@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
@@ -6,25 +6,26 @@ import {
6
6
  getExecutorRegistry,
7
7
  handleScheduleTrigger,
8
8
  isNeedsSetupFailure,
9
+ notifyAutomationPreflightFailure,
9
10
  preflightAutomation,
10
11
  recordSchedulePreflightFailure,
11
12
  renderAutomationTokens,
12
13
  schedulePreflightInput,
13
14
  startWorkflowExecution
14
- } from "./cli-yz3djrm0.js";
15
+ } from "./cli-6pqcb4q0.js";
15
16
  import {
16
17
  buildScriptCredentialBindings,
17
18
  getScript,
18
19
  getScriptApiConnectionDescriptors,
19
20
  getScriptMcpConnectionDescriptors,
20
21
  runScript
21
- } from "./cli-3tgwnf43.js";
22
+ } from "./cli-aae6hz6a.js";
22
23
  import {
23
24
  createTaskWithSiblingAwareness
24
- } from "./cli-53s590z8.js";
25
+ } from "./cli-q50ef8g0.js";
25
26
  import {
26
27
  ensure
27
- } from "./cli-b5bq9crk.js";
28
+ } from "./cli-d8ftsp62.js";
28
29
  import {
29
30
  getDbClient,
30
31
  getDueScheduledTasks,
@@ -38,7 +39,11 @@ import {
38
39
  scheduleContextKey,
39
40
  telemetry,
40
41
  updateScheduledTask
41
- } from "./cli-ftht3zzj.js";
42
+ } from "./cli-yab68w40.js";
43
+ import {
44
+ init_event_bus,
45
+ workflowEventBus
46
+ } from "./cli-f7kvq46p.js";
42
47
  import {
43
48
  __toESM
44
49
  } from "./cli-bc05qbss.js";
@@ -46,31 +51,27 @@ import {
46
51
  // src/scheduler/scheduler.ts
47
52
  var import_cron_parser = __toESM(require_dist(), 1);
48
53
  init_db();
49
- init_context_key();
50
54
  init_telemetry();
51
- var schedulerInterval = null;
52
- var isProcessing = false;
53
- var executorRegistry = null;
54
- function resolveExecutorRegistry() {
55
- if (executorRegistry)
56
- return executorRegistry;
57
- try {
58
- return getExecutorRegistry();
59
- } catch {
60
- return null;
61
- }
62
- }
55
+
56
+ // src/scheduler/deferred-task-waits.ts
57
+ init_db();
58
+ init_event_bus();
59
+
60
+ // src/scheduler/schedule-task.ts
61
+ init_db();
62
+ init_context_key();
63
63
  async function createStandaloneScheduleTask(schedule, extraTags = []) {
64
64
  if (!schedule.taskTemplate) {
65
65
  throw new Error(`Schedule "${schedule.name}" has no taskTemplate (targetType=agent-task)`);
66
66
  }
67
- return await createTaskWithSiblingAwareness(schedule.taskTemplate, {
67
+ const task = await createTaskWithSiblingAwareness(schedule.taskTemplate, {
68
68
  key: schedule.key,
69
69
  creatorAgentId: schedule.createdByAgentId,
70
70
  taskType: schedule.taskType,
71
71
  tags: [...schedule.tags, "scheduled", `schedule:${schedule.name}`, ...extraTags],
72
72
  priority: schedule.priority,
73
73
  agentId: schedule.targetAgentId,
74
+ routingReason: schedule.targetAgentId ? "human_pinned" : undefined,
74
75
  model: schedule.model,
75
76
  modelTier: schedule.modelTier,
76
77
  scheduleId: schedule.id,
@@ -79,6 +80,109 @@ async function createStandaloneScheduleTask(schedule, extraTags = []) {
79
80
  contextKey: scheduleContextKey({ scheduleId: schedule.id }),
80
81
  parentTaskId: schedule.parentTaskId
81
82
  });
83
+ if (schedule.taskType === "deferred" && schedule.parentTaskId) {
84
+ await getDbClient().run("UPDATE deferred_task_waits SET taskId = ?, updated_at = ? WHERE status = 'pending' AND taskId = ?", [task.id, new Date().toISOString(), schedule.parentTaskId]);
85
+ }
86
+ return task;
87
+ }
88
+
89
+ // src/scheduler/deferred-task-waits.ts
90
+ async function dispatchDeferredTaskWait(scheduleId, reason, extraTags = []) {
91
+ const client = getDbClient();
92
+ if (!await client.get("SELECT * FROM deferred_task_waits WHERE scheduleId = ?", [
93
+ scheduleId
94
+ ]))
95
+ return;
96
+ return client.transaction(async () => {
97
+ const wait = await client.get("SELECT * FROM deferred_task_waits WHERE scheduleId = ?", [scheduleId]);
98
+ if (!wait || wait.status !== "pending")
99
+ return {};
100
+ if (reason !== "ceiling" && wait.eventName !== "settled" && wait.eventName !== reason)
101
+ return {};
102
+ let schedule = await getScheduledTaskById(scheduleId);
103
+ if (!schedule?.enabled)
104
+ return {};
105
+ const now = new Date().toISOString();
106
+ const claimed = await client.run("UPDATE deferred_task_waits SET status = 'fired', firedBy = ?, resolvedAt = ?, updated_at = ? WHERE scheduleId = ? AND status = 'pending'", [reason, now, now, scheduleId]);
107
+ if (!claimed.changes)
108
+ return {};
109
+ if (schedule.createdBy && !await getUserById(schedule.createdBy)) {
110
+ schedule = { ...schedule, createdBy: undefined };
111
+ }
112
+ if (!schedule.taskTemplate)
113
+ throw new Error(`Schedule "${schedule.name}" has no taskTemplate`);
114
+ const cause = reason === "ceiling" ? "ceiling expired" : `${reason} for task ${wait.taskId}`;
115
+ const task = await createStandaloneScheduleTask({
116
+ ...schedule,
117
+ taskTemplate: `${schedule.taskTemplate}
118
+
119
+ Wake-up cause: ${cause}.`
120
+ }, extraTags);
121
+ await client.run("UPDATE deferred_task_waits SET childTaskId = ? WHERE scheduleId = ?", [
122
+ task.id,
123
+ scheduleId
124
+ ]);
125
+ await updateScheduledTask(scheduleId, {
126
+ enabled: false,
127
+ nextRunAt: null,
128
+ lastRunAt: now,
129
+ lastUpdatedAt: now,
130
+ consecutiveErrors: 0,
131
+ lastErrorAt: null,
132
+ lastErrorMessage: null
133
+ });
134
+ return { task };
135
+ });
136
+ }
137
+ async function reconcileDeferredTaskWaits(taskId) {
138
+ const rows = await getDbClient().query(`SELECT w.*, t.status AS taskStatus FROM deferred_task_waits w
139
+ JOIN agent_tasks t ON t.id = w.taskId
140
+ JOIN scheduled_tasks s ON s.id = w.scheduleId
141
+ WHERE w.status = 'pending' AND s.enabled = 1 AND t.status IN ('completed', 'failed')
142
+ AND NOT EXISTS (
143
+ SELECT 1 FROM scheduled_tasks d
144
+ WHERE d.parentTaskId = t.id AND d.taskType = 'deferred' AND d.enabled = 1
145
+ )
146
+ AND (w.eventName = 'settled' OR w.eventName = 'task.' || t.status)
147
+ ${taskId ? "AND w.taskId = ?" : ""}`, taskId ? [taskId] : []);
148
+ for (const row of rows) {
149
+ try {
150
+ await dispatchDeferredTaskWait(row.scheduleId, `task.${row.taskStatus}`);
151
+ } catch (err) {
152
+ console.error(`[Scheduler] Deferred task wake failed for ${row.scheduleId}:`, err);
153
+ }
154
+ }
155
+ }
156
+ function onTaskTerminal(payload) {
157
+ if (!payload || typeof payload !== "object" || !("taskId" in payload) || typeof payload.taskId !== "string")
158
+ return;
159
+ reconcileDeferredTaskWaits(payload.taskId).catch((err) => {
160
+ console.error("[Scheduler] Deferred task event wake failed:", err);
161
+ });
162
+ }
163
+ async function initDeferredTaskWaits() {
164
+ stopDeferredTaskWaits();
165
+ workflowEventBus.on("task.completed", onTaskTerminal);
166
+ workflowEventBus.on("task.failed", onTaskTerminal);
167
+ await reconcileDeferredTaskWaits();
168
+ }
169
+ function stopDeferredTaskWaits() {
170
+ workflowEventBus.off("task.completed", onTaskTerminal);
171
+ workflowEventBus.off("task.failed", onTaskTerminal);
172
+ }
173
+
174
+ // src/scheduler/scheduler.ts
175
+ var schedulerInterval = null;
176
+ var isProcessing = false;
177
+ var executorRegistry = null;
178
+ function resolveExecutorRegistry() {
179
+ if (executorRegistry)
180
+ return executorRegistry;
181
+ try {
182
+ return getExecutorRegistry();
183
+ } catch {
184
+ return null;
185
+ }
82
186
  }
83
187
  async function executeScheduleScript(schedule) {
84
188
  if (!schedule.scriptName) {
@@ -121,9 +225,14 @@ function renderScheduledTaskParams(schedule) {
121
225
  return renderAutomationTokens(schedule, schedule.params ?? {});
122
226
  }
123
227
  async function dispatchScheduleTarget(schedule, extraTags = []) {
228
+ const deferred = await dispatchDeferredTaskWait(schedule.id, "ceiling", extraTags);
229
+ if (deferred)
230
+ return { triggeredWorkflows: false, ...deferred };
124
231
  const preflight = preflightAutomation(schedulePreflightInput(schedule), await getAutomationSetupStates());
125
232
  if (preflight.state === "needs_setup") {
126
- await recordSchedulePreflightFailure(schedule.id, preflight.failureReason);
233
+ const recorded = await recordSchedulePreflightFailure(schedule.id, preflight.failureReason);
234
+ if (recorded)
235
+ await notifyAutomationPreflightFailure(preflight);
127
236
  throw new AutomationNeedsSetupError(preflight.failureReason);
128
237
  }
129
238
  schedule = renderScheduledTaskParams(schedule);
@@ -376,7 +485,7 @@ function startScheduler(registry, intervalMs = 1e4, opts) {
376
485
  }
377
486
  executorRegistry = registry;
378
487
  console.log(`[Scheduler] Starting with ${intervalMs}ms polling interval`);
379
- recoverMissedSchedules().then(() => processSchedules());
488
+ initDeferredTaskWaits().then(() => recoverMissedSchedules()).then(() => processSchedules()).catch((err) => console.error("[Scheduler] Recovery failed:", err));
380
489
  schedulerInterval = setInterval(async () => {
381
490
  await processSchedules();
382
491
  }, intervalMs);
@@ -402,6 +511,7 @@ async function processSchedules() {
402
511
  return;
403
512
  isProcessing = true;
404
513
  try {
514
+ await reconcileDeferredTaskWaits();
405
515
  const dueSchedules = await getDueScheduledTasks();
406
516
  for (const schedule of dueSchedules) {
407
517
  try {
@@ -415,6 +525,7 @@ async function processSchedules() {
415
525
  }
416
526
  }
417
527
  function stopScheduler() {
528
+ stopDeferredTaskWaits();
418
529
  if (schedulerInterval) {
419
530
  clearInterval(schedulerInterval);
420
531
  schedulerInterval = null;
@@ -448,4 +559,4 @@ async function runScheduleNow(scheduleId) {
448
559
  console.log(`[Scheduler] Manually executed schedule "${schedule.name}"`);
449
560
  }
450
561
  }
451
- export { dispatchScheduleTarget, calculateNextRun, startScheduler, stopScheduler, runScheduleNow };
562
+ export { reconcileDeferredTaskWaits, dispatchScheduleTarget, calculateNextRun, startScheduler, stopScheduler, runScheduleNow };
@@ -4,12 +4,12 @@ import {
4
4
  linkIdentity,
5
5
  recordUnmappedIdentity,
6
6
  resolveIdentity
7
- } from "./cli-p1d5b073.js";
7
+ } from "./cli-gv88e1vf.js";
8
8
  import {
9
9
  getKv,
10
10
  init_db,
11
11
  upsertKv
12
- } from "./cli-ftht3zzj.js";
12
+ } from "./cli-yab68w40.js";
13
13
 
14
14
  // src/slack/enrich.ts
15
15
  init_db();
@@ -6,13 +6,13 @@ import {
6
6
  IDENTITY_FIELD_BUDGETS,
7
7
  init_identity_field_budget,
8
8
  init_templates
9
- } from "./cli-y6b6fb76.js";
9
+ } from "./cli-08b07b4r.js";
10
10
  import {
11
11
  init_resolver,
12
12
  init_steering_enabled,
13
13
  isSteeringEnabled,
14
14
  resolveTemplateAsync
15
- } from "./cli-kpv03zhj.js";
15
+ } from "./cli-3apbzgyk.js";
16
16
  import {
17
17
  MAX_PROFILE_FILE_LENGTH,
18
18
  init_constants
@@ -20,7 +20,7 @@ import {
20
20
  import {
21
21
  init_secret_scrubber,
22
22
  scrubSecrets
23
- } from "./cli-xqcq9y5e.js";
23
+ } from "./cli-r2ap2czm.js";
24
24
  import {
25
25
  __esm
26
26
  } from "./cli-bc05qbss.js";
package/dist/cli.js CHANGED
@@ -65,7 +65,7 @@ var import_react = __toESM(require_react(), 1);
65
65
  // package.json
66
66
  var package_default = {
67
67
  name: "@desplega.ai/agent-swarm",
68
- version: "1.147.0",
68
+ version: "1.149.0",
69
69
  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.",
70
70
  keywords: [
71
71
  "agent-swarm.dev",
@@ -176,6 +176,8 @@ var package_default = {
176
176
  "prepare-release": "bun scripts/prepare-release.ts",
177
177
  "refresh:vendored-openapi": "bun scripts/refresh-vendored-openapi.ts",
178
178
  "sync-chart-version": "bun scripts/sync-chart-version.ts",
179
+ "sync-plugin-versions": "bun scripts/sync-plugin-versions.ts",
180
+ "check:plugin-versions": "bun scripts/sync-plugin-versions.ts --check",
179
181
  "bump:agent-fs": "bun scripts/bump-agent-fs.ts",
180
182
  "check-chart-version": "bun scripts/sync-chart-version.ts --check-if-package-version-changed",
181
183
  cli: "bun src/cli.tsx",
@@ -739,7 +741,7 @@ function McpServer({ port, apiKey, dbPath }) {
739
741
  if (dbPath) {
740
742
  process.env.DATABASE_PATH = dbPath;
741
743
  }
742
- import("./http-y06z517d.js").then(() => {
744
+ import("./http-hrf77v87.js").then(() => {
743
745
  setStatus("running");
744
746
  }).catch((err) => {
745
747
  setStatus("error");
@@ -825,7 +827,7 @@ function WorkerRunner({
825
827
  }) {
826
828
  const { exit } = use_app_default();
827
829
  import_react.useEffect(() => {
828
- import("./worker-kznxp4qm.js").then(({ runWorker }) => runWorker({
830
+ import("./worker-qmb2d1e2.js").then(({ runWorker }) => runWorker({
829
831
  prompt: prompt || undefined,
830
832
  yolo,
831
833
  systemPrompt: systemPrompt || undefined,
@@ -842,7 +844,7 @@ function WorkerRunner({
842
844
  function LeadRunner({ prompt, yolo, systemPrompt, systemPromptFile, additionalArgs }) {
843
845
  const { exit } = use_app_default();
844
846
  import_react.useEffect(() => {
845
- import("./lead-75bjqa9d.js").then(({ runLead }) => runLead({
847
+ import("./lead-yckfn18d.js").then(({ runLead }) => runLead({
846
848
  prompt: prompt || undefined,
847
849
  yolo,
848
850
  systemPrompt: systemPrompt || undefined,
@@ -882,8 +884,8 @@ function LazyComponent({
882
884
  }
883
885
  return import_react.createElement(Component, props);
884
886
  }
885
- var loadOnboard = () => import("./onboard-bb5net8s.js").then(({ Onboard }) => Onboard);
886
- var loadConnect = () => import("./setup-gnfqnptp.js").then(({ Setup }) => Setup);
887
+ var loadOnboard = () => import("./onboard-dcyt1609.js").then(({ Onboard }) => Onboard);
888
+ var loadConnect = () => import("./setup-fe66kczs.js").then(({ Setup }) => Setup);
887
889
  function UnknownCommand({ command }) {
888
890
  const { exit } = use_app_default();
889
891
  import_react.useEffect(() => {
@@ -1004,14 +1006,14 @@ ${binName} docs \u2014 v${package_default.version}
1004
1006
  }
1005
1007
  process.exit(0);
1006
1008
  } else if (args.command === "hook") {
1007
- const { runHook } = await import("./hook-4nvqj2sb.js");
1009
+ const { runHook } = await import("./hook-kq9wp0ep.js");
1008
1010
  await runHook();
1009
1011
  } else if (args.command === "codex-hook") {
1010
- const { handleCodexHook } = await import("./codex-hook-bw8p5nh4.js");
1012
+ const { handleCodexHook } = await import("./codex-hook-hfrt9shr.js");
1011
1013
  await handleCodexHook();
1012
1014
  process.exit(0);
1013
1015
  } else if (args.command === "session-summary-stdin") {
1014
- const { runSessionSummaryFromStdin } = await import("./hook-hxccs7m5.js");
1016
+ const { runSessionSummaryFromStdin } = await import("./hook-bks2q1f6.js");
1015
1017
  await runSessionSummaryFromStdin();
1016
1018
  process.exit(process.exitCode ?? 0);
1017
1019
  } else if (args.command === "artifact") {
@@ -1024,7 +1026,7 @@ ${binName} docs \u2014 v${package_default.version}
1024
1026
  });
1025
1027
  } else if (args.command === "x") {
1026
1028
  const xArgs = process.argv.slice(process.argv.indexOf("x") + 1);
1027
- const { runXCommand } = await import("./x-n2phr5vm.js");
1029
+ const { runXCommand } = await import("./x-n3e0v3xa.js");
1028
1030
  await runXCommand(xArgs);
1029
1031
  } else if (args.command === "scripts") {
1030
1032
  const scriptsArgs = process.argv.slice(process.argv.indexOf("scripts") + 1);
@@ -1032,7 +1034,7 @@ ${binName} docs \u2014 v${package_default.version}
1032
1034
  printHelp("scripts");
1033
1035
  process.exit(scriptsArgs[0] === "reembed" || args.showHelp ? 0 : 1);
1034
1036
  }
1035
- const { runScriptsMaintenanceCommand } = await import("./maintenance-w4f1zjck.js");
1037
+ const { runScriptsMaintenanceCommand } = await import("./maintenance-6kfb2m5e.js");
1036
1038
  await runScriptsMaintenanceCommand(scriptsArgs);
1037
1039
  console.log("Scripts re-embedded.");
1038
1040
  } else if (args.command === "rbac") {
@@ -1042,21 +1044,21 @@ ${binName} docs \u2014 v${package_default.version}
1042
1044
  printHelp("rbac");
1043
1045
  process.exit(args.showHelp ? 0 : 1);
1044
1046
  }
1045
- const { runRbacCliCommand } = await import("./rbac-roles-z1jrffbt.js");
1047
+ const { runRbacCliCommand } = await import("./rbac-roles-ammq6rd2.js");
1046
1048
  await runRbacCliCommand(rbacArgs);
1047
1049
  } else if (args.command === "codex-login") {
1048
1050
  const { runCodexLogin } = await import("./codex-login-vx7ghkzj.js");
1049
1051
  const codexLoginArgs = process.argv.slice(process.argv.indexOf("codex-login") + 1);
1050
1052
  await runCodexLogin(codexLoginArgs);
1051
1053
  } else if (args.command === "codex-session-runner") {
1052
- const { runCodexSessionRunner } = await import("./codex-session-runner-k981s65v.js");
1054
+ const { runCodexSessionRunner } = await import("./codex-session-runner-gjgxyp5j.js");
1053
1055
  await runCodexSessionRunner();
1054
1056
  } else if (args.command === "claude-managed-setup") {
1055
1057
  const { runClaudeManagedSetup } = await import("./claude-managed-setup-f5pmsyrp.js");
1056
1058
  const setupArgs = process.argv.slice(process.argv.indexOf("claude-managed-setup") + 1);
1057
1059
  await runClaudeManagedSetup(setupArgs);
1058
1060
  } else if (args.command === "e2b") {
1059
- const { runE2BCommand } = await import("./e2b-6hb103d8.js");
1061
+ const { runE2BCommand } = await import("./e2b-p04vmtx0.js");
1060
1062
  const e2bArgs = process.argv.slice(process.argv.indexOf("e2b") + 1);
1061
1063
  await runE2BCommand(e2bArgs);
1062
1064
  } else {
@@ -6,12 +6,12 @@ import {
6
6
  createInProcessCodexSession,
7
7
  resolveCodexAuthMode,
8
8
  resolveCodexRunnerArgv
9
- } from "./cli-4nr988h6.js";
9
+ } from "./cli-e95cx1eb.js";
10
10
  import"./cli-hsxj0yar.js";
11
11
  import"./cli-r94z9p1z.js";
12
12
  import"./cli-2djtr51b.js";
13
13
  import"./cli-b5b30yzk.js";
14
- import"./cli-rvqz34y5.js";
14
+ import"./cli-jecc01cb.js";
15
15
  import"./cli-hp1n6zq3.js";
16
16
  import"./cli-zm7njwzd.js";
17
17
  import"./cli-s25avqg9.js";
@@ -27,8 +27,8 @@ import"./cli-bsakbbkm.js";
27
27
  import"./cli-ej6gbxfb.js";
28
28
  import"./cli-sd0mxa3c.js";
29
29
  import"./cli-w5e1d1vv.js";
30
- import"./cli-w9kb3bk1.js";
31
- import"./cli-xqcq9y5e.js";
30
+ import"./cli-kjwt6hdf.js";
31
+ import"./cli-r2ap2czm.js";
32
32
  import"./cli-knd276ed.js";
33
33
  import"./cli-c4eeb5q2.js";
34
34
  import"./cli-btbzvq95.js";
@@ -1,14 +1,14 @@
1
1
  #!/usr/bin/env bun
2
2
  import {
3
3
  renderSteeringDelivery
4
- } from "./cli-0b6y7kxm.js";
4
+ } from "./cli-xm87hzbw.js";
5
5
  import {
6
6
  getApiKey
7
7
  } from "./cli-f14fvzag.js";
8
8
  import {
9
9
  init_steering_enabled,
10
10
  isSteeringEnabled
11
- } from "./cli-kpv03zhj.js";
11
+ } from "./cli-3apbzgyk.js";
12
12
  import {
13
13
  getMcpBaseUrl,
14
14
  init_constants
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  createInProcessCodexSession
3
- } from "./cli-4nr988h6.js";
3
+ } from "./cli-e95cx1eb.js";
4
4
  import"./cli-hsxj0yar.js";
5
5
  import"./cli-r94z9p1z.js";
6
6
  import"./cli-2djtr51b.js";
7
7
  import"./cli-b5b30yzk.js";
8
- import"./cli-rvqz34y5.js";
8
+ import"./cli-jecc01cb.js";
9
9
  import"./cli-hp1n6zq3.js";
10
10
  import"./cli-zm7njwzd.js";
11
11
  import"./cli-s25avqg9.js";
@@ -21,11 +21,11 @@ import"./cli-bsakbbkm.js";
21
21
  import"./cli-ej6gbxfb.js";
22
22
  import"./cli-sd0mxa3c.js";
23
23
  import"./cli-w5e1d1vv.js";
24
- import"./cli-w9kb3bk1.js";
24
+ import"./cli-kjwt6hdf.js";
25
25
  import {
26
26
  init_secret_scrubber,
27
27
  scrubSecrets
28
- } from "./cli-xqcq9y5e.js";
28
+ } from "./cli-r2ap2czm.js";
29
29
  import"./cli-knd276ed.js";
30
30
  import"./cli-c4eeb5q2.js";
31
31
  import"./cli-btbzvq95.js";
@@ -2,9 +2,9 @@ import {
2
2
  getAllAgents,
3
3
  getAllTasks,
4
4
  init_db
5
- } from "./cli-ftht3zzj.js";
6
- import"./cli-y6b6fb76.js";
7
- import"./cli-kpv03zhj.js";
5
+ } from "./cli-yab68w40.js";
6
+ import"./cli-08b07b4r.js";
7
+ import"./cli-3apbzgyk.js";
8
8
  import"./cli-e29gmdmw.js";
9
9
  import"./cli-c2mk1kgf.js";
10
10
  import {
@@ -13,8 +13,8 @@ import {
13
13
  } from "./cli-ej6gbxfb.js";
14
14
  import"./cli-sd0mxa3c.js";
15
15
  import"./cli-w5e1d1vv.js";
16
- import"./cli-w9kb3bk1.js";
17
- import"./cli-xqcq9y5e.js";
16
+ import"./cli-kjwt6hdf.js";
17
+ import"./cli-r2ap2czm.js";
18
18
  import"./cli-zf8jjwex.js";
19
19
  import"./cli-bc05qbss.js";
20
20
 
@@ -455,21 +455,21 @@ import {
455
455
  upsertSkillFiles,
456
456
  upsertSwarmConfig,
457
457
  withFavoriteFlags
458
- } from "./cli-ftht3zzj.js";
458
+ } from "./cli-yab68w40.js";
459
459
  import {
460
460
  generateDefaultClaudeMd,
461
461
  generateDefaultIdentityMd,
462
462
  generateDefaultSoulMd,
463
463
  generateDefaultToolsMd
464
- } from "./cli-y6b6fb76.js";
465
- import"./cli-kpv03zhj.js";
464
+ } from "./cli-08b07b4r.js";
465
+ import"./cli-3apbzgyk.js";
466
466
  import"./cli-e29gmdmw.js";
467
467
  import"./cli-c2mk1kgf.js";
468
468
  import"./cli-ej6gbxfb.js";
469
469
  import"./cli-sd0mxa3c.js";
470
470
  import"./cli-w5e1d1vv.js";
471
- import"./cli-w9kb3bk1.js";
472
- import"./cli-xqcq9y5e.js";
471
+ import"./cli-kjwt6hdf.js";
472
+ import"./cli-r2ap2czm.js";
473
473
  import"./cli-zf8jjwex.js";
474
474
  import"./cli-bc05qbss.js";
475
475
  init_db();
@@ -12,7 +12,7 @@ import {
12
12
  init_secret_scrubber,
13
13
  isSensitiveKey,
14
14
  scrubSecrets
15
- } from "./cli-xqcq9y5e.js";
15
+ } from "./cli-r2ap2czm.js";
16
16
  import {
17
17
  Box_default,
18
18
  Select,
@@ -5,7 +5,7 @@ import {
5
5
  instantFlush,
6
6
  requestSlackThreadSteering,
7
7
  wasEventSeen
8
- } from "./cli-f146mn5s.js";
8
+ } from "./cli-qaacms9y.js";
9
9
  import {
10
10
  bufferedFileFailures,
11
11
  buildEffectiveText,
@@ -16,22 +16,22 @@ import {
16
16
  hasOtherUserMention,
17
17
  notifySlackFileFailures,
18
18
  routeMessage
19
- } from "./cli-mmemxxdc.js";
19
+ } from "./cli-kgz4np97.js";
20
20
  import"./cli-jsp14b6c.js";
21
21
  import {
22
22
  enrichSlackUserEmail,
23
23
  resolveSlackUserId,
24
24
  rewriteSlackMentions
25
- } from "./cli-dttph1bw.js";
26
- import"./cli-p1d5b073.js";
27
- import"./cli-53s590z8.js";
25
+ } from "./cli-ykxrnd1q.js";
26
+ import"./cli-gv88e1vf.js";
27
+ import"./cli-q50ef8g0.js";
28
28
  import {
29
29
  ackSlackMessage,
30
30
  buildTreeBlocks,
31
31
  ensureSlackThreadTree,
32
32
  isSlackRenderV2Enabled,
33
33
  registerTreeMessage
34
- } from "./cli-b5bq9crk.js";
34
+ } from "./cli-d8ftsp62.js";
35
35
  import"./cli-q51yprfq.js";
36
36
  import"./cli-9d8ntetj.js";
37
37
  import"./cli-yatxqynm.js";
@@ -45,12 +45,12 @@ import {
45
45
  init_db,
46
46
  reactionName,
47
47
  slackContextKey
48
- } from "./cli-ftht3zzj.js";
49
- import"./cli-y6b6fb76.js";
48
+ } from "./cli-yab68w40.js";
49
+ import"./cli-08b07b4r.js";
50
50
  import {
51
51
  init_resolver,
52
52
  resolveTemplate
53
- } from "./cli-kpv03zhj.js";
53
+ } from "./cli-3apbzgyk.js";
54
54
  import"./cli-e29gmdmw.js";
55
55
  import"./cli-c2mk1kgf.js";
56
56
  import {
@@ -59,8 +59,8 @@ import {
59
59
  } from "./cli-ej6gbxfb.js";
60
60
  import"./cli-sd0mxa3c.js";
61
61
  import"./cli-w5e1d1vv.js";
62
- import"./cli-w9kb3bk1.js";
63
- import"./cli-xqcq9y5e.js";
62
+ import"./cli-kjwt6hdf.js";
63
+ import"./cli-r2ap2czm.js";
64
64
  import"./cli-pzxba7gw.js";
65
65
  import {
66
66
  init_event_bus,
@@ -387,6 +387,7 @@ ${taskDescription2}`;
387
387
  const lead = await getLeadAgent();
388
388
  const { task, unattached: unattached2 } = await createSlackTaskWithFiles(fullTaskDescription2, {
389
389
  agentId: lead?.id,
390
+ routingReason: lead ? "skill" : undefined,
390
391
  source: "slack",
391
392
  slackChannelId: msg.channel,
392
393
  slackThreadTs: threadTs2,
@@ -474,6 +475,7 @@ ${taskDescription}`;
474
475
  }
475
476
  const created2 = await createSlackTaskWithFiles(fullTaskDescription, {
476
477
  agentId: agent.id,
478
+ routingReason: "human_pinned",
477
479
  source: "slack",
478
480
  slackChannelId: msg.channel,
479
481
  slackThreadTs: threadTs,
@@ -491,6 +493,7 @@ ${taskDescription}`;
491
493
  }
492
494
  const created = await createSlackTaskWithFiles(fullTaskDescription, {
493
495
  agentId: agent.id,
496
+ routingReason: "human_pinned",
494
497
  source: "slack",
495
498
  slackChannelId: msg.channel,
496
499
  slackThreadTs: threadTs,
@@ -2,10 +2,10 @@
2
2
  import {
3
3
  materializeClaudeMd,
4
4
  stopClaudeMd
5
- } from "./cli-d8brzxjb.js";
5
+ } from "./cli-4wtq5jjv.js";
6
6
  import {
7
7
  summarizeSession
8
- } from "./cli-rvqz34y5.js";
8
+ } from "./cli-jecc01cb.js";
9
9
  import {
10
10
  checkToolLoop,
11
11
  clearToolHistory
@@ -30,11 +30,11 @@ import {
30
30
  init_profile_sync,
31
31
  readIdentityBaselines,
32
32
  warnProfileFileTooLarge
33
- } from "./cli-m9sxbkhm.js";
33
+ } from "./cli-zvz62chv.js";
34
34
  import"./cli-bsakbbkm.js";
35
35
  import"./cli-9d8ntetj.js";
36
- import"./cli-y6b6fb76.js";
37
- import"./cli-kpv03zhj.js";
36
+ import"./cli-08b07b4r.js";
37
+ import"./cli-3apbzgyk.js";
38
38
  import {
39
39
  MAX_PROFILE_FILE_LENGTH,
40
40
  getMcpBaseUrl,
@@ -46,11 +46,11 @@ import"./cli-w5e1d1vv.js";
46
46
  import {
47
47
  init_package,
48
48
  package_default
49
- } from "./cli-w9kb3bk1.js";
49
+ } from "./cli-kjwt6hdf.js";
50
50
  import {
51
51
  init_secret_scrubber,
52
52
  scrubSecrets
53
- } from "./cli-xqcq9y5e.js";
53
+ } from "./cli-r2ap2czm.js";
54
54
  import"./cli-c4eeb5q2.js";
55
55
  import"./cli-btbzvq95.js";
56
56
  import"./cli-1m2e086m.js";