@desplega.ai/agent-swarm 1.103.0 → 1.105.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 (129) hide show
  1. package/README.md +3 -0
  2. package/dist/{actions-7txktrdj.js → actions-45g8tvc8.js} +6 -6
  3. package/dist/{app-xm3xsdye.js → app-18x5k1cj.js} +3 -3
  4. package/dist/{assistant-qpv63wk6.js → assistant-ka281qe8.js} +9 -10
  5. package/dist/{boot-reembed-9cxqka3e.js → boot-reembed-f38vbxw8.js} +4 -3
  6. package/dist/{boot-reembed-chxhrwv8.js → boot-reembed-rp2gba79.js} +5 -4
  7. package/dist/{boot-scrub-logs-8qtfkcz8.js → boot-scrub-logs-nsnc9f1a.js} +2 -2
  8. package/dist/{cli-gzepjz54.js → cli-0e24r2b6.js} +900 -352
  9. package/dist/{cli-dz3d6zjg.js → cli-0n4xxmy0.js} +121 -2
  10. package/dist/{cli-jt9d9fjw.js → cli-0s37sw3k.js} +1 -1
  11. package/dist/{cli-yeemwevj.js → cli-2hg6bj31.js} +20 -16
  12. package/dist/{cli-wjyyv518.js → cli-3j01d33e.js} +9 -14
  13. package/dist/{cli-xmtsan9k.js → cli-4df7btj0.js} +1 -1
  14. package/dist/{cli-8w95v19d.js → cli-634jy7sa.js} +351 -24
  15. package/dist/{cli-m8f6qzck.js → cli-7esh9fda.js} +1 -1
  16. package/dist/{cli-4fnp2tc3.js → cli-87fj1jk4.js} +1 -1
  17. package/dist/{cli-ksq38x4n.js → cli-8y7y1vmp.js} +2 -2
  18. package/dist/{cli-rvae030h.js → cli-ba47wf2q.js} +3 -3
  19. package/dist/{cli-2qynerth.js → cli-c4h8m0m3.js} +1 -1
  20. package/dist/{cli-fygaw191.js → cli-dd6tegmp.js} +2 -2
  21. package/dist/{cli-85pf4z38.js → cli-ehcjr5vs.js} +5 -3
  22. package/dist/{cli-rttgde5f.js → cli-gq7gvvrn.js} +1 -1
  23. package/dist/{cli-kk51f3tf.js → cli-gzmv1371.js} +5 -5
  24. package/dist/{http-zts4haq7.js → cli-sdf2qwkt.js} +83970 -76419
  25. package/dist/{cli-krvxq8bc.js → cli-sm9yseh1.js} +23 -4
  26. package/dist/{cli-8hyv6c2v.js → cli-v2fb1fxf.js} +41 -23
  27. package/dist/{cli-fwxdt7kt.js → cli-vpwffend.js} +30 -5
  28. package/dist/{cli-fedn86nz.js → cli-wztagmpk.js} +8 -3
  29. package/dist/{cli-v9283nma.js → cli-yd29d4n4.js} +1 -1
  30. package/dist/{cli-yfwwjeft.js → cli-yfyqsqzj.js} +1 -1
  31. package/dist/{cli-ns0r7mkr.js → cli-yzr0qxx1.js} +3 -3
  32. package/dist/{cli-s14sb64w.js → cli-zmta7t3y.js} +5 -7
  33. package/dist/cli.js +12 -10
  34. package/dist/{commands-aqn63mcw.js → commands-tn8zj0an.js} +2 -2
  35. package/dist/{db-azrvwsnj.js → db-gtqymk7r.js} +2 -2
  36. package/dist/{handlers-hf61har3.js → handlers-5xdqk40d.js} +10 -12
  37. package/dist/{hook-306p3yz4.js → hook-gj6j6zwj.js} +7 -5
  38. package/dist/http-4pceba9h.js +17374 -0
  39. package/dist/{index-bfh9hgek.js → index-0rfp6wh2.js} +5 -5
  40. package/dist/{index-3c651yfk.js → index-as4evz9g.js} +14 -11
  41. package/dist/{index-h2yqjyk0.js → index-paaw4xt5.js} +9 -8
  42. package/dist/{index-29vg51x6.js → index-wf0q4k03.js} +23 -10
  43. package/dist/{keepalive-a0dg5pds.js → keepalive-akbzjt41.js} +4 -4
  44. package/dist/{lead-7mcxedkc.js → lead-g8v85nf4.js} +19 -19
  45. package/dist/{maintenance-mrzqd53t.js → maintenance-9yrzmrh8.js} +5 -4
  46. package/dist/{onboard-4dkpv9wa.js → onboard-v5bx0kpy.js} +2 -2
  47. package/dist/{otel-impl-jt7gpyp9.js → otel-impl-530442da.js} +4510 -4465
  48. package/dist/{pricing-refresh-xqnzh8dt.js → pricing-refresh-dt289v11.js} +4 -4
  49. package/dist/{seed-pricing-56tjm1fj.js → seed-pricing-183er9b3.js} +3 -3
  50. package/dist/{setup-tbwk8j10.js → setup-tjgsvznx.js} +2 -2
  51. package/dist/{worker-e03za92t.js → worker-nxcxk5pb.js} +19 -19
  52. package/openapi.json +90 -4
  53. package/package.json +5 -3
  54. package/src/be/memory/constants.ts +6 -0
  55. package/src/be/memory/providers/sqlite-store.ts +468 -71
  56. package/src/be/memory/raters/retrieval.ts +4 -2
  57. package/src/be/memory/reranker.ts +5 -2
  58. package/src/be/memory/retrieval-store.ts +2 -0
  59. package/src/be/memory/types.ts +46 -0
  60. package/src/be/migrations/099_memory_structured_key_versioning.sql +41 -0
  61. package/src/be/migrations/100_memory_retrieval_source.sql +8 -0
  62. package/src/be/migrations/101_script_connections.sql +67 -0
  63. package/src/be/script-connections.ts +744 -0
  64. package/src/be/script-credential-broker.ts +38 -0
  65. package/src/be/scripts/typecheck.ts +23 -2
  66. package/src/be/seed-scripts/catalog/boot-triage.inline.ts +16 -4
  67. package/src/be/seed-scripts/catalog/boot-triage.ts +16 -4
  68. package/src/commands/runner.ts +8 -6
  69. package/src/heartbeat/heartbeat.ts +42 -1
  70. package/src/heartbeat/index.ts +7 -1
  71. package/src/http/memory.ts +127 -14
  72. package/src/http/pages-public.ts +123 -2
  73. package/src/http/scripts.ts +15 -14
  74. package/src/http/session-data.ts +16 -0
  75. package/src/otel-impl.ts +73 -0
  76. package/src/otel.ts +12 -0
  77. package/src/scripts-runtime/api-client.ts +100 -0
  78. package/src/scripts-runtime/api-types.ts +45 -0
  79. package/src/scripts-runtime/credential-broker/README.md +40 -0
  80. package/src/scripts-runtime/credential-broker/broker.ts +51 -0
  81. package/src/scripts-runtime/credential-broker/default-bindings.ts +19 -0
  82. package/src/scripts-runtime/credential-broker/fetch-patch.ts +102 -0
  83. package/src/scripts-runtime/credential-broker/index.ts +17 -0
  84. package/src/scripts-runtime/credential-broker/store.ts +72 -0
  85. package/src/scripts-runtime/credential-broker/types.ts +54 -0
  86. package/src/scripts-runtime/ctx.ts +11 -1
  87. package/src/scripts-runtime/egress-secrets.ts +14 -76
  88. package/src/scripts-runtime/eval-harness.ts +1 -1
  89. package/src/scripts-runtime/executors/types.ts +5 -5
  90. package/src/scripts-runtime/loader.ts +6 -1
  91. package/src/scripts-runtime/sdk-allowlist.ts +1 -0
  92. package/src/scripts-runtime/types/stdlib.d.ts +11 -0
  93. package/src/scripts-runtime/types/swarm-sdk.d.ts +11 -0
  94. package/src/server.ts +6 -0
  95. package/src/tests/credential-broker.test.ts +281 -0
  96. package/src/tests/heartbeat.test.ts +239 -0
  97. package/src/tests/memory-edit.test.ts +177 -0
  98. package/src/tests/memory-hybrid.test.ts +212 -0
  99. package/src/tests/otel-impl-secret-scrubbing.test.ts +101 -3
  100. package/src/tests/otel-session-cost-metrics.test.ts +281 -0
  101. package/src/tests/pages-authed-mode.test.ts +50 -0
  102. package/src/tests/runner-repo-autostash.test.ts +39 -8
  103. package/src/tests/script-connections.test.ts +360 -0
  104. package/src/tests/scripts-http.test.ts +16 -10
  105. package/src/tests/scripts-runtime-secret-egress.test.ts +26 -5
  106. package/src/tests/swarm-config-reserved-keys.test.ts +23 -0
  107. package/src/tests/update-schedule-mcp-tool.test.ts +83 -4
  108. package/src/tools/credential-bindings/index.ts +1 -0
  109. package/src/tools/credential-bindings/tool.ts +238 -0
  110. package/src/tools/memory-edit.ts +148 -0
  111. package/src/tools/memory-search.ts +17 -10
  112. package/src/tools/schedules/delete-schedule.ts +18 -8
  113. package/src/tools/schedules/update-schedule.ts +4 -9
  114. package/src/tools/script-connections/index.ts +1 -0
  115. package/src/tools/script-connections/tool.ts +167 -0
  116. package/src/tools/swarm-config/delete-config.ts +5 -0
  117. package/src/tools/swarm-config/set-config.ts +23 -1
  118. package/src/tools/tool-config.ts +6 -1
  119. package/src/types.ts +6 -0
  120. package/src/workflows/executors/swarm-script.ts +2 -0
  121. package/templates/community/dora-metrics/PLAYBOOK.md +294 -0
  122. package/templates/community/dora-metrics/README.md +39 -0
  123. package/templates/community/dora-metrics/lead-prompt.md +56 -0
  124. package/templates/community/dora-metrics/report.mjs +393 -0
  125. package/templates/community/dora-metrics/run.sh +113 -0
  126. package/templates/schedules/weekly-dora-metrics/config.json +13 -0
  127. package/templates/schedules/weekly-dora-metrics/content.md +61 -0
  128. package/dist/cli-2307phk1.js +0 -24223
  129. package/dist/cli-2deg0cen.js +0 -120
@@ -1,6 +1,7 @@
1
1
  import {
2
+ getScriptApiTypes,
2
3
  require_typescript
3
- } from "./cli-gzepjz54.js";
4
+ } from "./cli-0e24r2b6.js";
4
5
  import {
5
6
  __toESM
6
7
  } from "./cli-p9swy5t3.js";
@@ -132,6 +133,17 @@ export interface SwarmSdk {
132
133
 
133
134
  // --- write: memory ---
134
135
  memory_delete(args: { id: string }): Promise<unknown>;
136
+ memory_edit(args: {
137
+ memoryId?: string;
138
+ key?: string;
139
+ scope?: "agent" | "swarm";
140
+ mode?: "replace" | "exact";
141
+ content?: string;
142
+ oldString?: string;
143
+ newString?: string;
144
+ intent: string;
145
+ expectedVersion?: number;
146
+ }): Promise<unknown>;
135
147
  inject_learning(args: { content: string; name?: string; scope?: "agent" | "swarm"; source?: string; tags?: string[] }): Promise<unknown>;
136
148
 
137
149
  // --- write: tasks ---
@@ -285,6 +297,7 @@ export interface ScriptContext {
285
297
  run?: ScriptRunContext;
286
298
  step?: ScriptWorkflowSteps;
287
299
  swarm: SwarmSdk & { config: SwarmConfig };
300
+ api: ScriptApiRegistry;
288
301
  stdlib: ScriptStdlib;
289
302
  logger: ScriptLogger;
290
303
  }
@@ -292,6 +305,11 @@ export interface ScriptContext {
292
305
  // biome-ignore lint/suspicious/noExplicitAny: scripts may narrow their args type at the entrypoint.
293
306
  export type ScriptMain = (args: any, ctx: ScriptContext) => unknown | Promise<unknown>;
294
307
  `;
308
+ function scriptSdkTypesWithGeneratedApis(apiTypes = getScriptApiTypes()) {
309
+ return `${SCRIPT_SDK_TYPES}
310
+ ${apiTypes}
311
+ `;
312
+ }
295
313
  var SCRIPT_STDLIB_TYPES = `
296
314
  declare module "stdlib" {
297
315
  export interface Redacted<T> {
@@ -741,7 +759,7 @@ function toStructured(diag) {
741
759
  suggestion: extractSuggestion(message)
742
760
  };
743
761
  }
744
- function typecheckScript(source) {
762
+ function typecheckScript(source, context = {}) {
745
763
  const options = {
746
764
  allowImportingTsExtensions: true,
747
765
  lib: ["lib.es2022.d.ts"],
@@ -753,9 +771,10 @@ function typecheckScript(source) {
753
771
  target: import_typescript.default.ScriptTarget.ES2022,
754
772
  types: []
755
773
  };
774
+ const sdkTypes = scriptSdkTypesWithGeneratedApis(getScriptApiTypes(context));
756
775
  const files = new Map([
757
776
  [USER_FILE, source],
758
- [SDK_FILE, SCRIPT_SDK_TYPES],
777
+ [SDK_FILE, sdkTypes],
759
778
  [STDLIB_FILE, SCRIPT_STDLIB_TYPES],
760
779
  [RUNTIME_GLOBALS_FILE, SCRIPT_RUNTIME_GLOBALS],
761
780
  [
@@ -851,4 +870,4 @@ function extractScriptSignature(source) {
851
870
  return FALLBACK_SIGNATURE;
852
871
  }
853
872
 
854
- export { extractArgsJsonSchema, SCRIPT_SDK_TYPES, SCRIPT_STDLIB_TYPES, typecheckScript, extractScriptSignature };
873
+ export { extractArgsJsonSchema, scriptSdkTypesWithGeneratedApis, SCRIPT_STDLIB_TYPES, typecheckScript, extractScriptSignature };
@@ -2,10 +2,14 @@ import {
2
2
  getApiKey
3
3
  } from "./cli-f14fvzag.js";
4
4
  import {
5
+ CredentialBroker,
6
+ DEFAULT_CREDENTIAL_BINDINGS,
7
+ SwarmConfigCredentialBindingStore,
5
8
  getScript,
6
9
  getScriptVersion,
10
+ listRelationalCredentialBindings,
7
11
  validateScriptImports
8
- } from "./cli-gzepjz54.js";
12
+ } from "./cli-0e24r2b6.js";
9
13
  import {
10
14
  checkpointStep,
11
15
  checkpointStepFailure,
@@ -15,14 +19,14 @@ import {
15
19
  interpolateNodeConfig,
16
20
  runStepValidation,
17
21
  walkGraph
18
- } from "./cli-rttgde5f.js";
22
+ } from "./cli-gq7gvvrn.js";
19
23
  import {
20
24
  getAppUrl
21
25
  } from "./cli-dh55d5fg.js";
22
26
  import {
23
27
  withSiblingAwareness,
24
28
  workflowContextKey
25
- } from "./cli-jt9d9fjw.js";
29
+ } from "./cli-0s37sw3k.js";
26
30
  import {
27
31
  FollowUpConfigSchema,
28
32
  ModelTierSchema,
@@ -34,10 +38,12 @@ import {
34
38
  getDueWaitStates,
35
39
  getPendingEventWaitNames,
36
40
  getPendingWaitsByEvent,
41
+ getResolvedConfig,
37
42
  getRetryableSteps,
38
43
  getStuckApprovalRuns,
39
44
  getStuckWaitRuns,
40
45
  getStuckWorkflowRuns,
46
+ getSwarmConfigs,
41
47
  getTaskByWorkflowRunStepId,
42
48
  getWaitStateById,
43
49
  getWorkflow,
@@ -53,7 +59,7 @@ import {
53
59
  splitLegacyModelAlias,
54
60
  updateWorkflowRun,
55
61
  updateWorkflowRunStep
56
- } from "./cli-fedn86nz.js";
62
+ } from "./cli-wztagmpk.js";
57
63
  import {
58
64
  init_zod
59
65
  } from "./cli-q21d49ac.js";
@@ -62,6 +68,7 @@ import {
62
68
  } from "./cli-anrj584m.js";
63
69
  import {
64
70
  init_secret_scrubber,
71
+ registerVolatileSecret,
65
72
  scrubObject,
66
73
  scrubSecrets
67
74
  } from "./cli-3pp1362w.js";
@@ -1421,7 +1428,7 @@ class HumanInTheLoopExecutor extends BaseExecutor {
1421
1428
  }
1422
1429
  if (notification.channel === "slack") {
1423
1430
  try {
1424
- const { getSlackApp } = await import("./app-xm3xsdye.js");
1431
+ const { getSlackApp } = await import("./app-18x5k1cj.js");
1425
1432
  const slackApp = getSlackApp();
1426
1433
  if (!slackApp) {
1427
1434
  console.warn("[HITL] Slack not initialized — cannot send notification");
@@ -1535,7 +1542,7 @@ class NotifyExecutor extends BaseExecutor {
1535
1542
  }
1536
1543
  }
1537
1544
  case "slack": {
1538
- const { getSlackApp } = await import("./app-xm3xsdye.js");
1545
+ const { getSlackApp } = await import("./app-18x5k1cj.js");
1539
1546
  const app = getSlackApp();
1540
1547
  if (!app) {
1541
1548
  return {
@@ -1829,6 +1836,28 @@ class ScriptExecutor extends BaseExecutor {
1829
1836
  // src/workflows/executors/swarm-script.ts
1830
1837
  init_zod();
1831
1838
 
1839
+ // src/be/script-credential-broker.ts
1840
+ init_secret_scrubber();
1841
+ init_db();
1842
+ class RelationalCredentialBindingStore extends SwarmConfigCredentialBindingStore {
1843
+ listActiveBindings(context) {
1844
+ const relational = listRelationalCredentialBindings(context);
1845
+ if (relational.length > 0)
1846
+ return relational;
1847
+ return super.listActiveBindings(context);
1848
+ }
1849
+ }
1850
+ function buildScriptCredentialBindings(input) {
1851
+ const resolvedConfigs = getResolvedConfig(input.agentId, input.repoId);
1852
+ const configMap = new Map(resolvedConfigs.map((config) => [config.key, config.value]));
1853
+ const broker = new CredentialBroker(new RelationalCredentialBindingStore((filters) => getSwarmConfigs(filters)), (configKey) => configMap.get(configKey) ?? process.env[configKey], DEFAULT_CREDENTIAL_BINDINGS);
1854
+ const bindings = broker.resolveBindings({ agentId: input.agentId, repoId: input.repoId });
1855
+ for (const binding of bindings) {
1856
+ registerVolatileSecret(binding.value, binding.configKey);
1857
+ }
1858
+ return bindings;
1859
+ }
1860
+
1832
1861
  // src/scripts-runtime/executors/types.ts
1833
1862
  var DEFAULT_SCRIPT_RESOURCES = {
1834
1863
  memoryMb: 512,
@@ -1844,22 +1873,9 @@ var DEFAULT_SCRIPT_RESOURCES = {
1844
1873
  init_secret_scrubber();
1845
1874
 
1846
1875
  // src/scripts-runtime/egress-secrets.ts
1847
- var EGRESS_ALLOWLIST = {
1848
- GITHUB_TOKEN: ["api.github.com"]
1849
- };
1850
1876
  function buildEgressSecrets() {
1851
- const entries = [];
1852
- for (const [envKey, hosts] of Object.entries(EGRESS_ALLOWLIST)) {
1853
- const value = process.env[envKey];
1854
- if (!value)
1855
- continue;
1856
- entries.push({
1857
- placeholder: `[REDACTED:${envKey}]`,
1858
- hosts,
1859
- value
1860
- });
1861
- }
1862
- return entries;
1877
+ const broker = new CredentialBroker({ listActiveBindings: () => [] }, (configKey) => process.env[configKey], DEFAULT_CREDENTIAL_BINDINGS);
1878
+ return broker.resolveBindings({});
1863
1879
  }
1864
1880
 
1865
1881
  // src/scripts-runtime/executors/native.ts
@@ -2107,7 +2123,8 @@ function buildConfigPayload(input) {
2107
2123
  }
2108
2124
  },
2109
2125
  user: input.userConfig ?? {},
2110
- egressSecrets: buildEgressSecrets()
2126
+ egressSecrets: input.egressSecrets ?? buildEgressSecrets(),
2127
+ apiConnections: input.apiConnections ?? []
2111
2128
  };
2112
2129
  }
2113
2130
  async function runScript(input) {
@@ -2203,6 +2220,7 @@ class SwarmScriptExecutor extends BaseExecutor {
2203
2220
  args: config.args,
2204
2221
  fsMode: "none",
2205
2222
  agentId: agentId ?? "workflow",
2223
+ egressSecrets: buildScriptCredentialBindings({ agentId: agentId ?? undefined }),
2206
2224
  timeoutMs: config.timeoutMs
2207
2225
  });
2208
2226
  const workflowOutput = {
@@ -2560,4 +2578,4 @@ function initWorkflows() {
2560
2578
  initWaitBusSubscriptions(_registry);
2561
2579
  }
2562
2580
 
2563
- export { setupWorkflowResumeListener, retryFailedRun, cancelWorkflowRun, resumeWaitState, initWaitBusSubscriptions, subscribeWaitToBus, recoverIncompleteRuns, startRetryPoller, stopRetryPoller, validateTemplateVariables, instantiateTemplate, snapshotWorkflow, startWaitPoller, stopWaitPoller, RawLlmConfigSchema, executeRawLlm, runScript, getExecutorRegistry, initWorkflows };
2581
+ export { setupWorkflowResumeListener, retryFailedRun, cancelWorkflowRun, resumeWaitState, initWaitBusSubscriptions, subscribeWaitToBus, recoverIncompleteRuns, startRetryPoller, stopRetryPoller, validateTemplateVariables, instantiateTemplate, snapshotWorkflow, startWaitPoller, stopWaitPoller, RawLlmConfigSchema, executeRawLlm, buildScriptCredentialBindings, runScript, getExecutorRegistry, initWorkflows };
@@ -4,11 +4,11 @@ import {
4
4
  getNextResumeGeneration,
5
5
  getResumeGeneration,
6
6
  repointTrackerSyncBySwarmId
7
- } from "./cli-4fnp2tc3.js";
7
+ } from "./cli-87fj1jk4.js";
8
8
  import {
9
9
  getExecutorRegistry,
10
10
  recoverIncompleteRuns
11
- } from "./cli-8hyv6c2v.js";
11
+ } from "./cli-v2fb1fxf.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-fedn86nz.js";
46
+ } from "./cli-wztagmpk.js";
47
47
 
48
48
  // src/heartbeat/heartbeat.ts
49
49
  init_db();
@@ -347,6 +347,18 @@ function remediateCrashedWorkerTask(findings, task, opts) {
347
347
  if (remaining === 0)
348
348
  updateAgentStatus(task.agentId, "idle");
349
349
  }
350
+ function getBootEpochMs() {
351
+ const gs = globalThis;
352
+ const runId = gs.__runId;
353
+ if (!runId || typeof runId !== "string")
354
+ return null;
355
+ const match = runId.match(/^run_(\d+)$/);
356
+ if (!match)
357
+ return null;
358
+ const epoch = Number(match[1]);
359
+ return Number.isFinite(epoch) ? epoch : null;
360
+ }
361
+ var BOOT_EPOCH_SKEW_MS = 5000;
350
362
  async function runRebootSweep() {
351
363
  if (isSweeping) {
352
364
  console.log("[Heartbeat] Reboot sweep skipped — another sweep is running");
@@ -361,14 +373,27 @@ async function runRebootSweep() {
361
373
  return;
362
374
  }
363
375
  const reason = "Auto-failed by reboot sweep: worker session not found after server restart";
376
+ const bootEpoch = getBootEpochMs();
377
+ if (bootEpoch === null) {
378
+ console.warn("[Heartbeat] Reboot sweep: could not parse boot epoch from __runId — falling back to legacy session-exists check");
379
+ }
364
380
  for (const task of allInProgress) {
365
381
  if (!task.agentId) {
366
382
  console.warn(`[Heartbeat] Reboot sweep: skipping task ${task.id} — in_progress with no agentId`);
367
383
  continue;
368
384
  }
369
385
  const session = getActiveSessionForTask(task.id);
386
+ if (session) {
387
+ if (bootEpoch === null) {
388
+ continue;
389
+ }
390
+ const sessionLastSeen = new Date(session.lastHeartbeatAt).getTime();
391
+ if (sessionLastSeen >= bootEpoch - BOOT_EPOCH_SKEW_MS) {
392
+ continue;
393
+ }
394
+ }
370
395
  if (session)
371
- continue;
396
+ deleteActiveSession(task.id);
372
397
  const failed = failTask(task.id, reason);
373
398
  if (!failed)
374
399
  continue;
@@ -850,4 +875,4 @@ function stopHeartbeatChecklist() {
850
875
  console.log("[Heartbeat] Checklist stopped");
851
876
  }
852
877
  }
853
- export { runRebootSweep, getRebootAffectedTasks, checkHeartbeatChecklist, runHeartbeatSweep, startHeartbeat, stopHeartbeat };
878
+ export { getBootEpochMs, runRebootSweep, getRebootAffectedTasks, checkHeartbeatChecklist, runHeartbeatSweep, startHeartbeat, stopHeartbeat };
@@ -25,7 +25,7 @@ import {
25
25
  import {
26
26
  init_package,
27
27
  package_default
28
- } from "./cli-85pf4z38.js";
28
+ } from "./cli-ehcjr5vs.js";
29
29
  import {
30
30
  init_secret_scrubber,
31
31
  scrubSecrets
@@ -990,7 +990,8 @@ var init_types = __esm(() => {
990
990
  "system.boot",
991
991
  "system.migration",
992
992
  "system.error",
993
- "script.global_upsert"
993
+ "script.global_upsert",
994
+ "schedule.deleted"
994
995
  ]);
995
996
  SwarmEventSchema = object({
996
997
  id: uuid(),
@@ -1086,6 +1087,7 @@ var init_types = __esm(() => {
1086
1087
  id: string().uuid(),
1087
1088
  agentId: string().uuid().nullable(),
1088
1089
  scope: AgentMemoryScopeSchema,
1090
+ key: string().nullable().optional(),
1089
1091
  name: string().min(1).max(500),
1090
1092
  content: string(),
1091
1093
  summary: string().nullable(),
@@ -1096,10 +1098,13 @@ var init_types = __esm(() => {
1096
1098
  totalChunks: number().int().min(1).default(1),
1097
1099
  tags: array(string()),
1098
1100
  createdAt: string(),
1101
+ updatedAt: string().nullable().optional(),
1099
1102
  accessedAt: string(),
1100
1103
  expiresAt: string().nullable().optional(),
1101
1104
  accessCount: number().int().min(0).default(0).optional(),
1102
- embeddingModel: string().nullable().optional()
1105
+ embeddingModel: string().nullable().optional(),
1106
+ contentHash: string().nullable().optional(),
1107
+ version: number().int().min(1).default(1).optional()
1103
1108
  });
1104
1109
  ActiveSessionSchema = object({
1105
1110
  id: uuid(),
@@ -3,7 +3,7 @@ import {
3
3
  init_date_utils,
4
4
  init_db,
5
5
  normalizeDateRequired
6
- } from "./cli-fedn86nz.js";
6
+ } from "./cli-wztagmpk.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
  getDb,
3
3
  init_db
4
- } from "./cli-fedn86nz.js";
4
+ } from "./cli-wztagmpk.js";
5
5
 
6
6
  // src/be/users.ts
7
7
  init_db();
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  handleScheduleTrigger
3
- } from "./cli-rttgde5f.js";
3
+ } from "./cli-gq7gvvrn.js";
4
4
  import {
5
5
  createTaskWithSiblingAwareness,
6
6
  scheduleContextKey
7
- } from "./cli-jt9d9fjw.js";
7
+ } from "./cli-0s37sw3k.js";
8
8
  import {
9
9
  getDb,
10
10
  getDueScheduledTasks,
@@ -13,7 +13,7 @@ import {
13
13
  init_telemetry,
14
14
  telemetry,
15
15
  updateScheduledTask
16
- } from "./cli-fedn86nz.js";
16
+ } from "./cli-wztagmpk.js";
17
17
  import {
18
18
  __commonJS,
19
19
  __require,
@@ -1,20 +1,18 @@
1
1
  import {
2
- createAdditiveBuffer
3
- } from "./cli-dz3d6zjg.js";
4
- import {
2
+ createAdditiveBuffer,
5
3
  extractSlackMessageText
6
- } from "./cli-2deg0cen.js";
4
+ } from "./cli-0n4xxmy0.js";
7
5
  import {
8
6
  getSlackApp,
9
7
  registerTreeMessage
10
- } from "./cli-kk51f3tf.js";
8
+ } from "./cli-gzmv1371.js";
11
9
  import {
12
10
  buildBufferFlushBlocks
13
11
  } from "./cli-z92pkwzn.js";
14
12
  import {
15
13
  createTaskWithSiblingAwareness,
16
14
  slackContextKey
17
- } from "./cli-jt9d9fjw.js";
15
+ } from "./cli-0s37sw3k.js";
18
16
  import {
19
17
  getLatestActiveTaskInThread,
20
18
  getLeadAgent,
@@ -22,7 +20,7 @@ import {
22
20
  init_db,
23
21
  init_registry,
24
22
  registerTemplate
25
- } from "./cli-fedn86nz.js";
23
+ } from "./cli-wztagmpk.js";
26
24
 
27
25
  // src/slack/event-dedup.ts
28
26
  var DEFAULT_TTL_MS = 300000;
package/dist/cli.js CHANGED
@@ -62,7 +62,7 @@ var import_react = __toESM(require_react(), 1);
62
62
  // package.json
63
63
  var package_default = {
64
64
  name: "@desplega.ai/agent-swarm",
65
- version: "1.103.0",
65
+ version: "1.105.0",
66
66
  description: "Multi-agent orchestration for Claude Code, Codex, Gemini CLI, and other AI coding assistants",
67
67
  license: "MIT",
68
68
  author: "desplega.sh <contact@desplega.sh>",
@@ -182,12 +182,14 @@ var package_default = {
182
182
  "@inkjs/ui": "^2.0.0",
183
183
  "@linear/sdk": "^77.0.0",
184
184
  "@modelcontextprotocol/sdk": "^1.25.1",
185
- "@openai/codex-sdk": "^0.142.0",
186
- "@opencode-ai/sdk": "^1.17.9",
185
+ "@openai/codex-sdk": "^0.142.3",
186
+ "@opencode-ai/sdk": "^1.17.11",
187
187
  "@openfort/openfort-node": "^0.9.1",
188
188
  "@opentelemetry/api": "^1.9.1",
189
+ "@opentelemetry/exporter-metrics-otlp-http": "^0.218.0",
189
190
  "@opentelemetry/exporter-trace-otlp-http": "^0.218.0",
190
191
  "@opentelemetry/resources": "^2.7.1",
192
+ "@opentelemetry/sdk-metrics": "^2.7.1",
191
193
  "@opentelemetry/sdk-node": "^0.218.0",
192
194
  "@opentelemetry/semantic-conventions": "^1.41.1",
193
195
  "@slack/bolt": "^4.6.0",
@@ -616,7 +618,7 @@ function McpServer({ port, apiKey, dbPath }) {
616
618
  if (dbPath) {
617
619
  process.env.DATABASE_PATH = dbPath;
618
620
  }
619
- import("./http-zts4haq7.js").then(() => {
621
+ import("./http-4pceba9h.js").then(() => {
620
622
  setStatus("running");
621
623
  }).catch((err) => {
622
624
  setStatus("error");
@@ -702,7 +704,7 @@ function WorkerRunner({
702
704
  }) {
703
705
  const { exit } = use_app_default();
704
706
  import_react.useEffect(() => {
705
- import("./worker-e03za92t.js").then(({ runWorker }) => runWorker({
707
+ import("./worker-nxcxk5pb.js").then(({ runWorker }) => runWorker({
706
708
  prompt: prompt || undefined,
707
709
  yolo,
708
710
  systemPrompt: systemPrompt || undefined,
@@ -719,7 +721,7 @@ function WorkerRunner({
719
721
  function LeadRunner({ prompt, yolo, systemPrompt, systemPromptFile, additionalArgs }) {
720
722
  const { exit } = use_app_default();
721
723
  import_react.useEffect(() => {
722
- import("./lead-7mcxedkc.js").then(({ runLead }) => runLead({
724
+ import("./lead-g8v85nf4.js").then(({ runLead }) => runLead({
723
725
  prompt: prompt || undefined,
724
726
  yolo,
725
727
  systemPrompt: systemPrompt || undefined,
@@ -759,8 +761,8 @@ function LazyComponent({
759
761
  }
760
762
  return import_react.createElement(Component, props);
761
763
  }
762
- var loadOnboard = () => import("./onboard-4dkpv9wa.js").then(({ Onboard }) => Onboard);
763
- var loadConnect = () => import("./setup-tbwk8j10.js").then(({ Setup }) => Setup);
764
+ var loadOnboard = () => import("./onboard-v5bx0kpy.js").then(({ Onboard }) => Onboard);
765
+ var loadConnect = () => import("./setup-tjgsvznx.js").then(({ Setup }) => Setup);
764
766
  function UnknownCommand({ command }) {
765
767
  const { exit } = use_app_default();
766
768
  import_react.useEffect(() => {
@@ -873,7 +875,7 @@ ${binName} docs \u2014 v${package_default.version}
873
875
  }
874
876
  process.exit(0);
875
877
  } else if (args.command === "hook") {
876
- const { runHook } = await import("./hook-306p3yz4.js");
878
+ const { runHook } = await import("./hook-gj6j6zwj.js");
877
879
  await runHook();
878
880
  } else if (args.command === "artifact") {
879
881
  const artifactArgs = process.argv.slice(process.argv.indexOf("artifact") + 1);
@@ -893,7 +895,7 @@ ${binName} docs \u2014 v${package_default.version}
893
895
  printHelp("scripts");
894
896
  process.exit(scriptsArgs[0] === "reembed" || args.showHelp ? 0 : 1);
895
897
  }
896
- const { runScriptsMaintenanceCommand } = await import("./maintenance-mrzqd53t.js");
898
+ const { runScriptsMaintenanceCommand } = await import("./maintenance-9yrzmrh8.js");
897
899
  await runScriptsMaintenanceCommand(scriptsArgs);
898
900
  console.log("Scripts re-embedded.");
899
901
  } else if (args.command === "codex-login") {
@@ -2,11 +2,11 @@ import {
2
2
  getAllAgents,
3
3
  getAllTasks,
4
4
  init_db
5
- } from "./cli-fedn86nz.js";
5
+ } from "./cli-wztagmpk.js";
6
6
  import"./cli-z2zcxes1.js";
7
7
  import"./cli-q21d49ac.js";
8
8
  import"./cli-anrj584m.js";
9
- import"./cli-85pf4z38.js";
9
+ import"./cli-ehcjr5vs.js";
10
10
  import"./cli-3pp1362w.js";
11
11
  import"./cli-p9swy5t3.js";
12
12
 
@@ -376,11 +376,11 @@ import {
376
376
  upsertSkillFile,
377
377
  upsertSkillFiles,
378
378
  upsertSwarmConfig
379
- } from "./cli-fedn86nz.js";
379
+ } from "./cli-wztagmpk.js";
380
380
  import"./cli-z2zcxes1.js";
381
381
  import"./cli-q21d49ac.js";
382
382
  import"./cli-anrj584m.js";
383
- import"./cli-85pf4z38.js";
383
+ import"./cli-ehcjr5vs.js";
384
384
  import"./cli-3pp1362w.js";
385
385
  import"./cli-p9swy5t3.js";
386
386
  init_db();
@@ -3,26 +3,24 @@ import {
3
3
  getBufferMessageCount,
4
4
  instantFlush,
5
5
  wasEventSeen
6
- } from "./cli-s14sb64w.js";
6
+ } from "./cli-zmta7t3y.js";
7
7
  import {
8
+ extractSlackMessageText,
8
9
  extractTaskFromMessage,
9
10
  hasOtherUserMention,
10
11
  routeMessage
11
- } from "./cli-dz3d6zjg.js";
12
- import {
13
- extractSlackMessageText
14
- } from "./cli-2deg0cen.js";
12
+ } from "./cli-0n4xxmy0.js";
15
13
  import {
16
14
  registerTreeMessage
17
- } from "./cli-kk51f3tf.js";
15
+ } from "./cli-gzmv1371.js";
18
16
  import"./cli-fete3y1e.js";
19
17
  import"./cli-b0p7rfnd.js";
20
18
  import {
21
19
  enrichSlackUserEmail,
22
20
  resolveSlackUserId
23
- } from "./cli-rvae030h.js";
24
- import"./cli-2qynerth.js";
25
- import"./cli-yfwwjeft.js";
21
+ } from "./cli-ba47wf2q.js";
22
+ import"./cli-c4h8m0m3.js";
23
+ import"./cli-yfyqsqzj.js";
26
24
  import {
27
25
  buildTreeBlocks
28
26
  } from "./cli-z92pkwzn.js";
@@ -30,7 +28,7 @@ import"./cli-dh55d5fg.js";
30
28
  import {
31
29
  createTaskWithSiblingAwareness,
32
30
  slackContextKey
33
- } from "./cli-jt9d9fjw.js";
31
+ } from "./cli-0s37sw3k.js";
34
32
  import {
35
33
  getAgentById,
36
34
  getAgentWorkingOnThread,
@@ -40,11 +38,11 @@ import {
40
38
  init_db,
41
39
  init_resolver,
42
40
  resolveTemplate
43
- } from "./cli-fedn86nz.js";
41
+ } from "./cli-wztagmpk.js";
44
42
  import"./cli-z2zcxes1.js";
45
43
  import"./cli-q21d49ac.js";
46
44
  import"./cli-anrj584m.js";
47
- import"./cli-85pf4z38.js";
45
+ import"./cli-ehcjr5vs.js";
48
46
  import"./cli-3pp1362w.js";
49
47
  import"./cli-e15jhafb.js";
50
48
  import {
@@ -1,7 +1,3 @@
1
- import {
2
- contentSha256,
3
- readIdentityBaselines
4
- } from "./cli-wjyyv518.js";
5
1
  import {
6
2
  summarizeSession
7
3
  } from "./cli-p03mawph.js";
@@ -21,6 +17,11 @@ import {
21
17
  import {
22
18
  getApiKey
23
19
  } from "./cli-f14fvzag.js";
20
+ import {
21
+ contentSha256,
22
+ init_profile_sync,
23
+ readIdentityBaselines
24
+ } from "./cli-3j01d33e.js";
24
25
  import {
25
26
  getMcpBaseUrl
26
27
  } from "./cli-dh55d5fg.js";
@@ -29,7 +30,7 @@ import"./cli-anrj584m.js";
29
30
  import {
30
31
  init_package,
31
32
  package_default
32
- } from "./cli-85pf4z38.js";
33
+ } from "./cli-ehcjr5vs.js";
33
34
  import"./cli-3pp1362w.js";
34
35
  import"./cli-xw7p4wkq.js";
35
36
  import"./cli-4wgngmwv.js";
@@ -39,6 +40,7 @@ import"./cli-p9swy5t3.js";
39
40
 
40
41
  // src/hooks/hook.ts
41
42
  init_package();
43
+ init_profile_sync();
42
44
  var SERVER_NAME = package_default.config?.name ?? "agent-swarm";
43
45
  var CLAUDE_MD_PATH = `${process.env.HOME}/.claude/CLAUDE.md`;
44
46
  var CLAUDE_MD_BACKUP_PATH = `${process.env.HOME}/.claude/CLAUDE.md.bak`;