@desplega.ai/agent-swarm 1.158.0 → 1.160.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 (378) hide show
  1. package/README.md +1 -1
  2. package/dist/{acp-adapter-xaq4n6pc.js → acp-adapter-2mjwcsfh.js} +124 -27
  3. package/dist/{actions-p9hz5yat.js → actions-e43rxskr.js} +35 -30
  4. package/dist/{anthropic-messages-51pz26qe.js → anthropic-messages-5qx80j9k.js} +106 -16
  5. package/dist/{app-g26wdcz6.js → app-mc7xfagn.js} +12 -10
  6. package/dist/{assistant-wydfqkb3.js → assistant-sedkzv3b.js} +42 -31
  7. package/dist/{azure-openai-responses-8gksqtmz.js → azure-openai-responses-nfb21z9a.js} +13 -14
  8. package/dist/{boot-reembed-se8zmdcp.js → boot-reembed-cqz9swn5.js} +13 -12
  9. package/dist/{boot-reembed-g5ckg9yb.js → boot-reembed-m3656j2n.js} +14 -13
  10. package/dist/{boot-scrub-logs-wfxqan61.js → boot-scrub-logs-xbxf5d7w.js} +11 -9
  11. package/dist/boot-seeds-gsetbs5y.js +28 -0
  12. package/dist/{claude-adapter-tv2x4f36.js → claude-adapter-dc6289mc.js} +28 -23
  13. package/dist/{claude-managed-adapter-41b2s7fd.js → claude-managed-adapter-naaw51me.js} +4 -3
  14. package/dist/{claude-managed-setup-60g8aazx.js → claude-managed-setup-eacvchx0.js} +12 -3
  15. package/dist/claude-sdk-session-bqp2xvym.js +29722 -0
  16. package/dist/{cli-987hg0aa.js → cli-0jwe9034.js} +2 -2
  17. package/dist/{cli-vj6h9kc2.js → cli-0m7wct0d.js} +59 -1
  18. package/dist/{cli-c07r9a2m.js → cli-0q3avq3s.js} +12 -11
  19. package/dist/{cli-19jenss3.js → cli-0wgxmwf6.js} +31 -10
  20. package/dist/cli-0x01kwrd.js +491 -0
  21. package/dist/cli-0xqde53b.js +176 -0
  22. package/dist/cli-10nhj6xq.js +8355 -0
  23. package/dist/{cli-tt9k8r35.js → cli-12tszpk9.js} +479 -910
  24. package/dist/{cli-5b6b62tz.js → cli-13hw4z91.js} +1 -1
  25. package/dist/{cli-cqt19wg6.js → cli-1a2j50m0.js} +11 -2
  26. package/dist/{cli-xberxa1r.js → cli-25fcq4b4.js} +2 -2
  27. package/dist/{cli-npssxgaz.js → cli-2pdaysab.js} +52 -2
  28. package/dist/cli-3qhyh31j.js +166 -0
  29. package/dist/cli-447dt1h3.js +3828 -0
  30. package/dist/cli-4derpgyk.js +115 -0
  31. package/dist/{cli-00w2c66p.js → cli-523679eh.js} +13 -2
  32. package/dist/{cli-y95wp3tg.js → cli-58e8yr0d.js} +1 -1
  33. package/dist/{cli-24k806sc.js → cli-5nbmpy8w.js} +3 -3
  34. package/dist/{cli-53sz8gkz.js → cli-6cs6wzxt.js} +1 -1
  35. package/dist/cli-741yb0xx.js +1027 -0
  36. package/dist/cli-74h9hscv.js +69 -0
  37. package/dist/cli-7cxw8b60.js +14910 -0
  38. package/dist/{cli-xhaeg2nc.js → cli-7e398j1h.js} +1 -1
  39. package/dist/cli-7kyk9jr3.js +22 -0
  40. package/dist/cli-89s4ngw3.js +183 -0
  41. package/dist/{cli-9b13ggd1.js → cli-89v6kyq7.js} +1 -0
  42. package/dist/{cli-ftfvggzx.js → cli-9hsgwz4w.js} +1045 -581
  43. package/dist/{cli-rqz8qbw7.js → cli-a8dvhzrt.js} +59 -20
  44. package/dist/{cli-j57qkrpq.js → cli-azhgzetg.js} +395 -56
  45. package/dist/cli-br0qdrnp.js +2150 -0
  46. package/dist/{cli-rj19hc34.js → cli-btfv8y88.js} +1 -1
  47. package/dist/{cli-8qmme6vd.js → cli-c8a36vcc.js} +2 -2
  48. package/dist/cli-cpvsaqsw.js +333 -0
  49. package/dist/cli-d5czme6m.js +17805 -0
  50. package/dist/{cli-h38x0qhg.js → cli-et8m9xsv.js} +4 -3
  51. package/dist/{cli-x24pshtq.js → cli-evvtk35y.js} +6 -6
  52. package/dist/{cli-7s3syk22.js → cli-f8gy6r2r.js} +5 -5
  53. package/dist/{cli-zt1227k1.js → cli-fkqhbg8g.js} +5 -3
  54. package/dist/{cli-9httdpyq.js → cli-g2whhdrf.js} +1 -1
  55. package/dist/cli-gt4hxb8p.js +99 -0
  56. package/dist/{cli-s8eet254.js → cli-jajnsm8q.js} +37184 -53838
  57. package/dist/{cli-7gtvvpbh.js → cli-jayjpjmb.js} +21 -12
  58. package/dist/{cli-68w09sjw.js → cli-jyk0ynw2.js} +27 -89
  59. package/dist/{cli-aehm1rbq.js → cli-jz4w45qt.js} +1152 -61
  60. package/dist/cli-kmcpfwn2.js +333856 -0
  61. package/dist/{cli-4198qc9v.js → cli-ktmyrtpn.js} +19 -3
  62. package/dist/{cli-j55n64b6.js → cli-mfe5btp9.js} +505 -189
  63. package/dist/{cli-q67y4wzm.js → cli-phsaj4xq.js} +24 -2
  64. package/dist/{cli-1hkrch3k.js → cli-pm1rst0h.js} +46 -7
  65. package/dist/{cli-pw9rj5t9.js → cli-pqetb83f.js} +1 -176
  66. package/dist/{cli-ggm92wcn.js → cli-ptr8h7kp.js} +20 -1
  67. package/dist/{cli-s8s499xy.js → cli-qbksc292.js} +3 -2
  68. package/dist/{cli-47m6dkd3.js → cli-qydf22qq.js} +597 -346
  69. package/dist/{cli-3gmcwfyx.js → cli-r1mxd1xh.js} +13 -6
  70. package/dist/cli-rb9m6rpe.js +4980 -0
  71. package/dist/cli-rykfmgwg.js +102 -0
  72. package/dist/{cli-5d10vd2m.js → cli-shkxm1vn.js} +6 -5
  73. package/dist/{cli-eetrvv91.js → cli-t3p77qk1.js} +1 -1
  74. package/dist/cli-tfky2838.js +756 -0
  75. package/dist/{cli-g8djp6qe.js → cli-tmqt7dpj.js} +40 -0
  76. package/dist/{cli-fgqxwrpv.js → cli-tpq83z89.js} +1631 -127
  77. package/dist/cli-trc24wk2.js +143 -0
  78. package/dist/{cli-aky8tctm.js → cli-tzx2ke1v.js} +3 -3
  79. package/dist/cli-v7fn5gms.js +1425 -0
  80. package/dist/{cli-wscdvcqz.js → cli-vctdqs5h.js} +1 -1
  81. package/dist/{cli-cw9zck8j.js → cli-xjcywfsf.js} +8 -4
  82. package/dist/{cli-k0g1sjzm.js → cli-ybgv4kw2.js} +18 -11
  83. package/dist/{cli-rjehvrts.js → cli-ydmcgve1.js} +8 -8
  84. package/dist/{cli-vhjwh6cz.js → cli-ygwm91nt.js} +1 -1
  85. package/dist/{cli-mcnhgnn1.js → cli-ykk5jaax.js} +184 -26
  86. package/dist/{cli-de1396j2.js → cli-ywybs5as.js} +7 -1
  87. package/dist/cli-zpep9q5e.js +491 -0
  88. package/dist/cli.js +41 -32
  89. package/dist/cloudflare-workers-ai-system-one-k6fbxw9d.js +46 -0
  90. package/dist/{codex-adapter-cnm8wk11.js → codex-adapter-nmxcatww.js} +26 -17
  91. package/dist/{codex-hook-9hptmdhj.js → codex-hook-20me6byw.js} +2 -2
  92. package/dist/{codex-login-x3jk4etn.js → codex-login-w6fz4xbz.js} +50 -5
  93. package/dist/{codex-session-runner-gfg547zj.js → codex-session-runner-90aa80ev.js} +24 -17
  94. package/dist/{commands-e3bn0p75.js → commands-8wcq1kn7.js} +11 -9
  95. package/dist/{db-03v9kzr2.js → db-j40kc4se.js} +25 -11
  96. package/dist/{devin-adapter-8vgkwh29.js → devin-adapter-dpsv6hd9.js} +1 -1
  97. package/dist/{dispatcher-nrmg8yht.js → dispatcher-4zqy768d.js} +34 -29
  98. package/dist/{dsh-adapter-k03nfqa6.js → dsh-adapter-mpnzgztj.js} +3 -3
  99. package/dist/{e2b-93x1k0j5.js → e2b-ez07znam.js} +4 -3
  100. package/dist/execute-6e7qeyk4.js +1017 -0
  101. package/dist/{google-generative-ai-bxmv50nc.js → google-generative-ai-k6n5nbpp.js} +6 -5
  102. package/dist/{google-vertex-809af514.js → google-vertex-44xxtcvp.js} +6 -5
  103. package/dist/{handlers-aqcedbyb.js → handlers-kjdce1w5.js} +37 -32
  104. package/dist/{hook-ybvmrmhq.js → hook-czx13n12.js} +19 -15
  105. package/dist/{hook-7vkskkre.js → hook-r2t4bqfg.js} +18 -14
  106. package/dist/{http-2eqa8t24.js → http-3bbb19be.js} +900 -145
  107. package/dist/{index-f6cryxwe.js → index-4a5njnm1.js} +2 -59
  108. package/dist/{index-x71bvq0p.js → index-668me3f0.js} +35 -30
  109. package/dist/{index-c6zsv1bd.js → index-7aj368tw.js} +13 -12
  110. package/dist/{index-1yks3qcr.js → index-fg0dsp6c.js} +34 -29
  111. package/dist/{index-chgdkq36.js → index-kkv84jq9.js} +34 -29
  112. package/dist/{index-a3vn96n8.js → index-zg7vp46x.js} +198 -54
  113. package/dist/{keepalive-vtkf5n99.js → keepalive-yra8dy57.js} +13 -11
  114. package/dist/{lead-h3sp357x.js → lead-va0pad2c.js} +54 -49
  115. package/dist/llama-cpp-classify-tgj35k8d.js +335 -0
  116. package/dist/{maintenance-jzeqtk3q.js → maintenance-hqewtmyg.js} +14 -13
  117. package/dist/{mistral-conversations-zx0kn554.js → mistral-conversations-pc3ntnxt.js} +14 -17
  118. package/dist/{oauth-refresh-sweep-qp3dzmdp.js → oauth-refresh-sweep-7rdt1m9n.js} +12 -10
  119. package/dist/{onboard-tmsp0qbz.js → onboard-j6ms6d0x.js} +6 -5
  120. package/dist/{openai-codex-responses-4vjqzvjp.js → openai-codex-responses-bbancrr0.js} +21 -8
  121. package/dist/{openai-completions-9hjrqbw8.js → openai-completions-jpaj5g2b.js} +9 -12
  122. package/dist/{openai-responses-7b1pn0xt.js → openai-responses-200k1wx4.js} +23 -18
  123. package/dist/{opencode-adapter-x6x2da1z.js → opencode-adapter-89rabkw2.js} +8 -7
  124. package/dist/{openrouter-images-9f9ek4rw.js → openrouter-images-8yx3487g.js} +5 -7
  125. package/dist/{otel-impl-9mz73q65.js → otel-impl-a792rjz0.js} +1 -1
  126. package/dist/{pi-messages-txpjj39q.js → pi-messages-vxdt8v7j.js} +2 -1
  127. package/dist/{pi-mono-adapter-m6dvv0dz.js → pi-mono-adapter-g7qzvr3v.js} +295 -70
  128. package/dist/pricing-refresh-wx0tp7cb.js +39 -0
  129. package/dist/quickjs-r1pq2107.wasm +0 -0
  130. package/dist/{rbac-roles-c9wqz83x.js → rbac-roles-8tzawacv.js} +12 -10
  131. package/dist/{render-v2-gryrh9h8.js → render-v2-mm7zswb8.js} +12 -10
  132. package/dist/runtime-zyssgse0.js +24 -0
  133. package/dist/{setup-q9720bt6.js → setup-8y70ys6t.js} +6 -5
  134. package/dist/typesafe-system-one-2ef30pec.js +27 -0
  135. package/dist/{virtual-modules-3htpgn8x.js → virtual-modules-6nmk7h3n.js} +22 -13
  136. package/dist/{work-objects-b76x7deb.js → work-objects-fg6xkb0n.js} +37 -32
  137. package/dist/{worker-6vrxbv41.js → worker-wmwhxsph.js} +54 -49
  138. package/openapi.json +1314 -91
  139. package/package.json +12 -11
  140. package/src/be/db/agents.ts +20 -0
  141. package/src/be/db/api-keys.ts +70 -0
  142. package/src/be/db/tasks/human-free.ts +442 -0
  143. package/src/be/db/tasks/read.ts +56 -1
  144. package/src/be/db/tasks/write.ts +107 -11
  145. package/src/be/db.ts +274 -188
  146. package/src/be/harness-model-support.ts +182 -0
  147. package/src/be/human-free-drain.ts +67 -0
  148. package/src/be/memory/providers/sqlite-store.ts +51 -15
  149. package/src/be/migrations/182_task_human_free_flag.sql +63 -0
  150. package/src/be/migrations/183_human_free_reclassify_queue.sql +25 -0
  151. package/src/be/migrations/184_model_catalog.sql +120 -0
  152. package/src/be/migrations/185_api_key_auth_failures.sql +6 -0
  153. package/src/be/migrations/186_api_key_seat_mismatch.sql +8 -0
  154. package/src/be/model-catalog-store.ts +644 -0
  155. package/src/be/model-tier-keys.ts +46 -0
  156. package/src/be/model-tier-resolution.ts +534 -0
  157. package/src/be/model-validation.ts +188 -0
  158. package/src/be/models-catalog.ts +61 -7
  159. package/src/be/modelsdev-cache.json +82 -0
  160. package/src/be/modelsdev-cache.ts +2 -0
  161. package/src/be/pricing-refresh.ts +154 -12
  162. package/src/be/scripts/typecheck.ts +15 -0
  163. package/src/be/seed/runner.ts +18 -12
  164. package/src/be/seed/types.ts +1 -0
  165. package/src/be/seed-scripts/catalog/task-failure-audit.ts +61 -9
  166. package/src/be/swarm-config-guard.ts +8 -0
  167. package/src/cli.tsx +10 -0
  168. package/src/commands/claude-managed-setup.ts +3 -1
  169. package/src/commands/codex-login.ts +67 -0
  170. package/src/commands/credential-outcome-report.ts +191 -0
  171. package/src/commands/rate-limit-outcome.ts +34 -4
  172. package/src/commands/runner.ts +357 -186
  173. package/src/commands/seat-mismatch-report.ts +46 -0
  174. package/src/extensions/apply-task-create.ts +27 -1
  175. package/src/extensions/contract-types.generated.ts +1 -1
  176. package/src/heartbeat/heartbeat.ts +79 -17
  177. package/src/heartbeat/templates.ts +2 -2
  178. package/src/http/agents.ts +62 -1
  179. package/src/http/api-keys.ts +140 -2
  180. package/src/http/codex-oauth-keep-warm.ts +3 -5
  181. package/src/http/index.ts +8 -0
  182. package/src/http/memory.ts +12 -5
  183. package/src/http/models-catalog.ts +357 -8
  184. package/src/http/poll.ts +54 -3
  185. package/src/http/schedules.ts +51 -6
  186. package/src/http/script-runs.ts +12 -0
  187. package/src/http/session-data.ts +2 -5
  188. package/src/http/stats.ts +6 -8
  189. package/src/http/status.ts +15 -1
  190. package/src/http/tasks.ts +90 -7
  191. package/src/http/usage-cache.ts +56 -15
  192. package/src/http/workflows.ts +46 -8
  193. package/src/mcp-client/http-client.ts +5 -0
  194. package/src/memory/recall-query.ts +74 -0
  195. package/src/prompts/base-prompt.ts +15 -4
  196. package/src/prompts/session-templates.ts +23 -1
  197. package/src/providers/acp-adapter.ts +1 -0
  198. package/src/providers/claude-adapter.ts +14 -5
  199. package/src/providers/claude-managed-adapter.ts +1 -0
  200. package/src/providers/claude-managed-models.ts +47 -161
  201. package/src/providers/claude-sdk-session.ts +3 -1
  202. package/src/providers/codex-adapter.ts +14 -14
  203. package/src/providers/codex-models.ts +65 -198
  204. package/src/providers/devin-adapter.ts +1 -0
  205. package/src/providers/dsh-adapter.ts +2 -1
  206. package/src/providers/harness-version.ts +83 -7
  207. package/src/providers/opencode-adapter.ts +53 -1
  208. package/src/providers/pi-binary-root/src/extensions/codemode/worker.ts +11 -0
  209. package/src/providers/pi-codemode-runtime.ts +17 -0
  210. package/src/providers/pi-mono-adapter.ts +361 -83
  211. package/src/providers/pi-mono-extension.ts +16 -1
  212. package/src/providers/reasoning-effort.ts +44 -140
  213. package/src/providers/types.ts +8 -0
  214. package/src/rbac/legacy-policy.ts +43 -0
  215. package/src/rbac/permissions.ts +15 -0
  216. package/src/scripts-runtime/sdk-allowlist.ts +4 -0
  217. package/src/scripts-runtime/types/stdlib.d.ts +15 -0
  218. package/src/scripts-runtime/types/swarm-extension.d.ts +3 -0
  219. package/src/scripts-runtime/types/swarm-sdk.d.ts +15 -0
  220. package/src/server.ts +6 -0
  221. package/src/slack/assistant.ts +13 -0
  222. package/src/slack/message-text.ts +56 -2
  223. package/src/slack/render-v2.ts +87 -37
  224. package/src/slack/session-status.ts +541 -0
  225. package/src/slack/thread-buffer.ts +10 -2
  226. package/src/tasks/sibling-awareness.ts +3 -2
  227. package/src/telemetry.ts +5 -4
  228. package/src/templates.d.ts +6 -0
  229. package/src/tests/agents-list-model-display.test.ts +4 -6
  230. package/src/tests/api-key-auth-failure-route.test.ts +142 -0
  231. package/src/tests/api-key-tracking.test.ts +368 -1
  232. package/src/tests/base-prompt.test.ts +43 -2
  233. package/src/tests/claude-adapter.test.ts +68 -0
  234. package/src/tests/claude-managed-adapter.test.ts +12 -18
  235. package/src/tests/codex-adapter.test.ts +2 -1
  236. package/src/tests/codex-auth-failure.test.ts +52 -0
  237. package/src/tests/codex-gpt6-release.test.ts +66 -5
  238. package/src/tests/codex-login.test.ts +116 -0
  239. package/src/tests/context-window.test.ts +7 -5
  240. package/src/tests/credential-exhaustion-policy.test.ts +118 -3
  241. package/src/tests/credential-outcome-report.test.ts +171 -0
  242. package/src/tests/credential-status-api.test.ts +103 -2
  243. package/src/tests/db-extraction-contract.test.ts +1 -0
  244. package/src/tests/db-task-read-contract.test.ts +10 -1
  245. package/src/tests/db-task-write-contract.test.ts +535 -2
  246. package/src/tests/docs-index-footprint.test.js +3 -3
  247. package/src/tests/dokploy-deploy.test.ts +315 -0
  248. package/src/tests/dsh-adapter.test.ts +1 -1
  249. package/src/tests/explicit-model-validation.test.ts +583 -0
  250. package/src/tests/extensions-pre-task.test.ts +73 -0
  251. package/src/tests/fetch-resolved-env.test.ts +46 -0
  252. package/src/tests/hang-watchdog-worker.ts +47 -0
  253. package/src/tests/hang-watchdog.test.ts +45 -0
  254. package/src/tests/hang-watchdog.ts +30 -0
  255. package/src/tests/harness-model-guard.test.ts +123 -0
  256. package/src/tests/harness-model-support.test.ts +374 -0
  257. package/src/tests/harness-version.test.ts +70 -3
  258. package/src/tests/heartbeat-checklist-config.test.ts +71 -0
  259. package/src/tests/heartbeat-checklist.test.ts +4 -2
  260. package/src/tests/heartbeat-orphan-resume.test.ts +48 -0
  261. package/src/tests/http-task-write-ownership.test.ts +172 -0
  262. package/src/tests/human-free-flag.test.ts +279 -0
  263. package/src/tests/human-free-oracle.ts +57 -0
  264. package/src/tests/human-free-reclassify.test.ts +669 -0
  265. package/src/tests/memory-fts-populate.test.ts +139 -0
  266. package/src/tests/memory-http-recall-gating.test.ts +125 -1
  267. package/src/tests/migration-046-budgets.test.ts +3 -3
  268. package/src/tests/model-catalog-migration.test.ts +134 -0
  269. package/src/tests/model-catalog-table.test.ts +249 -0
  270. package/src/tests/model-catalog-write-access.test.ts +387 -0
  271. package/src/tests/model-rate-limit-windows.test.ts +19 -0
  272. package/src/tests/model-tier-resolution.test.ts +611 -0
  273. package/src/tests/models-catalog.test.ts +1 -1
  274. package/src/tests/multi-runtime-enabled-stats.test.ts +65 -1
  275. package/src/tests/opencode-adapter.test.ts +157 -2
  276. package/src/tests/package-publish.test.ts +137 -36
  277. package/src/tests/pi-codemode.test.ts +246 -0
  278. package/src/tests/pi-mono-adapter.test.ts +3 -0
  279. package/src/tests/pi-native-mcp.test.ts +193 -0
  280. package/src/tests/pi-tool-exposure.test.ts +374 -0
  281. package/src/tests/preload.ts +3 -0
  282. package/src/tests/pricing-routes.test.ts +2 -2
  283. package/src/tests/prompt-template-session.test.ts +5 -3
  284. package/src/tests/rate-limit-event.test.ts +65 -0
  285. package/src/tests/rate-limit-outcome.test.ts +90 -0
  286. package/src/tests/rbac-engine.test.ts +77 -3
  287. package/src/tests/reasoning-effort.test.ts +109 -0
  288. package/src/tests/refresh-modelsdev-carryforward.test.ts +5 -5
  289. package/src/tests/runner-key-completion-outcome.test.ts +112 -0
  290. package/src/tests/runner-key-outcome-late-reset.test.ts +224 -0
  291. package/src/tests/runner-registration-retry.test.ts +149 -0
  292. package/src/tests/runtime-model-catalog.test.ts +86 -0
  293. package/src/tests/script-connections.test.ts +9 -0
  294. package/src/tests/seat-mismatch-report.test.ts +85 -0
  295. package/src/tests/seed-scripts.test.ts +138 -0
  296. package/src/tests/seed.test.ts +25 -0
  297. package/src/tests/session-costs.test.ts +14 -11
  298. package/src/tests/slack-message-text.test.ts +101 -0
  299. package/src/tests/slack-render-v2.test.ts +96 -0
  300. package/src/tests/slack-session-status.test.ts +626 -0
  301. package/src/tests/slack-thread-buffer-context.test.ts +93 -0
  302. package/src/tests/status.test.ts +29 -0
  303. package/src/tests/steering-promotion.test.ts +51 -0
  304. package/src/tests/store-progress-ownership.test.ts +136 -0
  305. package/src/tests/subscription-plans.test.ts +28 -0
  306. package/src/tests/task-cascade-fail.test.ts +148 -2
  307. package/src/tests/task-citations.test.ts +3 -2
  308. package/src/tests/tool-annotations.test.ts +1 -1
  309. package/src/tests/usage-cache.test.ts +166 -0
  310. package/src/tests/workflow-agent-task.test.ts +30 -0
  311. package/src/tests/workflow-executors.test.ts +5 -2
  312. package/src/tests/workflow-system-one-decision-review.test.ts +1021 -0
  313. package/src/tests/workflow-system-one-decision-save-warnings.test.ts +365 -0
  314. package/src/tests/workflow-system-one-decision.test.ts +2063 -0
  315. package/src/tests/workflow-triggers-v2.test.ts +320 -0
  316. package/src/tools/model-catalog/index.ts +137 -0
  317. package/src/tools/schedules/create-schedule.ts +17 -2
  318. package/src/tools/schedules/patch-schedule.ts +31 -1
  319. package/src/tools/schedules/update-schedule.ts +31 -1
  320. package/src/tools/send-task.ts +18 -1
  321. package/src/tools/store-progress.ts +49 -4
  322. package/src/tools/task-action.ts +14 -1
  323. package/src/tools/tool-config.ts +3 -1
  324. package/src/tools/workflows/create-workflow.ts +17 -4
  325. package/src/tools/workflows/patch-workflow-node.ts +17 -7
  326. package/src/tools/workflows/patch-workflow.ts +9 -2
  327. package/src/tools/workflows/update-workflow.ts +17 -4
  328. package/src/types.ts +41 -1
  329. package/src/utils/codex-auth-failure.ts +34 -0
  330. package/src/utils/context-window.ts +47 -53
  331. package/src/utils/credentials.ts +72 -30
  332. package/src/utils/error-tracker.ts +80 -0
  333. package/src/utils/harness-cli-version.ts +115 -0
  334. package/src/utils/harness-model-error.ts +33 -0
  335. package/src/utils/model-rate-limit-windows.ts +12 -0
  336. package/src/utils/runtime-model-catalog.ts +152 -0
  337. package/src/utils/spawn-model-guard.ts +43 -0
  338. package/src/utils/subscription-plans.ts +22 -0
  339. package/src/workflows/approval-resolution.ts +39 -0
  340. package/src/workflows/definition.ts +7 -0
  341. package/src/workflows/engine.ts +69 -1
  342. package/src/workflows/executors/agent-task.ts +16 -6
  343. package/src/workflows/executors/base.ts +53 -0
  344. package/src/workflows/executors/human-in-the-loop.ts +8 -8
  345. package/src/workflows/executors/index.ts +1 -0
  346. package/src/workflows/executors/registry.ts +2 -0
  347. package/src/workflows/executors/system-one-decision.ts +1232 -0
  348. package/src/workflows/executors/system-one-providers.ts +301 -0
  349. package/src/workflows/executors/workflow-llm.ts +13 -1
  350. package/src/workflows/model-validation.ts +45 -0
  351. package/src/workflows/patch-definition.ts +5 -0
  352. package/src/workflows/readiness.ts +86 -0
  353. package/src/workflows/recovery.ts +12 -12
  354. package/src/workflows/resume.ts +23 -9
  355. package/src/workflows/triggers.ts +85 -0
  356. package/templates/schedules/daily-blocker-digest/content.md +4 -5
  357. package/templates/skills/agent-browser/SKILL.md +6 -5
  358. package/templates/skills/agent-browser/content.md +6 -5
  359. package/templates/skills/heartbeat-runbook/config.json +1 -1
  360. package/templates/skills/heartbeat-runbook/content.md +2 -2
  361. package/templates/skills/swarm-scripts/SKILL.md +1 -1
  362. package/templates/skills/swarm-scripts/content.md +1 -1
  363. package/templates/skills/workflow-iterate/content.md +82 -1
  364. package/templates/workflows/claude-code-changelog-watch/content.md +2 -0
  365. package/templates/workflows/pr-review-status-sweep/content.md +2 -0
  366. package/dist/boot-seeds-s3q01xj3.js +0 -26
  367. package/dist/claude-sdk-session-t442qz6f.js +0 -39108
  368. package/dist/cli-0xjkj1j7.js +0 -61
  369. package/dist/cli-20cj37vt.js +0 -335561
  370. package/dist/cli-2djtr51b.js +0 -48
  371. package/dist/cli-65hjmev5.js +0 -1141
  372. package/dist/cli-aw1jwp1r.js +0 -14075
  373. package/dist/cli-h967nb6r.js +0 -6603
  374. package/dist/cli-vapyk8sw.js +0 -20
  375. package/dist/cli-ws6rqycm.js +0 -247
  376. package/dist/pricing-refresh-v1cbr9te.js +0 -27
  377. package/src/providers/modelsdev-reasoning.json +0 -6453
  378. package/dist/{index-f24115ge.js → index-2wsdsnmm.js} +3 -3
@@ -7,7 +7,7 @@
7
7
  * memory, communication, secrets) from session-templates.ts
8
8
  * E outputs (gated on AGENT_FS_API_URL and the pages capability)
9
9
  * H deployment-gated notes: slack, steering
10
- * I tools and skills (deferred-tools line, skills, MCP server names)
10
+ * I tools and skills (harness tool discovery, skills, MCP server names)
11
11
  * J agent notes: CLAUDE.md for codex, opencode, pi, only when edited
12
12
  * K repository (per task)
13
13
  *
@@ -119,6 +119,7 @@ export const getBasePrompt = async (args: BasePromptArgs): Promise<string> => {
119
119
  const { role, agentId, traits } = args;
120
120
  const {
121
121
  hasMcp = true,
122
+ hasToolSearch = false,
122
123
  hasLocalEnvironment: hasLocalEnv = true,
123
124
  nativeSkillDiscovery = true,
124
125
  } = traits ?? {};
@@ -221,12 +222,17 @@ export const getBasePrompt = async (args: BasePromptArgs): Promise<string> => {
221
222
 
222
223
  // I. Tools and skills. Skipped without MCP: the discovery tools are MCP tools.
223
224
  if (hasMcp) {
225
+ const discoveryResult = await resolveTemplateAsync(
226
+ hasToolSearch ? "system.agent.tool_discovery.search" : "system.agent.tool_discovery.direct",
227
+ {},
228
+ );
224
229
  const toolsResult = await resolveTemplateAsync(
225
230
  "system.agent.tools_skills",
226
231
  renderToolsAndSkillsVars({
227
232
  skillsSummary: args.skillsSummary,
228
233
  mcpServers: args.mcpServers,
229
234
  nativeSkillDiscovery,
235
+ toolDiscovery: discoveryResult.text,
230
236
  hasLocalEnv,
231
237
  }),
232
238
  );
@@ -265,14 +271,15 @@ export const getBasePrompt = async (args: BasePromptArgs): Promise<string> => {
265
271
  /**
266
272
  * Dynamic lines for `system.agent.tools_skills`. The static text lives in the
267
273
  * template so operators can override or skip the section; only the lists that
268
- * depend on the installed skills and MCP servers are built here.
274
+ * depend on the installed skills, MCP servers, and harness are built here.
269
275
  */
270
276
  function renderToolsAndSkillsVars(input: {
271
277
  skillsSummary?: { name: string; description: string }[];
272
278
  mcpServers?: string[];
273
279
  nativeSkillDiscovery: boolean;
274
280
  hasLocalEnv: boolean;
275
- }): { skills: string; mcp_servers: string } {
281
+ toolDiscovery: string;
282
+ }): { skills: string; mcp_servers: string; tool_discovery: string } {
276
283
  let section = "";
277
284
 
278
285
  const skills = input.skillsSummary ?? [];
@@ -307,7 +314,11 @@ function renderToolsAndSkillsVars(input: {
307
314
  ? `Connected MCP servers: ${servers.join(", ")}. Their tools are in your tool list.\n`
308
315
  : "";
309
316
 
310
- return { skills: section, mcp_servers: mcpLine };
317
+ return {
318
+ skills: section,
319
+ mcp_servers: mcpLine,
320
+ tool_discovery: input.toolDiscovery,
321
+ };
311
322
  }
312
323
 
313
324
  /**
@@ -202,6 +202,7 @@ agent-fs is the shared drive between agents and people. Documents (reports, dige
202
202
  Pages: only for polished artifacts shared with a wider audience or explicitly requested; see \`pages\` skill.
203
203
  A tool a person will use, with data and actions: build an app. See the \`apps\` skill.
204
204
  Link env: \`APP_URL\` for pages, \`MCP_BASE_URL\` for the API, \`AGENT_FS_LIVE_URL\` for files. Report missing variables.
205
+ For a file anyone outside the swarm opens, use an \`agent-fs share-create\` link; \`AGENT_FS_LIVE_URL\` links are for signed-in teammates.
205
206
  `,
206
207
  variables: [],
207
208
  category: "system",
@@ -344,15 +345,36 @@ registerTemplate({
344
345
  category: "system",
345
346
  });
346
347
 
348
+ registerTemplate({
349
+ eventType: "system.agent.tool_discovery.search",
350
+ header: "",
351
+ defaultBody:
352
+ "Most swarm tools are deferred. Load one with your harness tool search before the first call.",
353
+ variables: [],
354
+ category: "system",
355
+ });
356
+
357
+ registerTemplate({
358
+ eventType: "system.agent.tool_discovery.direct",
359
+ header: "",
360
+ defaultBody: "Swarm tools are already in your tool list.",
361
+ variables: [],
362
+ category: "system",
363
+ });
364
+
347
365
  registerTemplate({
348
366
  eventType: "system.agent.tools_skills",
349
367
  header: "",
350
368
  defaultBody: `
351
369
  ## Tools and skills
352
370
 
353
- Most swarm tools are deferred. Load one with your harness tool search before the first call.
371
+ {{tool_discovery}}
354
372
  {{skills}}{{mcp_servers}}`,
355
373
  variables: [
374
+ {
375
+ name: "tool_discovery",
376
+ description: "Harness-specific guidance for discovering swarm tools.",
377
+ },
356
378
  {
357
379
  name: "skills",
358
380
  description:
@@ -358,6 +358,7 @@ export class ACPAdapter implements ProviderAdapter {
358
358
 
359
359
  readonly traits: ProviderTraits = {
360
360
  hasMcp: true,
361
+ hasToolSearch: false,
361
362
  hasLocalEnvironment: true,
362
363
  };
363
364
 
@@ -11,6 +11,7 @@ import { getContextWindowSize } from "../utils/context-window";
11
11
  import { validateClaudeCredentials } from "../utils/credentials";
12
12
  import {
13
13
  parseStderrForErrors,
14
+ redactRateLimitEventLine,
14
15
  SessionErrorTracker,
15
16
  trackErrorFromJson,
16
17
  } from "../utils/error-tracker";
@@ -830,19 +831,21 @@ class ClaudeSession implements ProviderSession {
830
831
  for await (const chunk of stdout) {
831
832
  stdoutChunks++;
832
833
  const text = new TextDecoder().decode(chunk);
833
- // Scrub before every log-egress point: file write, listener emit, and
834
- // downstream pretty-print / session-logs push (all consume event.content).
835
- logFileHandle.write(scrubSecrets(text));
836
834
 
837
835
  const combined = partialLine + text;
838
836
  const parts = combined.split("\n");
839
837
  partialLine = parts.pop() || "";
840
838
 
841
839
  for (const line of parts) {
840
+ // Scrub and redact before every log-egress point: file write,
841
+ // listener emit, and downstream pretty-print / session-logs push
842
+ // (all consume event.content). The file is written per complete
843
+ // line so a rate_limit_event is redacted as a whole JSON object.
844
+ logFileHandle.write(`${scrubSecrets(redactRateLimitEventLine(line))}\n`);
842
845
  const trimmed = line.trim();
843
846
  if (!trimmed) continue;
844
847
 
845
- this.emit({ type: "raw_log", content: scrubSecrets(trimmed) });
848
+ this.emit({ type: "raw_log", content: scrubSecrets(redactRateLimitEventLine(trimmed)) });
846
849
  this.processJsonLine(trimmed, (cost) => {
847
850
  lastCost = cost;
848
851
  });
@@ -850,8 +853,12 @@ class ClaudeSession implements ProviderSession {
850
853
  }
851
854
 
852
855
  // Handle remaining partial line
856
+ if (partialLine) logFileHandle.write(scrubSecrets(redactRateLimitEventLine(partialLine)));
853
857
  if (partialLine.trim()) {
854
- this.emit({ type: "raw_log", content: scrubSecrets(partialLine.trim()) });
858
+ this.emit({
859
+ type: "raw_log",
860
+ content: scrubSecrets(redactRateLimitEventLine(partialLine.trim())),
861
+ });
855
862
  this.processJsonLine(partialLine.trim(), (cost) => {
856
863
  lastCost = cost;
857
864
  });
@@ -931,6 +938,7 @@ class ClaudeSession implements ProviderSession {
931
938
  rateLimitResetAt: this.errorTracker.getRateLimitResetAt(),
932
939
  rateLimitWindows: this.errorTracker.getRateLimitWindows(),
933
940
  modelRateLimit: this.errorTracker.getModelRateLimit(),
941
+ creditsRequired: this.errorTracker.getCreditsRequired(),
934
942
  appliedReasoningEffort: this.appliedReasoningEffort,
935
943
  };
936
944
  }
@@ -1001,6 +1009,7 @@ export class ClaudeAdapter implements ProviderAdapter {
1001
1009
  readonly name = "claude";
1002
1010
  readonly traits: ProviderTraits = {
1003
1011
  hasMcp: true,
1012
+ hasToolSearch: true,
1004
1013
  // Claude Code reads ~/.claude/skills itself and advertises every skill's
1005
1014
  // name + description natively.
1006
1015
  nativeSkillDiscovery: true,
@@ -790,6 +790,7 @@ export class ClaudeManagedAdapter implements ProviderAdapter {
790
790
  // process is a thin SSE relay — no /workspace, no PM2, no agent-fs, no skills FS.
791
791
  readonly traits: ProviderTraits = {
792
792
  hasMcp: true,
793
+ hasToolSearch: false,
793
794
  hasLocalEnvironment: false,
794
795
  steerModes: ["steer", "queue"],
795
796
  };
@@ -1,48 +1,32 @@
1
1
  /**
2
- * Pricing table for Anthropic-managed Claude models, mirroring the layout of
3
- * `src/providers/codex-models.ts`. Rates are USD per million tokens (Mtok)
4
- * sourced from https://platform.claude.com/docs/en/about-claude/pricing
5
- * (verified 2026-09-02).
2
+ * Anthropic-managed Claude model facts, read from the model catalog
3
+ * (model-catalog phase 4). Rates are USD per million tokens (Mtok).
6
4
  *
7
- * The managed-agents API does NOT report dollar cost on the `span.model_request_end`
8
- * event — only token counts (`input_tokens`, `output_tokens`,
9
- * `cache_read_input_tokens`, `cache_creation_input_tokens`). Phase 4 of the
10
- * provider plan computes USD locally via {@link computeClaudeManagedCostUsd},
11
- * then folds in Anthropic's $0.08/session-hour runtime fee inside the adapter.
5
+ * There is no hand-maintained model list or price table any more: both come
6
+ * from the runtime catalog (`src/utils/runtime-model-catalog.ts` — the API's
7
+ * `model_catalog` + overlay rows, pulled over HTTP; the vendored models.dev
8
+ * snapshot offline). A new Claude model is listed and priced as soon as it
9
+ * lands in `model_catalog`, with no code change and no redeploy.
12
10
  *
13
- * Bump this file when Anthropic publishes new rates or new models.
11
+ * The managed-agents API does NOT report dollar cost on the
12
+ * `span.model_request_end` event — only token counts. The adapter computes
13
+ * USD locally via {@link computeClaudeManagedCostUsd}, then folds in
14
+ * Anthropic's $0.08/session-hour runtime fee. The API server recomputes the
15
+ * canonical price against the pricing table.
14
16
  *
15
17
  * Cache nomenclature mapping:
16
- * - `cache_read_input_tokens` → "cache hit" rate (cheapest)
17
- * - `cache_creation_input_tokens` → "cache write" rate (input × 1.25 for 5m TTL)
18
- * - regular `input_tokens` (uncached) → standard input rate
19
- *
20
- * Anthropic's pricing page lists 5-minute and 1-hour cache TTLs separately;
21
- * managed-agents currently uses the 5-minute breakpoint by default, which is
22
- * the rate captured here. If a future SDK release surfaces TTL on the usage
23
- * payload, refine these by TTL.
18
+ * - `cache_read_input_tokens` → catalog `cache_read`
19
+ * - `cache_creation_input_tokens` → catalog `cache_write` (5-minute TTL)
20
+ * - regular `input_tokens` (uncached) → catalog `input`
24
21
  */
22
+ import { harnessModelIds } from "@desplega/model-catalog";
23
+ import { runtimeCatalogModel, runtimeCatalogSection } from "../utils/runtime-model-catalog";
25
24
 
26
- /** Models supported by the managed-agents surface for the swarm worker. */
27
- export const CLAUDE_MANAGED_MODELS = [
28
- "claude-fable-5-1",
29
- "claude-mythos-5-1",
30
- "claude-opus-5-5",
31
- "claude-opus-5",
32
- "claude-fable-5",
33
- "claude-mythos-5",
34
- "claude-sonnet-5-5",
35
- "claude-sonnet-5",
36
- "claude-sonnet-4-6",
37
- "claude-opus-4-8",
38
- "claude-opus-4-7",
39
- "claude-opus-4-6",
40
- "claude-haiku-4-5",
41
- ] as const;
42
-
43
- export type ClaudeManagedModel = (typeof CLAUDE_MANAGED_MODELS)[number];
25
+ /** Managed-agents-selectable Claude models from the catalog, newest first. */
26
+ export function listClaudeManagedModels(): string[] {
27
+ return harnessModelIds("claude-managed", runtimeCatalogSection("anthropic"));
28
+ }
44
29
 
45
- /** Token rates per million tokens (USD). */
46
30
  export interface ClaudeManagedTokenPricing {
47
31
  /** USD per million uncached input tokens. */
48
32
  inputPerMillion: number;
@@ -54,131 +38,39 @@ export interface ClaudeManagedTokenPricing {
54
38
  cacheWritePerMillion: number;
55
39
  }
56
40
 
57
- /** Pricing per million tokens (USD), including an optional scheduled rate change. */
58
- export interface ClaudeManagedModelPricing extends ClaudeManagedTokenPricing {
59
- scheduledChange?: {
60
- /** ISO timestamp at which the replacement rates take effect. */
61
- effectiveAt: string;
62
- pricing: ClaudeManagedTokenPricing;
63
- };
64
- }
41
+ export type ClaudeManagedModelPricing = ClaudeManagedTokenPricing;
65
42
 
66
43
  /**
67
- * Anthropic public list pricing. Source:
68
- * https://platform.claude.com/docs/en/about-claude/pricing
69
- *
70
- * - claude-fable-5-1: $10 / $50 / $0.25 / $12.50 (verified 2026-09-02)
71
- * - claude-mythos-5-1: $10 / $50 / $0.25 / $12.50 (invite only, verified 2026-09-02)
72
- * - claude-fable-5: $10 / $50 / $1.00 / $12.50 (verified 2026-06-10)
73
- * - claude-mythos-5: $10 / $50 / $1.00 / $12.50 (limited availability, verified 2026-06-10)
74
- * - claude-opus-5-5: $4 / $20 / $0.20 / $5.00 (verified 2026-09-22)
75
- * - claude-opus-5: $5 / $25 / $0.50 / $6.25 (verified 2026-07-25)
76
- * - claude-sonnet-5-5: $2 / $10 / $0.20 / $2.50 (verified 2026-09-28)
77
- * - claude-sonnet-5: $2 / $10 / $0.20 / $2.50 (standard rate, verified 2026-08-29)
78
- * - claude-sonnet-4-6: $3 / $15 / $0.30 / $3.75 (in / out / cache-read / cache-write)
79
- * - claude-opus-4-8: $5 / $25 / $0.50 / $6.25 (verified 2026-05-28)
80
- * - claude-opus-4-7: $15 / $75 / $1.50 / $18.75 (STALE — was correct at launch, Anthropic has since dropped Opus to $5/$25)
81
- * - claude-opus-4-6: $5 / $25 / $0.50 / $6.25 (verified 2026-05-28)
82
- * - claude-haiku-4-5: $1 / $5 / $0.10 / $1.25
44
+ * Catalog pricing for a managed model. Dated ids fall back to their undated
45
+ * family id. Missing cache rates follow Anthropic's published multipliers
46
+ * (read = 0.1 × input, 5-minute write = 1.25 × input).
83
47
  */
84
- export const CLAUDE_MANAGED_MODEL_PRICING: Record<ClaudeManagedModel, ClaudeManagedModelPricing> = {
85
- "claude-fable-5-1": {
86
- inputPerMillion: 10.0,
87
- outputPerMillion: 50.0,
88
- cacheReadPerMillion: 0.25,
89
- cacheWritePerMillion: 12.5,
90
- },
91
- "claude-mythos-5-1": {
92
- inputPerMillion: 10.0,
93
- outputPerMillion: 50.0,
94
- cacheReadPerMillion: 0.25,
95
- cacheWritePerMillion: 12.5,
96
- },
97
- "claude-opus-5-5": {
98
- inputPerMillion: 4.0,
99
- outputPerMillion: 20.0,
100
- cacheReadPerMillion: 0.2,
101
- cacheWritePerMillion: 5.0,
102
- },
103
- "claude-opus-5": {
104
- inputPerMillion: 5.0,
105
- outputPerMillion: 25.0,
106
- cacheReadPerMillion: 0.5,
107
- cacheWritePerMillion: 6.25,
108
- },
109
- "claude-fable-5": {
110
- inputPerMillion: 10.0,
111
- outputPerMillion: 50.0,
112
- cacheReadPerMillion: 1.0,
113
- cacheWritePerMillion: 12.5,
114
- },
115
- "claude-mythos-5": {
116
- inputPerMillion: 10.0,
117
- outputPerMillion: 50.0,
118
- cacheReadPerMillion: 1.0,
119
- cacheWritePerMillion: 12.5,
120
- },
121
- "claude-sonnet-5-5": {
122
- inputPerMillion: 2.0,
123
- outputPerMillion: 10.0,
124
- cacheReadPerMillion: 0.2,
125
- cacheWritePerMillion: 2.5,
126
- },
127
- "claude-sonnet-5": {
128
- inputPerMillion: 2.0,
129
- outputPerMillion: 10.0,
130
- cacheReadPerMillion: 0.2,
131
- cacheWritePerMillion: 2.5,
132
- },
133
- "claude-sonnet-4-6": {
134
- inputPerMillion: 3.0,
135
- outputPerMillion: 15.0,
136
- cacheReadPerMillion: 0.3,
137
- cacheWritePerMillion: 3.75,
138
- },
139
- "claude-opus-4-8": {
140
- inputPerMillion: 5.0,
141
- outputPerMillion: 25.0,
142
- cacheReadPerMillion: 0.5,
143
- cacheWritePerMillion: 6.25,
144
- },
145
- "claude-opus-4-7": {
146
- inputPerMillion: 15.0,
147
- outputPerMillion: 75.0,
148
- cacheReadPerMillion: 1.5,
149
- cacheWritePerMillion: 18.75,
150
- },
151
- "claude-opus-4-6": {
152
- inputPerMillion: 5.0,
153
- outputPerMillion: 25.0,
154
- cacheReadPerMillion: 0.5,
155
- cacheWritePerMillion: 6.25,
156
- },
157
- "claude-haiku-4-5": {
158
- inputPerMillion: 1.0,
159
- outputPerMillion: 5.0,
160
- cacheReadPerMillion: 0.1,
161
- cacheWritePerMillion: 1.25,
162
- },
163
- };
48
+ export function getClaudeManagedModelPricing(model: string): ClaudeManagedModelPricing | undefined {
49
+ const cost =
50
+ runtimeCatalogModel("anthropic", model)?.cost ??
51
+ runtimeCatalogModel("anthropic", model.replace(/-\d{8}$/, ""))?.cost;
52
+ if (typeof cost?.input !== "number" || typeof cost.output !== "number") return undefined;
53
+ return {
54
+ inputPerMillion: cost.input,
55
+ outputPerMillion: cost.output,
56
+ cacheReadPerMillion: typeof cost.cache_read === "number" ? cost.cache_read : cost.input * 0.1,
57
+ cacheWritePerMillion:
58
+ typeof cost.cache_write === "number" ? cost.cache_write : cost.input * 1.25,
59
+ };
60
+ }
164
61
 
165
- /**
166
- * Models we've already warned about — keeps `console.warn` from spamming the
167
- * worker logs when an old session keeps replaying through `span.model_request_end`
168
- * events with an unrecognized model string.
169
- */
62
+ /** One warning per model per process for unpriced models. */
170
63
  const warnedUnknownModels = new Set<string>();
171
64
 
172
65
  /**
173
66
  * Compute USD cost for one Claude managed-agents session, given the SDK's
174
67
  * accumulated token counts.
175
68
  *
176
- * Returns `0` (with a deduplicated `console.warn`) for unknown model strings —
177
- * we'd rather under-report than make up a number on a typo.
69
+ * Returns `0` (with a deduplicated `console.warn`) for models the catalog does
70
+ * not price — we'd rather under-report than make up a number on a typo.
178
71
  *
179
- * Note: the runtime $0.08/session-hour fee is NOT folded in here. The adapter
180
- * computes that separately because it depends on the session's wallclock
181
- * `durationMs`, which is provider-state, not token-state.
72
+ * Note: the runtime $0.08/session-hour fee is NOT folded in here; the adapter
73
+ * computes it from the session's wallclock.
182
74
  */
183
75
  export function computeClaudeManagedCostUsd(
184
76
  model: string,
@@ -186,24 +78,18 @@ export function computeClaudeManagedCostUsd(
186
78
  outputTokens: number,
187
79
  cacheReadTokens: number,
188
80
  cacheWriteTokens: number,
189
- pricedAtMs: number = Date.now(),
190
81
  ): number {
191
- const configuredPricing = CLAUDE_MANAGED_MODEL_PRICING[model as ClaudeManagedModel];
192
- if (!configuredPricing) {
82
+ const pricing = getClaudeManagedModelPricing(model);
83
+ if (!pricing) {
193
84
  if (!warnedUnknownModels.has(model)) {
194
85
  warnedUnknownModels.add(model);
195
86
  console.warn(
196
- `[claude-managed-models] Unknown model "${model}" — returning $0 cost. ` +
197
- `Add it to CLAUDE_MANAGED_MODEL_PRICING in src/providers/claude-managed-models.ts.`,
87
+ `[claude-managed-models] Unpriced model "${model}" — returning $0 cost. ` +
88
+ "Add it to the model catalog (refresh or overlay row).",
198
89
  );
199
90
  }
200
91
  return 0;
201
92
  }
202
- const pricing =
203
- configuredPricing.scheduledChange &&
204
- pricedAtMs >= Date.parse(configuredPricing.scheduledChange.effectiveAt)
205
- ? configuredPricing.scheduledChange.pricing
206
- : configuredPricing;
207
93
  const inputCost = (inputTokens / 1_000_000) * pricing.inputPerMillion;
208
94
  const outputCost = (outputTokens / 1_000_000) * pricing.outputPerMillion;
209
95
  const cacheReadCost = (cacheReadTokens / 1_000_000) * pricing.cacheReadPerMillion;
@@ -13,6 +13,7 @@ import type { RunStopHookSessionSummaryOpts } from "../hooks/hook";
13
13
  import { getContextWindowSize } from "../utils/context-window";
14
14
  import {
15
15
  parseStderrForErrors,
16
+ redactRateLimitEvent,
16
17
  SessionErrorTracker,
17
18
  trackErrorFromJson,
18
19
  } from "../utils/error-tracker";
@@ -495,7 +496,7 @@ class ClaudeSdkSession implements ProviderSession {
495
496
  });
496
497
 
497
498
  for await (const message of this.query) {
498
- const scrubbed = scrubSecrets(JSON.stringify(message));
499
+ const scrubbed = scrubSecrets(JSON.stringify(redactRateLimitEvent(message)));
499
500
  log.write(`${scrubbed}\n`);
500
501
  this.emit({ type: "raw_log", content: scrubbed });
501
502
  const isResult = this.handleMessage(message);
@@ -581,6 +582,7 @@ class ClaudeSdkSession implements ProviderSession {
581
582
  rateLimitResetAt: this.errorTracker.getRateLimitResetAt(),
582
583
  rateLimitWindows: this.errorTracker.getRateLimitWindows(),
583
584
  modelRateLimit: this.errorTracker.getModelRateLimit(),
585
+ creditsRequired: this.errorTracker.getCreditsRequired(),
584
586
  appliedReasoningEffort: sessionEnvironment.appliedReasoningEffort,
585
587
  };
586
588
  }
@@ -392,16 +392,15 @@ export async function resolveCodexAuthMode(
392
392
  * Build the `failureReason` for a pool-slot OAuth revalidation failure
393
393
  * (see `resolveCodexAuthMode` above).
394
394
  *
395
- * Wording matters: when the failure is a rejected refresh whose body
396
- * indicates the credential is dead (invalid_grant, reused, revoked), the
397
- * upstream error body is embedded verbatim so the EXISTING
398
- * `codex-auth-expiry-watch` script's `DEAD_TOKEN_LIKE` patterns (which match
399
- * on substrings like "refresh token was already used" / "log out and sign in
400
- * again") still catch it with zero script changes. A lock-wait timeout is
401
- * transient/retryable — its wording is deliberately distinct so the watch
402
- * does NOT bench a slot over a temporary contention blip.
395
+ * Wording matters: every variant carries `[auth-error]`, but the runner's
396
+ * `isCodexAuthFailureReason` counts only a confirmed refresh rejection toward
397
+ * the auth-failure bench (2 in a row). A lock-wait timeout ("waiting for the
398
+ * refresh lock") and any other thrown error (refresh-lock HTTP or network
399
+ * failure, config-store persistence failure: "not a confirmed auth
400
+ * rejection") are excluded as transient, so an outage does NOT bench a
401
+ * healthy login.
403
402
  */
404
- function buildPoolRevalidationFailureReason(err: unknown, slot: number): string {
403
+ export function buildPoolRevalidationFailureReason(err: unknown, slot: number): string {
405
404
  if (err instanceof CodexOAuthRefreshError) {
406
405
  if (err.reason === "lock_timeout") {
407
406
  return `[auth-error] Codex pool slot ${slot} [...${err.keySuffix}] revalidation failed: timed out waiting for the refresh lock — transient, will retry on next task.`;
@@ -409,7 +408,7 @@ function buildPoolRevalidationFailureReason(err: unknown, slot: number): string
409
408
  return `[auth-error] Codex pool slot ${slot} [...${err.keySuffix}] revalidation failed: refresh rejected (${err.status ?? "unknown status"} ${err.body ?? ""}) — credential likely revoked; re-run codex-login for this slot.`;
410
409
  }
411
410
  const message = err instanceof Error ? err.message : String(err);
412
- return `[auth-error] Codex pool slot ${slot} revalidation failed: ${message}`;
411
+ return `[auth-error] Codex pool slot ${slot} revalidation failed (not a confirmed auth rejection, transient): ${message}`;
413
412
  }
414
413
 
415
414
  /**
@@ -558,16 +557,16 @@ export async function buildCodexConfig(
558
557
  // at `~/.codex/config.toml` (Phase 6). Repeating them here makes local dev
559
558
  // (no baseline file) behave identically to the Docker worker.
560
559
  //
561
- // `features.hooks` / `features.plugin_hooks` enable Codex's hook system and
562
- // the hooks contributed by installed Codex plugins (context-mode's plugin:
563
- // routing injection, PreToolUse safety blocks, output capture).
560
+ // Keep ChatGPT apps/connectors disabled because their `codex_apps` tools use
561
+ // the worker's host OAuth identity. Hooks remain enabled for Codex steering
562
+ // and the installed context-mode plugin.
564
563
  return {
565
564
  model,
566
565
  approval_policy: "never",
567
566
  sandbox_mode: "danger-full-access",
568
567
  skip_git_repo_check: true,
569
568
  show_raw_agent_reasoning: false,
570
- features: { hooks: true, plugin_hooks: true },
569
+ features: { apps: false, hooks: true, plugin_hooks: true },
571
570
  mcp_servers: mcpServers as CodexConfig,
572
571
  ...reasoningConfig,
573
572
  };
@@ -2373,6 +2372,7 @@ export class CodexAdapter implements ProviderAdapter {
2373
2372
  readonly name = "codex";
2374
2373
  readonly traits: ProviderTraits = {
2375
2374
  hasMcp: true,
2375
+ hasToolSearch: false,
2376
2376
  // No native skill system: `resolveSlashSkillPrompt` only inlines a SKILL.md
2377
2377
  // when a turn prompt opens with `/name`, so the system prompt must
2378
2378
  // enumerate the installed skills for the agent to know they exist.