@desplega.ai/agent-swarm 1.103.0 → 1.104.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 (122) hide show
  1. package/README.md +2 -0
  2. package/dist/{actions-7txktrdj.js → actions-2expzt47.js} +6 -6
  3. package/dist/{app-xm3xsdye.js → app-dr8hwx7z.js} +3 -3
  4. package/dist/{assistant-qpv63wk6.js → assistant-9rhgsw7v.js} +9 -10
  5. package/dist/{boot-reembed-chxhrwv8.js → boot-reembed-3q1aywnz.js} +5 -4
  6. package/dist/{boot-reembed-9cxqka3e.js → boot-reembed-9kt97g1z.js} +4 -3
  7. package/dist/{boot-scrub-logs-8qtfkcz8.js → boot-scrub-logs-vskq108e.js} +2 -2
  8. package/dist/{cli-fedn86nz.js → cli-0jw6j755.js} +8 -3
  9. package/dist/{cli-yeemwevj.js → cli-23zk7xqy.js} +20 -16
  10. package/dist/{cli-v9283nma.js → cli-2g9jf9ek.js} +1 -1
  11. package/dist/{cli-rvae030h.js → cli-2hap19dv.js} +3 -3
  12. package/dist/{cli-wjyyv518.js → cli-3j01d33e.js} +9 -14
  13. package/dist/{cli-8hyv6c2v.js → cli-54h5daha.js} +41 -23
  14. package/dist/{cli-fygaw191.js → cli-5pf0b84v.js} +2 -2
  15. package/dist/{cli-m8f6qzck.js → cli-7v4y3hyd.js} +1 -1
  16. package/dist/{cli-fwxdt7kt.js → cli-d4z1csms.js} +30 -5
  17. package/dist/{cli-jt9d9fjw.js → cli-e7bwjntj.js} +1 -1
  18. package/dist/{cli-s14sb64w.js → cli-etvgz5x8.js} +5 -7
  19. package/dist/{cli-2qynerth.js → cli-gj2n2ec1.js} +1 -1
  20. package/dist/{cli-dz3d6zjg.js → cli-nzc0h54v.js} +121 -2
  21. package/dist/{cli-8w95v19d.js → cli-p4cj4vhc.js} +351 -24
  22. package/dist/{cli-xmtsan9k.js → cli-q5tshxd6.js} +1 -1
  23. package/dist/{http-zts4haq7.js → cli-qvzgncd8.js} +83966 -76422
  24. package/dist/{cli-4fnp2tc3.js → cli-s42f54ja.js} +1 -1
  25. package/dist/{cli-krvxq8bc.js → cli-t9v14cnd.js} +23 -4
  26. package/dist/{cli-gzepjz54.js → cli-v1syqkcb.js} +900 -352
  27. package/dist/{cli-ksq38x4n.js → cli-w1nfskkg.js} +2 -2
  28. package/dist/{cli-ns0r7mkr.js → cli-y9p3e94h.js} +3 -3
  29. package/dist/{cli-85pf4z38.js → cli-yjt8a36k.js} +3 -3
  30. package/dist/{cli-yfwwjeft.js → cli-yvektv79.js} +1 -1
  31. package/dist/{cli-kk51f3tf.js → cli-zaxksbgj.js} +5 -5
  32. package/dist/{cli-rttgde5f.js → cli-zghef0em.js} +1 -1
  33. package/dist/cli.js +10 -10
  34. package/dist/{commands-aqn63mcw.js → commands-wfrkef57.js} +2 -2
  35. package/dist/{db-azrvwsnj.js → db-c42pxt7h.js} +2 -2
  36. package/dist/{handlers-hf61har3.js → handlers-n36zkfvx.js} +10 -12
  37. package/dist/{hook-306p3yz4.js → hook-gw3vhv6s.js} +7 -5
  38. package/dist/http-59ygpn2h.js +17263 -0
  39. package/dist/{index-h2yqjyk0.js → index-881c1baf.js} +9 -8
  40. package/dist/{index-29vg51x6.js → index-jca7jdpt.js} +23 -10
  41. package/dist/{index-bfh9hgek.js → index-xf6fp4y1.js} +5 -5
  42. package/dist/{index-3c651yfk.js → index-xz8vaa5c.js} +14 -11
  43. package/dist/{keepalive-a0dg5pds.js → keepalive-mj4302vw.js} +4 -4
  44. package/dist/{lead-7mcxedkc.js → lead-qm0xjvkv.js} +19 -19
  45. package/dist/{maintenance-mrzqd53t.js → maintenance-xppxbe4t.js} +5 -4
  46. package/dist/{onboard-4dkpv9wa.js → onboard-ejx6yxh8.js} +2 -2
  47. package/dist/{otel-impl-jt7gpyp9.js → otel-impl-zs5exkpk.js} +1 -1
  48. package/dist/{pricing-refresh-xqnzh8dt.js → pricing-refresh-nqyf8bkb.js} +4 -4
  49. package/dist/{seed-pricing-56tjm1fj.js → seed-pricing-w3x550cj.js} +3 -3
  50. package/dist/{setup-tbwk8j10.js → setup-7729ktfj.js} +2 -2
  51. package/dist/{worker-e03za92t.js → worker-4ttemwhw.js} +19 -19
  52. package/openapi.json +90 -4
  53. package/package.json +3 -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/scripts.ts +15 -14
  73. package/src/scripts-runtime/api-client.ts +100 -0
  74. package/src/scripts-runtime/api-types.ts +45 -0
  75. package/src/scripts-runtime/credential-broker/README.md +40 -0
  76. package/src/scripts-runtime/credential-broker/broker.ts +51 -0
  77. package/src/scripts-runtime/credential-broker/default-bindings.ts +19 -0
  78. package/src/scripts-runtime/credential-broker/fetch-patch.ts +102 -0
  79. package/src/scripts-runtime/credential-broker/index.ts +17 -0
  80. package/src/scripts-runtime/credential-broker/store.ts +72 -0
  81. package/src/scripts-runtime/credential-broker/types.ts +54 -0
  82. package/src/scripts-runtime/ctx.ts +11 -1
  83. package/src/scripts-runtime/egress-secrets.ts +14 -76
  84. package/src/scripts-runtime/eval-harness.ts +1 -1
  85. package/src/scripts-runtime/executors/types.ts +5 -5
  86. package/src/scripts-runtime/loader.ts +6 -1
  87. package/src/scripts-runtime/sdk-allowlist.ts +1 -0
  88. package/src/scripts-runtime/types/stdlib.d.ts +11 -0
  89. package/src/scripts-runtime/types/swarm-sdk.d.ts +11 -0
  90. package/src/server.ts +6 -0
  91. package/src/tests/credential-broker.test.ts +281 -0
  92. package/src/tests/heartbeat.test.ts +239 -0
  93. package/src/tests/memory-edit.test.ts +177 -0
  94. package/src/tests/memory-hybrid.test.ts +212 -0
  95. package/src/tests/runner-repo-autostash.test.ts +39 -8
  96. package/src/tests/script-connections.test.ts +360 -0
  97. package/src/tests/scripts-http.test.ts +16 -10
  98. package/src/tests/scripts-runtime-secret-egress.test.ts +26 -5
  99. package/src/tests/swarm-config-reserved-keys.test.ts +23 -0
  100. package/src/tests/update-schedule-mcp-tool.test.ts +83 -4
  101. package/src/tools/credential-bindings/index.ts +1 -0
  102. package/src/tools/credential-bindings/tool.ts +238 -0
  103. package/src/tools/memory-edit.ts +148 -0
  104. package/src/tools/memory-search.ts +17 -10
  105. package/src/tools/schedules/delete-schedule.ts +18 -8
  106. package/src/tools/schedules/update-schedule.ts +4 -9
  107. package/src/tools/script-connections/index.ts +1 -0
  108. package/src/tools/script-connections/tool.ts +167 -0
  109. package/src/tools/swarm-config/delete-config.ts +5 -0
  110. package/src/tools/swarm-config/set-config.ts +23 -1
  111. package/src/tools/tool-config.ts +6 -1
  112. package/src/types.ts +6 -0
  113. package/src/workflows/executors/swarm-script.ts +2 -0
  114. package/templates/community/dora-metrics/PLAYBOOK.md +294 -0
  115. package/templates/community/dora-metrics/README.md +39 -0
  116. package/templates/community/dora-metrics/lead-prompt.md +56 -0
  117. package/templates/community/dora-metrics/report.mjs +393 -0
  118. package/templates/community/dora-metrics/run.sh +113 -0
  119. package/templates/schedules/weekly-dora-metrics/config.json +13 -0
  120. package/templates/schedules/weekly-dora-metrics/content.md +61 -0
  121. package/dist/cli-2307phk1.js +0 -24223
  122. package/dist/cli-2deg0cen.js +0 -120
package/README.md CHANGED
@@ -123,10 +123,12 @@ Check [our templates](https://templates.agent-swarm.dev) for a quick start.
123
123
 
124
124
  - **Lead/worker orchestration in Docker** — isolated dev environments, priority queues, pause/resume across deploys. [Architecture →](https://docs.agent-swarm.dev/docs/architecture/overview)
125
125
  - **Compounding memory & persistent identity** — agents remember past sessions and evolve their own persona, expertise, and notes. [Memory →](https://docs.agent-swarm.dev/docs/architecture/memory) · [Agents →](https://docs.agent-swarm.dev/docs/architecture/agents)
126
+ - **Hybrid memory recall + in-place edits** — memory retrieval can blend vector and full-text ranking, and agents can correct an existing memory without losing its ID or history. [Memory →](https://docs.agent-swarm.dev/docs/architecture/memory) · [MCP tools →](https://docs.agent-swarm.dev/docs/reference/mcp-tools#memory-tools)
126
127
  - **Multi-channel inputs** — Slack, GitHub, GitLab, email, WhatsApp, Linear, Jira, and the HTTP API all create tasks. [Integrations](#integrations)
127
128
  - **Workflow engine with Human-in-the-Loop** — DAG-based automation with approval gates, retries, and structured I/O. [Workflows →](https://docs.agent-swarm.dev/docs/concepts/workflows)
128
129
  - **Scheduled & recurring tasks** — cron-based automation for standing work. [Scheduling →](https://docs.agent-swarm.dev/docs/concepts/scheduling)
129
130
  - **Durable script workflows** — launch background script runs, inspect their journals, and track them from the dashboard when a one-shot `script-run` is too small. [Guide →](https://docs.agent-swarm.dev/docs/guides/script-workflow-runs)
131
+ - **Typed script API connections** — lead-managed OpenAPI connections let scripts call approved external APIs through generated `ctx.api.*` clients while credential bindings keep raw secrets out of source and args. [Guide →](https://docs.agent-swarm.dev/docs/guides/scripts-credential-broker)
130
132
  - **E2B-backed eval harness** — run a scenario × harness-config matrix against real swarm stacks, capture transcripts/artifacts, and grade outcomes with deterministic checks plus LLM or agentic judges. [Guide →](https://docs.agent-swarm.dev/docs/guides/evals-harness)
131
133
  - **Harness & LLM agnostic** — run with Claude Code, Claude Bridge, OpenAI Codex, pi-mono (Anthropic, OpenRouter, or Amazon Bedrock), Devin, Claude Managed Agents, raw LLMs, or opencode. Tasks, schedules, and workflow agent-task nodes can use portable `modelTier` intent (`smol`, `regular`, `smart`, `ultra`) and resolve it per worker/provider at run time. [Harness config →](https://docs.agent-swarm.dev/docs/guides/harness-configuration) · [Add a new provider →](https://docs.agent-swarm.dev/docs/guides/harness-providers)
132
134
  - **Follow-up continuity across all harnesses** — child tasks inherit a bounded prior-task context preamble built from the task chain, so continuity survives restarts and works the same across every provider. [Task lifecycle →](https://docs.agent-swarm.dev/docs/concepts/task-lifecycle)
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  resolveSlackUserId
3
- } from "./cli-rvae030h.js";
4
- import"./cli-2qynerth.js";
5
- import"./cli-yfwwjeft.js";
3
+ } from "./cli-2hap19dv.js";
4
+ import"./cli-gj2n2ec1.js";
5
+ import"./cli-yvektv79.js";
6
6
  import {
7
7
  buildCancelledBlocks,
8
8
  getTaskLink
@@ -11,18 +11,18 @@ import"./cli-dh55d5fg.js";
11
11
  import {
12
12
  createTaskWithSiblingAwareness,
13
13
  slackContextKey
14
- } from "./cli-jt9d9fjw.js";
14
+ } from "./cli-e7bwjntj.js";
15
15
  import {
16
16
  cancelTask,
17
17
  getAgentById,
18
18
  getLeadAgent,
19
19
  getTaskById,
20
20
  init_db
21
- } from "./cli-fedn86nz.js";
21
+ } from "./cli-0jw6j755.js";
22
22
  import"./cli-z2zcxes1.js";
23
23
  import"./cli-q21d49ac.js";
24
24
  import"./cli-anrj584m.js";
25
- import"./cli-85pf4z38.js";
25
+ import"./cli-yjt8a36k.js";
26
26
  import"./cli-3pp1362w.js";
27
27
  import"./cli-p9swy5t3.js";
28
28
 
@@ -3,16 +3,16 @@ import {
3
3
  initSlackApp,
4
4
  startSlackApp,
5
5
  stopSlackApp
6
- } from "./cli-kk51f3tf.js";
6
+ } from "./cli-zaxksbgj.js";
7
7
  import"./cli-fete3y1e.js";
8
8
  import"./cli-b0p7rfnd.js";
9
9
  import"./cli-z92pkwzn.js";
10
10
  import"./cli-dh55d5fg.js";
11
- import"./cli-fedn86nz.js";
11
+ import"./cli-0jw6j755.js";
12
12
  import"./cli-z2zcxes1.js";
13
13
  import"./cli-q21d49ac.js";
14
14
  import"./cli-anrj584m.js";
15
- import"./cli-85pf4z38.js";
15
+ import"./cli-yjt8a36k.js";
16
16
  import"./cli-3pp1362w.js";
17
17
  import"./cli-e15jhafb.js";
18
18
  import"./cli-p9swy5t3.js";
@@ -1,27 +1,26 @@
1
1
  import {
2
2
  bufferThreadMessage,
3
3
  wasEventSeen
4
- } from "./cli-s14sb64w.js";
4
+ } from "./cli-etvgz5x8.js";
5
5
  import {
6
6
  hasOtherUserMention
7
- } from "./cli-dz3d6zjg.js";
8
- import"./cli-2deg0cen.js";
7
+ } from "./cli-nzc0h54v.js";
9
8
  import {
10
9
  require_dist
11
- } from "./cli-kk51f3tf.js";
10
+ } from "./cli-zaxksbgj.js";
12
11
  import"./cli-fete3y1e.js";
13
12
  import"./cli-b0p7rfnd.js";
14
13
  import {
15
14
  resolveSlackUserId
16
- } from "./cli-rvae030h.js";
17
- import"./cli-2qynerth.js";
18
- import"./cli-yfwwjeft.js";
15
+ } from "./cli-2hap19dv.js";
16
+ import"./cli-gj2n2ec1.js";
17
+ import"./cli-yvektv79.js";
19
18
  import"./cli-z92pkwzn.js";
20
19
  import"./cli-dh55d5fg.js";
21
20
  import {
22
21
  createTaskWithSiblingAwareness,
23
22
  slackContextKey
24
- } from "./cli-jt9d9fjw.js";
23
+ } from "./cli-e7bwjntj.js";
25
24
  import {
26
25
  getAgentWorkingOnThread,
27
26
  getLeadAgent,
@@ -29,11 +28,11 @@ import {
29
28
  init_db,
30
29
  init_resolver,
31
30
  resolveTemplate
32
- } from "./cli-fedn86nz.js";
31
+ } from "./cli-0jw6j755.js";
33
32
  import"./cli-z2zcxes1.js";
34
33
  import"./cli-q21d49ac.js";
35
34
  import"./cli-anrj584m.js";
36
- import"./cli-85pf4z38.js";
35
+ import"./cli-yjt8a36k.js";
37
36
  import"./cli-3pp1362w.js";
38
37
  import"./cli-e15jhafb.js";
39
38
  import {
@@ -1,16 +1,17 @@
1
1
  import {
2
2
  embedScript,
3
3
  embeddingProvider
4
- } from "./cli-fygaw191.js";
5
- import"./cli-8w95v19d.js";
4
+ } from "./cli-5pf0b84v.js";
5
+ import"./cli-p4cj4vhc.js";
6
+ import"./cli-3j01d33e.js";
6
7
  import {
7
8
  getDb,
8
9
  init_db
9
- } from "./cli-fedn86nz.js";
10
+ } from "./cli-0jw6j755.js";
10
11
  import"./cli-z2zcxes1.js";
11
12
  import"./cli-q21d49ac.js";
12
13
  import"./cli-anrj584m.js";
13
- import"./cli-85pf4z38.js";
14
+ import"./cli-yjt8a36k.js";
14
15
  import"./cli-3pp1362w.js";
15
16
  import"./cli-p9swy5t3.js";
16
17
 
@@ -3,15 +3,16 @@ import {
3
3
  getEmbeddingProvider,
4
4
  getMemoryStore,
5
5
  init_constants
6
- } from "./cli-8w95v19d.js";
6
+ } from "./cli-p4cj4vhc.js";
7
+ import"./cli-3j01d33e.js";
7
8
  import {
8
9
  getDb,
9
10
  init_db
10
- } from "./cli-fedn86nz.js";
11
+ } from "./cli-0jw6j755.js";
11
12
  import"./cli-z2zcxes1.js";
12
13
  import"./cli-q21d49ac.js";
13
14
  import"./cli-anrj584m.js";
14
- import"./cli-85pf4z38.js";
15
+ import"./cli-yjt8a36k.js";
15
16
  import"./cli-3pp1362w.js";
16
17
  import"./cli-p9swy5t3.js";
17
18
 
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  getDb,
3
3
  init_db
4
- } from "./cli-fedn86nz.js";
4
+ } from "./cli-0jw6j755.js";
5
5
  import"./cli-z2zcxes1.js";
6
6
  import"./cli-q21d49ac.js";
7
7
  import"./cli-anrj584m.js";
8
- import"./cli-85pf4z38.js";
8
+ import"./cli-yjt8a36k.js";
9
9
  import {
10
10
  init_secret_scrubber,
11
11
  scrubSecrets
@@ -25,7 +25,7 @@ import {
25
25
  import {
26
26
  init_package,
27
27
  package_default
28
- } from "./cli-85pf4z38.js";
28
+ } from "./cli-yjt8a36k.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(),
@@ -1,9 +1,3 @@
1
- import {
2
- contentSha256,
3
- resolveClaudeMdPath,
4
- syncProfileFilesToServer,
5
- writeIdentityBaselines
6
- } from "./cli-wjyyv518.js";
7
1
  import {
8
2
  authJsonToCredentialSelection,
9
3
  checkCodexCredentials,
@@ -29,7 +23,7 @@ import {
29
23
  withSpan,
30
24
  withSpanContext,
31
25
  writeSkillsToFilesystem
32
- } from "./cli-2307phk1.js";
26
+ } from "./cli-qvzgncd8.js";
33
27
  import {
34
28
  checkClaudeCredentials
35
29
  } from "./cli-p04j6hjv.js";
@@ -46,13 +40,20 @@ import {
46
40
  import {
47
41
  getApiKey
48
42
  } from "./cli-f14fvzag.js";
43
+ import {
44
+ contentSha256,
45
+ init_profile_sync,
46
+ resolveClaudeMdPath,
47
+ syncProfileFilesToServer,
48
+ writeIdentityBaselines
49
+ } from "./cli-3j01d33e.js";
49
50
  import {
50
51
  ensure,
51
52
  initialize
52
- } from "./cli-ns0r7mkr.js";
53
+ } from "./cli-y9p3e94h.js";
53
54
  import {
54
55
  validateJsonSchema
55
- } from "./cli-rttgde5f.js";
56
+ } from "./cli-zghef0em.js";
56
57
  import {
57
58
  getMcpBaseUrl
58
59
  } from "./cli-dh55d5fg.js";
@@ -75,7 +76,7 @@ import {
75
76
  resolveTaskModelSelection,
76
77
  resolveTemplateAsync,
77
78
  telemetry
78
- } from "./cli-fedn86nz.js";
79
+ } from "./cli-0jw6j755.js";
79
80
  import {
80
81
  init_credentials,
81
82
  resolveCredentialPools
@@ -1463,6 +1464,9 @@ async function awaitCredentials(opts) {
1463
1464
  return status;
1464
1465
  }
1465
1466
 
1467
+ // src/commands/runner.ts
1468
+ init_profile_sync();
1469
+
1466
1470
  // src/commands/resume-session.ts
1467
1471
  var RESUME_DEPRECATED_REASON = "native resume deprecated — using context preamble";
1468
1472
  function resolveResumeSession(_currentProvider, candidates) {
@@ -1539,7 +1543,7 @@ async function readClaudeMd(clonePath, role) {
1539
1543
  }
1540
1544
  async function listSwarmAutostashes(clonePath, role) {
1541
1545
  try {
1542
- const result = await Bun.$`cd ${clonePath} && git stash list --format=%gd%x09%s`.quiet();
1546
+ const result = await Bun.$`env -u GIT_DIR -u GIT_WORK_TREE -u GIT_INDEX_FILE -u GIT_PREFIX git -C ${clonePath} stash list --format=%gd%x09%s`.quiet();
1543
1547
  return result.text().split(`
1544
1548
  `).map((line) => line.trim()).filter((line) => line.includes("swarm-autostash")).flatMap((line) => {
1545
1549
  const [ref, ...messageParts] = line.split("\t");
@@ -1554,14 +1558,14 @@ async function listSwarmAutostashes(clonePath, role) {
1554
1558
  }
1555
1559
  async function refreshExistingRepoForTask(repoConfig, role) {
1556
1560
  const { name, clonePath, defaultBranch } = repoConfig;
1557
- const statusResult = await Bun.$`cd ${clonePath} && git status --porcelain`.quiet();
1561
+ const statusResult = await Bun.$`env -u GIT_DIR -u GIT_WORK_TREE -u GIT_INDEX_FILE -u GIT_PREFIX git -C ${clonePath} status --porcelain`.quiet();
1558
1562
  const statusOutput = statusResult.text().trim();
1559
1563
  let stashMessage = null;
1560
1564
  if (statusOutput !== "") {
1561
1565
  stashMessage = `swarm-autostash ${defaultBranch} ${new Date().toISOString()}`;
1562
1566
  try {
1563
1567
  console.log(`[${role}] Auto-stashing pending work in ${name}: ${stashMessage}`);
1564
- await Bun.$`cd ${clonePath} && git stash push --include-untracked -m ${stashMessage}`.quiet();
1568
+ await Bun.$`env -u GIT_DIR -u GIT_WORK_TREE -u GIT_INDEX_FILE -u GIT_PREFIX git -C ${clonePath} stash push --include-untracked -m ${stashMessage}`.quiet();
1565
1569
  console.log(`[${role}] Auto-stashed pending work in ${name}`);
1566
1570
  } catch (err) {
1567
1571
  const errorMsg = scrubSecrets(err.message);
@@ -1573,15 +1577,15 @@ async function refreshExistingRepoForTask(repoConfig, role) {
1573
1577
  console.log(`[${role}] Refreshing ${name} from origin/${defaultBranch}...`);
1574
1578
  const fetchSpec = `${defaultBranch}:refs/remotes/origin/${defaultBranch}`;
1575
1579
  const remoteRef = `refs/remotes/origin/${defaultBranch}`;
1576
- await Bun.$`cd ${clonePath} && git fetch origin ${fetchSpec}`.quiet();
1577
- await Bun.$`cd ${clonePath} && git merge --no-edit --no-stat ${remoteRef}`.quiet();
1580
+ await Bun.$`env -u GIT_DIR -u GIT_WORK_TREE -u GIT_INDEX_FILE -u GIT_PREFIX git -C ${clonePath} fetch origin ${fetchSpec}`.quiet();
1581
+ await Bun.$`env -u GIT_DIR -u GIT_WORK_TREE -u GIT_INDEX_FILE -u GIT_PREFIX git -C ${clonePath} merge --no-edit --no-stat ${remoteRef}`.quiet();
1578
1582
  console.log(`[${role}] Refreshed ${name}`);
1579
1583
  return null;
1580
1584
  } catch (err) {
1581
1585
  const errorMsg = scrubSecrets(err.message);
1582
1586
  console.warn(`[${role}] Could not refresh ${name}: ${errorMsg}`);
1583
1587
  try {
1584
- await Bun.$`cd ${clonePath} && git merge --abort`.quiet();
1588
+ await Bun.$`env -u GIT_DIR -u GIT_WORK_TREE -u GIT_INDEX_FILE -u GIT_PREFIX git -C ${clonePath} merge --abort`.quiet();
1585
1589
  } catch {}
1586
1590
  const stashNote = stashMessage ? ` Pending work was preserved in git stash "${stashMessage}".` : "";
1587
1591
  return `The repo "${name}" at ${clonePath} could not be refreshed from origin/${defaultBranch}: ${errorMsg}.${stashNote}`;
@@ -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-0jw6j755.js";
7
7
 
8
8
  // src/be/db-queries/oauth.ts
9
9
  init_date_utils();
@@ -1,16 +1,16 @@
1
1
  import {
2
2
  recordUnmappedIdentity
3
- } from "./cli-2qynerth.js";
3
+ } from "./cli-gj2n2ec1.js";
4
4
  import {
5
5
  findOrCreateUserByEmail,
6
6
  findUserByExternalId,
7
7
  linkIdentity
8
- } from "./cli-yfwwjeft.js";
8
+ } from "./cli-yvektv79.js";
9
9
  import {
10
10
  getKv,
11
11
  init_db,
12
12
  upsertKv
13
- } from "./cli-fedn86nz.js";
13
+ } from "./cli-0jw6j755.js";
14
14
 
15
15
  // src/slack/enrich.ts
16
16
  init_db();
@@ -2,15 +2,11 @@ import {
2
2
  init_secret_scrubber,
3
3
  scrubSecrets
4
4
  } from "./cli-3pp1362w.js";
5
+ import {
6
+ __esm
7
+ } from "./cli-p9swy5t3.js";
5
8
 
6
9
  // src/commands/profile-sync.ts
7
- init_secret_scrubber();
8
- var SOUL_MD_PATH = "/workspace/SOUL.md";
9
- var IDENTITY_MD_PATH = "/workspace/IDENTITY.md";
10
- var TOOLS_MD_PATH = "/workspace/TOOLS.md";
11
- var HEARTBEAT_MD_PATH = "/workspace/HEARTBEAT.md";
12
- var SETUP_SCRIPT_PATH = "/workspace/start-up.sh";
13
- var IDENTITY_BASELINES_PATH = "/tmp/identity-baselines.json";
14
10
  function contentSha256(content) {
15
11
  return new Bun.CryptoHasher("sha256").update(content).digest("hex");
16
12
  }
@@ -27,12 +23,6 @@ async function readIdentityBaselines(readFile = readFileIfExists) {
27
23
  return null;
28
24
  }
29
25
  }
30
- var CLAUDE_MD_PATH = `${process.env.HOME}/.claude/CLAUDE.md`;
31
- var WORKSPACE_CLAUDE_MD_PATH = "/workspace/CLAUDE.md";
32
- var IDENTITY_FILE_MIN_LENGTH = 500;
33
- var MAX_FILE_LENGTH = 65536;
34
- var SETUP_MARKER_START = "# === Agent-managed setup (from DB) ===";
35
- var SETUP_MARKER_END = "# === End agent-managed setup ===";
36
26
  function resolveClaudeMdPath(completedProviders) {
37
27
  const anyNonClaude = completedProviders.some((p) => p !== "claude");
38
28
  return anyNonClaude ? WORKSPACE_CLAUDE_MD_PATH : CLAUDE_MD_PATH;
@@ -163,5 +153,10 @@ async function syncProfileFilesToServer(opts) {
163
153
  await postProfileUpdate(opts, payload);
164
154
  }
165
155
  }
156
+ var SOUL_MD_PATH = "/workspace/SOUL.md", IDENTITY_MD_PATH = "/workspace/IDENTITY.md", TOOLS_MD_PATH = "/workspace/TOOLS.md", HEARTBEAT_MD_PATH = "/workspace/HEARTBEAT.md", SETUP_SCRIPT_PATH = "/workspace/start-up.sh", IDENTITY_BASELINES_PATH = "/tmp/identity-baselines.json", CLAUDE_MD_PATH, WORKSPACE_CLAUDE_MD_PATH = "/workspace/CLAUDE.md", IDENTITY_FILE_MIN_LENGTH = 500, MAX_FILE_LENGTH = 65536, SETUP_MARKER_START = "# === Agent-managed setup (from DB) ===", SETUP_MARKER_END = "# === End agent-managed setup ===";
157
+ var init_profile_sync = __esm(() => {
158
+ init_secret_scrubber();
159
+ CLAUDE_MD_PATH = `${process.env.HOME}/.claude/CLAUDE.md`;
160
+ });
166
161
 
167
- export { contentSha256, writeIdentityBaselines, readIdentityBaselines, resolveClaudeMdPath, syncProfileFilesToServer };
162
+ export { contentSha256, writeIdentityBaselines, readIdentityBaselines, resolveClaudeMdPath, syncProfileFilesToServer, init_profile_sync };
@@ -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-v1syqkcb.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-zghef0em.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-e7bwjntj.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-0jw6j755.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-dr8hwx7z.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-dr8hwx7z.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
  getEmbeddingProvider,
5
5
  init_embedding,
6
6
  serializeEmbedding
7
- } from "./cli-8w95v19d.js";
7
+ } from "./cli-p4cj4vhc.js";
8
8
  import {
9
9
  getDb,
10
10
  init_db
11
- } from "./cli-fedn86nz.js";
11
+ } from "./cli-0jw6j755.js";
12
12
  import {
13
13
  init_secret_scrubber,
14
14
  scrubSecrets
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  getDb,
3
3
  init_db
4
- } from "./cli-fedn86nz.js";
4
+ } from "./cli-0jw6j755.js";
5
5
 
6
6
  // src/be/seed-pricing.ts
7
7
  init_db();
@@ -4,11 +4,11 @@ import {
4
4
  getNextResumeGeneration,
5
5
  getResumeGeneration,
6
6
  repointTrackerSyncBySwarmId
7
- } from "./cli-4fnp2tc3.js";
7
+ } from "./cli-s42f54ja.js";
8
8
  import {
9
9
  getExecutorRegistry,
10
10
  recoverIncompleteRuns
11
- } from "./cli-8hyv6c2v.js";
11
+ } from "./cli-54h5daha.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-0jw6j755.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 };
@@ -3,7 +3,7 @@ import {
3
3
  getAgentById,
4
4
  getInProgressTasksByContextKey,
5
5
  init_db
6
- } from "./cli-fedn86nz.js";
6
+ } from "./cli-0jw6j755.js";
7
7
 
8
8
  // src/tasks/context-key.ts
9
9
  var SEPARATOR = ":";