@desplega.ai/agent-swarm 2.7.6 → 2.7.8

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 (361) hide show
  1. package/dist/{acp-adapter-bp91d37f.js → acp-adapter-vg5hqkvj.js} +6 -5
  2. package/dist/{actions-yj0eeaqh.js → actions-4m1ct4nh.js} +18 -18
  3. package/dist/{amp-adapter-4pg9h34q.js → amp-adapter-txqh7eqj.js} +2 -2
  4. package/dist/{anthropic-messages-x4q6rfq5.js → anthropic-messages-xey2skwx.js} +7 -7
  5. package/dist/{app-909e97cr.js → app-e00m45gn.js} +3 -3
  6. package/dist/{assistant-qdyb5fyy.js → assistant-gd08kr9e.js} +20 -20
  7. package/dist/{azure-openai-responses-s1w5n70z.js → azure-openai-responses-26t7j9ra.js} +5 -5
  8. package/dist/boot-args-schema-tjrkpbvm.js +89 -0
  9. package/dist/{boot-reembed-fk0s9z18.js → boot-reembed-21hbck22.js} +1 -1
  10. package/dist/{boot-reembed-gs1rzrnh.js → boot-reembed-mdxd3wgp.js} +1 -1
  11. package/dist/{boot-scrub-sweep-4qfd4kfx.js → boot-scrub-sweep-qy0zr9t2.js} +3 -3
  12. package/dist/{boot-seeds-yr00k13d.js → boot-seeds-n46eaxdv.js} +4 -4
  13. package/dist/{boxd-vdmfssd9.js → boxd-nv507va8.js} +1 -1
  14. package/dist/{claude-adapter-qta1f1xn.js → claude-adapter-j37w2eds.js} +6 -5
  15. package/dist/{claude-managed-adapter-dvs2xw5n.js → claude-managed-adapter-8jvcma9a.js} +3 -3
  16. package/dist/{claude-managed-setup-sc6j4dm0.js → claude-managed-setup-rzkjmgc1.js} +3 -3
  17. package/dist/{claude-sdk-session-zgrz6yvc.js → claude-sdk-session-4k7w73t0.js} +8290 -8226
  18. package/dist/{cli-w6dt9ged.js → cli-0ykgn1h5.js} +1 -1
  19. package/dist/{cli-89knwags.js → cli-1cxrbkk6.js} +2 -2
  20. package/dist/{cli-drr5v6av.js → cli-269q28a1.js} +4 -2
  21. package/dist/{cli-es6va8jk.js → cli-32m9eda8.js} +60 -53
  22. package/dist/{cli-q0k1w5zd.js → cli-3e4snnzf.js} +1 -1
  23. package/dist/{cli-dxae2yg7.js → cli-4t50yq3j.js} +2 -2
  24. package/dist/{cli-nhrvpaj7.js → cli-5j0m12ns.js} +520 -7
  25. package/dist/{cli-dhar9qay.js → cli-5ja3b75e.js} +2 -2
  26. package/dist/{cli-gdhpcbhf.js → cli-66ww7fer.js} +1 -1
  27. package/dist/{cli-bsn8nhrq.js → cli-6vcp76qk.js} +3 -3
  28. package/dist/{cli-8bc1w0tw.js → cli-7axf41jq.js} +29 -16
  29. package/dist/cli-82j36f2m.js +45 -0
  30. package/dist/{cli-svj5090z.js → cli-84rj785g.js} +5 -5
  31. package/dist/{cli-pd7vagab.js → cli-85gzce7b.js} +5 -5
  32. package/dist/{cli-xnrwazav.js → cli-8h0ayw8c.js} +1 -1
  33. package/dist/cli-8rpcng8j.js +67 -0
  34. package/dist/{cli-shpbx5ee.js → cli-8sdejs1f.js} +1728 -72
  35. package/dist/{cli-yx4kfngt.js → cli-9m8hdawy.js} +30 -17
  36. package/dist/{cli-436532ck.js → cli-ae0dnfee.js} +166 -154
  37. package/dist/{cli-bqt1mptt.js → cli-az48n0nr.js} +4 -4
  38. package/dist/{cli-386tyxxg.js → cli-bb0mmdk8.js} +2 -2
  39. package/dist/{cli-yy3rhsdw.js → cli-bbw9wj9m.js} +8 -8
  40. package/dist/{cli-xds5f77d.js → cli-bshb7jas.js} +2 -2
  41. package/dist/{cli-wp9sp1qb.js → cli-btfsp3mv.js} +3 -3
  42. package/dist/{cli-4zsenjhy.js → cli-c0kqky8y.js} +16 -3
  43. package/dist/{cli-a7v854rf.js → cli-dq8x79v8.js} +264 -13
  44. package/dist/{cli-ftyxyspd.js → cli-eqtfgfr6.js} +1 -1
  45. package/dist/{cli-yn4kxs06.js → cli-eyg1pa00.js} +4 -4
  46. package/dist/{cli-71ptav7x.js → cli-ferkkrg9.js} +1 -1
  47. package/dist/{cli-vpf89f34.js → cli-fmjd0t1y.js} +3 -3
  48. package/dist/{cli-4necwtsv.js → cli-fyhr5h4s.js} +38 -16
  49. package/dist/{cli-xnqgpshy.js → cli-fzachfnf.js} +1 -1
  50. package/dist/{cli-ehq736cn.js → cli-g7s47cc5.js} +4 -4
  51. package/dist/{cli-0qatpy8q.js → cli-ga786dzg.js} +34 -11
  52. package/dist/{cli-bjb3z51z.js → cli-gazw7kpa.js} +2 -2
  53. package/dist/{cli-54t00gt8.js → cli-gvx71kqv.js} +2 -2
  54. package/dist/{cli-c60vetmm.js → cli-jdv6ypxs.js} +1 -1
  55. package/dist/{cli-611a1294.js → cli-k0wwfqbg.js} +18 -1
  56. package/dist/{cli-cm5yqn35.js → cli-kf3pxxdg.js} +1 -0
  57. package/dist/{cli-0at8w34w.js → cli-kyr67fgx.js} +8 -8
  58. package/dist/{cli-vvpx3gsx.js → cli-m0hmeqma.js} +2 -2
  59. package/dist/{cli-he9wchme.js → cli-mkk9rnzz.js} +4 -4
  60. package/dist/{cli-e3r2neck.js → cli-msg9m2ny.js} +7 -5
  61. package/dist/{cli-m48g6p95.js → cli-nbsf8yvn.js} +15 -3
  62. package/dist/{cli-tfyyvzx6.js → cli-njwac61j.js} +5 -0
  63. package/dist/{cli-faxe6thg.js → cli-nn3ysbqk.js} +186 -54
  64. package/dist/{cli-decfb6v8.js → cli-p3vsj0d3.js} +24 -10
  65. package/dist/{cli-ekwks2vs.js → cli-ppjxh6ah.js} +3 -3
  66. package/dist/{cli-aa6yxc7m.js → cli-pz4rk021.js} +1 -1
  67. package/dist/{cli-nwj0ee2w.js → cli-q4ebh7h7.js} +4 -4
  68. package/dist/{cli-75gkpjvw.js → cli-qd57hhhh.js} +2 -2
  69. package/dist/{cli-zbbwez0r.js → cli-rjknb2ae.js} +4 -4
  70. package/dist/{cli-hgaazk69.js → cli-s4ss5g59.js} +5 -5
  71. package/dist/{cli-1h3wcpbw.js → cli-snpj5zbj.js} +2 -2
  72. package/dist/{cli-3ypk9vk1.js → cli-sq4n7af4.js} +1 -1
  73. package/dist/{cli-vfym7wmz.js → cli-ssnjfg5p.js} +5 -5
  74. package/dist/{cli-8snvgs5r.js → cli-t60ajbbp.js} +10 -10
  75. package/dist/{cli-hr2e2fft.js → cli-tpksw2nr.js} +22 -18
  76. package/dist/{cli-k2gzwsj2.js → cli-w4xnbm46.js} +300 -74
  77. package/dist/{cli-p5gp8pcx.js → cli-wemma3jd.js} +8 -7
  78. package/dist/{cli-70r77n04.js → cli-xae4g51r.js} +1 -1
  79. package/dist/{cli-waqbxg08.js → cli-xq9r2wtt.js} +50 -26
  80. package/dist/{cli-zm72anhg.js → cli-xr8908my.js} +11 -11
  81. package/dist/{cli-73jzwksr.js → cli-ycscb2ar.js} +4 -1
  82. package/dist/{cli-kqdg1bsb.js → cli-yndmfxb3.js} +2 -2
  83. package/dist/{cli-0yv5z2pg.js → cli-yqefz277.js} +1 -1
  84. package/dist/{cli-rmmmrjkd.js → cli-z1srzaf6.js} +11 -3
  85. package/dist/{cli-xbbndvjy.js → cli-z75yxkjh.js} +3 -3
  86. package/dist/{cli-jm2vfpfd.js → cli-zkky4t5g.js} +1 -1
  87. package/dist/cli.js +24 -22
  88. package/dist/{cloudflare-workers-ai-system-one-bm60fjm0.js → cloudflare-workers-ai-system-one-ef2a980q.js} +2 -2
  89. package/dist/{codex-adapter-ayd1fb6h.js → codex-adapter-88z6psm4.js} +5 -4
  90. package/dist/{codex-hook-9efm2x1m.js → codex-hook-fac6175r.js} +2 -2
  91. package/dist/{codex-login-y0pmff1c.js → codex-login-74wa4hmq.js} +1 -1
  92. package/dist/{codex-session-runner-jesa32xc.js → codex-session-runner-zwbcwzvx.js} +5 -4
  93. package/dist/{commands-hanewgf2.js → commands-7amxs716.js} +3 -3
  94. package/dist/{controller-dt1n3c1q.js → controller-5rkkc37m.js} +3 -3
  95. package/dist/{controllers-connect-xx8x64n5.js → controllers-connect-m7d4vxxb.js} +19 -19
  96. package/dist/{cursor-adapter-9s4dwwdw.js → cursor-adapter-x1q18693.js} +1 -1
  97. package/dist/{db-9dv0g1ab.js → db-athc68zt.js} +6 -2
  98. package/dist/{db-3vttcbv4.js → db-h2fsfve3.js} +3 -3
  99. package/dist/{dispatcher-tx9hd1sv.js → dispatcher-b1yz2bnn.js} +17 -17
  100. package/dist/{dsh-adapter-007y4ejs.js → dsh-adapter-e33bkxq9.js} +1 -1
  101. package/dist/{e2b-we6hs6q5.js → e2b-fr12yccx.js} +1 -1
  102. package/dist/{e2b-a19d28rz.js → e2b-x6ywzak3.js} +1 -1
  103. package/dist/{easter-egg-3d-rgbrqb8s.js → easter-egg-3d-pv5qnzc8.js} +1 -1
  104. package/dist/{embedding-space-ny1e2940.js → embedding-space-b4txbwrk.js} +6 -6
  105. package/dist/{embeddings-2t386t13.js → embeddings-m6zn6tad.js} +1 -1
  106. package/dist/{execute-pksh0ceh.js → execute-68nwny8m.js} +1 -1
  107. package/dist/{external-channel-phgmhmd7.js → external-channel-gkckmhzh.js} +2 -2
  108. package/dist/{fx-adapter-fy8rr921.js → fx-adapter-m5jbgd5q.js} +7 -6
  109. package/dist/{google-generative-ai-8y3m3k4b.js → google-generative-ai-v94hr7h0.js} +5 -5
  110. package/dist/{google-vertex-w3v98n7b.js → google-vertex-g7vr6cf8.js} +5 -5
  111. package/dist/{grok-adapter-q0abvpaj.js → grok-adapter-csvv7sac.js} +7 -6
  112. package/dist/handlers-8x5gfbzx.js +32 -0
  113. package/dist/{heartbeat-kadyek8p.js → heartbeat-6c2y3267.js} +20 -20
  114. package/dist/{hook-5zs3msf6.js → hook-q5fv0jy2.js} +25 -10
  115. package/dist/{hook-9k551xnj.js → hook-w0q2wcrv.js} +5 -4
  116. package/dist/{http-mhz9vw1f.js → http-bxat8dg3.js} +1242 -250
  117. package/dist/{index-rvr00sg7.js → index-bxrexmfy.js} +1020 -577
  118. package/dist/{index-vdygbq10.js → index-cqhqpgrv.js} +1 -1
  119. package/dist/{index-q361cg2f.js → index-fm0czesf.js} +1 -1
  120. package/dist/index-hpfte8jd.js +33 -0
  121. package/dist/index-ncf7yb5s.js +30 -0
  122. package/dist/index-vte6dyeh.js +37 -0
  123. package/dist/{keepalive-w56f32cg.js → keepalive-qnt21cv0.js} +3 -3
  124. package/dist/lead-4bvftzm6.js +71 -0
  125. package/dist/{maintenance-7mdgxcea.js → maintenance-btdr68y4.js} +1 -1
  126. package/dist/{mistral-conversations-4pmwj1c0.js → mistral-conversations-3gjpdb4b.js} +4 -4
  127. package/dist/{oauth-refresh-sweep-29txy9vk.js → oauth-refresh-sweep-vczabeh4.js} +2 -2
  128. package/dist/{onboard-kpsrkarj.js → onboard-k33ezyq8.js} +3 -3
  129. package/dist/{openai-codex-responses-44j573nm.js → openai-codex-responses-8pbxq9h5.js} +5 -5
  130. package/dist/{openai-completions-a4gee2a8.js → openai-completions-rm00s912.js} +4 -4
  131. package/dist/{openai-decisions-w4qkrcar.js → openai-decisions-8v957r2r.js} +1 -1
  132. package/dist/{openai-responses-rbp6h5kr.js → openai-responses-agxpf96k.js} +5 -5
  133. package/dist/{opencode-adapter-j25vm3rr.js → opencode-adapter-3dst2ka7.js} +5 -4
  134. package/dist/{otel-impl-6kkct7a8.js → otel-impl-13am7a65.js} +4 -4
  135. package/dist/{pi-mono-adapter-exhkzhn2.js → pi-mono-adapter-c53de1gd.js} +16 -9
  136. package/dist/{pricing-refresh-n2x7jh6k.js → pricing-refresh-9fcbnq3f.js} +3 -3
  137. package/dist/{rbac-roles-b5htkjby.js → rbac-roles-66j5h4y5.js} +5 -3
  138. package/dist/{rbac-roles-81ypx6es.js → rbac-roles-gw0p9h3j.js} +2 -2
  139. package/dist/{render-v2-qn6jmpk4.js → render-v2-fg8bmdn4.js} +3 -3
  140. package/dist/{resume-wd30wx23.js → resume-1c8kr3nh.js} +6 -6
  141. package/dist/{runtime-4hsg7h60.js → runtime-tzf9j7tc.js} +1 -1
  142. package/dist/{session-access-5qvfevhk.js → session-access-d0atq10j.js} +7 -5
  143. package/dist/{session-source-backfill-n1czavbr.js → session-source-backfill-0vscqmsa.js} +2 -2
  144. package/dist/{setup-dnb56qy5.js → setup-tvfa7rwe.js} +1 -1
  145. package/dist/{typesafe-system-one-5mavm259.js → typesafe-system-one-0bmqcxfg.js} +2 -2
  146. package/dist/{virtual-modules-76xxv9fs.js → virtual-modules-efxcp740.js} +5 -5
  147. package/dist/{work-objects-4n21tfkm.js → work-objects-ks71xqeb.js} +20 -20
  148. package/dist/worker-e7v2bvm9.js +71 -0
  149. package/dist/{worker-follow-up-77hvzxww.js → worker-follow-up-bfx0h9hg.js} +17 -17
  150. package/openapi.json +300 -27
  151. package/package.json +7 -5
  152. package/src/apps/definition.ts +6 -5
  153. package/src/be/db/model-profiles.ts +1 -1
  154. package/src/be/db/page-theme-tokens.ts +12 -0
  155. package/src/be/db/session-tree.ts +9 -5
  156. package/src/be/db/session-visibility.ts +25 -9
  157. package/src/be/db/tasks/read.ts +20 -7
  158. package/src/be/db/tasks/write.ts +96 -7
  159. package/src/be/db-client.ts +107 -7
  160. package/src/be/db-queries/tracker.ts +4 -2
  161. package/src/be/db.ts +83 -19
  162. package/src/be/migrations/269_pages_design_system.sql +23 -0
  163. package/src/be/migrations/271_subscription_usage_model.sql +30 -0
  164. package/src/be/model-validation.ts +19 -1
  165. package/src/be/rbac-roles.ts +21 -0
  166. package/src/be/runtime-pools/routing.ts +1 -1
  167. package/src/be/scripts/boot-args-schema.ts +95 -0
  168. package/src/be/scripts/extract-schema.ts +15 -10
  169. package/src/be/seed/schedules-seeder.ts +0 -10
  170. package/src/be/seed-scripts/catalog/boot-triage.inline.ts +1 -1
  171. package/src/be/seed-scripts/catalog/boot-triage.ts +1 -1
  172. package/src/be/seed-scripts/catalog/catalog-report.inline.ts +2 -0
  173. package/src/be/seed-scripts/catalog/catalog-report.ts +2 -0
  174. package/src/be/seed-scripts/catalog/get-child-outputs.ts +1 -1
  175. package/src/be/seed-scripts/catalog/memory-eval.ts +2 -0
  176. package/src/be/seed-scripts/catalog/swarm-update-check.ts +150 -0
  177. package/src/be/seed-scripts/catalog/wait-for-task.ts +1 -1
  178. package/src/be/seed-scripts/index.ts +9 -0
  179. package/src/be/seed-skills/bundled-files.generated.json +3 -3
  180. package/src/be/swarm-config-guard.ts +39 -0
  181. package/src/be/task-auto-title-listener.ts +127 -0
  182. package/src/be/users.ts +6 -4
  183. package/src/commands/claude-managed-setup.ts +1 -1
  184. package/src/commands/onboard/agent-fs-version.ts +1 -1
  185. package/src/commands/profile-sync.ts +151 -16
  186. package/src/commands/runner.ts +41 -16
  187. package/src/extensions/contract-types.generated.ts +1 -1
  188. package/src/hooks/hook.ts +20 -9
  189. package/src/http/agents.ts +7 -1
  190. package/src/http/approval-requests.ts +30 -6
  191. package/src/http/codex-oauth-device.ts +2 -2
  192. package/src/http/index.ts +11 -0
  193. package/src/http/mcp-oauth.ts +6 -0
  194. package/src/http/mcp-servers.ts +8 -0
  195. package/src/http/models-catalog.ts +1 -1
  196. package/src/http/pages-public.ts +131 -130
  197. package/src/http/pages.ts +94 -21
  198. package/src/http/poll.ts +3 -4
  199. package/src/http/prompt-templates.ts +1 -1
  200. package/src/http/schedules.ts +4 -0
  201. package/src/http/script-runs.ts +6 -1
  202. package/src/http/session-access.ts +61 -6
  203. package/src/http/sessions.ts +23 -7
  204. package/src/http/tasks.ts +53 -9
  205. package/src/http/users.ts +30 -1
  206. package/src/http/utils.ts +2 -1
  207. package/src/http/workflows.ts +11 -7
  208. package/src/pages/browser-sdk.ts +48 -21
  209. package/src/pages/color-literals.ts +115 -0
  210. package/src/pages/page-head.ts +766 -0
  211. package/src/pages/version.ts +3 -0
  212. package/src/prompts/session-templates.ts +1 -0
  213. package/src/providers/acp-targets.ts +1 -1
  214. package/src/providers/amp-adapter.ts +1 -1
  215. package/src/providers/codex-adapter.ts +10 -2
  216. package/src/providers/codex-app-server.ts +27 -1
  217. package/src/providers/codex-oauth/device.ts +49 -15
  218. package/src/providers/codex-oauth/flow.ts +2 -1
  219. package/src/providers/pi-mono-adapter.ts +8 -0
  220. package/src/providers/pi-mono-extension.ts +30 -15
  221. package/src/providers/pricing-sources.md +16 -1
  222. package/src/providers/swarm-events-shared.ts +15 -2
  223. package/src/rbac/legacy-policy.ts +1 -0
  224. package/src/rbac/permissions.ts +5 -0
  225. package/src/scheduler/deferred-task-waits.ts +9 -4
  226. package/src/scripts-runtime/extract-args-schema.ts +3 -1
  227. package/src/scripts-runtime/swarm-sdk.ts +1 -1
  228. package/src/scripts-runtime/types/swarm-extension.d.ts +29 -28
  229. package/src/server-user.ts +1 -1
  230. package/src/slack/ack.ts +48 -12
  231. package/src/slack/blocks.ts +1 -0
  232. package/src/slack/reaction-shortcode.ts +8 -2
  233. package/src/slack/render-v2.ts +30 -3
  234. package/src/slack/task-output.ts +4 -1
  235. package/src/slack/thread-buffer.ts +2 -2
  236. package/src/tasks/follow-up-gate.ts +318 -0
  237. package/src/tasks/task-skip.ts +28 -0
  238. package/src/tasks/terminal-result-guard.ts +3 -2
  239. package/src/tasks/worker-follow-up.ts +21 -1
  240. package/src/telemetry.ts +28 -1
  241. package/src/tests/agentmail-inbox-mapping.test.ts +73 -0
  242. package/src/tests/approval-requests.test.ts +58 -0
  243. package/src/tests/claude-managed-setup.test.ts +36 -0
  244. package/src/tests/codex-adapter.test.ts +2 -2
  245. package/src/tests/codex-app-server.test.ts +59 -0
  246. package/src/tests/codex-gateway-route.test.ts +50 -1
  247. package/src/tests/codex-oauth-device.test.ts +60 -0
  248. package/src/tests/codex-swarm-events.test.ts +43 -1
  249. package/src/tests/context-window.test.ts +14 -0
  250. package/src/tests/create-page-tool.test.ts +501 -0
  251. package/src/tests/db-client-busy-retry.test.ts +81 -0
  252. package/src/tests/db-queries-tracker.test.ts +2 -1
  253. package/src/tests/db-task-read-contract.test.ts +2 -0
  254. package/src/tests/db-task-write-contract.test.ts +4 -0
  255. package/src/tests/db-tasks-read.test.ts +21 -0
  256. package/src/tests/deferred-task-wake.test.ts +7 -2
  257. package/src/tests/e2e-coverage-contract.test.ts +235 -0
  258. package/src/tests/empty-output-schema.test.ts +160 -0
  259. package/src/tests/env-flag.test.ts +1 -0
  260. package/src/tests/explicit-model-validation.test.ts +14 -0
  261. package/src/tests/fixtures/pages/head-v1.html +56 -0
  262. package/src/tests/follow-up-gate-shadow.test.ts +513 -0
  263. package/src/tests/http-api-integration.test.ts +2 -2
  264. package/src/tests/http-users.test.ts +63 -0
  265. package/src/tests/identity-field-budget.test.ts +1 -1
  266. package/src/tests/internal-ai/credentials.test.ts +62 -0
  267. package/src/tests/internal-ai/task-title.test.ts +283 -0
  268. package/src/tests/mcp-input-caps.test.ts +4 -3
  269. package/src/tests/merge-gate-detect-changes.test.ts +167 -0
  270. package/src/tests/page-proxy.test.ts +1 -1
  271. package/src/tests/page-session-dev-cookie.test.ts +188 -0
  272. package/src/tests/pages-authed-mode.test.ts +13 -2
  273. package/src/tests/pages-frame-ancestors.test.ts +28 -1
  274. package/src/tests/pages-head-v2.test.ts +534 -0
  275. package/src/tests/pages-http.test.ts +330 -0
  276. package/src/tests/pages-public-html.test.ts +43 -0
  277. package/src/tests/pages-storage.test.ts +182 -0
  278. package/src/tests/pages-versioning.test.ts +72 -0
  279. package/src/tests/pi-mono-adapter.test.ts +39 -4
  280. package/src/tests/profile-sync-stale-writeback.test.ts +334 -0
  281. package/src/tests/profile-sync.test.ts +11 -15
  282. package/src/tests/rbac-engine.test.ts +1 -0
  283. package/src/tests/runner-context-usage.test.ts +119 -0
  284. package/src/tests/scheduled-task-required-params-migration.test.ts +3 -1
  285. package/src/tests/script-connections.test.ts +4 -0
  286. package/src/tests/script-executor-quickjs.test.ts +2 -0
  287. package/src/tests/script-runs-http.test.ts +57 -0
  288. package/src/tests/scripts-boot-args-schema.test.ts +181 -0
  289. package/src/tests/scripts-runtime.test.ts +24 -0
  290. package/src/tests/sdk-store-progress-skipped.test.ts +155 -0
  291. package/src/tests/seed-registry.test.ts +28 -6
  292. package/src/tests/seed-schedules.test.ts +61 -8
  293. package/src/tests/seed-scripts.test.ts +142 -2
  294. package/src/tests/session-costs-model-key-normalize.test.ts +59 -0
  295. package/src/tests/session-sharing.test.ts +212 -2
  296. package/src/tests/slack-reaction-config.test.ts +1 -0
  297. package/src/tests/slack-render-v2.test.ts +73 -0
  298. package/src/tests/slack-skip-reaction.test.ts +203 -0
  299. package/src/tests/store-progress-skipped.test.ts +159 -0
  300. package/src/tests/subscription-usage-migration.test.ts +57 -0
  301. package/src/tests/swarm-config-reserved-keys.test.ts +3 -0
  302. package/src/tests/swarm-diff.test.ts +121 -2
  303. package/src/tests/task-auto-title-config-guard.test.ts +37 -0
  304. package/src/tests/task-auto-title-listener.test.ts +165 -0
  305. package/src/tests/telemetry-endpoint-override.test.ts +27 -0
  306. package/src/tests/theme-import.test.ts +758 -0
  307. package/src/tests/themes-page-theme.test.ts +155 -0
  308. package/src/tests/themes-presets.test.ts +172 -0
  309. package/src/tests/trigger-claiming.test.ts +2 -0
  310. package/src/tests/workflow-script-principal.test.ts +2 -1
  311. package/src/tests/workflow-system-one-extraction.test.ts +29 -0
  312. package/src/themes/classics.ts +949 -0
  313. package/src/themes/import.ts +420 -0
  314. package/src/themes/page-fields.ts +40 -0
  315. package/src/themes/page-theme.ts +102 -0
  316. package/src/themes/presets.ts +561 -0
  317. package/src/themes/tokens.ts +218 -0
  318. package/src/tools/app-upsert.ts +1 -1
  319. package/src/tools/create-channel.ts +1 -1
  320. package/src/tools/create-page.ts +118 -12
  321. package/src/tools/defer-task.ts +1 -1
  322. package/src/tools/register-agentmail-inbox.ts +5 -0
  323. package/src/tools/repos/update-repo.ts +1 -1
  324. package/src/tools/request-human-input.ts +1 -1
  325. package/src/tools/send-task.ts +1 -1
  326. package/src/tools/store-progress.ts +39 -8
  327. package/src/tools/tracker/tracker-unlink.ts +2 -1
  328. package/src/tools/utils.ts +33 -0
  329. package/src/tools/workflows/retry-workflow-run.ts +3 -0
  330. package/src/types.ts +56 -5
  331. package/src/utils/constants.ts +19 -0
  332. package/src/utils/context-window.ts +6 -1
  333. package/src/utils/follow-up-gate-schedule-ids.ts +13 -0
  334. package/src/utils/internal-ai/credentials.ts +146 -93
  335. package/src/utils/internal-ai/index.ts +10 -0
  336. package/src/utils/internal-ai/models.ts +18 -0
  337. package/src/utils/internal-ai/task-title.ts +282 -0
  338. package/src/utils/output-schema.ts +23 -0
  339. package/src/utils/page-session.ts +37 -0
  340. package/src/workflows/executors/system-one-providers.ts +25 -6
  341. package/src/workflows/recovery.ts +8 -4
  342. package/src/workflows/resume.ts +19 -0
  343. package/templates/schedules/daily-status-report/content.md +88 -2
  344. package/templates/schedules/daily-swarm-update-check/content.md +16 -40
  345. package/templates/skills/apps/SKILL.md +1 -1
  346. package/templates/skills/apps/content.md +1 -1
  347. package/templates/skills/heartbeat-runbook/content.md +1 -1
  348. package/templates/skills/pages/config.json +1 -1
  349. package/templates/skills/pages/content.md +539 -86
  350. package/templates/skills/pages/files/examples/annotated-pr.html +21 -12
  351. package/templates/skills/pages/files/examples/multiplayer-board.html +41 -41
  352. package/templates/skills/pages/files/examples/report-page.html +125 -124
  353. package/dist/cli-2pnswgh8.js +0 -189
  354. package/dist/handlers-by3sfxyx.js +0 -32
  355. package/dist/index-4f2pvxae.js +0 -37
  356. package/dist/index-98gz7tmp.js +0 -30
  357. package/dist/index-k08z2cak.js +0 -33
  358. package/dist/lead-enq35nqp.js +0 -70
  359. package/dist/worker-gg1576j3.js +0 -70
  360. package/templates/schedules/daily-workflow-health-audit/config.json +0 -19
  361. package/templates/schedules/daily-workflow-health-audit/content.md +0 -191
@@ -0,0 +1,282 @@
1
+ /**
2
+ * Task title generation: a short display title for a task prompt.
3
+ *
4
+ * Consumer of `completeStructuredWithModel`. Walks `TASK_TITLE_MODEL_CANDIDATES`
5
+ * (provider order, then model order) and returns the first title a configured
6
+ * credential produces. Every candidate is a cheap, fast model: one title costs
7
+ * well under a tenth of a cent, so thousands of weekly tasks stay in cents.
8
+ *
9
+ * Worker-safe: no bun:sqlite import. The API server wires it to task creation
10
+ * in `src/be/task-auto-title-listener.ts`.
11
+ */
12
+
13
+ import { Type } from "typebox";
14
+ import { z } from "zod";
15
+ import { scrubSecrets } from "../secret-scrubber.js";
16
+ import { completeStructuredWithModel } from "./complete-structured.js";
17
+ import { type CredentialKind, type ResolvedCredential, resolveCredentials } from "./credentials.js";
18
+ import { kindForModelString } from "./models.js";
19
+
20
+ /** Longest generated title. The PATCH /api/tasks/{id}/title route allows 120. */
21
+ export const TASK_TITLE_MAX_CHARS = 100;
22
+ /** Prompts shorter than this keep the prompt itself as the display title. */
23
+ export const TASK_TITLE_MIN_TASK_CHARS = 48;
24
+ /** Prompt text sent to the model is cut here. Keeps every call small. */
25
+ export const TASK_TITLE_MAX_TASK_CHARS = 2000;
26
+ /** Whole generation, across every candidate. */
27
+ export const TASK_TITLE_TIMEOUT_MS = 20_000;
28
+
29
+ /** Env var that pins one model (`provider/model-id`, or a `claude -p` alias). */
30
+ export const TASK_TITLE_MODEL_ENV = "TASK_AUTO_TITLE_MODEL";
31
+
32
+ export interface TaskTitleCandidateGroup {
33
+ kind: CredentialKind;
34
+ /** Full model strings for this credential kind, best first. */
35
+ models: readonly string[];
36
+ }
37
+
38
+ /**
39
+ * Provider order, then model order within a provider. Cheapest and fastest
40
+ * first: pay-per-token API keys before subscription OAuth, and the `claude -p`
41
+ * shellout last (it spawns a full CLI process per call).
42
+ *
43
+ * Model prices (input / output, USD per million tokens, models.dev snapshot):
44
+ * deepseek-v4.1-flash 0.034 / 0.137 · claude-haiku-5.5 0.10 / 0.50 ·
45
+ * gpt-6-luna 0.10 / 0.50 · gpt-5-nano 0.05 / 0.40
46
+ */
47
+ export const TASK_TITLE_MODEL_CANDIDATES: readonly TaskTitleCandidateGroup[] = [
48
+ {
49
+ kind: "openrouter",
50
+ models: [
51
+ "openrouter/deepseek/deepseek-v4.1-flash",
52
+ "openrouter/anthropic/claude-haiku-5.5",
53
+ "openrouter/openai/gpt-6-luna",
54
+ ],
55
+ },
56
+ { kind: "anthropic", models: ["anthropic/claude-haiku-5-5"] },
57
+ { kind: "openai", models: ["openai/gpt-6-luna", "openai/gpt-5-nano"] },
58
+ { kind: "openai-codex", models: ["openai-codex/gpt-6-luna"] },
59
+ { kind: "claude-cli", models: ["haiku"] },
60
+ ];
61
+
62
+ export { kindForModelString };
63
+
64
+ /**
65
+ * The candidate list for one environment. `TASK_AUTO_TITLE_MODEL` moves its
66
+ * provider to the front and puts the pinned model first inside it; the rest of
67
+ * the list stays as fallback. An unknown provider is ignored with a warning.
68
+ */
69
+ export function buildTaskTitlePlan(
70
+ env: Record<string, string | undefined> = process.env,
71
+ ): readonly TaskTitleCandidateGroup[] {
72
+ const pinned = env[TASK_TITLE_MODEL_ENV]?.trim();
73
+ if (!pinned) return TASK_TITLE_MODEL_CANDIDATES;
74
+ const kind = kindForModelString(pinned);
75
+ if (!kind) {
76
+ console.warn(
77
+ `[task-title] ${TASK_TITLE_MODEL_ENV}=${pinned} names an unsupported provider; ignored`,
78
+ );
79
+ return TASK_TITLE_MODEL_CANDIDATES;
80
+ }
81
+ const own = TASK_TITLE_MODEL_CANDIDATES.find((group) => group.kind === kind);
82
+ const rest = TASK_TITLE_MODEL_CANDIDATES.filter((group) => group.kind !== kind);
83
+ const models = [pinned, ...(own?.models ?? []).filter((model) => model !== pinned)];
84
+ return [{ kind, models }, ...rest];
85
+ }
86
+
87
+ const SIBLING_OPEN = "<sibling_tasks_in_progress>";
88
+ const SIBLING_CLOSE = "</sibling_tasks_in_progress>";
89
+
90
+ /**
91
+ * Task text as the model should see it: without the sibling-awareness block
92
+ * the API prepends to child tasks, with runs of blank lines collapsed, and cut
93
+ * to `TASK_TITLE_MAX_TASK_CHARS`.
94
+ */
95
+ export function prepareTaskTextForTitle(task: string): string {
96
+ let text = task;
97
+ if (text.startsWith(SIBLING_OPEN)) {
98
+ const close = text.indexOf(SIBLING_CLOSE);
99
+ if (close !== -1) text = text.slice(close + SIBLING_CLOSE.length);
100
+ }
101
+ text = text
102
+ .replace(/\r\n?/g, "\n")
103
+ .replace(/\n{3,}/g, "\n\n")
104
+ .trim();
105
+ if (text.length > TASK_TITLE_MAX_TASK_CHARS) {
106
+ text = `${text.slice(0, TASK_TITLE_MAX_TASK_CHARS).trimEnd()} …`;
107
+ }
108
+ return text;
109
+ }
110
+
111
+ const WRAPPING_QUOTES: ReadonlyArray<[string, string]> = [
112
+ ['"', '"'],
113
+ ["'", "'"],
114
+ ["“", "”"],
115
+ ["‘", "’"],
116
+ ["`", "`"],
117
+ ["«", "»"],
118
+ ];
119
+
120
+ /**
121
+ * Clean a model-produced title: one line, no wrapping quotes or `Title:`
122
+ * prefix, no markdown emphasis, no trailing sentence punctuation, at most
123
+ * `TASK_TITLE_MAX_CHARS` (cut at a word boundary). Empty string when nothing
124
+ * usable remains.
125
+ */
126
+ export function normalizeTaskTitle(raw: string): string {
127
+ let title = raw.replace(/\s+/g, " ").trim();
128
+ title = title.replace(/^title\s*:\s*/i, "");
129
+ title = title.replace(/\*\*|__|^#+\s*/g, "");
130
+ const stripTrailingPunctuation = () => {
131
+ title = title.replace(/[.!…]+$/u, "").trim();
132
+ };
133
+ // Quotes can sit inside or outside the trailing punctuation: `"Title".` and `"Title…"`.
134
+ stripTrailingPunctuation();
135
+ for (const [open, close] of WRAPPING_QUOTES) {
136
+ if (title.length >= 2 && title.startsWith(open) && title.endsWith(close)) {
137
+ title = title.slice(open.length, title.length - close.length).trim();
138
+ }
139
+ }
140
+ stripTrailingPunctuation();
141
+ if (title.length > TASK_TITLE_MAX_CHARS) {
142
+ const cut = title.slice(0, TASK_TITLE_MAX_CHARS);
143
+ const lastSpace = cut.lastIndexOf(" ");
144
+ title = (lastSpace >= TASK_TITLE_MAX_CHARS / 2 ? cut.slice(0, lastSpace) : cut).trimEnd();
145
+ title = title.replace(/[,;:\-–—]+$/u, "").trimEnd();
146
+ }
147
+ return title;
148
+ }
149
+
150
+ export const TASK_TITLE_SYSTEM_PROMPT = [
151
+ "You write titles for tasks on a software team's dashboard.",
152
+ "Rules:",
153
+ "- 3 to 8 words, at most 80 characters.",
154
+ "- Sentence case. No trailing period. No quotes, markdown, emoji, or task ids.",
155
+ "- Name the concrete subject (feature, bug, repo, file, system, person), not a generic verb alone.",
156
+ "- Keep the language of the request.",
157
+ "- Ignore pasted logs, code, and context blocks; title the request itself.",
158
+ "Call the set_title tool with the title.",
159
+ ].join("\n");
160
+
161
+ export const TASK_TITLE_TOOL_NAME = "set_title";
162
+
163
+ const TaskTitleZodSchema = z.object({ title: z.string().trim().min(1).max(200) });
164
+ const TaskTitleToolSchema = Type.Object({
165
+ title: Type.String({ minLength: 1, maxLength: 200, description: "The task title." }),
166
+ });
167
+
168
+ export interface GenerateTaskTitleOptions {
169
+ /** Full task prompt as stored on the task. */
170
+ task: string;
171
+ /** Credential lookup env. Defaults to `process.env`. */
172
+ env?: Record<string, string | undefined>;
173
+ /** Optional loopback context for the codex OAuth probe (see `resolveCredentials`). */
174
+ apiUrl?: string;
175
+ apiKey?: string;
176
+ signal?: AbortSignal;
177
+ /** Diagnostic tag forwarded to `completeStructured` logs. */
178
+ callerTag?: string;
179
+ // Test injection points:
180
+ _resolveCredentials?: typeof resolveCredentials;
181
+ _completeStructured?: typeof completeStructuredWithModel;
182
+ }
183
+
184
+ export type GenerateTaskTitleResult =
185
+ | { ok: true; title: string; model: string; kind: CredentialKind }
186
+ | { ok: false; reason: "short-task" | "no-credentials" | "all-models-failed" };
187
+
188
+ /**
189
+ * Generate a title for `task`. Never throws: a provider error moves on to the
190
+ * next candidate, and exhausting the list returns `{ ok: false }`.
191
+ */
192
+ export async function generateTaskTitle(
193
+ opts: GenerateTaskTitleOptions,
194
+ ): Promise<GenerateTaskTitleResult> {
195
+ const text = prepareTaskTextForTitle(opts.task);
196
+ if (text.length < TASK_TITLE_MIN_TASK_CHARS) return { ok: false, reason: "short-task" };
197
+
198
+ const env = opts.env ?? process.env;
199
+ const resolve = opts._resolveCredentials ?? resolveCredentials;
200
+ const complete = opts._completeStructured ?? completeStructuredWithModel;
201
+ const callerTag = opts.callerTag ?? "task-title";
202
+ const plan = buildTaskTitlePlan(env);
203
+
204
+ // One lookup per kind, on demand, so the codex OAuth probe (an HTTP call
205
+ // that can rotate a refresh token) runs only when its turn comes.
206
+ const credentialCache = new Map<CredentialKind, ResolvedCredential | null>();
207
+ const credentialFor = async (kind: CredentialKind): Promise<ResolvedCredential | null> => {
208
+ const cached = credentialCache.get(kind);
209
+ if (cached !== undefined) return cached;
210
+ const [cred] = await resolve({
211
+ env,
212
+ apiUrl: opts.apiUrl,
213
+ apiKey: opts.apiKey,
214
+ callerTag,
215
+ kinds: [kind],
216
+ limit: 1,
217
+ });
218
+ credentialCache.set(kind, cred ?? null);
219
+ return cred ?? null;
220
+ };
221
+
222
+ let sawCredential = false;
223
+ for (const group of plan) {
224
+ if (opts.signal?.aborted) break;
225
+ const cred = await credentialFor(group.kind);
226
+ if (!cred) continue;
227
+ sawCredential = true;
228
+ for (const model of group.models) {
229
+ if (opts.signal?.aborted) break;
230
+ const title = await attemptTitle(complete, {
231
+ cred,
232
+ model,
233
+ text,
234
+ env,
235
+ callerTag,
236
+ signal: opts.signal,
237
+ });
238
+ if (title) return { ok: true, title, model, kind: cred.kind };
239
+ }
240
+ }
241
+ return { ok: false, reason: sawCredential ? "all-models-failed" : "no-credentials" };
242
+ }
243
+
244
+ interface TitleAttempt {
245
+ cred: ResolvedCredential;
246
+ model: string;
247
+ text: string;
248
+ env: Record<string, string | undefined>;
249
+ callerTag: string;
250
+ signal?: AbortSignal;
251
+ }
252
+
253
+ /** One model call. `completeStructuredWithModel` swallows provider errors; a throw here is still just a miss. */
254
+ async function attemptTitle(
255
+ complete: typeof completeStructuredWithModel,
256
+ attempt: TitleAttempt,
257
+ ): Promise<string> {
258
+ try {
259
+ const result = await complete({
260
+ zodSchema: TaskTitleZodSchema,
261
+ toolSchema: TaskTitleToolSchema,
262
+ toolName: TASK_TITLE_TOOL_NAME,
263
+ toolDescription: "Record the title for this task.",
264
+ systemPrompt: TASK_TITLE_SYSTEM_PROMPT,
265
+ userPrompt: `Task request:\n\n${attempt.text}`,
266
+ env: attempt.env,
267
+ retries: 1,
268
+ signal: attempt.signal,
269
+ callerTag: `${attempt.callerTag}:${attempt.model}`,
270
+ _credentialOverride: { ...attempt.cred, modelDefault: attempt.model },
271
+ });
272
+ return result ? normalizeTaskTitle(result.data.title) : "";
273
+ } catch (error) {
274
+ // Provider errors can echo request fragments; scrub before logging.
275
+ console.error(
276
+ scrubSecrets(
277
+ `[task-title] ${attempt.model} threw: ${error instanceof Error ? error.message : String(error)}`,
278
+ ),
279
+ );
280
+ return "";
281
+ }
282
+ }
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Task `outputSchema` presence rules, shared by the API server and workers.
3
+ *
4
+ * An explicit empty schema (`{}`) means "no output schema". Callers pass it on
5
+ * purpose to stop a child task from inheriting the parent's schema. It must
6
+ * never reach a harness as a contract: a worker told to return JSON matching
7
+ * `{}` completes with the literal output "{}" and drops its real result.
8
+ */
9
+
10
+ /** True when `schema` is a non-empty JSON Schema object the task must satisfy. */
11
+ export function isEffectiveOutputSchema(schema: unknown): schema is Record<string, unknown> {
12
+ return (
13
+ !!schema &&
14
+ typeof schema === "object" &&
15
+ !Array.isArray(schema) &&
16
+ Object.keys(schema).length > 0
17
+ );
18
+ }
19
+
20
+ /** Returns the schema when it is effective, otherwise `undefined`. */
21
+ export function normalizeOutputSchema(schema: unknown): Record<string, unknown> | undefined {
22
+ return isEffectiveOutputSchema(schema) ? schema : undefined;
23
+ }
@@ -27,7 +27,9 @@
27
27
  */
28
28
  import { createHmac, randomBytes, timingSafeEqual } from "node:crypto";
29
29
  import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
30
+ import type { IncomingHttpHeaders } from "node:http";
30
31
  import path from "node:path";
32
+ import { isDevOrTestNodeEnv } from "./node-env";
31
33
 
32
34
  const ENV_SECRET = "PAGE_SESSION_SECRET";
33
35
  const ENV_SECRET_FILE = "PAGE_SESSION_SECRET_FILE";
@@ -336,6 +338,41 @@ export async function extractAndVerifyCookie(
336
338
  */
337
339
  const PAGE_SESSION_TTL_SECONDS = 3600;
338
340
 
341
+ const LOCAL_DEV_HOSTNAMES = new Set(["localhost", "127.0.0.1"]);
342
+
343
+ /** True only for a parsed `http:` URL whose hostname is exactly a loopback dev name. */
344
+ function isLocalHttpUrl(value: string): boolean {
345
+ try {
346
+ const url = new URL(value);
347
+ return url.protocol === "http:" && LOCAL_DEV_HOSTNAMES.has(url.hostname);
348
+ } catch {
349
+ return false;
350
+ }
351
+ }
352
+
353
+ /**
354
+ * Decide the `dev` flag for `issuePageSessionCookie`. Shared by the launch
355
+ * endpoint (`src/http/pages.ts`) and the password flow on `/p/:id`
356
+ * (`src/http/pages-public.ts`) so both issue the same cookie.
357
+ *
358
+ * Fails closed: only an explicit development or test NODE_ENV can soften the
359
+ * cookie. Deployed images leave NODE_ENV unset and get `SameSite=None; Secure`.
360
+ * In dev, the request must come from `http://localhost` or `http://127.0.0.1`
361
+ * (parsed, so `http://localhost.evil.example` does not match). Without an
362
+ * Origin, the Host header decides; a missing Host counts as local.
363
+ * Anything else, including portless `https://*.localhost`, keeps
364
+ * `SameSite=None; Secure` so the cookie travels on cross-site fetches.
365
+ * Chrome treats localhost as a secure context, so Secure also works over http.
366
+ */
367
+ export function isLocalDevPageRequest(req: { headers: IncomingHttpHeaders }): boolean {
368
+ if (!isDevOrTestNodeEnv()) return false;
369
+ const origin = req.headers.origin ?? "";
370
+ if (origin !== "") return isLocalHttpUrl(origin);
371
+ const host = req.headers.host;
372
+ if (!host) return true;
373
+ return isLocalHttpUrl(`http://${host}`);
374
+ }
375
+
339
376
  /**
340
377
  * Mint a signed page-session token + build the `Set-Cookie` header value for
341
378
  * `pageId`. Shared by the bearer-authed launch endpoint (`src/http/pages.ts`)
@@ -51,7 +51,7 @@ export interface SystemOneBuiltEndpoint {
51
51
  /** What the value is, for messages: "the account id of a Cloudflare account". */
52
52
  readonly describe: string;
53
53
  /** Request URL, or null when the value is not usable. `model` is already allowlisted. */
54
- readonly build: (value: string, model: string) => string | null;
54
+ readonly build: (value: string, model: string, env: NodeJS.ProcessEnv) => string | null;
55
55
  }
56
56
 
57
57
  export type SystemOneEndpoint = string | SystemOneConfiguredEndpoint | SystemOneBuiltEndpoint;
@@ -155,11 +155,30 @@ async function readFirstGlobalConfig(
155
155
  const CLOUDFLARE_ENDPOINT: SystemOneBuiltEndpoint = {
156
156
  configKey: CLOUDFLARE_ACCOUNT_KEY,
157
157
  describe: "the 32-character id of a Cloudflare account",
158
- build: (accountId, model) => {
158
+ build: (accountId, model, env) => {
159
159
  const id = accountId.trim();
160
- return CLOUDFLARE_ACCOUNT_RE.test(id)
161
- ? `https://api.cloudflare.com/client/v4/accounts/${id}/ai/run/@cf/cloudflare/${model}`
162
- : null;
160
+ if (!CLOUDFLARE_ACCOUNT_RE.test(id)) return null;
161
+ const path = `/client/v4/accounts/${id}/ai/run/@cf/cloudflare/${model}`;
162
+ // Test traffic can reach a local mock. Config rows cannot set this reserved key.
163
+ if (env.NODE_ENV === "test" && env.CLOUDFLARE_API_BASE_URL) {
164
+ try {
165
+ const url = new URL(env.CLOUDFLARE_API_BASE_URL);
166
+ if (
167
+ url.protocol === "http:" &&
168
+ LOOPBACK_HOSTS.has(url.hostname) &&
169
+ url.pathname === "/" &&
170
+ !url.username &&
171
+ !url.password &&
172
+ !url.search &&
173
+ !url.hash
174
+ ) {
175
+ return `${url.origin}${path}`;
176
+ }
177
+ } catch {
178
+ // Ignore an invalid override and use the production endpoint.
179
+ }
180
+ }
181
+ return `https://api.cloudflare.com${path}`;
163
182
  },
164
183
  };
165
184
 
@@ -576,7 +595,7 @@ export async function resolveSystemOneTarget(
576
595
  errors.push(systemOneUrlMissingMessage(id, capability));
577
596
  } else {
578
597
  const resolved = isBuiltEndpoint(service.endpoint)
579
- ? service.endpoint.build(base, overrides.model ?? service.defaultModel ?? "")
598
+ ? service.endpoint.build(base, overrides.model ?? service.defaultModel ?? "", ctx.env)
580
599
  : systemOneEndpointFromBase(base, service.endpoint.path);
581
600
  if (resolved) endpoint = resolved;
582
601
  else errors.push(systemOneUrlInvalidMessage(id, capability));
@@ -254,6 +254,12 @@ async function completeIfSettled(runId: string, ctx: Record<string, unknown>): P
254
254
  * Check waiting runs whose linked tasks may have completed/failed/cancelled
255
255
  * while the server was down.
256
256
  */
257
+ function recoveredTaskReason(taskStatus: string): string {
258
+ if (taskStatus === "failed") return "Task failed (recovered)";
259
+ if (taskStatus === "skipped") return "Task skipped (recovered)";
260
+ return "Task cancelled (recovered)";
261
+ }
262
+
257
263
  async function recoverWaitingRuns(registry: ExecutorRegistry): Promise<number> {
258
264
  const stuckRuns = await getStuckWorkflowRuns();
259
265
  let recovered = 0;
@@ -288,8 +294,7 @@ async function recoverWaitingRuns(registry: ExecutorRegistry): Promise<number> {
288
294
  // Claimed: this sweep runs on every heartbeat, so the live task.failed
289
295
  // bus event may already have routed this step — a blind write here
290
296
  // would kill a run that is already advancing.
291
- const reason =
292
- stuck.taskStatus === "failed" ? "Task failed (recovered)" : "Task cancelled (recovered)";
297
+ const reason = recoveredTaskReason(stuck.taskStatus);
293
298
  const failed = await failStepAndRunIfWaiting(
294
299
  workflow.definition,
295
300
  stuck.stepId,
@@ -304,8 +309,7 @@ async function recoverWaitingRuns(registry: ExecutorRegistry): Promise<number> {
304
309
  }
305
310
 
306
311
  const ctx = (run.context ?? {}) as Record<string, unknown>;
307
- const reason =
308
- stuck.taskStatus === "failed" ? "Task failed (recovered)" : "Task cancelled (recovered)";
312
+ const reason = recoveredTaskReason(stuck.taskStatus);
309
313
  const stepOutput = {
310
314
  taskId: stuck.taskId,
311
315
  taskOutput: taskCompleted
@@ -144,6 +144,24 @@ export function setupWorkflowResumeListener(
144
144
  };
145
145
  eventBus.on("task.cancelled", onTaskCancelled);
146
146
 
147
+ // A skipped task did not do the node's work: route it like a cancel, never
148
+ // as a success, so the node's failure policy decides what happens next.
149
+ const onTaskSkipped = async (data: unknown) => {
150
+ try {
151
+ const event = data as TaskEvent;
152
+ if (!event.workflowRunId || !event.workflowRunStepId) return;
153
+ await handleTaskFailure(
154
+ event,
155
+ `Task was skipped: ${event.failureReason ?? "no reason given"}`,
156
+ registry,
157
+ { retryable: false },
158
+ );
159
+ } catch (err) {
160
+ console.error("[workflows] Handle task skip error:", err);
161
+ }
162
+ };
163
+ eventBus.on("task.skipped", onTaskSkipped);
164
+
147
165
  const onApprovalResolved = async (data: unknown) => {
148
166
  try {
149
167
  const event = data as ApprovalEvent;
@@ -170,6 +188,7 @@ export function setupWorkflowResumeListener(
170
188
  eventBus.off("task.completed", onTaskCompleted);
171
189
  eventBus.off("task.failed", onTaskFailed);
172
190
  eventBus.off("task.cancelled", onTaskCancelled);
191
+ eventBus.off("task.skipped", onTaskSkipped);
173
192
  eventBus.off("approval.resolved", onApprovalResolved);
174
193
  eventBus.off("workflow.child.finished", onChildRunFinished);
175
194
  };
@@ -27,7 +27,93 @@ You are Lead. Produce one digest covering workflows, schedule runs, agents, task
27
27
  Call `GET $MCP_BASE_URL/status` and read `status.automations`. List every automation whose state is `needs_setup`, its missing parameters/integrations, and its `fixUrl`. This is the first digest section and the first failure classification; it is setup work, not an automation failure.
28
28
 
29
29
  ### 1B. Workflows and schedules
30
- Run the same six-query set as `daily-workflow-health-audit` Phase 1 (hard-failed workflow runs, hard-failed schedule-spawned tasks, halted >24h runs, silent-empty-output completions, cron-didn't-fire, schedules with ≥3 consecutive errors — all against `workflow_runs` / `agent_tasks` / `scheduled_tasks` via `db-query`), plus:
30
+ Run these six failure-mode queries with `db-query`:
31
+
32
+ **1.** Hard-failed workflow runs (last 24h)
33
+
34
+ ```sql
35
+ SELECT wr.id, w.name AS workflowName, wr.status,
36
+ wr.finishedAt, wr.lastUpdatedAt,
37
+ SUBSTR(COALESCE(wr.error, ''), 1, 220) AS errSnippet
38
+ FROM workflow_runs wr
39
+ JOIN workflows w ON w.id = wr.workflowId
40
+ WHERE wr.status = 'failed'
41
+ AND datetime(COALESCE(wr.finishedAt, wr.lastUpdatedAt, wr.startedAt)) > datetime('now', '-24 hours')
42
+ ORDER BY wr.lastUpdatedAt DESC;
43
+ ```
44
+
45
+ **2.** Hard-failed schedule-spawned tasks (last 24h)
46
+
47
+ ```sql
48
+ SELECT t.id, s.name AS scheduleName, t.status,
49
+ SUBSTR(COALESCE(t.failureReason, ''), 1, 220) AS reasonSnippet,
50
+ SUBSTR(COALESCE(t.output, ''), 1, 220) AS outSnippet,
51
+ t.lastUpdatedAt
52
+ FROM agent_tasks t
53
+ LEFT JOIN scheduled_tasks s ON s.id = t.scheduleId
54
+ WHERE t.status = 'failed'
55
+ AND t.scheduleId IS NOT NULL
56
+ AND datetime(t.lastUpdatedAt) > datetime('now', '-24 hours')
57
+ ORDER BY t.lastUpdatedAt DESC;
58
+ ```
59
+
60
+ **3.** Halted >24h workflow runs (silent stuck)
61
+
62
+ ```sql
63
+ SELECT wr.id, w.name AS workflowName, wr.status, wr.lastUpdatedAt
64
+ FROM workflow_runs wr
65
+ JOIN workflows w ON w.id = wr.workflowId
66
+ WHERE wr.status IN ('running', 'waiting')
67
+ AND datetime(wr.lastUpdatedAt) < datetime('now', '-24 hours')
68
+ ORDER BY wr.lastUpdatedAt ASC;
69
+ ```
70
+
71
+ **4.** Silent: schedule-spawned task completed with empty/sentinel output
72
+
73
+ ```sql
74
+ SELECT t.id, s.name AS scheduleName, t.status,
75
+ SUBSTR(COALESCE(t.output, ''), 1, 220) AS outSnippet,
76
+ LENGTH(TRIM(COALESCE(t.output, ''))) AS outLen,
77
+ t.lastUpdatedAt
78
+ FROM agent_tasks t
79
+ LEFT JOIN scheduled_tasks s ON s.id = t.scheduleId
80
+ WHERE t.status = 'completed'
81
+ AND t.scheduleId IS NOT NULL
82
+ AND datetime(t.lastUpdatedAt) > datetime('now', '-24 hours')
83
+ AND (
84
+ t.output IS NULL
85
+ OR TRIM(t.output) = ''
86
+ OR TRIM(t.output) = '⚡ Running shell command'
87
+ OR LENGTH(TRIM(t.output)) < 10
88
+ )
89
+ ORDER BY t.lastUpdatedAt DESC;
90
+ ```
91
+
92
+ **5.** Cron didn't fire (nextRunAt in the past)
93
+
94
+ ```sql
95
+ SELECT s.id, s.name, s.cronExpression, s.lastRunAt, s.nextRunAt, s.consecutiveErrors,
96
+ SUBSTR(COALESCE(s.lastErrorMessage, ''), 1, 220) AS lastErrSnippet
97
+ FROM scheduled_tasks s
98
+ WHERE s.enabled = 1
99
+ AND s.scheduleType = 'recurring'
100
+ AND s.nextRunAt IS NOT NULL
101
+ AND datetime(s.nextRunAt) < datetime('now', '-1 hour')
102
+ ORDER BY s.nextRunAt ASC;
103
+ ```
104
+
105
+ **6.** Schedules with consecutive errors (defensive)
106
+
107
+ ```sql
108
+ SELECT s.id, s.name, s.cronExpression, s.consecutiveErrors, s.lastErrorAt,
109
+ SUBSTR(COALESCE(s.lastErrorMessage, ''), 1, 220) AS lastErrSnippet
110
+ FROM scheduled_tasks s
111
+ WHERE s.enabled = 1
112
+ AND s.consecutiveErrors >= 3
113
+ ORDER BY s.consecutiveErrors DESC;
114
+ ```
115
+
116
+ Plus:
31
117
  - Enabled/disabled counts: `SELECT enabled, COUNT(*) FROM scheduled_tasks GROUP BY enabled` and the workflow equivalent.
32
118
  - 7-day rollup, not just 24h: repeat the hard-failure and cron-didn't-fire queries with a `-7 days` window for a weekly trend line.
33
119
 
@@ -87,7 +173,7 @@ More than 3 qualify ⇒ post the 3 that matter and put the rest in the task outp
87
173
  `store-progress` with `status: "completed"`. **This is where the detail goes** — every count from Phase 1, the per-class failure breakdown, and the Slack message ts. The Slack post is the headline; the task output is the record. Cutting the post does not mean cutting the work.
88
174
 
89
175
  ## Anti-patterns
90
- - ❌ Modifying anything — this schedule reports, it doesn't fix (that's `daily-workflow-health-audit` for plumbing and `daily-compounding-reflection` for agent/skill/memory evolution).
176
+ - ❌ Modifying anything — this schedule reports, it doesn't fix (that's `daily-compounding-reflection` for agent/skill/memory evolution).
91
177
  - ❌ Folding the unclassified-failure bucket into "real defect" to make the number look more actionable than it is.
92
178
  - ❌ Narrating a zero. The all-clear line already covers `needs_setup` and integrations; only a non-verified integration or a real `needs_setup` automation earns its own line.
93
179
  - ❌ Exceeding 600 characters, or posting more than one message.
@@ -2,48 +2,24 @@
2
2
 
3
3
  Zero-config auto-update watchdog: compares the swarm's own running version against the latest published GitHub release of `desplega-ai/agent-swarm`, and flags the operator when an upgrade is available. No placeholders and no integration required — every install gets this by default.
4
4
 
5
- ## Schedule
6
-
7
- ```json
8
- {"cron":"0 9 * * *","timezone":"UTC","agentRole":"lead","enabled":true}
9
- ```
10
-
11
- ## Scheduled Task
12
-
13
- This schedule runs by default. It needs no repository clone and no integration — it only reads its own task metadata and calls the public GitHub API.
14
-
15
- Task Type: Daily Agent-Swarm Update Check
16
-
17
- You are Lead. Determine whether a newer `desplega-ai/agent-swarm` release is published than the version currently running on this install, and tell the operator if so.
18
-
19
- ## Phase 1 — Determine the running version
5
+ This is a script schedule: each fire runs the global `swarm-update-check` script directly, with no agent task in between. The script:
20
6
 
21
- Call `get-task-details` for THIS task's own id and read `task.swarmVersion` — the API server stamps every task with the `package.json` version it was running at task-creation time, so this is the version currently deployed on this install.
7
+ 1. Reads the running version from the API server's own `/health` route.
8
+ 2. Fetches `https://api.github.com/repos/desplega-ai/agent-swarm/releases/latest` once and reads `tag_name` and `html_url`.
9
+ 3. Compares the two as numeric `major.minor.patch`, never as strings (`"1.9.0" < "1.10.0"` is false as strings).
10
+ 4. Only when the latest release is newer, sends the lead one task to post the notice to its configured admin delivery channel (the in-app fallback if none is configured).
22
11
 
23
- If `swarmVersion` is missing or empty (an older install, or the field predates this schedule), complete with `output`: `"Unable to determine running version — swarmVersion not set on this task."` and stop. Do not guess a version.
12
+ Up to date, a missing running version (reported as `unknown`, never as up to date) and an unreachable GitHub API all end the run without any agent task. A failed GitHub call is reported once and never retried in a loop. The check never attempts the upgrade; `weekly-harness-upgrade-check` is the separate routine that bumps pinned harness versions inside the repo.
24
13
 
25
- ## Phase 2 — Fetch the latest published release
14
+ ## Schedule
26
15
 
27
- ```bash
28
- curl -fsSL https://api.github.com/repos/desplega-ai/agent-swarm/releases/latest
16
+ ```json
17
+ {
18
+ "cron": "0 9 * * *",
19
+ "timezone": "UTC",
20
+ "enabled": true,
21
+ "targetType": "script",
22
+ "scriptName": "swarm-update-check",
23
+ "scriptArgs": {}
24
+ }
29
25
  ```
30
-
31
- Read `.tag_name` (strip a leading `v` if present) and `.html_url`. If the request fails (network, rate limit, non-200), complete with `output`: `"Could not reach GitHub releases API: <error>"` and stop — do not retry in a loop.
32
-
33
- ## Phase 3 — Compare and act
34
-
35
- Compare the two versions as dotted numeric triples (major.minor.patch) — never as plain strings (`"1.9.0" < "1.10.0"` is false as strings).
36
-
37
- - **Latest <= running:** complete with `output`: `"Up to date: running <running>, latest published <latest>."` No further action.
38
- - **Latest > running:** raise it for the operator:
39
- 1. Post a short message to your configured admin delivery channel (or the in-app fallback if none is configured) naming the running version, the new version, and the release URL.
40
- 2. Complete `store-progress` with `status: "completed"` and `output`: `"Update available: running <running>, latest <latest> — <releaseUrl>"`.
41
-
42
- Do not attempt the upgrade yourself — this schedule only detects and reports. `weekly-harness-upgrade-check` is the separate routine that bumps pinned harness versions inside the repo; this schedule is about the agent-swarm release itself.
43
-
44
- ## Anti-patterns
45
-
46
- - ❌ Cloning the repo or reading `package.json` from disk — this schedule must work on any install, including ones where the API pod has no repo checkout.
47
- - ❌ String-comparing versions.
48
- - ❌ Treating a missing `swarmVersion` as "no update available" — it's "unknown", say so explicitly.
49
- - ❌ Retrying a failed GitHub API call in a loop.
@@ -133,7 +133,7 @@ Use `{ "$state": "/user/<field>" }` on a page for the read-only current-user bin
133
133
 
134
134
  ### Theming
135
135
 
136
- An optional top-level `"theme"` sets the preset the dashboard applies to the app's rendered canvas — a lowercase slug validated by shape only. The preset catalog ships with the dashboard (`apps/ui/src/lib/themes.ts` + `theme-classics.ts` — update this list and the `app-upsert` tool description when it changes); current ids: `hive` (the stock look), the accent/field presets `meadow`, `iris`, `rose`, `cobalt`, `ember`, `carbon`, and the classic editor/platform presets `github`, `vscode`, `material`, `solarized`, `tokyo`, `monokai`, `gruvbox`, `catppuccin`. Action and destructive tones are never themed; status tones are themed ONLY by the classic presets (their identity includes a status palette — hue semantics stay fixed, success reads green and error reads red everywhere). An id the viewer's dashboard build does not know degrades to the dashboard's own theme, so unknown slugs are safe but pointless. Omit `theme` to inherit whatever theme the viewer runs; `"hive"` is an explicit reset to the stock look even inside a themed dashboard.
136
+ An optional top-level `"theme"` sets the preset the dashboard applies to the app's rendered canvas: a lowercase slug validated by shape only. The preset catalog ships with the dashboard and lives in `src/themes/presets.ts` and `src/themes/classics.ts`. Update this list and the `app-upsert` tool description when it changes. Current ids: `hive` (the stock look), the accent/field presets `meadow`, `iris`, `rose`, `cobalt`, `ember`, `carbon`, `paper` (the warm editorial paper look), and the classic editor/platform presets `github`, `vscode`, `material`, `solarized`, `tokyo`, `monokai`, `gruvbox`, `catppuccin`. Action and destructive tones are never themed; status tones are themed ONLY by the classic presets (their identity includes a status palette: hue semantics stay fixed, success reads green and error reads red everywhere). An id the viewer's dashboard build does not know degrades to the dashboard's own theme, so unknown slugs are safe but pointless. Omit `theme` to inherit whatever theme the viewer runs; `"hive"` is an explicit reset to the stock look even inside a themed dashboard.
137
137
 
138
138
  Viewers can override the preset per app from the app's settings drawer; the override rides the reserved `$theme` key of the user-config values (accepted on every app, even without a declared `userConfig` schema, and never visible at `/user/...`). A present override always beats the definition's `theme` — even an unrecognized one, which degrades to the dashboard theme — so treat `theme` as the app's default styling, not a guarantee.
139
139