@desplega.ai/agent-swarm 1.102.0 → 1.103.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 (107) hide show
  1. package/dist/{actions-j9399ktm.js → actions-7txktrdj.js} +6 -6
  2. package/dist/{app-tnq1pz27.js → app-xm3xsdye.js} +3 -3
  3. package/dist/{assistant-c7y92gkw.js → assistant-qpv63wk6.js} +9 -9
  4. package/dist/{boot-reembed-k7e6fc1p.js → boot-reembed-9cxqka3e.js} +3 -3
  5. package/dist/{boot-reembed-b97r699t.js → boot-reembed-chxhrwv8.js} +4 -4
  6. package/dist/{boot-scrub-logs-14kbc61y.js → boot-scrub-logs-8qtfkcz8.js} +2 -2
  7. package/dist/{claude-managed-adapter-g07dbz3b.js → claude-managed-adapter-z29hjgzz.js} +3 -3
  8. package/dist/{cli-tsz1q7gk.js → cli-2307phk1.js} +375 -23
  9. package/dist/{cli-g5px3d7x.js → cli-2957pqpj.js} +24 -1
  10. package/dist/{cli-9qascwj7.js → cli-2qynerth.js} +1 -1
  11. package/dist/{cli-k1ghyj8b.js → cli-4fnp2tc3.js} +1 -1
  12. package/dist/{cli-hc4rd6sv.js → cli-85pf4z38.js} +1 -1
  13. package/dist/{cli-zk4gn40w.js → cli-8hyv6c2v.js} +6 -14
  14. package/dist/{cli-k81y1cjb.js → cli-8w95v19d.js} +1 -1
  15. package/dist/{cli-7xdq3jg3.js → cli-92fqyjcv.js} +1 -1
  16. package/dist/{cli-zctkpdmd.js → cli-dz3d6zjg.js} +1 -1
  17. package/dist/{cli-d0t4854c.js → cli-fedn86nz.js} +213 -476
  18. package/dist/{cli-g861fwjp.js → cli-fwxdt7kt.js} +3 -3
  19. package/dist/{cli-2aaa9mqr.js → cli-fygaw191.js} +2 -2
  20. package/dist/{cli-qbc6mncp.js → cli-gzepjz54.js} +2 -2
  21. package/dist/{cli-r68m8arr.js → cli-jt9d9fjw.js} +1 -1
  22. package/dist/{cli-axtg1zaa.js → cli-khe4x17a.js} +1 -1
  23. package/dist/{cli-sygq3fhn.js → cli-kk51f3tf.js} +5 -5
  24. package/dist/{cli-dgab5x2h.js → cli-krvxq8bc.js} +1 -1
  25. package/dist/{cli-xde8vhhp.js → cli-ksq38x4n.js} +2 -2
  26. package/dist/{cli-stqqf5kh.js → cli-m8f6qzck.js} +1 -1
  27. package/dist/{cli-ap4md0gc.js → cli-ns0r7mkr.js} +30 -5
  28. package/dist/{cli-t2jk33ta.js → cli-rttgde5f.js} +18 -6
  29. package/dist/{cli-mhj07xbq.js → cli-rvae030h.js} +3 -3
  30. package/dist/{cli-q6jzg6wj.js → cli-s14sb64w.js} +4 -4
  31. package/dist/{cli-zmf7refz.js → cli-v9283nma.js} +1 -1
  32. package/dist/{cli-fjx4x7nn.js → cli-xmtsan9k.js} +1 -1
  33. package/dist/{cli-vgck9mqq.js → cli-yeemwevj.js} +155 -37
  34. package/dist/{cli-5bqa41fd.js → cli-yfwwjeft.js} +1 -1
  35. package/dist/{cli-s8jw5bmg.js → cli-yp2krx5r.js} +2 -2
  36. package/dist/cli.js +9 -9
  37. package/dist/{codex-adapter-wf119mnw.js → codex-adapter-w0xharsg.js} +3 -3
  38. package/dist/{codex-session-runner-1gknw7mh.js → codex-session-runner-kzbjcm2k.js} +3 -3
  39. package/dist/{commands-2wyn3swb.js → commands-aqn63mcw.js} +2 -2
  40. package/dist/{db-567ntpxv.js → db-azrvwsnj.js} +2 -2
  41. package/dist/{handlers-wvwpk2kj.js → handlers-hf61har3.js} +9 -9
  42. package/dist/{hook-fatkywc0.js → hook-306p3yz4.js} +2 -2
  43. package/dist/{http-eq6wxve6.js → http-zts4haq7.js} +81 -62
  44. package/dist/{index-400x6p3j.js → index-29vg51x6.js} +6 -6
  45. package/dist/{index-9wqh5352.js → index-3c651yfk.js} +10 -10
  46. package/dist/{index-6aj8966p.js → index-bfh9hgek.js} +5 -5
  47. package/dist/{index-d1rm4ea3.js → index-h2yqjyk0.js} +8 -8
  48. package/dist/{keepalive-6x9nx92g.js → keepalive-a0dg5pds.js} +4 -4
  49. package/dist/{lead-5fgqwe13.js → lead-7mcxedkc.js} +21 -21
  50. package/dist/{maintenance-eajx5k1k.js → maintenance-mrzqd53t.js} +4 -4
  51. package/dist/{onboard-jc1w1edg.js → onboard-4dkpv9wa.js} +2 -2
  52. package/dist/{otel-impl-8k375amf.js → otel-impl-jt7gpyp9.js} +1 -1
  53. package/dist/{pi-mono-adapter-hf8sw7hs.js → pi-mono-adapter-zf7dt1wg.js} +1 -1
  54. package/dist/{pricing-refresh-zed6916t.js → pricing-refresh-xqnzh8dt.js} +4 -4
  55. package/dist/{seed-pricing-5805qzkz.js → seed-pricing-56tjm1fj.js} +3 -3
  56. package/dist/{setup-wz05vxh0.js → setup-tbwk8j10.js} +2 -2
  57. package/dist/{worker-j359graf.js → worker-e03za92t.js} +21 -21
  58. package/openapi.json +70 -1
  59. package/package.json +1 -1
  60. package/src/be/db.ts +83 -13
  61. package/src/be/migrations/098_repo_hooks_config.sql +3 -0
  62. package/src/be/task-lifecycle-events.ts +42 -0
  63. package/src/commands/runner.ts +174 -25
  64. package/src/github/task-reactions.ts +21 -0
  65. package/src/hooks/tool-loop-detection.test.ts +40 -0
  66. package/src/hooks/tool-loop-detection.ts +37 -1
  67. package/src/http/agents.ts +7 -0
  68. package/src/http/index.ts +16 -2
  69. package/src/http/prompt-templates.ts +1 -1
  70. package/src/http/repos.ts +5 -1
  71. package/src/http/schedules.ts +1 -1
  72. package/src/http/session-data.ts +2 -0
  73. package/src/http/tasks.ts +2 -1
  74. package/src/http/workflows.ts +1 -0
  75. package/src/prompts/resolver.ts +1 -1
  76. package/src/scheduler/scheduler.ts +25 -2
  77. package/src/server-runtime-counters.ts +12 -0
  78. package/src/server-user.ts +1 -2
  79. package/src/server.ts +5 -0
  80. package/src/telemetry.ts +18 -1
  81. package/src/tests/http-api-integration.test.ts +4 -0
  82. package/src/tests/model-control.test.ts +6 -6
  83. package/src/tests/swarm-repos.test.ts +25 -2
  84. package/src/tests/task-lifecycle-events.test.ts +53 -0
  85. package/src/tests/task-lifecycle-telemetry.test.ts +37 -1
  86. package/src/tests/telemetry-init.test.ts +32 -0
  87. package/src/tools/prompt-templates/preview.ts +1 -1
  88. package/src/tools/repos/update-repo.ts +6 -1
  89. package/src/tools/schedules/create-schedule.ts +1 -1
  90. package/src/tools/schedules/update-schedule.ts +1 -1
  91. package/src/tools/send-task.ts +7 -2
  92. package/src/tools/task-action.ts +6 -2
  93. package/src/types.ts +155 -1
  94. package/src/utils/template.ts +127 -0
  95. package/src/workflows/engine.ts +7 -0
  96. package/src/workflows/executors/agent-task.ts +1 -2
  97. package/src/workflows/template.ts +12 -121
  98. package/src/workflows/triggers.ts +6 -2
  99. package/templates/community/code-health-reports/PLAYBOOK.md +355 -0
  100. package/templates/community/code-health-reports/README.md +38 -0
  101. package/templates/community/code-health-reports/lead-prompt.md +52 -0
  102. package/templates/community/code-health-reports/report.mjs +378 -0
  103. package/templates/community/code-health-reports/run.sh +143 -0
  104. package/templates/schedules/weekly-code-health-reports/config.json +13 -0
  105. package/templates/schedules/weekly-code-health-reports/content.md +60 -0
  106. package/src/model-tiers.ts +0 -140
  107. package/templates/community/.gitkeep +0 -0
@@ -4,11 +4,11 @@ import {
4
4
  getNextResumeGeneration,
5
5
  getResumeGeneration,
6
6
  repointTrackerSyncBySwarmId
7
- } from "./cli-k1ghyj8b.js";
7
+ } from "./cli-4fnp2tc3.js";
8
8
  import {
9
9
  getExecutorRegistry,
10
10
  recoverIncompleteRuns
11
- } from "./cli-zk4gn40w.js";
11
+ } from "./cli-8hyv6c2v.js";
12
12
  import {
13
13
  assignUnassignedTaskPending,
14
14
  backfillSupersedeTaskResumeTaskId,
@@ -43,7 +43,7 @@ import {
43
43
  resolveTemplate,
44
44
  supersedeTask,
45
45
  updateAgentStatus
46
- } from "./cli-d0t4854c.js";
46
+ } from "./cli-fedn86nz.js";
47
47
 
48
48
  // src/heartbeat/heartbeat.ts
49
49
  init_db();
@@ -4,11 +4,11 @@ import {
4
4
  getEmbeddingProvider,
5
5
  init_embedding,
6
6
  serializeEmbedding
7
- } from "./cli-k81y1cjb.js";
7
+ } from "./cli-8w95v19d.js";
8
8
  import {
9
9
  getDb,
10
10
  init_db
11
- } from "./cli-d0t4854c.js";
11
+ } from "./cli-fedn86nz.js";
12
12
  import {
13
13
  init_secret_scrubber,
14
14
  scrubSecrets
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  embedScript
3
- } from "./cli-2aaa9mqr.js";
3
+ } from "./cli-fygaw191.js";
4
4
  import {
5
5
  computeContentHash,
6
6
  getDb,
7
7
  init_db
8
- } from "./cli-d0t4854c.js";
8
+ } from "./cli-fedn86nz.js";
9
9
  import {
10
10
  __commonJS,
11
11
  __require,
@@ -3,7 +3,7 @@ import {
3
3
  getAgentById,
4
4
  getInProgressTasksByContextKey,
5
5
  init_db
6
- } from "./cli-d0t4854c.js";
6
+ } from "./cli-fedn86nz.js";
7
7
 
8
8
  // src/tasks/context-key.ts
9
9
  var SEPARATOR = ":";
@@ -7,7 +7,7 @@ import {
7
7
  } from "./cli-4wmnp8q3.js";
8
8
  import {
9
9
  createSwarmEventHandler
10
- } from "./cli-7xdq3jg3.js";
10
+ } from "./cli-92fqyjcv.js";
11
11
  import {
12
12
  resolveCodexPrompt
13
13
  } from "./cli-r94z9p1z.js";
@@ -25,7 +25,7 @@ import {
25
25
  getTaskById,
26
26
  init_db,
27
27
  setSlackMessageTracking
28
- } from "./cli-d0t4854c.js";
28
+ } from "./cli-fedn86nz.js";
29
29
  import {
30
30
  require_receiver,
31
31
  require_sender,
@@ -54980,13 +54980,13 @@ async function initSlackApp() {
54980
54980
  socketMode: true,
54981
54981
  logLevel: import_bolt.LogLevel.DEBUG
54982
54982
  });
54983
- const { registerMessageHandler } = await import("./handlers-wvwpk2kj.js");
54984
- const { registerCommandHandler } = await import("./commands-2wyn3swb.js");
54985
- const { registerActionHandlers } = await import("./actions-j9399ktm.js");
54983
+ const { registerMessageHandler } = await import("./handlers-hf61har3.js");
54984
+ const { registerCommandHandler } = await import("./commands-aqn63mcw.js");
54985
+ const { registerActionHandlers } = await import("./actions-7txktrdj.js");
54986
54986
  registerMessageHandler(app);
54987
54987
  registerCommandHandler(app);
54988
54988
  registerActionHandlers(app);
54989
- const { createAssistant } = await import("./assistant-c7y92gkw.js");
54989
+ const { createAssistant } = await import("./assistant-qpv63wk6.js");
54990
54990
  app.assistant(createAssistant());
54991
54991
  return app;
54992
54992
  }
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  require_typescript
3
- } from "./cli-qbc6mncp.js";
3
+ } from "./cli-gzepjz54.js";
4
4
  import {
5
5
  __toESM
6
6
  } from "./cli-p9swy5t3.js";
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  buildModelsDevSeedRows
3
- } from "./cli-stqqf5kh.js";
3
+ } from "./cli-m8f6qzck.js";
4
4
  import {
5
5
  createLogEntry,
6
6
  getActivePricingRow,
7
7
  getDb,
8
8
  init_db,
9
9
  insertPricingRow
10
- } from "./cli-d0t4854c.js";
10
+ } from "./cli-fedn86nz.js";
11
11
  import {
12
12
  init_secret_scrubber,
13
13
  scrubSecrets
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  getDb,
3
3
  init_db
4
- } from "./cli-d0t4854c.js";
4
+ } from "./cli-fedn86nz.js";
5
5
 
6
6
  // src/be/seed-pricing.ts
7
7
  init_db();
@@ -1,17 +1,19 @@
1
1
  import {
2
2
  handleScheduleTrigger
3
- } from "./cli-t2jk33ta.js";
3
+ } from "./cli-rttgde5f.js";
4
4
  import {
5
5
  createTaskWithSiblingAwareness,
6
6
  scheduleContextKey
7
- } from "./cli-r68m8arr.js";
7
+ } from "./cli-jt9d9fjw.js";
8
8
  import {
9
9
  getDb,
10
10
  getDueScheduledTasks,
11
11
  getScheduledTaskById,
12
12
  init_db,
13
+ init_telemetry,
14
+ telemetry,
13
15
  updateScheduledTask
14
- } from "./cli-d0t4854c.js";
16
+ } from "./cli-fedn86nz.js";
15
17
  import {
16
18
  __commonJS,
17
19
  __require,
@@ -6833,6 +6835,7 @@ var version = package_default.version;
6833
6835
  // src/scheduler/scheduler.ts
6834
6836
  init_db();
6835
6837
  var import_cron_parser = __toESM(require_dist(), 1);
6838
+ init_telemetry();
6836
6839
  var schedulerInterval = null;
6837
6840
  var isProcessing = false;
6838
6841
  var executorRegistry = null;
@@ -6860,8 +6863,8 @@ async function recoverMissedSchedules() {
6860
6863
  if (missedBy < 15000)
6861
6864
  continue;
6862
6865
  console.log(`[Scheduler] Recovering missed schedule "${schedule.name}" ` + `(was due ${Math.round(missedBy / 1000)}s ago)`);
6866
+ let triggeredWorkflows = false;
6863
6867
  try {
6864
- let triggeredWorkflows = false;
6865
6868
  if (executorRegistry) {
6866
6869
  const runIds = await handleScheduleTrigger(schedule.id, schedule, executorRegistry);
6867
6870
  if (runIds.length > 0) {
@@ -6893,7 +6896,18 @@ async function recoverMissedSchedules() {
6893
6896
  if (schedule.scheduleType === "one_time") {
6894
6897
  console.log(`[Scheduler] One-time schedule "${schedule.name}" recovered and auto-disabled`);
6895
6898
  }
6899
+ telemetry.schedule("executed", {
6900
+ scheduleType: schedule.scheduleType,
6901
+ triggeredWorkflows,
6902
+ wasRecovered: true
6903
+ });
6896
6904
  } catch (err) {
6905
+ telemetry.schedule("error", {
6906
+ scheduleType: schedule.scheduleType,
6907
+ triggeredWorkflows,
6908
+ wasRecovered: true,
6909
+ consecutiveErrors: schedule.consecutiveErrors ?? 0
6910
+ });
6897
6911
  console.error(`[Scheduler] Error recovering "${schedule.name}":`, err);
6898
6912
  }
6899
6913
  }
@@ -6929,8 +6943,8 @@ function getBackoffMs(consecutiveErrors) {
6929
6943
  return ERROR_BACKOFF_MS[Math.max(0, idx)] ?? ERROR_BACKOFF_MS[0];
6930
6944
  }
6931
6945
  async function executeSchedule(schedule) {
6946
+ let triggeredWorkflows = false;
6932
6947
  try {
6933
- let triggeredWorkflows = false;
6934
6948
  if (executorRegistry) {
6935
6949
  const runIds = await handleScheduleTrigger(schedule.id, schedule, executorRegistry);
6936
6950
  if (runIds.length > 0) {
@@ -6967,6 +6981,11 @@ async function executeSchedule(schedule) {
6967
6981
  });
6968
6982
  console.log(`[Scheduler] Executed schedule "${schedule.name}", next run: ${nextRun}`);
6969
6983
  }
6984
+ telemetry.schedule("executed", {
6985
+ scheduleType: schedule.scheduleType,
6986
+ triggeredWorkflows,
6987
+ wasRecovered: false
6988
+ });
6970
6989
  } catch (err) {
6971
6990
  const errorCount = (schedule.consecutiveErrors ?? 0) + 1;
6972
6991
  const now = new Date;
@@ -6990,6 +7009,12 @@ async function executeSchedule(schedule) {
6990
7009
  console.log(`[Scheduler] Backing off "${schedule.name}" for ${backoff / 1000}s`);
6991
7010
  }
6992
7011
  updateScheduledTask(schedule.id, updates);
7012
+ telemetry.schedule("error", {
7013
+ scheduleType: schedule.scheduleType,
7014
+ triggeredWorkflows,
7015
+ wasRecovered: false,
7016
+ consecutiveErrors: errorCount
7017
+ });
6993
7018
  }
6994
7019
  }
6995
7020
  function startScheduler(registry, intervalMs = 1e4, opts) {
@@ -15,10 +15,12 @@ import {
15
15
  getWorkflowRunStepsByRunId,
16
16
  getWorkflowsByScheduleId,
17
17
  init_db,
18
+ init_telemetry,
18
19
  init_template,
20
+ telemetry,
19
21
  updateWorkflowRun,
20
22
  updateWorkflowRunStep
21
- } from "./cli-d0t4854c.js";
23
+ } from "./cli-fedn86nz.js";
22
24
  import {
23
25
  init_secret_scrubber,
24
26
  isSensitiveKey
@@ -247,8 +249,12 @@ function applyDefinitionPatch(def, patch) {
247
249
  return { definition: patchedDef, errors };
248
250
  }
249
251
 
252
+ // src/workflows/template.ts
253
+ init_template();
254
+
250
255
  // src/workflows/engine.ts
251
256
  init_db();
257
+ init_telemetry();
252
258
 
253
259
  // src/workflows/checkpoint.ts
254
260
  init_db();
@@ -506,9 +512,6 @@ function typeOf(data) {
506
512
  return typeof data;
507
513
  }
508
514
 
509
- // src/workflows/engine.ts
510
- init_template();
511
-
512
515
  // src/workflows/validation.ts
513
516
  function extractPassResult(executorType, output) {
514
517
  if (!output || typeof output !== "object")
@@ -605,6 +608,11 @@ async function startWorkflowExecution(workflow, triggerData, registry, options =
605
608
  }
606
609
  const runId = crypto.randomUUID();
607
610
  createWorkflowRun({ id: runId, workflowId: workflow.id, triggerData });
611
+ telemetry.workflow("started", {
612
+ workflowId: workflow.id,
613
+ nodeCount: workflow.definition.nodes.length,
614
+ triggerType: options.triggerType ?? "manual"
615
+ });
608
616
  const ctx = { trigger: triggerData };
609
617
  if (options.requestedByUserId) {
610
618
  ctx.swarm = { requestedByUserId: options.requestedByUserId };
@@ -1047,7 +1055,9 @@ async function handleWebhookTrigger(workflowId, payload, headers, registry) {
1047
1055
  }
1048
1056
  }
1049
1057
  const triggerData = parseTriggerPayload(payload);
1050
- const runId = await startWorkflowExecution(workflow, triggerData, registry);
1058
+ const runId = await startWorkflowExecution(workflow, triggerData, registry, {
1059
+ triggerType: "event"
1060
+ });
1051
1061
  return { runId };
1052
1062
  }
1053
1063
  function parseTriggerPayload(payload) {
@@ -1070,7 +1080,9 @@ async function handleScheduleTrigger(scheduleId, schedule, registry) {
1070
1080
  scheduleName: schedule.name,
1071
1081
  firedAt: new Date().toISOString()
1072
1082
  };
1073
- const runId = await startWorkflowExecution(workflow, triggerData, registry);
1083
+ const runId = await startWorkflowExecution(workflow, triggerData, registry, {
1084
+ triggerType: "schedule"
1085
+ });
1074
1086
  runIds.push(runId);
1075
1087
  console.log(`[Triggers] Schedule "${schedule.name}" triggered workflow "${workflow.name}" (run: ${runId})`);
1076
1088
  }
@@ -1,16 +1,16 @@
1
1
  import {
2
2
  recordUnmappedIdentity
3
- } from "./cli-9qascwj7.js";
3
+ } from "./cli-2qynerth.js";
4
4
  import {
5
5
  findOrCreateUserByEmail,
6
6
  findUserByExternalId,
7
7
  linkIdentity
8
- } from "./cli-5bqa41fd.js";
8
+ } from "./cli-yfwwjeft.js";
9
9
  import {
10
10
  getKv,
11
11
  init_db,
12
12
  upsertKv
13
- } from "./cli-d0t4854c.js";
13
+ } from "./cli-fedn86nz.js";
14
14
 
15
15
  // src/slack/enrich.ts
16
16
  init_db();
@@ -1,20 +1,20 @@
1
1
  import {
2
2
  createAdditiveBuffer
3
- } from "./cli-zctkpdmd.js";
3
+ } from "./cli-dz3d6zjg.js";
4
4
  import {
5
5
  extractSlackMessageText
6
6
  } from "./cli-2deg0cen.js";
7
7
  import {
8
8
  getSlackApp,
9
9
  registerTreeMessage
10
- } from "./cli-sygq3fhn.js";
10
+ } from "./cli-kk51f3tf.js";
11
11
  import {
12
12
  buildBufferFlushBlocks
13
13
  } from "./cli-z92pkwzn.js";
14
14
  import {
15
15
  createTaskWithSiblingAwareness,
16
16
  slackContextKey
17
- } from "./cli-r68m8arr.js";
17
+ } from "./cli-jt9d9fjw.js";
18
18
  import {
19
19
  getLatestActiveTaskInThread,
20
20
  getLeadAgent,
@@ -22,7 +22,7 @@ import {
22
22
  init_db,
23
23
  init_registry,
24
24
  registerTemplate
25
- } from "./cli-d0t4854c.js";
25
+ } from "./cli-fedn86nz.js";
26
26
 
27
27
  // src/slack/event-dedup.ts
28
28
  var DEFAULT_TTL_MS = 300000;
@@ -3,7 +3,7 @@ import {
3
3
  init_date_utils,
4
4
  init_db,
5
5
  normalizeDateRequired
6
- } from "./cli-d0t4854c.js";
6
+ } from "./cli-fedn86nz.js";
7
7
 
8
8
  // src/be/db-queries/oauth.ts
9
9
  init_date_utils();
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  init_package,
3
3
  package_default
4
- } from "./cli-hc4rd6sv.js";
4
+ } from "./cli-85pf4z38.js";
5
5
 
6
6
  // src/commands/shared/client-config.ts
7
7
  init_package();