@desplega.ai/agent-swarm 1.148.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 (179) hide show
  1. package/README.md +2 -1
  2. package/dist/{acp-adapter-grez7xhd.js → acp-adapter-4jncb126.js} +12 -5
  3. package/dist/{actions-kweznh5a.js → actions-31vp3ae7.js} +10 -9
  4. package/dist/{app-5fvvjv9m.js → app-1hh67x8w.js} +6 -6
  5. package/dist/{assistant-40m4w50s.js → assistant-z66dmz6p.js} +13 -11
  6. package/dist/{boot-reembed-cn357y5n.js → boot-reembed-fqzxxzjh.js} +7 -7
  7. package/dist/{boot-reembed-9rxmb26n.js → boot-reembed-wxa8ya0s.js} +8 -8
  8. package/dist/{boot-scrub-logs-5tpp0x3y.js → boot-scrub-logs-jnyndh79.js} +5 -5
  9. package/dist/{claude-adapter-9pz5q2pb.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-v8w0s7qm.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-tebsjpk7.js → cli-19f354qr.js} +2 -2
  15. package/dist/{cli-kzvhgvk3.js → cli-2qts1hys.js} +3 -3
  16. package/dist/{cli-kpv03zhj.js → cli-3apbzgyk.js} +27 -15
  17. package/dist/{cli-5khqvvnq.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-f8j56xv2.js → cli-6pqcb4q0.js} +53 -13
  22. package/dist/{cli-m1p5cysp.js → cli-7smrsr25.js} +3 -3
  23. package/dist/{cli-0amc6myn.js → cli-9fy6nk6g.js} +1 -1
  24. package/dist/{cli-dcem3pr1.js → cli-9hspd3dp.js} +2 -2
  25. package/dist/{cli-0er5m69z.js → cli-aae6hz6a.js} +4 -4
  26. package/dist/{cli-brxyat7h.js → cli-cr12paw2.js} +5 -5
  27. package/dist/{cli-dk3me3qs.js → cli-d8ftsp62.js} +8 -8
  28. package/dist/{cli-v3e51x7w.js → cli-e95cx1eb.js} +3 -3
  29. package/dist/{cli-ztn0ga15.js → cli-gjhjfeeg.js} +1 -1
  30. package/dist/{cli-xqcpg1st.js → cli-gv88e1vf.js} +1 -1
  31. package/dist/{cli-rvqz34y5.js → cli-jecc01cb.js} +1 -1
  32. package/dist/{cli-hzhhrt7b.js → cli-k0cr4kat.js} +1 -1
  33. package/dist/{cli-hz8xhefy.js → cli-kgz4np97.js} +4 -4
  34. package/dist/{cli-anedxf1w.js → cli-kjwt6hdf.js} +1 -1
  35. package/dist/{cli-3n7cbfjn.js → cli-mnmsfd1w.js} +6 -2
  36. package/dist/{cli-n9grk3yd.js → cli-n3dz2942.js} +37 -26
  37. package/dist/{cli-cdjezzc7.js → cli-nye12xk5.js} +8 -5
  38. package/dist/{cli-9216xm24.js → cli-phsxnkp6.js} +20 -20
  39. package/dist/{cli-7gn7c2af.js → cli-q50ef8g0.js} +1 -1
  40. package/dist/{cli-qy6h009w.js → cli-qaacms9y.js} +7 -6
  41. package/dist/{cli-xqcq9y5e.js → cli-r2ap2czm.js} +1 -0
  42. package/dist/{cli-hp2est46.js → cli-sd5pv3b1.js} +3 -3
  43. package/dist/{cli-0b6y7kxm.js → cli-xm87hzbw.js} +1 -1
  44. package/dist/{cli-6s2y152y.js → cli-yab68w40.js} +285 -11
  45. package/dist/{cli-p73drk6p.js → cli-yb9qhqam.js} +167 -40
  46. package/dist/{cli-56y3hch2.js → cli-ygweqcn4.js} +133 -22
  47. package/dist/{cli-n2cwscdd.js → cli-ykxrnd1q.js} +2 -2
  48. package/dist/{cli-m9sxbkhm.js → cli-zvz62chv.js} +3 -3
  49. package/dist/cli.js +14 -14
  50. package/dist/{codex-adapter-ehhj2qwc.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-5hne566k.js → codex-session-runner-gjgxyp5j.js} +4 -4
  53. package/dist/{commands-xnvh951h.js → commands-hz3nb95f.js} +5 -5
  54. package/dist/{db-ycr5zfr4.js → db-ggz97zbm.js} +5 -5
  55. package/dist/{e2b-6hb103d8.js → e2b-p04vmtx0.js} +1 -1
  56. package/dist/{handlers-1vt77kgq.js → handlers-nbzdzn9k.js} +14 -11
  57. package/dist/{hook-91ntpmff.js → hook-bks2q1f6.js} +7 -7
  58. package/dist/{hook-qfwjydvn.js → hook-kq9wp0ep.js} +8 -8
  59. package/dist/{http-h6g7bv5b.js → http-hrf77v87.js} +96 -45
  60. package/dist/{index-47ghesbn.js → index-6nsbg88z.js} +443 -144
  61. package/dist/{index-antf9t4p.js → index-8hmeg8j1.js} +14 -14
  62. package/dist/{index-d2mytx95.js → index-cqtebbhb.js} +13 -13
  63. package/dist/{index-0ez2aack.js → index-n28pw1zt.js} +15 -15
  64. package/dist/{keepalive-c4sp7yvd.js → keepalive-dxc12gvg.js} +7 -7
  65. package/dist/{lead-4r7z9e8v.js → lead-yckfn18d.js} +32 -32
  66. package/dist/{maintenance-yqjfdjas.js → maintenance-6kfb2m5e.js} +8 -8
  67. package/dist/{oauth-refresh-sweep-wtqgnh3c.js → oauth-refresh-sweep-1x1ac722.js} +6 -6
  68. package/dist/{onboard-a4krmh46.js → onboard-dcyt1609.js} +4 -3
  69. package/dist/{opencode-adapter-fef1mrn2.js → opencode-adapter-dce4wskd.js} +2 -2
  70. package/dist/{otel-impl-725kq0vp.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-kqxd7w9h.js → pricing-refresh-kaqg567e.js} +7 -7
  73. package/dist/{rbac-roles-gws5xej6.js → rbac-roles-ammq6rd2.js} +5 -5
  74. package/dist/{rbac-roles-t3wygpth.js → rbac-roles-cf97v1vd.js} +6 -6
  75. package/dist/{render-v2-x1wxvn51.js → render-v2-80w603vy.js} +6 -6
  76. package/dist/{seed-pricing-t6y8d0vf.js → seed-pricing-zbrn83xv.js} +6 -6
  77. package/dist/{setup-x50py6xg.js → setup-fe66kczs.js} +2 -2
  78. package/dist/{worker-zsz0qfxk.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 +1 -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/model-control.test.ts +18 -5
  135. package/src/tests/opencode-adapter.test.ts +2 -2
  136. package/src/tests/promote-draft-task-route.test.ts +4 -0
  137. package/src/tests/prompt-template-session.test.ts +13 -4
  138. package/src/tests/rbac-wire-e2e.test.ts +2 -2
  139. package/src/tests/routing-decision-persistence.test.ts +520 -0
  140. package/src/tests/routing-reason-contract.test.ts +89 -0
  141. package/src/tests/routing-reason-inventory.test.ts +55 -0
  142. package/src/tests/schedule-target-type.test.ts +48 -1
  143. package/src/tests/scheduled-task-required-params-migration.test.ts +182 -0
  144. package/src/tests/scheduled-tasks.test.ts +9 -5
  145. package/src/tests/script-connections.test.ts +4 -0
  146. package/src/tests/script-runs-http.test.ts +31 -0
  147. package/src/tests/scripts-typecheck.test.ts +11 -0
  148. package/src/tests/secret-scrubber.test.ts +12 -0
  149. package/src/tests/send-task-output-schema.test.ts +66 -1
  150. package/src/tests/send-task-requested-by.test.ts +1 -0
  151. package/src/tests/send-task-slack-routing-guard.test.ts +2 -0
  152. package/src/tests/store-progress-blocked-waiting-gate.test.ts +151 -0
  153. package/src/tests/swarm-tool-result-gate.test.ts +24 -0
  154. package/src/tests/task-tool-manifest.test.ts +47 -0
  155. package/src/tests/task-tool-preload-mcp.test.ts +125 -0
  156. package/src/tests/task-tools-ctx.test.ts +2 -0
  157. package/src/tests/tool-output-agent-id.test.ts +1 -0
  158. package/src/tests/ui-followup-lead-delegation.test.ts +6 -1
  159. package/src/tests/workflow-agent-task.test.ts +24 -1
  160. package/src/tests/workflow-engine-v2.test.ts +58 -2
  161. package/src/tools/defer-task.ts +73 -21
  162. package/src/tools/send-task.ts +31 -0
  163. package/src/tools/skills/skill-publish.ts +1 -0
  164. package/src/tools/store-progress.ts +43 -0
  165. package/src/tools/templates.ts +2 -1
  166. package/src/tools/utils.ts +33 -2
  167. package/src/types.ts +14 -1
  168. package/src/utils/acp-session-token.ts +14 -4
  169. package/src/utils/secret-scrubber.ts +2 -0
  170. package/src/utils/task-tool-manifest.ts +33 -0
  171. package/src/workflows/engine.ts +4 -1
  172. package/src/workflows/executors/agent-task.ts +7 -1
  173. package/templates/ai-toolbox.manifest.json +6 -1
  174. package/templates/skills/comms/config.json +18 -0
  175. package/templates/skills/comms/content.md +74 -0
  176. package/templates/skills/comms/files/references/ste-rules.md +73 -0
  177. package/templates/skills/comms/files/references/visual-shapes.md +112 -0
  178. package/templates/skills/swarm-scripts/SKILL.md +3 -2
  179. 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-f8j56xv2.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-0er5m69z.js";
22
+ } from "./cli-aae6hz6a.js";
22
23
  import {
23
24
  createTaskWithSiblingAwareness
24
- } from "./cli-7gn7c2af.js";
25
+ } from "./cli-q50ef8g0.js";
25
26
  import {
26
27
  ensure
27
- } from "./cli-dk3me3qs.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-6s2y152y.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-xqcpg1st.js";
7
+ } from "./cli-gv88e1vf.js";
8
8
  import {
9
9
  getKv,
10
10
  init_db,
11
11
  upsertKv
12
- } from "./cli-6s2y152y.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.148.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",
@@ -741,7 +741,7 @@ function McpServer({ port, apiKey, dbPath }) {
741
741
  if (dbPath) {
742
742
  process.env.DATABASE_PATH = dbPath;
743
743
  }
744
- import("./http-h6g7bv5b.js").then(() => {
744
+ import("./http-hrf77v87.js").then(() => {
745
745
  setStatus("running");
746
746
  }).catch((err) => {
747
747
  setStatus("error");
@@ -827,7 +827,7 @@ function WorkerRunner({
827
827
  }) {
828
828
  const { exit } = use_app_default();
829
829
  import_react.useEffect(() => {
830
- import("./worker-zsz0qfxk.js").then(({ runWorker }) => runWorker({
830
+ import("./worker-qmb2d1e2.js").then(({ runWorker }) => runWorker({
831
831
  prompt: prompt || undefined,
832
832
  yolo,
833
833
  systemPrompt: systemPrompt || undefined,
@@ -844,7 +844,7 @@ function WorkerRunner({
844
844
  function LeadRunner({ prompt, yolo, systemPrompt, systemPromptFile, additionalArgs }) {
845
845
  const { exit } = use_app_default();
846
846
  import_react.useEffect(() => {
847
- import("./lead-4r7z9e8v.js").then(({ runLead }) => runLead({
847
+ import("./lead-yckfn18d.js").then(({ runLead }) => runLead({
848
848
  prompt: prompt || undefined,
849
849
  yolo,
850
850
  systemPrompt: systemPrompt || undefined,
@@ -884,8 +884,8 @@ function LazyComponent({
884
884
  }
885
885
  return import_react.createElement(Component, props);
886
886
  }
887
- var loadOnboard = () => import("./onboard-a4krmh46.js").then(({ Onboard }) => Onboard);
888
- var loadConnect = () => import("./setup-x50py6xg.js").then(({ Setup }) => Setup);
887
+ var loadOnboard = () => import("./onboard-dcyt1609.js").then(({ Onboard }) => Onboard);
888
+ var loadConnect = () => import("./setup-fe66kczs.js").then(({ Setup }) => Setup);
889
889
  function UnknownCommand({ command }) {
890
890
  const { exit } = use_app_default();
891
891
  import_react.useEffect(() => {
@@ -1006,14 +1006,14 @@ ${binName} docs \u2014 v${package_default.version}
1006
1006
  }
1007
1007
  process.exit(0);
1008
1008
  } else if (args.command === "hook") {
1009
- const { runHook } = await import("./hook-qfwjydvn.js");
1009
+ const { runHook } = await import("./hook-kq9wp0ep.js");
1010
1010
  await runHook();
1011
1011
  } else if (args.command === "codex-hook") {
1012
- const { handleCodexHook } = await import("./codex-hook-bw8p5nh4.js");
1012
+ const { handleCodexHook } = await import("./codex-hook-hfrt9shr.js");
1013
1013
  await handleCodexHook();
1014
1014
  process.exit(0);
1015
1015
  } else if (args.command === "session-summary-stdin") {
1016
- const { runSessionSummaryFromStdin } = await import("./hook-91ntpmff.js");
1016
+ const { runSessionSummaryFromStdin } = await import("./hook-bks2q1f6.js");
1017
1017
  await runSessionSummaryFromStdin();
1018
1018
  process.exit(process.exitCode ?? 0);
1019
1019
  } else if (args.command === "artifact") {
@@ -1026,7 +1026,7 @@ ${binName} docs \u2014 v${package_default.version}
1026
1026
  });
1027
1027
  } else if (args.command === "x") {
1028
1028
  const xArgs = process.argv.slice(process.argv.indexOf("x") + 1);
1029
- const { runXCommand } = await import("./x-n2phr5vm.js");
1029
+ const { runXCommand } = await import("./x-n3e0v3xa.js");
1030
1030
  await runXCommand(xArgs);
1031
1031
  } else if (args.command === "scripts") {
1032
1032
  const scriptsArgs = process.argv.slice(process.argv.indexOf("scripts") + 1);
@@ -1034,7 +1034,7 @@ ${binName} docs \u2014 v${package_default.version}
1034
1034
  printHelp("scripts");
1035
1035
  process.exit(scriptsArgs[0] === "reembed" || args.showHelp ? 0 : 1);
1036
1036
  }
1037
- const { runScriptsMaintenanceCommand } = await import("./maintenance-yqjfdjas.js");
1037
+ const { runScriptsMaintenanceCommand } = await import("./maintenance-6kfb2m5e.js");
1038
1038
  await runScriptsMaintenanceCommand(scriptsArgs);
1039
1039
  console.log("Scripts re-embedded.");
1040
1040
  } else if (args.command === "rbac") {
@@ -1044,21 +1044,21 @@ ${binName} docs \u2014 v${package_default.version}
1044
1044
  printHelp("rbac");
1045
1045
  process.exit(args.showHelp ? 0 : 1);
1046
1046
  }
1047
- const { runRbacCliCommand } = await import("./rbac-roles-gws5xej6.js");
1047
+ const { runRbacCliCommand } = await import("./rbac-roles-ammq6rd2.js");
1048
1048
  await runRbacCliCommand(rbacArgs);
1049
1049
  } else if (args.command === "codex-login") {
1050
1050
  const { runCodexLogin } = await import("./codex-login-vx7ghkzj.js");
1051
1051
  const codexLoginArgs = process.argv.slice(process.argv.indexOf("codex-login") + 1);
1052
1052
  await runCodexLogin(codexLoginArgs);
1053
1053
  } else if (args.command === "codex-session-runner") {
1054
- const { runCodexSessionRunner } = await import("./codex-session-runner-5hne566k.js");
1054
+ const { runCodexSessionRunner } = await import("./codex-session-runner-gjgxyp5j.js");
1055
1055
  await runCodexSessionRunner();
1056
1056
  } else if (args.command === "claude-managed-setup") {
1057
1057
  const { runClaudeManagedSetup } = await import("./claude-managed-setup-f5pmsyrp.js");
1058
1058
  const setupArgs = process.argv.slice(process.argv.indexOf("claude-managed-setup") + 1);
1059
1059
  await runClaudeManagedSetup(setupArgs);
1060
1060
  } else if (args.command === "e2b") {
1061
- const { runE2BCommand } = await import("./e2b-6hb103d8.js");
1061
+ const { runE2BCommand } = await import("./e2b-p04vmtx0.js");
1062
1062
  const e2bArgs = process.argv.slice(process.argv.indexOf("e2b") + 1);
1063
1063
  await runE2BCommand(e2bArgs);
1064
1064
  } else {
@@ -6,12 +6,12 @@ import {
6
6
  createInProcessCodexSession,
7
7
  resolveCodexAuthMode,
8
8
  resolveCodexRunnerArgv
9
- } from "./cli-v3e51x7w.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-anedxf1w.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-v3e51x7w.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-anedxf1w.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-6s2y152y.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-anedxf1w.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-6s2y152y.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-anedxf1w.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-qy6h009w.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-hz8xhefy.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-n2cwscdd.js";
26
- import"./cli-xqcpg1st.js";
27
- import"./cli-7gn7c2af.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-dk3me3qs.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-6s2y152y.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-anedxf1w.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-anedxf1w.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";