@desplega.ai/agent-swarm 1.149.0 → 1.150.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (385) hide show
  1. package/README.md +7 -3
  2. package/dist/{acp-adapter-4jncb126.js → acp-adapter-d5mzggyk.js} +1 -1
  3. package/dist/{actions-31vp3ae7.js → actions-wn6ew0p7.js} +11 -10
  4. package/dist/{anthropic-messages-vs2rabzp.js → anthropic-messages-ec35ktvx.js} +4 -4
  5. package/dist/{app-1hh67x8w.js → app-dty7p9hg.js} +7 -7
  6. package/dist/{artifact-gj9arwrr.js → artifact-td4q4dch.js} +1 -1
  7. package/dist/{assistant-z66dmz6p.js → assistant-q4vhgjtx.js} +16 -17
  8. package/dist/{boot-reembed-wxa8ya0s.js → boot-reembed-92292pgf.js} +9 -9
  9. package/dist/{boot-reembed-fqzxxzjh.js → boot-reembed-n15q6s9x.js} +8 -8
  10. package/dist/{boot-scrub-logs-jnyndh79.js → boot-scrub-logs-44pc955m.js} +5 -5
  11. package/dist/{claude-adapter-3qpa9w0j.js → claude-adapter-cjegjbje.js} +14 -14
  12. package/dist/{claude-managed-adapter-qvsmh6mv.js → claude-managed-adapter-p3ts5m9m.js} +2 -2
  13. package/dist/{claude-sdk-session-2yxgjs5d.js → claude-sdk-session-7ywbn12v.js} +14 -14
  14. package/dist/{cli-cr12paw2.js → cli-111ey3ra.js} +5 -5
  15. package/dist/{cli-4wtq5jjv.js → cli-1mx65de9.js} +1 -1
  16. package/dist/{cli-9d8ntetj.js → cli-2658f6at.js} +1 -1
  17. package/dist/{cli-n3dz2942.js → cli-3ckzxdt1.js} +10 -6
  18. package/dist/{cli-yb9qhqam.js → cli-3mh119qv.js} +184 -67
  19. package/dist/{cli-ykxrnd1q.js → cli-72xdszyx.js} +2 -2
  20. package/dist/{cli-xm87hzbw.js → cli-7fesa1ky.js} +1 -1
  21. package/dist/{cli-3q5ejx9p.js → cli-7kwmt3r5.js} +2 -2
  22. package/dist/{cli-2qts1hys.js → cli-8chp8xab.js} +2 -2
  23. package/dist/{cli-qaacms9y.js → cli-9gqddmxs.js} +122 -97
  24. package/dist/{cli-zvz62chv.js → cli-a45d5v9b.js} +4 -4
  25. package/dist/{cli-9xvdm3bx.js → cli-asvrh7kj.js} +1 -1
  26. package/dist/{cli-kgz4np97.js → cli-b8x19vbh.js} +4 -4
  27. package/dist/{cli-9fy6nk6g.js → cli-ceb5y160.js} +1 -1
  28. package/dist/{cli-k0cr4kat.js → cli-ck1vqzdj.js} +1 -1
  29. package/dist/{cli-e29gmdmw.js → cli-dv6cdjs2.js} +2 -1
  30. package/dist/{cli-jecc01cb.js → cli-dyx0237s.js} +1 -1
  31. package/dist/{cli-kjwt6hdf.js → cli-gm0fhz13.js} +3 -3
  32. package/dist/{cli-sd5pv3b1.js → cli-h505yhex.js} +2 -2
  33. package/dist/{handlers-nbzdzn9k.js → cli-hbagregr.js} +15 -38
  34. package/dist/{cli-08b07b4r.js → cli-hmyynq9b.js} +1 -1
  35. package/dist/{cli-d8ftsp62.js → cli-kt7wevqh.js} +20 -13
  36. package/dist/{cli-gjhjfeeg.js → cli-kyysm7m3.js} +1 -1
  37. package/dist/{cli-1ebpar1q.js → cli-mzb0n642.js} +6 -6
  38. package/dist/{cli-q50ef8g0.js → cli-n1yj5fd5.js} +1 -1
  39. package/dist/{cli-3apbzgyk.js → cli-n75jt793.js} +13 -9
  40. package/dist/{cli-19f354qr.js → cli-q04q68be.js} +2 -2
  41. package/dist/{cli-yab68w40.js → cli-qp69dd5d.js} +29 -14
  42. package/dist/{cli-6pqcb4q0.js → cli-rnsr8asm.js} +12 -11
  43. package/dist/{cli-ygweqcn4.js → cli-rwp3ksm7.js} +91 -108
  44. package/dist/{cli-phsxnkp6.js → cli-ryz8q8p1.js} +74 -58
  45. package/dist/{cli-e95cx1eb.js → cli-taym3dmg.js} +10 -10
  46. package/dist/{cli-nye12xk5.js → cli-ttje5a4z.js} +7 -4
  47. package/dist/{cli-9hspd3dp.js → cli-vr6qj104.js} +1 -1
  48. package/dist/{cli-mnmsfd1w.js → cli-xjb9wghj.js} +7 -3
  49. package/dist/{cli-gv88e1vf.js → cli-ydk0wjj8.js} +1 -1
  50. package/dist/{cli-aae6hz6a.js → cli-zd21jrrc.js} +3 -3
  51. package/dist/{cli-7smrsr25.js → cli-zthatyrx.js} +23 -11
  52. package/dist/cli.js +19 -19
  53. package/dist/{codex-adapter-8meawydj.js → codex-adapter-rn3aq7jm.js} +7 -7
  54. package/dist/{codex-hook-hfrt9shr.js → codex-hook-gthcmm0g.js} +3 -3
  55. package/dist/{codex-session-runner-gjgxyp5j.js → codex-session-runner-bge0cbsw.js} +7 -7
  56. package/dist/{commands-hz3nb95f.js → commands-26phw0pc.js} +5 -5
  57. package/dist/{db-ggz97zbm.js → db-jxjx6s1b.js} +6 -6
  58. package/dist/{e2b-p04vmtx0.js → e2b-413b8t4v.js} +1 -1
  59. package/dist/handlers-vr1djg4n.js +41 -0
  60. package/dist/{hook-bks2q1f6.js → hook-jw0ztn96.js} +9 -9
  61. package/dist/{hook-kq9wp0ep.js → hook-t6fqsggw.js} +10 -10
  62. package/dist/{http-hrf77v87.js → http-hyc7s57s.js} +80 -71
  63. package/dist/{index-n28pw1zt.js → index-1d9r6a74.js} +18 -18
  64. package/dist/{index-cqtebbhb.js → index-bcyx5djw.js} +17 -17
  65. package/dist/{index-6nsbg88z.js → index-sfhaq59d.js} +408 -74
  66. package/dist/{index-8hmeg8j1.js → index-wtwpthe1.js} +17 -17
  67. package/dist/{keepalive-dxc12gvg.js → keepalive-fbsak4ya.js} +7 -7
  68. package/dist/{lead-yckfn18d.js → lead-rdzdm627.js} +39 -39
  69. package/dist/{maintenance-6kfb2m5e.js → maintenance-25z1c1vf.js} +9 -9
  70. package/dist/{node-x1g4v0pq.js → node-209sxmg3.js} +9 -9
  71. package/dist/{oauth-refresh-sweep-1x1ac722.js → oauth-refresh-sweep-j3d7gtse.js} +6 -6
  72. package/dist/{onboard-dcyt1609.js → onboard-dkcwrc75.js} +2 -2
  73. package/dist/{otel-impl-tbk3e5dr.js → otel-impl-8rgyy3j8.js} +1 -1
  74. package/dist/{pi-mono-adapter-zvshk5cj.js → pi-mono-adapter-4s2bbkgq.js} +8 -8
  75. package/dist/{pricing-refresh-kaqg567e.js → pricing-refresh-9cek71nq.js} +7 -7
  76. package/dist/{rbac-roles-cf97v1vd.js → rbac-roles-vk8mqp9v.js} +6 -6
  77. package/dist/{rbac-roles-ammq6rd2.js → rbac-roles-z98s2ypy.js} +5 -5
  78. package/dist/{render-v2-80w603vy.js → render-v2-3j26g0qh.js} +7 -7
  79. package/dist/{seed-pricing-zbrn83xv.js → seed-pricing-7rxhcnzm.js} +6 -6
  80. package/dist/{setup-fe66kczs.js → setup-e2t7vz0c.js} +2 -2
  81. package/dist/work-objects-8d3nd3x2.js +141 -0
  82. package/dist/{worker-qmb2d1e2.js → worker-0x9fn7nq.js} +39 -39
  83. package/openapi.json +15 -4
  84. package/package.json +3 -3
  85. package/src/agentmail/handlers.ts +5 -0
  86. package/src/be/budget-refusal-notify.ts +1 -0
  87. package/src/be/db/tasks/read.ts +3 -0
  88. package/src/be/db/tasks/write.ts +13 -1
  89. package/src/be/db.ts +4 -2
  90. package/src/be/migrations/153_deferred_task_wait_members.sql +25 -0
  91. package/src/be/migrations/154_routing_source.sql +3 -0
  92. package/src/be/scripts/typecheck.ts +7 -3
  93. package/src/be/seed/automation-toggle.ts +69 -0
  94. package/src/be/seed/schedules-seeder.ts +53 -8
  95. package/src/be/seed/workflows-seeder.ts +35 -6
  96. package/src/be/seed-scripts/catalog/delegate.ts +3 -1
  97. package/src/be/seed-skills/bundled-files.generated.json +1 -1
  98. package/src/be/steering.ts +1 -0
  99. package/src/be/swarm-config-guard.ts +1 -0
  100. package/src/commands/credential-refresh.ts +70 -0
  101. package/src/commands/provider-credentials.ts +2 -25
  102. package/src/commands/runner.ts +23 -56
  103. package/src/github/handlers.ts +9 -0
  104. package/src/gitlab/handlers.ts +4 -0
  105. package/src/heartbeat/heartbeat.ts +3 -0
  106. package/src/http/approval-requests.ts +1 -0
  107. package/src/http/apps.ts +1 -0
  108. package/src/http/config.ts +4 -1
  109. package/src/http/core.ts +4 -2
  110. package/src/http/index.ts +16 -3
  111. package/src/http/script-runs.ts +5 -0
  112. package/src/http/tasks.ts +5 -0
  113. package/src/integrations/kapso/inbound.ts +1 -0
  114. package/src/jira/sync.ts +2 -0
  115. package/src/linear/sync.ts +2 -0
  116. package/src/prompts/session-templates.ts +13 -9
  117. package/src/providers/claude-adapter.ts +21 -8
  118. package/src/scheduler/deferred-task-waits.ts +34 -5
  119. package/src/scheduler/schedule-task.ts +5 -1
  120. package/src/scheduler/scheduler.ts +104 -123
  121. package/src/scripts-runtime/types/stdlib.d.ts +7 -3
  122. package/src/scripts-runtime/types/swarm-sdk.d.ts +7 -3
  123. package/src/slack/HEURISTICS.md +2 -0
  124. package/src/slack/actions.ts +1 -0
  125. package/src/slack/app.ts +2 -0
  126. package/src/slack/assistant.ts +4 -12
  127. package/src/slack/handlers.ts +9 -14
  128. package/src/slack/inbound-files.ts +3 -3
  129. package/src/slack/render-v2.ts +17 -3
  130. package/src/slack/thread-buffer.ts +66 -23
  131. package/src/slack/work-objects.test.ts +252 -0
  132. package/src/slack/work-objects.ts +118 -0
  133. package/src/tasks/worker-follow-up.ts +4 -0
  134. package/src/tests/acp-adapter.test.ts +10 -10
  135. package/src/tests/agent-fs-live-url.test.ts +40 -0
  136. package/src/tests/agent-fs-provision-seeder.test.ts +12 -12
  137. package/src/tests/api-key-tracking.test.ts +18 -18
  138. package/src/tests/api-key.test.ts +4 -2
  139. package/src/tests/apps-rbac.test.ts +1 -1
  140. package/src/tests/apps-spike5.test.ts +1 -1
  141. package/src/tests/apps-sync-engine.test.ts +8 -8
  142. package/src/tests/apps-user-config.test.ts +1 -1
  143. package/src/tests/artifact-sdk.test.ts +8 -8
  144. package/src/tests/asset-key-mcp.test.ts +2 -0
  145. package/src/tests/automation-preflight-alert.test.ts +1 -1
  146. package/src/tests/base-prompt.test.ts +6 -6
  147. package/src/tests/budget-user-scope.test.ts +1 -1
  148. package/src/tests/budgets-routes.test.ts +1 -1
  149. package/src/tests/claude-adapter-binary.test.ts +22 -40
  150. package/src/tests/claude-adapter-otel.test.ts +13 -7
  151. package/src/tests/claude-adapter.test.ts +8 -6
  152. package/src/tests/claude-hook-credentials.test.ts +3 -3
  153. package/src/tests/claude-managed-adapter.test.ts +4 -4
  154. package/src/tests/claude-managed-setup.test.ts +3 -3
  155. package/src/tests/claude-sdk-lifecycle.test.ts +1 -1
  156. package/src/tests/claude-sdk-transport.test.ts +6 -6
  157. package/src/tests/claude-stop-hook.test.ts +8 -8
  158. package/src/tests/claude-worker-parity.test.ts +3 -3
  159. package/src/tests/codex-adapter-pool-auth-revalidate.test.ts +5 -5
  160. package/src/tests/codex-adapter.test.ts +7 -5
  161. package/src/tests/codex-app-server.test.ts +2 -2
  162. package/src/tests/codex-login.test.ts +15 -15
  163. package/src/tests/codex-oauth-credential-info.test.ts +4 -4
  164. package/src/tests/codex-oauth-keep-warm.test.ts +4 -4
  165. package/src/tests/codex-oauth-refresh-lock.test.ts +1 -1
  166. package/src/tests/codex-oauth-storage.test.ts +7 -7
  167. package/src/tests/codex-pool.test.ts +1 -1
  168. package/src/tests/codex-steering-hook.test.ts +1 -1
  169. package/src/tests/codex-swarm-events.test.ts +1 -1
  170. package/src/tests/config-api-only-keys.test.ts +1 -1
  171. package/src/tests/config-session-auth.test.ts +2 -2
  172. package/src/tests/connection-embedded-auth.test.ts +20 -18
  173. package/src/tests/core-auth.test.ts +1 -1
  174. package/src/tests/create-page-tool.test.ts +3 -3
  175. package/src/tests/credential-refresh.test.ts +115 -0
  176. package/src/tests/credential-wait.test.ts +2 -2
  177. package/src/tests/credentials.test.ts +6 -4
  178. package/src/tests/db-queries-oauth.test.ts +40 -40
  179. package/src/tests/defer-task.test.ts +73 -8
  180. package/src/tests/deferred-task-wait-migration.test.ts +64 -0
  181. package/src/tests/deferred-task-wake.test.ts +190 -1
  182. package/src/tests/devin-adapter.test.ts +1 -1
  183. package/src/tests/devin-api.test.ts +1 -1
  184. package/src/tests/e2b-dispatch.test.ts +21 -19
  185. package/src/tests/e2e-claude-transport.test.ts +3 -3
  186. package/src/tests/e2e-redact.test.ts +6 -6
  187. package/src/tests/ensure-token.test.ts +68 -68
  188. package/src/tests/entrypoint-api-readiness.test.ts +1 -1
  189. package/src/tests/entrypoint-codex-oauth-seed.test.ts +13 -13
  190. package/src/tests/events-http.test.ts +1 -1
  191. package/src/tests/fs-routes.test.ts +1 -1
  192. package/src/tests/gitlab-auth.test.ts +10 -10
  193. package/src/tests/harness-provider-resolution.test.ts +8 -5
  194. package/src/tests/heartbeat-reroute-decision.test.ts +1 -0
  195. package/src/tests/helper-credentials.test.ts +137 -0
  196. package/src/tests/http/context-routes.test.ts +2 -2
  197. package/src/tests/http-api-integration.test.ts +5 -2
  198. package/src/tests/http-users.test.ts +1 -1
  199. package/src/tests/identity-refresh.test.ts +2 -2
  200. package/src/tests/internal-ai/complete-structured.test.ts +2 -2
  201. package/src/tests/internal-ai/credentials.test.ts +19 -17
  202. package/src/tests/jira-metadata.test.ts +1 -1
  203. package/src/tests/jira-oauth.test.ts +5 -5
  204. package/src/tests/jira-sync.test.ts +1 -1
  205. package/src/tests/jira-webhook-lifecycle.test.ts +3 -3
  206. package/src/tests/jira-webhook.test.ts +2 -2
  207. package/src/tests/kapso-inbound.test.ts +2 -2
  208. package/src/tests/kv-http.test.ts +1 -1
  209. package/src/tests/kv-namespace-resolution.test.ts +1 -1
  210. package/src/tests/kv-page-proxy.test.ts +2 -2
  211. package/src/tests/launch-password-rejection.test.ts +2 -2
  212. package/src/tests/linear-webhook.test.ts +1 -1
  213. package/src/tests/mcp-oauth-dcr-reuse.test.ts +6 -6
  214. package/src/tests/mcp-oauth-ensure-token.test.ts +28 -22
  215. package/src/tests/mcp-oauth-manual-client.test.ts +16 -12
  216. package/src/tests/mcp-oauth-queries.test.ts +35 -32
  217. package/src/tests/mcp-oauth-resolve-secrets.test.ts +8 -8
  218. package/src/tests/mcp-oauth-wrapper.test.ts +20 -20
  219. package/src/tests/mcp-user-route.test.ts +1 -1
  220. package/src/tests/memory-edges.test.ts +1 -1
  221. package/src/tests/memory-rate-endpoint.test.ts +1 -1
  222. package/src/tests/memory-rate-tool.test.ts +2 -2
  223. package/src/tests/memory-rater-e2e.test.ts +1 -1
  224. package/src/tests/memory-rater-llm-summarizer.test.ts +3 -3
  225. package/src/tests/memory-rater-llm.test.ts +1 -1
  226. package/src/tests/model-control.test.ts +3 -0
  227. package/src/tests/multi-runtime-registration.test.ts +97 -3
  228. package/src/tests/oauth-access-token-tool.test.ts +18 -18
  229. package/src/tests/oauth-callback-flow.test.ts +8 -8
  230. package/src/tests/oauth-credential-bindings.test.ts +29 -27
  231. package/src/tests/oauth-keepalive.test.ts +10 -10
  232. package/src/tests/oauth-presets.test.ts +13 -5
  233. package/src/tests/oauth-refresh-failure.test.ts +9 -9
  234. package/src/tests/oauth-refresh-sweep.test.ts +20 -13
  235. package/src/tests/oauth-wrapper.test.ts +1 -1
  236. package/src/tests/onboard-compose.test.ts +3 -3
  237. package/src/tests/onboard-env.test.ts +26 -26
  238. package/src/tests/onboard-non-interactive.test.ts +4 -4
  239. package/src/tests/opencode-adapter.test.ts +1 -1
  240. package/src/tests/opencode-plugin.test.ts +2 -2
  241. package/src/tests/otel-session-cost-metrics.test.ts +1 -1
  242. package/src/tests/page-proxy-authed.test.ts +2 -2
  243. package/src/tests/page-proxy.test.ts +2 -2
  244. package/src/tests/page-session.test.ts +7 -7
  245. package/src/tests/page-viewer-auth.test.ts +2 -2
  246. package/src/tests/pages-authed-mode.test.ts +1 -1
  247. package/src/tests/pages-http.test.ts +1 -1
  248. package/src/tests/pages-password-mode.test.ts +1 -1
  249. package/src/tests/pages-public-authed-401.test.ts +1 -1
  250. package/src/tests/pages-public-html.test.ts +2 -2
  251. package/src/tests/pages-view-count.test.ts +1 -1
  252. package/src/tests/pi-mono-adapter.test.ts +10 -10
  253. package/src/tests/pi-mono-extension.test.ts +2 -2
  254. package/src/tests/pricing-routes.test.ts +1 -1
  255. package/src/tests/profile-sync-warning.test.ts +8 -8
  256. package/src/tests/profile-sync.test.ts +8 -8
  257. package/src/tests/prompt-template-session.test.ts +36 -5
  258. package/src/tests/provider-process-group.test.ts +95 -4
  259. package/src/tests/providers/pi-cost.test.ts +1 -1
  260. package/src/tests/queue-stall-alarm.test.ts +1 -1
  261. package/src/tests/rbac-admission.test.ts +1 -1
  262. package/src/tests/rbac-charact-http.test.ts +1 -1
  263. package/src/tests/rbac-e2e-helpers.ts +1 -1
  264. package/src/tests/realtime-room-surfaces.test.ts +1 -1
  265. package/src/tests/reload-config.test.ts +1 -1
  266. package/src/tests/routing-reason-contract.test.ts +76 -3
  267. package/src/tests/routing-reason-inventory.test.ts +11 -6
  268. package/src/tests/routing-source.test.ts +53 -0
  269. package/src/tests/runner-agent-fs-provision-retry.test.ts +1 -1
  270. package/src/tests/runner-context-preamble.test.ts +1 -1
  271. package/src/tests/runner-deployment-resume.test.ts +1 -1
  272. package/src/tests/runner-fallback-output.test.ts +1 -1
  273. package/src/tests/runner-identity-refresh.test.ts +1 -1
  274. package/src/tests/runner-skills-refresh.test.ts +1 -1
  275. package/src/tests/schedule-target-type.test.ts +3 -3
  276. package/src/tests/scheduled-tasks.test.ts +14 -5
  277. package/src/tests/scheduler-occurrence.test.ts +347 -0
  278. package/src/tests/script-apis-mcp.test.ts +1 -1
  279. package/src/tests/script-connections-http.test.ts +61 -58
  280. package/src/tests/script-connections-mcp.test.ts +1 -1
  281. package/src/tests/script-connections.test.ts +1 -1
  282. package/src/tests/script-runs-http.test.ts +15 -7
  283. package/src/tests/script-workflows-runtime-e2e.test.ts +1 -1
  284. package/src/tests/scripts-external-api.test.ts +1 -1
  285. package/src/tests/scripts-http.test.ts +1 -1
  286. package/src/tests/scripts-mcp-e2e.test.ts +1 -1
  287. package/src/tests/scripts-only-gating.test.ts +2 -2
  288. package/src/tests/scripts-retention.test.ts +1 -1
  289. package/src/tests/scripts-runtime-identity.test.ts +1 -1
  290. package/src/tests/scripts-runtime-secret-egress.test.ts +1 -1
  291. package/src/tests/scripts-runtime.test.ts +6 -4
  292. package/src/tests/scripts-typecheck.test.ts +21 -0
  293. package/src/tests/sdk-allowlist.test.ts +1 -1
  294. package/src/tests/secret-scrubber.test.ts +38 -31
  295. package/src/tests/seed-registry.test.ts +46 -8
  296. package/src/tests/seed-schedules.test.ts +139 -8
  297. package/src/tests/seed-workflows.test.ts +93 -7
  298. package/src/tests/send-task-output-schema.test.ts +9 -1
  299. package/src/tests/send-task-requested-by.test.ts +1 -0
  300. package/src/tests/send-task-slack-routing-guard.test.ts +2 -0
  301. package/src/tests/session-costs-codex-recompute.test.ts +1 -1
  302. package/src/tests/session-costs-golden.test.ts +2 -2
  303. package/src/tests/session-costs-model-key-normalize.test.ts +2 -2
  304. package/src/tests/session-costs-recompute-all-providers.test.ts +1 -1
  305. package/src/tests/session-tokens.test.ts +1 -1
  306. package/src/tests/shutdown-error-scrubbing.test.ts +1 -1
  307. package/src/tests/slack-file-tools-attachments.test.ts +1 -1
  308. package/src/tests/slack-inbound-files.test.ts +222 -86
  309. package/src/tests/slack-reaction-config.test.ts +5 -4
  310. package/src/tests/slack-read-boundaries.test.ts +1 -1
  311. package/src/tests/slack-render-v2.test.ts +120 -1
  312. package/src/tests/status.test.ts +7 -7
  313. package/src/tests/steering-core.test.ts +1 -1
  314. package/src/tests/steering-transport.test.ts +4 -4
  315. package/src/tests/store-progress-output-guidance.test.ts +34 -0
  316. package/src/tests/swarm-tool-result-gate.test.ts +11 -11
  317. package/src/tests/swarm-x-tool.test.ts +7 -5
  318. package/src/tests/sync-ai-toolbox-skills.test.ts +19 -0
  319. package/src/tests/task-supersede-resume.test.ts +1 -1
  320. package/src/tests/task-tools-ctx.test.ts +2 -0
  321. package/src/tests/tasks-requested-by-filter.test.ts +2 -2
  322. package/src/tests/telemetry-init.test.ts +11 -3
  323. package/src/tests/tool-output-agent-id.test.ts +1 -0
  324. package/src/tests/tracker-fold.test.ts +7 -7
  325. package/src/tests/tracker-tools.test.ts +3 -3
  326. package/src/tests/ui-followup-lead-delegation.test.ts +1 -0
  327. package/src/tests/unified-oauth-migration.test.ts +5 -5
  328. package/src/tests/user-token-rest-auth.test.ts +1 -1
  329. package/src/tests/user-token-routes.test.ts +1 -1
  330. package/src/tests/whoami-route.test.ts +1 -1
  331. package/src/tests/workflow-agent-task.test.ts +15 -13
  332. package/src/tests/workflow-ctx.test.ts +1 -1
  333. package/src/tests/workflow-e2e.test.ts +1 -1
  334. package/src/tests/workflow-engine-v2.test.ts +3 -1
  335. package/src/tests/workflow-executors.test.ts +2 -2
  336. package/src/tests/workflow-http-v2.test.ts +8 -6
  337. package/src/tests/workflow-input-redaction.test.ts +7 -5
  338. package/src/tests/workflow-integration-io.test.ts +2 -2
  339. package/src/tests/workflow-llm.test.ts +5 -5
  340. package/src/tests/workflow-registry.test.ts +1 -1
  341. package/src/tests/workflow-swarm-script.test.ts +1 -1
  342. package/src/tests/workflow-triggers-v2.test.ts +23 -21
  343. package/src/tests/x-composio.test.ts +9 -7
  344. package/src/tests/x402-client.test.ts +1 -1
  345. package/src/tests/x402-config.test.ts +28 -41
  346. package/src/tools/defer-task.ts +156 -24
  347. package/src/tools/send-task.ts +21 -1
  348. package/src/tools/skills/skill-publish.ts +1 -0
  349. package/src/tools/store-progress.ts +1 -1
  350. package/src/tools/templates.ts +2 -1
  351. package/src/types.ts +11 -0
  352. package/src/utils/constants.ts +7 -1
  353. package/src/utils/credentials.test.ts +16 -16
  354. package/src/workflows/executors/agent-task.ts +5 -0
  355. package/templates/ai-toolbox.manifest.json +7 -1
  356. package/templates/schedules/daily-blocker-digest/config.json +6 -1
  357. package/templates/schedules/daily-compounding-reflection/config.json +1 -0
  358. package/templates/schedules/daily-hn-briefing/config.json +1 -1
  359. package/templates/schedules/daily-status-report/config.json +6 -1
  360. package/templates/schedules/daily-swarm-update-check/config.json +19 -0
  361. package/templates/schedules/daily-swarm-update-check/content.md +49 -0
  362. package/templates/schedules/daily-workflow-health-audit/config.json +6 -1
  363. package/templates/schedules/gtm-weekly-review/config.json +1 -1
  364. package/templates/schedules/weekly-code-health-reports/config.json +1 -1
  365. package/templates/schedules/weekly-dependabot-triage/config.json +1 -1
  366. package/templates/schedules/weekly-dora-metrics/config.json +1 -1
  367. package/templates/schedules/weekly-harness-upgrade-check/config.json +1 -1
  368. package/templates/skills/delegate-work/files/scripts/codex-exec.sh +1 -1
  369. package/templates/skills/serply-search/SKILL.md +95 -0
  370. package/templates/skills/serply-search/config.json +13 -0
  371. package/templates/skills/serply-search/content.md +90 -0
  372. package/templates/skills/swarm-scripts/SKILL.md +2 -2
  373. package/templates/skills/swarm-scripts/content.md +2 -2
  374. package/templates/workflows/claude-code-changelog-watch/config.json +1 -1
  375. package/templates/workflows/gsc-topic-miner/config.json +1 -1
  376. package/templates/workflows/linear-drain-loop/config.json +1 -1
  377. package/templates/workflows/llm-safe-release-context/config.json +1 -1
  378. package/templates/workflows/ralph-loop/config.json +1 -1
  379. package/dist/{azure-openai-responses-cqar64rc.js → azure-openai-responses-g85jv7m8.js} +8 -8
  380. package/dist/{cli-4xz3pmrq.js → cli-8qx7jnrk.js} +5 -5
  381. package/dist/{cli-6664w7y4.js → cli-wk0gjrn3.js} +3 -3
  382. package/dist/{google-vertex-ppw8ydpa.js → google-vertex-pkhpkbq9.js} +3 -3
  383. package/dist/{openai-codex-responses-g7w48y30.js → openai-codex-responses-pm5gnyfa.js} +4 -4
  384. package/dist/{openai-completions-0bqmsajw.js → openai-completions-qdcmkfnr.js} +12 -12
  385. package/dist/{openai-responses-nmeyptke.js → openai-responses-vwvk1taj.js} +13 -13
@@ -3,26 +3,50 @@ import {
3
3
  composioArgsFromParts,
4
4
  executeComposioRequest
5
5
  } from "./cli-0z2v4nhw.js";
6
+ import {
7
+ AGENT_MAX_TASKS_CONFIG_KEY,
8
+ createTrackerAgentMapping,
9
+ createTrackerSync,
10
+ createTrackerSyncIfAbsent,
11
+ createWorkerTaskFollowUp,
12
+ deleteTrackerSync,
13
+ getAllTrackerSyncs,
14
+ getTrackerSync,
15
+ getTrackerSyncByExternalId,
16
+ hasTrackerDelivery,
17
+ markRuntimeInstanceOffline,
18
+ markTrackerDelivery,
19
+ reconcileAgentStatusFromRuntimes,
20
+ repointTrackerSyncBySwarmId,
21
+ resetAgentMaxTasksMirror,
22
+ touchRuntimeInstance,
23
+ updateTrackerSync,
24
+ updateTrackerSyncSwarmId,
25
+ upsertSwarmConfigWithPolicyMirror
26
+ } from "./cli-xjb9wghj.js";
6
27
  import {
7
28
  LlmRater,
8
29
  REFERENCES_SOURCE_MAX_LENGTH,
9
30
  sanitizeReferencesSource
10
31
  } from "./cli-xvkmedgn.js";
32
+ import {
33
+ isMultiRuntimeEnabled
34
+ } from "./cli-07jd68a1.js";
11
35
  import {
12
36
  calculateNextRun,
13
37
  reconcileDeferredTaskWaits,
14
38
  runScheduleNow
15
- } from "./cli-ygweqcn4.js";
39
+ } from "./cli-rwp3ksm7.js";
16
40
  import {
17
41
  startPricingRefreshLoop
18
- } from "./cli-sd5pv3b1.js";
42
+ } from "./cli-h505yhex.js";
19
43
  import {
20
44
  seedPricingFromModelsDev
21
- } from "./cli-9fy6nk6g.js";
45
+ } from "./cli-ceb5y160.js";
22
46
  import {
23
47
  ensureRbacSeedsSynced,
24
48
  getUserGrant
25
- } from "./cli-k0cr4kat.js";
49
+ } from "./cli-ck1vqzdj.js";
26
50
  import {
27
51
  can,
28
52
  decideAdmission,
@@ -49,34 +73,10 @@ import {
49
73
  runSavedScriptAsAgent,
50
74
  updateApp,
51
75
  upgradeAppDefinition
52
- } from "./cli-19f354qr.js";
76
+ } from "./cli-q04q68be.js";
53
77
  import {
54
78
  require_dist as require_dist2
55
79
  } from "./cli-qgm2pfpq.js";
56
- import {
57
- AGENT_MAX_TASKS_CONFIG_KEY,
58
- createTrackerAgentMapping,
59
- createTrackerSync,
60
- createTrackerSyncIfAbsent,
61
- createWorkerTaskFollowUp,
62
- deleteTrackerSync,
63
- getAllTrackerSyncs,
64
- getTrackerSync,
65
- getTrackerSyncByExternalId,
66
- hasTrackerDelivery,
67
- markRuntimeInstanceOffline,
68
- markTrackerDelivery,
69
- reconcileAgentStatusFromRuntimes,
70
- repointTrackerSyncBySwarmId,
71
- resetAgentMaxTasksMirror,
72
- touchRuntimeInstance,
73
- updateTrackerSync,
74
- updateTrackerSyncSwarmId,
75
- upsertSwarmConfigWithPolicyMirror
76
- } from "./cli-mnmsfd1w.js";
77
- import {
78
- isMultiRuntimeEnabled
79
- } from "./cli-07jd68a1.js";
80
80
  import {
81
81
  TriggerSchemaError,
82
82
  cancelWorkflowRun,
@@ -87,7 +87,7 @@ import {
87
87
  snapshotWorkflow,
88
88
  startWorkflowExecution,
89
89
  validateJsonSchema
90
- } from "./cli-6pqcb4q0.js";
90
+ } from "./cli-rnsr8asm.js";
91
91
  import {
92
92
  ConnectionAuthInputSchema,
93
93
  SCRIPT_LONG_TIMEOUT_HINT_MS,
@@ -110,7 +110,7 @@ import {
110
110
  upsertCredentialBinding,
111
111
  upsertScriptConnection,
112
112
  validateDefinition
113
- } from "./cli-aae6hz6a.js";
113
+ } from "./cli-zd21jrrc.js";
114
114
  import {
115
115
  CANDIDATE_SET_MULTIPLIER,
116
116
  computeScore,
@@ -122,7 +122,7 @@ import {
122
122
  isGraphExpansionEnabled,
123
123
  rerank,
124
124
  rowToCandidate
125
- } from "./cli-3q5ejx9p.js";
125
+ } from "./cli-7kwmt3r5.js";
126
126
  import {
127
127
  getApiKey
128
128
  } from "./cli-f14fvzag.js";
@@ -140,7 +140,7 @@ import {
140
140
  listAuthorizationsForApp,
141
141
  onAuthorizationRefreshed,
142
142
  upsertOAuthApp
143
- } from "./cli-9hspd3dp.js";
143
+ } from "./cli-vr6qj104.js";
144
144
  import {
145
145
  ZodFirstPartyTypeKind,
146
146
  objectType
@@ -159,7 +159,7 @@ import {
159
159
  getFileInfo,
160
160
  parseSlackTs,
161
161
  uploadFile
162
- } from "./cli-kgz4np97.js";
162
+ } from "./cli-b8x19vbh.js";
163
163
  import {
164
164
  AgentFsProvider
165
165
  } from "./cli-jsp14b6c.js";
@@ -179,10 +179,10 @@ import {
179
179
  resolveIdentityByEmail,
180
180
  resolveUserByToken,
181
181
  unlinkIdentity
182
- } from "./cli-gv88e1vf.js";
182
+ } from "./cli-ydk0wjj8.js";
183
183
  import {
184
184
  createTaskWithSiblingAwareness
185
- } from "./cli-q50ef8g0.js";
185
+ } from "./cli-n1yj5fd5.js";
186
186
  import {
187
187
  ensure,
188
188
  getAgentDisplayName,
@@ -193,7 +193,7 @@ import {
193
193
  startSlackApp,
194
194
  stopSlackApp,
195
195
  withSpan
196
- } from "./cli-d8ftsp62.js";
196
+ } from "./cli-kt7wevqh.js";
197
197
  import {
198
198
  $OpenAPIRegistry,
199
199
  $OpenApiGeneratorV31,
@@ -442,13 +442,13 @@ import {
442
442
  upsertPromptTemplate,
443
443
  upsertService,
444
444
  validateConfigValue
445
- } from "./cli-yab68w40.js";
445
+ } from "./cli-qp69dd5d.js";
446
446
  import {
447
447
  generateDefaultClaudeMd,
448
448
  generateDefaultIdentityMd,
449
449
  generateDefaultSoulMd,
450
450
  init_defaults
451
- } from "./cli-08b07b4r.js";
451
+ } from "./cli-hmyynq9b.js";
452
452
  import {
453
453
  getTemplateDefinition,
454
454
  init_registry,
@@ -457,14 +457,14 @@ import {
457
457
  interpolate,
458
458
  registerTemplate,
459
459
  resolveTemplate
460
- } from "./cli-3apbzgyk.js";
460
+ } from "./cli-n75jt793.js";
461
461
  import {
462
462
  MAX_PROFILE_FILE_LENGTH,
463
463
  getAppUrl,
464
464
  getMcpBaseUrl,
465
465
  getPublicMcpBaseUrl,
466
466
  init_constants
467
- } from "./cli-e29gmdmw.js";
467
+ } from "./cli-dv6cdjs2.js";
468
468
  import {
469
469
  init_env_flag,
470
470
  isEnvFlagEnabled,
@@ -518,7 +518,7 @@ import {
518
518
  import {
519
519
  init_package,
520
520
  package_default
521
- } from "./cli-kjwt6hdf.js";
521
+ } from "./cli-gm0fhz13.js";
522
522
  import {
523
523
  init_secret_scrubber,
524
524
  refreshSecretScrubberCache,
@@ -19310,6 +19310,7 @@ ${combinedPreview}`
19310
19310
  const task = await createTaskWithSiblingAwareness(followupResult.text, {
19311
19311
  agentId: first.agentId,
19312
19312
  routingReason: "continuity",
19313
+ routingSource: "engine_default",
19313
19314
  source: "agentmail",
19314
19315
  taskType: "agentmail-reply",
19315
19316
  agentmailInboxId: first.inboxId,
@@ -19437,6 +19438,7 @@ async function handleMessageReceived(payload) {
19437
19438
  const task2 = await createTaskWithSiblingAwareness(followupResult.text, {
19438
19439
  agentId: existingTask.agentId,
19439
19440
  routingReason: existingTask.agentId ? "continuity" : undefined,
19441
+ routingSource: existingTask.agentId ? "engine_default" : undefined,
19440
19442
  source: "agentmail",
19441
19443
  taskType: "agentmail-reply",
19442
19444
  agentmailInboxId: inbox_id,
@@ -19468,6 +19470,7 @@ async function handleMessageReceived(payload) {
19468
19470
  const task3 = await createTaskWithSiblingAwareness(leadResult.text, {
19469
19471
  agentId: agent.id,
19470
19472
  routingReason: "human_pinned",
19473
+ routingSource: "engine_default",
19471
19474
  source: "agentmail",
19472
19475
  taskType: "agentmail-message",
19473
19476
  agentmailInboxId: inbox_id,
@@ -19492,6 +19495,7 @@ async function handleMessageReceived(payload) {
19492
19495
  const task2 = await createTaskWithSiblingAwareness(workerResult.text, {
19493
19496
  agentId: agent.id,
19494
19497
  routingReason: "human_pinned",
19498
+ routingSource: "engine_default",
19495
19499
  source: "agentmail",
19496
19500
  taskType: "agentmail-message",
19497
19501
  agentmailInboxId: inbox_id,
@@ -19520,6 +19524,7 @@ async function handleMessageReceived(payload) {
19520
19524
  const task2 = await createTaskWithSiblingAwareness(unmappedResult.text, {
19521
19525
  agentId: lead.id,
19522
19526
  routingReason: "skill",
19527
+ routingSource: "engine_default",
19523
19528
  source: "agentmail",
19524
19529
  taskType: "agentmail-message",
19525
19530
  agentmailInboxId: inbox_id,
@@ -20328,6 +20333,7 @@ async function handlePullRequest(event) {
20328
20333
  const task2 = await createTaskWithSiblingAwareness(result2.text, {
20329
20334
  agentId: lead2?.id ?? "",
20330
20335
  routingReason: lead2 ? "skill" : undefined,
20336
+ routingSource: lead2 ? "engine_default" : undefined,
20331
20337
  source: "github",
20332
20338
  vcsProvider: "github",
20333
20339
  taskType: "github-pr",
@@ -20401,6 +20407,7 @@ async function handlePullRequest(event) {
20401
20407
  const task2 = await createTaskWithSiblingAwareness(result2.text, {
20402
20408
  agentId: lead2?.id ?? "",
20403
20409
  routingReason: lead2 ? "skill" : undefined,
20410
+ routingSource: lead2 ? "engine_default" : undefined,
20404
20411
  source: "github",
20405
20412
  vcsProvider: "github",
20406
20413
  taskType: "github-pr",
@@ -20470,6 +20477,7 @@ async function handlePullRequest(event) {
20470
20477
  const task2 = await createTaskWithSiblingAwareness(result2.text, {
20471
20478
  agentId: lead2?.id ?? "",
20472
20479
  routingReason: lead2 ? "skill" : undefined,
20480
+ routingSource: lead2 ? "engine_default" : undefined,
20473
20481
  source: "github",
20474
20482
  vcsProvider: "github",
20475
20483
  taskType: "github-pr",
@@ -20529,6 +20537,7 @@ async function handlePullRequest(event) {
20529
20537
  const task = await createTaskWithSiblingAwareness(result.text, {
20530
20538
  agentId: lead?.id ?? "",
20531
20539
  routingReason: lead ? "skill" : undefined,
20540
+ routingSource: lead ? "engine_default" : undefined,
20532
20541
  source: "github",
20533
20542
  vcsProvider: "github",
20534
20543
  taskType: "github-pr",
@@ -20578,6 +20587,7 @@ async function handleIssue(event) {
20578
20587
  const task2 = await createTaskWithSiblingAwareness(result2.text, {
20579
20588
  agentId: lead2?.id ?? "",
20580
20589
  routingReason: lead2 ? "skill" : undefined,
20590
+ routingSource: lead2 ? "engine_default" : undefined,
20581
20591
  source: "github",
20582
20592
  vcsProvider: "github",
20583
20593
  taskType: "github-issue",
@@ -20645,6 +20655,7 @@ async function handleIssue(event) {
20645
20655
  const task2 = await createTaskWithSiblingAwareness(result2.text, {
20646
20656
  agentId: lead2?.id ?? "",
20647
20657
  routingReason: lead2 ? "skill" : undefined,
20658
+ routingSource: lead2 ? "engine_default" : undefined,
20648
20659
  source: "github",
20649
20660
  vcsProvider: "github",
20650
20661
  taskType: "github-issue",
@@ -20694,6 +20705,7 @@ async function handleIssue(event) {
20694
20705
  const task = await createTaskWithSiblingAwareness(result.text, {
20695
20706
  agentId: lead?.id ?? "",
20696
20707
  routingReason: lead ? "skill" : undefined,
20708
+ routingSource: lead ? "engine_default" : undefined,
20697
20709
  source: "github",
20698
20710
  vcsProvider: "github",
20699
20711
  taskType: "github-issue",
@@ -20758,6 +20770,7 @@ async function handleComment(event, eventType) {
20758
20770
  const task = await createTaskWithSiblingAwareness(result.text, {
20759
20771
  agentId: lead?.id ?? "",
20760
20772
  routingReason: lead ? "skill" : undefined,
20773
+ routingSource: lead ? "engine_default" : undefined,
20761
20774
  source: "github",
20762
20775
  vcsProvider: "github",
20763
20776
  taskType: "github-comment",
@@ -20958,6 +20971,7 @@ ${review.body}` : "";
20958
20971
  const task = await createTaskWithSiblingAwareness(result.text, {
20959
20972
  agentId: lead?.id ?? "",
20960
20973
  routingReason: lead ? "skill" : undefined,
20974
+ routingSource: lead ? "engine_default" : undefined,
20961
20975
  source: "github",
20962
20976
  vcsProvider: "github",
20963
20977
  taskType: "github-review",
@@ -21305,6 +21319,7 @@ async function handleMergeRequest(event) {
21305
21319
  const task = await createTaskWithSiblingAwareness(result.text, {
21306
21320
  agentId: lead?.id ?? null,
21307
21321
  routingReason: lead ? "skill" : undefined,
21322
+ routingSource: lead ? "engine_default" : undefined,
21308
21323
  source: "gitlab",
21309
21324
  vcsProvider: "gitlab",
21310
21325
  taskType: "gitlab-mr",
@@ -21388,6 +21403,7 @@ async function handleIssue2(event) {
21388
21403
  const task = await createTaskWithSiblingAwareness(result.text, {
21389
21404
  agentId: lead?.id ?? null,
21390
21405
  routingReason: lead ? "skill" : undefined,
21406
+ routingSource: lead ? "engine_default" : undefined,
21391
21407
  source: "gitlab",
21392
21408
  vcsProvider: "gitlab",
21393
21409
  taskType: "gitlab-issue",
@@ -21471,6 +21487,7 @@ _Note: There's an active task (${existingTask.id}) for this ${entityLabel}._` :
21471
21487
  const task = await createTaskWithSiblingAwareness(noteResult.text, {
21472
21488
  agentId: lead?.id ?? null,
21473
21489
  routingReason: lead ? "skill" : undefined,
21490
+ routingSource: lead ? "engine_default" : undefined,
21474
21491
  source: "gitlab",
21475
21492
  vcsProvider: "gitlab",
21476
21493
  taskType: "gitlab-comment",
@@ -21528,6 +21545,7 @@ async function handlePipeline(event) {
21528
21545
  const task = await createTaskWithSiblingAwareness(pipelineResult.text, {
21529
21546
  agentId: lead?.id ?? null,
21530
21547
  routingReason: lead ? "skill" : undefined,
21548
+ routingSource: lead ? "engine_default" : undefined,
21531
21549
  source: "gitlab",
21532
21550
  vcsProvider: "gitlab",
21533
21551
  taskType: "gitlab-ci",
@@ -22257,6 +22275,7 @@ ${input.descriptionText}
22257
22275
  const task = await createTaskWithSiblingAwareness(result.text, {
22258
22276
  agentId: lead?.id ?? "",
22259
22277
  routingReason: lead ? "skill" : undefined,
22278
+ routingSource: lead ? "engine_default" : undefined,
22260
22279
  source: "jira",
22261
22280
  taskType: "jira-issue",
22262
22281
  requestedByUserId: input.requestedByUserId,
@@ -22287,6 +22306,7 @@ ${input.descriptionText}
22287
22306
  const task = await createTaskWithSiblingAwareness(result.text, {
22288
22307
  agentId: lead?.id ?? "",
22289
22308
  routingReason: lead ? "skill" : undefined,
22309
+ routingSource: lead ? "engine_default" : undefined,
22290
22310
  source: "jira",
22291
22311
  taskType: "jira-issue",
22292
22312
  requestedByUserId: input.requestedByUserId,
@@ -22326,7 +22346,7 @@ async function notifySlack(text) {
22326
22346
  return;
22327
22347
  }
22328
22348
  try {
22329
- const { getSlackApp: getSlackApp2 } = await import("./app-1hh67x8w.js");
22349
+ const { getSlackApp: getSlackApp2 } = await import("./app-dty7p9hg.js");
22330
22350
  const app = getSlackApp2();
22331
22351
  if (!app) {
22332
22352
  console.warn("[Jira webhook keepalive] Slack not available, cannot send notification");
@@ -22397,7 +22417,7 @@ async function deleteJiraWebhook(webhookId) {
22397
22417
  console.log(`[Jira webhook keepalive] Deleted webhook id=${webhookId}`);
22398
22418
  }
22399
22419
  async function overwriteWebhookIds(next) {
22400
- const { getDbClient: getDbClient2 } = await import("./db-ggz97zbm.js");
22420
+ const { getDbClient: getDbClient2 } = await import("./db-jxjx6s1b.js");
22401
22421
  await getDbClient2().transaction(async (tx) => {
22402
22422
  const row = await tx.get("SELECT metadata FROM oauth_apps WHERE provider = 'jira'");
22403
22423
  if (!row) {
@@ -94581,6 +94601,7 @@ ${issueDescription}
94581
94601
  const task = await createTaskWithSiblingAwareness(templateResult.text, {
94582
94602
  agentId: lead?.id ?? "",
94583
94603
  routingReason: lead ? "skill" : undefined,
94604
+ routingSource: lead ? "engine_default" : undefined,
94584
94605
  source: "linear",
94585
94606
  taskType: "linear-issue",
94586
94607
  requestedByUserId,
@@ -94775,6 +94796,7 @@ async function handleAgentSessionPrompted(event) {
94775
94796
  const task = await createTaskWithSiblingAwareness(followupResult.text, {
94776
94797
  agentId: lead?.id ?? "",
94777
94798
  routingReason: lead ? "skill" : undefined,
94799
+ routingSource: lead ? "engine_default" : undefined,
94778
94800
  source: "linear",
94779
94801
  taskType: "linear-issue",
94780
94802
  requestedByUserId: promptedRequestedByUserId,
@@ -99991,6 +100013,7 @@ async function handleApps(req, res, pathSegments, queryParams, myAgentId) {
99991
100013
  source: "api",
99992
100014
  agentId: action.agentId ?? lead?.id,
99993
100015
  routingReason: action.agentId ? "human_pinned" : lead ? "skill" : undefined,
100016
+ routingSource: action.agentId || lead ? "engine_default" : undefined,
99994
100017
  key: normalizeAssetKey(`shared/app:${app.id}/action:${parsed.params.name}/`),
99995
100018
  ...actor.startsWith("user:") ? { requestedByUserId: actor.slice("user:".length) } : {}
99996
100019
  });
@@ -103191,6 +103214,7 @@ async function guardTerminalTaskResultWrite(task, write) {
103191
103214
 
103192
103215
  // src/tools/defer-task.ts
103193
103216
  init_types();
103217
+ init_constants();
103194
103218
 
103195
103219
  class DeferAbortedError extends Error {
103196
103220
  }
@@ -103203,19 +103227,90 @@ Checks:
103203
103227
  ${checks2.map((c) => `- ${c}`).join(`
103204
103228
  `)}`;
103205
103229
  }
103230
+ function partsInTz(date2, tz) {
103231
+ const fmt = new Intl.DateTimeFormat("en-US", {
103232
+ timeZone: tz,
103233
+ year: "numeric",
103234
+ month: "2-digit",
103235
+ day: "2-digit",
103236
+ hour: "2-digit",
103237
+ minute: "2-digit",
103238
+ second: "2-digit",
103239
+ hour12: false
103240
+ });
103241
+ const parts = Object.fromEntries(fmt.formatToParts(date2).map((p) => [p.type, p.value]));
103242
+ const hour = parts.hour === "24" ? "00" : parts.hour;
103243
+ return {
103244
+ year: parts.year,
103245
+ month: parts.month,
103246
+ day: parts.day,
103247
+ hour,
103248
+ minute: parts.minute,
103249
+ second: parts.second
103250
+ };
103251
+ }
103252
+ function formatDeferralDateTime(target, now, tz) {
103253
+ let zone = tz;
103254
+ try {
103255
+ Intl.DateTimeFormat("en-US", { timeZone: zone });
103256
+ } catch {
103257
+ zone = "UTC";
103258
+ }
103259
+ const t = partsInTz(target, zone);
103260
+ const time = `${t.hour}:${t.minute}:${t.second}`;
103261
+ const n = partsInTz(now, zone);
103262
+ if (t.year === n.year && t.month === n.month && t.day === n.day)
103263
+ return { date: "today", time };
103264
+ const tm = partsInTz(new Date(now.getTime() + 86400000), zone);
103265
+ if (t.year === tm.year && t.month === tm.month && t.day === tm.day) {
103266
+ return { date: "tomorrow", time };
103267
+ }
103268
+ return { date: `${t.month}-${t.day}`, time };
103269
+ }
103270
+ async function resolveRequesterTimezone(requestedByUserId) {
103271
+ if (requestedByUserId) {
103272
+ const user = await getUserById(requestedByUserId);
103273
+ if (user?.timezone)
103274
+ return { tz: user.timezone, isFallback: false };
103275
+ }
103276
+ return { tz: "UTC", isFallback: true };
103277
+ }
103278
+ function renderShortDesc(note, max = 100) {
103279
+ const firstLine = (note.split(`
103280
+ `)[0] ?? "").trim().replace(/^pending:\s*/i, "");
103281
+ if (firstLine.length <= max)
103282
+ return firstLine;
103283
+ return `${firstLine.slice(0, max - 1).trimEnd()}…`;
103284
+ }
103285
+ function renderHumanFacingDeferral(note, nextRunAt, scheduleId, tz, isFallbackTz) {
103286
+ const now = new Date;
103287
+ const target = new Date(nextRunAt);
103288
+ const { date: date2, time } = formatDeferralDateTime(target, now, tz);
103289
+ const timeLabel = isFallbackTz ? `${time} UTC` : time;
103290
+ const shortId = scheduleId.slice(0, 8);
103291
+ const link = `[${shortId}](${getAppUrl()}/schedules/${scheduleId})`;
103292
+ const shortDesc = renderShortDesc(note);
103293
+ return `Deferred until ${date2} ${timeLabel} (${link}) -> ${shortDesc}`;
103294
+ }
103206
103295
  var registerDeferTaskTool = (server) => {
103207
103296
  createToolRegistrar(server)("defer-task", {
103208
103297
  title: "Defer Task",
103209
103298
  annotations: { destructiveHint: false, idempotentHint: false },
103210
- description: "Completes this task now with status `completed` and books a wake-up for you. Use when the result needs time: a build, a deploy, a reply. The task reaches its final state on this call; the lead sees your summary as its output unless the task has an outputSchema. For a task with an outputSchema, provide output as a JSON string matching that schema; it is stored verbatim as terminal output, while deferral details remain visible in the task log. A one-off schedule wakes you up later with a child task that carries this task as its parent. Optionally provide wakeOn to wake early when another task completes or fails; delayMs or runAt remains required as the ceiling. Provide delayMs or runAt, a summary of what you did, and a note that says what is pending and what to check.",
103299
+ description: "Completes this task now with status `completed` and books a wake-up for you. Use when the result needs time: a build, a deploy, a reply. The task reaches its final state on this call; the lead sees your summary as its output unless the task has an outputSchema. For a task with an outputSchema, provide output as a JSON string matching that schema; it is stored verbatim as terminal output, while deferral details remain visible in the task log. A one-off schedule wakes you up later with a child task that carries this task as its parent. Optionally provide wakeOn with taskId or taskIds to wake early on task outcomes; mode defaults to all, or use any for the first match. delayMs or runAt remains required as the ceiling for the whole set. Provide delayMs or runAt, a summary of what you did, and a note that says what is pending and what to check.",
103211
103300
  inputSchema: object({
103212
103301
  taskId: string().describe("The ID of the task you are working on."),
103213
103302
  delayMs: number().int().positive().optional().describe("Wake up after this many milliseconds (e.g. 1800000 for 30 min)."),
103214
103303
  runAt: string().datetime().optional().describe("Wake up at this ISO datetime (e.g. '2026-03-06T15:00:00Z'). Must be future."),
103215
103304
  wakeOn: object({
103216
103305
  event: _enum(["task.completed", "task.failed", "settled"]),
103217
- taskId: string().min(1)
103218
- }).strict().optional().describe("Wake early on this task event. settled covers completed or failed. Already-terminal tasks are rejected; a delayMs/runAt ceiling is still required."),
103306
+ taskId: string().min(1).optional(),
103307
+ taskIds: array(string().min(1)).min(1).optional(),
103308
+ mode: _enum(["all", "any"]).optional()
103309
+ }).strict().refine((wake) => wake.taskId !== undefined !== (wake.taskIds !== undefined), {
103310
+ message: "Provide exactly one of wakeOn.taskId or wakeOn.taskIds."
103311
+ }).refine((wake) => !wake.taskIds || new Set(wake.taskIds).size === wake.taskIds.length, {
103312
+ message: "wakeOn.taskIds must not contain duplicates."
103313
+ }).optional().describe("Wake early on a task event. Provide taskId or nonempty, unique taskIds. mode defaults to all (every member must match); any wakes on the first match. settled covers completed or failed. Deferred members follow their continuations. Any already-terminal member rejects the request; one delayMs/runAt ceiling is still required for the whole set."),
103219
103314
  summary: string().min(1).max(4000).describe("What you did so far and where things stand. Stored in the task log for tasks with an outputSchema; otherwise becomes the task's output."),
103220
103315
  output: string().optional().describe("Required when the task has an outputSchema: a JSON string matching that schema, stored verbatim as terminal output. Ignored for tasks without an outputSchema."),
103221
103316
  note: string().min(1).max(2000).describe("What is pending, and what to check on wake-up."),
@@ -103261,7 +103356,9 @@ var registerDeferTaskTool = (server) => {
103261
103356
  return toolErr("runAt must be in the future.");
103262
103357
  }
103263
103358
  const nextRunAt = delayMs ? new Date(Date.now() + delayMs).toISOString() : runAt;
103264
- const wakeDescription = wakeOn ? `on ${wakeOn.event} for task ${wakeOn.taskId}, or by ${nextRunAt}` : `at ${nextRunAt}`;
103359
+ const watchedTaskIds = wakeOn?.taskIds ?? (wakeOn?.taskId ? [wakeOn.taskId] : []);
103360
+ const wakeMode = wakeOn?.mode ?? "all";
103361
+ const wakeDescription = wakeOn ? `on ${wakeOn.event} for ${wakeMode} of tasks ${watchedTaskIds.join(", ")}, or by ${nextRunAt}` : `at ${nextRunAt}`;
103265
103362
  const checksBlock = renderChecks(checks2);
103266
103363
  const taskTemplate = `Resume task ${taskId}: ${note}${checksBlock}`;
103267
103364
  const createdBy = await resolveTaskAuditUserId(requestInfo.sourceTaskId, requestInfo.agentId) ?? undefined;
@@ -103273,16 +103370,17 @@ var registerDeferTaskTool = (server) => {
103273
103370
  if (outputValidationError)
103274
103371
  return toolErr(outputValidationError);
103275
103372
  }
103373
+ const { tz: requesterTz, isFallback: isFallbackTz } = await resolveRequesterTimezone(task.requestedByUserId);
103276
103374
  try {
103277
103375
  const committed = await getDbClient().transaction(async () => {
103278
- if (wakeOn) {
103279
- if (wakeOn.taskId === taskId)
103376
+ for (const watchedId of watchedTaskIds) {
103377
+ if (watchedId === taskId)
103280
103378
  throw new DeferAbortedError("Cannot wake on the task being deferred.");
103281
- const watched = await getTaskById(wakeOn.taskId);
103379
+ const watched = await getTaskById(watchedId);
103282
103380
  if (!watched)
103283
- throw new DeferAbortedError(`Watched task ${wakeOn.taskId} not found.`);
103381
+ throw new DeferAbortedError(`Watched task ${watchedId} not found.`);
103284
103382
  if (isTerminalTaskStatus(watched.status))
103285
- throw new DeferAbortedError(`Watched task ${wakeOn.taskId} is already ${watched.status}; read its result instead of deferring.`);
103383
+ throw new DeferAbortedError(`Watched task ${watchedId} is already ${watched.status}; read its result instead of deferring.`);
103286
103384
  }
103287
103385
  const schedule = await createScheduledTask({
103288
103386
  name: `deferred-${taskId.slice(0, 8)}-${Date.now()}-${crypto.randomUUID()}`,
@@ -103301,9 +103399,12 @@ var registerDeferTaskTool = (server) => {
103301
103399
  createdBy
103302
103400
  });
103303
103401
  if (wakeOn) {
103304
- await getDbClient().run("INSERT INTO deferred_task_waits (scheduleId, taskId, eventName, created_by, updated_by) VALUES (?, ?, ?, ?, ?)", [schedule.id, wakeOn.taskId, wakeOn.event, createdBy ?? null, createdBy ?? null]);
103402
+ await getDbClient().run("INSERT INTO deferred_task_waits (scheduleId, eventName, mode, created_by, updated_by) VALUES (?, ?, ?, ?, ?)", [schedule.id, wakeOn.event, wakeMode, createdBy ?? null, createdBy ?? null]);
103403
+ for (const watchedId of watchedTaskIds) {
103404
+ await getDbClient().run("INSERT INTO deferred_task_wait_members (scheduleId, taskId, created_by, updated_by) VALUES (?, ?, ?, ?)", [schedule.id, watchedId, createdBy ?? null, createdBy ?? null]);
103405
+ }
103305
103406
  getDbClient().afterCommit(() => {
103306
- reconcileDeferredTaskWaits(wakeOn.taskId).catch((err) => {
103407
+ Promise.all(watchedTaskIds.map((id) => reconcileDeferredTaskWaits(id))).catch((err) => {
103307
103408
  console.error("[defer-task] Event wake reconciliation failed:", err);
103308
103409
  });
103309
103410
  });
@@ -103311,19 +103412,19 @@ var registerDeferTaskTool = (server) => {
103311
103412
  const deferralDetails = `${summary}
103312
103413
 
103313
103414
  Deferred until ${nextRunAt} (schedule ${schedule.id}). Pending: ${note}${checksBlock}`;
103314
- const terminalOutput = task.outputSchema ? output : deferralDetails;
103315
- const completed = await completeTask(taskId, terminalOutput);
103415
+ const terminalOutput = task.outputSchema ? output : renderHumanFacingDeferral(note, nextRunAt, schedule.id, requesterTz, isFallbackTz);
103416
+ const completed = await completeTask(taskId, terminalOutput, {
103417
+ addTags: ["deferred"]
103418
+ });
103316
103419
  if (!completed) {
103317
103420
  throw new DeferAbortedError(`Task ${taskId} reached a terminal state before this deferral committed.`);
103318
103421
  }
103319
- if (task.outputSchema) {
103320
- await createLogEntry({
103321
- eventType: "task_progress",
103322
- taskId,
103323
- agentId: requestInfo.agentId,
103324
- newValue: deferralDetails
103325
- });
103326
- }
103422
+ await createLogEntry({
103423
+ eventType: "task_progress",
103424
+ taskId,
103425
+ agentId: requestInfo.agentId,
103426
+ newValue: deferralDetails
103427
+ });
103327
103428
  getDbClient().afterCommit(() => {
103328
103429
  ensure({
103329
103430
  id: "completed",
@@ -116271,7 +116372,7 @@ function checkOutputSchemaShape(outputSchema, ctx) {
116271
116372
  var sendTaskInputSchema = object({
116272
116373
  agentId: string().optional().describe("The agent to assign/offer task to. Omit to create unassigned task for pool."),
116273
116374
  routingReason: RoutingReasonSchema.optional().describe("Why this agent was selected. Required when agentId is supplied; omit for pool routing."),
116274
- routingNote: string().max(200).optional().describe("Optional routing context (maximum 200 characters)."),
116375
+ routingNote: string().max(200).optional().describe("Why this worker fits the task. Required when agentId is supplied: at least 10 characters after trimming whitespace, maximum 200 characters. Optional for implicit parent or pool routing."),
116275
116376
  task: string().min(1).describe("The task description to send."),
116276
116377
  key: AssetKeySchema.optional().describe("Logical namespace key. Child tasks inherit their parent namespace when provided."),
116277
116378
  offerMode: boolean().default(false).describe("If true, offer the task instead of direct assign (agent must accept/reject)."),
@@ -116312,6 +116413,13 @@ var sendTaskInputSchema = object({
116312
116413
  path: ["routingReason"]
116313
116414
  });
116314
116415
  }
116416
+ if (data.agentId !== undefined && (data.routingNote?.trim().length ?? 0) < 10) {
116417
+ ctx.addIssue({
116418
+ code: ZodIssueCode.custom,
116419
+ message: "routingNote is required when agentId is supplied (at least 10 characters after trim).",
116420
+ path: ["routingNote"]
116421
+ });
116422
+ }
116315
116423
  checkOutputSchemaShape(data.outputSchema, ctx);
116316
116424
  });
116317
116425
  var sendTaskOutputSchema = swarmToolOutputSchema({
@@ -116366,6 +116474,9 @@ async function sendTaskHandler(ctx, {
116366
116474
  if (agentId !== undefined && routingReason === undefined) {
116367
116475
  return toolErr("routingReason is required when agentId is supplied.");
116368
116476
  }
116477
+ if (agentId !== undefined && (routingNote?.trim().length ?? 0) < 10) {
116478
+ return toolErr("routingNote is required when agentId is supplied (at least 10 characters after trim).");
116479
+ }
116369
116480
  if (ctx.kind === "owner" && !ctx.agentId) {
116370
116481
  return toolErr('Agent ID not found. The MCP client should define the "X-Agent-ID" header.', {
116371
116482
  data: { yourAgentId: ctx.agentId }
@@ -116425,6 +116536,7 @@ async function sendTaskHandler(ctx, {
116425
116536
  }
116426
116537
  const effectiveRoutingReason = agentId !== undefined ? routingReason : effectiveAgentId ? "continuity" : undefined;
116427
116538
  const effectiveRoutingNote = effectiveRoutingReason ? routingNote : undefined;
116539
+ const effectiveRoutingSource = agentId !== undefined ? "declared" : effectiveAgentId ? "engine_default" : undefined;
116428
116540
  const evaluateDedupGuards = async () => {
116429
116541
  const existingTrackerWork = await findExistingLinearTrackerContextWork(effectiveParentTask?.contextKey);
116430
116542
  if (existingTrackerWork) {
@@ -116499,6 +116611,7 @@ async function sendTaskHandler(ctx, {
116499
116611
  followUpConfig,
116500
116612
  outputSchema,
116501
116613
  routingReason: effectiveRoutingReason,
116614
+ routingSource: effectiveRoutingSource,
116502
116615
  routingNote: effectiveRoutingNote,
116503
116616
  routingAffinity: effectiveLeadOnly || requiredCapabilities?.length ? { leadOnly: effectiveLeadOnly, capabilities: requiredCapabilities ?? [] } : undefined
116504
116617
  });
@@ -116557,6 +116670,7 @@ async function sendTaskHandler(ctx, {
116557
116670
  followUpConfig,
116558
116671
  outputSchema,
116559
116672
  routingReason: effectiveRoutingReason,
116673
+ routingSource: effectiveRoutingSource,
116560
116674
  routingNote: effectiveRoutingNote,
116561
116675
  routingAffinity: effectiveLeadOnly || requiredCapabilities?.length ? { leadOnly: effectiveLeadOnly, capabilities: requiredCapabilities ?? [] } : undefined
116562
116676
  });
@@ -116594,6 +116708,7 @@ async function sendTaskHandler(ctx, {
116594
116708
  followUpConfig,
116595
116709
  outputSchema,
116596
116710
  routingReason: effectiveRoutingReason,
116711
+ routingSource: effectiveRoutingSource,
116597
116712
  routingNote: effectiveRoutingNote,
116598
116713
  routingAffinity: effectiveLeadOnly || requiredCapabilities?.length ? { leadOnly: effectiveLeadOnly, capabilities: requiredCapabilities ?? [] } : undefined
116599
116714
  });
@@ -117135,6 +117250,7 @@ To reject: close this task with a rejection reason.`;
117135
117250
  const task = await createTaskExtended(taskDescription, {
117136
117251
  agentId: leadAgent.id,
117137
117252
  routingReason: "skill",
117253
+ routingSource: "engine_default",
117138
117254
  creatorAgentId: requestInfo.agentId,
117139
117255
  source: "mcp",
117140
117256
  taskType: "skill-approval",
@@ -118911,7 +119027,7 @@ var registerStoreProgressTool = (server) => {
118911
119027
  taskId: uuid().optional().describe("Full task UUID. Defaults to the caller-owned task in X-Source-Task-Id; required outside task context."),
118912
119028
  progress: string().optional().describe("The progress update to store."),
118913
119029
  status: _enum(["completed", "failed", "in_progress", "pending"]).optional().describe("Set to 'completed' or 'failed' to finish the task. 'in_progress' and 'pending' store progress only and do not change task status."),
118914
- output: string().optional().describe("The task result (used when completing). For Slack-originated tasks, this is published verbatim in the thread's outcome card: provide a concrete summary scaled to what was asked, including only the outcome and any links or IDs the human needs—not process narration, a transcript, or a restatement of the brief."),
119030
+ output: string().optional().describe("The task result (used when completing). For Slack-originated tasks, this is published verbatim in the thread's outcome card. Keep free-text output under 120 words by default. Name the result and every artifact link, plus any IDs the human needs. Link documents instead of inlining them; omit process narration, transcripts, and restatements of the brief. Exceed the target only when requested depth, enumerated results, essential evidence, caveats, or instructions require it, or when the task's outputSchema requires longer output. When the task carries an outputSchema, output must be JSON matching it."),
118915
119031
  failureReason: string().optional().describe("The reason for failure (used when failing)."),
118916
119032
  attachments: array(AttachmentInputSchema).max(20).optional().describe("Pointer-based artifacts produced by this step — agent-fs path, URL, shared-fs path, or swarm Page. No inline file data; upload to agent-fs first and attach by path. Agent-fs pointers are verified before task state changes, using the explicit org/drive pair or the registering agent's configured defaults. May be sent on any call (progress or completion) and accumulates across calls; duplicates are de-duped by sha256 (when present) or by (kind, pointer, name)."),
118917
119033
  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."),
@@ -119682,6 +119798,7 @@ async function emitBudgetRefusalSideEffects(ctx, inserted) {
119682
119798
  const followUp = await createTaskExtended(resolved.text, {
119683
119799
  agentId: leadAgent.id,
119684
119800
  routingReason: "skill",
119801
+ routingSource: "engine_default",
119685
119802
  source: "system",
119686
119803
  taskType: "follow-up",
119687
119804
  parentTaskId: ctx.task.id,
@@ -4,12 +4,12 @@ import {
4
4
  linkIdentity,
5
5
  recordUnmappedIdentity,
6
6
  resolveIdentity
7
- } from "./cli-gv88e1vf.js";
7
+ } from "./cli-ydk0wjj8.js";
8
8
  import {
9
9
  getKv,
10
10
  init_db,
11
11
  upsertKv
12
- } from "./cli-yab68w40.js";
12
+ } from "./cli-qp69dd5d.js";
13
13
 
14
14
  // src/slack/enrich.ts
15
15
  init_db();