@desplega.ai/agent-swarm 2.8.2 → 2.8.3

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 (258) hide show
  1. package/dist/acp-adapter-xq6s2z6t.js +14 -0
  2. package/dist/{actions-kxek041g.js → actions-ewz7bp4g.js} +20 -19
  3. package/dist/{amp-adapter-ce7jjke4.js → amp-adapter-f25tqhnf.js} +3 -3
  4. package/dist/{app-v6zz8yh0.js → app-mkptw0k7.js} +4 -4
  5. package/dist/{assistant-m0sw9xx2.js → assistant-c47rfe77.js} +23 -22
  6. package/dist/{boot-args-schema-66bk37wv.js → boot-args-schema-4vb0xsat.js} +1 -1
  7. package/dist/{boot-reembed-edjpwsc1.js → boot-reembed-1ghy2sab.js} +1 -1
  8. package/dist/{boot-reembed-y27n09tz.js → boot-reembed-htr73hbs.js} +1 -1
  9. package/dist/{boot-scrub-sweep-1xc35965.js → boot-scrub-sweep-yrytg42z.js} +4 -4
  10. package/dist/{boot-seeds-7hjj91qj.js → boot-seeds-n2b3dx4e.js} +4 -4
  11. package/dist/{boxd-ent8ch04.js → boxd-jmfqgkqa.js} +1 -1
  12. package/dist/{claude-adapter-stw7jdcf.js → claude-adapter-r33pqnzx.js} +8 -9
  13. package/dist/{claude-managed-adapter-jh6c523j.js → claude-managed-adapter-hddmxjyj.js} +4 -4
  14. package/dist/{claude-managed-setup-y6z2perp.js → claude-managed-setup-hfvry1bd.js} +5 -5
  15. package/dist/{claude-sdk-session-vvya8wqk.js → claude-sdk-session-0hamqzc7.js} +10 -11
  16. package/dist/{cli-v1dv1r37.js → cli-0bcgyj5b.js} +74 -3
  17. package/dist/{cli-t2tma8gb.js → cli-0vksaxvr.js} +2 -2
  18. package/dist/{cli-mrt48bx7.js → cli-15204js0.js} +1 -1
  19. package/dist/{cli-8aes17e4.js → cli-1m96dc36.js} +3 -3
  20. package/dist/{cli-2r0jcc3k.js → cli-2d0cghfn.js} +1 -1
  21. package/dist/{cli-0cq8y6m7.js → cli-4ax9mvvg.js} +4 -4
  22. package/dist/{cli-tekytdq9.js → cli-4dpkjc2e.js} +6 -6
  23. package/dist/{cli-x1wa213s.js → cli-4e1hfbpq.js} +5 -5
  24. package/dist/{cli-7349va39.js → cli-500c09j9.js} +921 -431
  25. package/dist/{cli-9mb2q6pb.js → cli-54qr8mcd.js} +2 -2
  26. package/dist/{cli-m88rpzkh.js → cli-5a7szzfh.js} +2 -2
  27. package/dist/{cli-bst1vp7e.js → cli-5y2fvw4z.js} +13 -5
  28. package/dist/{cli-vj75tyaw.js → cli-6yygkr0w.js} +7 -7
  29. package/dist/{cli-kjtwrhea.js → cli-7c5tgqhf.js} +5 -5
  30. package/dist/{cli-2gxeg5gr.js → cli-8476gtwf.js} +1 -1
  31. package/dist/{cli-zh9rsbqf.js → cli-922z7gwm.js} +3 -3
  32. package/dist/{cli-jrzkw01m.js → cli-93t5s4zq.js} +2 -2
  33. package/dist/{cli-gyt3zydq.js → cli-9zmb7ptc.js} +9 -9
  34. package/dist/{cli-dzpc6en0.js → cli-am1ptset.js} +2 -2
  35. package/dist/{cli-w401b9tq.js → cli-awwptga4.js} +1 -1
  36. package/dist/{cli-26ctbcdp.js → cli-bhsfbmk8.js} +3 -3
  37. package/dist/{cli-mxn1qvbn.js → cli-bj6qhgte.js} +14 -32
  38. package/dist/{cli-g70vxtjh.js → cli-c0xjnr8z.js} +2 -2
  39. package/dist/{cli-jdknh18m.js → cli-c3ng0mb4.js} +13 -13
  40. package/dist/{cli-f4e8r23x.js → cli-c71n3bxq.js} +11 -6
  41. package/dist/{cli-6rc5frdm.js → cli-crpf163n.js} +25 -18
  42. package/dist/{cli-1qkz151v.js → cli-dpsfwh7n.js} +13 -21
  43. package/dist/{cli-xzm9vcfg.js → cli-dtdht77h.js} +2 -2
  44. package/dist/{cli-a0z912j7.js → cli-e2w34h6z.js} +137 -62
  45. package/dist/{cli-eddnyg3t.js → cli-emekyyhr.js} +1 -1
  46. package/dist/{cli-d84byzn8.js → cli-f1kwb5fc.js} +109 -33
  47. package/dist/{cli-0jzra9ad.js → cli-gn9y6fn7.js} +2 -2
  48. package/dist/{cli-vdektqgf.js → cli-gpz1d0t2.js} +4 -4
  49. package/dist/{cli-rcecc3yq.js → cli-h9yy18gy.js} +84 -36
  50. package/dist/{cli-m5akxq8q.js → cli-j8cjdzan.js} +1 -1
  51. package/dist/{cli-m9s2qff2.js → cli-jg5txpm6.js} +187 -93
  52. package/dist/{cli-b98a65ed.js → cli-k2rw11py.js} +3 -3
  53. package/dist/{cli-3e875j5p.js → cli-k96cecs7.js} +276 -47
  54. package/dist/{cli-3vjhs18n.js → cli-kd56bmk4.js} +1 -1
  55. package/dist/{cli-3sy2xags.js → cli-kmemts3w.js} +12 -12
  56. package/dist/{cli-f6bahpn5.js → cli-knva3nmx.js} +2 -2
  57. package/dist/{cli-959kp5h2.js → cli-kw44j53p.js} +13 -13
  58. package/dist/{cli-bsywb58a.js → cli-mdpbjnzq.js} +10 -10
  59. package/dist/{cli-2kvhc7x8.js → cli-me0r8gzr.js} +35 -76
  60. package/dist/{cli-4vzgeta4.js → cli-mwwmka77.js} +14 -14
  61. package/dist/{cli-q24n86d2.js → cli-n5t077me.js} +2 -2
  62. package/dist/{cli-rvhdmjvt.js → cli-nx2n3z6p.js} +1 -1
  63. package/dist/{cli-28fq781p.js → cli-pe4d96rb.js} +1 -1
  64. package/dist/{cli-3rkdne1h.js → cli-pxwtcgcp.js} +2 -2
  65. package/dist/{cli-n6vtrcht.js → cli-qmqt520k.js} +2 -2
  66. package/dist/{cli-pchypa1s.js → cli-qps8je6j.js} +17 -2
  67. package/dist/{cli-97ae65rz.js → cli-rjvsf9qa.js} +5 -5
  68. package/dist/{cli-e1p3n5gq.js → cli-rqfvkx5t.js} +6 -6
  69. package/dist/{cli-3vmb0n58.js → cli-s7zz734a.js} +1 -1
  70. package/dist/{cli-rmzsadkf.js → cli-s8p8hhty.js} +2 -2
  71. package/dist/{cli-j24zbska.js → cli-sdvcrq5x.js} +5 -5
  72. package/dist/{cli-5y340nzn.js → cli-sg27rk2t.js} +5 -5
  73. package/dist/{cli-d6521kb5.js → cli-skmhsnqh.js} +1 -1
  74. package/dist/{cli-5mrq3ake.js → cli-t4dv07kr.js} +1 -1
  75. package/dist/{cli-z1w943va.js → cli-t5ys4ebm.js} +3 -3
  76. package/dist/{cli-f4r3g076.js → cli-tas6ckky.js} +2 -2
  77. package/dist/{cli-1pz0330a.js → cli-tf79ryyy.js} +1 -1
  78. package/dist/{cli-kc7v1nfv.js → cli-tnzebztn.js} +1 -1
  79. package/dist/{cli-pfs8adn4.js → cli-vx421edw.js} +3 -3
  80. package/dist/{cli-kchjb7qy.js → cli-x3ex5bqf.js} +1 -1
  81. package/dist/cli-yss07azk.js +142 -0
  82. package/dist/{cli-fwy8kfd6.js → cli-z8cvws4c.js} +98 -16
  83. package/dist/{cli-g5mtmf6t.js → cli-zdaypkq9.js} +146 -52
  84. package/dist/{cli-fpjmegdb.js → cli-zeaehgyd.js} +2 -2
  85. package/dist/{cli-837vfs2x.js → cli-ztq5z4e1.js} +4 -4
  86. package/dist/cli.js +20 -20
  87. package/dist/{codex-adapter-zerf5qsp.js → codex-adapter-2brxx5ta.js} +7 -8
  88. package/dist/{codex-hook-30gyhzxe.js → codex-hook-c930c3ea.js} +1 -1
  89. package/dist/{codex-login-bcda78ge.js → codex-login-cbrs1h5w.js} +1 -1
  90. package/dist/{codex-session-runner-89s304py.js → codex-session-runner-y9anfj0r.js} +8 -9
  91. package/dist/{commands-jeh1b51j.js → commands-wn9q06qr.js} +3 -3
  92. package/dist/{controller-mctfbrse.js → controller-fw608czd.js} +4 -4
  93. package/dist/{controllers-connect-nxa1ddwn.js → controllers-connect-63j5rdcm.js} +20 -20
  94. package/dist/{cursor-adapter-qj8vehv6.js → cursor-adapter-6mb9jme8.js} +2 -2
  95. package/dist/{db-2dvay0es.js → db-0m6v5tq4.js} +3 -3
  96. package/dist/{db-b36qn6k3.js → db-y4wfrzbm.js} +4 -2
  97. package/dist/{devin-adapter-xedz98zv.js → devin-adapter-r0yx3gv8.js} +1 -1
  98. package/dist/{dispatcher-gndbta01.js → dispatcher-9tq2zzdj.js} +17 -17
  99. package/dist/{docker-866qpzt9.js → docker-j75atvpt.js} +2 -2
  100. package/dist/{dsh-adapter-f75sz821.js → dsh-adapter-t09sv4tq.js} +2 -2
  101. package/dist/{e2b-jbm7mj93.js → e2b-7s9dscap.js} +2 -2
  102. package/dist/{e2b-3gpc2n3w.js → e2b-a7vzs2vj.js} +2 -2
  103. package/dist/{easter-egg-3d-533knw22.js → easter-egg-3d-fbwvmwhe.js} +1 -1
  104. package/dist/{embedding-space-4p05vb2x.js → embedding-space-wh8de1t9.js} +6 -6
  105. package/dist/{embeddings-m6768mgh.js → embeddings-3hpbdtjr.js} +1 -1
  106. package/dist/{event-bus-e66gh7cc.js → event-bus-tr6h3gv8.js} +1 -1
  107. package/dist/{execute-b3mrb1mv.js → execute-4bdf8sdy.js} +1 -1
  108. package/dist/{external-channel-gjv3jne3.js → external-channel-ts2fwqh0.js} +2 -2
  109. package/dist/fx-adapter-1rnxnf56.js +17 -0
  110. package/dist/grok-adapter-efhmf1r8.js +17 -0
  111. package/dist/handlers-anrr3py9.js +32 -0
  112. package/dist/{heartbeat-a1tv60gt.js → heartbeat-2ze5fzpc.js} +20 -20
  113. package/dist/{hook-8h5dzcgq.js → hook-ca54yd4s.js} +5 -5
  114. package/dist/{hook-cyaps9ba.js → hook-gaehe2w5.js} +7 -7
  115. package/dist/{http-t15mhbd9.js → http-jfg8t2yk.js} +3861 -1798
  116. package/dist/{index-tvfafeyy.js → index-3gv6sc4z.js} +1 -1
  117. package/dist/{index-qav6455f.js → index-3yvzbhxd.js} +97 -22
  118. package/dist/index-8w2aznds.js +33 -0
  119. package/dist/{index-w1zqf680.js → index-csgrxedz.js} +1 -1
  120. package/dist/index-qnjvr362.js +37 -0
  121. package/dist/index-yzxd3sn9.js +32 -0
  122. package/dist/{keepalive-91s7hzrb.js → keepalive-k2a3qe73.js} +4 -4
  123. package/dist/lead-zhxqbfdv.js +69 -0
  124. package/dist/{maintenance-7pjmy5xy.js → maintenance-gb5sd5nc.js} +1 -1
  125. package/dist/{node-4c5jqxr3.js → node-7qsx5kvm.js} +1 -1
  126. package/dist/{oauth-refresh-sweep-rzqfm94j.js → oauth-refresh-sweep-y7rm6bkb.js} +3 -3
  127. package/dist/{onboard-74st7pag.js → onboard-jmc5qerv.js} +3 -3
  128. package/dist/{opencode-adapter-arn7gm8q.js → opencode-adapter-7eade9ev.js} +6 -7
  129. package/dist/{otel-impl-rnzey8cb.js → otel-impl-8j1xhxqd.js} +2 -2
  130. package/dist/{pi-mono-adapter-6mkwq64n.js → pi-mono-adapter-yqmaf32x.js} +13 -13
  131. package/dist/{pricing-refresh-ha21jhk7.js → pricing-refresh-1nj722h6.js} +2 -2
  132. package/dist/{rbac-roles-wqhma4dr.js → rbac-roles-b1mtr6dr.js} +3 -3
  133. package/dist/{rbac-roles-59dxachk.js → rbac-roles-n1f3frk1.js} +2 -2
  134. package/dist/{render-v2-14kpzx12.js → render-v2-1gfpd8rj.js} +4 -4
  135. package/dist/{resume-gsa5fb5f.js → resume-w1s1eh5v.js} +7 -7
  136. package/dist/{runtime-1hv06jsn.js → runtime-84g5egsc.js} +1 -1
  137. package/dist/{session-access-skm7bnp6.js → session-access-y6z1txk4.js} +4 -4
  138. package/dist/{session-source-backfill-pbqzbncv.js → session-source-backfill-gxxwfh12.js} +3 -3
  139. package/dist/{setup-5yermsem.js → setup-r91gstyk.js} +1 -1
  140. package/dist/{virtual-modules-gazyapte.js → virtual-modules-cgnj6kme.js} +3 -3
  141. package/dist/{work-objects-xj0ck0w4.js → work-objects-qcxzg61c.js} +20 -20
  142. package/dist/worker-7j2907g6.js +69 -0
  143. package/dist/{worker-follow-up-911xc0b8.js → worker-follow-up-y2d2h7km.js} +17 -17
  144. package/dist/{x-2fyrt5pp.js → x-qhxq2ama.js} +2 -2
  145. package/openapi.json +1214 -108
  146. package/package.json +3 -3
  147. package/src/be/db/tasks/read.ts +33 -0
  148. package/src/be/db.ts +32 -7
  149. package/src/be/migrations/289_automation_savings_daily.sql +47 -0
  150. package/src/be/migrations/291_task_slack_participants.sql +4 -0
  151. package/src/be/migrations/293_savings_component_links.sql +58 -0
  152. package/src/be/migrations/296_automation_savings_daily_read_index.sql +6 -0
  153. package/src/be/model-profile-check.ts +10 -2
  154. package/src/be/savings/compute.ts +511 -16
  155. package/src/be/savings/model.ts +282 -14
  156. package/src/be/savings/read.ts +1500 -0
  157. package/src/be/savings/rollup.ts +571 -0
  158. package/src/be/scripts/run-credential.ts +15 -3
  159. package/src/be/scripts/typecheck.ts +86 -4
  160. package/src/be/seed-scripts/catalog/dreaming-learnings.ts +10 -2
  161. package/src/be/seed-scripts/catalog/dreaming-memtax-create.ts +70 -4
  162. package/src/be/swarm-config-guard.ts +8 -0
  163. package/src/be/users.ts +29 -2
  164. package/src/commands/runner.ts +159 -41
  165. package/src/extensions/contract-types.generated.ts +1 -1
  166. package/src/http/index.ts +8 -1
  167. package/src/http/poll.ts +14 -1
  168. package/src/http/requested-by.ts +97 -1
  169. package/src/http/savings.ts +676 -190
  170. package/src/http/scripts.ts +26 -15
  171. package/src/http/tasks.ts +43 -5
  172. package/src/prompts/session-templates.ts +80 -3
  173. package/src/providers/acp-targets.ts +1 -1
  174. package/src/providers/amp-adapter.ts +1 -1
  175. package/src/providers/claude-adapter.ts +0 -20
  176. package/src/providers/claude-flag-settings.ts +12 -10
  177. package/src/providers/codex-adapter.ts +9 -34
  178. package/src/providers/opencode-adapter.ts +34 -12
  179. package/src/scheduler/scheduler.ts +20 -14
  180. package/src/scripts-runtime/ctx.ts +1 -1
  181. package/src/scripts-runtime/executors/quickjs-bundle.ts +1 -0
  182. package/src/scripts-runtime/executors/quickjs-prelude.ts +162 -2
  183. package/src/scripts-runtime/executors/quickjs-runner.ts +4 -1
  184. package/src/scripts-runtime/stdlib/fetch.ts +113 -15
  185. package/src/scripts-runtime/stdlib/index.ts +3 -1
  186. package/src/scripts-runtime/stdlib/retry.ts +174 -0
  187. package/src/scripts-runtime/swarm-sdk.ts +186 -17
  188. package/src/scripts-runtime/types/stdlib.d.ts +86 -4
  189. package/src/scripts-runtime/types/swarm-extension.d.ts +26 -0
  190. package/src/scripts-runtime/types/swarm-sdk.d.ts +60 -2
  191. package/src/slack/actions.ts +1 -0
  192. package/src/slack/assistant.ts +2 -0
  193. package/src/slack/enrich.ts +144 -50
  194. package/src/slack/handlers.ts +37 -95
  195. package/src/slack/templates.ts +9 -0
  196. package/src/slack/thread-buffer.ts +45 -71
  197. package/src/slack/thread-participants.ts +187 -0
  198. package/src/tests/base-prompt.test.ts +5 -4
  199. package/src/tests/claude-adapter-binary.test.ts +7 -1
  200. package/src/tests/claude-adapter.test.ts +10 -64
  201. package/src/tests/claude-flag-settings.test.ts +15 -11
  202. package/src/tests/claude-hook-credentials.test.ts +0 -1
  203. package/src/tests/claude-sdk-lifecycle.test.ts +5 -1
  204. package/src/tests/codex-adapter.test.ts +17 -78
  205. package/src/tests/create-task-vcs-repo.test.ts +136 -0
  206. package/src/tests/db-task-read-contract.test.ts +2 -0
  207. package/src/tests/db-task-write-contract.test.ts +1 -0
  208. package/src/tests/docs-index-footprint.test.js +3 -3
  209. package/src/tests/dreaming-learnings.test.ts +104 -0
  210. package/src/tests/extensions-pre-task.test.ts +4 -2
  211. package/src/tests/fetch-resolved-env.test.ts +47 -1
  212. package/src/tests/opencode-adapter.test.ts +53 -6
  213. package/src/tests/prompt-template-session.test.ts +17 -1
  214. package/src/tests/runner-requester-profile.test.ts +139 -1
  215. package/src/tests/savings-compound.test.ts +774 -0
  216. package/src/tests/savings-compute.test.ts +7 -198
  217. package/src/tests/savings-fleet-latency.test.ts +143 -0
  218. package/src/tests/savings-fleet-read.test.ts +195 -0
  219. package/src/tests/savings-fleet-scale.test.ts +222 -0
  220. package/src/tests/savings-model.test.ts +212 -0
  221. package/src/tests/savings-read.test.ts +367 -0
  222. package/src/tests/savings-rollup.test.ts +766 -0
  223. package/src/tests/savings-scripts.test.ts +611 -0
  224. package/src/tests/script-connections.test.ts +2 -0
  225. package/src/tests/script-executor-conformance.test.ts +444 -0
  226. package/src/tests/scripts-http.test.ts +55 -0
  227. package/src/tests/scripts-runtime-fetch.test.ts +2 -2
  228. package/src/tests/secret-rules.test.ts +124 -1
  229. package/src/tests/secret-scrubber.test.ts +1 -1
  230. package/src/tests/slack-dm-implicit-mention.test.ts +20 -1
  231. package/src/tests/slack-identity-resolution.test.ts +23 -0
  232. package/src/tests/slack-inbound-files.test.ts +2 -1
  233. package/src/tests/slack-thread-participants.test.ts +429 -0
  234. package/src/tests/tool-annotations.test.ts +30 -0
  235. package/src/types.ts +31 -0
  236. package/src/utils/mcp-server-fetcher.test.ts +89 -0
  237. package/src/utils/mcp-server-fetcher.ts +13 -5
  238. package/src/utils/request-auth-context.ts +24 -0
  239. package/src/utils/secret-rules.generated.ts +1 -1
  240. package/src/utils/secret-scrubber.ts +154 -29
  241. package/src/workflows/executors/swarm-script.ts +23 -19
  242. package/templates/skills/swarm-scripts/SKILL.md +5 -4
  243. package/templates/skills/swarm-scripts/content.md +5 -4
  244. package/templates/skills/work-on-task/SKILL.md +1 -1
  245. package/templates/skills/work-on-task/content.md +1 -1
  246. package/templates/workflows/dreaming/content.md +1 -1
  247. package/dist/acp-adapter-fqzkxyra.js +0 -15
  248. package/dist/cli-4bd1rck6.js +0 -4
  249. package/dist/cli-xf3qw745.js +0 -104
  250. package/dist/fx-adapter-rpsgb1tw.js +0 -18
  251. package/dist/grok-adapter-n2m3zjg1.js +0 -18
  252. package/dist/handlers-nv8edn19.js +0 -32
  253. package/dist/index-ksmyd6kc.js +0 -37
  254. package/dist/index-rjnrje98.js +0 -32
  255. package/dist/index-tv3413wy.js +0 -33
  256. package/dist/lead-3hmddvrm.js +0 -70
  257. package/dist/worker-qgg0m2gw.js +0 -70
  258. package/src/providers/ctx-mode-env.ts +0 -10
package/openapi.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "openapi": "3.1.0",
3
3
  "info": {
4
4
  "title": "Agent Swarm API",
5
- "version": "2.8.2",
5
+ "version": "2.8.3",
6
6
  "description": "Multi-agent orchestration API for Claude Code, Codex, and Gemini CLI. Enables task distribution, agent communication, and service discovery.\n\nMCP tools are documented separately in [MCP.md](./MCP.md)."
7
7
  },
8
8
  "servers": [
@@ -279,6 +279,54 @@
279
279
  "slackUserId": {
280
280
  "type": "string"
281
281
  },
282
+ "slackParticipants": {
283
+ "type": "object",
284
+ "properties": {
285
+ "people": {
286
+ "type": "array",
287
+ "items": {
288
+ "type": "object",
289
+ "properties": {
290
+ "slackUserId": {
291
+ "type": "string"
292
+ },
293
+ "userId": {
294
+ "type": "string"
295
+ },
296
+ "trust": {
297
+ "type": "string",
298
+ "enum": [
299
+ "internal",
300
+ "external",
301
+ "unknown"
302
+ ]
303
+ },
304
+ "starter": {
305
+ "type": "boolean"
306
+ },
307
+ "newest": {
308
+ "type": "boolean"
309
+ },
310
+ "asked": {
311
+ "type": "boolean"
312
+ }
313
+ },
314
+ "required": [
315
+ "slackUserId",
316
+ "trust"
317
+ ]
318
+ }
319
+ },
320
+ "more": {
321
+ "type": "integer",
322
+ "minimum": 0
323
+ }
324
+ },
325
+ "required": [
326
+ "people",
327
+ "more"
328
+ ]
329
+ },
282
330
  "slackReplySent": {
283
331
  "type": "boolean",
284
332
  "default": false
@@ -35079,6 +35127,11 @@
35079
35127
  "dir": {
35080
35128
  "type": "string"
35081
35129
  },
35130
+ "vcsRepo": {
35131
+ "type": "string",
35132
+ "minLength": 1,
35133
+ "description": "A registered repo (`swarm_repos`), as `owner/repo` or its URL. The worker clones or refreshes it and loads its `CLAUDE.md`. Stored as the registered repo's URL; an unregistered or ambiguous repo is a 400."
35134
+ },
35082
35135
  "parentTaskId": {
35083
35136
  "type": "string"
35084
35137
  },
@@ -35173,7 +35226,7 @@
35173
35226
  }
35174
35227
  },
35175
35228
  "400": {
35176
- "description": "Validation error, an unknown `model` (set `allowCustomModel` to store a custom id), or agentId/offeredTo targets an extension identity",
35229
+ "description": "Validation error, an unknown `model` (set `allowCustomModel` to store a custom id), a `vcsRepo` that is not exactly one registered repo, or agentId/offeredTo targets an extension identity",
35177
35230
  "content": {
35178
35231
  "application/json": {
35179
35232
  "schema": {
@@ -36869,6 +36922,87 @@
36869
36922
  "name"
36870
36923
  ]
36871
36924
  },
36925
+ "threadParticipants": {
36926
+ "type": "object",
36927
+ "properties": {
36928
+ "total": {
36929
+ "type": "integer"
36930
+ },
36931
+ "more": {
36932
+ "type": "integer"
36933
+ },
36934
+ "people": {
36935
+ "type": "array",
36936
+ "items": {
36937
+ "type": "object",
36938
+ "properties": {
36939
+ "label": {
36940
+ "type": "string"
36941
+ },
36942
+ "trust": {
36943
+ "type": "string",
36944
+ "enum": [
36945
+ "internal",
36946
+ "external",
36947
+ "unknown"
36948
+ ]
36949
+ },
36950
+ "starter": {
36951
+ "type": "boolean"
36952
+ },
36953
+ "newest": {
36954
+ "type": "boolean"
36955
+ },
36956
+ "asked": {
36957
+ "type": "boolean"
36958
+ },
36959
+ "language": {
36960
+ "type": "string"
36961
+ },
36962
+ "verbosity": {
36963
+ "type": "string"
36964
+ }
36965
+ },
36966
+ "required": [
36967
+ "label",
36968
+ "trust"
36969
+ ]
36970
+ }
36971
+ },
36972
+ "starterProfile": {
36973
+ "type": "object",
36974
+ "properties": {
36975
+ "id": {
36976
+ "type": "string"
36977
+ },
36978
+ "name": {
36979
+ "type": "string",
36980
+ "minLength": 1
36981
+ },
36982
+ "email": {
36983
+ "type": "string"
36984
+ },
36985
+ "role": {
36986
+ "type": "string"
36987
+ },
36988
+ "notes": {
36989
+ "type": "string"
36990
+ },
36991
+ "comms": {
36992
+ "$ref": "#/components/schemas/UserCommsPrefs"
36993
+ }
36994
+ },
36995
+ "required": [
36996
+ "name"
36997
+ ]
36998
+ }
36999
+ },
37000
+ "required": [
37001
+ "total",
37002
+ "more",
37003
+ "people"
37004
+ ]
37005
+ },
36872
37006
  "credentialAllowlist": {
36873
37007
  "type": "object",
36874
37008
  "additionalProperties": {
@@ -39663,6 +39797,87 @@
39663
39797
  "required": [
39664
39798
  "name"
39665
39799
  ]
39800
+ },
39801
+ "threadParticipants": {
39802
+ "type": "object",
39803
+ "properties": {
39804
+ "total": {
39805
+ "type": "integer"
39806
+ },
39807
+ "more": {
39808
+ "type": "integer"
39809
+ },
39810
+ "people": {
39811
+ "type": "array",
39812
+ "items": {
39813
+ "type": "object",
39814
+ "properties": {
39815
+ "label": {
39816
+ "type": "string"
39817
+ },
39818
+ "trust": {
39819
+ "type": "string",
39820
+ "enum": [
39821
+ "internal",
39822
+ "external",
39823
+ "unknown"
39824
+ ]
39825
+ },
39826
+ "starter": {
39827
+ "type": "boolean"
39828
+ },
39829
+ "newest": {
39830
+ "type": "boolean"
39831
+ },
39832
+ "asked": {
39833
+ "type": "boolean"
39834
+ },
39835
+ "language": {
39836
+ "type": "string"
39837
+ },
39838
+ "verbosity": {
39839
+ "type": "string"
39840
+ }
39841
+ },
39842
+ "required": [
39843
+ "label",
39844
+ "trust"
39845
+ ]
39846
+ }
39847
+ },
39848
+ "starterProfile": {
39849
+ "type": "object",
39850
+ "properties": {
39851
+ "id": {
39852
+ "type": "string"
39853
+ },
39854
+ "name": {
39855
+ "type": "string",
39856
+ "minLength": 1
39857
+ },
39858
+ "email": {
39859
+ "type": "string"
39860
+ },
39861
+ "role": {
39862
+ "type": "string"
39863
+ },
39864
+ "notes": {
39865
+ "type": "string"
39866
+ },
39867
+ "comms": {
39868
+ "$ref": "#/components/schemas/UserCommsPrefs"
39869
+ }
39870
+ },
39871
+ "required": [
39872
+ "name"
39873
+ ]
39874
+ }
39875
+ },
39876
+ "required": [
39877
+ "total",
39878
+ "more",
39879
+ "people"
39880
+ ]
39666
39881
  }
39667
39882
  },
39668
39883
  "required": [
@@ -39765,6 +39980,87 @@
39765
39980
  "required": [
39766
39981
  "name"
39767
39982
  ]
39983
+ },
39984
+ "threadParticipants": {
39985
+ "type": "object",
39986
+ "properties": {
39987
+ "total": {
39988
+ "type": "integer"
39989
+ },
39990
+ "more": {
39991
+ "type": "integer"
39992
+ },
39993
+ "people": {
39994
+ "type": "array",
39995
+ "items": {
39996
+ "type": "object",
39997
+ "properties": {
39998
+ "label": {
39999
+ "type": "string"
40000
+ },
40001
+ "trust": {
40002
+ "type": "string",
40003
+ "enum": [
40004
+ "internal",
40005
+ "external",
40006
+ "unknown"
40007
+ ]
40008
+ },
40009
+ "starter": {
40010
+ "type": "boolean"
40011
+ },
40012
+ "newest": {
40013
+ "type": "boolean"
40014
+ },
40015
+ "asked": {
40016
+ "type": "boolean"
40017
+ },
40018
+ "language": {
40019
+ "type": "string"
40020
+ },
40021
+ "verbosity": {
40022
+ "type": "string"
40023
+ }
40024
+ },
40025
+ "required": [
40026
+ "label",
40027
+ "trust"
40028
+ ]
40029
+ }
40030
+ },
40031
+ "starterProfile": {
40032
+ "type": "object",
40033
+ "properties": {
40034
+ "id": {
40035
+ "type": "string"
40036
+ },
40037
+ "name": {
40038
+ "type": "string",
40039
+ "minLength": 1
40040
+ },
40041
+ "email": {
40042
+ "type": "string"
40043
+ },
40044
+ "role": {
40045
+ "type": "string"
40046
+ },
40047
+ "notes": {
40048
+ "type": "string"
40049
+ },
40050
+ "comms": {
40051
+ "$ref": "#/components/schemas/UserCommsPrefs"
40052
+ }
40053
+ },
40054
+ "required": [
40055
+ "name"
40056
+ ]
40057
+ }
40058
+ },
40059
+ "required": [
40060
+ "total",
40061
+ "more",
40062
+ "people"
40063
+ ]
39768
40064
  }
39769
40065
  },
39770
40066
  "required": [
@@ -51430,8 +51726,8 @@
51430
51726
  },
51431
51727
  "/api/savings/jobs": {
51432
51728
  "get": {
51433
- "summary": "Estimated automation savings for a workflow",
51434
- "description": "What the workflow's runs in the window would have cost as agent tasks, minus what they cost. `measuredUsd` is the measured spend and `estimatedLlmUsd` the LLM spend estimated where none was recorded; `actualUsd` is their sum scaled to the substituted share of runs, the estimate the saving subtracts. Modelled at the chosen tier, with an 80% range (p10 to p90). `valid` is false when the workflow had no runs, or more runs than the live computation handles.",
51729
+ "summary": "Estimated automation savings per workflow or script",
51730
+ "description": "What the workflows' or scripts' runs in the window would have cost as agent tasks, minus what they cost, read from the hourly savings rollup. With `workflowId` and `components=true`, also returns the workflow's components (child workflow runs, nested script runs and tasks its runs caused, recursively) priced as on their own rows, and `withComponents`, own runs plus those; lists and schedule reads reject `components=true`. `measuredUsd` is the measured spend and `estimatedLlmUsd` the LLM spend estimated where none was recorded; `actualUsd` is their sum scaled to the substituted share of runs, the estimate the saving subtracts. Modelled at the chosen tier, with an 80% range (p10 to p90). Pass `workflowId` for one workflow, `scriptName` for one script, or `kind=workflow` / `kind=script` for every workflow or script with runs. Scheduled scripts are priced as standalone agent tasks; other scripts as the extra turns they add to the calling agent's session. Scripts record no LLM spend, so their spend fields are 0. Pass `scheduleId` for one schedule, or `kind=schedule` for every schedule: a workflow or script target returns the target's row (`scope: target-job`, with `scheduleId`), because runs carry no schedule link, so schedules of one target show the same row, and `total` is null for schedule reads; an agent-task target returns a measured row (`basis` measured) with the recorded cost of its tasks and `savingUsd: null`. A disabled schedule is priced from its target's runs and flagged by `scheduleEnabled`. `valid` is false until the rollup has computed every day of the window, and when there were no runs.",
51435
51731
  "tags": [
51436
51732
  "Savings"
51437
51733
  ],
@@ -51446,10 +51742,54 @@
51446
51742
  "type": "string",
51447
51743
  "minLength": 1
51448
51744
  },
51449
- "required": true,
51745
+ "required": false,
51450
51746
  "name": "workflowId",
51451
51747
  "in": "query"
51452
51748
  },
51749
+ {
51750
+ "schema": {
51751
+ "type": "string",
51752
+ "minLength": 1
51753
+ },
51754
+ "required": false,
51755
+ "name": "scriptName",
51756
+ "in": "query"
51757
+ },
51758
+ {
51759
+ "schema": {
51760
+ "type": "string",
51761
+ "minLength": 1
51762
+ },
51763
+ "required": false,
51764
+ "name": "scheduleId",
51765
+ "in": "query"
51766
+ },
51767
+ {
51768
+ "schema": {
51769
+ "type": "string",
51770
+ "enum": [
51771
+ "workflow",
51772
+ "script",
51773
+ "schedule"
51774
+ ]
51775
+ },
51776
+ "required": false,
51777
+ "name": "kind",
51778
+ "in": "query"
51779
+ },
51780
+ {
51781
+ "schema": {
51782
+ "type": "string",
51783
+ "enum": [
51784
+ "true",
51785
+ "false"
51786
+ ],
51787
+ "default": "false"
51788
+ },
51789
+ "required": false,
51790
+ "name": "components",
51791
+ "in": "query"
51792
+ },
51453
51793
  {
51454
51794
  "schema": {
51455
51795
  "type": "string",
@@ -51482,7 +51822,7 @@
51482
51822
  ],
51483
51823
  "responses": {
51484
51824
  "200": {
51485
- "description": "Savings rows for the workflow",
51825
+ "description": "Savings rows",
51486
51826
  "content": {
51487
51827
  "application/json": {
51488
51828
  "schema": {
@@ -51530,7 +51870,10 @@
51530
51870
  ]
51531
51871
  },
51532
51872
  "computedAt": {
51533
- "type": "string"
51873
+ "type": [
51874
+ "string",
51875
+ "null"
51876
+ ]
51534
51877
  },
51535
51878
  "valid": {
51536
51879
  "type": "boolean"
@@ -51541,12 +51884,357 @@
51541
51884
  "null"
51542
51885
  ],
51543
51886
  "enum": [
51887
+ "not-computed",
51544
51888
  "no-runs",
51545
- "too-many-runs",
51889
+ "target-missing",
51546
51890
  null
51547
51891
  ]
51548
51892
  },
51893
+ "boundaryEstimated": {
51894
+ "type": "boolean",
51895
+ "description": "The window is rolling, so its first UTC day is partial and its runs are scanned live. True when that scan could not run (too many runs, or a busy database) and the day's bucket was scaled to the part inside the window instead."
51896
+ },
51549
51897
  "rows": {
51898
+ "type": "array",
51899
+ "items": {
51900
+ "anyOf": [
51901
+ {
51902
+ "type": "object",
51903
+ "properties": {
51904
+ "kind": {
51905
+ "type": "string",
51906
+ "enum": [
51907
+ "workflow",
51908
+ "script-scheduled",
51909
+ "script-agent-invoked"
51910
+ ]
51911
+ },
51912
+ "workflowId": {
51913
+ "type": "string"
51914
+ },
51915
+ "scriptName": {
51916
+ "type": "string"
51917
+ },
51918
+ "name": {
51919
+ "type": "string"
51920
+ },
51921
+ "basis": {
51922
+ "type": "string",
51923
+ "enum": [
51924
+ "modelled"
51925
+ ]
51926
+ },
51927
+ "scheduleId": {
51928
+ "type": "string"
51929
+ },
51930
+ "scheduleName": {
51931
+ "type": "string"
51932
+ },
51933
+ "scheduleEnabled": {
51934
+ "type": "boolean"
51935
+ },
51936
+ "scope": {
51937
+ "type": "string",
51938
+ "enum": [
51939
+ "target-job"
51940
+ ]
51941
+ },
51942
+ "enabledOnlyRule": {
51943
+ "type": "boolean"
51944
+ },
51945
+ "runs": {
51946
+ "type": "integer"
51947
+ },
51948
+ "substitutedRuns": {
51949
+ "type": "integer"
51950
+ },
51951
+ "effectRuns": {
51952
+ "type": "integer"
51953
+ },
51954
+ "enabledOnlyRuns": {
51955
+ "type": "integer"
51956
+ },
51957
+ "capApplied": {
51958
+ "type": "boolean"
51959
+ },
51960
+ "opsPerRun": {
51961
+ "type": "number"
51962
+ },
51963
+ "measuredUsd": {
51964
+ "type": "number",
51965
+ "description": "Measured spend of every run in the window: agent tasks, their reviews, recorded LLM cost."
51966
+ },
51967
+ "estimatedLlmUsd": {
51968
+ "type": "number",
51969
+ "description": "LLM spend estimated from tokens and output size, not measured. 0 when the runs recorded their LLM cost."
51970
+ },
51971
+ "actualUsd": {
51972
+ "type": "number",
51973
+ "description": "Scaled estimate, not a measurement: `measuredUsd + estimatedLlmUsd` times `substitutedRuns / runs`. The saving subtracts this."
51974
+ },
51975
+ "agentOnlyUsd": {
51976
+ "type": "object",
51977
+ "properties": {
51978
+ "p10": {
51979
+ "type": "number"
51980
+ },
51981
+ "p50": {
51982
+ "type": "number"
51983
+ },
51984
+ "p90": {
51985
+ "type": "number"
51986
+ }
51987
+ },
51988
+ "required": [
51989
+ "p10",
51990
+ "p50",
51991
+ "p90"
51992
+ ]
51993
+ },
51994
+ "savingUsd": {
51995
+ "type": "object",
51996
+ "properties": {
51997
+ "p10": {
51998
+ "type": "number"
51999
+ },
52000
+ "p50": {
52001
+ "type": "number"
52002
+ },
52003
+ "p90": {
52004
+ "type": "number"
52005
+ }
52006
+ },
52007
+ "required": [
52008
+ "p10",
52009
+ "p50",
52010
+ "p90"
52011
+ ]
52012
+ },
52013
+ "actualHours": {
52014
+ "type": "number",
52015
+ "description": "Scaled estimate: measured hours times `substitutedRuns / runs`. Always 0 for scripts, which keep no agent active."
52016
+ },
52017
+ "agentOnlyHours": {
52018
+ "type": "object",
52019
+ "properties": {
52020
+ "p10": {
52021
+ "type": "number"
52022
+ },
52023
+ "p50": {
52024
+ "type": "number"
52025
+ },
52026
+ "p90": {
52027
+ "type": "number"
52028
+ }
52029
+ },
52030
+ "required": [
52031
+ "p10",
52032
+ "p50",
52033
+ "p90"
52034
+ ]
52035
+ },
52036
+ "hoursSaved": {
52037
+ "type": "object",
52038
+ "properties": {
52039
+ "p10": {
52040
+ "type": "number"
52041
+ },
52042
+ "p50": {
52043
+ "type": "number"
52044
+ },
52045
+ "p90": {
52046
+ "type": "number"
52047
+ }
52048
+ },
52049
+ "required": [
52050
+ "p10",
52051
+ "p50",
52052
+ "p90"
52053
+ ]
52054
+ },
52055
+ "agentOnlyUsdPerRun": {
52056
+ "type": "number"
52057
+ }
52058
+ },
52059
+ "required": [
52060
+ "kind",
52061
+ "name",
52062
+ "basis",
52063
+ "enabledOnlyRule",
52064
+ "runs",
52065
+ "substitutedRuns",
52066
+ "effectRuns",
52067
+ "enabledOnlyRuns",
52068
+ "capApplied",
52069
+ "opsPerRun",
52070
+ "measuredUsd",
52071
+ "estimatedLlmUsd",
52072
+ "actualUsd",
52073
+ "agentOnlyUsd",
52074
+ "savingUsd",
52075
+ "actualHours",
52076
+ "agentOnlyHours",
52077
+ "hoursSaved",
52078
+ "agentOnlyUsdPerRun"
52079
+ ]
52080
+ },
52081
+ {
52082
+ "type": "object",
52083
+ "properties": {
52084
+ "kind": {
52085
+ "type": "string",
52086
+ "enum": [
52087
+ "agent-task-schedule"
52088
+ ]
52089
+ },
52090
+ "scheduleId": {
52091
+ "type": "string"
52092
+ },
52093
+ "scheduleName": {
52094
+ "type": "string"
52095
+ },
52096
+ "scheduleEnabled": {
52097
+ "type": "boolean"
52098
+ },
52099
+ "name": {
52100
+ "type": "string"
52101
+ },
52102
+ "basis": {
52103
+ "type": "string",
52104
+ "enum": [
52105
+ "measured"
52106
+ ]
52107
+ },
52108
+ "runs": {
52109
+ "type": "integer",
52110
+ "description": "Agent tasks the schedule created in the window."
52111
+ },
52112
+ "actualUsd": {
52113
+ "type": "number",
52114
+ "description": "Recorded cost of those tasks. A floor: review tasks and follow-ups are not linked to the schedule."
52115
+ },
52116
+ "actualHours": {
52117
+ "type": "number"
52118
+ },
52119
+ "savingUsd": {
52120
+ "type": "null"
52121
+ }
52122
+ },
52123
+ "required": [
52124
+ "kind",
52125
+ "scheduleId",
52126
+ "scheduleName",
52127
+ "scheduleEnabled",
52128
+ "name",
52129
+ "basis",
52130
+ "runs",
52131
+ "actualUsd",
52132
+ "actualHours",
52133
+ "savingUsd"
52134
+ ]
52135
+ }
52136
+ ]
52137
+ }
52138
+ },
52139
+ "total": {
52140
+ "type": [
52141
+ "object",
52142
+ "null"
52143
+ ],
52144
+ "properties": {
52145
+ "runs": {
52146
+ "type": "integer"
52147
+ },
52148
+ "substitutedRuns": {
52149
+ "type": "integer"
52150
+ },
52151
+ "enabledOnlyRuns": {
52152
+ "type": "integer"
52153
+ },
52154
+ "measuredUsd": {
52155
+ "type": "number"
52156
+ },
52157
+ "estimatedLlmUsd": {
52158
+ "type": "number"
52159
+ },
52160
+ "actualUsd": {
52161
+ "type": "number"
52162
+ },
52163
+ "agentOnlyUsd": {
52164
+ "type": "object",
52165
+ "properties": {
52166
+ "p10": {
52167
+ "type": "number"
52168
+ },
52169
+ "p50": {
52170
+ "type": "number"
52171
+ },
52172
+ "p90": {
52173
+ "type": "number"
52174
+ }
52175
+ },
52176
+ "required": [
52177
+ "p10",
52178
+ "p50",
52179
+ "p90"
52180
+ ]
52181
+ },
52182
+ "savingUsd": {
52183
+ "type": "object",
52184
+ "properties": {
52185
+ "p10": {
52186
+ "type": "number"
52187
+ },
52188
+ "p50": {
52189
+ "type": "number"
52190
+ },
52191
+ "p90": {
52192
+ "type": "number"
52193
+ }
52194
+ },
52195
+ "required": [
52196
+ "p10",
52197
+ "p50",
52198
+ "p90"
52199
+ ]
52200
+ },
52201
+ "actualHours": {
52202
+ "type": "number"
52203
+ },
52204
+ "hoursSaved": {
52205
+ "type": "object",
52206
+ "properties": {
52207
+ "p10": {
52208
+ "type": "number"
52209
+ },
52210
+ "p50": {
52211
+ "type": "number"
52212
+ },
52213
+ "p90": {
52214
+ "type": "number"
52215
+ }
52216
+ },
52217
+ "required": [
52218
+ "p10",
52219
+ "p50",
52220
+ "p90"
52221
+ ]
52222
+ }
52223
+ },
52224
+ "required": [
52225
+ "runs",
52226
+ "substitutedRuns",
52227
+ "enabledOnlyRuns",
52228
+ "measuredUsd",
52229
+ "estimatedLlmUsd",
52230
+ "actualUsd",
52231
+ "agentOnlyUsd",
52232
+ "savingUsd",
52233
+ "actualHours",
52234
+ "hoursSaved"
52235
+ ]
52236
+ },
52237
+ "components": {
51550
52238
  "type": "array",
51551
52239
  "items": {
51552
52240
  "type": "object",
@@ -51554,50 +52242,39 @@
51554
52242
  "kind": {
51555
52243
  "type": "string",
51556
52244
  "enum": [
51557
- "workflow"
52245
+ "workflow",
52246
+ "script",
52247
+ "task"
51558
52248
  ]
51559
52249
  },
51560
52250
  "workflowId": {
51561
52251
  "type": "string"
51562
52252
  },
52253
+ "scriptName": {
52254
+ "type": "string"
52255
+ },
51563
52256
  "name": {
51564
52257
  "type": "string"
51565
52258
  },
51566
- "basis": {
52259
+ "linkKind": {
51567
52260
  "type": "string",
51568
52261
  "enum": [
51569
- "modelled"
52262
+ "sub-workflow",
52263
+ "step-workflow",
52264
+ "step-script",
52265
+ "step-task",
52266
+ "descendant-task"
51570
52267
  ]
51571
52268
  },
51572
- "runs": {
51573
- "type": "integer"
51574
- },
51575
- "substitutedRuns": {
51576
- "type": "integer"
51577
- },
51578
- "effectRuns": {
52269
+ "depth": {
51579
52270
  "type": "integer"
51580
52271
  },
51581
- "enabledOnlyRuns": {
51582
- "type": "integer"
51583
- },
51584
- "capApplied": {
51585
- "type": "boolean"
51586
- },
51587
- "opsPerRun": {
51588
- "type": "number"
51589
- },
51590
- "measuredUsd": {
51591
- "type": "number",
51592
- "description": "Measured spend of every run in the window: agent tasks, their reviews, recorded LLM cost."
51593
- },
51594
- "estimatedLlmUsd": {
52272
+ "runs": {
51595
52273
  "type": "number",
51596
- "description": "LLM spend estimated from tokens and output size, not measured. 0 when the runs recorded their LLM cost."
52274
+ "description": "Runs (tasks for a task component) in this tree. Fractional below the first level."
51597
52275
  },
51598
52276
  "actualUsd": {
51599
- "type": "number",
51600
- "description": "Scaled estimate, not a measurement: `measuredUsd + estimatedLlmUsd` times `substitutedRuns / runs`. The saving subtracts this."
52277
+ "type": "number"
51601
52278
  },
51602
52279
  "agentOnlyUsd": {
51603
52280
  "type": "object",
@@ -51637,29 +52314,6 @@
51637
52314
  "p90"
51638
52315
  ]
51639
52316
  },
51640
- "actualHours": {
51641
- "type": "number",
51642
- "description": "Scaled estimate: measured hours times `substitutedRuns / runs`."
51643
- },
51644
- "agentOnlyHours": {
51645
- "type": "object",
51646
- "properties": {
51647
- "p10": {
51648
- "type": "number"
51649
- },
51650
- "p50": {
51651
- "type": "number"
51652
- },
51653
- "p90": {
51654
- "type": "number"
51655
- }
51656
- },
51657
- "required": [
51658
- "p10",
51659
- "p50",
51660
- "p90"
51661
- ]
51662
- },
51663
52317
  "hoursSaved": {
51664
52318
  "type": "object",
51665
52319
  "properties": {
@@ -51679,32 +52333,122 @@
51679
52333
  "p90"
51680
52334
  ]
51681
52335
  },
51682
- "agentOnlyUsdPerRun": {
51683
- "type": "number"
52336
+ "inOwnRow": {
52337
+ "type": "boolean",
52338
+ "description": "True for unowned tasks: their spend is already in the workflow's own row, on both sides, and adds nothing to `withComponents`."
51684
52339
  }
51685
52340
  },
51686
52341
  "required": [
51687
52342
  "kind",
51688
- "workflowId",
51689
52343
  "name",
51690
- "basis",
52344
+ "linkKind",
52345
+ "depth",
51691
52346
  "runs",
51692
- "substitutedRuns",
51693
- "effectRuns",
51694
- "enabledOnlyRuns",
51695
- "capApplied",
51696
- "opsPerRun",
51697
- "measuredUsd",
51698
- "estimatedLlmUsd",
51699
52347
  "actualUsd",
51700
52348
  "agentOnlyUsd",
51701
52349
  "savingUsd",
51702
- "actualHours",
51703
- "agentOnlyHours",
51704
52350
  "hoursSaved",
51705
- "agentOnlyUsdPerRun"
52351
+ "inOwnRow"
51706
52352
  ]
51707
52353
  }
52354
+ },
52355
+ "withComponents": {
52356
+ "type": [
52357
+ "object",
52358
+ "null"
52359
+ ],
52360
+ "properties": {
52361
+ "runs": {
52362
+ "type": "integer"
52363
+ },
52364
+ "substitutedRuns": {
52365
+ "type": "integer"
52366
+ },
52367
+ "enabledOnlyRuns": {
52368
+ "type": "integer"
52369
+ },
52370
+ "measuredUsd": {
52371
+ "type": "number"
52372
+ },
52373
+ "estimatedLlmUsd": {
52374
+ "type": "number"
52375
+ },
52376
+ "actualUsd": {
52377
+ "type": "number"
52378
+ },
52379
+ "agentOnlyUsd": {
52380
+ "type": "object",
52381
+ "properties": {
52382
+ "p10": {
52383
+ "type": "number"
52384
+ },
52385
+ "p50": {
52386
+ "type": "number"
52387
+ },
52388
+ "p90": {
52389
+ "type": "number"
52390
+ }
52391
+ },
52392
+ "required": [
52393
+ "p10",
52394
+ "p50",
52395
+ "p90"
52396
+ ]
52397
+ },
52398
+ "savingUsd": {
52399
+ "type": "object",
52400
+ "properties": {
52401
+ "p10": {
52402
+ "type": "number"
52403
+ },
52404
+ "p50": {
52405
+ "type": "number"
52406
+ },
52407
+ "p90": {
52408
+ "type": "number"
52409
+ }
52410
+ },
52411
+ "required": [
52412
+ "p10",
52413
+ "p50",
52414
+ "p90"
52415
+ ]
52416
+ },
52417
+ "actualHours": {
52418
+ "type": "number"
52419
+ },
52420
+ "hoursSaved": {
52421
+ "type": "object",
52422
+ "properties": {
52423
+ "p10": {
52424
+ "type": "number"
52425
+ },
52426
+ "p50": {
52427
+ "type": "number"
52428
+ },
52429
+ "p90": {
52430
+ "type": "number"
52431
+ }
52432
+ },
52433
+ "required": [
52434
+ "p10",
52435
+ "p50",
52436
+ "p90"
52437
+ ]
52438
+ }
52439
+ },
52440
+ "required": [
52441
+ "runs",
52442
+ "substitutedRuns",
52443
+ "enabledOnlyRuns",
52444
+ "measuredUsd",
52445
+ "estimatedLlmUsd",
52446
+ "actualUsd",
52447
+ "agentOnlyUsd",
52448
+ "savingUsd",
52449
+ "actualHours",
52450
+ "hoursSaved"
52451
+ ]
51708
52452
  }
51709
52453
  },
51710
52454
  "required": [
@@ -51716,14 +52460,16 @@
51716
52460
  "computedAt",
51717
52461
  "valid",
51718
52462
  "reason",
51719
- "rows"
52463
+ "boundaryEstimated",
52464
+ "rows",
52465
+ "total"
51720
52466
  ]
51721
52467
  }
51722
52468
  }
51723
52469
  }
51724
52470
  },
51725
52471
  "400": {
51726
- "description": "Missing workflowId, or an unknown days or tier value",
52472
+ "description": "Not exactly one of workflowId, scriptName, scheduleId and kind, `components=true` without workflowId, or an unknown days or tier value",
51727
52473
  "content": {
51728
52474
  "application/json": {
51729
52475
  "schema": {
@@ -51733,27 +52479,7 @@
51733
52479
  }
51734
52480
  },
51735
52481
  "404": {
51736
- "description": "Workflow not found",
51737
- "content": {
51738
- "application/json": {
51739
- "schema": {
51740
- "$ref": "#/components/schemas/ErrorResponse"
51741
- }
51742
- }
51743
- }
51744
- },
51745
- "408": {
51746
- "description": "A savings query ran past its time budget",
51747
- "content": {
51748
- "application/json": {
51749
- "schema": {
51750
- "$ref": "#/components/schemas/ErrorResponse"
51751
- }
51752
- }
51753
- }
51754
- },
51755
- "429": {
51756
- "description": "Too many concurrent database queries; retry shortly",
52482
+ "description": "Workflow, script or schedule not found",
51757
52483
  "content": {
51758
52484
  "application/json": {
51759
52485
  "schema": {
@@ -51767,8 +52493,8 @@
51767
52493
  },
51768
52494
  "/api/savings/daily": {
51769
52495
  "get": {
51770
- "summary": "Daily automation savings for a workflow",
51771
- "description": "The workflow's p50 saving, measured spend and scaled actual cost per UTC day of the window, from the same computation as `/api/savings/jobs`, so the points sum to its p50 saving, `measuredUsd`, `estimatedLlmUsd` and `actualUsd`. When the hourly cap applies, the counted schedule runs are spread pro rata over the days. `valid` is false when the workflow had no runs, or more runs than the live computation handles.",
52496
+ "summary": "Daily automation savings of a workflow, a script or the fleet",
52497
+ "description": "The p50 saving, measured spend, estimated LLM spend and scaled actual cost per UTC day of the window, from the hourly savings rollup. With `workflowId` or `scriptName` the points add up to the window figures of `GET /api/savings/jobs` for the same target; with neither they cover every workflow and script and add up to `GET /api/savings/summary`.",
51772
52498
  "tags": [
51773
52499
  "Savings"
51774
52500
  ],
@@ -51783,10 +52509,19 @@
51783
52509
  "type": "string",
51784
52510
  "minLength": 1
51785
52511
  },
51786
- "required": true,
52512
+ "required": false,
51787
52513
  "name": "workflowId",
51788
52514
  "in": "query"
51789
52515
  },
52516
+ {
52517
+ "schema": {
52518
+ "type": "string",
52519
+ "minLength": 1
52520
+ },
52521
+ "required": false,
52522
+ "name": "scriptName",
52523
+ "in": "query"
52524
+ },
51790
52525
  {
51791
52526
  "schema": {
51792
52527
  "type": "string",
@@ -51819,7 +52554,7 @@
51819
52554
  ],
51820
52555
  "responses": {
51821
52556
  "200": {
51822
- "description": "Daily savings points for the workflow",
52557
+ "description": "Daily savings points",
51823
52558
  "content": {
51824
52559
  "application/json": {
51825
52560
  "schema": {
@@ -51867,7 +52602,10 @@
51867
52602
  ]
51868
52603
  },
51869
52604
  "computedAt": {
51870
- "type": "string"
52605
+ "type": [
52606
+ "string",
52607
+ "null"
52608
+ ]
51871
52609
  },
51872
52610
  "valid": {
51873
52611
  "type": "boolean"
@@ -51878,11 +52616,16 @@
51878
52616
  "null"
51879
52617
  ],
51880
52618
  "enum": [
52619
+ "not-computed",
51881
52620
  "no-runs",
51882
- "too-many-runs",
52621
+ "target-missing",
51883
52622
  null
51884
52623
  ]
51885
52624
  },
52625
+ "boundaryEstimated": {
52626
+ "type": "boolean",
52627
+ "description": "The window is rolling, so its first UTC day is partial and its runs are scanned live. True when that scan could not run (too many runs, or a busy database) and the day's bucket was scaled to the part inside the window instead."
52628
+ },
51886
52629
  "points": {
51887
52630
  "type": "array",
51888
52631
  "items": {
@@ -51926,6 +52669,7 @@
51926
52669
  "computedAt",
51927
52670
  "valid",
51928
52671
  "reason",
52672
+ "boundaryEstimated",
51929
52673
  "points"
51930
52674
  ]
51931
52675
  }
@@ -51933,7 +52677,7 @@
51933
52677
  }
51934
52678
  },
51935
52679
  "400": {
51936
- "description": "Missing workflowId, or an unknown days or tier value",
52680
+ "description": "Both workflowId and scriptName, or an unknown days or tier value",
51937
52681
  "content": {
51938
52682
  "application/json": {
51939
52683
  "schema": {
@@ -51943,7 +52687,7 @@
51943
52687
  }
51944
52688
  },
51945
52689
  "404": {
51946
- "description": "Workflow not found",
52690
+ "description": "Workflow or script not found",
51947
52691
  "content": {
51948
52692
  "application/json": {
51949
52693
  "schema": {
@@ -51951,19 +52695,381 @@
51951
52695
  }
51952
52696
  }
51953
52697
  }
52698
+ }
52699
+ }
52700
+ }
52701
+ },
52702
+ "/api/savings/summary": {
52703
+ "get": {
52704
+ "summary": "Fleet automation savings",
52705
+ "description": "What every workflow and script run in the window would have cost as agent tasks, minus what they cost, from the hourly savings rollup at the chosen tier, with the fleet's 80% range. Adds the swarm's measured session spend over the same window, the self-optimization ratio, the runs left out and the model's assumptions. `valid` is false until the rollup has computed every day of the window, and when there were no runs.",
52706
+ "tags": [
52707
+ "Savings"
52708
+ ],
52709
+ "security": [
52710
+ {
52711
+ "bearerAuth": []
52712
+ }
52713
+ ],
52714
+ "parameters": [
52715
+ {
52716
+ "schema": {
52717
+ "type": "string",
52718
+ "enum": [
52719
+ "7",
52720
+ "30",
52721
+ "90"
52722
+ ],
52723
+ "default": "30"
52724
+ },
52725
+ "required": false,
52726
+ "name": "days",
52727
+ "in": "query"
51954
52728
  },
51955
- "408": {
51956
- "description": "A savings query ran past its time budget",
52729
+ {
52730
+ "schema": {
52731
+ "type": "string",
52732
+ "enum": [
52733
+ "smol",
52734
+ "regular",
52735
+ "smart",
52736
+ "ultra"
52737
+ ],
52738
+ "default": "smart"
52739
+ },
52740
+ "required": false,
52741
+ "name": "tier",
52742
+ "in": "query"
52743
+ }
52744
+ ],
52745
+ "responses": {
52746
+ "200": {
52747
+ "description": "Fleet savings",
51957
52748
  "content": {
51958
52749
  "application/json": {
51959
52750
  "schema": {
51960
- "$ref": "#/components/schemas/ErrorResponse"
52751
+ "type": "object",
52752
+ "properties": {
52753
+ "window": {
52754
+ "type": "object",
52755
+ "properties": {
52756
+ "start": {
52757
+ "type": "string"
52758
+ },
52759
+ "end": {
52760
+ "type": "string"
52761
+ },
52762
+ "days": {
52763
+ "type": "integer"
52764
+ }
52765
+ },
52766
+ "required": [
52767
+ "start",
52768
+ "end",
52769
+ "days"
52770
+ ]
52771
+ },
52772
+ "tier": {
52773
+ "type": "string",
52774
+ "enum": [
52775
+ "smol",
52776
+ "regular",
52777
+ "smart",
52778
+ "ultra"
52779
+ ]
52780
+ },
52781
+ "calibrationModel": {
52782
+ "type": "string"
52783
+ },
52784
+ "calibratedAt": {
52785
+ "type": "string"
52786
+ },
52787
+ "calibrationSource": {
52788
+ "type": "string",
52789
+ "enum": [
52790
+ "shipped",
52791
+ "deployment"
52792
+ ]
52793
+ },
52794
+ "computedAt": {
52795
+ "type": [
52796
+ "string",
52797
+ "null"
52798
+ ]
52799
+ },
52800
+ "valid": {
52801
+ "type": "boolean"
52802
+ },
52803
+ "reason": {
52804
+ "type": [
52805
+ "string",
52806
+ "null"
52807
+ ],
52808
+ "enum": [
52809
+ "not-computed",
52810
+ "no-runs",
52811
+ "target-missing",
52812
+ null
52813
+ ]
52814
+ },
52815
+ "boundaryEstimated": {
52816
+ "type": "boolean",
52817
+ "description": "The window is rolling, so its first UTC day is partial and its runs are scanned live. True when that scan could not run (too many runs, or a busy database) and the day's bucket was scaled to the part inside the window instead."
52818
+ },
52819
+ "total": {
52820
+ "type": [
52821
+ "object",
52822
+ "null"
52823
+ ],
52824
+ "properties": {
52825
+ "runs": {
52826
+ "type": "integer"
52827
+ },
52828
+ "substitutedRuns": {
52829
+ "type": "integer"
52830
+ },
52831
+ "enabledOnlyRuns": {
52832
+ "type": "integer"
52833
+ },
52834
+ "measuredUsd": {
52835
+ "type": "number"
52836
+ },
52837
+ "estimatedLlmUsd": {
52838
+ "type": "number"
52839
+ },
52840
+ "actualUsd": {
52841
+ "type": "number"
52842
+ },
52843
+ "agentOnlyUsd": {
52844
+ "type": "object",
52845
+ "properties": {
52846
+ "p10": {
52847
+ "type": "number"
52848
+ },
52849
+ "p50": {
52850
+ "type": "number"
52851
+ },
52852
+ "p90": {
52853
+ "type": "number"
52854
+ }
52855
+ },
52856
+ "required": [
52857
+ "p10",
52858
+ "p50",
52859
+ "p90"
52860
+ ]
52861
+ },
52862
+ "savingUsd": {
52863
+ "type": "object",
52864
+ "properties": {
52865
+ "p10": {
52866
+ "type": "number"
52867
+ },
52868
+ "p50": {
52869
+ "type": "number"
52870
+ },
52871
+ "p90": {
52872
+ "type": "number"
52873
+ }
52874
+ },
52875
+ "required": [
52876
+ "p10",
52877
+ "p50",
52878
+ "p90"
52879
+ ]
52880
+ },
52881
+ "actualHours": {
52882
+ "type": "number"
52883
+ },
52884
+ "hoursSaved": {
52885
+ "type": "object",
52886
+ "properties": {
52887
+ "p10": {
52888
+ "type": "number"
52889
+ },
52890
+ "p50": {
52891
+ "type": "number"
52892
+ },
52893
+ "p90": {
52894
+ "type": "number"
52895
+ }
52896
+ },
52897
+ "required": [
52898
+ "p10",
52899
+ "p50",
52900
+ "p90"
52901
+ ]
52902
+ }
52903
+ },
52904
+ "required": [
52905
+ "runs",
52906
+ "substitutedRuns",
52907
+ "enabledOnlyRuns",
52908
+ "measuredUsd",
52909
+ "estimatedLlmUsd",
52910
+ "actualUsd",
52911
+ "agentOnlyUsd",
52912
+ "savingUsd",
52913
+ "actualHours",
52914
+ "hoursSaved"
52915
+ ]
52916
+ },
52917
+ "byKind": {
52918
+ "type": [
52919
+ "object",
52920
+ "null"
52921
+ ],
52922
+ "properties": {
52923
+ "workflows": {
52924
+ "type": "object",
52925
+ "properties": {
52926
+ "jobs": {
52927
+ "type": "integer"
52928
+ },
52929
+ "runs": {
52930
+ "type": "integer"
52931
+ },
52932
+ "substitutedRuns": {
52933
+ "type": "integer"
52934
+ },
52935
+ "savingUsd": {
52936
+ "type": "number",
52937
+ "description": "p50"
52938
+ },
52939
+ "hoursSaved": {
52940
+ "type": "number",
52941
+ "description": "p50"
52942
+ }
52943
+ },
52944
+ "required": [
52945
+ "jobs",
52946
+ "runs",
52947
+ "substitutedRuns",
52948
+ "savingUsd",
52949
+ "hoursSaved"
52950
+ ]
52951
+ },
52952
+ "scheduledScripts": {
52953
+ "type": "object",
52954
+ "properties": {
52955
+ "jobs": {
52956
+ "type": "integer"
52957
+ },
52958
+ "runs": {
52959
+ "type": "integer"
52960
+ },
52961
+ "substitutedRuns": {
52962
+ "type": "integer"
52963
+ },
52964
+ "savingUsd": {
52965
+ "type": "number",
52966
+ "description": "p50"
52967
+ },
52968
+ "hoursSaved": {
52969
+ "type": "number",
52970
+ "description": "p50"
52971
+ }
52972
+ },
52973
+ "required": [
52974
+ "jobs",
52975
+ "runs",
52976
+ "substitutedRuns",
52977
+ "savingUsd",
52978
+ "hoursSaved"
52979
+ ]
52980
+ },
52981
+ "agentInvokedScripts": {
52982
+ "type": "object",
52983
+ "properties": {
52984
+ "jobs": {
52985
+ "type": "integer"
52986
+ },
52987
+ "runs": {
52988
+ "type": "integer"
52989
+ },
52990
+ "substitutedRuns": {
52991
+ "type": "integer"
52992
+ },
52993
+ "savingUsd": {
52994
+ "type": "number",
52995
+ "description": "p50"
52996
+ },
52997
+ "hoursSaved": {
52998
+ "type": "number",
52999
+ "description": "p50"
53000
+ }
53001
+ },
53002
+ "required": [
53003
+ "jobs",
53004
+ "runs",
53005
+ "substitutedRuns",
53006
+ "savingUsd",
53007
+ "hoursSaved"
53008
+ ]
53009
+ }
53010
+ },
53011
+ "required": [
53012
+ "workflows",
53013
+ "scheduledScripts",
53014
+ "agentInvokedScripts"
53015
+ ]
53016
+ },
53017
+ "fleetLlmUsd": {
53018
+ "type": "number",
53019
+ "description": "Measured session spend of the whole swarm in the window, as on the usage page."
53020
+ },
53021
+ "selfOptimizationRatio": {
53022
+ "type": [
53023
+ "number",
53024
+ "null"
53025
+ ],
53026
+ "description": "`(fleetLlmUsd + savingUsd.p50) / fleetLlmUsd`: what the swarm would have spent without its automations, per dollar it spent. Null without spend or without a valid total."
53027
+ },
53028
+ "excluded": {
53029
+ "type": [
53030
+ "object",
53031
+ "null"
53032
+ ],
53033
+ "properties": {
53034
+ "enabledOnlyRuns": {
53035
+ "type": "integer",
53036
+ "description": "Runs that are not substituted: router events and API runs with no effect, polls above the hourly cap, skipped and cancelled runs."
53037
+ }
53038
+ },
53039
+ "required": [
53040
+ "enabledOnlyRuns"
53041
+ ]
53042
+ },
53043
+ "assumptions": {
53044
+ "type": "array",
53045
+ "items": {
53046
+ "type": "string"
53047
+ }
53048
+ }
53049
+ },
53050
+ "required": [
53051
+ "window",
53052
+ "tier",
53053
+ "calibrationModel",
53054
+ "calibratedAt",
53055
+ "calibrationSource",
53056
+ "computedAt",
53057
+ "valid",
53058
+ "reason",
53059
+ "boundaryEstimated",
53060
+ "total",
53061
+ "byKind",
53062
+ "fleetLlmUsd",
53063
+ "selfOptimizationRatio",
53064
+ "excluded",
53065
+ "assumptions"
53066
+ ]
51961
53067
  }
51962
53068
  }
51963
53069
  }
51964
53070
  },
51965
- "429": {
51966
- "description": "Too many concurrent database queries; retry shortly",
53071
+ "400": {
53072
+ "description": "An unknown days or tier value",
51967
53073
  "content": {
51968
53074
  "application/json": {
51969
53075
  "schema": {