@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
package/CHANGELOG.md CHANGED
@@ -1,5 +1,45 @@
1
1
  # Changelog
2
2
 
3
+ ## 8.0.0
4
+
5
+ This major release adds required workflow result fields, extends public status, event, fault and speculation unions, and reclassifies model-provider rate limits. Result producers and test doubles must provide `WorkflowResult.inputRequests`; update exhaustive handling of `TaskStatus`, `WorkflowResult.status`, `WorkflowEvent.type`, `FaultCode`, `ObservationEvent`, `Agent`, `StorageCategoryName` and speculation statuses, and handlers that matched `provider` for HTTP 429. Existing entry points remain available. Live limit campaigns and authenticated model campaigns for these additions remain outstanding.
6
+
7
+ - Add opt-in task result caching with `task({ cache: { store, version, key, maxAgeMs, mode } })`, `taskCacheStore({ transporter })` and `repositoryFingerprint()`. A hit restores the stored lossless JSON result without an attempt, usage or replayed side effects; `loopTask` accepts `cache`, while gates, interactions, `agentTask` and `isolatedTask` reject it. Store errors and invalid entries degrade to a miss without changing the task outcome. `TaskRecord` gains `cacheHit`, `WorkflowEvent` gains the `cache` type with `cache` and `error`, `StorageCategoryName` gains `task-cache` and retention policies accept the `task-cache` scope; update exhaustive consumers. Entries are not authenticated.
8
+ - Add opt-in quota pauses with `workflow.start({ onQuota: { action: "pause", maxWaitMs } })`. A quota error pauses the task durably instead of retrying or failing it; a known reset within `maxWaitMs` is awaited in process, otherwise a later start with the same checkpoint resumes it. `TaskRecord` gains `quota` and `WorkflowEvent` gains the `quota` type and `resetAt`; update exhaustive consumers. Human-readable reset times are not parsed, and reruns start a new agent dispatch.
9
+ - Continue the conversation interrupted by a quota pause: `TaskContext.quota` exposes the captured conversation and retained branch to the first attempt after the pause. `agentTask` and `isolatedTask` resume it with a short instruction unless `quotaResume: "restart"`, integrated isolated workspaces start from the interrupted branch, and interactive tasks continue the interrupted turn. Agents without resume or capture start a new conversation.
10
+ - Carry quota failures across queues: `QueueResult.quota` reports the handler's limit and `queuedTask` rejects with code `quota`. The first attempt after a pause publishes a new job, `<key>:quota:<attempt>`, and `QueueRequest.idempotencyKey` keeps the handler's effect key stable.
11
+ - Report candidates stopped by a limit with speculation status `quota` and `SpeculationResult.quota`; `SpeculativeCandidateResult.status` and `SpeculationResult.status` gain `quota`, so update exhaustive consumers. A durable race finished on quota reruns only those candidates as new attempts from the baseline, without continuing their conversation.
12
+ - Add the `quota` fault code, the `quota` agent event, `AgentAdapter.quota` and `quotaFault()`. Claude Code, Codex, Copilot, Kimi and Antigravity limit signals reclassify failed turns from `process` to `quota`, with the reset time when Claude reports it. HTTP 429 and quota stream errors from OpenAI and Anthropic model providers now use code `quota` instead of `provider`, keep `retryAfterMs` and add `resetAt`; update handlers that matched `provider` for rate limits. Classification is based on recorded protocol formats, not live limit campaigns.
13
+ - Add `replayAgent()` to replay a dispatch journal without calling a model: it re-emits the recorded events and usage turn by turn, rebuilds the recorded commits inside the sandbox with their original identities, rethrows recorded turn failures and reports prompt, baseline, tree, exhausted and unrecorded differences through `ReplayDivergence` (or warnings with `divergence: "warn"`). `logging.replayable` records each sandbox dispatch's linear commits as verified binary patches; journals then contain repository content. `Agent` gains the `ReplayAgent` variant, `FaultCode` gains `replay`, `ObservationEvent` gains `workspace-commits` and `dispatch-finished` gains an optional `error`; update exhaustive consumers.
14
+ - Add `interactiveAgentTask()` with durable question/answer turns for the Outpost harness and portable CLI conversations, preserved worktrees, actor validation, cumulative usage and explicit interrupted-turn replay. Antigravity and disabled capture are rejected. Pending questions release the sandbox; in-tool suspension, signed answers and question expiry remain future work.
15
+ - Extend `TaskStatus` and `WorkflowResult.status` with `waiting-input`, and `WorkflowEvent.type` with `input-request`/`input-answer`. Result producers must now provide `inputRequests`; consumers with exhaustive status handling must account for these additions.
16
+ - Add `loopTask` for bounded attempt/check cycles with feedback, durable phase recovery, cumulative budgets, phase-specific idempotency keys and `LoopTaskExhausted`. `WorkflowEvent.type` gains `loop`; update exhaustive consumers. Callback errors require explicit resume; loop checkpoints require JSON outputs.
17
+
18
+ ## 7.0.0
19
+
20
+ This major release extends public event and conversation unions and adds required context fields. Update exhaustive handling of `AgentEvent`, `WorkflowEvent.type`, `ModelStreamEvent`, `ConversationFormat` and `StoredConversationFormat`; custom context producers and test doubles must provide `TaskContext.idempotencyKey` and `QueueHandlerContext.idempotencyKey`. Existing entry points remain available. Redis queues now require `maxmemory-policy=noeviction`, and token-only workflow budgets reject incomplete usage. Firecracker and speculation remain experimental; 7.0.0 does not complete every roadmap direction.
21
+
22
+ - Add opt-in durable speculation through Transport with fenced ownership, explicit crash recovery, cumulative budgets, preserved attempts, bounded cleanup and Git merge preflight. Mounted Docker/Podman support resource reconciliation; unsupported providers reject durable mode. Speculation remains experimental.
23
+ - Add confirmed Daytona egress policies with explicit rejection of unsupported rules and account capabilities; snapshot Vercel native firewall configuration against caller mutation. Add opt-in network probes and bilingual capability/ownership documentation. Container allowlists remain unsupported.
24
+ - Add opt-in signed approval/pause gates with rotating Ed25519 approver keys, per-request HTTP queue credential rotation and stable task/worker idempotency keys. Document persistent effect deduplication and multi-worker recovery; queues still do not guarantee exactly-once external effects.
25
+ - Add opt-in capped exponential task retries and full jitter, preserve HTTP model Retry-After minimum waits, and expose selected retry delays. Add cooperative workflow.start({ timeoutMs }) deadlines renewed on resume, preserving checkpoint compatibility and explicit replay authorization.
26
+
27
+ - Stabilize the built-in harness and OpenAI/Anthropic model contracts, with authenticated delegation validated for both integrations. Add `defineHarnessSubagent()` with serialized shared-sandbox execution, separate captured histories, inherited permissions, bounded depth and cumulative ancestor token budgets. Count final responses and context summaries toward token ceilings, reject incomplete accounting and correlate child lifecycle/usage events. Add deterministic container CI and an opt-in, budgeted live campaign.
28
+ - Add scoped observation hubs with bounded pluggable sinks, correlated workflow/agent/operation events, process stop diagnostics, normalized CLI tool results and opt-in model payloads. Journals and reporters use the shared delivery policy; sink failures are reported independently of execution. OpenTelemetry can consume the unified stream without changing metric names.
29
+ - Add native session capture, warm/cold resume and response repairs for Copilot and Kimi, plus native Kimi fork. Antigravity supports warm resume and repairs only; portable capture/cold resume and automated fork remain unsupported. Copilot automated fork is explicitly refused. Session bundles preserve supported native files and can be archived through Transport.
30
+
31
+ - Add opt-in Firecracker jailer execution with protected root-owned assets, an unprivileged VMM identity, cgroup v2 CPU/memory/process limits and conservative jail/cgroup cleanup. Direct execution remains compatible; the provider remains experimental pending broader host and adversarial validation.
32
+ - Pin Antigravity CLI 1.2.12 in generated images and remote bootstrap using versioned archives and recorded SHA-512 digests. Expose `agentVersions.antigravity`, compare it in doctor, and disable automatic updates in generated images, agent requests and diagnostics. Existing binaries are reused; existing image recipes must be updated and rebuilt.
33
+ - Collect Copilot and Kimi token usage from sandbox session files, including Kimi sub-agents, and reconcile Copilot streamed usage without double counting. Missing or partial counters carry `Usage.complete: false` through dispatch, workflows, speculation and checkpoints. Token-only workflow budgets fail with `WorkflowUsageUnavailable` when accounting is incomplete; configure an attempt budget and execution time limits for bounded fallback.
34
+
35
+ - Add `s3Transport({ deleteMode: "tombstone" })` for services such as R2 without atomic conditional DELETE: conditional PUT markers fence stale deletions and concurrent recreation, remain physically stored, and are hidden from reads and lists. The default conditional DELETE mode is unchanged.
36
+ - Refuse BullMQ queues unless Redis INFO confirms `maxmemory-policy=noeviction`, with a configuration error instead of allowing eviction of queue state.
37
+
38
+ - Stop host `doctor` probes and their descendants on interruption, preserving SIGINT/SIGTERM exit codes.
39
+ - Keep a safe connection diagnostic in CLI-agent timeout errors when the latest failure event reports a connection problem, without copying endpoint URLs or credentials.
40
+ - Fix Copilot account authentication when `config.json` stores the selected account token as an object with a `token` field, while retaining support for string tokens.
41
+ - Fix Kimi Code international account authentication with `kimiHarness({ authentication: "account", region: "global" })`: copy the region-scoped OAuth credential and device identifier, then provision the same region inside the sandbox. Account authentication defaults to `region: "global"` when omitted; Chinese accounts must select `region: "mainland-cn"` explicitly. Conflicting account endpoint overrides are rejected for both explicit and default regions.
42
+
3
43
  ## 6.0.1
4
44
 
5
45
  - Rebuild the English and French Guide from scratch with focused explanations and short, directly usable snippets. Introduce a new page structure, task-based navigation and a dedicated responsive Guide layout.
package/README.md CHANGED
@@ -2,9 +2,11 @@
2
2
 
3
3
  [Documentation](https://elie-laloum.github.io/outpost/) · [Français](https://elie-laloum.github.io/outpost/fr/) · [API](https://elie-laloum.github.io/outpost/reference/) · [Changelog](CHANGELOG.md)
4
4
 
5
- Outpost is a TypeScript library for running coding agents in reusable sandboxes, managing their Git workspaces and composing typed workflows. Claude Code, Codex, Antigravity, GitHub Copilot CLI and Kimi Code adapters work with Docker, Podman, Vercel, Daytona or explicit host execution. Each harness authenticates explicitly with your account login or an API key. Antigravity, Copilot and Kimi run fresh sessions only; native conversation capture, resume and fork are available for Claude Code and Codex.
5
+ Outpost is a TypeScript library for running coding agents in reusable sandboxes, managing their Git workspaces and composing typed workflows. Claude Code, Codex, Antigravity, GitHub Copilot CLI and Kimi Code adapters work with Docker, Podman, Vercel, Daytona or explicit host execution. Each harness authenticates explicitly with your account login or an API key. Claude Code, Codex and Kimi support native capture, resume and fork. Copilot supports capture and resume; Antigravity resumes conversations only while their sandbox remains open. These continuation additions are available in 7.0.0.
6
6
 
7
- Version 6.0.0 unifies CLI authentication: every harness selects `account` (your host login, copied into the private sandbox home) or `usage` (an API key), and Outpost never reads a system keychain. It replaces Gemini CLI with Antigravity, GitHub Copilot CLI and Kimi Code harnesses, routes all runtime persistence through storage transports, and renames the harness types. It contains breaking API changes. See the [changelog](CHANGELOG.md#600) for details and migration notes, and the [roadmap](https://elie-laloum.github.io/outpost/project/roadmap/) for remaining validation and upcoming priorities.
7
+ Version 8.0.0 adds verification loops, interactive agent tasks, dispatch record and replay, task result caching and quota pauses that resume interrupted conversations. It extends public status, event and fault unions and reclassifies model-provider rate limits as `quota`: see the [changelog](CHANGELOG.md#800) for migration notes.
8
+
9
+ Version 7.0.0 stabilizes the built-in harness and adds bounded subagents, unified observation, native CLI continuation, signed workflow decisions and recoverable speculation. It extends public TypeScript unions and context contracts: see the [changelog](CHANGELOG.md#700) for migration notes. Firecracker and speculation remain experimental; the [roadmap](https://elie-laloum.github.io/outpost/project/roadmap/) records remaining validation and planned work.
8
10
 
9
11
  ## Get started
10
12
 
@@ -46,7 +48,7 @@ console.log(result.branch, result.commits);
46
48
 
47
49
  `repository` selects a local Git checkout; without it, library calls use the current working directory. See [repository paths](https://elie-laloum.github.io/outpost/guide/repository-context/) for external checkouts and paths relative to the workflow script.
48
50
 
49
- Let Outpost drive a model itself with `harness({ modelProvider, tools, instructions, limits })` and tools from `defineHarnessTool()`, then compose it with `agent({ harness, model })`. See [build a custom harness](https://elie-laloum.github.io/outpost/guide/model-loop/) for configuration.
51
+ Let Outpost drive a model itself with `harness({ modelProvider, tools, instructions, limits })` and tools from `defineHarnessTool()`, then compose it with `agent({ harness, model })`. Use `defineHarnessSubagent()` to expose a built-in child as a tool with its own history and limits; its token usage also counts toward the parent budget. The built-in contracts and OpenAI and Anthropic integrations are stable in 7.0.0. See [build a custom harness](https://elie-laloum.github.io/outpost/guide/model-loop/) for configuration.
50
52
 
51
53
  Learn about [sandboxes](https://elie-laloum.github.io/outpost/guide/sandbox-sessions/), [workflows](https://elie-laloum.github.io/outpost/guide/task-dependencies/), [providers](https://elie-laloum.github.io/outpost/guide/execution-backends/) and [recovery](https://elie-laloum.github.io/outpost/guide/failure-recovery/) in the English/French documentation. The [roadmap](https://elie-laloum.github.io/outpost/project/roadmap/) describes future work.
52
54
 
package/SECURITY.md CHANGED
@@ -12,10 +12,18 @@ Remote providers upload repository history and inputs to the selected cloud acco
12
12
 
13
13
  Prompt command expansion only recognizes commands present in the original prompt file. Substitution cannot introduce new expansion fragments. Values substituted inside an original shell command still have shell semantics and must be trusted or quoted by the prompt author.
14
14
 
15
- Agent authentication is explicit. `account` reads only the selected CLI's own session file (or the file or profile named by `account.file`) on the host, refuses links, directories and files above 1 MiB, and never reads a system keychain. Isolated providers receive a copy in the private sandbox home through stdin, with 0700 directories and 0600 files; `localSandboxProvider()` receives credential variables only and no host file is written. A sandbox copy can refresh and rotate a subscription refresh token, invalidating the host login; use a dedicated profile through `account.file` when that matters. Agents can read every credential they receive, so give them only the access their task requires. Generated images and remote bootstrap install npm CLIs at pinned versions, but install the Antigravity CLI with Google's official script, which fetches the current release: build and pin your own image when you need a reviewed agent binary.
15
+ Agent authentication is explicit. `account` reads only the selected CLI's own session file (or the file or profile named by `account.file`) on the host, refuses links, directories and files above 1 MiB, and never reads a system keychain. Isolated providers receive a copy in the private sandbox home through stdin, with 0700 directories and 0600 files; `localSandboxProvider()` receives credential variables only and no host file is written. A sandbox copy can refresh and rotate a subscription refresh token, invalidating the host login; use a dedicated profile through `account.file` when that matters. Agents can read every credential they receive, so give them only the access their task requires. Generated images and remote bootstrap install pinned CLI versions. Antigravity archives use versioned Google URLs and SHA-512 digests recorded in Outpost; installation rejects mismatches before extraction. Generated images and Outpost's Antigravity requests and diagnostics disable automatic updates. Bootstrap reuses an existing executable without replacing or verifying its bytes; `outpost doctor --agent antigravity` compares its reported version with `agentVersions.antigravity`. A checksum verifies the selected archive's integrity, not the safety of its code.
16
16
 
17
17
  Conversation transcripts, logs, bundles and patches may contain secrets. Runtime files are ignored by Git and sensitive files are created with restrictive permissions where supported. Keep API keys in environment variables or ignored `.env` files. Never embed tokens in tracked configuration, remote URLs or examples.
18
18
 
19
19
  Report vulnerabilities privately using the repository's security reporting channel when enabled, or contact the maintainer through the hosting profile. Do not include live credentials in reports. V1 receives fixes for reproducible security defects.
20
20
 
21
21
  Explicit storage transports can send artifacts, journals, transcripts, recovery payloads and operational metadata to the configured object store. The caller owns the S3 client and credentials; they are not forwarded to agents. Use a dedicated private bucket prefix and access policy. Object revisions fence cooperating writers but do not authenticate artifact producers or operators. Stop an abandoned runner independently before releasing its checkpoint ownership; a remote PID is not proof of inactivity.
22
+
23
+ The optional Firecracker jailer mode requires a trusted root supervisor and root-owned boot assets, executables, SSH trust files, jail base and cgroup v2 parent. Outpost does not elevate privileges. The VMM drops to the explicitly selected non-root UID/GID, uses the jailer's mount namespace and receives CPU, memory, swap and process limits. The supervisor remains privileged and outside the VMM cgroup; its workflow code, configuration, dependencies and transfer destinations must be trusted. Guest file downloads currently buffer individual files in the supervisor, so the VMM memory limit is not a total host-resource budget. Kernel work outside that cgroup is likewise not charged to its CPU quota. Operators own TAP setup, network filtering, parent resources and crash recovery. This mode remains experimental pending the remaining control-plane resource and adversarial validation.
24
+
25
+ Egress policies restrict sandbox outbound connections, not host model-provider calls, image downloads or cloud control-plane traffic. Vercel domain rules inspect TLS SNI rather than encrypted HTTP Host headers; allowed CIDRs grant independent IP access and denied CIDRs take precedence. A domain allowlist is not a general defense against exfiltration through allowed services or shared infrastructure. Mounted host sockets can expose separate network capabilities. Outpost copies network configuration at provider composition.
26
+
27
+ Daytona egress is sent at creation and confirmed through its network-update API before Outpost prepares the workspace or exposes the lease. A rejected confirmation fails acquisition and triggers deletion. Tier 3/4 and WRITE_SANDBOXES are required; native creation options alone do not establish this guarantee. Autonomous image startup precedes confirmation and must be trusted, without embedded secrets or startup workloads. Unsupported combinations and wildcard patterns that would implicitly grant apex access are rejected. Docker/Podman allowlists remain unsupported; local and Firecracker execution reject Outpost egress policies. See the bilingual outbound-network guide for capabilities and live-validation limits.
28
+
29
+ Signed workflow gates verify an Ed25519 key bound to an approver, not a human login. The signing service must authenticate the user and their intent. Keep private keys outside worker sandboxes; trust the configured verifier and public-key source. Gate authentication requirements participate in checkpoint identity, but signatures do not authenticate checkpoint storage. Revocation rejects new proofs and does not undo already persisted decisions. HTTP queue bearer tokens authorize all queue operations; dynamic token sources allow rotation, not tenant isolation. Use trusted TLS termination for remote connections. Idempotency keys only prevent duplicate external effects when the effect service atomically deduplicates them and retains receipts throughout the replay window.
@@ -1,4 +1,7 @@
1
+ import { quotaMatcher } from "./quota.js";
2
+ import { antigravityQuotaPatterns } from "./quota.constants.js";
1
3
  import { antigravityCredentials } from "./antigravity-authentication.js";
4
+ import { antigravityVariables } from "./antigravity.constants.js";
2
5
  import { antigravityEvents } from "./antigravity-events.js";
3
6
  import { antigravityRequest } from "./antigravity-request.js";
4
7
  import { credentialPlanner } from "./authentication.js";
@@ -11,15 +14,17 @@ function bindAntigravity(settings) {
11
14
  name: "antigravity",
12
15
  ...(credentials ? { credentials } : {}),
13
16
  bootstrap: "antigravity",
14
- resumable: false,
17
+ resumable: true,
18
+ forkable: false,
15
19
  capture: false,
16
20
  requiresFinishedEvent: true,
17
21
  variables: Object.freeze({
18
- AGY_CLI_DISABLE_AUTO_UPDATE: "true",
22
+ ...antigravityVariables,
19
23
  ...settings.variables,
20
24
  }),
21
25
  request: (input) => antigravityRequest(settings, input),
22
26
  events: antigravityEvents,
27
+ quota: quotaMatcher(antigravityQuotaPatterns),
23
28
  });
24
29
  }
25
30
  export function antigravityHarness(settings = {}) {
@@ -1 +1 @@
1
- {"version":3,"file":"antigravity-adapter.js","sourceRoot":"","sources":["../../../src/adapters/agents/antigravity-adapter.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AACzE,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAE9D,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAGnE,SAAS,eAAe,CAAC,QAAoC;IAC3D,YAAY,CAAC,uBAAuB,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAC;IACtD,MAAM,WAAW,GAAG,iBAAiB,CACnC,aAAa,EACb,sBAAsB,EACtB,QAAQ,CAAC,cAAc,EACvB,QAAQ,CAAC,KAAK,CACf,CAAC;IACF,OAAO,MAAM,CAAC,MAAM,CAAC;QACnB,IAAI,EAAE,aAAa;QACnB,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACvC,SAAS,EAAE,aAAa;QACxB,SAAS,EAAE,KAAK;QAChB,OAAO,EAAE,KAAK;QACd,qBAAqB,EAAE,IAAI;QAC3B,SAAS,EAAE,MAAM,CAAC,MAAM,CAAC;YACvB,2BAA2B,EAAE,MAAM;YACnC,GAAG,QAAQ,CAAC,SAAS;SACtB,CAAC;QACF,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,kBAAkB,CAAC,QAAQ,EAAE,KAAK,CAAC;QACvD,MAAM,EAAE,iBAAiB;KACH,CAAC,CAAC;AAC5B,CAAC;AAED,MAAM,UAAU,kBAAkB,CAChC,WAAgC,EAAE;IAElC,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,eAAe,CAAC;YACd,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 { antigravityCredentials } from \"./antigravity-authentication.ts\";\nimport { antigravityEvents } from \"./antigravity-events.ts\";\nimport { antigravityRequest } from \"./antigravity-request.ts\";\nimport type { AntigravitySettings } from \"./antigravity.types.ts\";\nimport { credentialPlanner } from \"./authentication.ts\";\nimport { antigravityModelSupport } from \"./model-support.constants.ts\";\nimport { harnessSettings, supportModel } from \"./model-support.ts\";\nimport type { Bound } from \"./settings.types.ts\";\n\nfunction bindAntigravity(settings: Bound<AntigravitySettings>): AgentAdapter {\n supportModel(antigravityModelSupport, settings.model);\n const credentials = credentialPlanner(\n \"Antigravity\",\n antigravityCredentials,\n settings.authentication,\n settings.model,\n );\n return Object.freeze({\n name: \"antigravity\",\n ...(credentials ? { credentials } : {}),\n bootstrap: \"antigravity\",\n resumable: false,\n capture: false,\n requiresFinishedEvent: true,\n variables: Object.freeze({\n AGY_CLI_DISABLE_AUTO_UPDATE: \"true\",\n ...settings.variables,\n }),\n request: (input) => antigravityRequest(settings, input),\n events: antigravityEvents,\n } satisfies AgentAdapter);\n}\n\nexport function antigravityHarness(\n settings: AntigravitySettings = {},\n): 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 bindAntigravity({\n ...configured,\n ...(model === undefined ? {} : { model }),\n }),\n });\n}\n"]}
1
+ {"version":3,"file":"antigravity-adapter.js","sourceRoot":"","sources":["../../../src/adapters/agents/antigravity-adapter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAGhE,OAAO,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AACzE,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAE9D,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAGnE,SAAS,eAAe,CAAC,QAAoC;IAC3D,YAAY,CAAC,uBAAuB,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAC;IACtD,MAAM,WAAW,GAAG,iBAAiB,CACnC,aAAa,EACb,sBAAsB,EACtB,QAAQ,CAAC,cAAc,EACvB,QAAQ,CAAC,KAAK,CACf,CAAC;IACF,OAAO,MAAM,CAAC,MAAM,CAAC;QACnB,IAAI,EAAE,aAAa;QACnB,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACvC,SAAS,EAAE,aAAa;QACxB,SAAS,EAAE,IAAI;QACf,QAAQ,EAAE,KAAK;QACf,OAAO,EAAE,KAAK;QACd,qBAAqB,EAAE,IAAI;QAC3B,SAAS,EAAE,MAAM,CAAC,MAAM,CAAC;YACvB,GAAG,oBAAoB;YACvB,GAAG,QAAQ,CAAC,SAAS;SACtB,CAAC;QACF,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,kBAAkB,CAAC,QAAQ,EAAE,KAAK,CAAC;QACvD,MAAM,EAAE,iBAAiB;QACzB,KAAK,EAAE,YAAY,CAAC,wBAAwB,CAAC;KACvB,CAAC,CAAC;AAC5B,CAAC;AAED,MAAM,UAAU,kBAAkB,CAChC,WAAgC,EAAE;IAElC,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,eAAe,CAAC;YACd,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 { quotaMatcher } from \"./quota.ts\";\nimport { antigravityQuotaPatterns } from \"./quota.constants.ts\";\nimport type { AgentAdapter, CliHarness } from \"../../domain/agent.types.ts\";\nimport type { AgentModel } from \"../../domain/model.types.ts\";\nimport { antigravityCredentials } from \"./antigravity-authentication.ts\";\nimport { antigravityVariables } from \"./antigravity.constants.ts\";\nimport { antigravityEvents } from \"./antigravity-events.ts\";\nimport { antigravityRequest } from \"./antigravity-request.ts\";\nimport type { AntigravitySettings } from \"./antigravity.types.ts\";\nimport { credentialPlanner } from \"./authentication.ts\";\nimport { antigravityModelSupport } from \"./model-support.constants.ts\";\nimport { harnessSettings, supportModel } from \"./model-support.ts\";\nimport type { Bound } from \"./settings.types.ts\";\n\nfunction bindAntigravity(settings: Bound<AntigravitySettings>): AgentAdapter {\n supportModel(antigravityModelSupport, settings.model);\n const credentials = credentialPlanner(\n \"Antigravity\",\n antigravityCredentials,\n settings.authentication,\n settings.model,\n );\n return Object.freeze({\n name: \"antigravity\",\n ...(credentials ? { credentials } : {}),\n bootstrap: \"antigravity\",\n resumable: true,\n forkable: false,\n capture: false,\n requiresFinishedEvent: true,\n variables: Object.freeze({\n ...antigravityVariables,\n ...settings.variables,\n }),\n request: (input) => antigravityRequest(settings, input),\n events: antigravityEvents,\n quota: quotaMatcher(antigravityQuotaPatterns),\n } satisfies AgentAdapter);\n}\n\nexport function antigravityHarness(\n settings: AntigravitySettings = {},\n): 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 bindAntigravity({\n ...configured,\n ...(model === undefined ? {} : { model }),\n }),\n });\n}\n"]}
@@ -1,6 +1,6 @@
1
1
  import { antigravityRequest } from "./antigravity-request.js";
2
2
  import { helpDiagnostics } from "./cli-diagnostics.js";
3
3
  export function antigravityDiagnostics() {
4
- return helpDiagnostics((input) => antigravityRequest({}, input), "Usage of agy:");
4
+ return helpDiagnostics((input) => antigravityRequest({}, input), "Usage of agy:", true);
5
5
  }
6
6
  //# sourceMappingURL=antigravity-diagnostics.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"antigravity-diagnostics.js","sourceRoot":"","sources":["../../../src/adapters/agents/antigravity-diagnostics.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAEvD,MAAM,UAAU,sBAAsB;IACpC,OAAO,eAAe,CACpB,CAAC,KAAK,EAAE,EAAE,CAAC,kBAAkB,CAAC,EAAE,EAAE,KAAK,CAAC,EACxC,eAAe,CAChB,CAAC;AACJ,CAAC","sourcesContent":["import { antigravityRequest } from \"./antigravity-request.ts\";\nimport { helpDiagnostics } from \"./cli-diagnostics.ts\";\n\nexport function antigravityDiagnostics() {\n return helpDiagnostics(\n (input) => antigravityRequest({}, input),\n \"Usage of agy:\",\n );\n}\n"]}
1
+ {"version":3,"file":"antigravity-diagnostics.js","sourceRoot":"","sources":["../../../src/adapters/agents/antigravity-diagnostics.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAEvD,MAAM,UAAU,sBAAsB;IACpC,OAAO,eAAe,CACpB,CAAC,KAAK,EAAE,EAAE,CAAC,kBAAkB,CAAC,EAAE,EAAE,KAAK,CAAC,EACxC,eAAe,EACf,IAAI,CACL,CAAC;AACJ,CAAC","sourcesContent":["import { antigravityRequest } from \"./antigravity-request.ts\";\nimport { helpDiagnostics } from \"./cli-diagnostics.ts\";\n\nexport function antigravityDiagnostics() {\n return helpDiagnostics(\n (input) => antigravityRequest({}, input),\n \"Usage of agy:\",\n true,\n );\n}\n"]}
@@ -1,19 +1,28 @@
1
+ import { toolResult } from "./tool-result.js";
1
2
  import { decodeLine } from "./event-decoder.js";
2
3
  import { asRecord, numberOrZero } from "./protocol.js";
3
4
  const steps = {
4
5
  agent_response: (step) => typeof step.text_delta === "string" && step.text_delta
5
6
  ? [{ kind: "text", text: step.text_delta }]
6
7
  : [],
7
- tool: (step) => typeof step.tool_name === "string" &&
8
- (step.state === "DONE" || step.state === "ERROR")
9
- ? [
10
- {
11
- kind: "tool",
12
- name: step.tool_name,
13
- input: asRecord(step.tool_info).parameters,
14
- },
15
- ]
16
- : [],
8
+ tool: (step) => {
9
+ if (typeof step.tool_name !== "string")
10
+ return [];
11
+ const callId = typeof step.step_index === "number" &&
12
+ Number.isSafeInteger(step.step_index)
13
+ ? `${String(step.conversation_id ?? "turn")}:${step.step_index}`
14
+ : undefined;
15
+ const info = asRecord(step.tool_info);
16
+ if (step.state === "ACTIVE" && callId)
17
+ return [
18
+ { kind: "tool", name: step.tool_name, input: info.parameters, callId },
19
+ ];
20
+ if (step.state !== "DONE" && step.state !== "ERROR")
21
+ return [];
22
+ if (callId)
23
+ return toolResult(callId, step.tool_name, info.result ?? info.output, step.state === "ERROR");
24
+ return [{ kind: "tool", name: step.tool_name, input: info.parameters }];
25
+ },
17
26
  };
18
27
  function failure(result, response) {
19
28
  if (typeof result.error === "string" && result.error)
@@ -1 +1 @@
1
- {"version":3,"file":"antigravity-events.js","sourceRoot":"","sources":["../../../src/adapters/agents/antigravity-events.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAGvD,MAAM,KAAK,GAAkB;IAC3B,cAAc,EAAE,CAAC,IAAI,EAAE,EAAE,CACvB,OAAO,IAAI,CAAC,UAAU,KAAK,QAAQ,IAAI,IAAI,CAAC,UAAU;QACpD,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,UAAU,EAAE,CAAC;QAC3C,CAAC,CAAC,EAAE;IACR,IAAI,EAAE,CAAC,IAAI,EAAE,EAAE,CACb,OAAO,IAAI,CAAC,SAAS,KAAK,QAAQ;QAClC,CAAC,IAAI,CAAC,KAAK,KAAK,MAAM,IAAI,IAAI,CAAC,KAAK,KAAK,OAAO,CAAC;QAC/C,CAAC,CAAC;YACE;gBACE,IAA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AC,MAAM,KAAK,SAAS,IAAI,QAAQ,CAAC,IAAI,EAAE;QAChD,OAAO;YACL,GAAG,MAAM;YACT,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAE;YAClC,EAAE,IAAI,EAAE,UAAU,EAAE;SACrB,CAAC;IACJ,OAAO,CAAC,GAAG,MAAM,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,CAAC,MAAM,EAAE,QAAQ,CAAC,EAAE,CAAC,CAAC;AAC9E,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,IAAY;IAC5C,OAAO,UAAU,CACf,IAAI,EACJ;QACE,IAAI,EAAE,CAAC,KAAK,EAAE,EAAE,CACd,OAAO,KAAK,CAAC,eAAe,KAAK,QAAQ;YACvC,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,cAAc,EAAE,EAAE,EAAE,KAAK,CAAC,eAAe,EAAE,CAAC;YACvD,CAAC,CAAC,EAAE;QACR,WAAW,EAAE,CAAC,KAAK,EAAE,EAAE;YACrB,MAAM,IAAI,GAAG,QAAQ,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;YACzC,MAAM,MAAM,GACV,OAAO,IAAI,CAAC,SAAS,KAAK,QAAQ;gBAClC,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC;gBAClC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC;gBACvB,CAAC,CAAC,SAAS,CAAC;YAChB,OAAO,MAAM,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;QAC9B,CAAC;QACD,MAAM;KACP,EACD,OAAO,CACR,CAAC;AACJ,CAAC","sourcesContent":["import type { AgentEvent } from \"../../domain/agent.types.ts\";\nimport { decodeLine } from \"./event-decoder.ts\";\nimport { asRecord, numberOrZero } from \"./protocol.ts\";\nimport type { EventDecoders, ProtocolRecord } from \"./protocol.types.ts\";\n\nconst steps: EventDecoders = {\n agent_response: (step) =>\n typeof step.text_delta === \"string\" && step.text_delta\n ? [{ kind: \"text\", text: step.text_delta }]\n : [],\n tool: (step) =>\n typeof step.tool_name === \"string\" &&\n (step.state === \"DONE\" || step.state === \"ERROR\")\n ? [\n {\n kind: \"tool\",\n name: step.tool_name,\n input: asRecord(step.tool_info).parameters,\n },\n ]\n : [],\n};\n\nfunction failure(result: ProtocolRecord, response: string): string {\n if (typeof result.error === \"string\" && result.error) return result.error;\n if (result.status === \"SUCCESS\" && !response.trim())\n return \"Antigravity returned an empty response\";\n return `Antigravity ended the turn with status ${String(result.status ?? \"unknown\")}`;\n}\n\nfunction result(event: ProtocolRecord): AgentEvent[] {\n const result = asRecord(event.result);\n const usage = asRecord(result.usage);\n const response = typeof result.response === \"string\" ? result.response : \"\";\n const events: AgentEvent[] = Object.keys(usage).length\n ? [\n {\n kind: \"usage\",\n tokens: {\n input: numberOrZero(usage.input_tokens),\n cached: numberOrZero(usage.cache_read_tokens),\n output:\n numberOrZero(usage.output_tokens) +\n numberOrZero(usage.thinking_tokens),\n },\n },\n ]\n : [];\n if (result.status === \"SUCCESS\" && response.trim())\n return [\n ...events,\n { kind: \"result\", text: response },\n { kind: \"finished\" },\n ];\n return [...events, { kind: \"failure\", message: failure(result, response) }];\n}\n\nexport function antigravityEvents(line: string): AgentEvent[] {\n return decodeLine(\n line,\n {\n init: (event) =>\n typeof event.conversation_id === \"string\"\n ? [{ kind: \"conversation\", id: event.conversation_id }]\n : [],\n step_update: (event) => {\n const step = asRecord(event.step_update);\n const decode =\n typeof step.step_type === \"string\" &&\n Object.hasOwn(steps, step.step_type)\n ? steps[step.step_type]\n : undefined;\n return decode?.(step) ?? [];\n },\n result,\n },\n \"event\",\n );\n}\n"]}
1
+ {"version":3,"file":"antigravity-events.js","sourceRoot":"","sources":["../../../src/adapters/agents/antigravity-events.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,OAAO,EAAE,U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M,CAAC,MAAM,KAAK,SAAS,IAAI,QAAQ,CAAC,IAAI,EAAE;QAChD,OAAO;YACL,GAAG,MAAM;YACT,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAE;YAClC,EAAE,IAAI,EAAE,UAAU,EAAE;SACrB,CAAC;IACJ,OAAO,CAAC,GAAG,MAAM,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,CAAC,MAAM,EAAE,QAAQ,CAAC,EAAE,CAAC,CAAC;AAC9E,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,IAAY;IAC5C,OAAO,UAAU,CACf,IAAI,EACJ;QACE,IAAI,EAAE,CAAC,KAAK,EAAE,EAAE,CACd,OAAO,KAAK,CAAC,eAAe,KAAK,QAAQ;YACvC,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,cAAc,EAAE,EAAE,EAAE,KAAK,CAAC,eAAe,EAAE,CAAC;YACvD,CAAC,CAAC,EAAE;QACR,WAAW,EAAE,CAAC,KAAK,EAAE,EAAE;YACrB,MAAM,IAAI,GAAG,QAAQ,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;YACzC,MAAM,MAAM,GACV,OAAO,IAAI,CAAC,SAAS,KAAK,QAAQ;gBAClC,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC;gBAClC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC;gBACvB,CAAC,CAAC,SAAS,CAAC;YAChB,OAAO,MAAM,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;QAC9B,CAAC;QACD,MAAM;KACP,EACD,OAAO,CACR,CAAC;AACJ,CAAC","sourcesContent":["import { toolResult } from \"./tool-result.ts\";\nimport type { AgentEvent } from \"../../domain/agent.types.ts\";\nimport { decodeLine } from \"./event-decoder.ts\";\nimport { asRecord, numberOrZero } from \"./protocol.ts\";\nimport type { EventDecoders, ProtocolRecord } from \"./protocol.types.ts\";\n\nconst steps: EventDecoders = {\n agent_response: (step) =>\n typeof step.text_delta === \"string\" && step.text_delta\n ? [{ kind: \"text\", text: step.text_delta }]\n : [],\n tool: (step) => {\n if (typeof step.tool_name !== \"string\") return [];\n const callId =\n typeof step.step_index === \"number\" &&\n Number.isSafeInteger(step.step_index)\n ? `${String(step.conversation_id ?? \"turn\")}:${step.step_index}`\n : undefined;\n const info = asRecord(step.tool_info);\n if (step.state === \"ACTIVE\" && callId)\n return [\n { kind: \"tool\", name: step.tool_name, input: info.parameters, callId },\n ];\n if (step.state !== \"DONE\" && step.state !== \"ERROR\") return [];\n if (callId)\n return toolResult(\n callId,\n step.tool_name,\n info.result ?? info.output,\n step.state === \"ERROR\",\n );\n return [{ kind: \"tool\", name: step.tool_name, input: info.parameters }];\n },\n};\n\nfunction failure(result: ProtocolRecord, response: string): string {\n if (typeof result.error === \"string\" && result.error) return result.error;\n if (result.status === \"SUCCESS\" && !response.trim())\n return \"Antigravity returned an empty response\";\n return `Antigravity ended the turn with status ${String(result.status ?? \"unknown\")}`;\n}\n\nfunction result(event: ProtocolRecord): AgentEvent[] {\n const result = asRecord(event.result);\n const usage = asRecord(result.usage);\n const response = typeof result.response === \"string\" ? result.response : \"\";\n const events: AgentEvent[] = Object.keys(usage).length\n ? [\n {\n kind: \"usage\",\n tokens: {\n input: numberOrZero(usage.input_tokens),\n cached: numberOrZero(usage.cache_read_tokens),\n output:\n numberOrZero(usage.output_tokens) +\n numberOrZero(usage.thinking_tokens),\n },\n },\n ]\n : [];\n if (result.status === \"SUCCESS\" && response.trim())\n return [\n ...events,\n { kind: \"result\", text: response },\n { kind: \"finished\" },\n ];\n return [...events, { kind: \"failure\", message: failure(result, response) }];\n}\n\nexport function antigravityEvents(line: string): AgentEvent[] {\n return decodeLine(\n line,\n {\n init: (event) =>\n typeof event.conversation_id === \"string\"\n ? [{ kind: \"conversation\", id: event.conversation_id }]\n : [],\n step_update: (event) => {\n const step = asRecord(event.step_update);\n const decode =\n typeof step.step_type === \"string\" &&\n Object.hasOwn(steps, step.step_type)\n ? steps[step.step_type]\n : undefined;\n return decode?.(step) ?? [];\n },\n result,\n },\n \"event\",\n );\n}\n"]}
@@ -1,7 +1,13 @@
1
+ import { validId } from "../../infrastructure/conversations/identity.js";
1
2
  import { invariant } from "../../domain/errors.js";
3
+ import { antigravityVariables } from "./antigravity.constants.js";
2
4
  export function antigravityRequest(settings, input) {
3
- invariant(!input.continuation, "Antigravity does not support continuation or fork in Outpost");
5
+ invariant(!input.continuation?.fork, "Antigravity does not support automated fork in Outpost");
4
6
  const args = [];
7
+ if (input.continuation) {
8
+ validId(input.continuation.id);
9
+ args.push("--conversation", input.continuation.id);
10
+ }
5
11
  if (settings.model)
6
12
  args.push("--model", settings.model.name);
7
13
  if (settings.mode)
@@ -9,6 +15,7 @@ export function antigravityRequest(settings, input) {
9
15
  if (input.interactive)
10
16
  return {
11
17
  executable: "agy",
18
+ variables: antigravityVariables,
12
19
  arguments: [
13
20
  ...args,
14
21
  ...(input.text === undefined
@@ -22,6 +29,7 @@ export function antigravityRequest(settings, input) {
22
29
  args.push("--input-format", "stream-json", "--output-format", "stream-json");
23
30
  return {
24
31
  executable: "agy",
32
+ variables: antigravityVariables,
25
33
  arguments: args,
26
34
  stdin: `${JSON.stringify({ event: "user", message: { content: input.text ?? "" } })}\n`,
27
35
  };
@@ -1 +1 @@
1
- {"version":3,"file":"antigravity-request.js","sourceRoot":"","sources":["../../../src/adapters/agents/antigravity-request.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAInD,MAAM,UAAU,kBAAkB,CAChC,QAAoC,EACpC,KAAiB;IAEjB,SAAS,CACP,CAAC,KAAK,CAAC,YAAY,EACnB,8DAA8D,CAC/D,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,QAAQ,CAAC,IAAI;QAAE,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC;IACtD,IAAI,KAAK,CAAC,WAAW;QACnB,OAAO;YACL,UAAU,EAAE,KAAK;YACjB,SAAS,EAAE;gBACT,GAAG,IAAI;gBACP,GAAG,CAAC,KAAK,CAAC,IAAI,KAAK,SAAS;oBAC1B,CAAC,CAAC,EAAE;oBACJ,CAAC,CAAC,CAAC,sBAAsB,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;aAC1C;YACD,WAAW,EAAE,IAAI;SAClB,CAAC;IACJ,IAAI,CAAC,QAAQ,CAAC,IAAI;QAAE,IAAI,CAAC,IAAI,CAAC,gCAAgC,CAAC,CAAC;IAChE,IAAI,CAAC,IAAI,CAAC,gBAAgB,EAAE,aAAa,EAAE,iBAAiB,EAAE,aAAa,CAAC,CAAC;IAC7E,OAAO;QACL,UAAU,EAAE,KAAK;QACjB,SAAS,EAAE,IAAI;QACf,KAAK,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,OAAO,EAAE,KAAK,CAAC,IAAI,IAAI,EAAE,EAAE,EAAE,CAAC,IAAI;KACxF,CAAC;AACJ,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 { AntigravitySettings } from \"./antigravity.types.ts\";\nimport type { Bound } from \"./settings.types.ts\";\n\nexport function antigravityRequest(\n settings: Bound<AntigravitySettings>,\n input: AgentInput,\n): Command {\n invariant(\n !input.continuation,\n \"Antigravity 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 (settings.mode) args.push(\"--mode\", settings.mode);\n if (input.interactive)\n return {\n executable: \"agy\",\n arguments: [\n ...args,\n ...(input.text === undefined\n ? []\n : [\"--prompt-interactive\", input.text]),\n ],\n interactive: true,\n };\n if (!settings.mode) args.push(\"--dangerously-skip-permissions\");\n args.push(\"--input-format\", \"stream-json\", \"--output-format\", \"stream-json\");\n return {\n executable: \"agy\",\n arguments: args,\n stdin: `${JSON.stringify({ event: \"user\", message: { content: input.text ?? \"\" } })}\\n`,\n };\n}\n"]}
1
+ {"version":3,"file":"antigravity-request.js","sourceRoot":"","sources":["../../../src/adapters/agents/antigravity-request.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,gDAAgD,CAAC;AAGzE,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAIlE,MAAM,UAAU,kBAAkB,CAChC,QAAoC,EACpC,KAAiB;IAEjB,SAAS,CACP,CAAC,KAAK,CAAC,YAAY,EAAE,IAAI,EACzB,wDAAwD,CACzD,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,gBAAgB,EAAE,KAAK,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC;IACrD,CAAC;IACD,IAAI,QAAQ,CAAC,KAAK;QAAE,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC9D,IAAI,QAAQ,CAAC,IAAI;QAAE,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC;IACtD,IAAI,KAAK,CAAC,WAAW;QACnB,OAAO;YACL,UAAU,EAAE,KAAK;YACjB,SAAS,EAAE,oBAAoB;YAC/B,SAAS,EAAE;gBACT,GAAG,IAAI;gBACP,GAAG,CAAC,KAAK,CAAC,IAAI,KAAK,SAAS;oBAC1B,CAAC,CAAC,EAAE;oBACJ,CAAC,CAAC,CAAC,sBAAsB,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;aAC1C;YACD,WAAW,EAAE,IAAI;SAClB,CAAC;IACJ,IAAI,CAAC,QAAQ,CAAC,IAAI;QAAE,IAAI,CAAC,IAAI,CAAC,gCAAgC,CAAC,CAAC;IAChE,IAAI,CAAC,IAAI,CAAC,gBAAgB,EAAE,aAAa,EAAE,iBAAiB,EAAE,aAAa,CAAC,CAAC;IAC7E,OAAO;QACL,UAAU,EAAE,KAAK;QACjB,SAAS,EAAE,oBAAoB;QAC/B,SAAS,EAAE,IAAI;QACf,KAAK,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,OAAO,EAAE,KAAK,CAAC,IAAI,IAAI,EAAE,EAAE,EAAE,CAAC,IAAI;KACxF,CAAC;AACJ,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 { antigravityVariables } from \"./antigravity.constants.ts\";\nimport type { AntigravitySettings } from \"./antigravity.types.ts\";\nimport type { Bound } from \"./settings.types.ts\";\n\nexport function antigravityRequest(\n settings: Bound<AntigravitySettings>,\n input: AgentInput,\n): Command {\n invariant(\n !input.continuation?.fork,\n \"Antigravity does not support automated fork in Outpost\",\n );\n const args: string[] = [];\n if (input.continuation) {\n validId(input.continuation.id);\n args.push(\"--conversation\", input.continuation.id);\n }\n if (settings.model) args.push(\"--model\", settings.model.name);\n if (settings.mode) args.push(\"--mode\", settings.mode);\n if (input.interactive)\n return {\n executable: \"agy\",\n variables: antigravityVariables,\n arguments: [\n ...args,\n ...(input.text === undefined\n ? []\n : [\"--prompt-interactive\", input.text]),\n ],\n interactive: true,\n };\n if (!settings.mode) args.push(\"--dangerously-skip-permissions\");\n args.push(\"--input-format\", \"stream-json\", \"--output-format\", \"stream-json\");\n return {\n executable: \"agy\",\n variables: antigravityVariables,\n arguments: args,\n stdin: `${JSON.stringify({ event: \"user\", message: { content: input.text ?? \"\" } })}\\n`,\n };\n}\n"]}
@@ -0,0 +1,3 @@
1
+ export declare const antigravityVariables: Readonly<{
2
+ AGY_CLI_DISABLE_AUTO_UPDATE: "true";
3
+ }>;
@@ -0,0 +1,4 @@
1
+ export const antigravityVariables = Object.freeze({
2
+ AGY_CLI_DISABLE_AUTO_UPDATE: "true",
3
+ });
4
+ //# sourceMappingURL=antigravity.constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"antigravity.constants.js","sourceRoot":"","sources":["../../../src/adapters/agents/antigravity.constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,oBAAoB,GAAG,MAAM,CAAC,MAAM,CAAC;IAChD,2BAA2B,EAAE,MAAM;CACpC,CAAC,CAAC","sourcesContent":["export const antigravityVariables = Object.freeze({\n AGY_CLI_DISABLE_AUTO_UPDATE: \"true\",\n});\n"]}
@@ -1,3 +1,5 @@
1
+ import { quotaMatcher } from "./quota.js";
2
+ import { claudeQuotaPatterns } from "./quota.constants.js";
1
3
  import { invariant } from "../../domain/errors.js";
2
4
  import { credentialPlanner } from "./authentication.js";
3
5
  import { claudeCredentials } from "./claude-authentication.js";
@@ -25,6 +27,7 @@ function bindClaude(settings) {
25
27
  }),
26
28
  request: (input) => claudeRequest(settings, input),
27
29
  events: claudeEvents,
30
+ quota: quotaMatcher(claudeQuotaPatterns),
28
31
  transcriptUsage: claudeTranscriptUsage,
29
32
  });
30
33
  }
@@ -1 +1 @@
1
- {"version":3,"file":"claude-adapter.js","sourceRoot":"","sources":["../../../src/adapters/agents/claude-adapter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAEnD,OAAO,EAA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,CAAC,EAAE,CAAC;SAC/D,CAAC;QACF,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,aAAa,CAAC,QAAQ,EAAE,KAAK,CAAC;QAClD,MAAM,EAAE,YAAY;QACpB,eAAe,EAAE,qBAAqB;KAChB,CAAC,CAAC;AAC5B,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,WAA2B,EAAE;IACzD,eAAe,CAAC,QAAQ,CAAC,CAAC;IAC1B,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC;QAC/B,GAAG,QAAQ;QACX,SAAS,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,GAAG,QAAQ,CAAC,SAAS,EAAE,CAAC;KACpD,CAAC,CAAC;IACH,OAAO,MAAM,CAAC,MAAM,CAAC;QACnB,IAAI,EAAE,KAAK;QACX,IAAI,EAAE,CAAC,KAAkB,EAAE,EAAE,CAC3B,UAAU,CAAC;YACT,GAAG,UAAU;YACb,GAAG,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC;SAC1C,CAAC;KACL,CAAC,CAAC;AACL,CAAC","sourcesContent":["import { invariant } from \"../../domain/errors.ts\";\nimport type { AgentModel } from \"../../domain/model.types.ts\";\nimport { credentialPlanner } from \"./authentication.ts\";\nimport { claudeCredentials } from \"./claude-authentication.ts\";\nimport type { AgentAdapter, CliHarness } from \"../../domain/agent.types.ts\";\nimport { claudeEvents, claudeTranscriptUsage } from \"./claude-events.ts\";\nimport { claudeRequest } from \"./claude-request.ts\";\nimport {\n CLAUDE_MAX_OUTPUT_VARIABLE,\n claudeModelSupport,\n} from \"./model-support.constants.ts\";\nimport { harnessSettings, supportModel } from \"./model-support.ts\";\nimport type { Bound, ClaudeSettings } from \"./settings.types.ts\";\n\nfunction bindClaude(settings: Bound<ClaudeSettings>): AgentAdapter {\n supportModel(claudeModelSupport, settings.model);\n const maxOutputTokens = settings.model?.maxOutputTokens;\n invariant(\n maxOutputTokens === undefined ||\n !Object.hasOwn(settings.variables ?? {}, CLAUDE_MAX_OUTPUT_VARIABLE),\n `Set maxOutputTokens on the agent model or ${CLAUDE_MAX_OUTPUT_VARIABLE}, not both`,\n );\n const credentials = credentialPlanner(\n \"Claude Code\",\n claudeCredentials,\n settings.authentication,\n settings.model,\n );\n return Object.freeze({\n name: \"claude\",\n ...(credentials ? { credentials } : {}),\n conversations: \"claude\",\n resumable: true,\n capture: settings.saveConversations ?? true,\n variables: Object.freeze({\n ...settings.variables,\n ...(maxOutputTokens === undefined\n ? {}\n : { [CLAUDE_MAX_OUTPUT_VARIABLE]: String(maxOutputTokens) }),\n }),\n request: (input) => claudeRequest(settings, input),\n events: claudeEvents,\n transcriptUsage: claudeTranscriptUsage,\n } satisfies AgentAdapter);\n}\n\nexport function claudeHarness(settings: ClaudeSettings = {}): CliHarness {\n harnessSettings(settings);\n const configured = Object.freeze({\n ...settings,\n variables: Object.freeze({ ...settings.variables }),\n });\n return Object.freeze({\n kind: \"cli\",\n bind: (model?: AgentModel) =>\n bindClaude({\n ...configured,\n ...(model === undefined ? {} : { model }),\n }),\n });\n}\n"]}
1
+ {"version":3,"file":"claude-adapter.js","sourceRoot":"","sources":["../../../src/adapters/agents/claude-adapter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAEnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAE/D,OAAO,EAAE,YAAY,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AACzE,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EACL,0BAA0B,EAC1B,kBAAkB,GACnB,MA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AU,aAAa,CAAC,WAA2B,EAAE;IACzD,eAAe,CAAC,QAAQ,CAAC,CAAC;IAC1B,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC;QAC/B,GAAG,QAAQ;QACX,SAAS,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,GAAG,QAAQ,CAAC,SAAS,EAAE,CAAC;KACpD,CAAC,CAAC;IACH,OAAO,MAAM,CAAC,MAAM,CAAC;QACnB,IAAI,EAAE,KAAK;QACX,IAAI,EAAE,CAAC,KAAkB,EAAE,EAAE,CAC3B,UAAU,CAAC;YACT,GAAG,UAAU;YACb,GAAG,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC;SAC1C,CAAC;KACL,CAAC,CAAC;AACL,CAAC","sourcesContent":["import { quotaMatcher } from \"./quota.ts\";\nimport { claudeQuotaPatterns } from \"./quota.constants.ts\";\nimport { invariant } from \"../../domain/errors.ts\";\nimport type { AgentModel } from \"../../domain/model.types.ts\";\nimport { credentialPlanner } from \"./authentication.ts\";\nimport { claudeCredentials } from \"./claude-authentication.ts\";\nimport type { AgentAdapter, CliHarness } from \"../../domain/agent.types.ts\";\nimport { claudeEvents, claudeTranscriptUsage } from \"./claude-events.ts\";\nimport { claudeRequest } from \"./claude-request.ts\";\nimport {\n CLAUDE_MAX_OUTPUT_VARIABLE,\n claudeModelSupport,\n} from \"./model-support.constants.ts\";\nimport { harnessSettings, supportModel } from \"./model-support.ts\";\nimport type { Bound, ClaudeSettings } from \"./settings.types.ts\";\n\nfunction bindClaude(settings: Bound<ClaudeSettings>): AgentAdapter {\n supportModel(claudeModelSupport, settings.model);\n const maxOutputTokens = settings.model?.maxOutputTokens;\n invariant(\n maxOutputTokens === undefined ||\n !Object.hasOwn(settings.variables ?? {}, CLAUDE_MAX_OUTPUT_VARIABLE),\n `Set maxOutputTokens on the agent model or ${CLAUDE_MAX_OUTPUT_VARIABLE}, not both`,\n );\n const credentials = credentialPlanner(\n \"Claude Code\",\n claudeCredentials,\n settings.authentication,\n settings.model,\n );\n return Object.freeze({\n name: \"claude\",\n ...(credentials ? { credentials } : {}),\n conversations: \"claude\",\n resumable: true,\n capture: settings.saveConversations ?? true,\n variables: Object.freeze({\n ...settings.variables,\n ...(maxOutputTokens === undefined\n ? {}\n : { [CLAUDE_MAX_OUTPUT_VARIABLE]: String(maxOutputTokens) }),\n }),\n request: (input) => claudeRequest(settings, input),\n events: claudeEvents,\n quota: quotaMatcher(claudeQuotaPatterns),\n transcriptUsage: claudeTranscriptUsage,\n } satisfies AgentAdapter);\n}\n\nexport function claudeHarness(settings: ClaudeSettings = {}): CliHarness {\n harnessSettings(settings);\n const configured = Object.freeze({\n ...settings,\n variables: Object.freeze({ ...settings.variables }),\n });\n return Object.freeze({\n kind: \"cli\",\n bind: (model?: AgentModel) =>\n bindClaude({\n ...configured,\n ...(model === undefined ? {} : { model }),\n }),\n });\n}\n"]}
@@ -1,5 +1,7 @@
1
+ import { toolResult } from "./tool-result.js";
1
2
  import { decodeEvent, decodeLine } from "./event-decoder.js";
2
3
  import { asRecord, decodeRecord, numberOrZero } from "./protocol.js";
4
+ import { claudeQuotaErrors } from "./quota.constants.js";
3
5
  function tokens(value) {
4
6
  const usage = asRecord(value);
5
7
  return {
@@ -14,18 +16,73 @@ function system(event) {
14
16
  ? [{ kind: "conversation", id: event.session_id }]
15
17
  : [];
16
18
  }
19
+ function rateLimit(event) {
20
+ const info = asRecord(event.rate_limit_info);
21
+ if (info.status !== "rejected")
22
+ return [];
23
+ const reset = typeof info.resetsAt === "number" && Number.isSafeInteger(info.resetsAt)
24
+ ? new Date(info.resetsAt * 1000)
25
+ : undefined;
26
+ const limit = typeof info.rateLimitType === "string" ? info.rateLimitType : "usage";
27
+ return [
28
+ {
29
+ kind: "quota",
30
+ message: `Claude Code ${limit} limit reached`,
31
+ ...(reset && Number.isFinite(reset.getTime())
32
+ ? { resetAt: reset.toISOString() }
33
+ : {}),
34
+ },
35
+ ];
36
+ }
17
37
  function assistant(event) {
18
- const content = asRecord(event.message).content;
38
+ const quota = typeof event.error === "string" && claudeQuotaErrors.has(event.error)
39
+ ? [{ kind: "quota", message: `Claude Code reported ${event.error}` }]
40
+ : [];
41
+ const message = asRecord(event.message);
42
+ const content = message.content;
19
43
  if (!Array.isArray(content))
20
- return [];
21
- return content.flatMap((part) => decodeEvent(asRecord(part), {
22
- text: (block) => typeof block.text === "string"
23
- ? [{ kind: "text", text: block.text }]
24
- : [],
25
- tool_use: (block) => [
26
- { kind: "tool", name: String(block.name), input: block.input },
27
- ],
28
- }));
44
+ return quota;
45
+ const usage = message.usage
46
+ ? [
47
+ {
48
+ kind: "message-usage",
49
+ tokens: tokens(message.usage),
50
+ ...(typeof message.id === "string" ? { messageId: message.id } : {}),
51
+ ...(typeof event.parent_tool_use_id === "string"
52
+ ? { parentCallId: event.parent_tool_use_id }
53
+ : {}),
54
+ },
55
+ ]
56
+ : [];
57
+ return [
58
+ ...quota,
59
+ ...usage,
60
+ ...content.flatMap((part) => decodeEvent(asRecord(part), {
61
+ text: (block) => typeof block.text === "string"
62
+ ? [{ kind: "text", text: block.text }]
63
+ : [],
64
+ thinking: (block) => typeof block.thinking === "string"
65
+ ? [{ kind: "reasoning", text: block.thinking }]
66
+ : [],
67
+ tool_result: (block) => toolResult(block.tool_use_id, undefined, block.content, block.is_error === true).map((value) => ({
68
+ ...value,
69
+ ...(typeof event.parent_tool_use_id === "string"
70
+ ? { parentCallId: event.parent_tool_use_id }
71
+ : {}),
72
+ })),
73
+ tool_use: (block) => [
74
+ {
75
+ kind: "tool",
76
+ name: String(block.name),
77
+ input: block.input,
78
+ ...(typeof block.id === "string" ? { callId: block.id } : {}),
79
+ ...(typeof event.parent_tool_use_id === "string"
80
+ ? { parentCallId: event.parent_tool_use_id }
81
+ : {}),
82
+ },
83
+ ],
84
+ })),
85
+ ];
29
86
  }
30
87
  function result(event) {
31
88
  const events = [];
@@ -45,7 +102,17 @@ export function claudeEvents(line) {
45
102
  return decodeLine(line, {
46
103
  system,
47
104
  assistant,
105
+ user: assistant,
106
+ stream_event: (event) => {
107
+ const delta = asRecord(asRecord(event.event).delta);
108
+ if (delta.type === "text_delta" && typeof delta.text === "string")
109
+ return [{ kind: "text-delta", text: delta.text }];
110
+ if (delta.type === "thinking_delta" && typeof delta.thinking === "string")
111
+ return [{ kind: "reasoning", text: delta.thinking }];
112
+ return [];
113
+ },
48
114
  result,
115
+ rate_limit_event: rateLimit,
49
116
  });
50
117
  }
51
118
  export function claudeTranscriptUsage(text) {
@@ -1 +1 @@
1
- {"version":3,"file":"claude-events.js","sourceRoot":"","sources":["../../../src/adapters/agents/claude-events.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAGrE,SAAS,MAAM,CAAC,KAAc;IAC5B,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC9B,OAAO;QACL,KAAK,EAAE,YAAY,CAAC,KAAK,CAAC,YAAY,CAAC;QACvC,YAAY,EAAE,YAAY,CAAC,KAAK,CAAC,2BAA2B,CAAC;QAC7D,MAAM,EAAE,YAAY,CAAC,KAAK,CAAC,uBAAuB,CAAC;QACnD,MAAM,EAAE,YAAY,CAAC,KAAK,CAAC,aAAa,CAAC;KAC1C,CAAC;AACJ,CAAC;AAED,SAAS,MAAM,CAAC,KAAqB;IACnC,OAAO,OAAO,KAAK,CAAC,UAAU,KAAK,QAAQ;QACzC,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,cAAc,EAAE,EAAE,EAAE,KAAK,CAAC,UAAU,EAAE,CAAC;QAClD,CAAC,CAAC,EAAE,CAAC;AACT,CAAC;AAED,SAAS,SAAS,CAAC,KAAqB;IACtC,MAAM,OAAO,GAAG,QAAQ,CAAC,KAAK,CAAC,O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MAAM,CAAC,IAAI,cAAc,CAC/D;SACF;QACH,CAAC,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,CACzB,CAAC;IACF,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,IAAY;IACvC,OAAO,UAAU,CAAC,IAAI,EAAE;QACtB,MAAM;QACN,SAAS;QACT,MAAM;KACiB,CAAC,CAAC;AAC7B,CAAC;AAED,MAAM,UAAU,qBAAqB,CAAC,IAAY;IAChD,IAAI,KAAwB,CAAC;IAC7B,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,CAAC;QACvC,MAAM,KAAK,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC;QACjC,IAAI,KAAK,EAAE,IAAI,KAAK,WAAW;YAAE,SAAS;QAC1C,MAAM,OAAO,GAAG,QAAQ,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QACxC,IAAI,OAAO,CAAC,KAAK;YAAE,KAAK,GAAG,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IACnD,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["import type { AgentEvent, Usage } from \"../../domain/agent.types.ts\";\nimport { decodeEvent, decodeLine } from \"./event-decoder.ts\";\nimport { asRecord, decodeRecord, numberOrZero } from \"./protocol.ts\";\nimport type { EventDecoders, ProtocolRecord } from \"./protocol.types.ts\";\n\nfunction tokens(value: unknown): Usage {\n const usage = asRecord(value);\n return {\n input: numberOrZero(usage.input_tokens),\n cacheCreated: numberOrZero(usage.cache_creation_input_tokens),\n cached: numberOrZero(usage.cache_read_input_tokens),\n output: numberOrZero(usage.output_tokens),\n };\n}\n\nfunction system(event: ProtocolRecord): AgentEvent[] {\n return typeof event.session_id === \"string\"\n ? [{ kind: \"conversation\", id: event.session_id }]\n : [];\n}\n\nfunction assistant(event: ProtocolRecord): AgentEvent[] {\n const content = asRecord(event.message).content;\n if (!Array.isArray(content)) return [];\n return content.flatMap((part) =>\n decodeEvent(asRecord(part), {\n text: (block) =>\n typeof block.text === \"string\"\n ? [{ kind: \"text\", text: block.text }]\n : [],\n tool_use: (block) => [\n { kind: \"tool\", name: String(block.name), input: block.input },\n ],\n }),\n );\n}\n\nfunction result(event: ProtocolRecord): AgentEvent[] {\n const events: AgentEvent[] = [];\n if (!event.is_error && typeof event.result === \"string\")\n events.push({ kind: \"result\", text: event.result });\n if (event.usage) events.push({ kind: \"usage\", tokens: tokens(event.usage) });\n events.push(\n event.is_error\n ? {\n kind: \"failure\",\n message: String(\n event.result ?? JSON.stringify(event.errors) ?? \"Agent failed\",\n ),\n }\n : { kind: \"finished\" },\n );\n return events;\n}\n\nexport function claudeEvents(line: string): AgentEvent[] {\n return decodeLine(line, {\n system,\n assistant,\n result,\n } satisfies EventDecoders);\n}\n\nexport function claudeTranscriptUsage(text: string): Usage | undefined {\n let usage: Usage | undefined;\n for (const line of text.split(/\\r?\\n/)) {\n const event = decodeRecord(line);\n if (event?.type !== \"assistant\") continue;\n const message = asRecord(event.message);\n if (message.usage) usage = tokens(message.usage);\n }\n return usage;\n}\n"]}
1
+ {"version":3,"file":"claude-events.js","sourceRoot":"","sources":["../../../src/adapters/agents/claude-events.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAErE,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAEzD,SAAS,MAAM,CAAC,KAAc;IAC5B,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC9B,OAAO;QACL,KAAK,EAAE,YAAY,CAAC,KAAK,CAAC,YAAY,CAAC;QACvC,YAAY,EAAE,YAAY,CAAC,KAAK,CAAC,2BAA2B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EAAE,IAAI,EAAE,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC;YACvD,OAAO,EAAE,CAAC;QACZ,CAAC;QACD,MAAM;QACN,gBAAgB,EAAE,SAAS;KACJ,CAAC,CAAC;AAC7B,CAAC;AAED,MAAM,UAAU,qBAAqB,CAAC,IAAY;IAChD,IAAI,KAAwB,CAAC;IAC7B,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,CAAC;QACvC,MAAM,KAAK,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC;QACjC,IAAI,KAAK,EAAE,IAAI,KAAK,WAAW;YAAE,SAAS;QAC1C,MAAM,OAAO,GAAG,QAAQ,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QACxC,IAAI,OAAO,CAAC,KAAK;YAAE,KAAK,GAAG,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IACnD,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["import { toolResult } from \"./tool-result.ts\";\nimport type { AgentEvent, Usage } from \"../../domain/agent.types.ts\";\nimport { decodeEvent, decodeLine } from \"./event-decoder.ts\";\nimport { asRecord, decodeRecord, numberOrZero } from \"./protocol.ts\";\nimport type { EventDecoders, ProtocolRecord } from \"./protocol.types.ts\";\nimport { claudeQuotaErrors } from \"./quota.constants.ts\";\n\nfunction tokens(value: unknown): Usage {\n const usage = asRecord(value);\n return {\n input: numberOrZero(usage.input_tokens),\n cacheCreated: numberOrZero(usage.cache_creation_input_tokens),\n cached: numberOrZero(usage.cache_read_input_tokens),\n output: numberOrZero(usage.output_tokens),\n };\n}\n\nfunction system(event: ProtocolRecord): AgentEvent[] {\n return typeof event.session_id === \"string\"\n ? [{ kind: \"conversation\", id: event.session_id }]\n : [];\n}\n\nfunction rateLimit(event: ProtocolRecord): AgentEvent[] {\n const info = asRecord(event.rate_limit_info);\n if (info.status !== \"rejected\") return [];\n const reset =\n typeof info.resetsAt === \"number\" && Number.isSafeInteger(info.resetsAt)\n ? new Date(info.resetsAt * 1000)\n : undefined;\n const limit =\n typeof info.rateLimitType === \"string\" ? info.rateLimitType : \"usage\";\n return [\n {\n kind: \"quota\",\n message: `Claude Code ${limit} limit reached`,\n ...(reset && Number.isFinite(reset.getTime())\n ? { resetAt: reset.toISOString() }\n : {}),\n },\n ];\n}\n\nfunction assistant(event: ProtocolRecord): AgentEvent[] {\n const quota: AgentEvent[] =\n typeof event.error === \"string\" && claudeQuotaErrors.has(event.error)\n ? [{ kind: \"quota\", message: `Claude Code reported ${event.error}` }]\n : [];\n const message = asRecord(event.message);\n const content = message.content;\n if (!Array.isArray(content)) return quota;\n const usage: AgentEvent[] = message.usage\n ? [\n {\n kind: \"message-usage\",\n tokens: tokens(message.usage),\n ...(typeof message.id === \"string\" ? { messageId: message.id } : {}),\n ...(typeof event.parent_tool_use_id === \"string\"\n ? { parentCallId: event.parent_tool_use_id }\n : {}),\n },\n ]\n : [];\n return [\n ...quota,\n ...usage,\n ...content.flatMap((part) =>\n decodeEvent(asRecord(part), {\n text: (block) =>\n typeof block.text === \"string\"\n ? [{ kind: \"text\", text: block.text }]\n : [],\n thinking: (block) =>\n typeof block.thinking === \"string\"\n ? [{ kind: \"reasoning\", text: block.thinking }]\n : [],\n tool_result: (block) =>\n toolResult(\n block.tool_use_id,\n undefined,\n block.content,\n block.is_error === true,\n ).map((value) => ({\n ...value,\n ...(typeof event.parent_tool_use_id === \"string\"\n ? { parentCallId: event.parent_tool_use_id }\n : {}),\n })),\n tool_use: (block) => [\n {\n kind: \"tool\",\n name: String(block.name),\n input: block.input,\n ...(typeof block.id === \"string\" ? { callId: block.id } : {}),\n ...(typeof event.parent_tool_use_id === \"string\"\n ? { parentCallId: event.parent_tool_use_id }\n : {}),\n },\n ],\n }),\n ),\n ];\n}\n\nfunction result(event: ProtocolRecord): AgentEvent[] {\n const events: AgentEvent[] = [];\n if (!event.is_error && typeof event.result === \"string\")\n events.push({ kind: \"result\", text: event.result });\n if (event.usage) events.push({ kind: \"usage\", tokens: tokens(event.usage) });\n events.push(\n event.is_error\n ? {\n kind: \"failure\",\n message: String(\n event.result ?? JSON.stringify(event.errors) ?? \"Agent failed\",\n ),\n }\n : { kind: \"finished\" },\n );\n return events;\n}\n\nexport function claudeEvents(line: string): AgentEvent[] {\n return decodeLine(line, {\n system,\n assistant,\n user: assistant,\n stream_event: (event) => {\n const delta = asRecord(asRecord(event.event).delta);\n if (delta.type === \"text_delta\" && typeof delta.text === \"string\")\n return [{ kind: \"text-delta\", text: delta.text }];\n if (delta.type === \"thinking_delta\" && typeof delta.thinking === \"string\")\n return [{ kind: \"reasoning\", text: delta.thinking }];\n return [];\n },\n result,\n rate_limit_event: rateLimit,\n } satisfies EventDecoders);\n}\n\nexport function claudeTranscriptUsage(text: string): Usage | undefined {\n let usage: Usage | undefined;\n for (const line of text.split(/\\r?\\n/)) {\n const event = decodeRecord(line);\n if (event?.type !== \"assistant\") continue;\n const message = asRecord(event.message);\n if (message.usage) usage = tokens(message.usage);\n }\n return usage;\n}\n"]}
@@ -4,6 +4,8 @@ export function claudeRequest(settings, input) {
4
4
  const args = [];
5
5
  if (!input.interactive)
6
6
  args.push("--print", "--verbose", "--output-format", "stream-json");
7
+ if (!input.interactive && settings.partialMessages)
8
+ args.push("--include-partial-messages");
7
9
  if (settings.model)
8
10
  args.push("--model", settings.model.name);
9
11
  if (settings.model?.reasoning)
@@ -1 +1 @@
1
- {"version":3,"file":"claude-request.js","sourceRoot":"","sources":["../../../src/adapters/agents/claude-request.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAGzD,MAAM,UAAU,aAAa,CAC3B,QAA+B,EAC/B,KAAiB;IAEjB,oBAAoB,CAAC,KAAK,CAAC,CAAC;IAC5B,MAAM,IAAI,GAAa,EAAE,CAAC;IAC1B,IAAI,CAAC,KAAK,CAAC,WAAW;QACpB,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,WAAW,EAAE,iBAAiB,EAAE,aAAa,CAAC,CAAC;IACtE,IAAI,QAAQ,CAAC,KAAK;QAAE,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC9D,IAAI,QAAQ,CAAC,KAAK,EAAE,SAAS;QAC3B,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,QAAQ,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;IAClD,IAAI,QAAQ,CAAC,WAAW;QACtB,IAAI,CAAC,IAAI,CAAC,mBAAmB,EAAE,QAAQ,CAAC,WAAW,CAAC,CAAC;IACvD,IAAI,CAAC,QAAQ,CAAC,WAAW,IAAI,CAAC,KAAK,CAAC,WAAW;QAC7C,IAAI,CAAC,IAAI,CAAC,gCAAgC,CAAC,CAAC;IAC9C,IAAI,KAAK,CAAC,YAAY,EAAE,CAAC;QACvB,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,KAAK,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC;QAC7C,IAAI,KAAK,CAAC,YAAY,CAAC,IAAI;YAAE,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;IAC3D,CAAC;IACD,IAAI,KAAK,CAAC,WAAW,IAAI,KAAK,CAAC,IAAI,KAAK,SAAS;QAC/C,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;IAC9B,OAAO;QACL,UAAU,EAAE,QAAQ;QACpB,SAAS,EAAE,IAAI;QACf,GAAG,CAAC,KAAK,CAAC,WAAW;YACnB,CAAC,CAAC,EAAE,WAAW,EAAE,IAAI,EAAE;YACvB,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,IAAI,IAAI,EAAE,EAAE,CAAC;KACjC,CAAC;AACJ,CAAC","sourcesContent":["import type { AgentInput } from \"../../domain/agent.types.ts\";\nimport type { Command } from \"../../domain/command.types.ts\";\nimport { validateContinuation } from \"./continuation.ts\";\nimport type { Bound, ClaudeSettings } from \"./settings.types.ts\";\n\nexport function claudeRequest(\n settings: Bound<ClaudeSettings>,\n input: AgentInput,\n): Command {\n validateContinuation(input);\n const args: string[] = [];\n if (!input.interactive)\n args.push(\"--print\", \"--verbose\", \"--output-format\", \"stream-json\");\n if (settings.model) args.push(\"--model\", settings.model.name);\n if (settings.model?.reasoning)\n args.push(\"--effort\", settings.model.reasoning);\n if (settings.permissions)\n args.push(\"--permission-mode\", settings.permissions);\n if (!settings.permissions && !input.interactive)\n args.push(\"--dangerously-skip-permissions\");\n if (input.continuation) {\n args.push(\"--resume\", input.continuation.id);\n if (input.continuation.fork) args.push(\"--fork-session\");\n }\n if (input.interactive && input.text !== undefined)\n args.push(\"--\", input.text);\n return {\n executable: \"claude\",\n arguments: args,\n ...(input.interactive\n ? { interactive: true }\n : { stdin: input.text ?? \"\" }),\n };\n}\n"]}
1
+ {"version":3,"file":"claude-request.js","sourceRoot":"","sources":["../../../src/adapters/agents/claude-request.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAGzD,MAAM,UAAU,aAAa,CAC3B,QAA+B,EAC/B,KAAiB;IAEjB,oBAAoB,CAAC,KAAK,CAAC,CAAC;IAC5B,MAAM,IAAI,GAAa,EAAE,CAAC;IAC1B,IAAI,CAAC,KAAK,CAAC,WAAW;QACpB,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,WAAW,EAAE,iBAAiB,EAAE,aAAa,CAAC,CAAC;IACtE,IAAI,CAAC,KAAK,CAAC,WAAW,IAAI,QAAQ,CAAC,eAAe;QAChD,IAAI,CAAC,IAAI,CAAC,4BAA4B,CAAC,CAAC;IAC1C,IAAI,QAAQ,CAAC,KAAK;QAAE,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC9D,IAAI,QAAQ,CAAC,KAAK,EAAE,SAAS;QAC3B,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,QAAQ,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;IAClD,IAAI,QAAQ,CAAC,WAAW;QACtB,IAAI,CAAC,IAAI,CAAC,mBAAmB,EAAE,QAAQ,CAAC,WAAW,CAAC,CAAC;IACvD,IAAI,CAAC,QAAQ,CAAC,WAAW,IAAI,CAAC,KAAK,CAAC,WAAW;QAC7C,IAAI,CAAC,IAAI,CAAC,gCAAgC,CAAC,CAAC;IAC9C,IAAI,KAAK,CAAC,YAAY,EAAE,CAAC;QACvB,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,KAAK,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC;QAC7C,IAAI,KAAK,CAAC,YAAY,CAAC,IAAI;YAAE,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;IAC3D,CAAC;IACD,IAAI,KAAK,CAAC,WAAW,IAAI,KAAK,CAAC,IAAI,KAAK,SAAS;QAC/C,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;IAC9B,OAAO;QACL,UAAU,EAAE,QAAQ;QACpB,SAAS,EAAE,IAAI;QACf,GAAG,CAAC,KAAK,CAAC,WAAW;YACnB,CAAC,CAAC,EAAE,WAAW,EAAE,IAAI,EAAE;YACvB,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,IAAI,IAAI,EAAE,EAAE,CAAC;KACjC,CAAC;AACJ,CAAC","sourcesContent":["import type { AgentInput } from \"../../domain/agent.types.ts\";\nimport type { Command } from \"../../domain/command.types.ts\";\nimport { validateContinuation } from \"./continuation.ts\";\nimport type { Bound, ClaudeSettings } from \"./settings.types.ts\";\n\nexport function claudeRequest(\n settings: Bound<ClaudeSettings>,\n input: AgentInput,\n): Command {\n validateContinuation(input);\n const args: string[] = [];\n if (!input.interactive)\n args.push(\"--print\", \"--verbose\", \"--output-format\", \"stream-json\");\n if (!input.interactive && settings.partialMessages)\n args.push(\"--include-partial-messages\");\n if (settings.model) args.push(\"--model\", settings.model.name);\n if (settings.model?.reasoning)\n args.push(\"--effort\", settings.model.reasoning);\n if (settings.permissions)\n args.push(\"--permission-mode\", settings.permissions);\n if (!settings.permissions && !input.interactive)\n args.push(\"--dangerously-skip-permissions\");\n if (input.continuation) {\n args.push(\"--resume\", input.continuation.id);\n if (input.continuation.fork) args.push(\"--fork-session\");\n }\n if (input.interactive && input.text !== undefined)\n args.push(\"--\", input.text);\n return {\n executable: \"claude\",\n arguments: args,\n ...(input.interactive\n ? { interactive: true }\n : { stdin: input.text ?? \"\" }),\n };\n}\n"]}
@@ -2,4 +2,4 @@ import type { AgentInput } from "../../domain/agent.types.ts";
2
2
  import type { Command } from "../../domain/command.types.ts";
3
3
  import type { AgentCliDiagnostic, AgentCliMode } from "./cli-diagnostics.types.ts";
4
4
  export declare function cliDiagnostics(request: (input: AgentInput) => Command, usage: Readonly<Record<AgentCliMode, string>>): readonly AgentCliDiagnostic[];
5
- export declare function helpDiagnostics(request: (input: AgentInput) => Command, usage: string): readonly AgentCliDiagnostic[];
5
+ export declare function helpDiagnostics(request: (input: AgentInput) => Command, usage: string, resume?: boolean): readonly AgentCliDiagnostic[];
@@ -11,15 +11,22 @@ export function cliDiagnostics(request, usage) {
11
11
  };
12
12
  });
13
13
  }
14
- export function helpDiagnostics(request, usage) {
15
- const command = request({});
16
- return [
17
- {
18
- mode: "start",
14
+ export function helpDiagnostics(request, usage, resume = false) {
15
+ const modes = resume ? ["start", "resume"] : ["start"];
16
+ return modes.map((mode) => {
17
+ const command = request(mode === "resume"
18
+ ? { continuation: { id: "00000000-0000-0000-0000-000000000000" } }
19
+ : {});
20
+ return {
21
+ mode,
19
22
  usage,
20
23
  options: (command.arguments ?? []).filter((argument) => argument.startsWith("--")),
21
- command: { executable: command.executable, arguments: ["--help"] },
22
- },
23
- ];
24
+ command: {
25
+ executable: command.executable,
26
+ arguments: ["--help"],
27
+ ...(command.variables ? { variables: command.variables } : {}),
28
+ },
29
+ };
30
+ });
24
31
  }
25
32
  //# sourceMappingURL=cli-diagnostics.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"cli-diagnostics.js","sourceRoot":"","sources":["../../../src/adapters/agents/cli-diagnostics.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AAMxE,MAAM,UAAU,cAAc,CAC5B,OAAuC,EACvC,KAA6C;IAE7C,OAAO,sBAAsB,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,EAAE;QACpD,MAAM,OAAO,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;QAC/B,MAAM,IAAI,GAAG,OAAO,CAAC,SAAS,IAAI,EAAE,CAAC;QACrC,OAAO;YACL,IAAI;YACJ,KAAK,EAAE,KAAK,CAAC,IAAI,CAAC;YAClB,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;YAC7D,OAAO,EAAE,EAAE,GAAG,OAAO,EAAE,SAAS,EAAE,CAAC,GAAG,IAAI,EAAE,QAAQ,CAAC,EAAE;SACxD,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,eAAe,CAC7B,OAAuC,EACvC,KAAa;IAEb,MAAM,OAAO,GAAG,OAAO,CAAC,EAAE,CAAC,CAAC;IAC5B,OAAO;QACL;YACE,IAAI,EAAE,OAAO;YACb,KAAK;YACL,OAAO,EAAE,CAAC,OAAO,CAAC,SAAS,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE,EAAE,CACrD,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,CAC1B;YACD,OAAO,EAAE,EAAE,UAAU,EAAE,OAAO,CAAC,UAAU,EAAE,SAAS,EAAE,CAAC,QAAQ,CAAC,EAAE;SACnE;KACF,CAAC;AACJ,CAAC","sourcesContent":["import type { AgentInput } from \"../../domain/agent.types.ts\";\nimport type { Command } from \"../../domain/command.types.ts\";\nimport { cliDiagnosticScenarios } from \"./cli-diagnostics.constants.ts\";\nimport type {\n AgentCliDiagnostic,\n AgentCliMode,\n} from \"./cli-diagnostics.types.ts\";\n\nexport function cliDiagnostics(\n request: (input: AgentInput) => Command,\n usage: Readonly<Record<AgentCliMode, string>>,\n): readonly AgentCliDiagnostic[] {\n return cliDiagnosticScenarios.map(({ mode, input }) => {\n const command = request(input);\n const args = command.arguments ?? [];\n return {\n mode,\n usage: usage[mode],\n options: args.filter((argument) => argument.startsWith(\"--\")),\n command: { ...command, arguments: [...args, \"--help\"] },\n };\n });\n}\n\nexport function helpDiagnostics(\n request: (input: AgentInput) => Command,\n usage: string,\n): readonly AgentCliDiagnostic[] {\n const command = request({});\n return [\n {\n mode: \"start\",\n usage,\n options: (command.arguments ?? []).filter((argument) =>\n argument.startsWith(\"--\"),\n ),\n command: { executable: command.executable, arguments: [\"--help\"] },\n },\n ];\n}\n"]}
1
+ {"version":3,"file":"cli-diagnostics.js","sourceRoot":"","sources":["../../../src/adapters/agents/cli-diagnostics.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AAMxE,MAAM,UAAU,cAAc,CAC5B,OAAuC,EACvC,KAA6C;IAE7C,OAAO,sBAAsB,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,EAAE;QACpD,MAAM,OAAO,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;QAC/B,MAAM,IAAI,GAAG,OAAO,CAAC,SAAS,IAAI,EAAE,CAAC;QACrC,OAAO;YACL,IAAI;YACJ,KAAK,EAAE,KAAK,CAAC,IAAI,CAAC;YAClB,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;YAC7D,OAAO,EAAE,EAAE,GAAG,OAAO,EAAE,SAAS,EAAE,CAAC,GAAG,IAAI,EAAE,QAAQ,CAAC,EAAE;SACxD,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,eAAe,CAC7B,OAAuC,EACvC,KAAa,EACb,MAAM,GAAG,KAAK;IAEd,MAAM,KAAK,GAAG,MAAM,CAAC,CAAC,CAAE,CAAC,OAAO,EAAE,QAAQ,CAAW,CAAC,CAAC,CAAE,CAAC,OAAO,CAAW,CAAC;IAC7E,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;QACxB,MAAM,OAAO,GAAG,OAAO,CACrB,IAAI,KAAK,QAAQ;YACf,CAAC,CAAC,EAAE,YAAY,EAAE,EAAE,EAAE,EAAE,sCAAsC,EAAE,EAAE;YAClE,CAAC,CAAC,EAAE,CACP,CAAC;QACF,OAAO;YACL,IAAI;YACJ,KAAK;YACL,OAAO,EAAE,CAAC,OAAO,CAAC,SAAS,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE,EAAE,CACrD,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,CAC1B;YACD,OAAO,EAAE;gBACP,UAAU,EAAE,OAAO,CAAC,UAAU;gBAC9B,SAAS,EAAE,CAAC,QAAQ,CAAC;gBACrB,GAAG,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,OAAO,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;aAC/D;SACF,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import type { AgentInput } from \"../../domain/agent.types.ts\";\nimport type { Command } from \"../../domain/command.types.ts\";\nimport { cliDiagnosticScenarios } from \"./cli-diagnostics.constants.ts\";\nimport type {\n AgentCliDiagnostic,\n AgentCliMode,\n} from \"./cli-diagnostics.types.ts\";\n\nexport function cliDiagnostics(\n request: (input: AgentInput) => Command,\n usage: Readonly<Record<AgentCliMode, string>>,\n): readonly AgentCliDiagnostic[] {\n return cliDiagnosticScenarios.map(({ mode, input }) => {\n const command = request(input);\n const args = command.arguments ?? [];\n return {\n mode,\n usage: usage[mode],\n options: args.filter((argument) => argument.startsWith(\"--\")),\n command: { ...command, arguments: [...args, \"--help\"] },\n };\n });\n}\n\nexport function helpDiagnostics(\n request: (input: AgentInput) => Command,\n usage: string,\n resume = false,\n): readonly AgentCliDiagnostic[] {\n const modes = resume ? ([\"start\", \"resume\"] as const) : ([\"start\"] as const);\n return modes.map((mode) => {\n const command = request(\n mode === \"resume\"\n ? { continuation: { id: \"00000000-0000-0000-0000-000000000000\" } }\n : {},\n );\n return {\n mode,\n usage,\n options: (command.arguments ?? []).filter((argument) =>\n argument.startsWith(\"--\"),\n ),\n command: {\n executable: command.executable,\n arguments: [\"--help\"],\n ...(command.variables ? { variables: command.variables } : {}),\n },\n };\n });\n}\n"]}