@desplega.ai/agent-swarm 1.147.0 → 1.149.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 (185) hide show
  1. package/README.md +13 -1
  2. package/dist/{acp-adapter-9n319wqc.js → acp-adapter-4jncb126.js} +12 -5
  3. package/dist/{actions-2vxqvpr9.js → actions-31vp3ae7.js} +10 -9
  4. package/dist/{app-w066xfy0.js → app-1hh67x8w.js} +6 -6
  5. package/dist/{assistant-kt31dj2h.js → assistant-z66dmz6p.js} +13 -11
  6. package/dist/{boot-reembed-az5rassp.js → boot-reembed-fqzxxzjh.js} +7 -7
  7. package/dist/{boot-reembed-j3mm3rfz.js → boot-reembed-wxa8ya0s.js} +8 -8
  8. package/dist/{boot-scrub-logs-b6h54817.js → boot-scrub-logs-jnyndh79.js} +5 -5
  9. package/dist/{claude-adapter-w1z04ann.js → claude-adapter-3qpa9w0j.js} +9 -9
  10. package/dist/{claude-managed-adapter-sactwn31.js → claude-managed-adapter-qvsmh6mv.js} +2 -2
  11. package/dist/{claude-sdk-session-f0cc1kec.js → claude-sdk-session-2yxgjs5d.js} +9 -9
  12. package/dist/{cli-y6b6fb76.js → cli-08b07b4r.js} +1 -1
  13. package/dist/{cli-8fc8de14.js → cli-0z2v4nhw.js} +1 -1
  14. package/dist/{cli-de14znh8.js → cli-19f354qr.js} +2 -2
  15. package/dist/{cli-hbv0kq6w.js → cli-2qts1hys.js} +3 -3
  16. package/dist/{cli-kpv03zhj.js → cli-3apbzgyk.js} +27 -15
  17. package/dist/{cli-1th1728g.js → cli-3q5ejx9p.js} +2 -2
  18. package/dist/{cli-d8brzxjb.js → cli-4wtq5jjv.js} +2 -2
  19. package/dist/{cli-ct0et58h.js → cli-5my3bjsd.js} +1 -1
  20. package/dist/{cli-cn6mmc7f.js → cli-6664w7y4.js} +1 -1
  21. package/dist/{cli-yz3djrm0.js → cli-6pqcb4q0.js} +53 -13
  22. package/dist/{cli-719k9j2c.js → cli-7smrsr25.js} +3 -3
  23. package/dist/{cli-rw51bq3j.js → cli-9fy6nk6g.js} +1 -1
  24. package/dist/{cli-zhjmqxzh.js → cli-9hspd3dp.js} +2 -2
  25. package/dist/{cli-3tgwnf43.js → cli-aae6hz6a.js} +4 -4
  26. package/dist/{cli-89xfd7f9.js → cli-cr12paw2.js} +5 -5
  27. package/dist/{cli-b5bq9crk.js → cli-d8ftsp62.js} +8 -8
  28. package/dist/{cli-4nr988h6.js → cli-e95cx1eb.js} +3 -3
  29. package/dist/{cli-n8508nre.js → cli-gjhjfeeg.js} +1 -1
  30. package/dist/{cli-p1d5b073.js → cli-gv88e1vf.js} +1 -1
  31. package/dist/{cli-rvqz34y5.js → cli-jecc01cb.js} +1 -1
  32. package/dist/{cli-8v0g1yc8.js → cli-k0cr4kat.js} +1 -1
  33. package/dist/{cli-mmemxxdc.js → cli-kgz4np97.js} +4 -4
  34. package/dist/{cli-w9kb3bk1.js → cli-kjwt6hdf.js} +3 -1
  35. package/dist/{cli-f7dsy61y.js → cli-mnmsfd1w.js} +6 -2
  36. package/dist/{cli-54wwve05.js → cli-n3dz2942.js} +37 -26
  37. package/dist/{cli-12fz972k.js → cli-nye12xk5.js} +8 -5
  38. package/dist/{cli-tzvk9haz.js → cli-phsxnkp6.js} +20 -20
  39. package/dist/{cli-53s590z8.js → cli-q50ef8g0.js} +1 -1
  40. package/dist/{cli-f146mn5s.js → cli-qaacms9y.js} +7 -6
  41. package/dist/{cli-xqcq9y5e.js → cli-r2ap2czm.js} +1 -0
  42. package/dist/{cli-m8yrsg97.js → cli-sd5pv3b1.js} +3 -3
  43. package/dist/{cli-0b6y7kxm.js → cli-xm87hzbw.js} +1 -1
  44. package/dist/{cli-ftht3zzj.js → cli-yab68w40.js} +285 -11
  45. package/dist/{cli-atcve9y8.js → cli-yb9qhqam.js} +227 -59
  46. package/dist/{cli-smby5m17.js → cli-ygweqcn4.js} +133 -22
  47. package/dist/{cli-dttph1bw.js → cli-ykxrnd1q.js} +2 -2
  48. package/dist/{cli-m9sxbkhm.js → cli-zvz62chv.js} +3 -3
  49. package/dist/cli.js +16 -14
  50. package/dist/{codex-adapter-zw4dwsx7.js → codex-adapter-8meawydj.js} +4 -4
  51. package/dist/{codex-hook-bw8p5nh4.js → codex-hook-hfrt9shr.js} +2 -2
  52. package/dist/{codex-session-runner-k981s65v.js → codex-session-runner-gjgxyp5j.js} +4 -4
  53. package/dist/{commands-sykrxx7e.js → commands-hz3nb95f.js} +5 -5
  54. package/dist/{db-sfbsc8wt.js → db-ggz97zbm.js} +5 -5
  55. package/dist/{e2b-6hb103d8.js → e2b-p04vmtx0.js} +1 -1
  56. package/dist/{handlers-0aspcejm.js → handlers-nbzdzn9k.js} +14 -11
  57. package/dist/{hook-hxccs7m5.js → hook-bks2q1f6.js} +7 -7
  58. package/dist/{hook-4nvqj2sb.js → hook-kq9wp0ep.js} +8 -8
  59. package/dist/{http-y06z517d.js → http-hrf77v87.js} +96 -45
  60. package/dist/{index-tce1rss4.js → index-6nsbg88z.js} +443 -144
  61. package/dist/{index-x5j894zf.js → index-8hmeg8j1.js} +14 -14
  62. package/dist/{index-k8znfx0z.js → index-cqtebbhb.js} +13 -13
  63. package/dist/{index-hssww7kj.js → index-n28pw1zt.js} +15 -15
  64. package/dist/{keepalive-w733ax66.js → keepalive-dxc12gvg.js} +7 -7
  65. package/dist/{lead-75bjqa9d.js → lead-yckfn18d.js} +32 -32
  66. package/dist/{maintenance-w4f1zjck.js → maintenance-6kfb2m5e.js} +8 -8
  67. package/dist/{oauth-refresh-sweep-wdetky26.js → oauth-refresh-sweep-1x1ac722.js} +6 -6
  68. package/dist/{onboard-bb5net8s.js → onboard-dcyt1609.js} +4 -3
  69. package/dist/{opencode-adapter-fef1mrn2.js → opencode-adapter-dce4wskd.js} +2 -2
  70. package/dist/{otel-impl-0w7c14ap.js → otel-impl-tbk3e5dr.js} +2 -2
  71. package/dist/{pi-mono-adapter-2has4gnp.js → pi-mono-adapter-zvshk5cj.js} +2 -2
  72. package/dist/{pricing-refresh-9nzsrgcq.js → pricing-refresh-kaqg567e.js} +7 -7
  73. package/dist/{rbac-roles-z1jrffbt.js → rbac-roles-ammq6rd2.js} +5 -5
  74. package/dist/{rbac-roles-r3hqjp09.js → rbac-roles-cf97v1vd.js} +6 -6
  75. package/dist/{render-v2-vbr89fnb.js → render-v2-80w603vy.js} +6 -6
  76. package/dist/{seed-pricing-g62hy1pk.js → seed-pricing-zbrn83xv.js} +6 -6
  77. package/dist/{setup-gnfqnptp.js → setup-fe66kczs.js} +2 -2
  78. package/dist/{worker-kznxp4qm.js → worker-qmb2d1e2.js} +32 -32
  79. package/dist/{x-n2phr5vm.js → x-n3e0v3xa.js} +2 -2
  80. package/openapi.json +46 -4
  81. package/package.json +3 -1
  82. package/src/agentmail/handlers.ts +5 -0
  83. package/src/automation-preflight-alert.ts +41 -0
  84. package/src/be/automation-preflight.ts +3 -3
  85. package/src/be/budget-refusal-notify.ts +1 -0
  86. package/src/be/db/tasks/read.ts +5 -0
  87. package/src/be/db.ts +132 -2
  88. package/src/be/migrations/150_deferred_task_waits.sql +18 -0
  89. package/src/be/migrations/151_repair_scheduled_task_required_params.sql +39 -0
  90. package/src/be/migrations/152_routing_decisions.sql +44 -0
  91. package/src/be/scripts/typecheck.ts +33 -22
  92. package/src/be/seed-scripts/catalog/delegate.ts +5 -1
  93. package/src/be/seed-skills/bundled-files.generated.json +10 -0
  94. package/src/be/seed-skills/index.ts +3 -0
  95. package/src/be/steering.ts +1 -0
  96. package/src/be/swarm-config-guard.ts +11 -0
  97. package/src/commands/onboard/steps/post-task.tsx +1 -0
  98. package/src/github/handlers.ts +9 -0
  99. package/src/gitlab/handlers.ts +4 -0
  100. package/src/heartbeat/heartbeat.ts +8 -0
  101. package/src/http/approval-requests.ts +1 -0
  102. package/src/http/apps.ts +1 -0
  103. package/src/http/config.ts +15 -6
  104. package/src/http/mcp.ts +31 -4
  105. package/src/http/script-runs.ts +6 -0
  106. package/src/http/tasks.ts +52 -30
  107. package/src/integrations/kapso/inbound.ts +1 -0
  108. package/src/jira/sync.ts +2 -0
  109. package/src/linear/sync.ts +2 -0
  110. package/src/prompts/session-templates.ts +29 -15
  111. package/src/scheduler/deferred-task-waits.ts +123 -0
  112. package/src/scheduler/schedule-task.ts +42 -0
  113. package/src/scheduler/scheduler.ts +22 -31
  114. package/src/script-workflows/workflow-ctx.ts +2 -0
  115. package/src/scripts-runtime/types/stdlib.d.ts +38 -24
  116. package/src/scripts-runtime/types/swarm-sdk.d.ts +38 -24
  117. package/src/server.ts +10 -1
  118. package/src/slack/actions.ts +1 -0
  119. package/src/slack/assistant.ts +2 -0
  120. package/src/slack/handlers.ts +3 -0
  121. package/src/slack/thread-buffer.ts +2 -0
  122. package/src/tasks/worker-follow-up.ts +9 -0
  123. package/src/tests/acp-adapter.test.ts +35 -6
  124. package/src/tests/acp-session-token.test.ts +67 -0
  125. package/src/tests/asset-key-api.test.ts +15 -2
  126. package/src/tests/asset-key-mcp.test.ts +2 -0
  127. package/src/tests/automation-preflight-alert.test.ts +91 -0
  128. package/src/tests/claude-worker-parity.test.ts +3 -0
  129. package/src/tests/config-session-auth.test.ts +143 -0
  130. package/src/tests/defer-task.test.ts +117 -6
  131. package/src/tests/deferred-task-wake.test.ts +456 -0
  132. package/src/tests/heartbeat-reroute-decision.test.ts +1 -0
  133. package/src/tests/http-api-integration.test.ts +33 -4
  134. package/src/tests/mcp-input-ergonomics.test.ts +386 -0
  135. package/src/tests/model-control.test.ts +18 -5
  136. package/src/tests/opencode-adapter.test.ts +2 -2
  137. package/src/tests/promote-draft-task-route.test.ts +4 -0
  138. package/src/tests/prompt-template-session.test.ts +13 -4
  139. package/src/tests/rbac-wire-e2e.test.ts +2 -2
  140. package/src/tests/routing-decision-persistence.test.ts +520 -0
  141. package/src/tests/routing-reason-contract.test.ts +89 -0
  142. package/src/tests/routing-reason-inventory.test.ts +55 -0
  143. package/src/tests/schedule-target-type.test.ts +48 -1
  144. package/src/tests/scheduled-task-required-params-migration.test.ts +182 -0
  145. package/src/tests/scheduled-tasks.test.ts +9 -5
  146. package/src/tests/script-connections.test.ts +4 -0
  147. package/src/tests/script-runs-http.test.ts +31 -0
  148. package/src/tests/scripts-typecheck.test.ts +11 -0
  149. package/src/tests/secret-scrubber.test.ts +12 -0
  150. package/src/tests/send-task-output-schema.test.ts +66 -1
  151. package/src/tests/send-task-requested-by.test.ts +1 -0
  152. package/src/tests/send-task-slack-routing-guard.test.ts +2 -0
  153. package/src/tests/store-progress-blocked-waiting-gate.test.ts +151 -0
  154. package/src/tests/swarm-tool-result-gate.test.ts +24 -0
  155. package/src/tests/task-tool-manifest.test.ts +47 -0
  156. package/src/tests/task-tool-preload-mcp.test.ts +125 -0
  157. package/src/tests/task-tools-ctx.test.ts +2 -0
  158. package/src/tests/tool-output-agent-id.test.ts +1 -0
  159. package/src/tests/ui-followup-lead-delegation.test.ts +6 -1
  160. package/src/tests/workflow-agent-task.test.ts +24 -1
  161. package/src/tests/workflow-engine-v2.test.ts +58 -2
  162. package/src/tools/accept-steer.ts +0 -1
  163. package/src/tools/defer-task.ts +73 -21
  164. package/src/tools/memory-get.ts +10 -3
  165. package/src/tools/memory-rate.ts +19 -7
  166. package/src/tools/memory-search.ts +2 -1
  167. package/src/tools/memory-store.ts +25 -5
  168. package/src/tools/send-task.ts +40 -2
  169. package/src/tools/skills/skill-publish.ts +1 -0
  170. package/src/tools/store-progress.ts +78 -4
  171. package/src/tools/templates.ts +2 -1
  172. package/src/tools/utils.ts +33 -2
  173. package/src/types.ts +14 -1
  174. package/src/utils/acp-session-token.ts +14 -4
  175. package/src/utils/secret-scrubber.ts +2 -0
  176. package/src/utils/task-tool-manifest.ts +33 -0
  177. package/src/workflows/engine.ts +4 -1
  178. package/src/workflows/executors/agent-task.ts +7 -1
  179. package/templates/ai-toolbox.manifest.json +6 -1
  180. package/templates/skills/comms/config.json +18 -0
  181. package/templates/skills/comms/content.md +74 -0
  182. package/templates/skills/comms/files/references/ste-rules.md +73 -0
  183. package/templates/skills/comms/files/references/visual-shapes.md +112 -0
  184. package/templates/skills/swarm-scripts/SKILL.md +3 -2
  185. package/templates/skills/swarm-scripts/content.md +3 -2
@@ -25,7 +25,7 @@ import {
25
25
  sandboxSpawnEnv,
26
26
  snapshotCapped,
27
27
  touchScratchScriptLastUsed
28
- } from "./cli-3tgwnf43.js";
28
+ } from "./cli-aae6hz6a.js";
29
29
  import {
30
30
  detachedProcessGroup,
31
31
  registerProcessGroup,
@@ -34,17 +34,18 @@ import {
34
34
  import {
35
35
  getOAuthApp,
36
36
  getOAuthTokens
37
- } from "./cli-zhjmqxzh.js";
37
+ } from "./cli-9hspd3dp.js";
38
38
  import {
39
39
  withSiblingAwareness
40
- } from "./cli-53s590z8.js";
40
+ } from "./cli-q50ef8g0.js";
41
41
  import {
42
42
  getSlackApp
43
- } from "./cli-b5bq9crk.js";
43
+ } from "./cli-d8ftsp62.js";
44
44
  import {
45
45
  FollowUpConfigSchema,
46
46
  ModelTierSchema,
47
47
  ReasoningEffortSchema,
48
+ RoutingReasonSchema,
48
49
  cancelPendingApprovalRequestsForRun,
49
50
  cancelTask,
50
51
  claimApprovalCancellationNotification,
@@ -91,13 +92,13 @@ import {
91
92
  updateWorkflowRun,
92
93
  updateWorkflowRunStep,
93
94
  workflowContextKey
94
- } from "./cli-ftht3zzj.js";
95
+ } from "./cli-yab68w40.js";
95
96
  import {
96
97
  deepInterpolate,
97
98
  findInterpolationTokens,
98
99
  init_template,
99
100
  interpolate
100
- } from "./cli-kpv03zhj.js";
101
+ } from "./cli-3apbzgyk.js";
101
102
  import {
102
103
  getAppUrl,
103
104
  getMcpBaseUrl,
@@ -113,7 +114,7 @@ import {
113
114
  init_secret_scrubber,
114
115
  isSensitiveKey,
115
116
  scrubSecrets
116
- } from "./cli-xqcq9y5e.js";
117
+ } from "./cli-r2ap2czm.js";
117
118
  import {
118
119
  init_event_bus,
119
120
  workflowEventBus
@@ -121,6 +122,38 @@ import {
121
122
  import {
122
123
  __require
123
124
  } from "./cli-bc05qbss.js";
125
+ // src/automation-preflight-alert.ts
126
+ init_constants();
127
+ init_secret_scrubber();
128
+ async function notifyAutomationPreflightFailure(preflight) {
129
+ const channel = process.env.SLACK_ALERTS_CHANNEL?.trim();
130
+ if (!channel) {
131
+ console.warn("[Automation Preflight] SLACK_ALERTS_CHANNEL not set; skipping alert");
132
+ return;
133
+ }
134
+ try {
135
+ const { getSlackApp: getSlackApp2 } = await import("./app-1hh67x8w.js");
136
+ const app = getSlackApp2();
137
+ if (!app) {
138
+ console.warn("[Automation Preflight] Slack not available, cannot send notification");
139
+ return;
140
+ }
141
+ await app.client.chat.postMessage({
142
+ channel,
143
+ text: scrubSecrets(`⚠️ Automation needs setup
144
+ ` + `Automation: ${preflight.kind} "${preflight.name}"
145
+ Missing params: ${preflight.missing.params.join(", ") || "none"}
146
+ Missing integrations: ${preflight.missing.integrations.join(", ") || "none"}
147
+ Fire SKIPPED. It was not retried or queued.
148
+ Fix setup: ${getAppUrl()}${preflight.fixUrl}`),
149
+ unfurl_links: false,
150
+ unfurl_media: false
151
+ });
152
+ } catch (error) {
153
+ console.error("[Automation Preflight] Failed to send Slack notification:", scrubSecrets(error instanceof Error ? error.message : String(error)));
154
+ }
155
+ }
156
+
124
157
  // src/be/automation-preflight.ts
125
158
  init_db();
126
159
  var NEEDS_SETUP_PREFIX = "needs_setup:";
@@ -359,7 +392,7 @@ async function recordWorkflowPreflightFailure(input) {
359
392
  AND startedAt >= ? AND startedAt < ?
360
393
  ORDER BY startedAt ASC LIMIT 1`, [input.workflowId, bounds.start, bounds.end]);
361
394
  if (existing)
362
- return existing.id;
395
+ return { runId: existing.id, recorded: false };
363
396
  const runId = crypto.randomUUID();
364
397
  const timestamp = now.toISOString();
365
398
  await tx.run(`INSERT INTO workflow_runs
@@ -376,7 +409,7 @@ async function recordWorkflowPreflightFailure(input) {
376
409
  timestamp,
377
410
  timestamp
378
411
  ]);
379
- return runId;
412
+ return { runId, recorded: true };
380
413
  });
381
414
  }
382
415
 
@@ -876,13 +909,16 @@ async function resolveRenderedWorkflowInputs(input) {
876
909
  async function startWorkflowExecution(workflow, triggerData, registry, options = {}) {
877
910
  const preflight = preflightAutomation(workflowPreflightInput(workflow), await getAutomationSetupStates());
878
911
  if (preflight.state === "needs_setup") {
879
- return await recordWorkflowPreflightFailure({
912
+ const { runId: runId2, recorded } = await recordWorkflowPreflightFailure({
880
913
  workflowId: workflow.id,
881
914
  triggerType: options.triggerType ?? "manual",
882
915
  triggerData,
883
916
  failureReason: preflight.failureReason,
884
917
  createdBy: options.requestedByUserId
885
918
  });
919
+ if (recorded)
920
+ await notifyAutomationPreflightFailure(preflight);
921
+ return runId2;
886
922
  }
887
923
  workflow = renderAutomationTokens(workflow, workflow.params ?? {});
888
924
  if (workflow.triggerSchema) {
@@ -2882,6 +2918,8 @@ init_types();
2882
2918
  var AgentTaskConfigSchema = exports_external.object({
2883
2919
  template: exports_external.string(),
2884
2920
  agentId: exports_external.string().optional(),
2921
+ routingReason: RoutingReasonSchema.optional(),
2922
+ routingNote: exports_external.string().max(200).optional(),
2885
2923
  tags: exports_external.array(exports_external.string()).optional(),
2886
2924
  priority: exports_external.number().int().min(0).max(100).optional(),
2887
2925
  offerMode: exports_external.boolean().optional(),
@@ -2941,6 +2979,8 @@ class AgentTaskExecutor extends BaseExecutor {
2941
2979
  const { description: taskDescription, options: taskOptions } = await withSiblingAwareness(config.template, {
2942
2980
  key: effectiveKey,
2943
2981
  agentId: config.agentId ?? null,
2982
+ routingReason: config.routingReason ?? (config.agentId ? "human_pinned" : undefined),
2983
+ routingNote: config.routingNote,
2944
2984
  source: "workflow",
2945
2985
  tags: config.tags,
2946
2986
  priority: config.priority,
@@ -3335,7 +3375,7 @@ class HumanInTheLoopExecutor extends BaseExecutor {
3335
3375
  }
3336
3376
  if (notification.channel === "slack") {
3337
3377
  try {
3338
- const { getSlackApp: getSlackApp2 } = await import("./app-w066xfy0.js");
3378
+ const { getSlackApp: getSlackApp2 } = await import("./app-1hh67x8w.js");
3339
3379
  const slackApp = getSlackApp2();
3340
3380
  if (!slackApp) {
3341
3381
  console.warn("[HITL] Slack not initialized — cannot send notification");
@@ -3455,7 +3495,7 @@ class NotifyExecutor extends BaseExecutor {
3455
3495
  }
3456
3496
  }
3457
3497
  case "slack": {
3458
- const { getSlackApp: getSlackApp2 } = await import("./app-w066xfy0.js");
3498
+ const { getSlackApp: getSlackApp2 } = await import("./app-1hh67x8w.js");
3459
3499
  const app = getSlackApp2();
3460
3500
  if (!app) {
3461
3501
  return {
@@ -4279,4 +4319,4 @@ async function initWorkflows() {
4279
4319
  logOpenWebhookTriggers();
4280
4320
  }
4281
4321
 
4282
- export { validateJsonSchema, findJsonSchemaShapeErrors, automationIntegrationFixUrl, isNeedsSetupFailure, preflightAutomation, renderAutomationTokens, getAutomationSetupStates, schedulePreflightInput, listEnabledAutomationPreflightInputs, recordSchedulePreflightFailure, TriggerSchemaError, startWorkflowExecution, setupWorkflowResumeListener, retryFailedRun, cancelWorkflowRun, resumeWaitState, initWaitBusSubscriptions, subscribeWaitToBus, recoverIncompleteRuns, startRetryPoller, stopRetryPoller, validateTemplateVariables, instantiateTemplate, handleWebhookTrigger, logOpenWebhookTriggers, handleEventTrigger, handleScheduleTrigger, verifyHmacSignature, WebhookError, snapshotWorkflow, snapshotAndUpdateWorkflow, startWaitPoller, stopWaitPoller, RawLlmConfigSchema, RawLlmOutputSchema, executeRawLlm, getExecutorRegistry, initWorkflows };
4322
+ export { validateJsonSchema, findJsonSchemaShapeErrors, notifyAutomationPreflightFailure, automationIntegrationFixUrl, isNeedsSetupFailure, preflightAutomation, renderAutomationTokens, getAutomationSetupStates, schedulePreflightInput, listEnabledAutomationPreflightInputs, recordSchedulePreflightFailure, TriggerSchemaError, startWorkflowExecution, setupWorkflowResumeListener, retryFailedRun, cancelWorkflowRun, resumeWaitState, initWaitBusSubscriptions, subscribeWaitToBus, recoverIncompleteRuns, startRetryPoller, stopRetryPoller, validateTemplateVariables, instantiateTemplate, handleWebhookTrigger, logOpenWebhookTriggers, handleEventTrigger, handleScheduleTrigger, verifyHmacSignature, WebhookError, snapshotWorkflow, snapshotAndUpdateWorkflow, startWaitPoller, stopWaitPoller, RawLlmConfigSchema, RawLlmOutputSchema, executeRawLlm, getExecutorRegistry, initWorkflows };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  runStopHookSessionSummarySubprocess
3
- } from "./cli-89xfd7f9.js";
3
+ } from "./cli-cr12paw2.js";
4
4
  import {
5
5
  SessionErrorTracker,
6
6
  buildOtelTraceparentEnv,
@@ -42,7 +42,7 @@ import {
42
42
  import {
43
43
  init_secret_scrubber,
44
44
  scrubSecrets
45
- } from "./cli-xqcq9y5e.js";
45
+ } from "./cli-r2ap2czm.js";
46
46
  import {
47
47
  require_src
48
48
  } from "./cli-knd276ed.js";
@@ -817,7 +817,7 @@ class ClaudeAdapter {
817
817
  if (transport === "sdk" && isClaudeBridgeEffective(sourceEnv)) {
818
818
  throw new Error("CLAUDE_TRANSPORT=sdk cannot run with an effective Claude Bridge configuration. Select CLI transport or disable the bridge.");
819
819
  }
820
- const claudeSdk = transport === "sdk" ? await import("./claude-sdk-session-f0cc1kec.js") : undefined;
820
+ const claudeSdk = transport === "sdk" ? await import("./claude-sdk-session-2yxgjs5d.js") : undefined;
821
821
  claudeSdk?.validateClaudeSdkAdditionalArgs([
822
822
  ...claudeBinaryArgv.slice(1),
823
823
  ...config.additionalArgs ?? []
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  getDb,
3
3
  init_db
4
- } from "./cli-ftht3zzj.js";
4
+ } from "./cli-yab68w40.js";
5
5
 
6
6
  // src/be/seed-pricing.ts
7
7
  init_db();
@@ -7,12 +7,12 @@ import {
7
7
  init_date_utils,
8
8
  init_db,
9
9
  normalizeDateRequired
10
- } from "./cli-ftht3zzj.js";
10
+ } from "./cli-yab68w40.js";
11
11
  import {
12
12
  init_secret_scrubber,
13
13
  registerVolatileSecret,
14
14
  scrubSecrets
15
- } from "./cli-xqcq9y5e.js";
15
+ } from "./cli-r2ap2czm.js";
16
16
 
17
17
  // src/be/db-queries/oauth.ts
18
18
  init_crypto();
@@ -3,7 +3,7 @@ import {
3
3
  } from "./cli-epan13p1.js";
4
4
  import {
5
5
  embedScript
6
- } from "./cli-hbv0kq6w.js";
6
+ } from "./cli-2qts1hys.js";
7
7
  import {
8
8
  detachedProcessGroup,
9
9
  registerProcessGroup,
@@ -23,7 +23,7 @@ import {
23
23
  oauthAppRowToProviderConfig,
24
24
  updateAuthorizationTokens,
25
25
  upsertAuthorization
26
- } from "./cli-zhjmqxzh.js";
26
+ } from "./cli-9hspd3dp.js";
27
27
  import {
28
28
  CredentialBroker,
29
29
  DEFAULT_CREDENTIAL_BINDINGS,
@@ -44,7 +44,7 @@ import {
44
44
  normalizeDateRequired,
45
45
  placeholderForConfigKey,
46
46
  upsertSwarmConfig
47
- } from "./cli-ftht3zzj.js";
47
+ } from "./cli-yab68w40.js";
48
48
  import {
49
49
  init_env_flag,
50
50
  isEnvFlagEnabled
@@ -61,7 +61,7 @@ import {
61
61
  registerVolatileSecret,
62
62
  scrubObject,
63
63
  scrubSecrets
64
- } from "./cli-xqcq9y5e.js";
64
+ } from "./cli-r2ap2czm.js";
65
65
  import {
66
66
  __commonJS,
67
67
  __require,
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  materializeClaudeMd,
3
3
  stopClaudeMd
4
- } from "./cli-d8brzxjb.js";
4
+ } from "./cli-4wtq5jjv.js";
5
5
  import {
6
6
  summarizeSession
7
- } from "./cli-rvqz34y5.js";
7
+ } from "./cli-jecc01cb.js";
8
8
  import {
9
9
  checkToolLoop,
10
10
  clearToolHistory
@@ -26,7 +26,7 @@ import {
26
26
  init_profile_sync,
27
27
  readIdentityBaselines,
28
28
  warnProfileFileTooLarge
29
- } from "./cli-m9sxbkhm.js";
29
+ } from "./cli-zvz62chv.js";
30
30
  import {
31
31
  MAX_PROFILE_FILE_LENGTH,
32
32
  getMcpBaseUrl,
@@ -35,11 +35,11 @@ import {
35
35
  import {
36
36
  init_package,
37
37
  package_default
38
- } from "./cli-w9kb3bk1.js";
38
+ } from "./cli-kjwt6hdf.js";
39
39
  import {
40
40
  init_secret_scrubber,
41
41
  scrubSecrets
42
- } from "./cli-xqcq9y5e.js";
42
+ } from "./cli-r2ap2czm.js";
43
43
 
44
44
  // src/hooks/hook.ts
45
45
  init_package();
@@ -49,7 +49,7 @@ import {
49
49
  setSlackMessageTracking,
50
50
  slackContextKey,
51
51
  updateSlackMessageRecord
52
- } from "./cli-ftht3zzj.js";
52
+ } from "./cli-yab68w40.js";
53
53
  import {
54
54
  getAppUrl,
55
55
  init_constants
@@ -61,7 +61,7 @@ import {
61
61
  import {
62
62
  init_secret_scrubber,
63
63
  scrubSecrets
64
- } from "./cli-xqcq9y5e.js";
64
+ } from "./cli-r2ap2czm.js";
65
65
  import {
66
66
  require_extension,
67
67
  require_permessage_deflate,
@@ -54475,7 +54475,7 @@ async function initOtel(serviceRole = process.env.AGENT_ROLE || "api") {
54475
54475
  return;
54476
54476
  initialized = true;
54477
54477
  try {
54478
- const impl = await import("./otel-impl-0w7c14ap.js");
54478
+ const impl = await import("./otel-impl-tbk3e5dr.js");
54479
54479
  await impl.boot(serviceRole);
54480
54480
  realWithSpan = impl.withSpan;
54481
54481
  realStartSpan = impl.startSpan;
@@ -55793,13 +55793,13 @@ async function initSlackApp() {
55793
55793
  logLevel: import_bolt.LogLevel.DEBUG,
55794
55794
  ...slackApiUrl ? { clientOptions: { slackApiUrl } } : {}
55795
55795
  });
55796
- const { registerMessageHandler } = await import("./handlers-0aspcejm.js");
55797
- const { registerCommandHandler } = await import("./commands-sykrxx7e.js");
55798
- const { registerActionHandlers } = await import("./actions-2vxqvpr9.js");
55796
+ const { registerMessageHandler } = await import("./handlers-nbzdzn9k.js");
55797
+ const { registerCommandHandler } = await import("./commands-hz3nb95f.js");
55798
+ const { registerActionHandlers } = await import("./actions-31vp3ae7.js");
55799
55799
  registerMessageHandler(app);
55800
55800
  registerCommandHandler(app);
55801
55801
  registerActionHandlers(app);
55802
- const { createAssistant } = await import("./assistant-kt31dj2h.js");
55802
+ const { createAssistant } = await import("./assistant-z66dmz6p.js");
55803
55803
  app.assistant(createAssistant());
55804
55804
  return app;
55805
55805
  }
@@ -55808,7 +55808,7 @@ async function startSlackApp() {
55808
55808
  await initSlackApp();
55809
55809
  }
55810
55810
  if (app) {
55811
- const { isSlackRenderV2Enabled: isSlackRenderV2Enabled2 } = await import("./render-v2-vbr89fnb.js");
55811
+ const { isSlackRenderV2Enabled: isSlackRenderV2Enabled2 } = await import("./render-v2-80w603vy.js");
55812
55812
  if (isSlackRenderV2Enabled2())
55813
55813
  await ensureSlackRenderV2Activation();
55814
55814
  await app.start();
@@ -13,7 +13,7 @@ import {
13
13
  } from "./cli-b5b30yzk.js";
14
14
  import {
15
15
  summarizeSession
16
- } from "./cli-rvqz34y5.js";
16
+ } from "./cli-jecc01cb.js";
17
17
  import {
18
18
  CTX_MODE_NUDGE_EVERY
19
19
  } from "./cli-zm7njwzd.js";
@@ -49,11 +49,11 @@ import {
49
49
  import {
50
50
  init_package,
51
51
  package_default
52
- } from "./cli-w9kb3bk1.js";
52
+ } from "./cli-kjwt6hdf.js";
53
53
  import {
54
54
  init_secret_scrubber,
55
55
  scrubSecrets
56
- } from "./cli-xqcq9y5e.js";
56
+ } from "./cli-r2ap2czm.js";
57
57
  import {
58
58
  __require
59
59
  } from "./cli-bc05qbss.js";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  init_package,
3
3
  package_default
4
- } from "./cli-w9kb3bk1.js";
4
+ } from "./cli-kjwt6hdf.js";
5
5
 
6
6
  // src/commands/shared/client-config.ts
7
7
  init_package();
@@ -4,7 +4,7 @@ import {
4
4
  incrKv,
5
5
  init_db,
6
6
  upsertKv
7
- } from "./cli-ftht3zzj.js";
7
+ } from "./cli-yab68w40.js";
8
8
 
9
9
  // src/be/users.ts
10
10
  init_db();
@@ -23,7 +23,7 @@ import {
23
23
  import {
24
24
  init_secret_scrubber,
25
25
  scrubSecrets
26
- } from "./cli-xqcq9y5e.js";
26
+ } from "./cli-r2ap2czm.js";
27
27
 
28
28
  // src/utils/internal-ai/complete-structured.ts
29
29
  init_zod();
@@ -5,7 +5,7 @@ import {
5
5
  getDb,
6
6
  getDbClient,
7
7
  init_db
8
- } from "./cli-ftht3zzj.js";
8
+ } from "./cli-yab68w40.js";
9
9
 
10
10
  // src/be/rbac-roles.ts
11
11
  init_db();
@@ -4,7 +4,7 @@ import {
4
4
  } from "./cli-jsp14b6c.js";
5
5
  import {
6
6
  createTaskWithSiblingAwareness
7
- } from "./cli-53s590z8.js";
7
+ } from "./cli-q50ef8g0.js";
8
8
  import {
9
9
  init_task_attachment_links,
10
10
  taskAttachmentFetchCommand
@@ -19,13 +19,13 @@ import {
19
19
  insertTaskAttachment,
20
20
  promoteDraftTask,
21
21
  refreshDraftTaskLease
22
- } from "./cli-ftht3zzj.js";
22
+ } from "./cli-yab68w40.js";
23
23
  import {
24
24
  init_registry,
25
25
  init_resolver,
26
26
  registerTemplate,
27
27
  resolveTemplate
28
- } from "./cli-kpv03zhj.js";
28
+ } from "./cli-3apbzgyk.js";
29
29
  import {
30
30
  init_env_flag,
31
31
  isEnvFlagEnabled
@@ -33,7 +33,7 @@ import {
33
33
  import {
34
34
  init_secret_scrubber,
35
35
  scrubSecrets
36
- } from "./cli-xqcq9y5e.js";
36
+ } from "./cli-r2ap2czm.js";
37
37
  import {
38
38
  __callDispose,
39
39
  __using
@@ -7,7 +7,7 @@ var package_default;
7
7
  var init_package = __esm(() => {
8
8
  package_default = {
9
9
  name: "@desplega.ai/agent-swarm",
10
- version: "1.147.0",
10
+ version: "1.149.0",
11
11
  description: "agent-swarm.dev — an open-source operating system for AI work: a lead agent breaks goals into tasks, routes them to specialized workers such as Claude Code or Codex, runs each worker in an isolated container, and preserves shared memory, tools, schedules, and review gates so delegated work compounds across sessions.",
12
12
  keywords: [
13
13
  "agent-swarm.dev",
@@ -118,6 +118,8 @@ var init_package = __esm(() => {
118
118
  "prepare-release": "bun scripts/prepare-release.ts",
119
119
  "refresh:vendored-openapi": "bun scripts/refresh-vendored-openapi.ts",
120
120
  "sync-chart-version": "bun scripts/sync-chart-version.ts",
121
+ "sync-plugin-versions": "bun scripts/sync-plugin-versions.ts",
122
+ "check:plugin-versions": "bun scripts/sync-plugin-versions.ts --check",
121
123
  "bump:agent-fs": "bun scripts/bump-agent-fs.ts",
122
124
  "check-chart-version": "bun scripts/sync-chart-version.ts --check-if-package-version-changed",
123
125
  cli: "bun src/cli.tsx",
@@ -26,11 +26,11 @@ import {
26
26
  updateAgentMaxTasks,
27
27
  updateAgentStatus,
28
28
  upsertSwarmConfig
29
- } from "./cli-ftht3zzj.js";
29
+ } from "./cli-yab68w40.js";
30
30
  import {
31
31
  init_resolver,
32
32
  resolveTemplate
33
- } from "./cli-kpv03zhj.js";
33
+ } from "./cli-3apbzgyk.js";
34
34
  import {
35
35
  init_env_flag,
36
36
  isEnvFlagEnabled
@@ -478,6 +478,7 @@ ${depLines.join(`
478
478
  }
479
479
  return await createTaskExtended(followUpDescription, {
480
480
  agentId: leadAgent.id,
481
+ routingReason: "skill",
481
482
  source: "system",
482
483
  taskType: "follow-up",
483
484
  parentTaskId: task.id,
@@ -555,6 +556,7 @@ async function createResumeFollowUp(args) {
555
556
  } : sourceAffinity;
556
557
  const created = await createTaskExtended(followUpDescription, {
557
558
  agentId: preferredAgentId,
559
+ routingReason: preferredAgentId === undefined ? undefined : preferredAgentId === parent.agentId ? "continuity" : "reroute_fault",
558
560
  creatorAgentId: parent.creatorAgentId,
559
561
  source: "system",
560
562
  taskType: "resume",
@@ -608,6 +610,7 @@ async function createRerouteDecisionTask(args) {
608
610
  });
609
611
  const created = await createTaskExtended(decision.text, {
610
612
  agentId: leadAgent.id,
613
+ routingReason: "reroute_fault",
611
614
  creatorAgentId: original.creatorAgentId,
612
615
  source: "system",
613
616
  taskType: "reroute-decision",
@@ -644,6 +647,7 @@ async function createPoolStarvationDecisionTask(args) {
644
647
  });
645
648
  const created = await createTaskExtended(decision.text, {
646
649
  agentId: leadAgent.id,
650
+ routingReason: "overflow",
647
651
  creatorAgentId: original.creatorAgentId,
648
652
  source: "system",
649
653
  taskType: "reroute-decision",
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  SYSTEM_COLUMN_KINDS,
3
3
  listAppRecords
4
- } from "./cli-de14znh8.js";
4
+ } from "./cli-19f354qr.js";
5
5
  import {
6
6
  getScriptApiTypes,
7
7
  getScriptMcpTypes,
8
8
  require_typescript
9
- } from "./cli-3tgwnf43.js";
9
+ } from "./cli-aae6hz6a.js";
10
10
  import {
11
11
  deleteSwarmConfigByKey,
12
12
  getAgentById,
@@ -15,11 +15,11 @@ import {
15
15
  getSwarmConfigs,
16
16
  init_db,
17
17
  upsertSwarmConfig
18
- } from "./cli-ftht3zzj.js";
18
+ } from "./cli-yab68w40.js";
19
19
  import {
20
20
  init_secret_scrubber,
21
21
  scrubSecrets
22
- } from "./cli-xqcq9y5e.js";
22
+ } from "./cli-r2ap2czm.js";
23
23
  import {
24
24
  __require,
25
25
  __toESM
@@ -629,6 +629,36 @@ export type ScriptScope = "agent" | "global";
629
629
  export type ScriptFsMode = "none" | "workspace-rw";
630
630
  export type ScriptApiRawOptions = { raw: true };
631
631
  export type ScriptApiDefaultOptions = { raw?: false };
632
+ export type RoutingReason = "skill" | "continuity" | "overflow" | "human_pinned" | "reroute_fault";
633
+ export type TaskSendArgs = Record<string, unknown> & {
634
+ task: string;
635
+ routingNote?: string;
636
+ } & (
637
+ | { agentId: string; routingReason: RoutingReason }
638
+ | { agentId?: never; routingReason?: never }
639
+ );
640
+ export type AgentTaskStepConfig = {
641
+ template?: string;
642
+ task?: string;
643
+ agentId?: string;
644
+ routingReason?: RoutingReason;
645
+ routingNote?: string;
646
+ tags?: string[];
647
+ priority?: number;
648
+ offerMode?: boolean;
649
+ dir?: string;
650
+ vcsRepo?: string;
651
+ model?: string;
652
+ parentTaskId?: string;
653
+ requestedByUserId?: string;
654
+ outputSchema?: Record<string, unknown>;
655
+ /** Wait for the dispatched task to reach a terminal status before resolving. Default: true. */
656
+ waitForCompletion?: boolean;
657
+ /** Max ms to wait for a terminal status before throwing. Default: 2h. Only used when waitForCompletion is true. */
658
+ timeoutMs?: number;
659
+ /** Throw when the task ends failed/cancelled/superseded (default), or resolve with {taskId,status,error} when false. */
660
+ failOnTaskFailure?: boolean;
661
+ };
632
662
 
633
663
  export interface ScriptApiRawResult {
634
664
  ok: boolean;
@@ -732,7 +762,7 @@ export interface SwarmSdk {
732
762
  task_list(args?: Record<string, unknown>): Promise<unknown>;
733
763
  task_get(args: { taskId: string }): Promise<unknown>;
734
764
  task_storeProgress(args: Record<string, unknown>): Promise<unknown>;
735
- task_defer(args: { taskId: string; delayMs?: number; runAt?: string; summary: string; note: string; checks?: string[] }): Promise<unknown>;
765
+ task_defer(args: { taskId: string; delayMs?: number; runAt?: string; wakeOn?: { event: "task.completed" | "task.failed" | "settled"; taskId: string }; summary: string; note: string; checks?: string[] }): Promise<unknown>;
736
766
  task_poll(args?: Record<string, unknown>): Promise<unknown>;
737
767
  // --- kv ---
738
768
  kv_get<T = unknown>(args: { key: string; namespace?: string }): Promise<KvSdkResponse<KvEntry<T>>>;
@@ -813,7 +843,7 @@ export interface SwarmSdk {
813
843
  inject_learning(args: { content: string; name?: string; scope?: "agent" | "swarm"; source?: string; tags?: string[] }): Promise<unknown>;
814
844
 
815
845
  // --- write: tasks ---
816
- task_send(args: Record<string, unknown>): Promise<unknown>;
846
+ task_send(args: TaskSendArgs): Promise<unknown>;
817
847
  task_cancel(args: { taskId: string }): Promise<unknown>;
818
848
  task_steer(args: { taskId: string; message: string; mode?: "steer" | "queue"; onUnsupported?: "degrade" | "fail" }): Promise<unknown>;
819
849
  task_action(args: Record<string, unknown>): Promise<unknown>;
@@ -968,26 +998,7 @@ export interface ScriptWorkflowSteps {
968
998
  ): Promise<unknown>;
969
999
  agentTask(
970
1000
  label: string,
971
- config: {
972
- template?: string;
973
- task?: string;
974
- agentId?: string;
975
- tags?: string[];
976
- priority?: number;
977
- offerMode?: boolean;
978
- dir?: string;
979
- vcsRepo?: string;
980
- model?: string;
981
- parentTaskId?: string;
982
- requestedByUserId?: string;
983
- outputSchema?: Record<string, unknown>;
984
- /** Wait for the dispatched task to reach a terminal status before resolving. Default: true. */
985
- waitForCompletion?: boolean;
986
- /** Max ms to wait for a terminal status before throwing. Default: 2h. Only used when waitForCompletion is true. */
987
- timeoutMs?: number;
988
- /** Throw when the task ends failed/cancelled/superseded (default), or resolve with {taskId,status,error} when false. */
989
- failOnTaskFailure?: boolean;
990
- },
1001
+ config: AgentTaskStepConfig,
991
1002
  ): Promise<unknown>;
992
1003
  swarmScript(
993
1004
  label: string,