@desplega.ai/agent-swarm 2.7.10 → 2.8.1

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 (296) hide show
  1. package/dist/acp-adapter-pdy3qsvg.js +15 -0
  2. package/dist/{actions-b8aqhrsg.js → actions-pwjpn0j6.js} +19 -20
  3. package/dist/{amp-adapter-4c165vgn.js → amp-adapter-cq9jgj6x.js} +2 -3
  4. package/dist/{app-m9khefrh.js → app-cnfffgwg.js} +3 -3
  5. package/dist/{assistant-rh4v3ntz.js → assistant-kpn317y1.js} +21 -22
  6. package/dist/{boot-args-schema-hwkc8bzv.js → boot-args-schema-pbbnhmc3.js} +1 -1
  7. package/dist/{boot-reembed-fdyk55h4.js → boot-reembed-9m0ysxma.js} +1 -1
  8. package/dist/{boot-reembed-5y6yw9sj.js → boot-reembed-majbn53m.js} +1 -1
  9. package/dist/{boot-scrub-sweep-r5r8kqsn.js → boot-scrub-sweep-app8g8ym.js} +3 -3
  10. package/dist/{boot-seeds-8f9zt5cm.js → boot-seeds-pbtmvcjm.js} +4 -5
  11. package/dist/{claude-adapter-s5df247c.js → claude-adapter-wn1g3qp5.js} +7 -8
  12. package/dist/{claude-managed-adapter-h74d06yz.js → claude-managed-adapter-jh6c523j.js} +3 -3
  13. package/dist/{claude-managed-setup-9gsmwzyx.js → claude-managed-setup-pd47nzch.js} +6 -6
  14. package/dist/{claude-sdk-session-dq1j4nz9.js → claude-sdk-session-3a2a6589.js} +9066 -8818
  15. package/dist/{cli-n5yexkdg.js → cli-0b4zam62.js} +1 -0
  16. package/dist/{cli-5wfz00be.js → cli-0jzra9ad.js} +2 -2
  17. package/dist/{cli-zjphdj1a.js → cli-0ntbxyaa.js} +40 -18
  18. package/dist/{cli-yz7v0sh4.js → cli-1xh9a7hn.js} +4 -6
  19. package/dist/{cli-eqtfgfr6.js → cli-2gxeg5gr.js} +1 -1
  20. package/dist/{cli-hfkwwy1h.js → cli-2zp0et3v.js} +21 -2
  21. package/dist/{cli-6m6b4bep.js → cli-3rkdne1h.js} +2 -2
  22. package/dist/{cli-mr97t7cc.js → cli-4r05hnqa.js} +263 -14
  23. package/dist/{cli-jc1g9ndz.js → cli-5j88qqa8.js} +10 -5
  24. package/dist/{cli-xfjrc279.js → cli-5mrq3ake.js} +48 -14
  25. package/dist/{cli-an1knn2k.js → cli-6mma83xa.js} +5 -5
  26. package/dist/{cli-tph5wt3y.js → cli-6wj7p986.js} +1 -1
  27. package/dist/{cli-t73cas91.js → cli-7349va39.js} +8100 -7620
  28. package/dist/{cli-5xcb8gxq.js → cli-7b8sbmag.js} +8 -8
  29. package/dist/{cli-3xj33nrx.js → cli-7cp6aa1q.js} +10 -3
  30. package/dist/{cli-mp9aa8g5.js → cli-7p1kvkck.js} +6 -6
  31. package/dist/{cli-j7d73g1y.js → cli-7w69ne2f.js} +3035 -354
  32. package/dist/{cli-cr14kftt.js → cli-89cqnasv.js} +3 -3
  33. package/dist/{cli-w3bk0dgv.js → cli-8aes17e4.js} +2 -2
  34. package/dist/{cli-7wz05bx3.js → cli-93k32c37.js} +468 -745
  35. package/dist/{cli-eqk5p56g.js → cli-9vhebtjz.js} +9 -9
  36. package/dist/{cli-td33w98c.js → cli-9wngrawf.js} +10 -10
  37. package/dist/cli-a3b239vq.js +242 -0
  38. package/dist/{cli-kx4c8j05.js → cli-b085njxz.js} +63 -19
  39. package/dist/{cli-8ewkreqd.js → cli-b5rs97a6.js} +7 -9
  40. package/dist/{cli-bxz823sz.js → cli-b8e9nb04.js} +1 -1
  41. package/dist/{cli-nj3x45rw.js → cli-bb431xey.js} +52 -43
  42. package/dist/{cli-36wdfzgn.js → cli-bsywb58a.js} +8 -8
  43. package/dist/{cli-18qt3few.js → cli-cyhbbd1z.js} +1 -1
  44. package/dist/{cli-eb2azq8n.js → cli-d3p5vwbk.js} +9 -9
  45. package/dist/{cli-2tsfpc70.js → cli-dy32zecz.js} +1 -1
  46. package/dist/{cli-rjyghzg4.js → cli-g70vxtjh.js} +2 -2
  47. package/dist/{cli-55bkx8hh.js → cli-gax7fk3t.js} +1 -1
  48. package/dist/{cli-jg24scat.js → cli-jcpr5smb.js} +3 -3
  49. package/dist/{cli-n07eecjs.js → cli-jywyhqws.js} +3 -3
  50. package/dist/{cli-38yww4e9.js → cli-k0615eh8.js} +8 -8
  51. package/dist/{cli-3xddv0rk.js → cli-k26bkr9t.js} +5 -7
  52. package/dist/{cli-xd5ebp64.js → cli-k93bq1wq.js} +3 -3
  53. package/dist/{cli-f2zenhja.js → cli-kc7v1nfv.js} +1 -1
  54. package/dist/{cli-x9exydey.js → cli-m4dqmnbp.js} +1 -1
  55. package/dist/{cli-gpwhbgx0.js → cli-m9s2qff2.js} +57 -25
  56. package/dist/{cli-ybjdc978.js → cli-mrt48bx7.js} +7 -4
  57. package/dist/{cli-ttbqe3q4.js → cli-p1w18yhx.js} +1 -1
  58. package/dist/{cli-h49ejvmc.js → cli-pcad4cb1.js} +1 -1
  59. package/dist/{cli-tmft5dz2.js → cli-qmqk2yc2.js} +1 -1
  60. package/dist/{cli-g1px1g2e.js → cli-re4raaj0.js} +1 -1
  61. package/dist/{cli-xbtq4d6s.js → cli-sn7rtnj4.js} +12 -8
  62. package/dist/{cli-n9abj89w.js → cli-syybb0p1.js} +8 -8
  63. package/dist/{cli-v2fwbnsk.js → cli-tacge1w0.js} +6 -6
  64. package/dist/{cli-pyrxt9gw.js → cli-tk7cjj8h.js} +1 -1
  65. package/dist/{cli-xvymtmv4.js → cli-tqegb8eq.js} +3 -3
  66. package/dist/{cli-kf3pxxdg.js → cli-v1dv1r37.js} +1 -1
  67. package/dist/{cli-z9cs5m0w.js → cli-vbh10fqa.js} +12 -12
  68. package/dist/{cli-3xcwp3z8.js → cli-vj75tyaw.js} +3 -3
  69. package/dist/{cli-xncjscpm.js → cli-vqptjbr7.js} +50 -24
  70. package/dist/{cli-q581b386.js → cli-wk18cm92.js} +5 -5
  71. package/dist/{cli-4vwxp550.js → cli-x1wa213s.js} +1 -1
  72. package/dist/{cli-n9ftpys4.js → cli-x6t50dmw.js} +7 -7
  73. package/dist/{cli-jrp1dt73.js → cli-xzm9vcfg.js} +1 -1
  74. package/dist/{cli-16phend6.js → cli-yn2bbre9.js} +1 -1
  75. package/dist/{cli-rt0ag4x1.js → cli-yncmerje.js} +5 -5
  76. package/dist/{cli-0m7rtm11.js → cli-zcsw143p.js} +1 -1
  77. package/dist/cli.js +18 -18
  78. package/dist/{codex-adapter-yr60sme6.js → codex-adapter-nha71q3n.js} +5 -6
  79. package/dist/{codex-hook-fac6175r.js → codex-hook-h3vk6xzr.js} +1 -1
  80. package/dist/{codex-session-runner-pch8x584.js → codex-session-runner-ak9x1k1h.js} +5 -6
  81. package/dist/{commands-phjfbkv0.js → commands-f587qpq8.js} +3 -3
  82. package/dist/{controller-jkx994pz.js → controller-hxx8wwy1.js} +2 -2
  83. package/dist/{controllers-connect-c4448kwa.js → controllers-connect-k5sg9m9h.js} +20 -21
  84. package/dist/{cursor-adapter-ndebqnm8.js → cursor-adapter-n5nc3mfe.js} +1 -2
  85. package/dist/{db-ef32tbfc.js → db-amm8w15a.js} +10 -2
  86. package/dist/{db-ez6egt6v.js → db-nzf8zb5z.js} +3 -3
  87. package/dist/{devin-adapter-z46ep5ph.js → devin-adapter-xedz98zv.js} +1 -1
  88. package/dist/{dispatcher-g3tt9hs9.js → dispatcher-89zrts8f.js} +18 -19
  89. package/dist/{dsh-adapter-tcyn3099.js → dsh-adapter-nrhbrjz8.js} +1 -2
  90. package/dist/{easter-egg-3d-e36hk5td.js → easter-egg-3d-533knw22.js} +1 -1
  91. package/dist/{embedding-space-4kyh5qqj.js → embedding-space-ezwenjmj.js} +6 -6
  92. package/dist/{embeddings-6a8v4a6t.js → embeddings-np74ht6g.js} +1 -1
  93. package/dist/{execute-3cbg0twf.js → execute-b3mrb1mv.js} +1 -1
  94. package/dist/{external-channel-se646snz.js → external-channel-z46yx9d7.js} +2 -2
  95. package/dist/{fx-adapter-yw795hqq.js → fx-adapter-3q12snn6.js} +7 -8
  96. package/dist/{grok-adapter-ttmcss2j.js → grok-adapter-ahb1w033.js} +7 -8
  97. package/dist/handlers-vbww69re.js +32 -0
  98. package/dist/heartbeat-dt9qw9c8.js +43 -0
  99. package/dist/{hook-hq93y5ej.js → hook-8k6fbz9b.js} +5 -5
  100. package/dist/{hook-g3nhexsy.js → hook-jgcgygex.js} +6 -6
  101. package/dist/{http-5a9p4h6y.js → http-haw4r8ne.js} +284 -142
  102. package/dist/{index-0eny15vj.js → index-2skqtd76.js} +2 -2
  103. package/dist/{index-6haqt3v5.js → index-4a0670yh.js} +8917 -8476
  104. package/dist/index-4xwaf5th.js +32 -0
  105. package/dist/{index-3c5pxbge.js → index-5gk12my8.js} +1 -1
  106. package/dist/{index-w7em4ktq.js → index-d6wkh8ar.js} +2 -2
  107. package/dist/index-f0hcrs8e.js +33 -0
  108. package/dist/{index-rvccek1w.js → index-gjwaqaq8.js} +5 -5
  109. package/dist/{index-e5pfbsys.js → index-hjhfk3ra.js} +3 -3
  110. package/dist/{index-1qw6f2dc.js → index-khe3gp0k.js} +4 -4
  111. package/dist/index-s4ewdma4.js +37 -0
  112. package/dist/{index-hgn3c961.js → index-tez78qj3.js} +979 -36
  113. package/dist/{index-s72rqgsx.js → index-tvfafeyy.js} +1 -1
  114. package/dist/{keepalive-1j4n4dmk.js → keepalive-xn6s7rmg.js} +3 -3
  115. package/dist/lead-6ygbfhbh.js +70 -0
  116. package/dist/{maintenance-dmghacy5.js → maintenance-vdts800b.js} +1 -1
  117. package/dist/{node-je82wjet.js → node-4c5jqxr3.js} +1 -1
  118. package/dist/{oauth-refresh-sweep-yy06c03c.js → oauth-refresh-sweep-094c8wfk.js} +2 -2
  119. package/dist/{onboard-52f9t5dm.js → onboard-v99eh56m.js} +3 -3
  120. package/dist/{opencode-adapter-krnh9jkn.js → opencode-adapter-dsagkhtw.js} +5 -6
  121. package/dist/{otel-impl-xjqz6wjj.js → otel-impl-q7yr9yp0.js} +1 -1
  122. package/dist/{pi-mono-adapter-dbxyp0qv.js → pi-mono-adapter-546cd1cc.js} +9 -9
  123. package/dist/{pricing-refresh-ctdr74pd.js → pricing-refresh-7dh2yase.js} +2 -3
  124. package/dist/{rbac-roles-ehv8s10n.js → rbac-roles-mdmc96p4.js} +3 -3
  125. package/dist/{rbac-roles-q0gr8eyj.js → rbac-roles-npbmdh77.js} +4 -6
  126. package/dist/{registry-hpjfmcfz.js → registry-32b1mft6.js} +1 -1
  127. package/dist/{render-v2-5b6chvcq.js → render-v2-twhhwmms.js} +3 -3
  128. package/dist/{resume-5a5d2845.js → resume-5gsrjd5e.js} +6 -6
  129. package/dist/{runtime-khxszyfp.js → runtime-1hv06jsn.js} +1 -1
  130. package/dist/{session-access-gj0bjhqg.js → session-access-m191x30x.js} +4 -4
  131. package/dist/{session-source-backfill-2sy0krfk.js → session-source-backfill-nt923ask.js} +2 -2
  132. package/dist/{setup-7ssfakk1.js → setup-wv467afy.js} +1 -1
  133. package/dist/{virtual-modules-pjj0knwf.js → virtual-modules-gazyapte.js} +3 -3
  134. package/dist/{work-objects-bf3syvhq.js → work-objects-8zkrpy13.js} +21 -22
  135. package/dist/{worker-follow-up-38xevga6.js → worker-follow-up-cecqszem.js} +18 -19
  136. package/dist/worker-mz5z7kj0.js +70 -0
  137. package/openapi.json +334 -7
  138. package/package.json +5 -5
  139. package/src/apps/definition.ts +11 -0
  140. package/src/apps/store.ts +28 -8
  141. package/src/be/db/model-profiles.ts +147 -38
  142. package/src/be/db/tasks/read.ts +5 -1
  143. package/src/be/db/workflow-run-definitions.ts +117 -0
  144. package/src/be/db.ts +24 -3
  145. package/src/be/memory/constants.ts +14 -1
  146. package/src/be/memory/key-paths.ts +8 -0
  147. package/src/be/memory/providers/sqlite-store.ts +160 -10
  148. package/src/be/memory/task-learning.ts +79 -14
  149. package/src/be/memory/types.ts +24 -1
  150. package/src/be/migrations/279_backfill_learning_expiry.sql +15 -0
  151. package/src/be/migrations/281_model_profiles_pr2.sql +28 -0
  152. package/src/be/migrations/283_workflow_run_definitions.sql +14 -0
  153. package/src/be/model-profile-check.ts +284 -0
  154. package/src/be/model-tier-resolution.ts +112 -12
  155. package/src/be/multi-runtime.ts +27 -0
  156. package/src/be/runtime-pools/routing.ts +52 -4
  157. package/src/be/scripts/typecheck.ts +1 -0
  158. package/src/be/seed-scripts/catalog/dreaming-learnings.ts +552 -0
  159. package/src/be/seed-scripts/catalog/dreaming-memtax-create.ts +389 -14
  160. package/src/be/seed-scripts/catalog/dreaming-memtax.ts +6 -3
  161. package/src/be/seed-scripts/index.ts +9 -0
  162. package/src/be/steering.ts +8 -2
  163. package/src/commands/onboard/agent-fs-version.ts +1 -1
  164. package/src/commands/runner.ts +32 -1
  165. package/src/fs/provider.ts +17 -3
  166. package/src/heartbeat/heartbeat.ts +12 -1
  167. package/src/heartbeat/index.ts +1 -0
  168. package/src/http/agents.ts +56 -4
  169. package/src/http/apps.ts +3 -1
  170. package/src/http/config.ts +2 -6
  171. package/src/http/index.ts +2 -3
  172. package/src/http/model-profiles.ts +58 -10
  173. package/src/http/poll.ts +36 -3
  174. package/src/http/schedules.ts +42 -3
  175. package/src/http/tasks.ts +37 -12
  176. package/src/http/workflows.ts +15 -2
  177. package/src/prompts/session-templates.ts +1 -1
  178. package/src/providers/acp-targets.ts +11 -6
  179. package/src/providers/amp-adapter.ts +1 -1
  180. package/src/providers/claude-sdk-session.ts +132 -23
  181. package/src/providers/codex-skill-resolver.ts +10 -4
  182. package/src/providers/cursor-adapter.ts +1 -1
  183. package/src/providers/devin-skill-resolver.ts +5 -5
  184. package/src/providers/dsh-adapter.ts +1 -1
  185. package/src/scheduler/schedule-task.ts +1 -0
  186. package/src/scripts-runtime/eval-harness.ts +14 -1
  187. package/src/scripts-runtime/executors/types.ts +3 -0
  188. package/src/scripts-runtime/sdk-allowlist.ts +1 -0
  189. package/src/scripts-runtime/swarm-sdk.ts +18 -1
  190. package/src/scripts-runtime/types/stdlib.d.ts +1 -0
  191. package/src/scripts-runtime/types/swarm-sdk.d.ts +1 -0
  192. package/src/server.ts +2 -0
  193. package/src/slack/app.ts +93 -0
  194. package/src/slack/inbound-dispatch.ts +18 -1
  195. package/src/slack/workspace-guard.ts +345 -0
  196. package/src/tasks/task-terminal-effects.ts +4 -0
  197. package/src/tasks/worker-follow-up.ts +102 -2
  198. package/src/tests/acp-adapter.test.ts +82 -0
  199. package/src/tests/apps-icon.test.ts +120 -0
  200. package/src/tests/chained-task-follow-up.test.ts +248 -0
  201. package/src/tests/check-pr-body.test.ts +40 -0
  202. package/src/tests/claude-sdk-lifecycle.test.ts +216 -1
  203. package/src/tests/claude-sdk-process.fixture.ts +57 -0
  204. package/src/tests/codex-skill-resolver.test.ts +31 -0
  205. package/src/tests/credentials-allowlist.test.ts +470 -0
  206. package/src/tests/db-task-read-contract.test.ts +5 -0
  207. package/src/tests/db-task-write-contract.test.ts +5 -0
  208. package/src/tests/deferred-wake-follow-up.test.ts +47 -0
  209. package/src/tests/docs-index-footprint.test.js +3 -3
  210. package/src/tests/dreaming-learnings.test.ts +1395 -0
  211. package/src/tests/dsh-adapter.test.ts +1 -1
  212. package/src/tests/explicit-model-validation.test.ts +2 -0
  213. package/src/tests/fs-provider.test.ts +42 -0
  214. package/src/tests/heartbeat.test.ts +28 -1
  215. package/src/tests/human-free-reclassify.test.ts +5 -1
  216. package/src/tests/list-endpoint-slimming.test.ts +17 -0
  217. package/src/tests/mcp-tools.test.ts +1 -1
  218. package/src/tests/migration-283-workflow-run-definitions.test.ts +69 -0
  219. package/src/tests/model-profile-check.test.ts +387 -0
  220. package/src/tests/model-profiles-api.test.ts +528 -1
  221. package/src/tests/profile-claim.test.ts +415 -3
  222. package/src/tests/profile-tier-alias.test.ts +382 -0
  223. package/src/tests/schedule-profile.test.ts +359 -0
  224. package/src/tests/script-connections.test.ts +6 -0
  225. package/src/tests/script-native-unawaited-drain.test.ts +167 -0
  226. package/src/tests/script-per-script-executor.test.ts +1 -0
  227. package/src/tests/scripts-sdk-bridge-tool-failure.test.ts +141 -0
  228. package/src/tests/seed-scripts.test.ts +2 -2
  229. package/src/tests/slack-inbound-receipts.test.ts +22 -2
  230. package/src/tests/slack-socket-ack.test.ts +16 -1
  231. package/src/tests/slack-workspace-guard.test.ts +905 -0
  232. package/src/tests/steering-core.test.ts +40 -0
  233. package/src/tests/store-progress-learning.test.ts +605 -20
  234. package/src/tests/tool-annotations.test.ts +1 -1
  235. package/src/tests/workflow-convergence.test.ts +46 -40
  236. package/src/tests/workflow-definition-pinning-recovery.test.ts +552 -0
  237. package/src/tests/workflow-definition-pinning.test.ts +645 -0
  238. package/src/tests/workflow-executors.test.ts +16 -7
  239. package/src/tests/workflow-foreach.test.ts +43 -20
  240. package/src/tests/workflow-notify-slack-ready.test.ts +161 -0
  241. package/src/tests/workflow-profile.test.ts +328 -0
  242. package/src/tools/app-upsert.ts +1 -1
  243. package/src/tools/memory-edit.ts +2 -1
  244. package/src/tools/model-profiles/check-model-profile.ts +63 -0
  245. package/src/tools/schedules/create-schedule.ts +45 -4
  246. package/src/tools/schedules/patch-schedule.ts +50 -4
  247. package/src/tools/schedules/update-schedule.ts +50 -4
  248. package/src/tools/script-run.ts +1 -1
  249. package/src/tools/send-task.ts +17 -2
  250. package/src/tools/store-progress.ts +15 -3
  251. package/src/tools/task-action.ts +9 -1
  252. package/src/tools/templates.ts +13 -0
  253. package/src/tools/tool-config.ts +2 -1
  254. package/src/tools/utils.ts +61 -4
  255. package/src/tools/workflows/create-workflow.ts +1 -1
  256. package/src/tools/workflows/retry-workflow-run.ts +1 -1
  257. package/src/tools/workflows/update-workflow.ts +10 -1
  258. package/src/types.ts +56 -1
  259. package/src/utils/credentials.ts +89 -12
  260. package/src/workflows/engine.ts +10 -1
  261. package/src/workflows/executors/agent-task.ts +21 -2
  262. package/src/workflows/executors/foreach.ts +4 -1
  263. package/src/workflows/executors/notify.ts +62 -6
  264. package/src/workflows/executors/sub-workflow.ts +1 -1
  265. package/src/workflows/executors/swarm-script.ts +4 -1
  266. package/src/workflows/foreach-driver.ts +8 -5
  267. package/src/workflows/limits.ts +2 -1
  268. package/src/workflows/model-validation.ts +27 -2
  269. package/src/workflows/patch-definition.ts +3 -1
  270. package/src/workflows/recovery.ts +6 -6
  271. package/src/workflows/resume.ts +9 -9
  272. package/src/workflows/retry-poller.ts +2 -2
  273. package/templates/skills/apps/SKILL.md +2 -0
  274. package/templates/skills/apps/content.md +2 -0
  275. package/templates/skills/code-quality/content.md +12 -0
  276. package/templates/skills/memory/content.md +8 -0
  277. package/templates/skills/scheduling/config.json +1 -1
  278. package/templates/skills/scheduling/content.md +2 -2
  279. package/templates/skills/swarm-docs/content.md +4 -0
  280. package/templates/skills/swarm-extensions/content.md +1 -1
  281. package/templates/skills/swarm-scripts/SKILL.md +2 -2
  282. package/templates/skills/swarm-scripts/content.md +2 -2
  283. package/templates/skills/work-on-task/SKILL.md +2 -0
  284. package/templates/skills/work-on-task/content.md +2 -0
  285. package/templates/workflows/dreaming/content.md +174 -7
  286. package/dist/acp-adapter-srfhs1s9.js +0 -16
  287. package/dist/cli-bzvs88tv.js +0 -339
  288. package/dist/cli-cyn9v8zr.js +0 -748
  289. package/dist/cli-ed6yqpf1.js +0 -779
  290. package/dist/handlers-17wha3ze.js +0 -33
  291. package/dist/heartbeat-gwewgdms.js +0 -42
  292. package/dist/index-8arwq8mw.js +0 -34
  293. package/dist/index-tpw054az.js +0 -38
  294. package/dist/index-waq75j2j.js +0 -31
  295. package/dist/lead-re73kdgc.js +0 -72
  296. package/dist/worker-r8mz7a65.js +0 -72
@@ -48,6 +48,13 @@ import {
48
48
  getDb2,
49
49
  getDbClient2,
50
50
  init_runtime2,
51
+ isRbacEnabled,
52
+ decideAdmission,
53
+ grantLeadEquivalence,
54
+ revokeLeadEquivalence,
55
+ init_elevated_agents,
56
+ can,
57
+ init_rbac,
51
58
  CHAT_SDK_ADAPTER_NAMES,
52
59
  CHAT_SDK_ADAPTER_SCHEMAS,
53
60
  ChatSdkAdaptersDraftSchema,
@@ -61,8 +68,6 @@ import {
61
68
  parseFollowUpGateScheduleIds,
62
69
  isFollowUpGateScheduleId,
63
70
  init_follow_up_gate_schedule_ids,
64
- tierConfigKey,
65
- init_model_tier_keys,
66
71
  isInternalConfigKey,
67
72
  internalConfigKeyError,
68
73
  isReservedConfigKey,
@@ -97,6 +102,14 @@ import {
97
102
  computeContentHash2,
98
103
  getContextVersion2,
99
104
  getContextVersionHistory2,
105
+ taskModelPin,
106
+ init_model_pin,
107
+ upsertModelCatalogOverlay,
108
+ init_model_catalog_store,
109
+ explicitModelErrorForAgent,
110
+ init_model_validation2,
111
+ checkProfileForAgent,
112
+ init_model_profile_check,
100
113
  getTaskById2,
101
114
  hasNonTerminalRerouteDecisionChild2,
102
115
  getAgentCurrentTask2,
@@ -125,11 +138,9 @@ import {
125
138
  findRecentCancelledTaskInThread2,
126
139
  init_read,
127
140
  listModelProfiles,
128
- getModelProfileByName,
129
141
  modelProfileRefError,
130
- getAgentDefaultProfileName,
131
- repoModelOverrideKeys,
132
142
  taskProfileError,
143
+ scheduleProfileUpdate,
133
144
  init_model_profiles,
134
145
  onTaskStarted,
135
146
  init_task_lifecycle_events,
@@ -142,11 +153,13 @@ import {
142
153
  getAuthorizationById,
143
154
  getOAuthTokens,
144
155
  init_oauth,
156
+ LEARNING_TTL_DAYS,
145
157
  LEARNING_DUPLICATE_MIN_SIMILARITY,
146
158
  CANDIDATE_SET_MULTIPLIER,
147
159
  isGraphExpansionEnabled,
148
160
  init_constants2,
149
161
  LONGTERM_ROOT,
162
+ LEARNINGS_ROOT,
150
163
  MEMORY_KEY_PATTERN,
151
164
  MEMORY_KEY_PATTERN_MESSAGE,
152
165
  MEMORY_KEY_MAX_LENGTH,
@@ -206,6 +219,7 @@ import {
206
219
  findAcceptedWorkflowOperation,
207
220
  recordAcceptedWorkflowOperation,
208
221
  init_workflow_idempotency,
222
+ getRunWorkflow2,
209
223
  recordSlackMessage2,
210
224
  getSlackTreeMessageByThread2,
211
225
  markTaskSlackReplySent2,
@@ -361,30 +375,23 @@ import {
361
375
  recordInlineScriptRun2,
362
376
  exports_db,
363
377
  init_db4
364
- } from "./cli-j7d73g1y.js";
378
+ } from "./cli-7w69ne2f.js";
365
379
  import {
366
380
  assertMayActOnOperatorGrantedTarget2,
367
381
  getUserGrant2,
368
382
  init_rbac_roles
369
- } from "./cli-yz7v0sh4.js";
383
+ } from "./cli-1xh9a7hn.js";
370
384
  import {
371
385
  ensurePricingSeeded2,
372
386
  ensureRbacSeeded2,
373
387
  ensureModelProfilesSeeded2,
374
388
  init_boot_seeds
375
- } from "./cli-3xddv0rk.js";
389
+ } from "./cli-k26bkr9t.js";
376
390
  import {
377
- buildCatalogEntries,
378
- listModelCatalog,
379
- listModelCatalogOverlay,
380
- upsertModelCatalogOverlay,
381
- getCatalogGeneration,
382
- loadModelsCatalog,
383
- init_model_catalog_store,
384
391
  requestModelCatalogRefresh2,
385
392
  startPricingRefreshLoop2,
386
393
  init_pricing_refresh
387
- } from "./cli-ed6yqpf1.js";
394
+ } from "./cli-a3b239vq.js";
388
395
  import {
389
396
  workflowEventBus2,
390
397
  init_event_bus
@@ -397,7 +404,7 @@ import {
397
404
  externalChannelToolError2,
398
405
  getChannelBlockReason2,
399
406
  init_external_channel
400
- } from "./cli-bxz823sz.js";
407
+ } from "./cli-b8e9nb04.js";
401
408
  import {
402
409
  noteSlackInboundSideEffect,
403
410
  init_inbound_dispatch,
@@ -436,7 +443,7 @@ import {
436
443
  startSlackApp2,
437
444
  stopSlackAppUnderLifecycleLock2,
438
445
  init_app3
439
- } from "./cli-mr97t7cc.js";
446
+ } from "./cli-4r05hnqa.js";
440
447
  import {
441
448
  shapeApprovalResolution,
442
449
  init_approval_resolution,
@@ -460,7 +467,7 @@ import {
460
467
  resumeFromChildRun2,
461
468
  initWaitBusSubscriptions2,
462
469
  init_resume
463
- } from "./cli-z9cs5m0w.js";
470
+ } from "./cli-vbh10fqa.js";
464
471
  import {
465
472
  FilesError,
466
473
  providerPath,
@@ -470,15 +477,15 @@ import {
470
477
  init_agent_fs_provider,
471
478
  getFileStorageProvider2,
472
479
  init_registry2
473
- } from "./cli-3xj33nrx.js";
480
+ } from "./cli-7cp6aa1q.js";
474
481
  import {
475
482
  tableToAscii2,
476
483
  init_dist4
477
- } from "./cli-n9ftpys4.js";
484
+ } from "./cli-x6t50dmw.js";
478
485
  import {
479
486
  getRuntimePool2,
480
487
  init_db2
481
- } from "./cli-xd5ebp64.js";
488
+ } from "./cli-k93bq1wq.js";
482
489
  import {
483
490
  duplicateGuardedQueryKey,
484
491
  parseQueryParams,
@@ -511,19 +518,13 @@ import {
511
518
  findRoute,
512
519
  route,
513
520
  init_route_def
514
- } from "./cli-8ewkreqd.js";
521
+ } from "./cli-b5rs97a6.js";
515
522
  import {
516
523
  COMPOSIO_HTTP_METHODS,
517
524
  executeComposioRequest,
518
525
  composioArgsFromParts,
519
526
  init_composio
520
527
  } from "./cli-28fq781p.js";
521
- import {
522
- ampPinProviderError,
523
- ampPinCatalogError,
524
- ampModelError,
525
- init_amp_models
526
- } from "./cli-ttbqe3q4.js";
527
528
  import {
528
529
  object,
529
530
  init_v4_mini
@@ -541,10 +542,6 @@ import {
541
542
  LlmRater,
542
543
  init_llm
543
544
  } from "./cli-2xv18ywz.js";
544
- import {
545
- loadModelsDevCache,
546
- init_modelsdev_cache
547
- } from "./cli-bzvs88tv.js";
548
545
  import {
549
546
  require_dist2,
550
547
  ConnectionAuthInputSchema,
@@ -623,7 +620,7 @@ import {
623
620
  init_typecheck,
624
621
  parseSkillContent,
625
622
  init_skill_parser
626
- } from "./cli-zjphdj1a.js";
623
+ } from "./cli-0ntbxyaa.js";
627
624
  import {
628
625
  detachedProcessGroup,
629
626
  registerProcessGroup,
@@ -638,7 +635,7 @@ import {
638
635
  ensureToken,
639
636
  ensureTokenOrThrow,
640
637
  init_ensure_token
641
- } from "./cli-16phend6.js";
638
+ } from "./cli-yn2bbre9.js";
642
639
  import {
643
640
  require_fast_deep_equal
644
641
  } from "./cli-bhp11egn.js";
@@ -733,7 +730,7 @@ import {
733
730
  validateDefinition,
734
731
  applyDefinitionPatch,
735
732
  init_definition2
736
- } from "./cli-xncjscpm.js";
733
+ } from "./cli-vqptjbr7.js";
737
734
  import {
738
735
  isMultiRuntimeEnabled,
739
736
  init_multi_runtime2
@@ -754,24 +751,15 @@ import {
754
751
  isSlackLeaveThreadDisabled,
755
752
  leaveSlackThread,
756
753
  init_left_threads
757
- } from "./cli-2tsfpc70.js";
754
+ } from "./cli-dy32zecz.js";
758
755
  import {
759
756
  publicEndpointSsrfOptions,
760
757
  init_mcp_wrapper
761
- } from "./cli-0m7rtm11.js";
758
+ } from "./cli-zcsw143p.js";
762
759
  import {
763
760
  canProvisionKind,
764
761
  init_runtime_providers
765
762
  } from "./cli-hxpyc9sn.js";
766
- import {
767
- isRbacEnabled,
768
- decideAdmission,
769
- grantLeadEquivalence,
770
- revokeLeadEquivalence,
771
- init_elevated_agents,
772
- can,
773
- init_rbac
774
- } from "./cli-cyn9v8zr.js";
775
763
  import {
776
764
  findUserById,
777
765
  findUserByExternalId,
@@ -786,7 +774,7 @@ import {
786
774
  resolveSessionToken,
787
775
  fingerprintApiKey,
788
776
  init_users
789
- } from "./cli-g1px1g2e.js";
777
+ } from "./cli-re4raaj0.js";
790
778
  import {
791
779
  normalizeAssetKey,
792
780
  SESSION_RESOURCE_KINDS,
@@ -808,10 +796,8 @@ import {
808
796
  init_zod_openapi,
809
797
  AssetKeySchema,
810
798
  ModelTierSchema,
811
- MODEL_TIERS,
812
799
  ReasoningEffortSchema,
813
800
  DEFAULT_MODEL_TIER_MAP,
814
- parseModelTier,
815
801
  splitLegacyModelAlias,
816
802
  AgentTaskStatusSchema,
817
803
  isTerminalTaskStatus,
@@ -825,6 +811,7 @@ import {
825
811
  AttachmentInputSchema,
826
812
  AgentStatusSchema,
827
813
  AgentAvatarSchema,
814
+ AppIconSchema,
828
815
  AgentSlackIconSchema,
829
816
  ChannelTypeSchema,
830
817
  ScheduledTaskTargetTypeSchema,
@@ -856,7 +843,7 @@ import {
856
843
  KvNamespaceSchema,
857
844
  KvKeySchema,
858
845
  init_types4
859
- } from "./cli-hfkwwy1h.js";
846
+ } from "./cli-2zp0et3v.js";
860
847
  import {
861
848
  generateDefaultClaudeMd2,
862
849
  generateDefaultSoulMd2,
@@ -867,9 +854,10 @@ import {
867
854
  init_task_attachment_links,
868
855
  contentSha256,
869
856
  init_profile_sync
870
- } from "./cli-pyrxt9gw.js";
857
+ } from "./cli-tk7cjj8h.js";
871
858
  import {
872
859
  getSlackConfiguration,
860
+ isSlackConfigured,
873
861
  init_config4
874
862
  } from "./cli-eetzmsy5.js";
875
863
  import {
@@ -879,7 +867,7 @@ import {
879
867
  import {
880
868
  selectCredential,
881
869
  init_credentials2
882
- } from "./cli-xfjrc279.js";
870
+ } from "./cli-5mrq3ake.js";
883
871
  import {
884
872
  findInterpolationTokens,
885
873
  interpolate,
@@ -889,7 +877,7 @@ import {
889
877
  init_registry3,
890
878
  resolveTemplate,
891
879
  init_resolver
892
- } from "./cli-kf3pxxdg.js";
880
+ } from "./cli-v1dv1r37.js";
893
881
  import {
894
882
  init_zod
895
883
  } from "./cli-zcfpsfzf.js";
@@ -924,7 +912,7 @@ import {
924
912
  import {
925
913
  init_package,
926
914
  package_default
927
- } from "./cli-rt0ag4x1.js";
915
+ } from "./cli-yncmerje.js";
928
916
  import {
929
917
  realtimeBus,
930
918
  init_bus
@@ -957,18 +945,7 @@ import {
957
945
  init_api_key
958
946
  } from "./cli-pax9q4ff.js";
959
947
  import {
960
- chatgptSubscriptionModelId,
961
- isAlias,
962
- parseAlias,
963
- resolveAlias,
964
- harnessCatalogSection,
965
- isHarnessModelJudged,
966
- harnessModelIds,
967
- modelFamilyKey,
968
- buildClaudeShortnameMap,
969
- harnessModelMismatch,
970
948
  openAICompatibleProviderIds,
971
- claudeCatalogModelId,
972
949
  init_src2,
973
950
  scrubSecrets,
974
951
  scrubObject,
@@ -19879,600 +19856,6 @@ var init_additive_ingress = __esm(() => {
19879
19856
  init_additive_buffer();
19880
19857
  });
19881
19858
 
19882
- // src/tasks/model-pin.ts
19883
- function taskModelPin(task) {
19884
- if (task.modelSource === "model")
19885
- return task.modelAlias ?? task.model ?? undefined;
19886
- if (task.modelSource === "fallback:cli-unsupported:model" && task.modelAlias) {
19887
- return task.modelAlias;
19888
- }
19889
- if (task.modelSource === "fallback:cli-unsupported" && task.modelAlias && !task.modelTier) {
19890
- return task.modelAlias;
19891
- }
19892
- if (!task.modelSource && !task.resolvedModel && !task.claudeSessionId) {
19893
- return task.model ?? undefined;
19894
- }
19895
- return;
19896
- }
19897
- function resumedTaskModelSelection(task) {
19898
- const pin = taskModelPin(task);
19899
- if (!pin)
19900
- return { model: undefined, resolvedModel: undefined, modelSource: undefined };
19901
- return {
19902
- model: pin,
19903
- resolvedModel: task.resolvedModel ?? undefined,
19904
- modelSource: task.modelSource ?? undefined
19905
- };
19906
- }
19907
- var init_model_pin = () => {};
19908
-
19909
- // src/be/harness-model-support.ts
19910
- async function getHarnessModelSupport(harness, cliVersion, modelId) {
19911
- const row = await getDbClient2().get("SELECT status FROM harness_model_support WHERE harness = ? AND cliVersion = ? AND modelId = ?", [harness, cliVersion, modelId]);
19912
- return row?.status ?? "unknown";
19913
- }
19914
- async function listHarnessModelSupport(filter) {
19915
- const where = [];
19916
- const params = [];
19917
- if (filter?.harness) {
19918
- where.push("harness = ?");
19919
- params.push(filter.harness);
19920
- }
19921
- if (filter?.cliVersion) {
19922
- where.push("cliVersion = ?");
19923
- params.push(filter.cliVersion);
19924
- }
19925
- return await getDbClient2().query(`SELECT harness, cliVersion, modelId, status, checkedAt, error FROM harness_model_support${where.length > 0 ? ` WHERE ${where.join(" AND ")}` : ""} ORDER BY checkedAt DESC`, params);
19926
- }
19927
- async function recordHarnessModelSupport(input) {
19928
- const checkedAt = input.now ?? Date.now();
19929
- const error = input.error ? scrubSecrets(input.error).slice(0, 2000) : null;
19930
- await getDbClient2().run(`INSERT INTO harness_model_support (harness, cliVersion, modelId, status, checkedAt, error)
19931
- VALUES (?, ?, ?, ?, ?, ?)
19932
- ON CONFLICT (harness, cliVersion, modelId) DO UPDATE SET
19933
- status = CASE WHEN excluded.status = 'unknown' THEN harness_model_support.status ELSE excluded.status END,
19934
- checkedAt = excluded.checkedAt,
19935
- error = excluded.error`, [input.harness, input.cliVersion, input.modelId, input.status, checkedAt, error]);
19936
- const row = await getDbClient2().get("SELECT harness, cliVersion, modelId, status, checkedAt, error FROM harness_model_support WHERE harness = ? AND cliVersion = ? AND modelId = ?", [input.harness, input.cliVersion, input.modelId]);
19937
- if (!row)
19938
- throw new Error("harness_model_support upsert returned no row");
19939
- return row;
19940
- }
19941
- async function agentRanModel(agentId, modelId) {
19942
- const row = await getDbClient2().get(`SELECT id FROM agent_tasks
19943
- WHERE agentId = ? AND (resolvedModel = ? OR (resolvedModel IS NULL AND model = ?))
19944
- LIMIT 1`, [agentId, modelId, modelId]);
19945
- return row !== null && row !== undefined;
19946
- }
19947
- async function getAgentHarnessCliVersion(agentId) {
19948
- const row = await getDbClient2().get("SELECT harnessCliVersion FROM agents WHERE id = ?", [agentId]);
19949
- return row?.harnessCliVersion ?? null;
19950
- }
19951
- async function setAgentHarnessCliVersion(agentId, cliVersion) {
19952
- await getDbClient2().run("UPDATE agents SET harnessCliVersion = ? WHERE id = ? AND harnessCliVersion IS NOT ?", [cliVersion, agentId, cliVersion]);
19953
- }
19954
- function unsupportedModelMessage(harness, cliVersion, model) {
19955
- return `Model "${model}" is not supported by the ${harness} CLI ${cliVersion} on this worker. A CLI bump is needed before tasks can pin it.`;
19956
- }
19957
- async function fallbackForUnsupportedModel(harness, cliVersion, model, catalogSection) {
19958
- if (!harnessCatalogSection(harness))
19959
- return null;
19960
- const family = modelFamilyKey(harness === "claude" ? claudeCatalogModelId(model, catalogSection) : model);
19961
- const rejected = new Set((await listHarnessModelSupport({ harness, cliVersion })).filter((r) => r.status === "unsupported").map((r) => r.modelId));
19962
- for (const id of harnessModelIds(harness, catalogSection)) {
19963
- if (id === model || rejected.has(id))
19964
- continue;
19965
- if (modelFamilyKey(id) === family)
19966
- return id;
19967
- }
19968
- return null;
19969
- }
19970
- function noticeCliUnsupported(harness, cliVersion, model, fallback) {
19971
- const key = `${harness}|${cliVersion}|${model}`;
19972
- if (noticed.has(key))
19973
- return;
19974
- noticed.add(key);
19975
- console.warn(`[model-tiers] ${model} is unsupported on ${harness} CLI ${cliVersion}; tier/alias tasks fall back to ${fallback} until the CLI is bumped`);
19976
- }
19977
- var CLI_PINNED_HARNESSES, noticed;
19978
- var init_harness_model_support = __esm(() => {
19979
- init_src2();
19980
- init_secret_scrubber();
19981
- init_db4();
19982
- CLI_PINNED_HARNESSES = new Set(["claude", "codex"]);
19983
- noticed = new Set;
19984
- });
19985
-
19986
- // src/be/model-tier-resolution.ts
19987
- function sanitizeModelTierOverrides(raw) {
19988
- const parsed = OverridesSchema.safeParse(raw);
19989
- if (!parsed.success)
19990
- return {};
19991
- const result = {};
19992
- for (const [provider, tiers] of Object.entries(parsed.data)) {
19993
- if (!ProviderNameSchema.safeParse(provider).success)
19994
- continue;
19995
- const clean = {};
19996
- for (const [tier, value] of Object.entries(tiers)) {
19997
- const t = parseModelTier(tier);
19998
- const v = value.trim();
19999
- if (t && t === tier && v && v.length <= 200 && !/\s/.test(v))
20000
- clean[t] = v;
20001
- }
20002
- if (Object.keys(clean).length > 0)
20003
- result[provider] = clean;
20004
- }
20005
- return result;
20006
- }
20007
- function parseModelTierOverridesHeader(header) {
20008
- if (header === null || header === undefined || header === "")
20009
- return;
20010
- try {
20011
- return sanitizeModelTierOverrides(JSON.parse(decodeURIComponent(header)));
20012
- } catch {
20013
- return;
20014
- }
20015
- }
20016
- async function getAgentModelTierOverrides(agentId) {
20017
- const row = await getDbClient2().get("SELECT modelTierOverrides FROM agents WHERE id = ?", [agentId]);
20018
- if (!row?.modelTierOverrides)
20019
- return {};
20020
- try {
20021
- return sanitizeModelTierOverrides(JSON.parse(row.modelTierOverrides));
20022
- } catch {
20023
- return {};
20024
- }
20025
- }
20026
- async function setAgentModelTierOverrides(agentId, overrides) {
20027
- const next = Object.keys(overrides).length > 0 ? JSON.stringify(overrides) : null;
20028
- await getDbClient2().run("UPDATE agents SET modelTierOverrides = ? WHERE id = ? AND modelTierOverrides IS NOT ?", [next, agentId, next]);
20029
- }
20030
- function mergeFacts(base, overlay) {
20031
- const merged = { ...base };
20032
- for (const [key, value] of Object.entries(overlay)) {
20033
- if (value !== null && value !== undefined) {
20034
- merged[key] = value;
20035
- }
20036
- }
20037
- return merged;
20038
- }
20039
- async function loadResolutionCatalog() {
20040
- const now = Date.now();
20041
- const generation = getCatalogGeneration();
20042
- if (cachedCatalog && cachedCatalog.generation === generation && now - cachedCatalog.at < CATALOG_TTL_MS) {
20043
- return cachedCatalog;
20044
- }
20045
- let entries = await listModelCatalog();
20046
- if (entries.length === 0) {
20047
- const snapshot = loadModelsDevCache();
20048
- entries = snapshot ? buildCatalogEntries(snapshot, 0) : [];
20049
- }
20050
- const facts = new Map;
20051
- for (const entry of entries) {
20052
- facts.set(`${entry.provider}/${entry.modelId}`, {
20053
- provider: entry.provider,
20054
- modelId: entry.modelId,
20055
- facts: entry
20056
- });
20057
- }
20058
- for (const overlay of await listModelCatalogOverlay()) {
20059
- const key = `${overlay.provider}/${overlay.modelId}`;
20060
- const existing = facts.get(key);
20061
- facts.set(key, {
20062
- provider: overlay.provider,
20063
- modelId: overlay.modelId,
20064
- facts: existing ? mergeFacts(existing.facts, overlay) : overlay
20065
- });
20066
- }
20067
- const catalog = {};
20068
- const priced = new Set;
20069
- for (const { provider, modelId, facts: f } of facts.values()) {
20070
- catalog[provider] ??= { id: provider, name: provider, models: {} };
20071
- const model = {
20072
- ...f.name ? { name: f.name } : {},
20073
- ...f.releaseDate ? { release_date: f.releaseDate } : {},
20074
- ...f.contextWindow ? { limit: { context: f.contextWindow } } : {},
20075
- ...f.pricing ? { cost: f.pricing } : {}
20076
- };
20077
- catalog[provider].models[modelId] = model;
20078
- const p = f.pricing;
20079
- if (p && (typeof p.input === "number" || typeof p.output === "number")) {
20080
- priced.add(`${provider}/${modelId}`);
20081
- }
20082
- }
20083
- cachedCatalog = { at: now, generation, catalog, priced };
20084
- return cachedCatalog;
20085
- }
20086
- function soakDays() {
20087
- const raw = process.env.MODEL_LATEST_SOAK_DAYS?.trim();
20088
- if (!raw)
20089
- return DEFAULT_MODEL_LATEST_SOAK_DAYS;
20090
- const n = Number(raw);
20091
- return Number.isInteger(n) && n >= 0 ? n : DEFAULT_MODEL_LATEST_SOAK_DAYS;
20092
- }
20093
- function autoUpgradeEnabled() {
20094
- const raw = process.env.MODEL_AUTO_UPGRADE?.trim().toLowerCase();
20095
- return !(raw === "false" || raw === "0");
20096
- }
20097
- async function lastAliasResolution(alias) {
20098
- const row = await getDbClient2().get("SELECT newModel FROM model_alias_resolutions WHERE alias = ? ORDER BY id DESC LIMIT 1", [alias]);
20099
- return row?.newModel ?? null;
20100
- }
20101
- async function resolveLatestAlias(alias, now = new Date, opts = {}) {
20102
- const parsed = parseAlias(alias);
20103
- if (!parsed)
20104
- return null;
20105
- const key = alias.trim().toLowerCase();
20106
- const previous = await lastAliasResolution(key);
20107
- if (previous && !autoUpgradeEnabled())
20108
- return previous;
20109
- const { catalog, priced } = await loadResolutionCatalog();
20110
- const section = parsed.kind;
20111
- const resolved = resolveAlias(key, catalog, {
20112
- soakDays: soakDays(),
20113
- now,
20114
- isSupported: (id) => priced.has(`${section}/${id}`)
20115
- });
20116
- if (!resolved)
20117
- return null;
20118
- if (resolved !== previous && opts.record !== false) {
20119
- await getDbClient2().run("INSERT INTO model_alias_resolutions (alias, previousModel, newModel, changedAt) VALUES (?, ?, ?, ?)", [key, previous, resolved, now.getTime()]);
20120
- getDbClient2().afterCommit(() => {
20121
- console.info(`[model-tiers] alias ${key} now resolves to ${resolved}${previous ? ` (was ${previous})` : ""}`);
20122
- });
20123
- }
20124
- return resolved;
20125
- }
20126
- function taskModelCandidates(input) {
20127
- const candidates = [];
20128
- const model = input.model?.trim();
20129
- if (model)
20130
- candidates.push({ value: model, source: "model" });
20131
- const tier = parseModelTier(input.modelTier);
20132
- const provider = input.harnessProvider;
20133
- if (tier && provider) {
20134
- const worker = input.workerOverrides?.[provider]?.[tier]?.trim();
20135
- if (worker)
20136
- candidates.push({ value: worker, source: "worker-env" });
20137
- const env = input.env ?? process.env;
20138
- const configured = env[tierConfigKey(provider, tier)]?.trim();
20139
- if (configured)
20140
- candidates.push({ value: configured, source: "tier-config" });
20141
- const fallback = DEFAULT_MODEL_TIER_MAP[provider]?.[tier];
20142
- if (fallback)
20143
- candidates.push({ value: fallback, source: "tier-default" });
20144
- }
20145
- return candidates;
20146
- }
20147
- function harnessMismatchReason(model, harness) {
20148
- return `[model-harness-mismatch] Model "${model}" does not run on the ${harness} harness of this worker. The task pinned a model from another harness family. Re-create the task with modelTier or with a ${harness} model.`;
20149
- }
20150
- async function resolveTaskModel(input) {
20151
- const harness = input.harnessProvider ?? null;
20152
- const judged = harness !== null && isHarnessModelJudged(harness);
20153
- const sections = judged ? (await loadResolutionCatalog()).catalog : {};
20154
- for (const candidate of taskModelCandidates(input)) {
20155
- let resolution = null;
20156
- if (!isAlias(candidate.value)) {
20157
- resolution = {
20158
- resolvedModel: candidate.value,
20159
- modelSource: candidate.source,
20160
- modelAlias: null
20161
- };
20162
- } else {
20163
- const resolved = await resolveLatestAlias(candidate.value, input.now, {
20164
- record: input.record
20165
- });
20166
- if (resolved) {
20167
- resolution = {
20168
- resolvedModel: resolved,
20169
- modelSource: candidate.source,
20170
- modelAlias: candidate.value.trim().toLowerCase()
20171
- };
20172
- }
20173
- }
20174
- if (!resolution) {
20175
- console.warn(`[model-tiers] ${candidate.source} alias ${candidate.value} resolved to nothing; trying next layer`);
20176
- continue;
20177
- }
20178
- if (judged && harnessModelMismatch(resolution.resolvedModel, harness, sections)) {
20179
- if (candidate.source === "model") {
20180
- return { harnessMismatch: harnessMismatchReason(candidate.value, harness) };
20181
- }
20182
- console.warn(`[model-tiers] ${candidate.source} value ${candidate.value} does not run on ${harness}; trying next layer`);
20183
- continue;
20184
- }
20185
- return resolution;
20186
- }
20187
- return null;
20188
- }
20189
- async function previewModelTiers(opts = {}) {
20190
- const env = opts.env ?? process.env;
20191
- const rows = [];
20192
- for (const provider of ProviderNameSchema.options) {
20193
- if (MODEL_TIERS.every((tier) => !DEFAULT_MODEL_TIER_MAP[provider][tier]))
20194
- continue;
20195
- for (const tier of MODEL_TIERS) {
20196
- const key = tierConfigKey(provider, tier);
20197
- const configured = env[key]?.trim() || null;
20198
- const resolution = await resolveTaskModel({
20199
- modelTier: tier,
20200
- harnessProvider: provider,
20201
- env,
20202
- now: opts.now,
20203
- record: false
20204
- });
20205
- const previewed = resolution && "harnessMismatch" in resolution ? null : resolution;
20206
- rows.push({
20207
- provider,
20208
- tier,
20209
- key,
20210
- defaultValue: DEFAULT_MODEL_TIER_MAP[provider][tier],
20211
- configured,
20212
- source: previewed?.modelSource === "tier-config" ? "tier-config" : "tier-default",
20213
- resolvedModel: previewed?.resolvedModel ?? null,
20214
- alias: previewed?.modelAlias ?? null
20215
- });
20216
- }
20217
- }
20218
- return rows;
20219
- }
20220
- async function applyCliSupport(resolution, harness, cliVersion) {
20221
- if (!harness || !cliVersion || !CLI_PINNED_HARNESSES.has(harness))
20222
- return resolution;
20223
- const status = await getHarnessModelSupport(harness, cliVersion, resolution.resolvedModel);
20224
- if (status !== "unsupported")
20225
- return resolution;
20226
- if (resolution.modelSource === "model" && !resolution.modelAlias) {
20227
- return { unsupported: unsupportedModelMessage(harness, cliVersion, resolution.resolvedModel) };
20228
- }
20229
- const section = harnessCatalogSection(harness);
20230
- const { catalog, priced } = await loadResolutionCatalog();
20231
- const candidates = Object.fromEntries(Object.entries(section && catalog[section]?.models || {}).filter(([id]) => priced.has(`${section}/${id}`)));
20232
- const fallback = await fallbackForUnsupportedModel(harness, cliVersion, resolution.resolvedModel, candidates);
20233
- if (!fallback)
20234
- return resolution;
20235
- noticeCliUnsupported(harness, cliVersion, resolution.resolvedModel, fallback);
20236
- const modelSource = resolution.modelSource.startsWith("profile:") ? resolution.modelSource : resolution.modelSource === "model" ? "fallback:cli-unsupported:model" : "fallback:cli-unsupported";
20237
- return { ...resolution, resolvedModel: fallback, modelSource };
20238
- }
20239
- async function resolveClaimProfile(name, source, harness) {
20240
- const isTask = source === "profile:task";
20241
- const profile = await getModelProfileByName(name);
20242
- if (!profile) {
20243
- return isTask ? { modelUnsupported: `[model-profile-missing] Model profile "${name}" no longer exists.` } : null;
20244
- }
20245
- if (profile.harness !== harness) {
20246
- if (!isTask)
20247
- return null;
20248
- return {
20249
- modelUnsupported: `[model-harness-mismatch] Model profile "${name}" runs on the ${profile.harness} harness, not on the ${harness ?? "unknown"} harness of this worker. Re-create the task with a ${harness ?? "matching"} profile.`
20250
- };
20251
- }
20252
- let resolution = {
20253
- resolvedModel: profile.model,
20254
- modelSource: source,
20255
- modelAlias: null
20256
- };
20257
- if (isAlias(profile.model)) {
20258
- const resolved = await resolveLatestAlias(profile.model);
20259
- if (!resolved) {
20260
- if (!isTask)
20261
- return null;
20262
- return {
20263
- modelUnsupported: `[model-profile-unresolved] Model profile "${name}" names ${profile.model}, which resolves to no usable model.`
20264
- };
20265
- }
20266
- resolution = {
20267
- resolvedModel: resolved,
20268
- modelSource: source,
20269
- modelAlias: profile.model.trim().toLowerCase()
20270
- };
20271
- }
20272
- return { profile: { name: profile.name, effort: profile.effort }, resolution };
20273
- }
20274
- async function recordClaimModelResolution(task, agent, { includeRepoSecrets = true } = {}) {
20275
- const harnessProvider = agent.harnessProvider ?? agent.provider ?? null;
20276
- if (!task.model?.trim()) {
20277
- const taskProfile = task.profile?.trim();
20278
- const agentDefault = taskProfile || parseModelTier(task.modelTier) ? null : await getAgentDefaultProfileName(agent.id);
20279
- const repoKeys = agentDefault ? await repoModelOverrideKeys(task.vcsRepo, { includeSecrets: includeRepoSecrets }) : new Set;
20280
- const defaultProfile = repoKeys.has("MODEL_OVERRIDE") ? null : agentDefault;
20281
- const picked = taskProfile ? await resolveClaimProfile(taskProfile, "profile:task", harnessProvider) : defaultProfile ? await resolveClaimProfile(defaultProfile, "profile:agent-default", harnessProvider) : null;
20282
- if (picked && "modelUnsupported" in picked)
20283
- return { modelUnsupported: picked.modelUnsupported };
20284
- if (picked) {
20285
- const checked = await applyCliSupport(picked.resolution, harnessProvider, await getAgentHarnessCliVersion(agent.id));
20286
- const resolution = "unsupported" in checked ? picked.resolution : checked;
20287
- await getDbClient2().run("UPDATE agent_tasks SET resolvedModel = ?, modelSource = ?, modelAlias = ?, resolvedProfile = ? WHERE id = ?", [
20288
- resolution.resolvedModel,
20289
- resolution.modelSource,
20290
- resolution.modelAlias,
20291
- picked.profile.name,
20292
- task.id
20293
- ]);
20294
- return {
20295
- resolvedModel: resolution.resolvedModel,
20296
- modelSource: resolution.modelSource,
20297
- ...resolution.modelAlias ? { modelAlias: resolution.modelAlias } : {},
20298
- resolvedProfile: picked.profile.name,
20299
- ...!task.effort && picked.profile.effort && !repoKeys.has("REASONING_EFFORT_OVERRIDE") ? { effort: picked.profile.effort } : {}
20300
- };
20301
- }
20302
- }
20303
- const resolved = await resolveTaskModel({
20304
- model: task.model,
20305
- modelTier: task.modelTier,
20306
- harnessProvider,
20307
- workerOverrides: await getAgentModelTierOverrides(agent.id)
20308
- });
20309
- if (!resolved) {
20310
- await getDbClient2().run(`UPDATE agent_tasks SET resolvedModel = NULL, modelSource = NULL, modelAlias = NULL, resolvedProfile = NULL
20311
- WHERE id = ? AND (resolvedModel IS NOT NULL OR modelSource IS NOT NULL OR modelAlias IS NOT NULL
20312
- OR resolvedProfile IS NOT NULL)`, [task.id]);
20313
- return {};
20314
- }
20315
- if ("harnessMismatch" in resolved)
20316
- return { modelUnsupported: resolved.harnessMismatch };
20317
- const checked = await applyCliSupport(resolved, harnessProvider, await getAgentHarnessCliVersion(agent.id));
20318
- if ("unsupported" in checked) {
20319
- return { modelUnsupported: checked.unsupported };
20320
- }
20321
- const resolution = checked;
20322
- await getDbClient2().run("UPDATE agent_tasks SET resolvedModel = ?, modelSource = ?, modelAlias = ?, resolvedProfile = NULL WHERE id = ?", [resolution.resolvedModel, resolution.modelSource, resolution.modelAlias, task.id]);
20323
- return resolution.modelAlias ? resolution : { resolvedModel: resolution.resolvedModel, modelSource: resolution.modelSource };
20324
- }
20325
- var DEFAULT_MODEL_LATEST_SOAK_DAYS = 2, OverridesSchema, CATALOG_TTL_MS = 30000, cachedCatalog = null;
20326
- var init_model_tier_resolution = __esm(() => {
20327
- init_src2();
20328
- init_zod();
20329
- init_types4();
20330
- init_db4();
20331
- init_model_profiles();
20332
- init_harness_model_support();
20333
- init_model_catalog_store();
20334
- init_model_tier_keys();
20335
- init_modelsdev_cache();
20336
- init_model_tier_keys();
20337
- OverridesSchema = record2(string2(), record2(string2(), string2()));
20338
- });
20339
-
20340
- // src/be/model-validation.ts
20341
- function hasModel(catalog, provider, modelId) {
20342
- const models = catalog[provider]?.models;
20343
- return Boolean(models && Object.hasOwn(models, modelId));
20344
- }
20345
- function isKnownCatalogModel(model, catalog) {
20346
- const id = model.trim().replace(CONTEXT_SUFFIX_RE, "");
20347
- if (!id)
20348
- return false;
20349
- const subscriptionId = chatgptSubscriptionModelId(id);
20350
- if (subscriptionId)
20351
- return hasModel(catalog, "openai", subscriptionId);
20352
- const slash = id.indexOf("/");
20353
- if (slash > 0) {
20354
- const provider = id.slice(0, slash);
20355
- const rest = id.slice(slash + 1);
20356
- if (hasModel(catalog, provider, rest))
20357
- return true;
20358
- if (provider === "amazon-bedrock") {
20359
- return hasModel(catalog, provider, rest.replace(BEDROCK_REGION_PREFIX_RE, ""));
20360
- }
20361
- }
20362
- for (const provider of Object.keys(catalog)) {
20363
- if (hasModel(catalog, provider, id))
20364
- return true;
20365
- }
20366
- const anthropic = catalog.anthropic?.models;
20367
- return Object.hasOwn(buildClaudeShortnameMap(anthropic), id);
20368
- }
20369
- function claudeShortnameToCatalogId(model, catalog) {
20370
- const anthropic = catalog.anthropic?.models;
20371
- const shortnames = buildClaudeShortnameMap(anthropic);
20372
- const bare = model.replace(CONTEXT_SUFFIX_RE, "");
20373
- return Object.hasOwn(shortnames, bare) ? shortnames[bare] : model;
20374
- }
20375
- async function harnessModelErrorFor(model, harness) {
20376
- const { providers } = await loadModelsCatalog();
20377
- return harnessModelMismatch(model, harness, providers, {});
20378
- }
20379
- async function poolTaskRunsOnHarness(task, harness) {
20380
- const profileName = task?.profile?.trim();
20381
- if (profileName) {
20382
- const profile = await getModelProfileByName(profileName);
20383
- return !profile || !harness || profile.harness === harness;
20384
- }
20385
- const model = taskModelPin(task ?? {})?.trim();
20386
- if (!model)
20387
- return true;
20388
- return await harnessModelErrorFor(model, harness) === null;
20389
- }
20390
- async function explicitModelError(check) {
20391
- const model = check.model?.trim();
20392
- if (!model)
20393
- return null;
20394
- if (check.harnessProvider && FREE_FORM_HARNESSES.has(check.harnessProvider))
20395
- return null;
20396
- if (check.harnessProvider === "amp") {
20397
- const shapeError = ampModelError(model);
20398
- if (shapeError || check.allowCustomModel)
20399
- return shapeError;
20400
- const { providers } = await loadModelsCatalog();
20401
- return ampPinProviderError(model) ?? ampPinCatalogError(model, providers);
20402
- }
20403
- const { providers } = await loadModelsCatalog();
20404
- const catalog = providers;
20405
- if (check.harnessProvider) {
20406
- const harnessModel = harnessCatalogSection(check.harnessProvider) === "anthropic" ? model : claudeShortnameToCatalogId(model, catalog);
20407
- const mismatch = harnessModelMismatch(harnessModel, check.harnessProvider, catalog, { agentId: check.agentId, agentName: check.agentName });
20408
- if (mismatch)
20409
- return mismatch;
20410
- }
20411
- if (check.allowCustomModel)
20412
- return null;
20413
- if (isAlias(model)) {
20414
- if (!parseAlias(model)) {
20415
- return `Invalid model alias "${model}". Use latest:<provider>/<family>[@stable|@any], e.g. latest:anthropic/opus.`;
20416
- }
20417
- const resolved = await resolveLatestAlias(model, new Date, { record: false });
20418
- return resolved ? null : `Model alias "${model}" matches no model in the catalog. Check the provider and family, or use a concrete model id.`;
20419
- }
20420
- if (Object.keys(catalog).length === 0)
20421
- return null;
20422
- if (isKnownCatalogModel(model, catalog))
20423
- return null;
20424
- return `Unknown model "${model}": it is not in the model catalog. Use a catalog model id, a Claude CLI shortname (opus, sonnet, haiku, fable), a latest:<provider>/<family> alias, or modelTier. To run a custom model id anyway, set allowCustomModel: true (allow_custom_model on the agent runtime).`;
20425
- }
20426
- async function explicitModelErrorForAgent(check) {
20427
- const model = check.model?.trim();
20428
- if (!model)
20429
- return null;
20430
- const agent = check.agentId ? await getAgentById2(check.agentId) : null;
20431
- if (agent) {
20432
- return explicitModelError({
20433
- ...check,
20434
- agentId: agent.id,
20435
- agentName: agent.name,
20436
- harnessProvider: agent.harnessProvider ?? agent.provider ?? null
20437
- });
20438
- }
20439
- if (!check.agentId && !isAlias(model)) {
20440
- const poolError = await poolHarnessModelError(model);
20441
- if (poolError)
20442
- return poolError;
20443
- }
20444
- return explicitModelError({ ...check, harnessProvider: null });
20445
- }
20446
- async function poolHarnessModelError(model) {
20447
- const agents = await getAllAgents2({ slim: true });
20448
- if (agents.length === 0)
20449
- return null;
20450
- const { providers } = await loadModelsCatalog();
20451
- const sections = providers;
20452
- const harnesses = new Set;
20453
- for (const agent of agents) {
20454
- const harness = agent.harnessProvider ?? agent.provider ?? null;
20455
- if (!harnessModelMismatch(model, harness, sections))
20456
- return null;
20457
- if (harness)
20458
- harnesses.add(harness);
20459
- }
20460
- return `Model "${model}" does not run on any registered agent harness (${[...harnesses].sort().join(", ")}). Use modelTier (smol, regular, smart, ultra) for portable intent, or omit model and let the claiming agent resolve it.`;
20461
- }
20462
- var FREE_FORM_HARNESSES, CONTEXT_SUFFIX_RE, BEDROCK_REGION_PREFIX_RE;
20463
- var init_model_validation = __esm(() => {
20464
- init_src2();
20465
- init_model_pin();
20466
- init_amp_models();
20467
- init_db4();
20468
- init_model_profiles();
20469
- init_model_catalog_store();
20470
- init_model_tier_resolution();
20471
- FREE_FORM_HARNESSES = new Set(["acp", "devin", "dsh", "cursor"]);
20472
- CONTEXT_SUFFIX_RE = /\[1m\]$/i;
20473
- BEDROCK_REGION_PREFIX_RE = /^(?:us|eu|apac|global|us-gov)\./;
20474
- });
20475
-
20476
19859
  // src/extensions/manifest-format.ts
20477
19860
  function parseStructuredText(filename, text) {
20478
19861
  const lower = filename.toLowerCase();
@@ -20549,7 +19932,7 @@ async function recoverRunningRuns(registry) {
20549
19932
  await failRunningRun(runId, "Child workflow run lost its initial context in a restart");
20550
19933
  continue;
20551
19934
  }
20552
- const workflow = await getWorkflow2(run.workflowId);
19935
+ const workflow = await getRunWorkflow2(run);
20553
19936
  if (!workflow)
20554
19937
  continue;
20555
19938
  const completedNodeIds = new Set(await getCompletedStepNodeIds2(runId));
@@ -20596,7 +19979,7 @@ async function recoverOrphanedSubWorkflowSteps(registry) {
20596
19979
  const run = await getWorkflowRun2(row.runId);
20597
19980
  if (!run || run.status !== "running" && run.status !== "waiting")
20598
19981
  continue;
20599
- const workflow = await getWorkflow2(run.workflowId);
19982
+ const workflow = await getRunWorkflow2(run);
20600
19983
  const node = workflow?.definition.nodes.find((n) => n.id === row.nodeId);
20601
19984
  if (!workflow || !node)
20602
19985
  continue;
@@ -20659,7 +20042,7 @@ async function recoverWaitingRuns(registry) {
20659
20042
  for (const stuck of stuckRuns) {
20660
20043
  try {
20661
20044
  const run = await getWorkflowRun2(stuck.runId);
20662
- const workflow = await getWorkflow2(stuck.workflowId);
20045
+ const workflow = await getRunWorkflow2({ id: stuck.runId, workflowId: stuck.workflowId });
20663
20046
  if (!run || run.status !== "waiting" || !workflow)
20664
20047
  continue;
20665
20048
  const taskCompleted = stuck.taskStatus === "completed";
@@ -20724,7 +20107,7 @@ async function recoverApprovalWaitingRuns(registry) {
20724
20107
  for (const stuck of stuckRuns) {
20725
20108
  try {
20726
20109
  const run = await getWorkflowRun2(stuck.runId);
20727
- const workflow = await getWorkflow2(stuck.workflowId);
20110
+ const workflow = await getRunWorkflow2({ id: stuck.runId, workflowId: stuck.workflowId });
20728
20111
  if (!run || !workflow)
20729
20112
  continue;
20730
20113
  const ctx = run.context ?? {};
@@ -20805,7 +20188,7 @@ async function recoverForeachFanouts(registry) {
20805
20188
  let recovered = 0;
20806
20189
  for (const fanout of fanouts.values()) {
20807
20190
  try {
20808
- const workflow = await getWorkflow2(fanout.workflowId);
20191
+ const workflow = await getRunWorkflow2({ id: fanout.runId, workflowId: fanout.workflowId });
20809
20192
  const parent = workflow?.definition.nodes.find((node) => node.id === fanout.parentNodeId);
20810
20193
  if (parent?.type !== "foreach")
20811
20194
  continue;
@@ -20851,7 +20234,7 @@ function startRetryPoller(registry, intervalMs = 5000) {
20851
20234
  const run = await getWorkflowRun2(step.runId);
20852
20235
  if (!run)
20853
20236
  continue;
20854
- const workflow = await getWorkflow2(run.workflowId);
20237
+ const workflow = await getRunWorkflow2(run);
20855
20238
  if (!workflow)
20856
20239
  continue;
20857
20240
  const foreachParent = resolveForeachParent(workflow.definition, step.nodeId);
@@ -20919,7 +20302,7 @@ function startRetryPoller(registry, intervalMs = 5000) {
20919
20302
  if (!waiting)
20920
20303
  continue;
20921
20304
  if (result.waitFor === "workflow.child.finished") {
20922
- const { resumeFromChildRun } = await import("./resume-5a5d2845.js");
20305
+ const { resumeFromChildRun } = await import("./resume-5gsrjd5e.js");
20923
20306
  await resumeFromChildRun(step.id, registry);
20924
20307
  }
20925
20308
  } else {
@@ -21408,7 +20791,8 @@ var init_errors2 = __esm(() => {
21408
20791
  var AgentTaskConfigSchema, AgentTaskOutputSchema, AgentTaskExecutor;
21409
20792
  var init_agent_task = __esm(() => {
21410
20793
  init_zod();
21411
- init_model_validation();
20794
+ init_model_profiles();
20795
+ init_model_validation2();
21412
20796
  init_apply_task_create();
21413
20797
  init_context_key();
21414
20798
  init_errors2();
@@ -21428,6 +20812,7 @@ var init_agent_task = __esm(() => {
21428
20812
  modelTier: ModelTierSchema.optional(),
21429
20813
  allowCustomModel: boolean().optional(),
21430
20814
  effort: ReasoningEffortSchema.optional(),
20815
+ profile: string2().min(1).optional(),
21431
20816
  parentTaskId: string2().uuid().optional(),
21432
20817
  requestedByUserId: string2().optional(),
21433
20818
  outputSchema: record2(string2(), unknown()).optional(),
@@ -21466,7 +20851,7 @@ var init_agent_task = __esm(() => {
21466
20851
  let effectiveVcsRepo = config.vcsRepo;
21467
20852
  let effectiveKey;
21468
20853
  if (meta.workflowId) {
21469
- const workflow = await db.getWorkflow(meta.workflowId);
20854
+ const workflow = await db.getRunWorkflow({ id: meta.runId, workflowId: meta.workflowId });
21470
20855
  if (workflow) {
21471
20856
  if (!effectiveDir && workflow.dir)
21472
20857
  effectiveDir = workflow.dir;
@@ -21482,6 +20867,15 @@ var init_agent_task = __esm(() => {
21482
20867
  });
21483
20868
  if (modelError)
21484
20869
  return { status: "failed", error: modelError };
20870
+ const profileError = await taskProfileError({
20871
+ profile: config.profile,
20872
+ model: config.model,
20873
+ modelTier: config.modelTier,
20874
+ agentId: config.agentId,
20875
+ vcsRepo: effectiveVcsRepo
20876
+ });
20877
+ if (profileError)
20878
+ return { status: "failed", error: profileError };
21485
20879
  const preCreate = await applyPreTaskCreate({
21486
20880
  description: config.template,
21487
20881
  options: {
@@ -21500,6 +20894,7 @@ var init_agent_task = __esm(() => {
21500
20894
  vcsRepo: effectiveVcsRepo,
21501
20895
  ...splitLegacyModelAlias({ model: config.model, modelTier: config.modelTier }),
21502
20896
  effort: config.effort,
20897
+ profile: config.profile?.trim() || undefined,
21503
20898
  parentTaskId: config.parentTaskId,
21504
20899
  requestedByUserId: config.requestedByUserId ?? meta.requestedByUserId,
21505
20900
  outputSchema: config.outputSchema,
@@ -21512,7 +20907,14 @@ var init_agent_task = __esm(() => {
21512
20907
  if (preCreate.kind === "blocked") {
21513
20908
  throw new TaskCreationBlockedError(preCreate.reason, preCreate.extension);
21514
20909
  }
21515
- const task = await db.createTaskExtended(preCreate.description, preCreate.options);
20910
+ let task;
20911
+ try {
20912
+ task = await db.createTaskExtended(preCreate.description, preCreate.options);
20913
+ } catch (error) {
20914
+ if (modelProfileRefError(error) !== "missing")
20915
+ throw error;
20916
+ return { status: "failed", error: `Unknown model profile "${config.profile}".` };
20917
+ }
21516
20918
  return {
21517
20919
  status: "success",
21518
20920
  async: true,
@@ -21588,11 +20990,25 @@ var init_code_match = __esm(() => {
21588
20990
  });
21589
20991
 
21590
20992
  // src/workflows/executors/notify.ts
21591
- var NotifyConfigSchema, NotifyOutputSchema, NotifyExecutor;
20993
+ async function waitForSlackApp(getApp, signal) {
20994
+ const deadline = Date.now() + slackReadyWait.timeoutMs;
20995
+ while (Date.now() < deadline && !signal?.aborted) {
20996
+ await Bun.sleep(Math.min(slackReadyWait.pollMs, Math.max(0, deadline - Date.now())));
20997
+ if (signal?.aborted)
20998
+ return null;
20999
+ const app = getApp();
21000
+ if (app)
21001
+ return app;
21002
+ }
21003
+ return null;
21004
+ }
21005
+ var slackReadyWait, NotifyConfigSchema, NotifyOutputSchema, NotifyExecutor;
21592
21006
  var init_notify = __esm(() => {
21593
21007
  init_zod();
21008
+ init_config4();
21594
21009
  init_secret_scrubber();
21595
21010
  init_base();
21011
+ slackReadyWait = { timeoutMs: 25000, pollMs: 250 };
21596
21012
  NotifyConfigSchema = object2({
21597
21013
  channel: _enum2(["swarm", "slack", "email"]),
21598
21014
  target: string2().optional(),
@@ -21608,7 +21024,7 @@ var init_notify = __esm(() => {
21608
21024
  mode = "instant";
21609
21025
  configSchema = NotifyConfigSchema;
21610
21026
  outputSchema = NotifyOutputSchema;
21611
- async execute(config, context, _meta) {
21027
+ async execute(config, context, meta) {
21612
21028
  const message = scrubSecrets(this.deps.interpolate(config.template, context));
21613
21029
  switch (config.channel) {
21614
21030
  case "swarm": {
@@ -21632,13 +21048,28 @@ var init_notify = __esm(() => {
21632
21048
  }
21633
21049
  }
21634
21050
  case "slack": {
21635
- const { getSlackApp } = await import("./app-m9khefrh.js");
21636
- const app = getSlackApp();
21051
+ const { getSlackApp } = await import("./app-cnfffgwg.js");
21052
+ let app = getSlackApp();
21637
21053
  if (!app) {
21638
- return {
21639
- status: "success",
21640
- output: { sent: false, message }
21641
- };
21054
+ if (!isSlackConfigured()) {
21055
+ return {
21056
+ status: "success",
21057
+ output: { sent: false, message }
21058
+ };
21059
+ }
21060
+ app = await waitForSlackApp(getSlackApp, meta.signal);
21061
+ if (meta.signal?.aborted) {
21062
+ return {
21063
+ status: "failed",
21064
+ error: "Step deadline reached while waiting for the Slack client; message not sent"
21065
+ };
21066
+ }
21067
+ if (!app) {
21068
+ return {
21069
+ status: "failed",
21070
+ error: `Slack is configured but its client was not ready within ${slackReadyWait.timeoutMs}ms; message not sent`
21071
+ };
21072
+ }
21642
21073
  }
21643
21074
  try {
21644
21075
  const result = await app.client.chat.postMessage({
@@ -22141,7 +21572,10 @@ var init_swarm_script = __esm(() => {
22141
21572
  error: "swarm-script: fsMode 'workspace-rw' is v2 only; use 'none' or omit"
22142
21573
  };
22143
21574
  }
22144
- const workflow = await this.deps.db.getWorkflow(meta.workflowId);
21575
+ const workflow = await this.deps.db.getRunWorkflow({
21576
+ id: meta.runId,
21577
+ workflowId: meta.workflowId
21578
+ });
22145
21579
  const agentId = workflow?.createdByAgentId ?? await getWorkflowRunTriggeredByAgentId(meta.runId) ?? undefined;
22146
21580
  const resolved = await resolveScriptSource(config, agentId);
22147
21581
  if (!resolved.ok) {
@@ -22599,6 +22033,7 @@ async function prepareStandaloneScheduleTask(schedule, extraTags = []) {
22599
22033
  routingSource: schedule.targetAgentId ? "engine_default" : undefined,
22600
22034
  model: schedule.model,
22601
22035
  modelTier: schedule.modelTier,
22036
+ profile: schedule.profile,
22602
22037
  scheduleId: schedule.id,
22603
22038
  source: "schedule",
22604
22039
  requestedByUserId: schedule.createdBy,
@@ -24304,6 +23739,7 @@ var init_sdk_allowlist = __esm(() => {
24304
23739
  modelCatalog_refresh: "model-catalog-refresh",
24305
23740
  modelCatalog_overlayUpsert: "model-catalog-overlay-upsert",
24306
23741
  modelProfile_list: "list-model-profiles",
23742
+ modelProfile_check: "check-model-profile",
24307
23743
  slack_read: "slack-read",
24308
23744
  slack_listChannels: "slack-list-channels",
24309
23745
  slack_post: "slack-post",
@@ -24772,6 +24208,12 @@ function formatIdleDuration(ms) {
24772
24208
  const remMinutes = minutes % 60;
24773
24209
  return remMinutes > 0 ? `${hours}h${remMinutes}m` : `${hours}h`;
24774
24210
  }
24211
+ function modelTierDeprecation(tier, harness) {
24212
+ if (!tier)
24213
+ return;
24214
+ const seeded = harness ? Boolean(DEFAULT_MODEL_TIER_MAP[harness]?.[tier]) : false;
24215
+ return { tier, suggestedProfile: seeded ? `${harness}-${tier}` : null };
24216
+ }
24775
24217
  function composeWireResult(r) {
24776
24218
  const normalizedDetails = r.details?.trim() || undefined;
24777
24219
  const dataFallback = !normalizedDetails && r.data && Object.keys(r.data).length > 0 ? JSON.stringify(r.data, null, 2) : undefined;
@@ -25028,7 +24470,7 @@ function setPreloadedTools(server, names) {
25028
24470
  async function applyPreToolCall(name, args, requestInfo, inputSchema) {
25029
24471
  if (requestInfo.callOrigin !== "mcp")
25030
24472
  return { args };
25031
- const dispatcher = await import("./dispatcher-g3tt9hs9.js");
24473
+ const dispatcher = await import("./dispatcher-89zrts8f.js");
25032
24474
  const result = await dispatcher.dispatchPre("pre.tool.call", { tool: name, args, requestInfo }, inputSchema ? {
25033
24475
  validateModify: async (data) => {
25034
24476
  const schema = normalizeObjectSchema(inputSchema) ?? inputSchema;
@@ -25121,17 +24563,28 @@ var scriptSdkRequestOrigins, extensionRequestOrigins, getRequestInfo = (req) =>
25121
24563
  if (typeof ms !== "number")
25122
24564
  return;
25123
24565
  return `That reads as blocked-waiting, ${formatIdleDuration(ms)} since your last update — keep working if you can, and if the wait is genuinely long, defer-task is one way to resume later instead of polling.`;
25124
- }, storeProgressNudge = (r) => {
24566
+ }, LEARNING_NOISE_FLOOR_NUDGES, storeProgressNudge = (r) => {
25125
24567
  const learning = r.data?.learning;
25126
24568
  if (r.ok && learning?.status === "duplicate" && typeof learning.memoryId === "string") {
25127
24569
  return `That learning repeats memory ${learning.memoryId}; if your text adds something, memory-edit that memory instead of storing a new one.`;
25128
24570
  }
24571
+ const noiseSteer = r.ok && learning?.status === "failed" && typeof learning.noiseFloor === "string" ? LEARNING_NOISE_FLOOR_NUDGES[learning.noiseFloor] : undefined;
24572
+ if (noiseSteer)
24573
+ return noiseSteer;
25129
24574
  return storeProgressBlockedWaitingNudge(r);
25130
24575
  }, workflowLongScriptTimeoutNudge = (r) => {
25131
24576
  if (!r.ok)
25132
24577
  return;
25133
24578
  const hint = r.data?.longScriptTimeoutHint;
25134
24579
  return hint ? WORKFLOW_LONG_SCRIPT_TIMEOUT_NUDGE : undefined;
24580
+ }, modelTierDeprecatedOutputSchema, modelTierDeprecatedNudge = (r) => {
24581
+ if (!r.ok)
24582
+ return;
24583
+ const note = r.data?.modelTierDeprecated;
24584
+ if (!note)
24585
+ return;
24586
+ const profile = typeof note.suggestedProfile === "string" ? note.suggestedProfile : `<harness>-${String(note.tier)}`;
24587
+ return `modelTier is deprecated: pass profile "${profile}" (same model).`;
25135
24588
  }, createPageNudge = (r) => {
25136
24589
  if (!r.ok)
25137
24590
  return;
@@ -25269,6 +24722,7 @@ var init_utils = __esm(() => {
25269
24722
  init_otel();
25270
24723
  init_color_literals();
25271
24724
  init_types3();
24725
+ init_types4();
25272
24726
  init_secret_scrubber();
25273
24727
  scriptSdkRequestOrigins = new WeakSet;
25274
24728
  extensionRequestOrigins = new WeakSet;
@@ -25292,6 +24746,14 @@ var init_utils = __esm(() => {
25292
24746
  nudge: string2().optional(),
25293
24747
  truncation: swarmToolTruncationSchema.optional()
25294
24748
  };
24749
+ LEARNING_NOISE_FLOOR_NUDGES = {
24750
+ "too-short": 'That learning was too short to hold a lesson; resend it as a title line, then the rule as "When X, do Y", or drop it if it is only status.',
24751
+ "repeats-progress": `That learning restates this call's progress or output; resend only the rule the next agent should follow ("When X, do Y"), or drop it.`
24752
+ };
24753
+ modelTierDeprecatedOutputSchema = looseObject({
24754
+ tier: string2().optional(),
24755
+ suggestedProfile: string2().nullable().optional()
24756
+ });
25295
24757
  NUDGES = {
25296
24758
  "defer-task": (r) => r.ok ? "Stop working on this task now; the wake-up task will carry your note." : undefined,
25297
24759
  "store-progress": storeProgressNudge,
@@ -25304,6 +24766,11 @@ var init_utils = __esm(() => {
25304
24766
  "patch-workflow": workflowLongScriptTimeoutNudge,
25305
24767
  "patch-workflow-node": workflowLongScriptTimeoutNudge,
25306
24768
  "slack-download-file": slackDownloadFileNudge,
24769
+ "send-task": modelTierDeprecatedNudge,
24770
+ "task-action": modelTierDeprecatedNudge,
24771
+ "create-schedule": modelTierDeprecatedNudge,
24772
+ "update-schedule": modelTierDeprecatedNudge,
24773
+ "patch-schedule": modelTierDeprecatedNudge,
25307
24774
  "slack-read": slackReadNudge,
25308
24775
  create_page: createPageNudge,
25309
24776
  "script-search": (r) => {
@@ -26040,7 +25507,15 @@ async function callBridgeApi(name, args, config, options = {}) {
26040
25507
  const message = data && typeof data === "object" && "error" in data ? String(data.error) : `api failed with ${res.status}`;
26041
25508
  throw new Error(`swarm-sdk: ${name} failed with ${res.status}: ${message}`);
26042
25509
  }
26043
- return scrubObject({ success: res.ok, status: res.status, data });
25510
+ const envelope = data !== null && typeof data === "object" ? data : undefined;
25511
+ const toolRefused = envelope?.success === false;
25512
+ const refusalMessage = toolRefused ? envelope?.message : undefined;
25513
+ return scrubObject({
25514
+ success: res.ok && !toolRefused,
25515
+ status: res.status,
25516
+ data,
25517
+ ...typeof refusalMessage === "string" ? { message: refusalMessage } : {}
25518
+ });
26044
25519
  }
26045
25520
  const res = await fetch(`${baseUrl}${request.path}`, {
26046
25521
  method: request.method,
@@ -27484,7 +26959,7 @@ async function applyPreTaskCreate(args) {
27484
26959
  }
27485
26960
  var MODIFIABLE_OPTION_KEYS, MODIFIABLE_OPTION_KEY_SET;
27486
26961
  var init_apply_task_create = __esm(() => {
27487
- init_model_validation();
26962
+ init_model_validation2();
27488
26963
  init_types4();
27489
26964
  init_secret_scrubber();
27490
26965
  init_event_bus();
@@ -32509,7 +31984,7 @@ async function loadAdapter(name, config, logger) {
32509
31984
  const base = { ...config, apiUrl, logger };
32510
31985
  switch (name) {
32511
31986
  case "telegram": {
32512
- const { TelegramAdapter } = await import("./index-rvccek1w.js");
31987
+ const { TelegramAdapter } = await import("./index-gjwaqaq8.js");
32513
31988
 
32514
31989
  class SwarmTelegramAdapter extends TelegramAdapter {
32515
31990
  isBotMentioned(message, text) {
@@ -32523,7 +31998,7 @@ async function loadAdapter(name, config, logger) {
32523
31998
  });
32524
31999
  }
32525
32000
  case "slack": {
32526
- const { createSlackAdapter } = await import("./index-0eny15vj.js");
32001
+ const { createSlackAdapter } = await import("./index-2skqtd76.js");
32527
32002
  return createSlackAdapter({
32528
32003
  ...base,
32529
32004
  signingSecret: config.signingSecret ?? "",
@@ -32533,7 +32008,7 @@ async function loadAdapter(name, config, logger) {
32533
32008
  });
32534
32009
  }
32535
32010
  case "discord": {
32536
- const { createDiscordAdapter } = await import("./index-w7em4ktq.js");
32011
+ const { createDiscordAdapter } = await import("./index-d6wkh8ar.js");
32537
32012
  return createDiscordAdapter({
32538
32013
  ...base,
32539
32014
  logger: withInfoFilter(logger, keepDiscordInfoLine),
@@ -32542,7 +32017,7 @@ async function loadAdapter(name, config, logger) {
32542
32017
  });
32543
32018
  }
32544
32019
  case "teams": {
32545
- const { createTeamsAdapter } = await import("./index-1qw6f2dc.js");
32020
+ const { createTeamsAdapter } = await import("./index-khe3gp0k.js");
32546
32021
  const { teamsWebhookVerifier, teamsToken } = getChatSdkTestHooks();
32547
32022
  return createTeamsAdapter({
32548
32023
  ...base,
@@ -32751,7 +32226,7 @@ async function readPersistedThreadHistory(threadId) {
32751
32226
  const rows = await new SqliteChatState().getList(`${SDK_THREAD_HISTORY_PREFIX}${threadId}`);
32752
32227
  if (rows.length === 0)
32753
32228
  return [];
32754
- const { Message: MessageClass } = await import("./index-e5pfbsys.js");
32229
+ const { Message: MessageClass } = await import("./index-hjhfk3ra.js");
32755
32230
  return rows.map((row) => MessageClass.fromJSON(row));
32756
32231
  }
32757
32232
  var SDK_THREAD_HISTORY_PREFIX = "msg-history:";
@@ -35295,7 +34770,7 @@ async function startChatSdk() {
35295
34770
  for (const [name, reason] of Object.entries(config.incomplete ?? {})) {
35296
34771
  console.warn(`[chat-sdk] ${name} not started, incomplete: ${scrubSecrets(reason)}`);
35297
34772
  }
35298
- const { Chat: ChatClass } = await import("./index-e5pfbsys.js");
34773
+ const { Chat: ChatClass } = await import("./index-hjhfk3ra.js");
35299
34774
  const state = new SqliteChatState;
35300
34775
  startChatRelayWatcher();
35301
34776
  await Promise.all(CHAT_SDK_ADAPTER_NAMES.map(async (name) => {
@@ -36202,7 +35677,7 @@ async function notifySlack(text) {
36202
35677
  return;
36203
35678
  }
36204
35679
  try {
36205
- const { getSlackApp } = await import("./app-m9khefrh.js");
35680
+ const { getSlackApp } = await import("./app-cnfffgwg.js");
36206
35681
  const app = getSlackApp();
36207
35682
  if (!app) {
36208
35683
  console.warn("[Jira webhook keepalive] Slack not available, cannot send notification");
@@ -36273,7 +35748,7 @@ async function deleteJiraWebhook(webhookId) {
36273
35748
  console.log(`[Jira webhook keepalive] Deleted webhook id=${webhookId}`);
36274
35749
  }
36275
35750
  async function overwriteWebhookIds(next) {
36276
- const { getDbClient } = await import("./db-ef32tbfc.js");
35751
+ const { getDbClient } = await import("./db-amm8w15a.js");
36277
35752
  await getDbClient().transaction(async (tx) => {
36278
35753
  const row = await tx.get("SELECT metadata FROM oauth_apps WHERE provider = 'jira'");
36279
35754
  if (!row) {
@@ -109768,14 +109243,14 @@ async function reloadGlobalConfigsAndIntegrations() {
109768
109243
  return runWithoutRequestAuth(() => runSlackLifecycleExclusive(() => reloadGlobalConfigsAndIntegrationsInner()));
109769
109244
  }
109770
109245
  async function reloadGlobalConfigsAndIntegrationsInner() {
109771
- const { getEmbeddingProvider, resetEmbeddingProvider } = await import("./index-3c5pxbge.js");
109246
+ const { getEmbeddingProvider, resetEmbeddingProvider } = await import("./index-5gk12my8.js");
109772
109247
  const wasEmbeddingsConfigured = getEmbeddingProvider().isConfigured();
109773
109248
  const updated = await loadGlobalConfigsIntoEnv(true);
109774
109249
  await syncTelemetryEnabled("settings").catch((err) => {
109775
109250
  console.error("[config-reload] telemetry re-init failed (non-fatal):", err);
109776
109251
  });
109777
109252
  await stopSlackAppUnderLifecycleLock2();
109778
- const { resetFileStorageProvider } = await import("./registry-hpjfmcfz.js");
109253
+ const { resetFileStorageProvider } = await import("./registry-32b1mft6.js");
109779
109254
  resetFileStorageProvider();
109780
109255
  resetEmbeddingProvider();
109781
109256
  const isEmbeddingsConfigured = getEmbeddingProvider().isConfigured();
@@ -109784,7 +109259,7 @@ async function reloadGlobalConfigsAndIntegrationsInner() {
109784
109259
  integrations.push("embeddings");
109785
109260
  }
109786
109261
  if (isEmbeddingsConfigured) {
109787
- import("./embedding-space-4kyh5qqj.js").then(({ runEmbeddingMaintenance }) => runEmbeddingMaintenance({ backfill: !wasEmbeddingsConfigured })).catch((err) => {
109262
+ import("./embedding-space-ezwenjmj.js").then(({ runEmbeddingMaintenance }) => runEmbeddingMaintenance({ backfill: !wasEmbeddingsConfigured })).catch((err) => {
109788
109263
  console.error("[config-reload] embedding maintenance failed (non-fatal):", err);
109789
109264
  });
109790
109265
  }
@@ -113640,6 +113115,7 @@ var init_apps = __esm(() => {
113640
113115
  id: string2(),
113641
113116
  name: string2(),
113642
113117
  description: string2().optional(),
113118
+ icon: AppIconSchema.optional(),
113643
113119
  createdAt: string2(),
113644
113120
  updatedAt: string2()
113645
113121
  });
@@ -114792,7 +114268,7 @@ var init_app_sync = __esm(() => {
114792
114268
  var registerAppUpsertTool = (server) => {
114793
114269
  createToolRegistrar(server)("app-upsert", {
114794
114270
  title: "Create or update an app",
114795
- description: "Stores a schema-backed app definition with models, queries/actions, pages, reusable elements, optional userConfig fields, and an optional top-level theme (a dashboard preset slug for the app's canvas: hive (stock; omit to inherit the viewer's theme), meadow, iris, rose, cobalt, ember, carbon, paper (the warm editorial paper look), plus the classic presets github, vscode, material, solarized, tokyo, monokai, gruvbox, catppuccin; viewers can override it per-user; unknown slugs degrade to the viewer's dashboard theme), then returns its dashboard URL. userConfig is versioned schema only; each user's values are stored separately, survive rollback, and schema changes are always compatible. Pages may bind a declared field read-only at exactly /user/<field>; pure and bound reusable elements must receive that value through a prop. Elements are private by default: pure elements read declared props, allow $item/$index inside repeats, may expose one leaf ElementSlot, and cannot invoke actions; bound elements may use the defining app's queries/actions, while exported bound elements cannot navigate. Prop kinds include enum with a required non-empty enum values array. Pages or elements reuse them with literal ElementRef targets, and cross-app refs require export: true. Zero-model pure-UI apps are valid. Pass appId to update; breaking a referenced export is blocked by the compatibility gate unless forceElementBreak explicitly names it.",
114271
+ description: `Stores a schema-backed app definition with models, queries/actions, pages, reusable elements, optional userConfig fields, an optional top-level theme (a dashboard preset slug for the app's canvas: hive (stock; omit to inherit the viewer's theme), meadow, iris, rose, cobalt, ember, carbon, paper (the warm editorial paper look), plus the classic presets github, vscode, material, solarized, tokyo, monokai, gruvbox, catppuccin; viewers can override it per-user; unknown slugs degrade to the viewer's dashboard theme), and an optional top-level icon ({ type: "lucide", icon: "<kebab-case lucide icon name>", color?: "#RRGGBB" }) shown as the app's icon on the dashboard Apps page (omit it, or use an unrecognized name, for a generic default), then returns its dashboard URL. userConfig is versioned schema only; each user's values are stored separately, survive rollback, and schema changes are always compatible. Pages may bind a declared field read-only at exactly /user/<field>; pure and bound reusable elements must receive that value through a prop. Elements are private by default: pure elements read declared props, allow $item/$index inside repeats, may expose one leaf ElementSlot, and cannot invoke actions; bound elements may use the defining app's queries/actions, while exported bound elements cannot navigate. Prop kinds include enum with a required non-empty enum values array. Pages or elements reuse them with literal ElementRef targets, and cross-app refs require export: true. Zero-model pure-UI apps are valid. Pass appId to update; breaking a referenced export is blocked by the compatibility gate unless forceElementBreak explicitly names it.`,
114796
114272
  annotations: { destructiveHint: false },
114797
114273
  inputSchema: object2({
114798
114274
  name: string2().min(1).describe("Human-readable app name."),
@@ -119693,6 +119169,29 @@ async function createWorkerTaskFollowUp2(args) {
119693
119169
  } catch {}
119694
119170
  return null;
119695
119171
  }
119172
+ let chainRejection = null;
119173
+ if (status === "completed" && args.chainedTaskId) {
119174
+ const chain = await checkChainedTask(task, args.chainedTaskId, args.completingAgentId ?? task.agentId ?? "");
119175
+ if (chain.ok) {
119176
+ try {
119177
+ await createLogEntry2({
119178
+ eventType: "task_follow_up_suppressed",
119179
+ taskId: task.id,
119180
+ agentId: leadAgent.id,
119181
+ metadata: {
119182
+ reason: "chained_task_live",
119183
+ status,
119184
+ chainedTaskId: chain.child.id,
119185
+ chainedTaskStatus: chain.child.status,
119186
+ ...task.followUpConfig?.onCompleted ? { droppedOnCompleted: true } : {}
119187
+ }
119188
+ });
119189
+ } catch {}
119190
+ console.log(`[worker-follow-up] Skipped follow-up for completed task ${task.id.slice(0, 8)}: work continues in chained task ${chain.child.id.slice(0, 8)} (${chain.child.status})`);
119191
+ return null;
119192
+ }
119193
+ chainRejection = chain;
119194
+ }
119696
119195
  const agentName = taskAgent.name || task.agentId?.slice(0, 8) || "Unknown";
119697
119196
  const taskDesc = task.task.slice(0, 200);
119698
119197
  const creatorAgent = task.creatorAgentId ? `${task.creatorAgentId}${task.creatorAgentId === leadAgent.id ? " (you)" : ""}` : "<none>";
@@ -119714,6 +119213,12 @@ ${instructions}
119714
119213
  task_id: task.id
119715
119214
  });
119716
119215
  followUpDescription = completedResult.text;
119216
+ if (chainRejection) {
119217
+ followUpDescription += resolveTemplate("task.worker.chain_rejected", {
119218
+ chained_task_id: chainRejection.chainedTaskId,
119219
+ reason: chainRejection.reason
119220
+ }).text;
119221
+ }
119717
119222
  } else {
119718
119223
  const reason = failureReason || "(no reason given)";
119719
119224
  const failedResult = resolveTemplate("task.worker.failed", {
@@ -119753,7 +119258,7 @@ ${depLines.join(`
119753
119258
  return null;
119754
119259
  const changes = preFollowUp.action === "modify" ? preFollowUp.data : {};
119755
119260
  const followUpAgentId = changes.agentId === undefined ? leadAgent.id : changes.agentId;
119756
- const wake = followUpAgentId && !instructions ? await findDeferredWakeFor(task.id, followUpAgentId) : null;
119261
+ const wake = followUpAgentId && !instructions && !chainRejection ? await findDeferredWakeFor(task.id, followUpAgentId) : null;
119757
119262
  if (wake) {
119758
119263
  try {
119759
119264
  await createLogEntry2({
@@ -119801,6 +119306,27 @@ ${depLines.join(`
119801
119306
  }
119802
119307
  return followUp;
119803
119308
  }
119309
+ async function checkChainedTask(task, chainedTaskId, completingAgentId) {
119310
+ const reject = (reason) => ({ ok: false, chainedTaskId, reason });
119311
+ let child;
119312
+ try {
119313
+ child = await getTaskById2(chainedTaskId);
119314
+ } catch (err) {
119315
+ return reject(`lookup failed (${err instanceof Error ? err.message : String(err)})`);
119316
+ }
119317
+ if (!child)
119318
+ return reject("no task has this id");
119319
+ if (child.parentTaskId !== task.id) {
119320
+ return reject(child.parentTaskId ? `its parentTaskId is ${child.parentTaskId}, not this task` : "it has no parentTaskId");
119321
+ }
119322
+ if (!completingAgentId || child.creatorAgentId !== completingAgentId) {
119323
+ return reject("it was not created by the agent that completed this task");
119324
+ }
119325
+ if (!LIVE_CHAINED_TASK_STATUSES.has(child.status)) {
119326
+ return reject(`it is ${child.status}, not live`);
119327
+ }
119328
+ return { ok: true, child };
119329
+ }
119804
119330
  async function deferredWorkChatContextKey(task) {
119805
119331
  if (chatThreadOfContextKey(task.contextKey))
119806
119332
  return;
@@ -119996,7 +119522,7 @@ async function createPoolStarvationDecisionTask2(args) {
119996
119522
  });
119997
119523
  return { kind: "created", task: created };
119998
119524
  }
119999
- var TaskFollowUpModifySchema, WORKER_LIVENESS_WINDOW_SECONDS, RESUME_GENERATION_TAG_PREFIX = "resume-generation:", CRASH_RECOVERY_PIN_TAG = "crash-recovery-pin", GRACEFUL_SHUTDOWN_PIN_TAG = "graceful-shutdown-pin", REBOOT_RETRY_PIN_TAG2 = "reboot-retry-pin", MAX_CONTINUATION_HOPS = 32;
119525
+ var TaskFollowUpModifySchema, WORKER_LIVENESS_WINDOW_SECONDS, RESUME_GENERATION_TAG_PREFIX = "resume-generation:", CRASH_RECOVERY_PIN_TAG = "crash-recovery-pin", GRACEFUL_SHUTDOWN_PIN_TAG = "graceful-shutdown-pin", REBOOT_RETRY_PIN_TAG2 = "reboot-retry-pin", LIVE_CHAINED_TASK_STATUSES, MAX_CONTINUATION_HOPS = 32;
120000
119526
  var init_worker_follow_up = __esm(() => {
120001
119527
  init_zod();
120002
119528
  init_db4();
@@ -120020,6 +119546,13 @@ var init_worker_follow_up = __esm(() => {
120020
119546
  followUpConfig: true
120021
119547
  }).partial().extend({ description: string2().trim().min(1).optional() }).strict();
120022
119548
  WORKER_LIVENESS_WINDOW_SECONDS = Number(process.env.WORKER_LIVENESS_WINDOW_SECONDS || "30");
119549
+ LIVE_CHAINED_TASK_STATUSES = new Set([
119550
+ "offered",
119551
+ "reviewing",
119552
+ "pending",
119553
+ "in_progress",
119554
+ "paused"
119555
+ ]);
120023
119556
  });
120024
119557
 
120025
119558
  // src/tasks/task-terminal-effects.ts
@@ -120103,7 +119636,9 @@ ${taskContent}`,
120103
119636
  task: { ...task, task: safeTask },
120104
119637
  status,
120105
119638
  output: safeOutput,
120106
- failureReason: safeFailureReason
119639
+ failureReason: safeFailureReason,
119640
+ chainedTaskId: args.chainedTaskId,
119641
+ completingAgentId: agentId
120107
119642
  });
120108
119643
  if (followUp) {
120109
119644
  console.log(`[task-terminal-effects] Created follow-up task ${followUp.id.slice(0, 8)} for ${status} task ${taskId.slice(0, 8)}`);
@@ -122978,7 +122513,7 @@ var agentMemoryOutputSchema, registerMemoryEditTool = (server) => {
122978
122513
  newString: string2().optional().describe("Replacement for oldString. Required for 'exact' mode. Can be empty to delete."),
122979
122514
  intent: string2().min(1).describe("Why you are editing this memory."),
122980
122515
  expectedVersion: number2().int().min(1).optional(),
122981
- newKey: string2().max(MEMORY_KEY_MAX_LENGTH).regex(MEMORY_KEY_PATTERN, MEMORY_KEY_PATTERN_MESSAGE).optional().describe("Move the memory to this logical path, for example '/longterm/facts/swarm-runtime/slug'. Alone it is a pure move: omit content/oldString/newString. Fails when the key is already used in this scope by the same owner. Moving into /longterm marks the memory as curated on every chunk: it stops expiring and is protected from cleanup, and moving it out later does not bring the expiry back. A key under /longterm must start with /longterm/company-story, /longterm/entities/people, /longterm/entities/customers, /longterm/facts, /longterm/decisions, /longterm/workstreams or /longterm/timeline. Paths under /longterm/company-story, /longterm/entities and /longterm/timeline are lead-only.")
122516
+ newKey: string2().max(MEMORY_KEY_MAX_LENGTH).regex(MEMORY_KEY_PATTERN, MEMORY_KEY_PATTERN_MESSAGE).optional().describe(`Move the memory to this logical path, for example '/longterm/facts/swarm-runtime/slug'. Alone it is a pure move: omit content/oldString/newString. Fails when the key is already used in this scope by the same owner. Moving into /longterm marks the memory as curated on every chunk: it stops expiring and is protected from cleanup, and moving it out later does not bring the expiry back. A move into /learnings starts a ${LEARNING_TTL_DAYS}-day expiry; a move out of /learnings takes the source's own expiry (none for manual). A key under /longterm must start with /longterm/company-story, /longterm/entities/people, /longterm/entities/customers, /longterm/facts, /longterm/decisions, /longterm/workstreams or /longterm/timeline. Paths under /longterm/company-story, /longterm/entities and /longterm/timeline are lead-only.`)
122982
122517
  }),
122983
122518
  outputSchema: swarmToolOutputSchema({
122984
122519
  yourAgentId: string2().optional(),
@@ -123093,6 +122628,7 @@ var init_memory_edit = __esm(() => {
123093
122628
  init_zod();
123094
122629
  init_db4();
123095
122630
  init_memory();
122631
+ init_constants2();
123096
122632
  init_key_guard();
123097
122633
  init_key_paths();
123098
122634
  init_link_resolver();
@@ -123881,6 +123417,51 @@ var init_model_catalog = __esm(() => {
123881
123417
  init_utils();
123882
123418
  });
123883
123419
 
123420
+ // src/tools/model-profiles/check-model-profile.ts
123421
+ var registerCheckModelProfileTool = (server) => {
123422
+ createToolRegistrar(server)("check-model-profile", {
123423
+ title: "Check Model Profile",
123424
+ description: "Check whether an agent can run a model profile before you pass it as `profile` or set it as the agent's default. Judges the harness, the model, the agent's credential report and the profile's credential allowlist. Each row is pass, warn, fail or unverified; only a fail blocks.",
123425
+ annotations: { readOnlyHint: true },
123426
+ inputSchema: object2({
123427
+ agentId: string2().min(1).describe("The agent that would run the profile."),
123428
+ profile: string2().min(1).describe("Model profile name (see list-model-profiles).")
123429
+ }),
123430
+ outputSchema: swarmToolOutputSchema({
123431
+ result: looseObject({
123432
+ agentId: string2().optional(),
123433
+ ok: boolean().optional(),
123434
+ profiles: array2(looseObject({
123435
+ name: string2().optional(),
123436
+ ok: boolean().optional(),
123437
+ checks: array2(looseObject({
123438
+ check: string2().optional(),
123439
+ state: string2().optional(),
123440
+ detail: string2().optional()
123441
+ })).optional()
123442
+ })).optional()
123443
+ }).optional()
123444
+ })
123445
+ }, async ({ agentId, profile }) => {
123446
+ if (!await getAgentById2(agentId))
123447
+ return toolErr(`Agent ${agentId} not found.`);
123448
+ const result = await checkProfileForAgent(agentId, profile);
123449
+ if (!result) {
123450
+ return toolErr(`Unknown model profile "${profile}". List profiles with list-model-profiles.`);
123451
+ }
123452
+ const primary = result.profiles[0];
123453
+ const lines = (primary?.checks ?? []).map((row) => `${row.check}: ${row.state}${row.detail ? ` (${row.detail})` : ""}`);
123454
+ return toolOk(`Agent ${agentId} ${result.ok ? "can" : "cannot"} run model profile "${profile}".`, { details: lines.join(`
123455
+ `), data: { result } });
123456
+ });
123457
+ };
123458
+ var init_check_model_profile = __esm(() => {
123459
+ init_zod();
123460
+ init_db4();
123461
+ init_model_profile_check();
123462
+ init_utils();
123463
+ });
123464
+
123884
123465
  // src/tools/model-profiles/list-model-profiles.ts
123885
123466
  var registerListModelProfilesTool = (server) => {
123886
123467
  createToolRegistrar(server)("list-model-profiles", {
@@ -132310,7 +131891,8 @@ var import_cron_parser2, createScheduleInputSchema, scheduleDataShape, registerC
132310
131891
  inputSchema: createScheduleInputSchema,
132311
131892
  outputSchema: swarmToolOutputSchema({
132312
131893
  yourAgentId: string2().optional(),
132313
- schedule: looseObject(scheduleDataShape).optional()
131894
+ schedule: looseObject(scheduleDataShape).optional(),
131895
+ modelTierDeprecated: modelTierDeprecatedOutputSchema.optional()
132314
131896
  })
132315
131897
  }, async ({
132316
131898
  key,
@@ -132334,6 +131916,7 @@ var import_cron_parser2, createScheduleInputSchema, scheduleDataShape, registerC
132334
131916
  enabled,
132335
131917
  model,
132336
131918
  modelTier,
131919
+ profile,
132337
131920
  allowCustomModel
132338
131921
  }, requestInfo, _meta) => {
132339
131922
  if (!requestInfo.agentId) {
@@ -132373,6 +131956,7 @@ var import_cron_parser2, createScheduleInputSchema, scheduleDataShape, registerC
132373
131956
  if (existing) {
132374
131957
  return toolErr(`Schedule with name "${name}" already exists.`);
132375
131958
  }
131959
+ let targetHarness = null;
132376
131960
  if (targetAgentId) {
132377
131961
  const agent = await getAgentById2(targetAgentId);
132378
131962
  if (!agent) {
@@ -132381,6 +131965,7 @@ var import_cron_parser2, createScheduleInputSchema, scheduleDataShape, registerC
132381
131965
  if (isExtensionAgent2(agent)) {
132382
131966
  return toolErr(extensionAgentAssignmentError2(agent));
132383
131967
  }
131968
+ targetHarness = agent.harnessProvider;
132384
131969
  }
132385
131970
  const resolvedTargetType = targetType ?? "agent-task";
132386
131971
  if (resolvedTargetType === "agent-task" && !taskTemplate) {
@@ -132410,6 +131995,14 @@ var import_cron_parser2, createScheduleInputSchema, scheduleDataShape, registerC
132410
131995
  });
132411
131996
  if (modelError)
132412
131997
  return toolErr(modelError);
131998
+ const profileError = await taskProfileError({
131999
+ profile,
132000
+ model,
132001
+ modelTier,
132002
+ agentId: targetAgentId
132003
+ });
132004
+ if (profileError)
132005
+ return toolErr(profileError);
132413
132006
  try {
132414
132007
  let nextRunAt;
132415
132008
  if (enabled === false) {
@@ -132447,14 +132040,25 @@ var import_cron_parser2, createScheduleInputSchema, scheduleDataShape, registerC
132447
132040
  createdByAgentId: requestInfo.agentId,
132448
132041
  model: normalizedModel.model,
132449
132042
  modelTier: normalizedModel.modelTier,
132043
+ profile,
132450
132044
  scheduleType: scheduleType ?? "recurring",
132451
132045
  createdBy
132452
132046
  });
132453
132047
  const scheduleDesc = isOneTime ? `one-time at ${schedule.nextRunAt}` : cronExpression || `every ${intervalMs}ms`;
132048
+ const modelTierDeprecated = modelTierDeprecation(modelTier, targetHarness);
132454
132049
  return toolOk(`Created schedule "${name}" (${scheduleDesc}). Next run: ${schedule.nextRunAt || "disabled"}`, {
132455
- data: { yourAgentId: requestInfo.agentId, schedule }
132050
+ data: {
132051
+ yourAgentId: requestInfo.agentId,
132052
+ schedule,
132053
+ ...modelTierDeprecated ? { modelTierDeprecated } : {}
132054
+ }
132456
132055
  });
132457
132056
  } catch (error) {
132057
+ if (modelProfileRefError(error) === "missing") {
132058
+ return toolErr(`Unknown model profile "${profile}".`, {
132059
+ data: { yourAgentId: requestInfo.agentId }
132060
+ });
132061
+ }
132458
132062
  const message = error instanceof Error ? error.message : "Unknown error";
132459
132063
  return toolErr(`Failed to create schedule: ${message}`, {
132460
132064
  data: { yourAgentId: requestInfo.agentId }
@@ -132467,7 +132071,8 @@ var init_create_schedule = __esm(() => {
132467
132071
  init_asset_key_auth();
132468
132072
  init_audit_user();
132469
132073
  init_db4();
132470
- init_model_validation();
132074
+ init_model_profiles();
132075
+ init_model_validation2();
132471
132076
  init_db3();
132472
132077
  init_scheduler2();
132473
132078
  init_utils();
@@ -132493,8 +132098,9 @@ var init_create_schedule = __esm(() => {
132493
132098
  targetAgentId: string2().optional().describe("Agent to assign tasks to (omit for task pool)"),
132494
132099
  timezone: string2().default("UTC").optional().describe("Timezone for cron schedules"),
132495
132100
  enabled: boolean().default(true).optional().describe("Whether the schedule is enabled (default: true)"),
132496
- model: string2().trim().min(1).optional().describe("Concrete model override for tasks created by this schedule. Interpreted by each assignee's harness/provider and does not switch providers. Prefer modelTier for portable intent. The model must run on the assignee's harness (an Anthropic model on a Claude agent, an OpenAI model on a Codex agent); a mismatch is rejected."),
132497
- modelTier: ModelTierSchema.optional().describe("Portable model tier for tasks created by this schedule: 'smol', 'regular', 'smart', or 'ultra'. Resolved by each assignee's harness/provider at run time."),
132101
+ model: string2().trim().min(1).optional().describe("Concrete model override for tasks created by this schedule. Interpreted by each assignee's harness/provider and does not switch providers. Prefer `profile` for a named harness + model + effort. The model must run on the assignee's harness (an Anthropic model on a Claude agent, an OpenAI model on a Codex agent); a mismatch is rejected."),
132102
+ modelTier: ModelTierSchema.optional().describe(`Deprecated: pass profile "<harness>-<tier>" instead (same model). Portable model tier for tasks created by this schedule: 'smol', 'regular', 'smart', or 'ultra'. Resolved at claim time through the seeded <harness>-<tier> profile of each assignee's harness.`),
132103
+ profile: string2().trim().min(1).optional().describe("Model profile name for tasks created by this schedule (see list-model-profiles): a named harness + model + effort, applied when each task is claimed. Must run on the target agent. Exclusive with model and modelTier."),
132498
132104
  allowCustomModel: boolean().optional().describe("Accept a `model` the model catalog does not list. Without it an unknown model id is rejected. Only for ids the catalog cannot know yet.")
132499
132105
  });
132500
132106
  scheduleDataShape = {
@@ -132517,6 +132123,7 @@ var init_create_schedule = __esm(() => {
132517
132123
  timezone: string2().optional(),
132518
132124
  model: string2().optional(),
132519
132125
  modelTier: ModelTierSchema.optional(),
132126
+ profile: string2().optional(),
132520
132127
  scheduleType: string2().optional(),
132521
132128
  targetType: ScheduledTaskTargetTypeSchema.optional(),
132522
132129
  workflowId: string2().optional(),
@@ -133142,7 +132749,8 @@ var import_cron_parser3, patchScheduleInputSchema, scheduleDataShape2, registerP
133142
132749
  inputSchema: patchScheduleInputSchema,
133143
132750
  outputSchema: swarmToolOutputSchema({
133144
132751
  yourAgentId: string2().optional(),
133145
- schedule: looseObject(scheduleDataShape2).optional()
132752
+ schedule: looseObject(scheduleDataShape2).optional(),
132753
+ modelTierDeprecated: modelTierDeprecatedOutputSchema.optional()
133146
132754
  })
133147
132755
  }, async ({
133148
132756
  key,
@@ -133165,6 +132773,7 @@ var import_cron_parser3, patchScheduleInputSchema, scheduleDataShape2, registerP
133165
132773
  enabled,
133166
132774
  model,
133167
132775
  modelTier,
132776
+ profile,
133168
132777
  allowCustomModel
133169
132778
  }, requestInfo, _meta) => {
133170
132779
  if (!requestInfo.agentId) {
@@ -133270,6 +132879,14 @@ var import_cron_parser3, patchScheduleInputSchema, scheduleDataShape2, registerP
133270
132879
  if (enabled !== undefined)
133271
132880
  updateData.enabled = enabled;
133272
132881
  const agentChanged = targetAgentId !== undefined && targetAgentId !== schedule.targetAgentId;
132882
+ const profileUpdate = await scheduleProfileUpdate(schedule, {
132883
+ profile,
132884
+ model,
132885
+ modelTier,
132886
+ targetAgentId
132887
+ });
132888
+ if (profileUpdate.error !== undefined)
132889
+ return toolErr(profileUpdate.error);
133273
132890
  if (model !== undefined || modelTier !== undefined) {
133274
132891
  const normalizedModel = splitLegacyModelAlias({ model, modelTier });
133275
132892
  if (normalizedModel.model !== schedule.model || agentChanged) {
@@ -133286,7 +132903,7 @@ var import_cron_parser3, patchScheduleInputSchema, scheduleDataShape2, registerP
133286
132903
  if (modelTier !== undefined || normalizedModel.modelTier) {
133287
132904
  updateData.modelTier = normalizedModel.modelTier ?? null;
133288
132905
  }
133289
- } else if (agentChanged && schedule.model) {
132906
+ } else if (agentChanged && schedule.model && !profileUpdate.fields.profile) {
133290
132907
  const modelError = await explicitModelErrorForAgent({
133291
132908
  model: schedule.model,
133292
132909
  allowCustomModel: true,
@@ -133295,6 +132912,7 @@ var import_cron_parser3, patchScheduleInputSchema, scheduleDataShape2, registerP
133295
132912
  if (modelError)
133296
132913
  return toolErr(modelError);
133297
132914
  }
132915
+ Object.assign(updateData, profileUpdate.fields);
133298
132916
  if (schedule.scheduleType === "one_time") {
133299
132917
  if (enabled === false) {
133300
132918
  updateData.nextRunAt = null;
@@ -133327,10 +132945,20 @@ var import_cron_parser3, patchScheduleInputSchema, scheduleDataShape2, registerP
133327
132945
  if (!updated) {
133328
132946
  return toolErr("Failed to update schedule.");
133329
132947
  }
132948
+ const modelTierDeprecated = modelTierDeprecation(modelTier, updated.targetAgentId ? (await getAgentById2(updated.targetAgentId))?.harnessProvider : null);
133330
132949
  return toolOk(`Patched schedule "${updated.name}". Next run: ${updated.nextRunAt || "disabled"}`, {
133331
- data: { yourAgentId: requestInfo.agentId, schedule: updated }
132950
+ data: {
132951
+ yourAgentId: requestInfo.agentId,
132952
+ schedule: updated,
132953
+ ...modelTierDeprecated ? { modelTierDeprecated } : {}
132954
+ }
133332
132955
  });
133333
132956
  } catch (error) {
132957
+ if (modelProfileRefError(error) === "missing") {
132958
+ return toolErr(`Unknown model profile "${profile}".`, {
132959
+ data: { yourAgentId: requestInfo.agentId }
132960
+ });
132961
+ }
133334
132962
  const message = error instanceof Error ? error.message : "Unknown error";
133335
132963
  return toolErr(`Failed to update schedule: ${message}`, {
133336
132964
  data: { yourAgentId: requestInfo.agentId }
@@ -133343,7 +132971,8 @@ var init_patch_schedule = __esm(() => {
133343
132971
  init_asset_key_auth();
133344
132972
  init_audit_user();
133345
132973
  init_db4();
133346
- init_model_validation();
132974
+ init_model_profiles();
132975
+ init_model_validation2();
133347
132976
  init_validate();
133348
132977
  init_db3();
133349
132978
  init_rbac();
@@ -133371,7 +133000,8 @@ var init_patch_schedule = __esm(() => {
133371
133000
  timezone: string2().optional().describe("New timezone"),
133372
133001
  enabled: boolean().optional().describe("Enable or disable the schedule"),
133373
133002
  model: string2().trim().min(1).nullable().optional().describe("Concrete model override for tasks created by this schedule. Set to null to clear. The model must run on the assignee's harness (an Anthropic model on a Claude agent, an OpenAI model on a Codex agent); a mismatch is rejected."),
133374
- modelTier: ModelTierSchema.nullable().optional().describe("Portable model tier for tasks created by this schedule. Set to null to clear."),
133003
+ modelTier: ModelTierSchema.nullable().optional().describe('Deprecated: pass profile "<harness>-<tier>" instead (same model). Portable model tier for tasks created by this schedule, resolved at claim time through the seeded <harness>-<tier> profile. Set to null to clear.'),
133004
+ profile: string2().trim().min(1).nullable().optional().describe("Model profile name for tasks created by this schedule (see list-model-profiles). Must run on the target agent. Exclusive with model and modelTier: setting a profile clears them, and setting either clears the profile. Set to null to clear."),
133375
133005
  allowCustomModel: boolean().optional().describe("Accept a `model` the model catalog does not list. Without it an unknown model id is rejected. Only for ids the catalog cannot know yet.")
133376
133006
  });
133377
133007
  scheduleDataShape2 = {
@@ -133394,6 +133024,7 @@ var init_patch_schedule = __esm(() => {
133394
133024
  timezone: string2().optional(),
133395
133025
  model: string2().optional(),
133396
133026
  modelTier: ModelTierSchema.optional(),
133027
+ profile: string2().optional(),
133397
133028
  scheduleType: string2().optional(),
133398
133029
  targetType: ScheduledTaskTargetTypeSchema.optional(),
133399
133030
  workflowId: string2().optional(),
@@ -133476,7 +133107,8 @@ var import_cron_parser4, updateScheduleInputSchema, scheduleDataShape3, register
133476
133107
  inputSchema: updateScheduleInputSchema,
133477
133108
  outputSchema: swarmToolOutputSchema({
133478
133109
  yourAgentId: string2().optional(),
133479
- schedule: looseObject(scheduleDataShape3).optional()
133110
+ schedule: looseObject(scheduleDataShape3).optional(),
133111
+ modelTierDeprecated: modelTierDeprecatedOutputSchema.optional()
133480
133112
  })
133481
133113
  }, async ({
133482
133114
  key,
@@ -133499,6 +133131,7 @@ var import_cron_parser4, updateScheduleInputSchema, scheduleDataShape3, register
133499
133131
  enabled,
133500
133132
  model,
133501
133133
  modelTier,
133134
+ profile,
133502
133135
  allowCustomModel
133503
133136
  }, requestInfo, _meta) => {
133504
133137
  if (!requestInfo.agentId) {
@@ -133604,6 +133237,14 @@ var import_cron_parser4, updateScheduleInputSchema, scheduleDataShape3, register
133604
133237
  if (enabled !== undefined)
133605
133238
  updateData.enabled = enabled;
133606
133239
  const agentChanged = targetAgentId !== undefined && targetAgentId !== schedule.targetAgentId;
133240
+ const profileUpdate = await scheduleProfileUpdate(schedule, {
133241
+ profile,
133242
+ model,
133243
+ modelTier,
133244
+ targetAgentId
133245
+ });
133246
+ if (profileUpdate.error !== undefined)
133247
+ return toolErr(profileUpdate.error);
133607
133248
  if (model !== undefined || modelTier !== undefined) {
133608
133249
  const normalizedModel = splitLegacyModelAlias({ model, modelTier });
133609
133250
  if (normalizedModel.model !== schedule.model || agentChanged) {
@@ -133620,7 +133261,7 @@ var import_cron_parser4, updateScheduleInputSchema, scheduleDataShape3, register
133620
133261
  if (modelTier !== undefined || normalizedModel.modelTier) {
133621
133262
  updateData.modelTier = normalizedModel.modelTier ?? null;
133622
133263
  }
133623
- } else if (agentChanged && schedule.model) {
133264
+ } else if (agentChanged && schedule.model && !profileUpdate.fields.profile) {
133624
133265
  const modelError = await explicitModelErrorForAgent({
133625
133266
  model: schedule.model,
133626
133267
  allowCustomModel: true,
@@ -133629,6 +133270,7 @@ var import_cron_parser4, updateScheduleInputSchema, scheduleDataShape3, register
133629
133270
  if (modelError)
133630
133271
  return toolErr(modelError);
133631
133272
  }
133273
+ Object.assign(updateData, profileUpdate.fields);
133632
133274
  if (schedule.scheduleType === "one_time") {
133633
133275
  if (enabled === false) {
133634
133276
  updateData.nextRunAt = null;
@@ -133661,10 +133303,20 @@ var import_cron_parser4, updateScheduleInputSchema, scheduleDataShape3, register
133661
133303
  if (!updated) {
133662
133304
  return toolErr("Failed to update schedule.");
133663
133305
  }
133306
+ const modelTierDeprecated = modelTierDeprecation(modelTier, updated.targetAgentId ? (await getAgentById2(updated.targetAgentId))?.harnessProvider : null);
133664
133307
  return toolOk(`Updated schedule "${updated.name}". Next run: ${updated.nextRunAt || "disabled"}`, {
133665
- data: { yourAgentId: requestInfo.agentId, schedule: updated }
133308
+ data: {
133309
+ yourAgentId: requestInfo.agentId,
133310
+ schedule: updated,
133311
+ ...modelTierDeprecated ? { modelTierDeprecated } : {}
133312
+ }
133666
133313
  });
133667
133314
  } catch (error) {
133315
+ if (modelProfileRefError(error) === "missing") {
133316
+ return toolErr(`Unknown model profile "${profile}".`, {
133317
+ data: { yourAgentId: requestInfo.agentId }
133318
+ });
133319
+ }
133668
133320
  const message = error instanceof Error ? error.message : "Unknown error";
133669
133321
  return toolErr(`Failed to update schedule: ${message}`, {
133670
133322
  data: { yourAgentId: requestInfo.agentId }
@@ -133677,7 +133329,8 @@ var init_update_schedule = __esm(() => {
133677
133329
  init_asset_key_auth();
133678
133330
  init_audit_user();
133679
133331
  init_db4();
133680
- init_model_validation();
133332
+ init_model_profiles();
133333
+ init_model_validation2();
133681
133334
  init_validate();
133682
133335
  init_db3();
133683
133336
  init_rbac();
@@ -133705,7 +133358,8 @@ var init_update_schedule = __esm(() => {
133705
133358
  timezone: string2().optional().describe("New timezone"),
133706
133359
  enabled: boolean().optional().describe("Enable or disable the schedule"),
133707
133360
  model: string2().trim().min(1).nullable().optional().describe("Concrete model override for tasks created by this schedule. Set to null to clear. The model must run on the assignee's harness (an Anthropic model on a Claude agent, an OpenAI model on a Codex agent); a mismatch is rejected."),
133708
- modelTier: ModelTierSchema.nullable().optional().describe("Portable model tier for tasks created by this schedule. Set to null to clear."),
133361
+ modelTier: ModelTierSchema.nullable().optional().describe('Deprecated: pass profile "<harness>-<tier>" instead (same model). Portable model tier for tasks created by this schedule, resolved at claim time through the seeded <harness>-<tier> profile. Set to null to clear.'),
133362
+ profile: string2().trim().min(1).nullable().optional().describe("Model profile name for tasks created by this schedule (see list-model-profiles). Must run on the target agent. Exclusive with model and modelTier: setting a profile clears them, and setting either clears the profile. Set to null to clear."),
133709
133363
  allowCustomModel: boolean().optional().describe("Accept a `model` the model catalog does not list. Without it an unknown model id is rejected. Only for ids the catalog cannot know yet.")
133710
133364
  });
133711
133365
  scheduleDataShape3 = {
@@ -133728,6 +133382,7 @@ var init_update_schedule = __esm(() => {
133728
133382
  timezone: string2().optional(),
133729
133383
  model: string2().optional(),
133730
133384
  modelTier: ModelTierSchema.optional(),
133385
+ profile: string2().optional(),
133731
133386
  scheduleType: string2().optional(),
133732
133387
  targetType: ScheduledTaskTargetTypeSchema.optional(),
133733
133388
  workflowId: string2().optional(),
@@ -134315,7 +133970,7 @@ ${body.stdout.trim()}`);
134315
133970
 
134316
133971
  `) : undefined;
134317
133972
  }
134318
- var SCRIPT_RUN_DESCRIPTION = "Run a named swarm-shared script (callable across agents and from workflow `swarm-script` nodes), OR inline source (auto-saved as scratch to the catalog). Inline source executes without the `script-upsert` compile-time typecheck. Use for swarm-visible, durable scripts. For local-only throwaway TS, use code-mode `run`.", registerScriptRunTool = (server) => {
133973
+ var SCRIPT_RUN_DESCRIPTION = "Run a named swarm-shared script (callable across agents and from workflow `swarm-script` nodes), OR inline source (auto-saved as scratch to the catalog). Inline source executes without the `script-upsert` compile-time typecheck. Use for swarm-visible, durable scripts. For local-only throwaway TS, use code-mode `run`. The run ends when the script's default export resolves: a call it did not await gets 2 s more, then is stopped (native) or aborted at once (quickjs), so await every write that must land. A `Promise.race` deadline therefore bounds the run; a nested `script_run` that lost the race keeps running on the server under its own wall.", registerScriptRunTool = (server) => {
134319
133974
  createToolRegistrar(server)("script-run", {
134320
133975
  title: "Script Run",
134321
133976
  description: SCRIPT_RUN_DESCRIPTION,
@@ -134855,7 +134510,8 @@ async function sendTaskHandler(ctx, {
134855
134510
  profile,
134856
134511
  model: normalizedModel.model,
134857
134512
  modelTier: normalizedModel.modelTier,
134858
- agentId: effectiveAgentId
134513
+ agentId: effectiveAgentId,
134514
+ vcsRepo: effectiveVcsRepo || effectiveParentTask?.vcsRepo
134859
134515
  });
134860
134516
  if (profileError)
134861
134517
  return toolErr(profileError, { data: { yourAgentId: creatorAgentId } });
@@ -135037,9 +134693,12 @@ async function sendTaskHandler(ctx, {
135037
134693
  throw error;
135038
134694
  return { success: false, message: `Unknown model profile "${profile}".`, task: undefined };
135039
134695
  });
134696
+ const assigneeId = result.task?.agentId ?? result.task?.offeredTo;
134697
+ const modelTierDeprecated = result.success && modelTier ? modelTierDeprecation(modelTier, assigneeId ? (await getAgentById2(assigneeId))?.harnessProvider : null) : undefined;
135040
134698
  const data = {
135041
134699
  yourAgentId: creatorAgentId,
135042
- task: result.task
134700
+ task: result.task,
134701
+ ...modelTierDeprecated ? { modelTierDeprecated } : {}
135043
134702
  };
135044
134703
  const details = result.task ? JSON.stringify(result.task, null, 2) : undefined;
135045
134704
  return result.success ? toolOk(result.message, { data, details }) : toolErr(result.message, { data, details });
@@ -135060,7 +134719,7 @@ var init_send_task = __esm(() => {
135060
134719
  init_db4();
135061
134720
  init_model_profiles();
135062
134721
  init_tracker();
135063
- init_model_validation();
134722
+ init_model_validation2();
135064
134723
  init_apply_task_create();
135065
134724
  init_rbac();
135066
134725
  init_follow_up_redelegation_guard();
@@ -135088,8 +134747,8 @@ var init_send_task = __esm(() => {
135088
134747
  parentTaskId: uuid().optional().describe("Parent task ID for session continuity. Child task will resume the parent's Claude session. Auto-routes to the same worker unless agentId is explicitly provided."),
135089
134748
  dir: string2().min(1).startsWith("/").optional().describe("Working directory (absolute path) for the agent to start in. If the directory doesn't exist, falls back to the default working directory."),
135090
134749
  vcsRepo: string2().optional().describe("VCS repo identifier (e.g., 'desplega-ai/agent-swarm' for GitHub or 'group/project' for GitLab). Links the task to a registered repo for workspace context."),
135091
- model: string2().trim().min(1).optional().describe("Concrete model override for this task, interpreted by the assignee's harness/provider. This does not switch providers. Prefer modelTier for portable intent. The model must run on the assignee's harness (an Anthropic model on a Claude agent, an OpenAI model on a Codex agent); a mismatch is rejected."),
135092
- modelTier: ModelTierSchema.optional().describe("Portable model tier for this task: 'smol', 'regular', 'smart', or 'ultra'. Resolved at claim/run time using the assignee's harness/provider. Legacy model shortnames map as haiku→smol, sonnet→regular, opus→smart, fable→ultra."),
134750
+ model: string2().trim().min(1).optional().describe("Concrete model override for this task, interpreted by the assignee's harness/provider. This does not switch providers. Prefer `profile` for a named harness + model + effort. The model must run on the assignee's harness (an Anthropic model on a Claude agent, an OpenAI model on a Codex agent); a mismatch is rejected."),
134751
+ modelTier: ModelTierSchema.optional().describe(`Deprecated: pass profile "<harness>-<tier>" instead (same model). Portable model tier for this task: 'smol', 'regular', 'smart', or 'ultra'. Resolved at claim time through the seeded <harness>-<tier> profile of the assignee's harness. Legacy model shortnames map as haiku→smol, sonnet→regular, opus→smart, fable→ultra.`),
135093
134752
  allowCustomModel: boolean().optional().describe("Accept a `model` the model catalog does not list. Without it an unknown model id is rejected. Only for ids the catalog cannot know yet (a fresh launch, a private deployment)."),
135094
134753
  effort: ReasoningEffortSchema.optional().describe("Reasoning effort for this task: 'off', 'low', 'medium', 'high', 'xhigh', or 'max'. If omitted, the assignee's REASONING_EFFORT_OVERRIDE/default applies."),
135095
134754
  profile: string2().trim().min(1).optional().describe("Model profile name (see list-model-profiles): a named harness + model + effort, applied when the task is claimed. Must run on the assignee's harness. Exclusive with model and modelTier. A set `effort` still wins over the profile's."),
@@ -135130,7 +134789,8 @@ var init_send_task = __esm(() => {
135130
134789
  });
135131
134790
  sendTaskOutputSchema = swarmToolOutputSchema({
135132
134791
  yourAgentId: string2().optional(),
135133
- task: looseAgentTaskOutputSchema.optional()
134792
+ task: looseAgentTaskOutputSchema.optional(),
134793
+ modelTierDeprecated: modelTierDeprecatedOutputSchema.optional()
135134
134794
  });
135135
134795
  TRACKER_OWNERSHIP_TRANSFER_PARENT_STATUSES = new Set([
135136
134796
  "superseded",
@@ -138240,6 +137900,9 @@ async function storeTaskLearning(params) {
138240
137900
  if (tags.length > LEARNING_MAX_TAGS) {
138241
137901
  return { status: "failed", error: `learning takes at most ${LEARNING_MAX_TAGS} tags` };
138242
137902
  }
137903
+ const noise = checkNoiseFloor(text, params.sameCall);
137904
+ if (noise)
137905
+ return noise;
138243
137906
  const workstream = resolveLearningWorkstream(input.workstream === undefined ? undefined : scrubSecrets(input.workstream), task.vcsRepo === undefined ? undefined : scrubSecrets(task.vcsRepo));
138244
137907
  try {
138245
137908
  const replay = await findReplay(task.id, contentSha256(text));
@@ -138258,6 +137921,29 @@ async function storeTaskLearning(params) {
138258
137921
  };
138259
137922
  }
138260
137923
  }
137924
+ function normalizeForEcho(value) {
137925
+ return value.toLowerCase().replace(/\s+/g, " ").trim();
137926
+ }
137927
+ function checkNoiseFloor(text, sameCall) {
137928
+ if (text.length < LEARNING_MIN_CHARS) {
137929
+ return {
137930
+ status: "failed",
137931
+ noiseFloor: "too-short",
137932
+ error: `learning is under ${LEARNING_MIN_CHARS} characters; write a title line, then the rule as "When X, do Y"`
137933
+ };
137934
+ }
137935
+ const learning = normalizeForEcho(text);
137936
+ for (const [field, value] of Object.entries(sameCall ?? {})) {
137937
+ if (value && normalizeForEcho(scrubSecrets(value)).includes(learning)) {
137938
+ return {
137939
+ status: "failed",
137940
+ noiseFloor: "repeats-progress",
137941
+ error: `learning repeats this call's ${field}; store the rule the next agent should follow, not the result`
137942
+ };
137943
+ }
137944
+ }
137945
+ return null;
137946
+ }
138261
137947
  async function findReplay(taskId, contentHash) {
138262
137948
  const replay = await getDbClient2().get(`SELECT id, key FROM agent_memory
138263
137949
  WHERE sourceTaskId = ? AND contentHash = ? AND key LIKE '${LEARNINGS_ROOT}/%'
@@ -138274,7 +137960,9 @@ async function findNearDuplicate(params) {
138274
137960
  scope: "swarm",
138275
137961
  isLead: params.isLead,
138276
137962
  keyPrefix,
138277
- limit: 1
137963
+ limit: 1,
137964
+ exhaustive: true,
137965
+ minSimilarity: LEARNING_DUPLICATE_MIN_SIMILARITY
138278
137966
  })));
138279
137967
  const best = results.flat().filter((candidate) => candidate.key).sort((a, b) => b.similarity - a.similarity)[0];
138280
137968
  if (!best || best.similarity < LEARNING_DUPLICATE_MIN_SIMILARITY)
@@ -138339,16 +138027,17 @@ async function insertLearning(params) {
138339
138027
  }
138340
138028
  return { status: "failed", error: `no free key under ${baseKey}` };
138341
138029
  }
138342
- var LEARNING_MAX_CHARS = 2000, LEARNING_MAX_TAGS = 5, LEARNINGS_ROOT = "/learnings", SEGMENT_MAX_CHARS = 60, KEY_ATTEMPTS = 4, DUPLICATE_SEARCH_PREFIXES, LEARNING_DUPLICATE_RATING_SOURCE = "learning-duplicate";
138030
+ var LEARNING_MAX_CHARS = 2000, LEARNING_MAX_TAGS = 5, LEARNING_MIN_CHARS = 80, SEGMENT_MAX_CHARS = 60, KEY_ATTEMPTS = 4, DUPLICATE_SEARCH_PREFIXES, LEARNING_DUPLICATE_RATING_SOURCE = "learning-duplicate";
138343
138031
  var init_task_learning = __esm(() => {
138344
138032
  init_db4();
138345
138033
  init_memory();
138346
138034
  init_constants2();
138347
138035
  init_index_content();
138036
+ init_key_paths();
138348
138037
  init_store();
138349
138038
  init_profile_sync();
138350
138039
  init_secret_scrubber();
138351
- DUPLICATE_SEARCH_PREFIXES = [`${LEARNINGS_ROOT}/`, "/longterm/workstreams/"];
138040
+ DUPLICATE_SEARCH_PREFIXES = [`${LEARNINGS_ROOT}/`, `${LONGTERM_ROOT}/`];
138352
138041
  });
138353
138042
 
138354
138043
  // src/tasks/task-skip.ts
@@ -138393,7 +138082,7 @@ function learningSentence(result) {
138393
138082
  var BLOCKED_WAITING_PATTERN, BLOCKED_WAITING_MIN_ELAPSED_MS, storeProgressOutputSchema, registerStoreProgressTool = (server) => {
138394
138083
  createToolRegistrar(server)("store-progress", {
138395
138084
  title: "Store task progress",
138396
- description: "Stores the progress of a specific task. Can also mark task as completed, failed, or skipped, which will set the agent back to idle. Use skipped only when the work is not yours to handle, such as a Slack thread message addressed to someone else; never skip an explicit @mention of you or work assigned to you.",
138085
+ description: "Stores the progress of a specific task. Can also mark task as completed, failed, or skipped, which will set the agent back to idle. Use skipped only when the work is not yours to handle, such as a Slack thread message addressed to someone else; never skip an explicit @mention of you or work assigned to you. When a live child task you created continues the work, complete with chainedTaskId so the lead is not woken for this step.",
138397
138086
  annotations: { idempotentHint: true },
138398
138087
  inputSchema: object2({
138399
138088
  taskId: uuid().optional().describe("Full task UUID. Defaults to the caller-owned task in X-Source-Task-Id; required outside task context."),
@@ -138410,8 +138099,9 @@ var BLOCKED_WAITING_PATTERN, BLOCKED_WAITING_MIN_ELAPSED_MS, storeProgressOutput
138410
138099
  workstream: string2().optional(),
138411
138100
  tags: array2(string2()).optional()
138412
138101
  })
138413
- ]).optional().describe(`A lesson to keep. Add one only when it would change how the next agent works: a gotcha, a dead end, a pattern that worked. Not a progress line. Stored as a swarm memory at /learnings/<workstream>/<slug>, tagged "learning" and tied to this task. The first line of text is the title. At most ~500 tokens and ${LEARNING_MAX_TAGS} kebab tags. workstream defaults to the task's repo name, else "general". Send it on or before the completing call: a call on a finished task stores nothing. A failed learning write is reported in the result and never blocks the progress update.`),
138102
+ ]).optional().describe(`A lesson to keep. Add one only when it would change how the next agent works: a gotcha, a dead end, a pattern that worked. Line 1 of text is the title. Line 2 is the rule, as "When X, do Y"; evidence goes after it, since recall shows only the first 300 characters. Not a learning: a status or pass/fail line, a restatement of this call's progress or output, text already in a skill, a claim you did not verify. Text under ${LEARNING_MIN_CHARS} characters, or contained in this call's progress or output, is rejected. Stored as a swarm memory at /learnings/<workstream>/<slug>, tagged "learning" and tied to this task. Expires after ${LEARNING_TTL_DAYS} days. At most ~500 tokens and ${LEARNING_MAX_TAGS} kebab tags. workstream defaults to the task's repo name, else "general". Send it on or before the completing call: a call on a finished task stores nothing. A failed learning write is reported in the result and never blocks the progress update.`),
138414
138103
  persistMemory: boolean().optional().describe("Opt in to task_completion memory persistence for automatic/recurring tasks. Manual tasks are persisted by default; scheduled, system, heartbeat/boot-triage, monitor, and digest tasks are skipped unless this is true."),
138104
+ chainedTaskId: uuid().optional().describe("With status 'completed' only: the id of a live child task you created (send-task with parentTaskId set to this task) that carries this result forward. The engine then creates no lead follow-up for this completion and logs the handoff on this task. The child must exist, have this task as parentTaskId, be created by you, and be pending, offered, reviewing, in_progress or paused. If any check fails, the normal follow-up is created and names the reason; the completion itself never fails. Ignored for every other status: a failure always wakes the lead."),
138415
138105
  force: boolean().optional().describe("On an already-terminal task, overwrite explicitly provided output and/or failureReason text while preserving status and finishedAt and without replaying events, memory writes, follow-up creation, business-use ensure, or capacity updates. Differing terminal text is otherwise discarded and reported as a failure.")
138416
138106
  }),
138417
138107
  outputSchema: storeProgressOutputSchema
@@ -138425,6 +138115,7 @@ var BLOCKED_WAITING_PATTERN, BLOCKED_WAITING_MIN_ELAPSED_MS, storeProgressOutput
138425
138115
  citations,
138426
138116
  learning,
138427
138117
  persistMemory,
138118
+ chainedTaskId,
138428
138119
  force
138429
138120
  }, requestInfo, _meta) => {
138430
138121
  if (!requestInfo.agentId) {
@@ -138601,7 +138292,8 @@ var BLOCKED_WAITING_PATTERN, BLOCKED_WAITING_MIN_ELAPSED_MS, storeProgressOutput
138601
138292
  agentId: agent.id,
138602
138293
  isLead: agent.isLead === true,
138603
138294
  task: existingTask,
138604
- learning
138295
+ learning,
138296
+ sameCall: { progress, output }
138605
138297
  }).then(resolve, (err) => resolve({ status: "failed", error: scrubSecrets(String(err)) })));
138606
138298
  });
138607
138299
  }
@@ -138731,7 +138423,8 @@ This check refuses once per task; the next completion is accepted and unfixed ci
138731
138423
  output,
138732
138424
  failureReason,
138733
138425
  agentId: requestInfo.agentId,
138734
- persistMemory
138426
+ persistMemory,
138427
+ ...status === "completed" && chainedTaskId ? { chainedTaskId } : {}
138735
138428
  });
138736
138429
  }
138737
138430
  const skipWasFresh = status === "skipped" && result.success && result.task?.status === "skipped" && !(("wasNoOp" in result) && result.wasNoOp) && !(("wasForcedOverwrite" in result) && result.wasForcedOverwrite);
@@ -138761,6 +138454,7 @@ This check refuses once per task; the next completion is accepted and unfixed ci
138761
138454
  var init_store_progress = __esm(() => {
138762
138455
  init_zod();
138763
138456
  init_db4();
138457
+ init_constants2();
138764
138458
  init_task_learning();
138765
138459
  init_task_citations2();
138766
138460
  init_agent_fs_provider();
@@ -138791,8 +138485,9 @@ var init_store_progress = __esm(() => {
138791
138485
  memoryId: string2().optional(),
138792
138486
  workstream: string2().optional(),
138793
138487
  similarity: number2().optional(),
138794
- error: string2().optional()
138795
- }).optional().describe("Present when the call carried a learning: stored, replayed (same text already stored for this task), duplicate (an existing swarm memory at key/memoryId says the same; similarity is the raw cosine), or failed with error.")
138488
+ error: string2().optional(),
138489
+ noiseFloor: string2().optional()
138490
+ }).optional().describe("Present when the call carried a learning: stored, replayed (same text already stored for this task), duplicate (an existing swarm memory at key/memoryId says the same; similarity is the raw cosine), or failed with error. A failed learning rejected as noise also carries noiseFloor: too-short or repeats-progress.")
138796
138491
  });
138797
138492
  });
138798
138493
 
@@ -139938,10 +139633,12 @@ async function taskActionHandler(ctx, input) {
139938
139633
  switch (action) {
139939
139634
  case "create": {
139940
139635
  const newTask = await createTaskExtended2(preparedCreate.description, preparedCreate.options);
139636
+ const modelTierDeprecated = modelTierDeprecation(input.modelTier, null);
139941
139637
  return {
139942
139638
  success: true,
139943
139639
  message: `Created unassigned task "${newTask.id}".`,
139944
- task: newTask
139640
+ task: newTask,
139641
+ ...modelTierDeprecated ? { modelTierDeprecated } : {}
139945
139642
  };
139946
139643
  }
139947
139644
  case "claim": {
@@ -140231,7 +139928,7 @@ var init_task_action = __esm(() => {
140231
139928
  init_budget_refusal_notify();
140232
139929
  init_db4();
140233
139930
  init_model_profiles();
140234
- init_model_validation();
139931
+ init_model_validation2();
140235
139932
  init_multi_runtime();
140236
139933
  init_apply_task_create();
140237
139934
  init_task_tool_ctx();
@@ -140260,7 +139957,7 @@ var init_task_action = __esm(() => {
140260
139957
  reason: string2().optional().describe("Reason for rejection (optional for 'reject')."),
140261
139958
  dir: string2().min(1).startsWith("/").optional().describe("Working directory (absolute path) for the agent to start in. Only used with 'create' action."),
140262
139959
  model: string2().trim().min(1).optional().describe("Concrete model override for the created task, interpreted by the claiming worker's harness/provider. This does not switch providers. Only used with 'create' action. The model must run on the assignee's harness (an Anthropic model on a Claude agent, an OpenAI model on a Codex agent); a mismatch is rejected."),
140263
- modelTier: ModelTierSchema.optional().describe("Portable model tier for the created task: 'smol', 'regular', 'smart', or 'ultra'. Resolved when a worker claims/runs the task. Only used with 'create' action."),
139960
+ modelTier: ModelTierSchema.optional().describe(`Deprecated: pass profile "<harness>-<tier>" instead (same model). Portable model tier for the created task: 'smol', 'regular', 'smart', or 'ultra'. Resolved when a worker claims the task, through the seeded <harness>-<tier> profile of its harness. Only used with 'create' action.`),
140264
139961
  allowCustomModel: boolean().optional().describe("Accept a `model` the model catalog does not list. Without it an unknown model id is rejected. Only used with 'create' action."),
140265
139962
  effort: ReasoningEffortSchema.optional().describe("Reasoning effort for the created task: 'off', 'low', 'medium', 'high', 'xhigh', or 'max'. Only used with 'create' action."),
140266
139963
  profile: string2().trim().min(1).optional().describe("Model profile name for the created pool task (see list-model-profiles); only workers on its harness claim it. Exclusive with model and modelTier. Only used with 'create' action."),
@@ -140277,7 +139974,8 @@ var init_task_action = __esm(() => {
140277
139974
  globalBudget: number2().optional(),
140278
139975
  userSpend: number2().optional(),
140279
139976
  userBudget: number2().optional(),
140280
- resetAt: string2().optional()
139977
+ resetAt: string2().optional(),
139978
+ modelTierDeprecated: modelTierDeprecatedOutputSchema.optional()
140281
139979
  });
140282
139980
  });
140283
139981
 
@@ -140839,7 +140537,10 @@ function asConfig(value) {
140839
140537
  function isStatic(value) {
140840
140538
  return typeof value === "string" && value.trim() !== "" && !value.includes("{{");
140841
140539
  }
140842
- async function workflowModelErrors(def) {
140540
+ function asString(value) {
140541
+ return typeof value === "string" ? value : undefined;
140542
+ }
140543
+ async function workflowModelErrors(def, { vcsRepo } = {}) {
140843
140544
  const errors = [];
140844
140545
  for (const node of def.nodes) {
140845
140546
  const targets = [];
@@ -140851,6 +140552,17 @@ async function workflowModelErrors(def) {
140851
140552
  targets.push({ config: body, path: "config.body.config" });
140852
140553
  }
140853
140554
  for (const { config, path } of targets) {
140555
+ if (isStatic(config.profile)) {
140556
+ const error = await taskProfileError({
140557
+ profile: config.profile,
140558
+ model: asString(config.model),
140559
+ modelTier: asString(config.modelTier),
140560
+ agentId: isStatic(config.agentId) ? config.agentId : undefined,
140561
+ vcsRepo: config.vcsRepo === undefined ? vcsRepo : asString(config.vcsRepo)
140562
+ });
140563
+ if (error)
140564
+ errors.push(`Node "${node.id}" ${path}.profile: ${error}`);
140565
+ }
140854
140566
  if (!isStatic(config.model) || !isStatic(config.agentId))
140855
140567
  continue;
140856
140568
  const modelTier = typeof config.modelTier === "string" ? config.modelTier : undefined;
@@ -140865,8 +140577,9 @@ async function workflowModelErrors(def) {
140865
140577
  }
140866
140578
  return errors;
140867
140579
  }
140868
- var init_model_validation2 = __esm(() => {
140869
- init_model_validation();
140580
+ var init_model_validation = __esm(() => {
140581
+ init_model_profiles();
140582
+ init_model_validation2();
140870
140583
  init_types4();
140871
140584
  });
140872
140585
 
@@ -140921,7 +140634,7 @@ var registerCreateWorkflowTool = (server) => {
140921
140634
  if (!validation.valid) {
140922
140635
  return toolErr(`Invalid definition: ${validation.errors.join("; ")}`);
140923
140636
  }
140924
- const modelErrors = await workflowModelErrors(definition);
140637
+ const modelErrors = await workflowModelErrors(definition, { vcsRepo });
140925
140638
  if (modelErrors.length > 0) {
140926
140639
  return toolErr(`Invalid definition: ${modelErrors.join("; ")}`);
140927
140640
  }
@@ -140966,7 +140679,7 @@ var init_create_workflow = __esm(() => {
140966
140679
  init_types4();
140967
140680
  init_workflows();
140968
140681
  init_definition2();
140969
- init_model_validation2();
140682
+ init_model_validation();
140970
140683
  init_readiness();
140971
140684
  });
140972
140685
 
@@ -141233,7 +140946,9 @@ async function patchWorkflowDefinition(options) {
141233
140946
  if (!validation.valid) {
141234
140947
  return { ok: false, reason: "invalid", errors: validation.errors };
141235
140948
  }
141236
- const modelErrors = await workflowModelErrors(patchResult.definition);
140949
+ const modelErrors = await workflowModelErrors(patchResult.definition, {
140950
+ vcsRepo: updates?.vcsRepo === undefined ? existing.vcsRepo : updates.vcsRepo
140951
+ });
141237
140952
  if (modelErrors.length > 0) {
141238
140953
  return { ok: false, reason: "invalid", errors: modelErrors };
141239
140954
  }
@@ -141254,7 +140969,7 @@ async function patchWorkflowDefinition(options) {
141254
140969
  var init_patch_definition = __esm(() => {
141255
140970
  init_db4();
141256
140971
  init_definition2();
141257
- init_model_validation2();
140972
+ init_model_validation();
141258
140973
  init_version();
141259
140974
  });
141260
140975
 
@@ -141432,7 +141147,7 @@ var registerRetryWorkflowRunTool = (server) => {
141432
141147
  createToolRegistrar(server)("retry-workflow-run", {
141433
141148
  title: "Retry Workflow Run",
141434
141149
  annotations: { destructiveHint: false },
141435
- description: "Resume the same failed workflow run from its failed step(s); completed steps are not re-run. Retrying re-creates the failed node's side effects (e.g. an agent task), so check the target state first if that work was already done manually.",
141150
+ description: "Resume the same failed workflow run from its failed step(s); completed steps are not re-run. Retrying re-creates the failed node's side effects (e.g. an agent task), so check the target state first if that work was already done manually. Retries on the definition the run started with; to use an edited workflow, trigger a new run.",
141436
141151
  inputSchema: object2({
141437
141152
  runId: string2().uuid().describe("Workflow run ID to retry")
141438
141153
  }),
@@ -141698,7 +141413,13 @@ var registerUpdateWorkflowTool = (server) => {
141698
141413
  if (!validation.valid) {
141699
141414
  return toolErr(`Invalid definition: ${validation.errors.join("; ")}`);
141700
141415
  }
141701
- const modelErrors = await workflowModelErrors(definition);
141416
+ }
141417
+ const repoChanged = vcsRepo !== undefined && (vcsRepo ?? null) !== (existing.vcsRepo ?? null);
141418
+ const judged = definition ?? (repoChanged ? existing.definition : undefined);
141419
+ if (judged) {
141420
+ const modelErrors = await workflowModelErrors(judged, {
141421
+ vcsRepo: vcsRepo === undefined ? existing.vcsRepo : vcsRepo
141422
+ });
141702
141423
  if (modelErrors.length > 0) {
141703
141424
  return toolErr(`Invalid definition: ${modelErrors.join("; ")}`);
141704
141425
  }
@@ -141747,7 +141468,7 @@ var init_update_workflow = __esm(() => {
141747
141468
  init_types4();
141748
141469
  init_workflows();
141749
141470
  init_definition2();
141750
- init_model_validation2();
141471
+ init_model_validation();
141751
141472
  init_readiness();
141752
141473
  init_version();
141753
141474
  });
@@ -141888,6 +141609,7 @@ async function createServer(opts = {}) {
141888
141609
  registerGetMetricsTool(server);
141889
141610
  registerSendTaskTool(server);
141890
141611
  registerListModelProfilesTool(server);
141612
+ registerCheckModelProfileTool(server);
141891
141613
  registerGetTaskDetailsTool(server);
141892
141614
  registerStoreProgressTool(server);
141893
141615
  registerMyAgentInfoTool(server);
@@ -142166,6 +141888,7 @@ var init_server = __esm(() => {
142166
141888
  init_memory_search();
142167
141889
  init_memory_store();
142168
141890
  init_model_catalog();
141891
+ init_check_model_profile();
142169
141892
  init_list_model_profiles();
142170
141893
  init_my_agent_info();
142171
141894
  init_oauth_access_token();
@@ -142270,4 +141993,4 @@ var init_server = __esm(() => {
142270
141993
  loggedToolAllowlistWarnings = new Set;
142271
141994
  });
142272
141995
 
142273
- export { DEFAULT_NEGOTIATED_PROTOCOL_VERSION, SUPPORTED_PROTOCOL_VERSIONS, isJSONRPCRequest, isJSONRPCResultResponse, isJSONRPCErrorResponse, JSONRPCMessageSchema, isInitializeRequest, init_types, McpServer, init_mcp, repointTrackerSyncBySwarmId, init_tracker, isRuntimePoolWakeable, isAgentReachable, init_reachability, referencedBundlePaths, skillDirs, init_manifest_format, TaskCreationBlockedError, init_errors2, resolveIdentity, renderIdentity, init_identity, recordUnmappedIdentity, init_unmapped_identities, MAX_TASK_ATTACHMENT_BYTES, recordTaskAttachmentUpload, scopeFromAttachment, backingProviderId, init_task_attachment_store, taskModelPin, resumedTaskModelSelection, init_model_pin, listHarnessModelSupport, recordHarnessModelSupport, agentRanModel, getAgentHarnessCliVersion, setAgentHarnessCliVersion, init_harness_model_support, sanitizeModelTierOverrides, parseModelTierOverridesHeader, setAgentModelTierOverrides, previewModelTiers, recordClaimModelResolution, init_model_tier_resolution, harnessModelErrorFor, poolTaskRunsOnHarness, explicitModelError, explicitModelErrorForAgent, init_model_validation, stripSiblingBlock, init_sibling_block, createTaskWithSiblingAwareness, init_sibling_awareness, transcribeAudioNotes, init_transcription, init_templates, buildEffectiveText, bufferedFileFailures, fetchSlackFiles, createSlackTaskWithFiles, notifySlackFileFailures, init_inbound_files, isAddressedToOtherUser, broadcastMatches, routeMessage, extractTaskFromMessage, init_router, extractSlackMessageText, slackInboundMessageText, collectSlackMessageFiles, init_message_text, createAdditiveBuffer, init_additive_buffer, recoverIncompleteRuns, init_recovery, handleWebhookTrigger, verifyHmacSignature, WebhookError, init_triggers, snapshotAndUpdateWorkflow, init_version, RawLlmConfigSchema, RawLlmOutputSchema, executeRawLlm, init_raw_llm, getExecutorRegistry2, initWorkflows2, init_workflows, dispatchScheduleTarget, calculateNextRun2, startScheduler2, stopScheduler2, runScheduleNow2, init_scheduler, ExtensionAssetConflictError, init_assets, ExtensionOwnershipError, getExtensionFiles, getExtensionById, getExtensionByName, listExtensions, listExtensionVersions, updateExtensionMeta, listExtensionRuns, init_db, SDK_ALLOWLIST, mcpToolNameForSdkMethod, init_sdk_allowlist, MCP_OVERFLOW_NAMESPACE, mcpOverflowAuthError, init_kv_overflow, hasKvViewArgs, resolveKvView, init_kv_view, COLOR_LITERAL_THRESHOLD, countColorLiterals, init_color_literals, toolErr, createToolRegistrar, init_utils, handleMcpBridge, init_mcp_bridge, Redacted, init_redacted, SCRIPT_SDK_RESPONSE_LIMIT_BYTES, readScriptSdkJsonResponse, init_response_limit, ExtensionConfigError, init_loader, ExtensionLifecycleError, setExtensionLoopbackBaseUrl, enableExtension, disableExtension, activateVersion, ExtensionAssetsInvalidError, installExtensionWithAssets, uninstallExtension, reloadExtension, loadEnabledExtensions, stopExtensionRuntime, init_lifecycle, ExtensionAbortedError2, isRegistered2, isExtensionAgentId2, getExtensionBridgeToken2, resolveBridgeCallOrigin2, extensionIdForAgent2, runContext2, registerLoaded2, unregister2, listRegistered2, dispatchPre2, dispatchPost2, init_dispatcher, REBOOT_RETRY_PIN_TAG2, getPinCandidateAgent2, resolveLeadOnlyRecoveryAssignment2, getResumeGeneration2, getNextResumeGeneration2, inheritedModelSelection2, createWorkerTaskFollowUp2, createResumeFollowUp2, createRerouteDecisionTask2, createPoolStarvationDecisionTask2, init_worker_follow_up, isGitHubEnabled, initGitHub, verifyWebhookSignature, isAgentMailEnabled, initAgentMail, verifyAgentMailWebhook, isInboxAllowed, isSenderAllowed, handleMessageReceived, init_agentmail, isAzureDevOpsEnabled, initAzureDevOps, verifyAzureDevOpsWebhook, isAzureDevOpsUrl, canonicalAzureDevOpsRepoUrl, parseAzureDevOpsRepoUrl, init_azure_devops, createdPullRequestOf, commentedPayloadOf, handlePullRequestCreated, handlePullRequestCommented, handleWorkItemCreated, handleWorkItemUpdated, handleWorkItemCommented, handleWorkItemDeleted, handleWorkItemRestored, initAzureDevOpsOutbound, init_azure_devops2, enqueueAuditRow, enqueueAdmissionRow, flushAuditBuffer, startAuditWriter, stopAuditWriter, startAuditGc, stopAuditGc, init_rbac_audit, getTelemetryIngestAnchor, init_telemetry_ingest_anchor, initApiTelemetry, syncTelemetryEnabled, init_telemetry_enable, isBitbucketEnabled, initBitbucket, verifyBitbucketWebhook, isDuplicateDelivery, markDeliveryProcessed, pullRequestEventOf, pullRequestCommentEventOf, handlePullRequestCreated2, handlePullRequestCommentCreated, handlePullRequestClosed, init_bitbucket, handlePullRequest, handleIssue, handleComment, handlePullRequestReview, handleCheckRun, handleCheckSuite, handleWorkflowRun, init_github, isGitLabEnabled, initGitLab, verifyGitLabWebhook, handleMergeRequest, handleIssue2, handleNote, handlePipeline, init_gitlab, isChatSdkEnabled, getChatSdkConfig, init_config, errorMessage, init_logger, resolveAdapterApiUrl, init_adapters, trackBackground, init_background, TelegramBotApiError, callTelegramBotApi, init_telegram_api, isTrustedTeamsServiceUrl, init_teams_origin, getSessionLabels, rememberSessionLabel, getResourceSessionLabels, init_session_labels, isChatSdkStopping, startChatSdk, getChatInstance, isChatAdapterConfigured, getChatSdkHealth, stopChatSdk, init_runtime, getJiraMetadata, updateJiraMetadata, clearJiraMetadata, init_metadata, registerJiraWebhook, deleteJiraWebhook, init_webhook_lifecycle, isJiraEnabled, initJira, init_app, handleJiraWebhook, init_webhook, init_jira, handleAgentSessionEvent, handleIssueUpdate, handleIssueDelete, handleAgentSessionPrompted, init_sync, isLinearEnabled, initLinear, init_app2, init_linear, init_slack, verifyPageSession, LEGACY_PAGE_SESSION_COOKIE, isCookieSafePageId, extractPageSession, extractLegacyPageSession, extractAndVerifyCookie, isLocalDevPageRequest, pageSessionSetCookies, init_page_session, resolveHttpRequestAuth, init_auth, getDeploymentEnvValue, loadGlobalConfigsIntoEnv, reloadGlobalConfigsAndIntegrations, scheduleIntegrationsReload, handleCore, init_core, MCP_MAX_TOOL_INPUT_ELEMENTS, MCP_MAX_REQUEST_BODY_BYTES, init_mcp_limits, userCtx, init_task_tool_ctx, requestPrincipal, agentFirstPrincipal, requireAuthKind, rejectGuest, init_request_principal, handleApps, init_apps, cancelApprovalRequest, cancelApprovalRequestAndRun, init_approval_cancel, getUserCommsPrefs, init_requester_comms, getTaskDetailsInputSchema, getTaskDetailsOutputSchema, getTaskDetailsHandler, init_get_task_details, cancelTaskInputSchema, cancelTaskOutputSchema, cancelTaskHandler, init_cancel_task, executeReadOnlyQuery, assertSelectOnlyQuery, handleDbQuery, init_db_query, snapshotMetric, init_version2, AssetKeyAuthorizationError, authorizeAssetKeyWrite, init_asset_key_auth, getPageEditCounter, init_page_versions, snapshotPage, init_version3, DEFAULT_THEME_ID, THEME_PRESET_IDS, getThemePreset, init_presets, readThemeFields, init_page_fields, assertOAuthAppUrlsSafe, assertOAuthEgressUrlSafe, init_app_validation, listOAuthPresets, listOAuthPresetIds, getOAuthPreset, hydrateOAuthAppFromPreset, init_presets2, scopedResourceScopeIdSchema, resolveScopedResourceId, init_scoped_resource, MemoryKeyError, init_key_guard, refreshLinks, init_link_resolver, indexMemoryContent, init_index_content, dedupeMemoryDocumentIds, recordMemoryAccesses, recordRetrievals, init_retrieval, ExplicitSelfDuplicateError, applyRating, init_store, shouldPersistAutomaticTaskMemory, init_automatic_task_gate, guardTerminalTaskResultWrite, init_terminal_result_guard, getTasksInputSchema, getTasksOutputSchema, getTasksHandler, init_get_tasks, reservedNamespaceError, privateNamespaceError, reservedRoomKeyError, init_kv_reserved_namespaces, updateMcpServerChecked, init_mcp_server_checked_update, updateTouchesStdioExecution, init_mcp_server_stdio_gate, canReadMemory, init_access, getLinksForMemory, init_links_store, expandCandidatesWithGraph, init_graph_expansion, isApiDraining, drainApi, init_api_drain, markKapsoMessageRead, sendKapsoReaction, init_client, getKapsoConfig, getKapsoNumberMapping, markKapsoMessageSeen, init_config2, changesAllowMerge, init_repo_merge_policy, updateSwarmRepoChecked, init_repo_checked_update, getCombConfig, init_config3, resolveRoomNamespace, roomRequestInfo, authorizeRoomNamespace, sessionAccessTopic, sessionPresenceRoot, init_auth2, RoomOperationSchema, init_document, removeAwarenessStates, init_awareness, roomTopic, decodeRoomSnapshot, roomView, getRoom, changeRoom, applyRoomUpdate, resetRoom, sweepRooms, closeRooms, removeNamespaceRooms, init_rooms, init_scheduler2, MEMORY_KEYS_DEFAULT_PREFIX, MEMORY_KEYS_MAX_LIMIT, estimateTokens, posteriorMean, listMemoryKeys, checkChunkIntegrity, getMemoryChunks, getPosteriorsByIds, init_key_browser, createEvent, createEventsBatch, getEventCountsFiltered, getEventsFiltered, init_events, mergeScheduleTiming, validateRecurringTiming, init_validate, followUpThreadForSourceTask, evaluateFollowUpRedelegation, init_follow_up_redelegation_guard, checkOutputSchemaShape, sendTaskOutputSchema, sendTaskHandler, init_send_task, steerTaskUserInputSchema, steerTaskOutputSchema, steerTaskHandler, init_steer_task, skipReasonFrom, finalizeSkippedTaskReaction, init_task_skip, IMPROVEMENT_TEXT_MAX, IMPROVEMENT_STATUSES, IMPROVEMENT_SOURCES, ImprovementError, isImprovementsEnabled, getImprovement, listImprovements, createImprovement, approveAndSend, discardImprovement, improvementLeakHints, init_improvements, canClaim, init_budget_admission, emitBudgetRefusalSideEffects, init_budget_refusal_notify, workflowModelErrors, init_model_validation2, patchWorkflowDefinition, init_patch_definition, idempotencyKeyHeader, readIdempotencyKey, replayAcceptedOperation, init_idempotency_key, resolveScriptsOnlyMode, init_scripts_only_mode, ALL_CAPABILITIES, hasCapability, getEnabledCapabilities, createServer, init_server };
141996
+ export { DEFAULT_NEGOTIATED_PROTOCOL_VERSION, SUPPORTED_PROTOCOL_VERSIONS, isJSONRPCRequest, isJSONRPCResultResponse, isJSONRPCErrorResponse, JSONRPCMessageSchema, isInitializeRequest, init_types, McpServer, init_mcp, repointTrackerSyncBySwarmId, init_tracker, isRuntimePoolWakeable, isAgentReachable, init_reachability, referencedBundlePaths, skillDirs, init_manifest_format, TaskCreationBlockedError, init_errors2, resolveIdentity, renderIdentity, init_identity, recordUnmappedIdentity, init_unmapped_identities, MAX_TASK_ATTACHMENT_BYTES, recordTaskAttachmentUpload, scopeFromAttachment, backingProviderId, init_task_attachment_store, stripSiblingBlock, init_sibling_block, createTaskWithSiblingAwareness, init_sibling_awareness, transcribeAudioNotes, init_transcription, init_templates, buildEffectiveText, bufferedFileFailures, fetchSlackFiles, createSlackTaskWithFiles, notifySlackFileFailures, init_inbound_files, isAddressedToOtherUser, broadcastMatches, routeMessage, extractTaskFromMessage, init_router, extractSlackMessageText, slackInboundMessageText, collectSlackMessageFiles, init_message_text, createAdditiveBuffer, init_additive_buffer, recoverIncompleteRuns, init_recovery, handleWebhookTrigger, verifyHmacSignature, WebhookError, init_triggers, snapshotAndUpdateWorkflow, init_version, RawLlmConfigSchema, RawLlmOutputSchema, executeRawLlm, init_raw_llm, getExecutorRegistry2, initWorkflows2, init_workflows, dispatchScheduleTarget, calculateNextRun2, startScheduler2, stopScheduler2, runScheduleNow2, init_scheduler, ExtensionAssetConflictError, init_assets, ExtensionOwnershipError, getExtensionFiles, getExtensionById, getExtensionByName, listExtensions, listExtensionVersions, updateExtensionMeta, listExtensionRuns, init_db, SDK_ALLOWLIST, mcpToolNameForSdkMethod, init_sdk_allowlist, MCP_OVERFLOW_NAMESPACE, mcpOverflowAuthError, init_kv_overflow, hasKvViewArgs, resolveKvView, init_kv_view, COLOR_LITERAL_THRESHOLD, countColorLiterals, init_color_literals, toolErr, createToolRegistrar, init_utils, handleMcpBridge, init_mcp_bridge, Redacted, init_redacted, SCRIPT_SDK_RESPONSE_LIMIT_BYTES, readScriptSdkJsonResponse, init_response_limit, ExtensionConfigError, init_loader, ExtensionLifecycleError, setExtensionLoopbackBaseUrl, enableExtension, disableExtension, activateVersion, ExtensionAssetsInvalidError, installExtensionWithAssets, uninstallExtension, reloadExtension, loadEnabledExtensions, stopExtensionRuntime, init_lifecycle, ExtensionAbortedError2, isRegistered2, isExtensionAgentId2, getExtensionBridgeToken2, resolveBridgeCallOrigin2, extensionIdForAgent2, runContext2, registerLoaded2, unregister2, listRegistered2, dispatchPre2, dispatchPost2, init_dispatcher, REBOOT_RETRY_PIN_TAG2, getPinCandidateAgent2, resolveLeadOnlyRecoveryAssignment2, getResumeGeneration2, getNextResumeGeneration2, inheritedModelSelection2, createWorkerTaskFollowUp2, createResumeFollowUp2, createRerouteDecisionTask2, createPoolStarvationDecisionTask2, init_worker_follow_up, isGitHubEnabled, initGitHub, verifyWebhookSignature, isAgentMailEnabled, initAgentMail, verifyAgentMailWebhook, isInboxAllowed, isSenderAllowed, handleMessageReceived, init_agentmail, isAzureDevOpsEnabled, initAzureDevOps, verifyAzureDevOpsWebhook, isAzureDevOpsUrl, canonicalAzureDevOpsRepoUrl, parseAzureDevOpsRepoUrl, init_azure_devops, createdPullRequestOf, commentedPayloadOf, handlePullRequestCreated, handlePullRequestCommented, handleWorkItemCreated, handleWorkItemUpdated, handleWorkItemCommented, handleWorkItemDeleted, handleWorkItemRestored, initAzureDevOpsOutbound, init_azure_devops2, enqueueAuditRow, enqueueAdmissionRow, flushAuditBuffer, startAuditWriter, stopAuditWriter, startAuditGc, stopAuditGc, init_rbac_audit, getTelemetryIngestAnchor, init_telemetry_ingest_anchor, initApiTelemetry, syncTelemetryEnabled, init_telemetry_enable, isBitbucketEnabled, initBitbucket, verifyBitbucketWebhook, isDuplicateDelivery, markDeliveryProcessed, pullRequestEventOf, pullRequestCommentEventOf, handlePullRequestCreated2, handlePullRequestCommentCreated, handlePullRequestClosed, init_bitbucket, handlePullRequest, handleIssue, handleComment, handlePullRequestReview, handleCheckRun, handleCheckSuite, handleWorkflowRun, init_github, isGitLabEnabled, initGitLab, verifyGitLabWebhook, handleMergeRequest, handleIssue2, handleNote, handlePipeline, init_gitlab, isChatSdkEnabled, getChatSdkConfig, init_config, errorMessage, init_logger, resolveAdapterApiUrl, init_adapters, trackBackground, init_background, TelegramBotApiError, callTelegramBotApi, init_telegram_api, isTrustedTeamsServiceUrl, init_teams_origin, getSessionLabels, rememberSessionLabel, getResourceSessionLabels, init_session_labels, isChatSdkStopping, startChatSdk, getChatInstance, isChatAdapterConfigured, getChatSdkHealth, stopChatSdk, init_runtime, getJiraMetadata, updateJiraMetadata, clearJiraMetadata, init_metadata, registerJiraWebhook, deleteJiraWebhook, init_webhook_lifecycle, isJiraEnabled, initJira, init_app, handleJiraWebhook, init_webhook, init_jira, handleAgentSessionEvent, handleIssueUpdate, handleIssueDelete, handleAgentSessionPrompted, init_sync, isLinearEnabled, initLinear, init_app2, init_linear, init_slack, verifyPageSession, LEGACY_PAGE_SESSION_COOKIE, isCookieSafePageId, extractPageSession, extractLegacyPageSession, extractAndVerifyCookie, isLocalDevPageRequest, pageSessionSetCookies, init_page_session, resolveHttpRequestAuth, init_auth, getDeploymentEnvValue, loadGlobalConfigsIntoEnv, reloadGlobalConfigsAndIntegrations, scheduleIntegrationsReload, handleCore, init_core, MCP_MAX_TOOL_INPUT_ELEMENTS, MCP_MAX_REQUEST_BODY_BYTES, init_mcp_limits, userCtx, init_task_tool_ctx, requestPrincipal, agentFirstPrincipal, requireAuthKind, rejectGuest, init_request_principal, handleApps, init_apps, cancelApprovalRequest, cancelApprovalRequestAndRun, init_approval_cancel, getUserCommsPrefs, init_requester_comms, getTaskDetailsInputSchema, getTaskDetailsOutputSchema, getTaskDetailsHandler, init_get_task_details, cancelTaskInputSchema, cancelTaskOutputSchema, cancelTaskHandler, init_cancel_task, executeReadOnlyQuery, assertSelectOnlyQuery, handleDbQuery, init_db_query, snapshotMetric, init_version2, AssetKeyAuthorizationError, authorizeAssetKeyWrite, init_asset_key_auth, getPageEditCounter, init_page_versions, snapshotPage, init_version3, DEFAULT_THEME_ID, THEME_PRESET_IDS, getThemePreset, init_presets, readThemeFields, init_page_fields, assertOAuthAppUrlsSafe, assertOAuthEgressUrlSafe, init_app_validation, listOAuthPresets, listOAuthPresetIds, getOAuthPreset, hydrateOAuthAppFromPreset, init_presets2, scopedResourceScopeIdSchema, resolveScopedResourceId, init_scoped_resource, MemoryKeyError, init_key_guard, refreshLinks, init_link_resolver, indexMemoryContent, init_index_content, dedupeMemoryDocumentIds, recordMemoryAccesses, recordRetrievals, init_retrieval, ExplicitSelfDuplicateError, applyRating, init_store, shouldPersistAutomaticTaskMemory, init_automatic_task_gate, guardTerminalTaskResultWrite, init_terminal_result_guard, getTasksInputSchema, getTasksOutputSchema, getTasksHandler, init_get_tasks, reservedNamespaceError, privateNamespaceError, reservedRoomKeyError, init_kv_reserved_namespaces, updateMcpServerChecked, init_mcp_server_checked_update, updateTouchesStdioExecution, init_mcp_server_stdio_gate, canReadMemory, init_access, getLinksForMemory, init_links_store, expandCandidatesWithGraph, init_graph_expansion, isApiDraining, drainApi, init_api_drain, markKapsoMessageRead, sendKapsoReaction, init_client, getKapsoConfig, getKapsoNumberMapping, markKapsoMessageSeen, init_config2, changesAllowMerge, init_repo_merge_policy, updateSwarmRepoChecked, init_repo_checked_update, getCombConfig, init_config3, resolveRoomNamespace, roomRequestInfo, authorizeRoomNamespace, sessionAccessTopic, sessionPresenceRoot, init_auth2, RoomOperationSchema, init_document, removeAwarenessStates, init_awareness, roomTopic, decodeRoomSnapshot, roomView, getRoom, changeRoom, applyRoomUpdate, resetRoom, sweepRooms, closeRooms, removeNamespaceRooms, init_rooms, init_scheduler2, MEMORY_KEYS_DEFAULT_PREFIX, MEMORY_KEYS_MAX_LIMIT, estimateTokens, posteriorMean, listMemoryKeys, checkChunkIntegrity, getMemoryChunks, getPosteriorsByIds, init_key_browser, createEvent, createEventsBatch, getEventCountsFiltered, getEventsFiltered, init_events, mergeScheduleTiming, validateRecurringTiming, init_validate, followUpThreadForSourceTask, evaluateFollowUpRedelegation, init_follow_up_redelegation_guard, checkOutputSchemaShape, sendTaskOutputSchema, sendTaskHandler, init_send_task, steerTaskUserInputSchema, steerTaskOutputSchema, steerTaskHandler, init_steer_task, skipReasonFrom, finalizeSkippedTaskReaction, init_task_skip, IMPROVEMENT_TEXT_MAX, IMPROVEMENT_STATUSES, IMPROVEMENT_SOURCES, ImprovementError, isImprovementsEnabled, getImprovement, listImprovements, createImprovement, approveAndSend, discardImprovement, improvementLeakHints, init_improvements, canClaim, init_budget_admission, emitBudgetRefusalSideEffects, init_budget_refusal_notify, workflowModelErrors, init_model_validation, patchWorkflowDefinition, init_patch_definition, idempotencyKeyHeader, readIdempotencyKey, replayAcceptedOperation, init_idempotency_key, resolveScriptsOnlyMode, init_scripts_only_mode, ALL_CAPABILITIES, hasCapability, getEnabledCapabilities, createServer, init_server };