@desplega.ai/agent-swarm 1.155.1 → 1.157.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 (112) hide show
  1. package/dist/{acp-adapter-fqsedz9y.js → acp-adapter-qhqrk4q0.js} +1 -1
  2. package/dist/{actions-by3qdvvk.js → actions-9rrg0zxm.js} +19 -18
  3. package/dist/{app-99hz4k80.js → app-enysy1zd.js} +7 -6
  4. package/dist/{assistant-18hve126.js → assistant-zegamy48.js} +20 -19
  5. package/dist/{boot-reembed-zm7dmkqt.js → boot-reembed-r6shx5qx.js} +9 -8
  6. package/dist/{boot-reembed-gv4gkq87.js → boot-reembed-zfxb937k.js} +8 -7
  7. package/dist/{boot-scrub-logs-f42mskp2.js → boot-scrub-logs-k5y0se6r.js} +6 -5
  8. package/dist/{claude-adapter-thxafssy.js → claude-adapter-5yc7hxwv.js} +11 -10
  9. package/dist/{claude-managed-setup-7da6qnmx.js → claude-managed-setup-60g8aazx.js} +2 -1
  10. package/dist/{claude-sdk-session-ww42x2t2.js → claude-sdk-session-j4ywn3xf.js} +11 -10
  11. package/dist/{cli-nw6z69ye.js → cli-005pze6s.js} +1 -1
  12. package/dist/{cli-pbsk349d.js → cli-01vfmq8c.js} +108 -31
  13. package/dist/{cli-6265kmdz.js → cli-3gmcwfyx.js} +1 -1
  14. package/dist/{cli-gwha4avb.js → cli-5j7bm4tb.js} +6 -6
  15. package/dist/{cli-rqbvtc1v.js → cli-6jjzxv3b.js} +2 -2
  16. package/dist/{cli-p2hxs01b.js → cli-74h6f2bp.js} +2 -2
  17. package/dist/{cli-vnyd306v.js → cli-9n76jszt.js} +1 -1
  18. package/dist/{cli-h4jrts5n.js → cli-9p33cz9h.js} +139 -57
  19. package/dist/{cli-60cwjbsn.js → cli-awwphhcs.js} +175 -24
  20. package/dist/{cli-kz0xtztz.js → cli-c41wjx0r.js} +4 -4
  21. package/dist/cli-cqt19wg6.js +92 -0
  22. package/dist/{cli-1msp3k1h.js → cli-cw9zck8j.js} +1 -1
  23. package/dist/{cli-82w25rb4.js → cli-f3va018d.js} +1 -1
  24. package/dist/{cli-dnpg5yrw.js → cli-ggm92wcn.js} +4 -4
  25. package/dist/{cli-fb79s4p1.js → cli-h0wdadsx.js} +2 -0
  26. package/dist/{cli-jmbz691m.js → cli-jytrw2na.js} +5 -5
  27. package/dist/{cli-cbm9ftfn.js → cli-n6zq3kbd.js} +1 -1
  28. package/dist/{cli-1fypa20m.js → cli-nbp6m6gp.js} +2 -2
  29. package/dist/{cli-2gjxfg9n.js → cli-r9ee9c4w.js} +21 -20
  30. package/dist/{cli-k85m894w.js → cli-s98skd5r.js} +2 -2
  31. package/dist/{cli-gy9ctpmm.js → cli-sgyqyyxe.js} +2 -2
  32. package/dist/{cli-6rgnj7rs.js → cli-tjmghmm5.js} +1 -1
  33. package/dist/{cli-vdd537x3.js → cli-tpv97m71.js} +3 -3
  34. package/dist/{cli-czbmash2.js → cli-tt9k8r35.js} +1 -1
  35. package/dist/{cli-967j85jf.js → cli-v53rbqp3.js} +2 -2
  36. package/dist/{cli-ntqdjgtp.js → cli-vhjwh6cz.js} +13 -1
  37. package/dist/{cli-79vvw6e7.js → cli-vx9p3qdt.js} +1 -1
  38. package/dist/{cli-66k89bhx.js → cli-wb2zvbfg.js} +1 -1
  39. package/dist/{cli-bg3d9v8z.js → cli-wsed24mk.js} +2 -2
  40. package/dist/{cli-j1gcxf46.js → cli-xf5b7y1f.js} +1 -1
  41. package/dist/{cli-03jn5306.js → cli-y3nxwx0t.js} +5 -5
  42. package/dist/{cli-dnp8dq8y.js → cli-y95wp3tg.js} +1 -1
  43. package/dist/{cli-x3xn5y1p.js → cli-yscm6cv8.js} +106 -39
  44. package/dist/cli.js +15 -15
  45. package/dist/{codex-adapter-3b6r5n1c.js → codex-adapter-gns3s6c3.js} +6 -5
  46. package/dist/{codex-hook-afd466wk.js → codex-hook-9hptmdhj.js} +2 -2
  47. package/dist/{codex-login-8rwg7vdn.js → codex-login-x3jk4etn.js} +2 -1
  48. package/dist/{codex-session-runner-1eepz35q.js → codex-session-runner-gqnxys5w.js} +6 -5
  49. package/dist/{commands-3ryb64pj.js → commands-hxy2y2sp.js} +6 -5
  50. package/dist/{db-efjt4fwn.js → db-w8ghhsgf.js} +18 -5
  51. package/dist/{dispatcher-8vmkfxsh.js → dispatcher-cp1rknjz.js} +18 -17
  52. package/dist/{dsh-adapter-k0twh6xp.js → dsh-adapter-1dwg97zv.js} +2 -2
  53. package/dist/{handlers-n1p7kpt3.js → handlers-egfhr351.js} +21 -20
  54. package/dist/{hook-13hfpvqx.js → hook-fbxjqfjz.js} +10 -9
  55. package/dist/{hook-frca1cmv.js → hook-x4kftwzt.js} +9 -8
  56. package/dist/{http-czpm03y6.js → http-c7jfx990.js} +197 -55
  57. package/dist/{index-2mw4vc58.js → index-4k9hct21.js} +18 -17
  58. package/dist/{index-ayydfsax.js → index-dc2ek6bw.js} +8 -7
  59. package/dist/{index-jxsk850z.js → index-jtvpgb8f.js} +13 -12
  60. package/dist/{index-cbrwzzq1.js → index-r6bty6tb.js} +19 -18
  61. package/dist/{index-mfqv15hj.js → index-yy07ef2s.js} +18 -17
  62. package/dist/{keepalive-qxpq5wqz.js → keepalive-f7ekefyc.js} +8 -7
  63. package/dist/{lead-ybh9mf8g.js → lead-h053syts.js} +27 -26
  64. package/dist/{maintenance-z5xb15gt.js → maintenance-a3w6zs54.js} +9 -8
  65. package/dist/{oauth-refresh-sweep-k89c5081.js → oauth-refresh-sweep-vra1dhkd.js} +7 -6
  66. package/dist/{onboard-hw2agvbp.js → onboard-mfgzeqxs.js} +2 -2
  67. package/dist/{otel-impl-fwfz8r5y.js → otel-impl-2ez6xk57.js} +1 -1
  68. package/dist/{pi-mono-adapter-bn004cee.js → pi-mono-adapter-2b7mw16r.js} +4 -3
  69. package/dist/{pricing-refresh-y978f0jw.js → pricing-refresh-6sw65tck.js} +8 -7
  70. package/dist/{rbac-roles-sp257r0x.js → rbac-roles-3gxmnb20.js} +7 -6
  71. package/dist/{rbac-roles-r4gb80zd.js → rbac-roles-nm6924sy.js} +6 -5
  72. package/dist/{render-v2-gzx9dkx8.js → render-v2-f026j6c4.js} +17 -6
  73. package/dist/{seed-pricing-59s5cqw7.js → seed-pricing-vqxa06qf.js} +7 -6
  74. package/dist/{setup-hj6wr8rt.js → setup-w606fr1q.js} +2 -2
  75. package/dist/{work-objects-pxkkejb4.js → work-objects-ezmggdne.js} +21 -20
  76. package/dist/{worker-yw7xsr4n.js → worker-1mbyv29k.js} +27 -26
  77. package/openapi.json +291 -4
  78. package/package.json +2 -2
  79. package/src/be/db.ts +318 -19
  80. package/src/be/migrations/162_slack_outcome_delivery_abandon.sql +14 -0
  81. package/src/be/migrations/164_usage_cover_index_and_key_plans.sql +22 -0
  82. package/src/commands/runner.ts +1 -0
  83. package/src/http/api-keys.ts +116 -3
  84. package/src/http/session-data.ts +34 -4
  85. package/src/http/usage-cache.ts +32 -0
  86. package/src/prompts/session-templates.ts +4 -4
  87. package/src/providers/codex-agents-md.ts +140 -17
  88. package/src/providers/codex-oauth/auth-json.ts +4 -1
  89. package/src/providers/codex-oauth/flow.ts +7 -0
  90. package/src/scheduler/deferred-task-waits.ts +69 -6
  91. package/src/scheduler/scheduler.ts +14 -0
  92. package/src/slack/render-v2.ts +228 -71
  93. package/src/tasks/worker-follow-up.ts +73 -0
  94. package/src/tests/base-prompt.test.ts +12 -5
  95. package/src/tests/codex-adapter.test.ts +126 -1
  96. package/src/tests/codex-oauth.test.ts +31 -0
  97. package/src/tests/db-task-read-contract.test.ts +8 -0
  98. package/src/tests/db-task-write-contract.test.ts +8 -0
  99. package/src/tests/deferred-schedule-reaper.test.ts +193 -0
  100. package/src/tests/deferred-wake-follow-up.test.ts +199 -0
  101. package/src/tests/docs-index-footprint.test.js +3 -3
  102. package/src/tests/entrypoint-acp-target-binary.test.ts +341 -0
  103. package/src/tests/script-connections.test.ts +3 -0
  104. package/src/tests/session-costs.test.ts +113 -0
  105. package/src/tests/slack-render-v2.test.ts +475 -2
  106. package/src/tools/defer-task.ts +1 -1
  107. package/src/tools/schedules/list-schedules.ts +4 -2
  108. package/src/tools/store-progress.ts +1 -1
  109. package/src/types.ts +4 -0
  110. package/src/utils/credentials.ts +2 -0
  111. package/src/utils/subscription-plans.ts +138 -0
  112. package/templates/skills/scheduling/content.md +2 -2
@@ -10,7 +10,7 @@ import {
10
10
  getMemoryRaterNames,
11
11
  resolveCredential,
12
12
  sanitizeReferencesSource
13
- } from "./cli-czbmash2.js";
13
+ } from "./cli-tt9k8r35.js";
14
14
  import {
15
15
  isMultiRuntimeEnabled
16
16
  } from "./cli-re8z5p8p.js";
@@ -19,14 +19,14 @@ import {
19
19
  } from "./cli-3dpj7atn.js";
20
20
  import {
21
21
  startPricingRefreshLoop
22
- } from "./cli-rqbvtc1v.js";
22
+ } from "./cli-6jjzxv3b.js";
23
23
  import {
24
24
  seedPricingFromModelsDev
25
- } from "./cli-j1gcxf46.js";
25
+ } from "./cli-xf5b7y1f.js";
26
26
  import {
27
27
  ensureRbacSeedsSynced,
28
28
  getUserGrant
29
- } from "./cli-82w25rb4.js";
29
+ } from "./cli-f3va018d.js";
30
30
  import {
31
31
  can,
32
32
  decideAdmission,
@@ -103,7 +103,7 @@ import {
103
103
  validateDefinition,
104
104
  validateScriptImports,
105
105
  writeBareImportShim
106
- } from "./cli-kz0xtztz.js";
106
+ } from "./cli-c41wjx0r.js";
107
107
  import {
108
108
  detachedProcessGroup,
109
109
  registerProcessGroup,
@@ -114,7 +114,7 @@ import {
114
114
  } from "./cli-f14fvzag.js";
115
115
  import {
116
116
  embedScript
117
- } from "./cli-bg3d9v8z.js";
117
+ } from "./cli-wsed24mk.js";
118
118
  import {
119
119
  buildAuthorizationUrl,
120
120
  createOAuthApp,
@@ -129,7 +129,7 @@ import {
129
129
  listAuthorizationsForApp,
130
130
  onAuthorizationRefreshed,
131
131
  upsertOAuthApp
132
- } from "./cli-66k89bhx.js";
132
+ } from "./cli-wb2zvbfg.js";
133
133
  import {
134
134
  AgentFsProvider,
135
135
  getFileStorageProvider,
@@ -146,7 +146,7 @@ import {
146
146
  isGraphExpansionEnabled,
147
147
  rerank,
148
148
  rowToCandidate
149
- } from "./cli-967j85jf.js";
149
+ } from "./cli-v53rbqp3.js";
150
150
  import {
151
151
  ZodFirstPartyTypeKind,
152
152
  objectType
@@ -176,7 +176,7 @@ import {
176
176
  taskCitationWarnings,
177
177
  upsertTaskCitations,
178
178
  withSpan
179
- } from "./cli-h4jrts5n.js";
179
+ } from "./cli-9p33cz9h.js";
180
180
  import {
181
181
  init_task_attachment_links,
182
182
  taskAttachmentDisplayUrl,
@@ -287,6 +287,7 @@ import {
287
287
  getLastSuccessfulRun,
288
288
  getLatestStepForNode,
289
289
  getLeadAgent,
290
+ getLogsByTaskIdAndEventType,
290
291
  getLogsByTaskIdChronological,
291
292
  getMcpServerById,
292
293
  getMcpServerByName,
@@ -441,7 +442,7 @@ import {
441
442
  upsertSwarmConfig,
442
443
  validateConfigValue,
443
444
  workflowContextKey
444
- } from "./cli-60cwjbsn.js";
445
+ } from "./cli-awwphhcs.js";
445
446
  import {
446
447
  $OpenAPIRegistry,
447
448
  $OpenApiGeneratorV31,
@@ -496,13 +497,13 @@ import {
496
497
  normalizeAssetKey,
497
498
  parseAssetKey,
498
499
  splitLegacyModelAlias
499
- } from "./cli-fb79s4p1.js";
500
+ } from "./cli-h0wdadsx.js";
500
501
  import {
501
502
  generateDefaultClaudeMd,
502
503
  generateDefaultIdentityMd,
503
504
  generateDefaultSoulMd,
504
505
  init_defaults
505
- } from "./cli-6265kmdz.js";
506
+ } from "./cli-3gmcwfyx.js";
506
507
  import {
507
508
  deepInterpolate,
508
509
  findInterpolationTokens,
@@ -513,7 +514,7 @@ import {
513
514
  interpolate,
514
515
  registerTemplate,
515
516
  resolveTemplate
516
- } from "./cli-dnpg5yrw.js";
517
+ } from "./cli-ggm92wcn.js";
517
518
  import {
518
519
  MAX_PROFILE_FILE_LENGTH,
519
520
  getAppUrl,
@@ -579,7 +580,7 @@ import {
579
580
  import {
580
581
  init_package,
581
582
  package_default
582
- } from "./cli-gy9ctpmm.js";
583
+ } from "./cli-sgyqyyxe.js";
583
584
  import {
584
585
  init_secret_scrubber,
585
586
  isSensitiveKey,
@@ -14318,7 +14319,7 @@ async function notifyAutomationPreflightFailure(preflight) {
14318
14319
  return;
14319
14320
  }
14320
14321
  try {
14321
- const { getSlackApp: getSlackApp2 } = await import("./app-99hz4k80.js");
14322
+ const { getSlackApp: getSlackApp2 } = await import("./app-enysy1zd.js");
14322
14323
  const app = getSlackApp2();
14323
14324
  if (!app) {
14324
14325
  console.warn("[Automation Preflight] Slack not available, cannot send notification");
@@ -17417,7 +17418,7 @@ async function resolveWaitCause(scheduleId, reason) {
17417
17418
  if (reason !== "ceiling" && wait.eventName !== "settled" && wait.eventName !== reason)
17418
17419
  return;
17419
17420
  if (reason === "ceiling")
17420
- return { wait, cause: "ceiling expired" };
17421
+ return { wait, cause: "ceiling expired", matchedTaskIds: [] };
17421
17422
  const members = await client.query(`SELECT m.taskId, t.status AS taskStatus, EXISTS (
17422
17423
  SELECT 1 FROM scheduled_tasks d
17423
17424
  WHERE d.parentTaskId = t.id AND d.taskType = 'deferred' AND d.enabled = 1
@@ -17428,7 +17429,7 @@ async function resolveWaitCause(scheduleId, reason) {
17428
17429
  if (!matched.length || wait.mode === "all" && matched.length !== members.length)
17429
17430
  return;
17430
17431
  const cause = members.length === 1 ? `task.${matched[0].taskStatus} for task ${matched[0].taskId}` : `${wait.mode} tasks matched ${wait.eventName}: ${matched.map((member) => `${member.taskId} (${member.taskStatus})`).join(", ")}`;
17431
- return { wait, cause };
17432
+ return { wait, cause, matchedTaskIds: matched.map((member) => member.taskId) };
17432
17433
  }
17433
17434
  function wakeSchedule(schedule, cause) {
17434
17435
  return { ...schedule, taskTemplate: `${schedule.taskTemplate}
@@ -17449,7 +17450,8 @@ async function prepareDeferredWakeTask(scheduleId, reason, extraTags) {
17449
17450
  throw new Error(`Schedule "${schedule.name}" has no taskTemplate`);
17450
17451
  return await prepareStandaloneScheduleTask(wakeSchedule(schedule, resolved.cause), extraTags);
17451
17452
  }
17452
- async function dispatchDeferredTaskWait(scheduleId, reason, extraTags = []) {
17453
+ var DEFERRED_WAIT_WOKE_EVENT = "task_deferred_wait_woke";
17454
+ async function dispatchDeferredTaskWait(scheduleId, reason, extraTags = [], triggerTaskId) {
17453
17455
  const client = getDbClient();
17454
17456
  if (!await client.get("SELECT * FROM deferred_task_waits WHERE scheduleId = ?", [
17455
17457
  scheduleId
@@ -17479,6 +17481,20 @@ async function dispatchDeferredTaskWait(scheduleId, reason, extraTags = []) {
17479
17481
  task.id,
17480
17482
  scheduleId
17481
17483
  ]);
17484
+ if (triggerTaskId && resolved.matchedTaskIds.includes(triggerTaskId)) {
17485
+ await createLogEntry({
17486
+ eventType: DEFERRED_WAIT_WOKE_EVENT,
17487
+ taskId: triggerTaskId,
17488
+ agentId: task.agentId ?? undefined,
17489
+ metadata: {
17490
+ scheduleId,
17491
+ waiterTaskId: schedule.parentTaskId ?? null,
17492
+ wakeTaskId: task.id,
17493
+ wakeAgentId: task.agentId ?? null,
17494
+ mode: resolved.wait.mode
17495
+ }
17496
+ });
17497
+ }
17482
17498
  await updateScheduledTask(scheduleId, {
17483
17499
  enabled: false,
17484
17500
  nextRunAt: null,
@@ -17527,12 +17543,24 @@ async function reconcileDeferredTaskWaits(taskId) {
17527
17543
  ${taskId ? "AND m.taskId = ?" : ""}`, taskId ? [taskId] : []);
17528
17544
  for (const row of rows) {
17529
17545
  try {
17530
- await dispatchDeferredTaskWait(row.scheduleId, `task.${row.taskStatus}`);
17546
+ await dispatchDeferredTaskWait(row.scheduleId, `task.${row.taskStatus}`, [], taskId);
17531
17547
  } catch (err) {
17532
17548
  console.error(`[Scheduler] Deferred task wake failed for ${row.scheduleId}:`, err);
17533
17549
  }
17534
17550
  }
17535
17551
  }
17552
+ var SPENT_DEFERRED_SCHEDULE_RETENTION_MS = 30 * 24 * 60 * 60 * 1000;
17553
+ async function reapSpentDeferredSchedules(now = new Date) {
17554
+ const cutoff = new Date(now.getTime() - SPENT_DEFERRED_SCHEDULE_RETENTION_MS).toISOString();
17555
+ const result = await getDbClient().run(`DELETE FROM scheduled_tasks
17556
+ WHERE taskType = 'deferred' AND scheduleType = 'one_time' AND enabled = 0
17557
+ AND lastRunAt IS NOT NULL AND lastRunAt < ?
17558
+ AND NOT EXISTS (
17559
+ SELECT 1 FROM deferred_task_waits w
17560
+ WHERE w.scheduleId = scheduled_tasks.id AND w.status = 'pending'
17561
+ )`, [cutoff]);
17562
+ return result.changes;
17563
+ }
17536
17564
  function onTaskEvent(payload) {
17537
17565
  if (!payload || typeof payload !== "object" || !("taskId" in payload) || typeof payload.taskId !== "string")
17538
17566
  return;
@@ -17561,6 +17589,8 @@ function stopDeferredTaskWaits() {
17561
17589
  var schedulerInterval = null;
17562
17590
  var schedulerRun = null;
17563
17591
  var isProcessing = false;
17592
+ var lastDeferredReapAt = 0;
17593
+ var DEFERRED_REAP_INTERVAL_MS = 60 * 60 * 1000;
17564
17594
  var executorRegistry = null;
17565
17595
  function resolveExecutorRegistry() {
17566
17596
  if (executorRegistry)
@@ -17873,6 +17903,16 @@ async function processSchedules() {
17873
17903
  console.error(`[Scheduler] Error executing "${schedule.name}":`, err);
17874
17904
  }
17875
17905
  }
17906
+ if (Date.now() - lastDeferredReapAt >= DEFERRED_REAP_INTERVAL_MS) {
17907
+ lastDeferredReapAt = Date.now();
17908
+ try {
17909
+ const reaped = await reapSpentDeferredSchedules();
17910
+ if (reaped)
17911
+ console.log(`[Scheduler] Reaped ${reaped} spent deferral schedule(s)`);
17912
+ } catch (err) {
17913
+ console.error("[Scheduler] Deferral schedule reap failed:", err);
17914
+ }
17915
+ }
17876
17916
  } finally {
17877
17917
  isProcessing = false;
17878
17918
  }
@@ -27733,7 +27773,7 @@ async function notifySlack(text) {
27733
27773
  return;
27734
27774
  }
27735
27775
  try {
27736
- const { getSlackApp: getSlackApp2 } = await import("./app-99hz4k80.js");
27776
+ const { getSlackApp: getSlackApp2 } = await import("./app-enysy1zd.js");
27737
27777
  const app = getSlackApp2();
27738
27778
  if (!app) {
27739
27779
  console.warn("[Jira webhook keepalive] Slack not available, cannot send notification");
@@ -27804,7 +27844,7 @@ async function deleteJiraWebhook(webhookId) {
27804
27844
  console.log(`[Jira webhook keepalive] Deleted webhook id=${webhookId}`);
27805
27845
  }
27806
27846
  async function overwriteWebhookIds(next) {
27807
- const { getDbClient: getDbClient2 } = await import("./db-efjt4fwn.js");
27847
+ const { getDbClient: getDbClient2 } = await import("./db-w8ghhsgf.js");
27808
27848
  await getDbClient2().transaction(async (tx) => {
27809
27849
  const row = await tx.get("SELECT metadata FROM oauth_apps WHERE provider = 'jira'");
27810
27850
  if (!row) {
@@ -101539,7 +101579,7 @@ async function reloadGlobalConfigsAndIntegrations() {
101539
101579
  return runWithoutRequestAuth(() => reloadGlobalConfigsAndIntegrationsInner());
101540
101580
  }
101541
101581
  async function reloadGlobalConfigsAndIntegrationsInner() {
101542
- const { getEmbeddingProvider: getEmbeddingProvider2, resetEmbeddingProvider } = await import("./index-ayydfsax.js");
101582
+ const { getEmbeddingProvider: getEmbeddingProvider2, resetEmbeddingProvider } = await import("./index-dc2ek6bw.js");
101543
101583
  const wasEmbeddingsConfigured = getEmbeddingProvider2().isConfigured();
101544
101584
  const updated = await loadGlobalConfigsIntoEnv(true);
101545
101585
  await stopSlackApp();
@@ -101552,10 +101592,10 @@ async function reloadGlobalConfigsAndIntegrationsInner() {
101552
101592
  integrations.push("embeddings");
101553
101593
  }
101554
101594
  if (!wasEmbeddingsConfigured && isEmbeddingsConfigured) {
101555
- import("./boot-reembed-gv4gkq87.js").then(({ runBootReembed }) => runBootReembed()).catch((err) => {
101595
+ import("./boot-reembed-zfxb937k.js").then(({ runBootReembed }) => runBootReembed()).catch((err) => {
101556
101596
  console.error("[config-reload] memory backfill failed (non-fatal):", err);
101557
101597
  });
101558
- import("./boot-reembed-zm7dmkqt.js").then(({ runBootReembedScripts }) => runBootReembedScripts()).catch((err) => {
101598
+ import("./boot-reembed-r6shx5qx.js").then(({ runBootReembedScripts }) => runBootReembedScripts()).catch((err) => {
101559
101599
  console.error("[config-reload] script backfill failed (non-fatal):", err);
101560
101600
  });
101561
101601
  }
@@ -102368,7 +102408,7 @@ function setPreloadedTools(server, names) {
102368
102408
  async function applyPreToolCall(name, args, requestInfo, inputSchema) {
102369
102409
  if (requestInfo.callOrigin !== "mcp")
102370
102410
  return { args };
102371
- const dispatcher = await import("./dispatcher-8vmkfxsh.js");
102411
+ const dispatcher = await import("./dispatcher-cp1rknjz.js");
102372
102412
  const result = await dispatcher.dispatchPre("pre.tool.call", { tool: name, args, requestInfo }, inputSchema ? {
102373
102413
  validateModify: async (data) => {
102374
102414
  const schema = normalizeObjectSchema(inputSchema) ?? inputSchema;
@@ -108809,6 +108849,24 @@ Attachments (${attachments.length}):
108809
108849
  ${lines.join(`
108810
108850
  `)}`;
108811
108851
  }
108852
+ async function findDeferredWakeFor(taskId, agentId) {
108853
+ try {
108854
+ await reconcileDeferredTaskWaits(taskId);
108855
+ for (const log of await getLogsByTaskIdAndEventType(taskId, DEFERRED_WAIT_WOKE_EVENT)) {
108856
+ const meta2 = JSON.parse(log.metadata ?? "{}");
108857
+ if (meta2.wakeAgentId === agentId && meta2.scheduleId && meta2.wakeTaskId) {
108858
+ return {
108859
+ scheduleId: meta2.scheduleId,
108860
+ waiterTaskId: meta2.waiterTaskId ?? null,
108861
+ wakeTaskId: meta2.wakeTaskId
108862
+ };
108863
+ }
108864
+ }
108865
+ } catch (err) {
108866
+ console.warn(`[worker-follow-up] Deferred wake lookup failed for ${taskId.slice(0, 8)}: ${err}`);
108867
+ }
108868
+ return null;
108869
+ }
108812
108870
  async function createWorkerTaskFollowUp(args) {
108813
108871
  const { task, status, output, failureReason } = args;
108814
108872
  if (task.workflowRunId)
@@ -108881,6 +108939,25 @@ ${depLines.join(`
108881
108939
  return null;
108882
108940
  const changes = preFollowUp.action === "modify" ? preFollowUp.data : {};
108883
108941
  const followUpAgentId = changes.agentId === undefined ? leadAgent.id : changes.agentId;
108942
+ const wake = followUpAgentId && !instructions ? await findDeferredWakeFor(task.id, followUpAgentId) : null;
108943
+ if (wake) {
108944
+ try {
108945
+ await createLogEntry({
108946
+ eventType: "task_follow_up_suppressed",
108947
+ taskId: task.id,
108948
+ agentId: followUpAgentId ?? undefined,
108949
+ metadata: {
108950
+ reason: "deferred_wait_woke",
108951
+ status,
108952
+ waiterTaskId: wake.waiterTaskId,
108953
+ wakeTaskId: wake.wakeTaskId,
108954
+ scheduleId: wake.scheduleId
108955
+ }
108956
+ });
108957
+ } catch {}
108958
+ console.log(`[worker-follow-up] Skipped follow-up for ${status} task ${task.id.slice(0, 8)}: woke deferred waiter ${wake.waiterTaskId?.slice(0, 8) ?? "?"} (wake-up task ${wake.wakeTaskId.slice(0, 8)})`);
108959
+ return null;
108960
+ }
108884
108961
  return await createTaskWithSiblingAwareness(changes.description ?? followUpDescription, {
108885
108962
  agentId: followUpAgentId,
108886
108963
  routingReason: followUpAgentId ? "skill" : undefined,
@@ -109348,7 +109425,7 @@ var registerDeferTaskTool = (server) => {
109348
109425
  message: "Provide exactly one of wakeOn.taskId or wakeOn.taskIds."
109349
109426
  }).refine((wake) => !wake.taskIds || new Set(wake.taskIds).size === wake.taskIds.length, {
109350
109427
  message: "wakeOn.taskIds must not contain duplicates."
109351
- }).optional().describe("Wake early on a task event. Provide taskId or nonempty, unique taskIds. mode defaults to all (every member must match); any wakes on the first match. settled covers completed, failed, or cancelled. Deferred and superseded members follow their continuations; a superseded member without a resume child holds to the ceiling. Any already-terminal member rejects the request; one delayMs/runAt ceiling is still required for the whole set."),
109428
+ }).optional().describe("Wake early on a task event. Provide taskId or nonempty, unique taskIds. mode defaults to all (every member must match); any wakes on the first match. settled covers completed, failed, or cancelled. Deferred and superseded members follow their continuations; a superseded member without a resume child holds to the ceiling. Any already-terminal member rejects the request; one delayMs/runAt ceiling is still required for the whole set. The member whose settlement wakes you creates no separate lead follow-up for your agent unless its followUpConfig sets onCompleted/onFailed; an all-mode member that settles while others are pending still does."),
109352
109429
  summary: string().min(1).max(4000).describe("What you did so far and where things stand. Stored in the task log for tasks with an outputSchema; otherwise becomes the task's output."),
109353
109430
  output: string().optional().describe("Required when the task has an outputSchema: a JSON string matching that schema, stored verbatim as terminal output. Ignored for tasks without an outputSchema."),
109354
109431
  note: string().min(1).max(2000).describe("What is pending, and what to check on wake-up."),
@@ -121324,8 +121401,8 @@ var registerListSchedulesTool = (server) => {
121324
121401
  keyPrefix: AssetKeySchema.optional().describe("Filter by namespace subtree."),
121325
121402
  scheduleType: _enum(["recurring", "one_time"]).optional().describe("Filter by schedule type"),
121326
121403
  hideCompleted: boolean().default(true).optional().describe("Hide completed one-time schedules (default: true)"),
121327
- consecutiveErrorsMin: number().int().min(0).optional().describe("Only return schedules with at least this many consecutive errors."),
121328
- lastRunStatus: _enum(["failed", "succeeded"]).optional().describe("Filter by derived last run status. `failed` means consecutiveErrors > 0; `succeeded` means lastRunAt is set and consecutiveErrors is 0."),
121404
+ consecutiveErrorsMin: number().int().min(0).optional().describe("Only return schedules with at least this many consecutive dispatch errors (the scheduler failed to create the task, workflow run, or script run). Does not count spawned tasks that later failed; for those use get-tasks with scheduleId and status failed."),
121405
+ lastRunStatus: _enum(["failed", "succeeded"]).optional().describe("Filter by derived last dispatch status. `failed` means consecutiveErrors > 0 (the last dispatch attempt errored); `succeeded` means lastRunAt is set and consecutiveErrors is 0. Reflects dispatch only, not the outcome of spawned tasks; for those use get-tasks with scheduleId and status failed."),
121329
121406
  includeFull: boolean().optional().describe("Return the full `taskTemplate` instead of a short `taskTemplatePreview`. Default false.")
121330
121407
  }),
121331
121408
  outputSchema: swarmToolOutputSchema({
@@ -125830,7 +125907,7 @@ var registerStoreProgressTool = (server) => {
125830
125907
  output: string().optional().describe("The task result (used when completing). For Slack-originated tasks, this is published verbatim in the thread's outcome card. Keep free-text output under 120 words by default. Name the result and every artifact link, plus any IDs the human needs. Link documents instead of inlining them; omit process narration, transcripts, and restatements of the brief. Exceed the target only when requested depth, enumerated results, essential evidence, caveats, or instructions require it, or when the task's outputSchema requires longer output. When the task carries an outputSchema, output must be JSON matching it."),
125831
125908
  failureReason: string().optional().describe("The reason for failure (used when failing)."),
125832
125909
  attachments: array(AttachmentInputSchema).max(20).optional().describe("Pointer-based artifacts produced by this step — agent-fs path, URL, shared-fs path, or swarm Page. No inline file data; upload to agent-fs first and attach by path. Agent-fs pointers are verified before task state changes, using the explicit org/drive pair or the registering agent's configured defaults. May be sent on any call (progress or completion) and accumulates across calls; duplicates are de-duped by sha256 (when present) or by (kind, pointer, name)."),
125833
- citations: array(CitationInputSchema).max(MAX_TASK_CITATIONS).catch([]).optional().describe('Claim sources, upserted by index across calls. Reference each one in output with [citation:N], or set general: true for a source that backs the whole answer (it renders under "General sources"). ref per kind: task = task UUID; memory = memory UUID (optional quote must appear verbatim in it); github = owner/repo#N, owner/repo@<sha>, or a github.com pull, issues, or commit URL; slack = permalink or channel/ts; agent-fs = file path; page = page id; script-run = script run id; url = http(s) URL. The first completing call is refused, and the task stays in progress, if a marker has no entry, a citation fails validation, or a non-general citation is unreferenced; the response lists each problem. After one refusal, completion proceeds and those markers and sources are dropped from rendered output. At most 50 citations per call/task, refs up to 2048 characters, labels up to 200. Invalid or oversized batches are ignored; existing indices can still be updated at capacity.'),
125910
+ citations: array(CitationInputSchema).max(MAX_TASK_CITATIONS).catch([]).optional().describe('Claim sources, upserted by index across calls. Use only for factual claims the reader cannot already see in the thread or task tree, 1-2 sources; none on delegation, routing, acks, or status replies. Reference each one in output with [citation:N], or set general: true for a source that backs the whole answer (it renders under "General sources"). ref per kind: task = task UUID; memory = memory UUID (optional quote must appear verbatim in it); github = owner/repo#N, owner/repo@<sha>, or a github.com pull, issues, or commit URL; slack = permalink or channel/ts; agent-fs = file path; page = page id; script-run = script run id; url = http(s) URL. The first completing call is refused, and the task stays in progress, if a marker has no entry, a citation fails validation, or a non-general citation is unreferenced; the response lists each problem. After one refusal, completion proceeds and those markers and sources are dropped from rendered output. At most 50 citations per call/task, refs up to 2048 characters, labels up to 200. Invalid or oversized batches are ignored; existing indices can still be updated at capacity.'),
125834
125911
  persistMemory: boolean().optional().describe("Opt in to task_completion memory persistence for automatic/recurring tasks. Manual tasks are persisted by default; scheduled, system, heartbeat/boot-triage, monitor, and digest tasks are skipped unless this is true."),
125835
125912
  force: boolean().optional().describe("On an already-terminal task, overwrite explicitly provided output and/or failureReason text while preserving status and finishedAt and without replaying events, memory writes, follow-up creation, business-use ensure, or capacity updates. Differing terminal text is otherwise discarded and reported as a failure.")
125836
125913
  }),
@@ -131288,7 +131365,7 @@ class HumanInTheLoopExecutor extends BaseExecutor {
131288
131365
  }
131289
131366
  if (notification.channel === "slack") {
131290
131367
  try {
131291
- const { getSlackApp: getSlackApp2 } = await import("./app-99hz4k80.js");
131368
+ const { getSlackApp: getSlackApp2 } = await import("./app-enysy1zd.js");
131292
131369
  const slackApp = getSlackApp2();
131293
131370
  if (!slackApp) {
131294
131371
  console.warn("[HITL] Slack not initialized — cannot send notification");
@@ -131417,7 +131494,7 @@ class NotifyExecutor extends BaseExecutor {
131417
131494
  }
131418
131495
  }
131419
131496
  case "slack": {
131420
- const { getSlackApp: getSlackApp2 } = await import("./app-99hz4k80.js");
131497
+ const { getSlackApp: getSlackApp2 } = await import("./app-enysy1zd.js");
131421
131498
  const app = getSlackApp2();
131422
131499
  if (!app) {
131423
131500
  return {
@@ -6,7 +6,7 @@ import {
6
6
  isSteeringEnabled,
7
7
  registerTemplate,
8
8
  resolveTemplateAsync
9
- } from "./cli-dnpg5yrw.js";
9
+ } from "./cli-ggm92wcn.js";
10
10
  import {
11
11
  getSlackConfiguration,
12
12
  init_config
@@ -5,12 +5,12 @@ import {
5
5
  instantFlush,
6
6
  requestSlackThreadSteering,
7
7
  wasEventSeen
8
- } from "./cli-jmbz691m.js";
8
+ } from "./cli-jytrw2na.js";
9
9
  import {
10
10
  enrichSlackUserEmail,
11
11
  resolveSlackUserId,
12
12
  rewriteSlackMentions
13
- } from "./cli-p2hxs01b.js";
13
+ } from "./cli-74h6f2bp.js";
14
14
  import {
15
15
  TaskCreationBlockedError,
16
16
  broadcastMatches,
@@ -23,14 +23,14 @@ import {
23
23
  hasOtherUserMention,
24
24
  notifySlackFileFailures,
25
25
  routeMessage
26
- } from "./cli-pbsk349d.js";
26
+ } from "./cli-01vfmq8c.js";
27
27
  import {
28
28
  ackSlackMessage,
29
29
  buildTreeBlocks,
30
30
  ensureSlackThreadTree,
31
31
  isSlackRenderV2Enabled,
32
32
  registerTreeMessage
33
- } from "./cli-h4jrts5n.js";
33
+ } from "./cli-9p33cz9h.js";
34
34
  import {
35
35
  getAgentById,
36
36
  getAgentWorkingOnThread,
@@ -43,11 +43,11 @@ import {
43
43
  isExtensionAgent,
44
44
  reactionName,
45
45
  slackContextKey
46
- } from "./cli-60cwjbsn.js";
46
+ } from "./cli-awwphhcs.js";
47
47
  import {
48
48
  init_resolver,
49
49
  resolveTemplate
50
- } from "./cli-dnpg5yrw.js";
50
+ } from "./cli-ggm92wcn.js";
51
51
  import {
52
52
  init_env_flag,
53
53
  isEnvFlagEnabled
@@ -1,14 +1,14 @@
1
1
  import {
2
2
  buildModelsDevSeedRows,
3
3
  loadModelsDevCache
4
- } from "./cli-j1gcxf46.js";
4
+ } from "./cli-xf5b7y1f.js";
5
5
  import {
6
6
  createLogEntry,
7
7
  getActivePricingRow,
8
8
  getDbClient,
9
9
  init_db,
10
10
  insertPricingRow
11
- } from "./cli-60cwjbsn.js";
11
+ } from "./cli-awwphhcs.js";
12
12
  import {
13
13
  init_secret_scrubber,
14
14
  scrubSecrets
@@ -4,12 +4,12 @@ import {
4
4
  linkIdentity,
5
5
  recordUnmappedIdentity,
6
6
  resolveIdentity
7
- } from "./cli-pbsk349d.js";
7
+ } from "./cli-01vfmq8c.js";
8
8
  import {
9
9
  getKv,
10
10
  init_db,
11
11
  upsertKv
12
- } from "./cli-60cwjbsn.js";
12
+ } from "./cli-awwphhcs.js";
13
13
 
14
14
  // src/slack/enrich.ts
15
15
  init_db();
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  init_package,
3
3
  package_default
4
- } from "./cli-gy9ctpmm.js";
4
+ } from "./cli-sgyqyyxe.js";
5
5
 
6
6
  // src/commands/shared/client-config.ts
7
7
  init_package();