@elie-laloum/outpost 6.0.1 → 8.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 (619) hide show
  1. package/CHANGELOG.md +40 -0
  2. package/README.md +5 -3
  3. package/SECURITY.md +9 -1
  4. package/dist/adapters/agents/antigravity-adapter.js +7 -2
  5. package/dist/adapters/agents/antigravity-adapter.js.map +1 -1
  6. package/dist/adapters/agents/antigravity-diagnostics.js +1 -1
  7. package/dist/adapters/agents/antigravity-diagnostics.js.map +1 -1
  8. package/dist/adapters/agents/antigravity-events.js +19 -10
  9. package/dist/adapters/agents/antigravity-events.js.map +1 -1
  10. package/dist/adapters/agents/antigravity-request.js +9 -1
  11. package/dist/adapters/agents/antigravity-request.js.map +1 -1
  12. package/dist/adapters/agents/antigravity.constants.d.ts +3 -0
  13. package/dist/adapters/agents/antigravity.constants.js +4 -0
  14. package/dist/adapters/agents/antigravity.constants.js.map +1 -0
  15. package/dist/adapters/agents/claude-adapter.js +3 -0
  16. package/dist/adapters/agents/claude-adapter.js.map +1 -1
  17. package/dist/adapters/agents/claude-events.js +77 -10
  18. package/dist/adapters/agents/claude-events.js.map +1 -1
  19. package/dist/adapters/agents/claude-request.js +2 -0
  20. package/dist/adapters/agents/claude-request.js.map +1 -1
  21. package/dist/adapters/agents/cli-diagnostics.d.ts +1 -1
  22. package/dist/adapters/agents/cli-diagnostics.js +15 -8
  23. package/dist/adapters/agents/cli-diagnostics.js.map +1 -1
  24. package/dist/adapters/agents/codex-adapter.js +3 -0
  25. package/dist/adapters/agents/codex-adapter.js.map +1 -1
  26. package/dist/adapters/agents/codex-events.js +28 -2
  27. package/dist/adapters/agents/codex-events.js.map +1 -1
  28. package/dist/adapters/agents/copilot-adapter.js +11 -2
  29. package/dist/adapters/agents/copilot-adapter.js.map +1 -1
  30. package/dist/adapters/agents/copilot-authentication.js +2 -1
  31. package/dist/adapters/agents/copilot-authentication.js.map +1 -1
  32. package/dist/adapters/agents/copilot-diagnostics.js +1 -1
  33. package/dist/adapters/agents/copilot-diagnostics.js.map +1 -1
  34. package/dist/adapters/agents/copilot-events.js +23 -3
  35. package/dist/adapters/agents/copilot-events.js.map +1 -1
  36. package/dist/adapters/agents/copilot-request.js +6 -1
  37. package/dist/adapters/agents/copilot-request.js.map +1 -1
  38. package/dist/adapters/agents/copilot-usage.d.ts +3 -0
  39. package/dist/adapters/agents/copilot-usage.js +19 -0
  40. package/dist/adapters/agents/copilot-usage.js.map +1 -0
  41. package/dist/adapters/agents/kimi-adapter.js +22 -3
  42. package/dist/adapters/agents/kimi-adapter.js.map +1 -1
  43. package/dist/adapters/agents/kimi-authentication.d.ts +2 -1
  44. package/dist/adapters/agents/kimi-authentication.js +41 -26
  45. package/dist/adapters/agents/kimi-authentication.js.map +1 -1
  46. package/dist/adapters/agents/kimi-diagnostics.d.ts +2 -1
  47. package/dist/adapters/agents/kimi-diagnostics.js +9 -1
  48. package/dist/adapters/agents/kimi-diagnostics.js.map +1 -1
  49. package/dist/adapters/agents/kimi-events.js +4 -0
  50. package/dist/adapters/agents/kimi-events.js.map +1 -1
  51. package/dist/adapters/agents/kimi-fork.d.ts +2 -0
  52. package/dist/adapters/agents/kimi-fork.js +11 -0
  53. package/dist/adapters/agents/kimi-fork.js.map +1 -0
  54. package/dist/adapters/agents/kimi-request.js +6 -1
  55. package/dist/adapters/agents/kimi-request.js.map +1 -1
  56. package/dist/adapters/agents/kimi-usage.d.ts +2 -0
  57. package/dist/adapters/agents/kimi-usage.js +7 -0
  58. package/dist/adapters/agents/kimi-usage.js.map +1 -0
  59. package/dist/adapters/agents/kimi.constants.d.ts +13 -0
  60. package/dist/adapters/agents/kimi.constants.js +14 -0
  61. package/dist/adapters/agents/kimi.constants.js.map +1 -0
  62. package/dist/adapters/agents/kimi.types.d.ts +1 -0
  63. package/dist/adapters/agents/kimi.types.js.map +1 -1
  64. package/dist/adapters/agents/protocol-fixtures.constants.js +15 -19
  65. package/dist/adapters/agents/protocol-fixtures.constants.js.map +1 -1
  66. package/dist/adapters/agents/quota.constants.d.ts +7 -0
  67. package/dist/adapters/agents/quota.constants.js +31 -0
  68. package/dist/adapters/agents/quota.constants.js.map +1 -0
  69. package/dist/adapters/agents/quota.d.ts +1 -0
  70. package/dist/adapters/agents/quota.js +4 -0
  71. package/dist/adapters/agents/quota.js.map +1 -0
  72. package/dist/adapters/agents/session-usage.constants.d.ts +10 -0
  73. package/dist/adapters/agents/session-usage.constants.js +110 -0
  74. package/dist/adapters/agents/session-usage.constants.js.map +1 -0
  75. package/dist/adapters/agents/session-usage.d.ts +5 -0
  76. package/dist/adapters/agents/session-usage.js +45 -0
  77. package/dist/adapters/agents/session-usage.js.map +1 -0
  78. package/dist/adapters/agents/settings.types.d.ts +1 -0
  79. package/dist/adapters/agents/settings.types.js.map +1 -1
  80. package/dist/adapters/agents/tool-result.d.ts +2 -0
  81. package/dist/adapters/agents/tool-result.js +17 -0
  82. package/dist/adapters/agents/tool-result.js.map +1 -0
  83. package/dist/adapters/models/anthropic-response.js +3 -0
  84. package/dist/adapters/models/anthropic-response.js.map +1 -1
  85. package/dist/adapters/models/http-provider.js +13 -2
  86. package/dist/adapters/models/http-provider.js.map +1 -1
  87. package/dist/adapters/models/model.constants.d.ts +2 -0
  88. package/dist/adapters/models/model.constants.js +6 -0
  89. package/dist/adapters/models/model.constants.js.map +1 -1
  90. package/dist/adapters/models/openai-responses.js +10 -0
  91. package/dist/adapters/models/openai-responses.js.map +1 -1
  92. package/dist/adapters/models/retry-after.d.ts +1 -0
  93. package/dist/adapters/models/retry-after.js +16 -0
  94. package/dist/adapters/models/retry-after.js.map +1 -0
  95. package/dist/adapters/models/stream-events.js +11 -7
  96. package/dist/adapters/models/stream-events.js.map +1 -1
  97. package/dist/application/activity-watchdog.js +1 -2
  98. package/dist/application/activity-watchdog.js.map +1 -1
  99. package/dist/application/agent-bootstrap.constants.js +1 -3
  100. package/dist/application/agent-bootstrap.constants.js.map +1 -1
  101. package/dist/application/agent-bootstrap.js +9 -3
  102. package/dist/application/agent-bootstrap.js.map +1 -1
  103. package/dist/application/agent-bootstrap.types.d.ts +1 -2
  104. package/dist/application/agent-bootstrap.types.js.map +1 -1
  105. package/dist/application/agent-output.js +83 -8
  106. package/dist/application/agent-output.js.map +1 -1
  107. package/dist/application/agent-quota.d.ts +7 -0
  108. package/dist/application/agent-quota.js +33 -0
  109. package/dist/application/agent-quota.js.map +1 -0
  110. package/dist/application/agent-request.d.ts +3 -0
  111. package/dist/application/agent-request.js +11 -0
  112. package/dist/application/agent-request.js.map +1 -0
  113. package/dist/application/agent-turn.js +90 -6
  114. package/dist/application/agent-turn.js.map +1 -1
  115. package/dist/application/agent-usage.d.ts +6 -0
  116. package/dist/application/agent-usage.js +57 -0
  117. package/dist/application/agent-usage.js.map +1 -0
  118. package/dist/application/attach.js +2 -0
  119. package/dist/application/attach.js.map +1 -1
  120. package/dist/application/custom-turn.js +44 -49
  121. package/dist/application/custom-turn.js.map +1 -1
  122. package/dist/application/dispatch-observation.d.ts +1 -1
  123. package/dist/application/dispatch-observation.js +150 -21
  124. package/dist/application/dispatch-observation.js.map +1 -1
  125. package/dist/application/dispatch-observation.types.d.ts +2 -0
  126. package/dist/application/dispatch-observation.types.js.map +1 -1
  127. package/dist/application/dispatch-validation.js +2 -0
  128. package/dist/application/dispatch-validation.js.map +1 -1
  129. package/dist/application/dispatch.js +1 -1
  130. package/dist/application/dispatch.js.map +1 -1
  131. package/dist/application/doctor-agent.constants.js +3 -0
  132. package/dist/application/doctor-agent.constants.js.map +1 -1
  133. package/dist/application/doctor-agent.js +6 -2
  134. package/dist/application/doctor-agent.js.map +1 -1
  135. package/dist/application/doctor.js +26 -6
  136. package/dist/application/doctor.js.map +1 -1
  137. package/dist/application/doctor.types.d.ts +1 -0
  138. package/dist/application/doctor.types.js.map +1 -1
  139. package/dist/application/execution.constants.d.ts +2 -0
  140. package/dist/application/execution.constants.js +2 -0
  141. package/dist/application/execution.constants.js.map +1 -1
  142. package/dist/application/execution.types.d.ts +10 -0
  143. package/dist/application/execution.types.js.map +1 -1
  144. package/dist/application/harness-budget.d.ts +3 -0
  145. package/dist/application/harness-budget.js +42 -0
  146. package/dist/application/harness-budget.js.map +1 -0
  147. package/dist/application/harness-budget.types.d.ts +5 -0
  148. package/dist/application/harness-budget.types.js +2 -0
  149. package/dist/application/harness-budget.types.js.map +1 -0
  150. package/dist/application/harness-hooks.js +34 -3
  151. package/dist/application/harness-hooks.js.map +1 -1
  152. package/dist/application/harness-loop.js +52 -24
  153. package/dist/application/harness-loop.js.map +1 -1
  154. package/dist/application/harness-model-provider.d.ts +3 -0
  155. package/dist/application/harness-model-provider.js +49 -0
  156. package/dist/application/harness-model-provider.js.map +1 -0
  157. package/dist/application/harness-model-provider.types.d.ts +10 -0
  158. package/dist/application/harness-model-provider.types.js +2 -0
  159. package/dist/application/harness-model-provider.types.js.map +1 -0
  160. package/dist/application/harness-subagent.d.ts +4 -0
  161. package/dist/application/harness-subagent.js +110 -0
  162. package/dist/application/harness-subagent.js.map +1 -0
  163. package/dist/application/harness.types.d.ts +11 -0
  164. package/dist/application/harness.types.js.map +1 -1
  165. package/dist/application/interactive-task-execution.d.ts +3 -0
  166. package/dist/application/interactive-task-execution.js +76 -0
  167. package/dist/application/interactive-task-execution.js.map +1 -0
  168. package/dist/application/interactive-task-protocol.d.ts +4 -0
  169. package/dist/application/interactive-task-protocol.js +56 -0
  170. package/dist/application/interactive-task-protocol.js.map +1 -0
  171. package/dist/application/interactive-task.constants.d.ts +4 -0
  172. package/dist/application/interactive-task.constants.js +7 -0
  173. package/dist/application/interactive-task.constants.js.map +1 -0
  174. package/dist/application/interactive-task.d.ts +3 -0
  175. package/dist/application/interactive-task.js +84 -0
  176. package/dist/application/interactive-task.js.map +1 -0
  177. package/dist/application/interactive-task.types.d.ts +44 -0
  178. package/dist/application/interactive-task.types.js +2 -0
  179. package/dist/application/interactive-task.types.js.map +1 -0
  180. package/dist/application/lifecycle-hooks.d.ts +1 -1
  181. package/dist/application/lifecycle-hooks.js +5 -4
  182. package/dist/application/lifecycle-hooks.js.map +1 -1
  183. package/dist/application/observed-lease.d.ts +3 -0
  184. package/dist/application/observed-lease.js +26 -0
  185. package/dist/application/observed-lease.js.map +1 -0
  186. package/dist/application/outpost.types.d.ts +3 -0
  187. package/dist/application/outpost.types.js.map +1 -1
  188. package/dist/application/output-lines.d.ts +4 -0
  189. package/dist/application/output-lines.js +28 -0
  190. package/dist/application/output-lines.js.map +1 -0
  191. package/dist/application/queue-worker.js +19 -1
  192. package/dist/application/queue-worker.js.map +1 -1
  193. package/dist/application/queue-worker.types.d.ts +1 -0
  194. package/dist/application/queue-worker.types.js.map +1 -1
  195. package/dist/application/queued-task.js +40 -6
  196. package/dist/application/queued-task.js.map +1 -1
  197. package/dist/application/quota-resume.constants.d.ts +1 -0
  198. package/dist/application/quota-resume.constants.js +2 -0
  199. package/dist/application/quota-resume.constants.js.map +1 -0
  200. package/dist/application/quota-resume.d.ts +9 -0
  201. package/dist/application/quota-resume.js +34 -0
  202. package/dist/application/quota-resume.js.map +1 -0
  203. package/dist/application/quota-resume.types.d.ts +1 -0
  204. package/dist/application/quota-resume.types.js +2 -0
  205. package/dist/application/quota-resume.types.js.map +1 -0
  206. package/dist/application/recovery-archive.d.ts +3 -2
  207. package/dist/application/recovery-archive.js +9 -2
  208. package/dist/application/recovery-archive.js.map +1 -1
  209. package/dist/application/recovery-restore.d.ts +3 -2
  210. package/dist/application/recovery-restore.js +9 -2
  211. package/dist/application/recovery-restore.js.map +1 -1
  212. package/dist/application/recovery-retention-policy.js +1 -1
  213. package/dist/application/recovery-retention-policy.js.map +1 -1
  214. package/dist/application/recovery-retention.d.ts +3 -2
  215. package/dist/application/recovery-retention.js +12 -5
  216. package/dist/application/recovery-retention.js.map +1 -1
  217. package/dist/application/recovery-retention.types.d.ts +1 -1
  218. package/dist/application/recovery-retention.types.js.map +1 -1
  219. package/dist/application/remote-workspace.js +7 -5
  220. package/dist/application/remote-workspace.js.map +1 -1
  221. package/dist/application/remote-workspace.types.d.ts +1 -0
  222. package/dist/application/remote-workspace.types.js.map +1 -1
  223. package/dist/application/replay-recording.d.ts +2 -0
  224. package/dist/application/replay-recording.js +22 -0
  225. package/dist/application/replay-recording.js.map +1 -0
  226. package/dist/application/replay-turn.d.ts +4 -0
  227. package/dist/application/replay-turn.js +47 -0
  228. package/dist/application/replay-turn.js.map +1 -0
  229. package/dist/application/replay-workspace.d.ts +4 -0
  230. package/dist/application/replay-workspace.js +71 -0
  231. package/dist/application/replay-workspace.js.map +1 -0
  232. package/dist/application/replay-workspace.types.d.ts +6 -0
  233. package/dist/application/replay-workspace.types.js +2 -0
  234. package/dist/application/replay-workspace.types.js.map +1 -0
  235. package/dist/application/repository-fingerprint.d.ts +1 -0
  236. package/dist/application/repository-fingerprint.js +18 -0
  237. package/dist/application/repository-fingerprint.js.map +1 -0
  238. package/dist/application/sandbox-agents.js +11 -12
  239. package/dist/application/sandbox-agents.js.map +1 -1
  240. package/dist/application/sandbox-attach.js +12 -3
  241. package/dist/application/sandbox-attach.js.map +1 -1
  242. package/dist/application/sandbox-dispatch.js +15 -25
  243. package/dist/application/sandbox-dispatch.js.map +1 -1
  244. package/dist/application/sandbox-provision.js +15 -9
  245. package/dist/application/sandbox-provision.js.map +1 -1
  246. package/dist/application/sandbox-session.types.d.ts +2 -2
  247. package/dist/application/sandbox-session.types.js.map +1 -1
  248. package/dist/application/sandbox.js +13 -6
  249. package/dist/application/sandbox.js.map +1 -1
  250. package/dist/application/speculation-checkpoint.d.ts +6 -0
  251. package/dist/application/speculation-checkpoint.js +223 -0
  252. package/dist/application/speculation-checkpoint.js.map +1 -0
  253. package/dist/application/speculation-checkpoint.types.d.ts +24 -0
  254. package/dist/application/speculation-checkpoint.types.js +2 -0
  255. package/dist/application/speculation-checkpoint.types.js.map +1 -0
  256. package/dist/application/speculation-integration.constants.d.ts +4 -0
  257. package/dist/application/speculation-integration.constants.js +5 -0
  258. package/dist/application/speculation-integration.constants.js.map +1 -0
  259. package/dist/application/speculation-integration.d.ts +2 -0
  260. package/dist/application/speculation-integration.js +67 -0
  261. package/dist/application/speculation-integration.js.map +1 -0
  262. package/dist/application/speculation-resume.d.ts +4 -0
  263. package/dist/application/speculation-resume.js +92 -0
  264. package/dist/application/speculation-resume.js.map +1 -0
  265. package/dist/application/speculation-run.d.ts +4 -0
  266. package/dist/application/speculation-run.js +337 -0
  267. package/dist/application/speculation-run.js.map +1 -0
  268. package/dist/application/speculation-timeout.d.ts +1 -0
  269. package/dist/application/speculation-timeout.js +15 -0
  270. package/dist/application/speculation-timeout.js.map +1 -0
  271. package/dist/application/speculation.constants.d.ts +1 -0
  272. package/dist/application/speculation.constants.js +5 -1
  273. package/dist/application/speculation.constants.js.map +1 -1
  274. package/dist/application/speculation.js +41 -149
  275. package/dist/application/speculation.js.map +1 -1
  276. package/dist/application/speculation.types.d.ts +30 -2
  277. package/dist/application/speculation.types.js.map +1 -1
  278. package/dist/application/startup-recovery.js +13 -0
  279. package/dist/application/startup-recovery.js.map +1 -1
  280. package/dist/application/startup-recovery.types.d.ts +1 -0
  281. package/dist/application/startup-recovery.types.js.map +1 -1
  282. package/dist/application/stop-reason.d.ts +2 -0
  283. package/dist/application/stop-reason.js +21 -0
  284. package/dist/application/stop-reason.js.map +1 -0
  285. package/dist/application/stop-reason.types.d.ts +4 -0
  286. package/dist/application/stop-reason.types.js +2 -0
  287. package/dist/application/stop-reason.types.js.map +1 -0
  288. package/dist/application/task-observation.d.ts +3 -0
  289. package/dist/application/task-observation.js +22 -0
  290. package/dist/application/task-observation.js.map +1 -0
  291. package/dist/application/task-usage.js +5 -12
  292. package/dist/application/task-usage.js.map +1 -1
  293. package/dist/application/tasks.d.ts +2 -2
  294. package/dist/application/tasks.js +52 -20
  295. package/dist/application/tasks.js.map +1 -1
  296. package/dist/application/tasks.types.d.ts +5 -0
  297. package/dist/application/tasks.types.js.map +1 -1
  298. package/dist/application/tool-execution.js +42 -19
  299. package/dist/application/tool-execution.js.map +1 -1
  300. package/dist/application/transport-inspection.constants.js +1 -0
  301. package/dist/application/transport-inspection.constants.js.map +1 -1
  302. package/dist/application/transport-retention.js +33 -1
  303. package/dist/application/transport-retention.js.map +1 -1
  304. package/dist/application/workspace.js +6 -4
  305. package/dist/application/workspace.js.map +1 -1
  306. package/dist/cli/doctor-command.js +1 -1
  307. package/dist/cli/doctor-command.js.map +1 -1
  308. package/dist/cli/main.js +2 -1
  309. package/dist/cli/main.js.map +1 -1
  310. package/dist/cli/scaffold.constants.js +3 -2
  311. package/dist/cli/scaffold.constants.js.map +1 -1
  312. package/dist/domain/agent-observation.d.ts +4 -0
  313. package/dist/domain/agent-observation.js +28 -0
  314. package/dist/domain/agent-observation.js.map +1 -0
  315. package/dist/domain/agent.types.d.ts +83 -4
  316. package/dist/domain/agent.types.js.map +1 -1
  317. package/dist/domain/errors.types.d.ts +1 -1
  318. package/dist/domain/errors.types.js.map +1 -1
  319. package/dist/domain/harness.js +6 -0
  320. package/dist/domain/harness.js.map +1 -1
  321. package/dist/domain/harness.types.d.ts +2 -1
  322. package/dist/domain/harness.types.js.map +1 -1
  323. package/dist/domain/model.types.d.ts +8 -0
  324. package/dist/domain/model.types.js.map +1 -1
  325. package/dist/domain/observation.constants.d.ts +8 -0
  326. package/dist/domain/observation.constants.js +9 -0
  327. package/dist/domain/observation.constants.js.map +1 -0
  328. package/dist/domain/observation.d.ts +2 -0
  329. package/dist/domain/observation.js +190 -0
  330. package/dist/domain/observation.js.map +1 -0
  331. package/dist/domain/observation.types.d.ts +89 -0
  332. package/dist/domain/observation.types.js +2 -0
  333. package/dist/domain/observation.types.js.map +1 -0
  334. package/dist/domain/observed-operation.d.ts +2 -0
  335. package/dist/domain/observed-operation.js +30 -0
  336. package/dist/domain/observed-operation.js.map +1 -0
  337. package/dist/domain/quota.constants.d.ts +1 -0
  338. package/dist/domain/quota.constants.js +2 -0
  339. package/dist/domain/quota.constants.js.map +1 -0
  340. package/dist/domain/quota.d.ts +4 -0
  341. package/dist/domain/quota.js +28 -0
  342. package/dist/domain/quota.js.map +1 -0
  343. package/dist/domain/quota.types.d.ts +7 -0
  344. package/dist/domain/quota.types.js +2 -0
  345. package/dist/domain/quota.types.js.map +1 -0
  346. package/dist/domain/replay.constants.d.ts +11 -0
  347. package/dist/domain/replay.constants.js +42 -0
  348. package/dist/domain/replay.constants.js.map +1 -0
  349. package/dist/domain/replay.d.ts +11 -0
  350. package/dist/domain/replay.js +231 -0
  351. package/dist/domain/replay.js.map +1 -0
  352. package/dist/domain/replay.types.d.ts +84 -0
  353. package/dist/domain/replay.types.js +2 -0
  354. package/dist/domain/replay.types.js.map +1 -0
  355. package/dist/domain/sandbox.types.d.ts +2 -0
  356. package/dist/domain/sandbox.types.js.map +1 -1
  357. package/dist/domain/subagent.constants.d.ts +13 -0
  358. package/dist/domain/subagent.constants.js +9 -0
  359. package/dist/domain/subagent.constants.js.map +1 -0
  360. package/dist/domain/subagent.d.ts +4 -0
  361. package/dist/domain/subagent.js +28 -0
  362. package/dist/domain/subagent.js.map +1 -0
  363. package/dist/domain/subagent.types.d.ts +13 -0
  364. package/dist/domain/subagent.types.js +2 -0
  365. package/dist/domain/subagent.types.js.map +1 -0
  366. package/dist/domain/task-queue.js +18 -0
  367. package/dist/domain/task-queue.js.map +1 -1
  368. package/dist/domain/task-queue.types.d.ts +9 -0
  369. package/dist/domain/task-queue.types.js.map +1 -1
  370. package/dist/domain/transcript.types.d.ts +2 -0
  371. package/dist/domain/transcript.types.js.map +1 -1
  372. package/dist/domain/usage.d.ts +1 -0
  373. package/dist/domain/usage.js +16 -0
  374. package/dist/domain/usage.js.map +1 -1
  375. package/dist/domain/workflow/budget.d.ts +7 -3
  376. package/dist/domain/workflow/budget.js +26 -0
  377. package/dist/domain/workflow/budget.js.map +1 -1
  378. package/dist/domain/workflow/budget.types.d.ts +1 -1
  379. package/dist/domain/workflow/budget.types.js.map +1 -1
  380. package/dist/domain/workflow/checkpoint-validation.js +21 -2
  381. package/dist/domain/workflow/checkpoint-validation.js.map +1 -1
  382. package/dist/domain/workflow/checkpoint.js +16 -2
  383. package/dist/domain/workflow/checkpoint.js.map +1 -1
  384. package/dist/domain/workflow/gate-validation.js +16 -2
  385. package/dist/domain/workflow/gate-validation.js.map +1 -1
  386. package/dist/domain/workflow/gates.d.ts +1 -1
  387. package/dist/domain/workflow/gates.js +52 -4
  388. package/dist/domain/workflow/gates.js.map +1 -1
  389. package/dist/domain/workflow/gates.types.d.ts +15 -1
  390. package/dist/domain/workflow/gates.types.js.map +1 -1
  391. package/dist/domain/workflow/idempotency.d.ts +1 -0
  392. package/dist/domain/workflow/idempotency.js +7 -0
  393. package/dist/domain/workflow/idempotency.js.map +1 -0
  394. package/dist/domain/workflow/input-validation.d.ts +7 -0
  395. package/dist/domain/workflow/input-validation.js +82 -0
  396. package/dist/domain/workflow/input-validation.js.map +1 -0
  397. package/dist/domain/workflow/input.d.ts +10 -0
  398. package/dist/domain/workflow/input.js +93 -0
  399. package/dist/domain/workflow/input.js.map +1 -0
  400. package/dist/domain/workflow/input.types.d.ts +37 -0
  401. package/dist/domain/workflow/input.types.js +2 -0
  402. package/dist/domain/workflow/input.types.js.map +1 -0
  403. package/dist/domain/workflow/loop-runner.d.ts +3 -0
  404. package/dist/domain/workflow/loop-runner.js +91 -0
  405. package/dist/domain/workflow/loop-runner.js.map +1 -0
  406. package/dist/domain/workflow/loop-task.d.ts +10 -0
  407. package/dist/domain/workflow/loop-task.js +39 -0
  408. package/dist/domain/workflow/loop-task.js.map +1 -0
  409. package/dist/domain/workflow/loop-task.types.d.ts +28 -0
  410. package/dist/domain/workflow/loop-task.types.js +2 -0
  411. package/dist/domain/workflow/loop-task.types.js.map +1 -0
  412. package/dist/domain/workflow/loop-validation.d.ts +4 -0
  413. package/dist/domain/workflow/loop-validation.js +62 -0
  414. package/dist/domain/workflow/loop-validation.js.map +1 -0
  415. package/dist/domain/workflow/quota-pause.d.ts +7 -0
  416. package/dist/domain/workflow/quota-pause.js +83 -0
  417. package/dist/domain/workflow/quota-pause.js.map +1 -0
  418. package/dist/domain/workflow/quota-pause.types.d.ts +14 -0
  419. package/dist/domain/workflow/quota-pause.types.js +2 -0
  420. package/dist/domain/workflow/quota-pause.types.js.map +1 -0
  421. package/dist/domain/workflow/quota-validation.d.ts +2 -0
  422. package/dist/domain/workflow/quota-validation.js +30 -0
  423. package/dist/domain/workflow/quota-validation.js.map +1 -0
  424. package/dist/domain/workflow/retry.constants.d.ts +2 -0
  425. package/dist/domain/workflow/retry.constants.js +3 -0
  426. package/dist/domain/workflow/retry.constants.js.map +1 -0
  427. package/dist/domain/workflow/retry.d.ts +4 -0
  428. package/dist/domain/workflow/retry.js +49 -0
  429. package/dist/domain/workflow/retry.js.map +1 -0
  430. package/dist/domain/workflow/task-cache-entry.d.ts +3 -0
  431. package/dist/domain/workflow/task-cache-entry.js +57 -0
  432. package/dist/domain/workflow/task-cache-entry.js.map +1 -0
  433. package/dist/domain/workflow/task-cache.constants.d.ts +3 -0
  434. package/dist/domain/workflow/task-cache.constants.js +3 -0
  435. package/dist/domain/workflow/task-cache.constants.js.map +1 -0
  436. package/dist/domain/workflow/task-cache.d.ts +6 -0
  437. package/dist/domain/workflow/task-cache.js +92 -0
  438. package/dist/domain/workflow/task-cache.js.map +1 -0
  439. package/dist/domain/workflow/task-cache.types.d.ts +35 -0
  440. package/dist/domain/workflow/task-cache.types.js +2 -0
  441. package/dist/domain/workflow/task-cache.types.js.map +1 -0
  442. package/dist/domain/workflow/task-runner.js +105 -35
  443. package/dist/domain/workflow/task-runner.js.map +1 -1
  444. package/dist/domain/workflow/task.js +26 -5
  445. package/dist/domain/workflow/task.js.map +1 -1
  446. package/dist/domain/workflow/validation.js +13 -2
  447. package/dist/domain/workflow/validation.js.map +1 -1
  448. package/dist/domain/workflow/workflow-scheduler.js +135 -72
  449. package/dist/domain/workflow/workflow-scheduler.js.map +1 -1
  450. package/dist/domain/workflow/workflow-state.js +48 -15
  451. package/dist/domain/workflow/workflow-state.js.map +1 -1
  452. package/dist/domain/workflow.d.ts +1 -1
  453. package/dist/domain/workflow.js +1 -1
  454. package/dist/domain/workflow.js.map +1 -1
  455. package/dist/domain/workflow.types.d.ts +38 -4
  456. package/dist/domain/workflow.types.js.map +1 -1
  457. package/dist/index.d.ts +28 -4
  458. package/dist/index.js +12 -1
  459. package/dist/index.js.map +1 -1
  460. package/dist/infrastructure/conversations/capture.js +10 -0
  461. package/dist/infrastructure/conversations/capture.js.map +1 -1
  462. package/dist/infrastructure/conversations/harness-transcript.js +6 -0
  463. package/dist/infrastructure/conversations/harness-transcript.js.map +1 -1
  464. package/dist/infrastructure/conversations/harness-transcript.types.d.ts +2 -0
  465. package/dist/infrastructure/conversations/harness-transcript.types.js.map +1 -1
  466. package/dist/infrastructure/conversations/layout.js +2 -0
  467. package/dist/infrastructure/conversations/layout.js.map +1 -1
  468. package/dist/infrastructure/conversations/locate.js +7 -1
  469. package/dist/infrastructure/conversations/locate.js.map +1 -1
  470. package/dist/infrastructure/conversations/native-store.js +8 -1
  471. package/dist/infrastructure/conversations/native-store.js.map +1 -1
  472. package/dist/infrastructure/conversations/paths.js +3 -0
  473. package/dist/infrastructure/conversations/paths.js.map +1 -1
  474. package/dist/infrastructure/conversations/restore.js +7 -0
  475. package/dist/infrastructure/conversations/restore.js.map +1 -1
  476. package/dist/infrastructure/conversations/session-bundle.constants.d.ts +5 -0
  477. package/dist/infrastructure/conversations/session-bundle.constants.js +173 -0
  478. package/dist/infrastructure/conversations/session-bundle.constants.js.map +1 -0
  479. package/dist/infrastructure/conversations/session-bundle.d.ts +6 -0
  480. package/dist/infrastructure/conversations/session-bundle.js +98 -0
  481. package/dist/infrastructure/conversations/session-bundle.js.map +1 -0
  482. package/dist/infrastructure/conversations/session-bundle.types.d.ts +1 -0
  483. package/dist/infrastructure/conversations/session-bundle.types.js +2 -0
  484. package/dist/infrastructure/conversations/session-bundle.types.js.map +1 -0
  485. package/dist/infrastructure/conversations.js +4 -2
  486. package/dist/infrastructure/conversations.js.map +1 -1
  487. package/dist/infrastructure/conversations.types.d.ts +1 -1
  488. package/dist/infrastructure/conversations.types.js.map +1 -1
  489. package/dist/infrastructure/custom-reporter.js +32 -24
  490. package/dist/infrastructure/custom-reporter.js.map +1 -1
  491. package/dist/infrastructure/custom-reporter.types.d.ts +2 -0
  492. package/dist/infrastructure/custom-reporter.types.js.map +1 -1
  493. package/dist/infrastructure/git/command.d.ts +2 -1
  494. package/dist/infrastructure/git/command.js +2 -2
  495. package/dist/infrastructure/git/command.js.map +1 -1
  496. package/dist/infrastructure/git/replay-commits.constants.d.ts +5 -0
  497. package/dist/infrastructure/git/replay-commits.constants.js +6 -0
  498. package/dist/infrastructure/git/replay-commits.constants.js.map +1 -0
  499. package/dist/infrastructure/git/replay-commits.d.ts +2 -0
  500. package/dist/infrastructure/git/replay-commits.js +92 -0
  501. package/dist/infrastructure/git/replay-commits.js.map +1 -0
  502. package/dist/infrastructure/git/workspace-lease.js +4 -3
  503. package/dist/infrastructure/git/workspace-lease.js.map +1 -1
  504. package/dist/infrastructure/git/workspace.js +7 -6
  505. package/dist/infrastructure/git/workspace.js.map +1 -1
  506. package/dist/infrastructure/git/workspace.types.d.ts +1 -0
  507. package/dist/infrastructure/git/workspace.types.js.map +1 -1
  508. package/dist/infrastructure/journal.constants.js +10 -1
  509. package/dist/infrastructure/journal.constants.js.map +1 -1
  510. package/dist/infrastructure/journal.d.ts +1 -1
  511. package/dist/infrastructure/journal.js +2 -2
  512. package/dist/infrastructure/journal.js.map +1 -1
  513. package/dist/infrastructure/journal.types.d.ts +3 -2
  514. package/dist/infrastructure/journal.types.js.map +1 -1
  515. package/dist/infrastructure/opentelemetry-dispatch.d.ts +3 -3
  516. package/dist/infrastructure/opentelemetry-dispatch.js +5 -4
  517. package/dist/infrastructure/opentelemetry-dispatch.js.map +1 -1
  518. package/dist/infrastructure/opentelemetry-observation.d.ts +5 -0
  519. package/dist/infrastructure/opentelemetry-observation.js +59 -0
  520. package/dist/infrastructure/opentelemetry-observation.js.map +1 -0
  521. package/dist/infrastructure/opentelemetry.js +15 -1
  522. package/dist/infrastructure/opentelemetry.js.map +1 -1
  523. package/dist/infrastructure/opentelemetry.types.d.ts +9 -1
  524. package/dist/infrastructure/opentelemetry.types.js.map +1 -1
  525. package/dist/infrastructure/reporter.d.ts +2 -2
  526. package/dist/infrastructure/reporter.js +8 -1
  527. package/dist/infrastructure/reporter.js.map +1 -1
  528. package/dist/infrastructure/s3-transport.constants.d.ts +2 -0
  529. package/dist/infrastructure/s3-transport.constants.js +3 -0
  530. package/dist/infrastructure/s3-transport.constants.js.map +1 -0
  531. package/dist/infrastructure/s3-transport.js +57 -3
  532. package/dist/infrastructure/s3-transport.js.map +1 -1
  533. package/dist/infrastructure/s3-transport.types.d.ts +1 -0
  534. package/dist/infrastructure/s3-transport.types.js.map +1 -1
  535. package/dist/infrastructure/speculation-store.constants.d.ts +3 -0
  536. package/dist/infrastructure/speculation-store.constants.js +2 -0
  537. package/dist/infrastructure/speculation-store.constants.js.map +1 -0
  538. package/dist/infrastructure/speculation-store.d.ts +4 -0
  539. package/dist/infrastructure/speculation-store.js +73 -0
  540. package/dist/infrastructure/speculation-store.js.map +1 -0
  541. package/dist/infrastructure/speculation-store.types.d.ts +12 -0
  542. package/dist/infrastructure/speculation-store.types.js +2 -0
  543. package/dist/infrastructure/speculation-store.types.js.map +1 -0
  544. package/dist/infrastructure/storage-inventory.types.d.ts +1 -1
  545. package/dist/infrastructure/storage-inventory.types.js.map +1 -1
  546. package/dist/infrastructure/task-queue-bullmq-resources.js +3 -0
  547. package/dist/infrastructure/task-queue-bullmq-resources.js.map +1 -1
  548. package/dist/infrastructure/task-queue-http.js +29 -4
  549. package/dist/infrastructure/task-queue-http.js.map +1 -1
  550. package/dist/infrastructure/task-queue-http.types.d.ts +2 -2
  551. package/dist/infrastructure/task-queue-http.types.js.map +1 -1
  552. package/dist/infrastructure/transport-conversations.js +2 -0
  553. package/dist/infrastructure/transport-conversations.js.map +1 -1
  554. package/dist/infrastructure/transport-journal.d.ts +1 -1
  555. package/dist/infrastructure/transport-journal.js +8 -2
  556. package/dist/infrastructure/transport-journal.js.map +1 -1
  557. package/dist/infrastructure/transport-task-cache.constants.d.ts +2 -0
  558. package/dist/infrastructure/transport-task-cache.constants.js +3 -0
  559. package/dist/infrastructure/transport-task-cache.constants.js.map +1 -0
  560. package/dist/infrastructure/transport-task-cache.d.ts +3 -0
  561. package/dist/infrastructure/transport-task-cache.js +56 -0
  562. package/dist/infrastructure/transport-task-cache.js.map +1 -0
  563. package/dist/infrastructure/transport-task-cache.types.d.ts +4 -0
  564. package/dist/infrastructure/transport-task-cache.types.js +2 -0
  565. package/dist/infrastructure/transport-task-cache.types.js.map +1 -0
  566. package/dist/infrastructure/workflow-decision-signature.constants.d.ts +4 -0
  567. package/dist/infrastructure/workflow-decision-signature.constants.js +5 -0
  568. package/dist/infrastructure/workflow-decision-signature.constants.js.map +1 -0
  569. package/dist/infrastructure/workflow-decision-signature.d.ts +4 -0
  570. package/dist/infrastructure/workflow-decision-signature.js +83 -0
  571. package/dist/infrastructure/workflow-decision-signature.js.map +1 -0
  572. package/dist/infrastructure/workflow-decision-signature.types.d.ts +16 -0
  573. package/dist/infrastructure/workflow-decision-signature.types.js +2 -0
  574. package/dist/infrastructure/workflow-decision-signature.types.js.map +1 -0
  575. package/dist/providers/antigravity-install.constants.d.ts +2 -0
  576. package/dist/providers/antigravity-install.constants.js +28 -0
  577. package/dist/providers/antigravity-install.constants.js.map +1 -0
  578. package/dist/providers/antigravity-install.d.ts +2 -0
  579. package/dist/providers/antigravity-install.js +29 -0
  580. package/dist/providers/antigravity-install.js.map +1 -0
  581. package/dist/providers/antigravity-install.types.d.ts +4 -0
  582. package/dist/providers/antigravity-install.types.js +2 -0
  583. package/dist/providers/antigravity-install.types.js.map +1 -0
  584. package/dist/providers/container-recovery.d.ts +4 -0
  585. package/dist/providers/container-recovery.js +28 -0
  586. package/dist/providers/container-recovery.js.map +1 -0
  587. package/dist/providers/container.js +8 -0
  588. package/dist/providers/container.js.map +1 -1
  589. package/dist/providers/daytona-network.constants.d.ts +5 -0
  590. package/dist/providers/daytona-network.constants.js +8 -0
  591. package/dist/providers/daytona-network.constants.js.map +1 -0
  592. package/dist/providers/daytona-network.d.ts +4 -0
  593. package/dist/providers/daytona-network.js +33 -0
  594. package/dist/providers/daytona-network.js.map +1 -0
  595. package/dist/providers/daytona.d.ts +1 -0
  596. package/dist/providers/daytona.js +9 -3
  597. package/dist/providers/daytona.js.map +1 -1
  598. package/dist/providers/daytona.types.d.ts +2 -0
  599. package/dist/providers/daytona.types.js.map +1 -1
  600. package/dist/providers/firecracker-command.js +1 -1
  601. package/dist/providers/firecracker-command.js.map +1 -1
  602. package/dist/providers/firecracker-jailer.constants.d.ts +9 -0
  603. package/dist/providers/firecracker-jailer.constants.js +10 -0
  604. package/dist/providers/firecracker-jailer.constants.js.map +1 -0
  605. package/dist/providers/firecracker-jailer.d.ts +4 -0
  606. package/dist/providers/firecracker-jailer.js +171 -0
  607. package/dist/providers/firecracker-jailer.js.map +1 -0
  608. package/dist/providers/firecracker-machine.js +30 -8
  609. package/dist/providers/firecracker-machine.js.map +1 -1
  610. package/dist/providers/firecracker.types.d.ts +16 -0
  611. package/dist/providers/firecracker.types.js.map +1 -1
  612. package/dist/providers/vercel-network.js +1 -1
  613. package/dist/providers/vercel-network.js.map +1 -1
  614. package/dist/providers/vercel.js +6 -3
  615. package/dist/providers/vercel.js.map +1 -1
  616. package/dist/providers/versions.constants.d.ts +1 -1
  617. package/dist/providers/versions.constants.js +1 -1
  618. package/dist/providers/versions.constants.js.map +1 -1
  619. package/package.json +1 -1
@@ -1,3 +1,5 @@
1
+ import { quotaMatcher } from "./quota.js";
2
+ import { codexQuotaPatterns } from "./quota.constants.js";
1
3
  import { credentialPlanner } from "./authentication.js";
2
4
  import { codexCredentials } from "./codex-authentication.js";
3
5
  import { codexProvider } from "./codex-provider.js";
@@ -18,6 +20,7 @@ function bindCodex(settings) {
18
20
  variables: Object.freeze({ ...settings.variables }),
19
21
  request: (input) => codexRequest(settings, input),
20
22
  events: codexEvents,
23
+ quota: quotaMatcher(codexQuotaPatterns),
21
24
  });
22
25
  }
23
26
  export function codexHarness(settings = {}) {
@@ -1 +1 @@
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"]}
1
+ {"version":3,"file":"codex-adapter.js","sourceRoot":"","sources":["../../../src/adapters/agents/codex-adapter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D,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;QACnB,KAAK,EAAE,YAAY,CAAC,kBAAkB,CAAC;KACjB,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 { quotaMatcher } from \"./quota.ts\";\nimport { codexQuotaPatterns } from \"./quota.constants.ts\";\nimport 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 quota: quotaMatcher(codexQuotaPatterns),\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,3 +1,4 @@
1
+ import { toolResult } from "./tool-result.js";
1
2
  import { decodeEvent, decodeLine } from "./event-decoder.js";
2
3
  import { asRecord, numberOrZero } from "./protocol.js";
3
4
  function conversation(event) {
@@ -7,16 +8,38 @@ function conversation(event) {
7
8
  }
8
9
  function completedItem(event) {
9
10
  return decodeEvent(asRecord(event.item), {
11
+ reasoning: (item) => typeof item.text === "string"
12
+ ? [{ kind: "reasoning", text: item.text }]
13
+ : [],
14
+ command_execution: (item) => toolResult(item.id, "command", item.aggregated_output, typeof item.exit_code === "number" && item.exit_code !== 0),
15
+ mcp_tool_call: (item) => toolResult(item.id, item.tool, item.result ?? item.error, item.error !== undefined && item.error !== null),
16
+ file_change: (item) => [
17
+ {
18
+ kind: "file-change",
19
+ changes: item.changes,
20
+ ...(typeof item.id === "string" ? { callId: item.id } : {}),
21
+ },
22
+ ],
10
23
  agent_message: (item) => typeof item.text === "string" ? [{ kind: "text", text: item.text }] : [],
11
24
  });
12
25
  }
13
26
  function startedItem(event) {
14
27
  return decodeEvent(asRecord(event.item), {
15
28
  command_execution: (item) => [
16
- { kind: "tool", name: "command", input: item.command },
29
+ {
30
+ kind: "tool",
31
+ name: "command",
32
+ input: item.command,
33
+ ...(typeof item.id === "string" ? { callId: item.id } : {}),
34
+ },
17
35
  ],
18
36
  mcp_tool_call: (item) => [
19
- { kind: "tool", name: String(item.tool), input: item.arguments },
37
+ {
38
+ kind: "tool",
39
+ name: String(item.tool),
40
+ input: item.arguments,
41
+ ...(typeof item.id === "string" ? { callId: item.id } : {}),
42
+ },
20
43
  ],
21
44
  });
22
45
  }
@@ -28,6 +51,9 @@ function completedTurn(event) {
28
51
  tokens: {
29
52
  input: numberOrZero(usage.input_tokens),
30
53
  cached: numberOrZero(usage.cached_input_tokens),
54
+ ...(typeof usage.cache_creation_input_tokens === "number"
55
+ ? { cacheCreated: numberOrZero(usage.cache_creation_input_tokens) }
56
+ : {}),
31
57
  output: numberOrZero(usage.output_tokens),
32
58
  },
33
59
  },
@@ -1 +1 @@
1
- {"version":3,"file":"codex-events.js","sourceRoot":"","sources":["../../../src/adapters/agents/codex-events.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAGvD,SAAS,YAAY,CAAC,KAAqB;IACzC,OAAO,OAAO,KAAK,CAAC,SAAS,KAAK,QAAQ;QACxC,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,cAAc,EAAE,EAAE,EAAE,KAAK,CAAC,SAAS,EAAE,CAAC;QACjD,CAAC,CAAC,EAAE,CAAC;AACT,CAAC;AAED,SAAS,aAAa,CAAC,KAAqB;IAC1C,OAAO,WAAW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C7B,CAAC,CAAC,KAAK,CAAC,KAAK;QACb,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC;IACpC,OAAO;QACL;YACE,IAAI,EAAE,SAAS;YACf,OAAO,EAAE,MAAM,CAAC,KAAK,CAAC,OAAO,IAAI,KAAK,IAAI,cAAc,CAAC;SAC1D;KACF,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,IAAY;IACtC,OAAO,UAAU,CAAC,IAAI,EAAE;QACtB,gBAAgB,EAAE,YAAY;QAC9B,gBAAgB,EAAE,aAAa;QAC/B,cAAc,EAAE,WAAW;QAC3B,gBAAgB,EAAE,aAAa;QAC/B,KAAK,EAAE,OAAO;QACd,aAAa,EAAE,OAAO;KACvB,CAAC,CAAC;AACL,CAAC","sourcesContent":["import type { AgentEvent } from \"../../domain/agent.types.ts\";\nimport { decodeEvent, decodeLine } from \"./event-decoder.ts\";\nimport { asRecord, numberOrZero } from \"./protocol.ts\";\nimport type { ProtocolRecord } from \"./protocol.types.ts\";\n\nfunction conversation(event: ProtocolRecord): AgentEvent[] {\n return typeof event.thread_id === \"string\"\n ? [{ kind: \"conversation\", id: event.thread_id }]\n : [];\n}\n\nfunction completedItem(event: ProtocolRecord): AgentEvent[] {\n return decodeEvent(asRecord(event.item), {\n agent_message: (item) =>\n typeof item.text === \"string\" ? [{ kind: \"text\", text: item.text }] : [],\n });\n}\n\nfunction startedItem(event: ProtocolRecord): AgentEvent[] {\n return decodeEvent(asRecord(event.item), {\n command_execution: (item) => [\n { kind: \"tool\", name: \"command\", input: item.command },\n ],\n mcp_tool_call: (item) => [\n { kind: \"tool\", name: String(item.tool), input: item.arguments },\n ],\n });\n}\n\nfunction completedTurn(event: ProtocolRecord): AgentEvent[] {\n const usage = asRecord(event.usage);\n return [\n {\n kind: \"usage\",\n tokens: {\n input: numberOrZero(usage.input_tokens),\n cached: numberOrZero(usage.cached_input_tokens),\n output: numberOrZero(usage.output_tokens),\n },\n },\n { kind: \"finished\" },\n ];\n}\n\nfunction failure(event: ProtocolRecord): AgentEvent[] {\n const error =\n typeof event.error === \"string\"\n ? event.error\n : asRecord(event.error).message;\n return [\n {\n kind: \"failure\",\n message: String(event.message ?? error ?? \"Agent failed\"),\n },\n ];\n}\n\nexport function codexEvents(line: string): AgentEvent[] {\n return decodeLine(line, {\n \"thread.started\": conversation,\n \"item.completed\": completedItem,\n \"item.started\": startedItem,\n \"turn.completed\": completedTurn,\n error: failure,\n \"turn.failed\": failure,\n });\n}\n"]}
1
+ {"version":3,"file":"codex-events.js","sourceRoot":"","sources":["../../../src/adapters/agents/codex-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,MAAM,eAAe,CAAC;AAGvD,SAAS,YAAY,CAAC,KAAqB;IACzC,OAAO,OAAO,KAAK,CAAC,SAAS,KAAK,QAAQ;QACxC,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,cAAc,EAAE,EAAE,EAAE,KAAK,CAAC,SAAS,EAAE,CAAC;QACjD,CAAC,CAAC,EAAE,CAAC;AACT,CAAC;AAED,SAAS,aAAa,CAAC,KAAqB;IAC1C,OAAO,WAAW,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE;QACvC,SAAS,EAAE,CAAC,IAAI,EAAE,EAAE,CAClB,OAAO,IAAI,CAAC,IAAI,KAAK,QAAQ;YAC3B,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC;YAC1C,CAAC,CAAC,EAAE;QACR,iBAAiB,EAAE,CAAC,IAAI,EAAE,EAAE,CAC1B,UAAU,CACR,IAAI,CAAC,EAAE,EACP,SAAS,EACT,IAAI,CAAC,iBA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1D;KACF,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,IAAY;IACtC,OAAO,UAAU,CAAC,IAAI,EAAE;QACtB,gBAAgB,EAAE,YAAY;QAC9B,gBAAgB,EAAE,aAAa;QAC/B,cAAc,EAAE,WAAW;QAC3B,gBAAgB,EAAE,aAAa;QAC/B,KAAK,EAAE,OAAO;QACd,aAAa,EAAE,OAAO;KACvB,CAAC,CAAC;AACL,CAAC","sourcesContent":["import { toolResult } from \"./tool-result.ts\";\nimport type { AgentEvent } from \"../../domain/agent.types.ts\";\nimport { decodeEvent, decodeLine } from \"./event-decoder.ts\";\nimport { asRecord, numberOrZero } from \"./protocol.ts\";\nimport type { ProtocolRecord } from \"./protocol.types.ts\";\n\nfunction conversation(event: ProtocolRecord): AgentEvent[] {\n return typeof event.thread_id === \"string\"\n ? [{ kind: \"conversation\", id: event.thread_id }]\n : [];\n}\n\nfunction completedItem(event: ProtocolRecord): AgentEvent[] {\n return decodeEvent(asRecord(event.item), {\n reasoning: (item) =>\n typeof item.text === \"string\"\n ? [{ kind: \"reasoning\", text: item.text }]\n : [],\n command_execution: (item) =>\n toolResult(\n item.id,\n \"command\",\n item.aggregated_output,\n typeof item.exit_code === \"number\" && item.exit_code !== 0,\n ),\n mcp_tool_call: (item) =>\n toolResult(\n item.id,\n item.tool,\n item.result ?? item.error,\n item.error !== undefined && item.error !== null,\n ),\n file_change: (item) => [\n {\n kind: \"file-change\",\n changes: item.changes,\n ...(typeof item.id === \"string\" ? { callId: item.id } : {}),\n },\n ],\n agent_message: (item) =>\n typeof item.text === \"string\" ? [{ kind: \"text\", text: item.text }] : [],\n });\n}\n\nfunction startedItem(event: ProtocolRecord): AgentEvent[] {\n return decodeEvent(asRecord(event.item), {\n command_execution: (item) => [\n {\n kind: \"tool\",\n name: \"command\",\n input: item.command,\n ...(typeof item.id === \"string\" ? { callId: item.id } : {}),\n },\n ],\n mcp_tool_call: (item) => [\n {\n kind: \"tool\",\n name: String(item.tool),\n input: item.arguments,\n ...(typeof item.id === \"string\" ? { callId: item.id } : {}),\n },\n ],\n });\n}\n\nfunction completedTurn(event: ProtocolRecord): AgentEvent[] {\n const usage = asRecord(event.usage);\n return [\n {\n kind: \"usage\",\n tokens: {\n input: numberOrZero(usage.input_tokens),\n cached: numberOrZero(usage.cached_input_tokens),\n ...(typeof usage.cache_creation_input_tokens === \"number\"\n ? { cacheCreated: numberOrZero(usage.cache_creation_input_tokens) }\n : {}),\n output: numberOrZero(usage.output_tokens),\n },\n },\n { kind: \"finished\" },\n ];\n}\n\nfunction failure(event: ProtocolRecord): AgentEvent[] {\n const error =\n typeof event.error === \"string\"\n ? event.error\n : asRecord(event.error).message;\n return [\n {\n kind: \"failure\",\n message: String(event.message ?? error ?? \"Agent failed\"),\n },\n ];\n}\n\nexport function codexEvents(line: string): AgentEvent[] {\n return decodeLine(line, {\n \"thread.started\": conversation,\n \"item.completed\": completedItem,\n \"item.started\": startedItem,\n \"turn.completed\": completedTurn,\n error: failure,\n \"turn.failed\": failure,\n });\n}\n"]}
@@ -1,3 +1,7 @@
1
+ import { quotaMatcher } from "./quota.js";
2
+ import { copilotQuotaPatterns } from "./quota.constants.js";
3
+ import { copilotUsage } from "./copilot-usage.js";
4
+ import { sessionUsageCommand, sessionUsageResult } from "./session-usage.js";
1
5
  import { credentialPlanner } from "./authentication.js";
2
6
  import { copilotCredentials } from "./copilot-authentication.js";
3
7
  import { copilotEvents } from "./copilot-events.js";
@@ -11,8 +15,9 @@ function bindCopilot(settings) {
11
15
  name: "copilot",
12
16
  ...(credentials ? { credentials } : {}),
13
17
  bootstrap: "copilot",
14
- resumable: false,
15
- capture: false,
18
+ resumable: true,
19
+ forkable: false,
20
+ conversations: "copilot",
16
21
  requiresFinishedEvent: true,
17
22
  variables: Object.freeze({
18
23
  COPILOT_AUTO_UPDATE: "false",
@@ -20,6 +25,10 @@ function bindCopilot(settings) {
20
25
  }),
21
26
  request: (input) => copilotRequest(settings, input),
22
27
  events: copilotEvents,
28
+ quota: quotaMatcher(copilotQuotaPatterns),
29
+ usage: "session",
30
+ usageCommand: (conversation) => sessionUsageCommand("copilot", conversation),
31
+ usageResult: (text) => sessionUsageResult(text, copilotUsage),
23
32
  });
24
33
  }
25
34
  export function copilotHarness(settings = {}) {
@@ -1 +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"]}
1
+ {"version":3,"file":"copilot-adapter.js","sourceRoot":"","sources":["../../../src/adapters/agents/copilot-adapter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAG7E,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,CAA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ent":["import { quotaMatcher } from \"./quota.ts\";\nimport { copilotQuotaPatterns } from \"./quota.constants.ts\";\nimport { copilotUsage } from \"./copilot-usage.ts\";\nimport { sessionUsageCommand, sessionUsageResult } from \"./session-usage.ts\";\nimport 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: true,\n forkable: false,\n conversations: \"copilot\",\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 quota: quotaMatcher(copilotQuotaPatterns),\n usage: \"session\",\n usageCommand: (conversation) =>\n sessionUsageCommand(\"copilot\", conversation),\n usageResult: (text) => sessionUsageResult(text, copilotUsage),\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"]}
@@ -18,9 +18,10 @@ function parseConfiguration(content) {
18
18
  function storedToken(content) {
19
19
  const configuration = parseConfiguration(content);
20
20
  const user = asRecord(configuration.lastLoggedInUser);
21
- const token = typeof user.host === "string" && typeof user.login === "string"
21
+ const stored = typeof user.host === "string" && typeof user.login === "string"
22
22
  ? asRecord(configuration.authTokens)[`${user.host}:${user.login}`]
23
23
  : undefined;
24
+ const token = typeof stored === "string" ? stored : asRecord(stored).token;
24
25
  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
26
  acceptToken(token);
26
27
  return token;
@@ -1 +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,a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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"]}
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,0CAA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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 stored =\n typeof user.host === \"string\" && typeof user.login === \"string\"\n ? asRecord(configuration.authTokens)[`${user.host}:${user.login}`]\n : undefined;\n const token = typeof stored === \"string\" ? stored : asRecord(stored).token;\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"]}
@@ -1,6 +1,6 @@
1
1
  import { helpDiagnostics } from "./cli-diagnostics.js";
2
2
  import { copilotRequest } from "./copilot-request.js";
3
3
  export function copilotDiagnostics() {
4
- return helpDiagnostics((input) => copilotRequest({}, input), "Usage: copilot [");
4
+ return helpDiagnostics((input) => copilotRequest({}, input), "Usage: copilot [", true);
5
5
  }
6
6
  //# sourceMappingURL=copilot-diagnostics.js.map
@@ -1 +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"]}
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,EAClB,IAAI,CACL,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 true,\n );\n}\n"]}
@@ -1,5 +1,8 @@
1
+ import { copilotShutdown, copilotUsage } from "./copilot-usage.js";
2
+ import { toolResult } from "./tool-result.js";
1
3
  import { decodeLine } from "./event-decoder.js";
2
4
  import { asRecord } from "./protocol.js";
5
+ import { copilotQuotaErrors } from "./quota.constants.js";
3
6
  function message(event) {
4
7
  const data = asRecord(event.data);
5
8
  const requests = Array.isArray(data.toolRequests) ? data.toolRequests : [];
@@ -38,12 +41,29 @@ function result(event) {
38
41
  export function copilotEvents(line) {
39
42
  return decodeLine(line, {
40
43
  "assistant.message": message,
41
- "session.error": (event) => {
44
+ "assistant.usage": (event) => [
45
+ { kind: "usage", tokens: copilotUsage(event.data) },
46
+ ],
47
+ "session.shutdown": copilotShutdown,
48
+ "assistant.reasoning": (event) => {
42
49
  const data = asRecord(event.data);
43
- return typeof data.message === "string"
44
- ? [{ kind: "warning", message: data.message }]
50
+ return typeof data.content === "string"
51
+ ? [{ kind: "reasoning", text: data.content }]
45
52
  : [];
46
53
  },
54
+ "tool.execution_complete": (event) => {
55
+ const data = asRecord(event.data);
56
+ return toolResult(data.toolCallId, undefined, data.result ?? data.error, data.success === false);
57
+ },
58
+ "session.error": (event) => {
59
+ const data = asRecord(event.data);
60
+ if (typeof data.message !== "string")
61
+ return [];
62
+ return typeof data.errorType === "string" &&
63
+ copilotQuotaErrors.has(data.errorType)
64
+ ? [{ kind: "quota", message: data.message }]
65
+ : [{ kind: "warning", message: data.message }];
66
+ },
47
67
  result,
48
68
  });
49
69
  }
@@ -1 +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,CAAC,CAAC,EA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AC,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"]}
1
+ {"version":3,"file":"copilot-events.js","sourceRoot":"","sources":["../../../src/adapters/agents/copilot-events.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACnE,OAAO,EAAE,UAAU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,SAAS,EACT,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,KAAK,EACzB,IAAI,CAAC,OAAO,KAAK,KAAK,CACvB,CAAC;QACJ,CAAC;QACD,eAAe,EAAE,CAAC,KAAK,EAAE,EAAE;YACzB,MAAM,IAAI,GAAG,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;YAClC,IAAI,OAAO,IAAI,CAAC,OAAO,KAAK,QAAQ;gBAAE,OAAO,EAAE,CAAC;YAChD,OAAO,OAAO,IAAI,CAAC,SAAS,KAAK,QAAQ;gBACvC,kBAAkB,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC;gBACtC,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,CAAC;gBAC5C,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC;QACnD,CAAC;QACD,MAAM;KACP,CAAC,CAAC;AACL,CAAC","sourcesContent":["import { copilotShutdown, copilotUsage } from \"./copilot-usage.ts\";\nimport { toolResult } from \"./tool-result.ts\";\nimport 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\";\nimport { copilotQuotaErrors } from \"./quota.constants.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 \"assistant.usage\": (event) => [\n { kind: \"usage\", tokens: copilotUsage(event.data) },\n ],\n \"session.shutdown\": copilotShutdown,\n \"assistant.reasoning\": (event) => {\n const data = asRecord(event.data);\n return typeof data.content === \"string\"\n ? [{ kind: \"reasoning\", text: data.content }]\n : [];\n },\n \"tool.execution_complete\": (event) => {\n const data = asRecord(event.data);\n return toolResult(\n data.toolCallId,\n undefined,\n data.result ?? data.error,\n data.success === false,\n );\n },\n \"session.error\": (event) => {\n const data = asRecord(event.data);\n if (typeof data.message !== \"string\") return [];\n return typeof data.errorType === \"string\" &&\n copilotQuotaErrors.has(data.errorType)\n ? [{ kind: \"quota\", message: data.message }]\n : [{ kind: \"warning\", message: data.message }];\n },\n result,\n });\n}\n"]}
@@ -1,7 +1,12 @@
1
+ import { validId } from "../../infrastructure/conversations/identity.js";
1
2
  import { invariant } from "../../domain/errors.js";
2
3
  export function copilotRequest(settings, input) {
3
- invariant(!input.continuation, "GitHub Copilot CLI does not support continuation or fork in Outpost");
4
+ invariant(!input.continuation?.fork, "GitHub Copilot CLI does not support automated fork in Outpost");
4
5
  const args = [];
6
+ if (input.continuation) {
7
+ validId(input.continuation.id);
8
+ args.push("--resume", input.continuation.id);
9
+ }
5
10
  if (settings.model)
6
11
  args.push("--model", settings.model.name);
7
12
  if (input.interactive)
@@ -1 +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"]}
1
+ {"version":3,"file":"copilot-request.js","sourceRoot":"","sources":["../../../src/adapters/agents/copilot-request.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,gDAAgD,CAAC;AAGzE,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAInD,MAAM,UAAU,cAAc,CAC5B,QAAgC,EAChC,KAAiB;IAEjB,SAAS,CACP,CAAC,KAAK,CAAC,YAAY,EAAE,IAAI,EACzB,+DAA+D,CAChE,CAAC;IACF,MAAM,IAAI,GAAa,EAAE,CAAC;IAC1B,IAAI,KAAK,CAAC,YAAY,EAAE,CAAC;QACvB,OAAO,CAAC,KAAK,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC;QAC/B,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,KAAK,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC;IAC/C,CAAC;IACD,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 { validId } from \"../../infrastructure/conversations/identity.ts\";\nimport 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?.fork,\n \"GitHub Copilot CLI does not support automated fork in Outpost\",\n );\n const args: string[] = [];\n if (input.continuation) {\n validId(input.continuation.id);\n args.push(\"--resume\", input.continuation.id);\n }\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"]}
@@ -0,0 +1,3 @@
1
+ import type { AgentEvent, Usage } from "../../domain/agent.types.ts";
2
+ export declare function copilotUsage(value: unknown): Usage;
3
+ export declare function copilotShutdown(event: Record<string, unknown>): AgentEvent[];
@@ -0,0 +1,19 @@
1
+ import { addUsage } from "../../domain/usage.js";
2
+ import { asRecord } from "./protocol.js";
3
+ import { usageCounts } from "./session-usage.js";
4
+ export function copilotUsage(value) {
5
+ const usage = asRecord(value);
6
+ return usageCounts(usage.inputTokens, usage.outputTokens, usage.cacheReadTokens, usage.cacheWriteTokens);
7
+ }
8
+ export function copilotShutdown(event) {
9
+ const metrics = asRecord(asRecord(event.data).modelMetrics);
10
+ const values = Object.values(metrics);
11
+ const tokens = values.reduce((total, metric) => addUsage(total, copilotUsage(asRecord(metric).usage)), {
12
+ input: 0,
13
+ cached: 0,
14
+ output: 0,
15
+ ...(values.length ? {} : { complete: false }),
16
+ });
17
+ return [{ kind: "usage", tokens, cumulative: true }];
18
+ }
19
+ //# sourceMappingURL=copilot-usage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"copilot-usage.js","sourceRoot":"","sources":["../../../src/adapters/agents/copilot-usage.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEjD,MAAM,UAAU,YAAY,CAAC,KAAc;IACzC,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC9B,OAAO,WAAW,CAChB,KAAK,CAAC,WAAW,EACjB,KAAK,CAAC,YAAY,EAClB,KAAK,CAAC,eAAe,EACrB,KAAK,CAAC,gBAAgB,CACvB,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,KAA8B;IAC5D,MAAM,OAAO,GAAG,QAAQ,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,YAAY,CAAC,CAAC;IAC5D,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IACtC,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAC1B,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,CAAC,QAAQ,CAAC,KAAK,EAAE,YAAY,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,CAAC,EACxE;QACE,KAAK,EAAE,CAAC;QACR,MAAM,EAAE,CAAC;QACT,MAAM,EAAE,CAAC;QACT,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;KAC9C,CACF,CAAC;IACF,OAAO,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC;AACvD,CAAC","sourcesContent":["import type { AgentEvent, Usage } from \"../../domain/agent.types.ts\";\nimport { addUsage } from \"../../domain/usage.ts\";\nimport { asRecord } from \"./protocol.ts\";\nimport { usageCounts } from \"./session-usage.ts\";\n\nexport function copilotUsage(value: unknown): Usage {\n const usage = asRecord(value);\n return usageCounts(\n usage.inputTokens,\n usage.outputTokens,\n usage.cacheReadTokens,\n usage.cacheWriteTokens,\n );\n}\n\nexport function copilotShutdown(event: Record<string, unknown>): AgentEvent[] {\n const metrics = asRecord(asRecord(event.data).modelMetrics);\n const values = Object.values(metrics);\n const tokens = values.reduce<Usage>(\n (total, metric) => addUsage(total, copilotUsage(asRecord(metric).usage)),\n {\n input: 0,\n cached: 0,\n output: 0,\n ...(values.length ? {} : { complete: false }),\n },\n );\n return [{ kind: \"usage\", tokens, cumulative: true }];\n}\n"]}
@@ -1,3 +1,11 @@
1
+ import { quotaMatcher } from "./quota.js";
2
+ import { kimiQuotaPatterns } from "./quota.constants.js";
3
+ import { kimiUsage } from "./kimi-usage.js";
4
+ import { sessionUsageCommand, sessionUsageResult } from "./session-usage.js";
5
+ import { forkKimi } from "./kimi-fork.js";
6
+ import { invariant } from "../../domain/errors.js";
7
+ import { authenticationForm } from "../../domain/authentication.js";
8
+ import { kimiRegions } from "./kimi.constants.js";
1
9
  import { credentialPlanner } from "./authentication.js";
2
10
  import { kimiCredentials } from "./kimi-authentication.js";
3
11
  import { kimiEvents } from "./kimi-events.js";
@@ -6,23 +14,34 @@ import { kimiModelSupport } from "./model-support.constants.js";
6
14
  import { harnessSettings, supportModel } from "./model-support.js";
7
15
  function bindKimi(settings) {
8
16
  supportModel(kimiModelSupport, settings.model);
9
- const credentials = credentialPlanner("Kimi Code", kimiCredentials, settings.authentication, settings.model);
17
+ const credentials = credentialPlanner("Kimi Code", kimiCredentials(settings.region), settings.authentication, settings.model);
10
18
  return Object.freeze({
11
19
  name: "kimi",
12
20
  ...(credentials ? { credentials } : {}),
13
21
  bootstrap: "kimi",
14
- resumable: false,
15
- capture: false,
22
+ resumable: true,
23
+ forkable: true,
24
+ fork: forkKimi,
25
+ conversations: "kimi",
16
26
  variables: Object.freeze({
17
27
  KIMI_CODE_NO_AUTO_UPDATE: "1",
18
28
  ...settings.variables,
19
29
  }),
20
30
  request: (input) => kimiRequest(settings, input),
21
31
  events: kimiEvents,
32
+ quota: quotaMatcher(kimiQuotaPatterns),
33
+ usage: "session",
34
+ usageCommand: (conversation) => sessionUsageCommand("kimi", conversation),
35
+ usageResult: (text) => sessionUsageResult(text, kimiUsage),
22
36
  });
23
37
  }
24
38
  export function kimiHarness(settings = {}) {
25
39
  harnessSettings(settings);
40
+ invariant(settings.region === undefined ||
41
+ Object.hasOwn(kimiRegions, settings.region), 'Kimi region must be "mainland-cn" or "global"');
42
+ invariant(settings.region === undefined ||
43
+ settings.authentication === undefined ||
44
+ !authenticationForm(settings.authentication).form.startsWith("usage"), "Kimi region selects account authentication; configure the API endpoint through variables for usage authentication");
26
45
  const configured = Object.freeze({
27
46
  ...settings,
28
47
  variables: Object.freeze({ ...settings.variables }),
@@ -1 +1 @@
1
- {"version":3,"file":"kimi-adapter.js","sourceRoot":"","sources":["../../../src/adapters/agents/kimi-adapter.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAGnE,SAAS,QAAQ,CAAC,QAA6B;IAC7C,YAAY,CAAC,gBAAgB,E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/model.types.ts\";\nimport { credentialPlanner } from \"./authentication.ts\";\nimport { kimiCredentials } from \"./kimi-authentication.ts\";\nimport { kimiEvents } from \"./kimi-events.ts\";\nimport { kimiRequest } from \"./kimi-request.ts\";\nimport type { KimiSettings } from \"./kimi.types.ts\";\nimport { kimiModelSupport } from \"./model-support.constants.ts\";\nimport { harnessSettings, supportModel } from \"./model-support.ts\";\nimport type { Bound } from \"./settings.types.ts\";\n\nfunction bindKimi(settings: Bound<KimiSettings>): AgentAdapter {\n supportModel(kimiModelSupport, settings.model);\n const credentials = credentialPlanner(\n \"Kimi Code\",\n kimiCredentials,\n settings.authentication,\n settings.model,\n );\n return Object.freeze({\n name: \"kimi\",\n ...(credentials ? { credentials } : {}),\n bootstrap: \"kimi\",\n resumable: false,\n capture: false,\n variables: Object.freeze({\n KIMI_CODE_NO_AUTO_UPDATE: \"1\",\n ...settings.variables,\n }),\n request: (input) => kimiRequest(settings, input),\n events: kimiEvents,\n } satisfies AgentAdapter);\n}\n\nexport function kimiHarness(settings: KimiSettings = {}): 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 bindKimi({ ...configured, ...(model === undefined ? {} : { model }) }),\n });\n}\n"]}
1
+ {"version":3,"file":"kimi-adapter.js","sourceRoot":"","sources":["../../../src/adapters/agents/kimi-adapter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAC7E,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE1C,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CA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AAS;QAChB,YAAY,EAAE,CAAC,YAAY,EAAE,EAAE,CAAC,mBAAmB,CAAC,MAAM,EAAE,YAAY,CAAC;QACzE,WAAW,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,kBAAkB,CAAC,IAAI,EAAE,SAAS,CAAC;KACpC,CAAC,CAAC;AAC5B,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,WAAyB,EAAE;IACrD,eAAe,CAAC,QAAQ,CAAC,CAAC;IAC1B,SAAS,CACP,QAAQ,CAAC,MAAM,KAAK,SAAS;QAC3B,MAAM,CAAC,MAAM,CAAC,WAAW,EAAE,QAAQ,CAAC,MAAM,CAAC,EAC7C,+CAA+C,CAChD,CAAC;IACF,SAAS,CACP,QAAQ,CAAC,MAAM,KAAK,SAAS;QAC3B,QAAQ,CAAC,cAAc,KAAK,SAAS;QACrC,CAAC,kBAAkB,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,EACvE,mHAAmH,CACpH,CAAC;IACF,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,QAAQ,CAAC,EAAE,GAAG,UAAU,EAAE,GAAG,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC;KACzE,CAAC,CAAC;AACL,CAAC","sourcesContent":["import { quotaMatcher } from \"./quota.ts\";\nimport { kimiQuotaPatterns } from \"./quota.constants.ts\";\nimport { kimiUsage } from \"./kimi-usage.ts\";\nimport { sessionUsageCommand, sessionUsageResult } from \"./session-usage.ts\";\nimport { forkKimi } from \"./kimi-fork.ts\";\nimport type { AgentAdapter, CliHarness } from \"../../domain/agent.types.ts\";\nimport { invariant } from \"../../domain/errors.ts\";\nimport { authenticationForm } from \"../../domain/authentication.ts\";\nimport { kimiRegions } from \"./kimi.constants.ts\";\nimport type { AgentModel } from \"../../domain/model.types.ts\";\nimport { credentialPlanner } from \"./authentication.ts\";\nimport { kimiCredentials } from \"./kimi-authentication.ts\";\nimport { kimiEvents } from \"./kimi-events.ts\";\nimport { kimiRequest } from \"./kimi-request.ts\";\nimport type { KimiSettings } from \"./kimi.types.ts\";\nimport { kimiModelSupport } from \"./model-support.constants.ts\";\nimport { harnessSettings, supportModel } from \"./model-support.ts\";\nimport type { Bound } from \"./settings.types.ts\";\n\nfunction bindKimi(settings: Bound<KimiSettings>): AgentAdapter {\n supportModel(kimiModelSupport, settings.model);\n const credentials = credentialPlanner(\n \"Kimi Code\",\n kimiCredentials(settings.region),\n settings.authentication,\n settings.model,\n );\n return Object.freeze({\n name: \"kimi\",\n ...(credentials ? { credentials } : {}),\n bootstrap: \"kimi\",\n resumable: true,\n forkable: true,\n fork: forkKimi,\n conversations: \"kimi\",\n variables: Object.freeze({\n KIMI_CODE_NO_AUTO_UPDATE: \"1\",\n ...settings.variables,\n }),\n request: (input) => kimiRequest(settings, input),\n events: kimiEvents,\n quota: quotaMatcher(kimiQuotaPatterns),\n usage: \"session\",\n usageCommand: (conversation) => sessionUsageCommand(\"kimi\", conversation),\n usageResult: (text) => sessionUsageResult(text, kimiUsage),\n } satisfies AgentAdapter);\n}\n\nexport function kimiHarness(settings: KimiSettings = {}): CliHarness {\n harnessSettings(settings);\n invariant(\n settings.region === undefined ||\n Object.hasOwn(kimiRegions, settings.region),\n 'Kimi region must be \"mainland-cn\" or \"global\"',\n );\n invariant(\n settings.region === undefined ||\n settings.authentication === undefined ||\n !authenticationForm(settings.authentication).form.startsWith(\"usage\"),\n \"Kimi region selects account authentication; configure the API endpoint through variables for usage authentication\",\n );\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 bindKimi({ ...configured, ...(model === undefined ? {} : { model }) }),\n });\n}\n"]}
@@ -1,2 +1,3 @@
1
+ import type { KimiSettings } from "./kimi.types.ts";
1
2
  import type { CredentialStrategy } from "./authentication.types.ts";
2
- export declare const kimiCredentials: CredentialStrategy;
3
+ export declare function kimiCredentials(region?: NonNullable<KimiSettings["region"]>): CredentialStrategy;
@@ -1,23 +1,36 @@
1
1
  import { join, posix } from "node:path";
2
+ import { DEFAULT_KIMI_REGION, kimiRegions } from "./kimi.constants.js";
2
3
  import { invariant } from "../../domain/errors.js";
3
4
  import { KIMI_LOGIN_DEADLINE_MS, credentialVariables, } from "./authentication.constants.js";
4
5
  import { credentialPlan, toolCommand, variableCredential, } from "./authentication.js";
5
- const profileFiles = [
6
- ["credentials", "kimi-code.json"],
7
- ["device_id"],
8
- ];
9
- function profile(root) {
10
- return () => credentialPlan({
11
- host: profileFiles.map((parts) => ({
12
- source: root(join(...parts)),
13
- destination: { file: posix.join(".kimi-code", ...parts) },
14
- login: "kimi login",
15
- alternative: `"usage" with ${credentialVariables.kimi.usage} and a model`,
16
- })),
17
- commands: [
18
- toolCommand("kimi", ["login"], { deadlineMs: KIMI_LOGIN_DEADLINE_MS }),
19
- ],
20
- });
6
+ function profile(root, region) {
7
+ const selected = kimiRegions[region];
8
+ const profileFiles = [["credentials", selected.credential], ["device_id"]];
9
+ return (variables) => {
10
+ for (const [name, expected] of [
11
+ ["KIMI_CODE_OAUTH_HOST", selected.oauthHost],
12
+ ["KIMI_OAUTH_HOST", selected.oauthHost],
13
+ ["KIMI_CODE_BASE_URL", selected.baseUrl],
14
+ ])
15
+ invariant(!variables[name] || variables[name]?.replace(/\/+$/, "") === expected, `Kimi ${name} conflicts with account region "${region}"`);
16
+ return credentialPlan({
17
+ variables: {
18
+ KIMI_CODE_OAUTH_HOST: selected.oauthHost,
19
+ KIMI_CODE_BASE_URL: selected.baseUrl,
20
+ },
21
+ host: profileFiles.map((parts) => ({
22
+ source: root(join(...parts)),
23
+ destination: { file: posix.join(".kimi-code", ...parts) },
24
+ login: `kimi login --region ${region}`,
25
+ alternative: `"usage" with ${credentialVariables.kimi.usage} and a model`,
26
+ })),
27
+ commands: [
28
+ toolCommand("kimi", ["login", "--region", region], {
29
+ deadlineMs: KIMI_LOGIN_DEADLINE_MS,
30
+ }),
31
+ ],
32
+ });
33
+ };
21
34
  }
22
35
  function modelName(input) {
23
36
  const name = input.model?.name;
@@ -35,14 +48,16 @@ const key = variableCredential({
35
48
  },
36
49
  }),
37
50
  });
38
- export const kimiCredentials = Object.freeze({
39
- account: () => profile((path) => ({
40
- path: join("~/.kimi-code", path),
41
- home: { variable: "KIMI_CODE_HOME", path },
42
- })),
43
- "account.file": (input) => profile((path) => ({ path: join(input.value, path) })),
44
- usage: key.preset,
45
- "usage.key": key.key,
46
- "usage.variable": key.variable,
47
- });
51
+ export function kimiCredentials(region = DEFAULT_KIMI_REGION) {
52
+ return Object.freeze({
53
+ account: () => profile((path) => ({
54
+ path: join("~/.kimi-code", path),
55
+ home: { variable: "KIMI_CODE_HOME", path },
56
+ }), region),
57
+ "account.file": (input) => profile((path) => ({ path: join(input.value, path) }), region),
58
+ usage: key.preset,
59
+ "usage.key": key.key,
60
+ "usage.variable": key.variable,
61
+ });
62
+ }
48
63
  //# sourceMappingURL=kimi-authentication.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"kimi-authentication.js","sourceRoot":"","sources":["../../../src/adapters/agents/kimi-authentication.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAExC,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EACL,sBAAsB,EACtB,mBAAmB,GACpB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,cAAc,EACd,WAAW,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e,GAAuB,MAAM,CAAC,MAAM,CAAC;IAC/D,OAAO,EAAE,GAAG,EAAE,CACZ,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;QACjB,IAAI,EAAE,IAAI,CAAC,cAAc,EAAE,IAAI,CAAC;QAChC,IAAI,EAAE,EAAE,QAAQ,EAAE,gBAAgB,EAAE,IAAI,EAAE;KAC3C,CAAC,CAAC;IACL,cAAc,EAAE,CAAC,KAAK,EAAE,EAAE,CACxB,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC;IACxD,KAAK,EAAE,GAAG,CAAC,MAAM;IACjB,WAAW,EAAE,GAAG,CAAC,GAAG;IACpB,gBAAgB,EAAE,GAAG,CAAC,QAAQ;CAC/B,CAAC,CAAC","sourcesContent":["import { join, posix } from \"node:path\";\nimport type { HostCredentialPath } from \"../../domain/agent.types.ts\";\nimport { invariant } from \"../../domain/errors.ts\";\nimport {\n KIMI_LOGIN_DEADLINE_MS,\n credentialVariables,\n} from \"./authentication.constants.ts\";\nimport {\n credentialPlan,\n toolCommand,\n variableCredential,\n} from \"./authentication.ts\";\nimport type {\n CredentialInput,\n CredentialPlanner,\n CredentialStrategy,\n} from \"./authentication.types.ts\";\n\nconst profileFiles = [\n [\"credentials\", \"kimi-code.json\"],\n [\"device_id\"],\n] as const;\n\nfunction profile(\n root: (path: string) => HostCredentialPath,\n): CredentialPlanner {\n return () =>\n credentialPlan({\n host: profileFiles.map((parts) => ({\n source: root(join(...parts)),\n destination: { file: posix.join(\".kimi-code\", ...parts) },\n login: \"kimi login\",\n alternative: `\"usage\" with ${credentialVariables.kimi.usage} and a model`,\n })),\n commands: [\n toolCommand(\"kimi\", [\"login\"], { deadlineMs: KIMI_LOGIN_DEADLINE_MS }),\n ],\n });\n}\n\nfunction modelName(input: CredentialInput): string {\n const name = input.model?.name;\n invariant(\n name,\n \"Kimi Code usage authentication requires a model name on agent()\",\n );\n return name;\n}\n\nconst key = variableCredential({\n variable: credentialVariables.kimi.usage,\n bind: modelName,\n expose: (secret, input) => ({\n variables: {\n KIMI_MODEL_API_KEY: secret,\n KIMI_MODEL_PROVIDER_TYPE: \"kimi\",\n KIMI_MODEL_NAME: modelName(input),\n },\n }),\n});\n\nexport const kimiCredentials: CredentialStrategy = Object.freeze({\n account: () =>\n profile((path) => ({\n path: join(\"~/.kimi-code\", path),\n home: { variable: \"KIMI_CODE_HOME\", path },\n })),\n \"account.file\": (input) =>\n profile((path) => ({ path: join(input.value, path) })),\n usage: key.preset,\n \"usage.key\": key.key,\n \"usage.variable\": key.variable,\n});\n"]}
1
+ {"version":3,"file":"kimi-authentication.js","sourceRoot":"","sources":["../../../src/adapters/agents/kimi-authentication.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,mBAAmB,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAGvE,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EACL,sBAAsB,EACtB,mBAAmB,GACpB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,cAAc,EACd,WAAW,EACX,kBAAkB,GACnB,MAAM,qBAAqB,CAAC;AAO7B,SAAS,OAAO,CACd,IAA0C,EAC1C,MAA2C;IAE3C,MAAM,QAAQ,GAAG,WAAW,CAAC,MAAM,CAAC,CAAC;IACrC,MAAM,YAAY,GAAG,CAAC,CAAC,aAAa,EAAE,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC,WAAW,CAAC,CAAC,CAAC;IAC3E,OAAO,CAAC,SAAS,EAAE,EAAE;QACnB,KAAK,MAAM,CAAC,IAAI,EAAE,QAAQ,CAAC,IAAI;YAC7B,CAAC,sBAAsB,EAAE,QAAQ,CAAC,SAAS,CAAC;YAC5C,CAAC,iBAA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AAI,EAAE,SAAS;IACf,MAAM,EAAE,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC;QAC1B,SAAS,EAAE;YACT,kBAAkB,EAAE,MAAM;YAC1B,wBAAwB,EAAE,MAAM;YAChC,eAAe,EAAE,SAAS,CAAC,KAAK,CAAC;SAClC;KACF,CAAC;CACH,CAAC,CAAC;AAEH,MAAM,UAAU,eAAe,CAC7B,SAA8C,mBAAmB;IAEjE,OAAO,MAAM,CAAC,MAAM,CAAC;QACnB,OAAO,EAAE,GAAG,EAAE,CACZ,OAAO,CACL,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;YACT,IAAI,EAAE,IAAI,CAAC,cAAc,EAAE,IAAI,CAAC;YAChC,IAAI,EAAE,EAAE,QAAQ,EAAE,gBAAgB,EAAE,IAAI,EAAE;SAC3C,CAAC,EACF,MAAM,CACP;QACH,cAAc,EAAE,CAAC,KAAK,EAAE,EAAE,CACxB,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,IAAI,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC;QAChE,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 { join, posix } from \"node:path\";\nimport { DEFAULT_KIMI_REGION, kimiRegions } from \"./kimi.constants.ts\";\nimport type { KimiSettings } from \"./kimi.types.ts\";\nimport type { HostCredentialPath } from \"../../domain/agent.types.ts\";\nimport { invariant } from \"../../domain/errors.ts\";\nimport {\n KIMI_LOGIN_DEADLINE_MS,\n credentialVariables,\n} from \"./authentication.constants.ts\";\nimport {\n credentialPlan,\n toolCommand,\n variableCredential,\n} from \"./authentication.ts\";\nimport type {\n CredentialInput,\n CredentialPlanner,\n CredentialStrategy,\n} from \"./authentication.types.ts\";\n\nfunction profile(\n root: (path: string) => HostCredentialPath,\n region: NonNullable<KimiSettings[\"region\"]>,\n): CredentialPlanner {\n const selected = kimiRegions[region];\n const profileFiles = [[\"credentials\", selected.credential], [\"device_id\"]];\n return (variables) => {\n for (const [name, expected] of [\n [\"KIMI_CODE_OAUTH_HOST\", selected.oauthHost],\n [\"KIMI_OAUTH_HOST\", selected.oauthHost],\n [\"KIMI_CODE_BASE_URL\", selected.baseUrl],\n ] as const)\n invariant(\n !variables[name] || variables[name]?.replace(/\\/+$/, \"\") === expected,\n `Kimi ${name} conflicts with account region \"${region}\"`,\n );\n return credentialPlan({\n variables: {\n KIMI_CODE_OAUTH_HOST: selected.oauthHost,\n KIMI_CODE_BASE_URL: selected.baseUrl,\n },\n host: profileFiles.map((parts) => ({\n source: root(join(...parts)),\n destination: { file: posix.join(\".kimi-code\", ...parts) },\n login: `kimi login --region ${region}`,\n alternative: `\"usage\" with ${credentialVariables.kimi.usage} and a model`,\n })),\n commands: [\n toolCommand(\"kimi\", [\"login\", \"--region\", region], {\n deadlineMs: KIMI_LOGIN_DEADLINE_MS,\n }),\n ],\n });\n };\n}\n\nfunction modelName(input: CredentialInput): string {\n const name = input.model?.name;\n invariant(\n name,\n \"Kimi Code usage authentication requires a model name on agent()\",\n );\n return name;\n}\n\nconst key = variableCredential({\n variable: credentialVariables.kimi.usage,\n bind: modelName,\n expose: (secret, input) => ({\n variables: {\n KIMI_MODEL_API_KEY: secret,\n KIMI_MODEL_PROVIDER_TYPE: \"kimi\",\n KIMI_MODEL_NAME: modelName(input),\n },\n }),\n});\n\nexport function kimiCredentials(\n region: NonNullable<KimiSettings[\"region\"]> = DEFAULT_KIMI_REGION,\n): CredentialStrategy {\n return Object.freeze({\n account: () =>\n profile(\n (path) => ({\n path: join(\"~/.kimi-code\", path),\n home: { variable: \"KIMI_CODE_HOME\", path },\n }),\n region,\n ),\n \"account.file\": (input) =>\n profile((path) => ({ path: join(input.value, path) }), region),\n usage: key.preset,\n \"usage.key\": key.key,\n \"usage.variable\": key.variable,\n });\n}\n"]}
@@ -1 +1,2 @@
1
- export declare function kimiDiagnostics(): readonly import("./cli-diagnostics.types.ts").AgentCliDiagnostic[];
1
+ import type { AgentCliDiagnostic } from "./cli-diagnostics.types.ts";
2
+ export declare function kimiDiagnostics(): readonly AgentCliDiagnostic[];
@@ -1,6 +1,14 @@
1
1
  import { helpDiagnostics } from "./cli-diagnostics.js";
2
2
  import { kimiRequest } from "./kimi-request.js";
3
3
  export function kimiDiagnostics() {
4
- return helpDiagnostics((input) => kimiRequest({}, input), "Usage: kimi [");
4
+ return [
5
+ ...helpDiagnostics((input) => kimiRequest({}, input), "Usage: kimi [", true),
6
+ {
7
+ mode: "fork",
8
+ usage: "Usage: kimi fork [",
9
+ options: ["--yes"],
10
+ command: { executable: "kimi", arguments: ["fork", "--help"] },
11
+ },
12
+ ];
5
13
  }
6
14
  //# sourceMappingURL=kimi-diagnostics.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"kimi-diagnostics.js","sourceRoot":"","sources":["../../../src/adapters/agents/kimi-diagnostics.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,MAAM,UAAU,eAAe;IAC7B,OAAO,eAAe,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,WAAW,CAAC,EAAE,EAAE,KAAK,CAAC,EAAE,eAAe,CAAC,CAAC;AAC7E,CAAC","sourcesContent":["import { helpDiagnostics } from \"./cli-diagnostics.ts\";\nimport { kimiRequest } from \"./kimi-request.ts\";\n\nexport function kimiDiagnostics() {\n return helpDiagnostics((input) => kimiRequest({}, input), \"Usage: kimi [\");\n}\n"]}
1
+ {"version":3,"file":"kimi-diagnostics.js","sourceRoot":"","sources":["../../../src/adapters/agents/kimi-diagnostics.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGhD,MAAM,UAAU,eAAe;IAC7B,OAAO;QACL,GAAG,eAAe,CAChB,CAAC,KAAK,EAAE,EAAE,CAAC,WAAW,CAAC,EAAE,EAAE,KAAK,CAAC,EACjC,eAAe,EACf,IAAI,CACL;QACD;YACE,IAAI,EAAE,MAAM;YACZ,KAAK,EAAE,oBAAoB;YAC3B,OAAO,EAAE,CAAC,OAAO,CAAC;YAClB,OAAO,EAAE,EAAE,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC,MAAM,EAAE,QAAQ,CAAC,EAAE;SAC/D;KACF,CAAC;AACJ,CAAC","sourcesContent":["import { helpDiagnostics } from \"./cli-diagnostics.ts\";\nimport { kimiRequest } from \"./kimi-request.ts\";\nimport type { AgentCliDiagnostic } from \"./cli-diagnostics.types.ts\";\n\nexport function kimiDiagnostics(): readonly AgentCliDiagnostic[] {\n return [\n ...helpDiagnostics(\n (input) => kimiRequest({}, input),\n \"Usage: kimi [\",\n true,\n ),\n {\n mode: \"fork\",\n usage: \"Usage: kimi fork [\",\n options: [\"--yes\"],\n command: { executable: \"kimi\", arguments: [\"fork\", \"--help\"] },\n },\n ];\n}\n"]}
@@ -1,3 +1,4 @@
1
+ import { toolResult } from "./tool-result.js";
1
2
  import { decodeLine } from "./event-decoder.js";
2
3
  import { asRecord } from "./protocol.js";
3
4
  function toolInput(value) {
@@ -25,6 +26,8 @@ function assistant(event) {
25
26
  ]
26
27
  : [];
27
28
  });
29
+ if (typeof event.reasoning_content === "string" && event.reasoning_content)
30
+ tools.push({ kind: "reasoning", text: event.reasoning_content });
28
31
  return typeof event.content === "string" && event.content
29
32
  ? [{ kind: "text", text: event.content }, ...tools]
30
33
  : tools;
@@ -40,6 +43,7 @@ const meta = {
40
43
  export function kimiEvents(line) {
41
44
  return decodeLine(line, {
42
45
  assistant,
46
+ tool: (event) => toolResult(event.tool_call_id, event.name, event.content, event.is_error === true),
43
47
  meta: (event) => {
44
48
  const decode = typeof event.type === "string" && Object.hasOwn(meta, event.type)
45
49
  ? meta[event.type]