@desplega.ai/agent-swarm 1.141.0 → 1.142.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 (178) hide show
  1. package/README.md +2 -2
  2. package/dist/{acp-adapter-nymf4qqx.js → acp-adapter-6jn4n9bf.js} +170 -18
  3. package/dist/{actions-g062r5pe.js → actions-1x7qhjcp.js} +6 -6
  4. package/dist/{app-y2gfznm7.js → app-1gqhr0zw.js} +3 -3
  5. package/dist/{assistant-7b1vz5qy.js → assistant-ywk5t26k.js} +8 -8
  6. package/dist/{boot-reembed-c7ezxtjj.js → boot-reembed-45rvpb3m.js} +4 -4
  7. package/dist/{boot-reembed-zwt66k10.js → boot-reembed-vvgj1fgk.js} +3 -3
  8. package/dist/{boot-scrub-logs-q2hq46vf.js → boot-scrub-logs-k83hm16a.js} +2 -2
  9. package/dist/{claude-adapter-jw7k5x7m.js → claude-adapter-gcxv09ga.js} +4 -3
  10. package/dist/{cli-sa6p8nqc.js → cli-0afy4jqg.js} +340 -11
  11. package/dist/{cli-0ejv5tq1.js → cli-15atwe0d.js} +2 -2
  12. package/dist/{cli-tzzvqbww.js → cli-2ed3wv25.js} +1 -1
  13. package/dist/{cli-tbkvywy2.js → cli-48akq54x.js} +1 -1
  14. package/dist/cli-6kgqmh9y.js +888 -0
  15. package/dist/{cli-xnsxc136.js → cli-6spqz3tg.js} +1 -1
  16. package/dist/{cli-gwaxg2pw.js → cli-8bg3den1.js} +4 -3
  17. package/dist/{cli-ae7g0pp7.js → cli-a6297e83.js} +106 -9
  18. package/dist/{cli-wqs1rz1c.js → cli-bc101wmn.js} +3 -3
  19. package/dist/cli-dgnj0zcc.js +40 -0
  20. package/dist/{cli-bbj8e2ws.js → cli-dxt17ymm.js} +2 -2
  21. package/dist/{cli-1smbv79b.js → cli-er2z53kh.js} +13 -6
  22. package/dist/{cli-sebnvgzq.js → cli-jt7k9yw5.js} +1 -1
  23. package/dist/{cli-fewd407e.js → cli-kfrk073c.js} +1 -1
  24. package/dist/{cli-gchvp5qh.js → cli-myfb8t15.js} +2 -2
  25. package/dist/{cli-0z1cjytc.js → cli-pt7gxw9n.js} +73 -17
  26. package/dist/{cli-fzwndvcp.js → cli-pw4gxcx1.js} +2 -2
  27. package/dist/{cli-9kz7k41f.js → cli-qmsts4ef.js} +10 -3
  28. package/dist/{cli-bmjg0n8y.js → cli-rsa49w51.js} +1 -1
  29. package/dist/{cli-68n7t6am.js → cli-s0w91tq3.js} +6 -6
  30. package/dist/{cli-ks1x39f4.js → cli-s84fa8td.js} +5 -5
  31. package/dist/{cli-hgwjr0wx.js → cli-tbtxpj2k.js} +28 -26
  32. package/dist/{cli-xeckvc7v.js → cli-thdvmrm6.js} +317 -315
  33. package/dist/{cli-2dycsvxt.js → cli-vf5b436q.js} +5 -3
  34. package/dist/{cli-e6wan0s7.js → cli-vp3sksy6.js} +1 -1
  35. package/dist/{cli-b4e7hnqh.js → cli-vqk6rxns.js} +1 -1
  36. package/dist/{cli-wqkg9vgk.js → cli-vqxttjd7.js} +3 -3
  37. package/dist/{cli-ktajvfc1.js → cli-wvdvxjep.js} +2 -810
  38. package/dist/cli-y89t4nca.js +67 -0
  39. package/dist/{cli-169dk2km.js → cli-z6wjvew7.js} +1 -1
  40. package/dist/cli.js +29 -14
  41. package/dist/{codex-adapter-em9hjrrg.js → codex-adapter-xvgkg755.js} +2 -1
  42. package/dist/{codex-session-runner-mtav6xyd.js → codex-session-runner-1d1ercsj.js} +2 -1
  43. package/dist/{commands-1tw7002f.js → commands-k6hhe7ne.js} +2 -2
  44. package/dist/{db-xvs6h6sy.js → db-w2qb9rss.js} +2 -2
  45. package/dist/{handlers-x3tfy39f.js → handlers-v52he40q.js} +8 -8
  46. package/dist/{hook-1d9m6edx.js → hook-dq02k126.js} +1 -1
  47. package/dist/{hook-7ga5tttv.js → hook-tyqkv069.js} +2 -2
  48. package/dist/{http-vmmy7mdd.js → http-x6fy2qbf.js} +1279 -328
  49. package/dist/{index-khs88v9c.js → index-1b2phtyf.js} +12 -11
  50. package/dist/{index-v0m6fre7.js → index-82913rbj.js} +12 -10
  51. package/dist/{index-zktsxh13.js → index-jmrvpb83.js} +1744 -12
  52. package/dist/{index-gcebknc7.js → index-wdmwar6v.js} +15 -11
  53. package/dist/{keepalive-n30kyw2p.js → keepalive-5axh79td.js} +4 -4
  54. package/dist/{lead-zha0ntzq.js → lead-7p1rnqt5.js} +24 -22
  55. package/dist/{maintenance-y0a823n0.js → maintenance-mkkk6xtc.js} +4 -4
  56. package/dist/{oauth-refresh-sweep-tp81bvd0.js → oauth-refresh-sweep-924sa8gn.js} +3 -3
  57. package/dist/{onboard-kqzbksgg.js → onboard-7220gcnm.js} +103 -11
  58. package/dist/{otel-impl-bgseftwt.js → otel-impl-h4zhfrtn.js} +1 -1
  59. package/dist/{pricing-refresh-1tv644rp.js → pricing-refresh-wekg4ay3.js} +4 -4
  60. package/dist/{rbac-roles-pyh65xw7.js → rbac-roles-19qa0m3a.js} +3 -3
  61. package/dist/{rbac-roles-nbqjqb3h.js → rbac-roles-tx0er4z4.js} +2 -2
  62. package/dist/{render-v2-bz6wnfqp.js → render-v2-hh0d7dyx.js} +3 -3
  63. package/dist/{seed-pricing-4kamyke2.js → seed-pricing-z2snez0a.js} +3 -3
  64. package/dist/{setup-ks1rgmvn.js → setup-zrp530my.js} +2 -2
  65. package/dist/{worker-tgq76zn6.js → worker-2va0xbjz.js} +24 -22
  66. package/openapi.json +882 -2
  67. package/package.json +5 -3
  68. package/src/be/automation-preflight.test.ts +319 -0
  69. package/src/be/automation-preflight.ts +418 -0
  70. package/src/be/db.ts +60 -4
  71. package/src/be/migrations/141_scheduled_task_automation_preflight.sql +135 -0
  72. package/src/be/migrations/142_workflow_automation_preflight.sql +62 -0
  73. package/src/be/models-catalog.ts +4 -3
  74. package/src/be/seed/registry.ts +9 -1
  75. package/src/be/seed/schedules-seeder.ts +247 -0
  76. package/src/be/seed/workflows-seeder.ts +237 -0
  77. package/src/cli.tsx +14 -1
  78. package/src/commands/onboard/compose-generator.ts +7 -3
  79. package/src/commands/onboard/non-interactive.ts +24 -0
  80. package/src/commands/onboard/presets.ts +54 -0
  81. package/src/commands/onboard/types.ts +3 -0
  82. package/src/commands/onboard.tsx +29 -7
  83. package/src/commands/provider-credentials.ts +29 -1
  84. package/src/commands/runner.ts +70 -7
  85. package/src/http/agents.ts +102 -4
  86. package/src/http/schedules.ts +10 -0
  87. package/src/http/script-runs.ts +6 -6
  88. package/src/http/status.ts +109 -51
  89. package/src/http/workflows.ts +18 -0
  90. package/src/providers/acp-adapter.ts +117 -17
  91. package/src/providers/acp-target-catalog.ts +60 -0
  92. package/src/providers/acp-targets.ts +101 -7
  93. package/src/providers/claude-adapter.ts +44 -35
  94. package/src/providers/codex-adapter.ts +47 -36
  95. package/src/scheduler/scheduler.ts +88 -2
  96. package/src/script-workflows/capability-bridge.ts +245 -0
  97. package/src/script-workflows/executor.ts +378 -54
  98. package/src/script-workflows/guest-ctx.ts +49 -0
  99. package/src/script-workflows/harness.ts +75 -93
  100. package/src/script-workflows/supervisor.ts +2 -2
  101. package/src/script-workflows/swarm-capabilities.ts +13 -0
  102. package/src/script-workflows/workflow-ctx.ts +41 -12
  103. package/src/scripts-runtime/executors/native.ts +34 -26
  104. package/src/tests/acp-adapter.test.ts +156 -2
  105. package/src/tests/acp-dashboard-runtime.test.ts +6 -0
  106. package/src/tests/agents-harness-provider.test.ts +71 -0
  107. package/src/tests/credential-status-api.test.ts +51 -0
  108. package/src/tests/models-catalog.test.ts +2 -1
  109. package/src/tests/onboard-compose.test.ts +48 -0
  110. package/src/tests/onboard-non-interactive.test.ts +87 -1
  111. package/src/tests/provider-process-group.test.ts +105 -0
  112. package/src/tests/schedule-target-type.test.ts +355 -1
  113. package/src/tests/script-connections.test.ts +4 -0
  114. package/src/tests/script-executor-conformance.test.ts +20 -9
  115. package/src/tests/script-workflow-capability-bridge.test.ts +201 -0
  116. package/src/tests/script-workflows-runtime-e2e.test.ts +293 -3
  117. package/src/tests/seed-registry.test.ts +54 -0
  118. package/src/tests/seed-schedules.test.ts +121 -0
  119. package/src/tests/seed-workflows.test.ts +134 -0
  120. package/src/tests/status.test.ts +85 -1
  121. package/src/tests/ui-e2e-ingest-payload.test.ts +257 -0
  122. package/src/tests/ui-e2e-publish-plan.test.ts +250 -0
  123. package/src/tests/workflow-ctx.test.ts +12 -30
  124. package/src/tests/workflow-engine-v2.test.ts +92 -0
  125. package/src/tests/workflow-executors.test.ts +5 -8
  126. package/src/tests/workflow-http-v2.test.ts +72 -3
  127. package/src/tests/workflow-template-prompt-injection.test.ts +111 -0
  128. package/src/tests/workflow-triggers-v2.test.ts +31 -0
  129. package/src/tools/workflows/create-workflow.ts +1 -1
  130. package/src/types.ts +76 -4
  131. package/src/utils/process-group.ts +92 -0
  132. package/src/workflows/engine.ts +39 -1
  133. package/src/workflows/executors/script.ts +23 -14
  134. package/src/workflows/index.ts +19 -1
  135. package/src/workflows/triggers.ts +25 -0
  136. package/src/workflows/version.ts +3 -0
  137. package/templates/schedules/daily-blocker-digest/config.json +2 -1
  138. package/templates/schedules/daily-blocker-digest/content.md +3 -1
  139. package/templates/schedules/daily-compounding-reflection/config.json +3 -5
  140. package/templates/schedules/daily-compounding-reflection/content.md +4 -1
  141. package/templates/schedules/daily-hn-briefing/config.json +2 -1
  142. package/templates/schedules/daily-hn-briefing/content.md +6 -4
  143. package/templates/schedules/daily-status-report/config.json +14 -0
  144. package/templates/schedules/daily-status-report/content.md +80 -0
  145. package/templates/schedules/daily-workflow-health-audit/config.json +2 -1
  146. package/templates/schedules/daily-workflow-health-audit/content.md +3 -1
  147. package/templates/schedules/gtm-weekly-review/config.json +2 -1
  148. package/templates/schedules/gtm-weekly-review/content.md +32 -12
  149. package/templates/schedules/weekly-code-health-reports/config.json +2 -1
  150. package/templates/schedules/weekly-code-health-reports/content.md +12 -10
  151. package/templates/schedules/weekly-dependabot-triage/config.json +2 -1
  152. package/templates/schedules/weekly-dependabot-triage/content.md +5 -3
  153. package/templates/schedules/weekly-dora-metrics/config.json +2 -1
  154. package/templates/schedules/weekly-dora-metrics/content.md +12 -10
  155. package/templates/schedules/weekly-harness-upgrade-check/config.json +14 -0
  156. package/templates/schedules/weekly-harness-upgrade-check/content.md +82 -0
  157. package/templates/skills/artifacts/content.md +1 -1
  158. package/templates/workflows/alerts-triage/config.json +14 -0
  159. package/templates/workflows/alerts-triage/content.md +17 -0
  160. package/templates/workflows/autopilot/config.json +1 -0
  161. package/templates/workflows/autopilot/content.md +3 -52
  162. package/templates/workflows/claude-code-changelog-watch/config.json +14 -0
  163. package/templates/workflows/claude-code-changelog-watch/content.md +11 -0
  164. package/templates/workflows/competitor-radar/config.json +14 -0
  165. package/templates/workflows/competitor-radar/content.md +7 -0
  166. package/templates/workflows/docs-site-releases/config.json +14 -0
  167. package/templates/workflows/docs-site-releases/content.md +12 -0
  168. package/templates/workflows/gsc-topic-miner/config.json +14 -0
  169. package/templates/workflows/gsc-topic-miner/content.md +7 -0
  170. package/templates/workflows/linear-drain-loop/config.json +2 -4
  171. package/templates/workflows/linear-drain-loop/content.md +5 -35
  172. package/templates/workflows/llm-safe-release-context/config.json +1 -0
  173. package/templates/workflows/llm-safe-release-context/content.md +4 -2
  174. package/templates/workflows/pr-review-status-sweep/config.json +14 -0
  175. package/templates/workflows/pr-review-status-sweep/content.md +10 -0
  176. package/templates/workflows/ralph-loop/config.json +1 -0
  177. package/templates/workflows/ralph-loop/content.md +3 -33
  178. package/tsconfig.json +1 -0
package/README.md CHANGED
@@ -127,12 +127,12 @@ Check [our templates](https://templates.agent-swarm.dev) for a quick start.
127
127
  - **Multi-channel inputs** — Slack, GitHub, GitLab, email, WhatsApp, Linear, Jira, and the HTTP API all create tasks. [Integrations](#integrations)
128
128
  - **Slack operations and persistent thread trees** — lead agents can create, populate, and archive channels, while conversations can opt in to one editable task tree with streamed outcome cards and explicit Block Kit messages. [Slack guide →](https://docs.agent-swarm.dev/docs/integrations/slack)
129
129
  - **Workflow engine with Human-in-the-Loop** — DAG-based automation with approval gates, retries, structured I/O, and `foreach` fan-out that rejoins child agent tasks deterministically. [Workflows →](https://docs.agent-swarm.dev/docs/concepts/workflows)
130
- - **Scheduled & recurring tasks** — cron-based automation for standing work, with schedules that can target agent tasks, workflows, or catalog scripts. [Scheduling →](https://docs.agent-swarm.dev/docs/concepts/scheduling)
130
+ - **Scheduled & recurring tasks** — cron-based automation for standing work, with schedules that can target agent tasks, workflows, or catalog scripts. Bundled automations declare their required parameters and integrations; if enabled before setup is complete, they remain in `needs_setup` instead of dispatching. [Scheduling →](https://docs.agent-swarm.dev/docs/concepts/scheduling)
131
131
  - **Mid-run task steering** — add context at the next turn boundary, request an immediate interrupt where the harness supports it, or degrade safely to a follow-up task. [Task steering →](https://docs.agent-swarm.dev/docs/guides/task-steering)
132
132
  - **Operator configuration UI** — tune non-secret feature flags, limits, integration toggles, and runtime defaults from Settings → Configuration, with source and restart-required indicators. [Configuration →](https://docs.agent-swarm.dev/docs/ui/configuration)
133
133
  - **Asset namespaces** — group tasks, workflows, schedules, pages, apps, scripts, and mapped files under canonical shared or personal keys, with inheritance, subtree filtering, audited moves, and cross-entity discovery. [Asset namespaces →](https://docs.agent-swarm.dev/docs/guides/asset-namespaces)
134
134
  - **Persistent shared files via agent-fs** — co-deploy agent-fs for shared task attachments, previews, and search; `store-progress` verifies attachment pointers before changing task state, late provisioning or config reloads activate the provider without an API restart, and tenant-authenticated control planes can invite shared-org members without receiving the bootstrap key. [Co-deployment guide →](https://docs.agent-swarm.dev/docs/guides/agent-fs-co-deployment)
135
- - **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)
135
+ - **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. User code runs in a credential-free guest while authenticated swarm operations stay behind a capability broker. [Guide →](https://docs.agent-swarm.dev/docs/guides/script-workflow-runs)
136
136
  - **Scripts-only MCP mode (code-mode)** — reduce the external MCP surface to eight script tools while retaining the full swarm SDK through `script-run`, cutting tool-schema context for capable coordinator models. [Guide →](https://docs.agent-swarm.dev/docs/guides/scripts-only-mode)
137
137
  - **Scripts as external APIs** — expose a saved script as a public `POST /api/x/script/<id>` endpoint with optional bearer auth, typed input validation, and per-endpoint usage tracking. [Guide →](https://docs.agent-swarm.dev/docs/guides/scripts-external-apis)
138
138
  - **Typed script API connections** — lead-managed OpenAPI, GraphQL, and MCP connections generate `ctx.api.*` / `ctx.mcp.*` clients for scripts, with credential bindings and OAuth-backed auth kept server-side. [Guide →](https://docs.agent-swarm.dev/docs/guides/script-connections)
@@ -1,6 +1,15 @@
1
+ import {
2
+ getAcpTargetCatalogEntry,
3
+ isAcpTarget
4
+ } from "./cli-dgnj0zcc.js";
1
5
  import {
2
6
  fetchInstalledMcpServers
3
7
  } from "./cli-tng3131n.js";
8
+ import {
9
+ detachedProcessGroup,
10
+ registerProcessGroup,
11
+ terminateProcessGroup
12
+ } from "./cli-y89t4nca.js";
4
13
  import"./cli-rx5cxzn2.js";
5
14
  import {
6
15
  array,
@@ -20,7 +29,7 @@ import {
20
29
  import {
21
30
  init_package,
22
31
  package_default
23
- } from "./cli-2dycsvxt.js";
32
+ } from "./cli-vf5b436q.js";
24
33
  import {
25
34
  init_secret_scrubber,
26
35
  scrubSecrets
@@ -4440,7 +4449,6 @@ function translateAcpSessionNotification(notification) {
4440
4449
 
4441
4450
  // src/providers/acp-targets.ts
4442
4451
  import { join } from "node:path";
4443
-
4444
4452
  class AcpTargetResolutionError extends Error {
4445
4453
  constructor(message) {
4446
4454
  super(message);
@@ -4473,6 +4481,59 @@ function baseTargetEnv(config) {
4473
4481
  }
4474
4482
  return env;
4475
4483
  }
4484
+ function copyEnvKeys(config, env, keys) {
4485
+ for (const key of keys) {
4486
+ const value = readEnv(config, key);
4487
+ if (value !== undefined)
4488
+ env[key] = value;
4489
+ }
4490
+ }
4491
+ function parseStringArray(value) {
4492
+ if (!value?.trim())
4493
+ return [];
4494
+ try {
4495
+ const parsed = JSON.parse(value);
4496
+ if (Array.isArray(parsed) && parsed.every((entry) => typeof entry === "string")) {
4497
+ return parsed;
4498
+ }
4499
+ } catch {}
4500
+ return value.split(",").map((entry) => entry.trim()).filter(Boolean);
4501
+ }
4502
+ function configuredOptions(config) {
4503
+ let options = {};
4504
+ const raw = readEnv(config, "ACP_CONFIG_OPTIONS");
4505
+ if (raw) {
4506
+ try {
4507
+ const parsed = JSON.parse(raw);
4508
+ if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
4509
+ options = Object.fromEntries(Object.entries(parsed).filter((entry) => typeof entry[1] === "string" || typeof entry[1] === "boolean"));
4510
+ }
4511
+ } catch {
4512
+ console.warn("\x1B[33m[acp]\x1B[0m Ignoring invalid ACP_CONFIG_OPTIONS JSON");
4513
+ }
4514
+ }
4515
+ delete options.model;
4516
+ if (config.model.trim())
4517
+ options.model = config.model.trim();
4518
+ return options;
4519
+ }
4520
+ function withModelInJsonEnv(env, key, model) {
4521
+ if (!model.trim())
4522
+ return;
4523
+ let value = {};
4524
+ const existing = env[key];
4525
+ if (existing) {
4526
+ try {
4527
+ const parsed = JSON.parse(existing);
4528
+ if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
4529
+ value = parsed;
4530
+ }
4531
+ } catch {
4532
+ console.warn(`\x1B[33m[acp]\x1B[0m Replacing invalid ${key} JSON for model fallback`);
4533
+ }
4534
+ }
4535
+ env[key] = JSON.stringify({ ...value, model: model.trim() });
4536
+ }
4476
4537
  function parseCommand(command, args) {
4477
4538
  const trimmed = command.trim();
4478
4539
  if (!trimmed) {
@@ -4499,8 +4560,15 @@ var customTargetProfile = {
4499
4560
  return parseCommand(command, readEnv(config, "ACP_TARGET_ARGS"));
4500
4561
  },
4501
4562
  env(config) {
4502
- return baseTargetEnv(config);
4563
+ const env = baseTargetEnv(config);
4564
+ copyEnvKeys(config, env, parseStringArray(readEnv(config, "ACP_TARGET_ENV_KEYS")));
4565
+ const modelEnvKey = readEnv(config, "ACP_MODEL_ENV_KEY")?.trim();
4566
+ if (modelEnvKey && /^[A-Za-z_][A-Za-z0-9_]*$/.test(modelEnvKey) && config.model.trim()) {
4567
+ env[modelEnvKey] = config.model.trim();
4568
+ }
4569
+ return env;
4503
4570
  },
4571
+ configuredOptions,
4504
4572
  async writeSystemPromptArtifact(config) {
4505
4573
  const relativePath = readEnv(config, "ACP_SYSTEM_PROMPT_PATH");
4506
4574
  if (!relativePath)
@@ -4509,13 +4577,32 @@ var customTargetProfile = {
4509
4577
  await Bun.write(targetPath, config.systemPrompt ?? "");
4510
4578
  }
4511
4579
  };
4580
+ var opencodeTargetProfile = {
4581
+ target: "opencode",
4582
+ command() {
4583
+ const entry = getAcpTargetCatalogEntry("opencode");
4584
+ return [entry.command, ...entry.args ?? []];
4585
+ },
4586
+ env(config) {
4587
+ const env = baseTargetEnv(config);
4588
+ const entry = getAcpTargetCatalogEntry("opencode");
4589
+ copyEnvKeys(config, env, entry.envKeys);
4590
+ withModelInJsonEnv(env, "OPENCODE_CONFIG_CONTENT", config.model);
4591
+ return env;
4592
+ },
4593
+ configuredOptions,
4594
+ async writeSystemPromptArtifact() {}
4595
+ };
4512
4596
  function resolveAcpTarget(config) {
4513
4597
  const target = readEnv(config, "ACP_TARGET") ?? "custom";
4598
+ if (!isAcpTarget(target)) {
4599
+ throw new AcpTargetResolutionError(`Unsupported ACP target "${target}". Supported targets: opencode, custom.`);
4600
+ }
4514
4601
  switch (target) {
4602
+ case "opencode":
4603
+ return opencodeTargetProfile;
4515
4604
  case "custom":
4516
4605
  return customTargetProfile;
4517
- default:
4518
- throw new AcpTargetResolutionError(`Unsupported ACP target "${target}". Only the generic "custom" target exists today — leave ACP_TARGET unset and point ACP_TARGET_COMMAND at your ACP agent.`);
4519
4606
  }
4520
4607
  }
4521
4608
 
@@ -4551,7 +4638,7 @@ class ACPSession {
4551
4638
  output = "";
4552
4639
  completionPromise;
4553
4640
  completionResolve;
4554
- constructor(connection, process2, config, sessionId) {
4641
+ constructor(connection, process2, config, sessionId, providerMeta) {
4555
4642
  this.connection = connection;
4556
4643
  this.process = process2;
4557
4644
  this.config = config;
@@ -4560,7 +4647,7 @@ class ACPSession {
4560
4647
  this.completionResolve = resolve;
4561
4648
  });
4562
4649
  this.consumeStderr();
4563
- this.emit({ type: "session_init", sessionId, provider: "acp" });
4650
+ this.emit({ type: "session_init", sessionId, provider: "acp", providerMeta });
4564
4651
  this.runPrompt();
4565
4652
  }
4566
4653
  onEvent(listener) {
@@ -4585,7 +4672,7 @@ class ACPSession {
4585
4672
  category: "abort"
4586
4673
  });
4587
4674
  }
4588
- this.process.kill();
4675
+ await terminateProcessGroup(this.process.pid);
4589
4676
  this.finish({
4590
4677
  exitCode: 1,
4591
4678
  sessionId: this.sessionId,
@@ -4609,6 +4696,7 @@ class ACPSession {
4609
4696
  }
4610
4697
  }
4611
4698
  async runPrompt() {
4699
+ let result;
4612
4700
  try {
4613
4701
  const response = await this.connection.prompt({
4614
4702
  sessionId: this.sessionId,
@@ -4616,7 +4704,7 @@ class ACPSession {
4616
4704
  });
4617
4705
  const isError = response.stopReason === "refusal" || response.stopReason === "cancelled";
4618
4706
  const cost = this.buildCostData(isError);
4619
- const result = {
4707
+ result = {
4620
4708
  exitCode: isError ? 1 : 0,
4621
4709
  sessionId: this.sessionId,
4622
4710
  cost,
@@ -4625,19 +4713,19 @@ class ACPSession {
4625
4713
  failureReason: isError ? `ACP prompt stopped with ${response.stopReason}` : undefined
4626
4714
  };
4627
4715
  this.emit({ type: "result", cost, output: this.output, isError });
4628
- this.finish(result);
4629
4716
  } catch (err) {
4630
4717
  const message = scrubSecrets(formatError(err));
4631
4718
  this.emit({ type: "error", message, category: "protocol" });
4632
- this.finish({
4719
+ result = {
4633
4720
  exitCode: 1,
4634
4721
  sessionId: this.sessionId,
4635
4722
  isError: true,
4636
4723
  failureReason: `ACP prompt failed: ${message}`
4637
- });
4724
+ };
4638
4725
  } finally {
4639
- this.process.kill();
4726
+ await terminateProcessGroup(this.process.pid);
4640
4727
  }
4728
+ this.finish(result);
4641
4729
  }
4642
4730
  async consumeStderr() {
4643
4731
  const stderr = this.process.stderr;
@@ -4687,13 +4775,14 @@ class ACPAdapter {
4687
4775
  const target = resolveAcpTarget(config);
4688
4776
  await target.writeSystemPromptArtifact(config);
4689
4777
  const command = target.command(config);
4690
- const proc = Bun.spawn(command, {
4778
+ const proc = registerProcessGroup(Bun.spawn(command, {
4691
4779
  cwd: config.cwd,
4780
+ detached: detachedProcessGroup,
4692
4781
  env: target.env(config),
4693
4782
  stdin: "pipe",
4694
4783
  stdout: "pipe",
4695
4784
  stderr: "pipe"
4696
- });
4785
+ }));
4697
4786
  let session = null;
4698
4787
  const client2 = new SwarmAcpClient((event) => session?.emitFromAcp(event));
4699
4788
  const stream = ndJsonStream2(fileSinkWritableStream(proc.stdin), proc.stdout);
@@ -4702,7 +4791,7 @@ class ACPAdapter {
4702
4791
  await connection.initialize({
4703
4792
  protocolVersion: PROTOCOL_VERSION,
4704
4793
  clientInfo: { name: "agent-swarm", version: package_default.version },
4705
- clientCapabilities: {}
4794
+ clientCapabilities: { session: { configOptions: { boolean: {} } } }
4706
4795
  });
4707
4796
  const installedServers = await fetchInstalledMcpServers(config.apiUrl, config.apiKey, config.agentId, "claude");
4708
4797
  const newSession = await connection.newSession({
@@ -4721,10 +4810,14 @@ class ACPAdapter {
4721
4810
  ...toAcpMcpServers(installedServers)
4722
4811
  ]
4723
4812
  });
4724
- session = new ACPSession(connection, proc, config, newSession.sessionId);
4813
+ const configOptions = await applyConfiguredOptions(connection, newSession.sessionId, newSession.configOptions ?? [], target.configuredOptions(config));
4814
+ session = new ACPSession(connection, proc, config, newSession.sessionId, {
4815
+ target: target.target,
4816
+ configOptions: sanitizeAcpConfigOptions(configOptions)
4817
+ });
4725
4818
  return session;
4726
4819
  } catch (err) {
4727
- proc.kill();
4820
+ await terminateProcessGroup(proc.pid);
4728
4821
  throw new Error(`ACP target failed during startup: ${scrubSecrets(formatError(err))}`);
4729
4822
  }
4730
4823
  }
@@ -4735,6 +4828,63 @@ class ACPAdapter {
4735
4828
  return `/${commandName}`;
4736
4829
  }
4737
4830
  }
4831
+ async function applyConfiguredOptions(connection, sessionId, advertised, configured) {
4832
+ let current = advertised;
4833
+ for (const [configId, value] of Object.entries(configured)) {
4834
+ const option = current.find((entry) => entry.id === configId);
4835
+ if (!option) {
4836
+ console.warn(`\x1B[33m[acp]\x1B[0m Config option "${configId}" was not advertised; using target fallback`);
4837
+ continue;
4838
+ }
4839
+ if (option.type === "boolean" && typeof value !== "boolean") {
4840
+ console.warn(`\x1B[33m[acp]\x1B[0m Config option "${configId}" expects a boolean; using target fallback`);
4841
+ continue;
4842
+ }
4843
+ if (option.type === "select" && typeof value !== "string") {
4844
+ console.warn(`\x1B[33m[acp]\x1B[0m Config option "${configId}" expects a string; using target fallback`);
4845
+ continue;
4846
+ }
4847
+ try {
4848
+ const response = typeof value === "boolean" ? await connection.setSessionConfigOption({
4849
+ sessionId,
4850
+ configId,
4851
+ type: "boolean",
4852
+ value
4853
+ }) : await connection.setSessionConfigOption({ sessionId, configId, value });
4854
+ current = response.configOptions;
4855
+ } catch (err) {
4856
+ console.warn(`\x1B[33m[acp]\x1B[0m Failed to set config option "${configId}"; using target fallback: ${scrubSecrets(formatError(err))}`);
4857
+ }
4858
+ }
4859
+ return current;
4860
+ }
4861
+ function sanitizeAcpConfigOptions(options) {
4862
+ return options.map((option) => {
4863
+ const common = {
4864
+ id: option.id,
4865
+ name: option.name,
4866
+ description: option.description,
4867
+ category: option.category
4868
+ };
4869
+ if (option.type === "boolean") {
4870
+ return { ...common, type: "boolean", currentValue: option.currentValue };
4871
+ }
4872
+ return {
4873
+ ...common,
4874
+ type: "select",
4875
+ currentValue: option.currentValue,
4876
+ options: option.options.map((entry) => ("group" in entry) ? {
4877
+ group: entry.group,
4878
+ name: entry.name,
4879
+ options: entry.options.map(({ value, name, description }) => ({
4880
+ value,
4881
+ name,
4882
+ description
4883
+ }))
4884
+ } : { value: entry.value, name: entry.name, description: entry.description })
4885
+ };
4886
+ });
4887
+ }
4738
4888
  function toAcpMcpServers(installed) {
4739
4889
  if (!installed)
4740
4890
  return [];
@@ -4783,5 +4933,7 @@ function fileSinkWritableStream(sink) {
4783
4933
  }
4784
4934
  export {
4785
4935
  ACPAdapter,
4936
+ applyConfiguredOptions,
4937
+ sanitizeAcpConfigOptions,
4786
4938
  toAcpMcpServers
4787
4939
  };
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  resolveSlackUserId
3
- } from "./cli-fzwndvcp.js";
4
- import"./cli-e6wan0s7.js";
3
+ } from "./cli-pw4gxcx1.js";
4
+ import"./cli-vp3sksy6.js";
5
5
  import {
6
6
  createTaskWithSiblingAwareness
7
- } from "./cli-fewd407e.js";
7
+ } from "./cli-kfrk073c.js";
8
8
  import {
9
9
  buildCancelledBlocks,
10
10
  ensureSlackThreadTree,
@@ -12,7 +12,7 @@ import {
12
12
  getAgentEmoji,
13
13
  getTaskLink,
14
14
  isSlackRenderV2Enabled
15
- } from "./cli-68n7t6am.js";
15
+ } from "./cli-s0w91tq3.js";
16
16
  import"./cli-qf9kpsve.js";
17
17
  import"./cli-g2p9bd1z.js";
18
18
  import {
@@ -23,7 +23,7 @@ import {
23
23
  init_context_key,
24
24
  init_db,
25
25
  slackContextKey
26
- } from "./cli-ae7g0pp7.js";
26
+ } from "./cli-a6297e83.js";
27
27
  import"./cli-d2epf5ae.js";
28
28
  import"./cli-87zrjxdb.js";
29
29
  import"./cli-a1rrkrb4.js";
@@ -31,7 +31,7 @@ import"./cli-xbyjkasx.js";
31
31
  import"./cli-nanaxrz6.js";
32
32
  import"./cli-s35981d0.js";
33
33
  import"./cli-pqv5gvyf.js";
34
- import"./cli-2dycsvxt.js";
34
+ import"./cli-vf5b436q.js";
35
35
  import"./cli-mkq1rk7b.js";
36
36
  import"./cli-qntkxysp.js";
37
37
  import"./cli-497b685t.js";
@@ -3,10 +3,10 @@ import {
3
3
  initSlackApp,
4
4
  startSlackApp,
5
5
  stopSlackApp
6
- } from "./cli-68n7t6am.js";
6
+ } from "./cli-s0w91tq3.js";
7
7
  import"./cli-qf9kpsve.js";
8
8
  import"./cli-g2p9bd1z.js";
9
- import"./cli-ae7g0pp7.js";
9
+ import"./cli-a6297e83.js";
10
10
  import"./cli-d2epf5ae.js";
11
11
  import"./cli-87zrjxdb.js";
12
12
  import"./cli-a1rrkrb4.js";
@@ -14,7 +14,7 @@ import"./cli-xbyjkasx.js";
14
14
  import"./cli-nanaxrz6.js";
15
15
  import"./cli-s35981d0.js";
16
16
  import"./cli-pqv5gvyf.js";
17
- import"./cli-2dycsvxt.js";
17
+ import"./cli-vf5b436q.js";
18
18
  import"./cli-mkq1rk7b.js";
19
19
  import"./cli-qntkxysp.js";
20
20
  import"./cli-497b685t.js";
@@ -2,24 +2,24 @@ import {
2
2
  bufferThreadMessage,
3
3
  getBufferMessageCount,
4
4
  wasEventSeen
5
- } from "./cli-ks1x39f4.js";
5
+ } from "./cli-s84fa8td.js";
6
6
  import {
7
7
  hasOtherUserMention
8
- } from "./cli-bmjg0n8y.js";
8
+ } from "./cli-rsa49w51.js";
9
9
  import {
10
10
  resolveSlackUserId,
11
11
  rewriteSlackMentions
12
- } from "./cli-fzwndvcp.js";
13
- import"./cli-e6wan0s7.js";
12
+ } from "./cli-pw4gxcx1.js";
13
+ import"./cli-vp3sksy6.js";
14
14
  import {
15
15
  createTaskWithSiblingAwareness
16
- } from "./cli-fewd407e.js";
16
+ } from "./cli-kfrk073c.js";
17
17
  import {
18
18
  ackSlackMessage,
19
19
  ensureSlackThreadTree,
20
20
  isSlackRenderV2Enabled,
21
21
  require_dist
22
- } from "./cli-68n7t6am.js";
22
+ } from "./cli-s0w91tq3.js";
23
23
  import"./cli-qf9kpsve.js";
24
24
  import"./cli-g2p9bd1z.js";
25
25
  import {
@@ -29,7 +29,7 @@ import {
29
29
  init_context_key,
30
30
  init_db,
31
31
  slackContextKey
32
- } from "./cli-ae7g0pp7.js";
32
+ } from "./cli-a6297e83.js";
33
33
  import"./cli-d2epf5ae.js";
34
34
  import {
35
35
  init_resolver,
@@ -43,7 +43,7 @@ import {
43
43
  } from "./cli-nanaxrz6.js";
44
44
  import"./cli-s35981d0.js";
45
45
  import"./cli-pqv5gvyf.js";
46
- import"./cli-2dycsvxt.js";
46
+ import"./cli-vf5b436q.js";
47
47
  import"./cli-mkq1rk7b.js";
48
48
  import"./cli-qntkxysp.js";
49
49
  import"./cli-497b685t.js";
@@ -1,14 +1,14 @@
1
1
  import {
2
2
  embedScript,
3
3
  embeddingProvider
4
- } from "./cli-0ejv5tq1.js";
5
- import"./cli-169dk2km.js";
4
+ } from "./cli-15atwe0d.js";
5
+ import"./cli-z6wjvew7.js";
6
6
  import"./cli-dr5tcz68.js";
7
7
  import"./cli-vsap7a8d.js";
8
8
  import {
9
9
  getDbClient,
10
10
  init_db
11
- } from "./cli-ae7g0pp7.js";
11
+ } from "./cli-a6297e83.js";
12
12
  import"./cli-d2epf5ae.js";
13
13
  import"./cli-87zrjxdb.js";
14
14
  import"./cli-a1rrkrb4.js";
@@ -16,7 +16,7 @@ import"./cli-xbyjkasx.js";
16
16
  import"./cli-nanaxrz6.js";
17
17
  import"./cli-s35981d0.js";
18
18
  import"./cli-pqv5gvyf.js";
19
- import"./cli-2dycsvxt.js";
19
+ import"./cli-vf5b436q.js";
20
20
  import"./cli-mkq1rk7b.js";
21
21
  import"./cli-pq2ee5ja.js";
22
22
 
@@ -3,13 +3,13 @@ import {
3
3
  getEmbeddingProvider,
4
4
  getMemoryStore,
5
5
  init_constants
6
- } from "./cli-169dk2km.js";
6
+ } from "./cli-z6wjvew7.js";
7
7
  import"./cli-dr5tcz68.js";
8
8
  import"./cli-vsap7a8d.js";
9
9
  import {
10
10
  getDbClient,
11
11
  init_db
12
- } from "./cli-ae7g0pp7.js";
12
+ } from "./cli-a6297e83.js";
13
13
  import"./cli-d2epf5ae.js";
14
14
  import"./cli-87zrjxdb.js";
15
15
  import"./cli-a1rrkrb4.js";
@@ -17,7 +17,7 @@ import"./cli-xbyjkasx.js";
17
17
  import"./cli-nanaxrz6.js";
18
18
  import"./cli-s35981d0.js";
19
19
  import"./cli-pqv5gvyf.js";
20
- import"./cli-2dycsvxt.js";
20
+ import"./cli-vf5b436q.js";
21
21
  import"./cli-mkq1rk7b.js";
22
22
  import"./cli-pq2ee5ja.js";
23
23
 
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  getDbClient,
3
3
  init_db
4
- } from "./cli-ae7g0pp7.js";
4
+ } from "./cli-a6297e83.js";
5
5
  import"./cli-d2epf5ae.js";
6
6
  import"./cli-87zrjxdb.js";
7
7
  import"./cli-a1rrkrb4.js";
@@ -9,7 +9,7 @@ import"./cli-xbyjkasx.js";
9
9
  import"./cli-nanaxrz6.js";
10
10
  import"./cli-s35981d0.js";
11
11
  import"./cli-pqv5gvyf.js";
12
- import"./cli-2dycsvxt.js";
12
+ import"./cli-vf5b436q.js";
13
13
  import {
14
14
  init_secret_scrubber,
15
15
  scrubSecrets
@@ -12,8 +12,8 @@ import {
12
12
  resolveClaudeBinary,
13
13
  resolveClaudeBinaryArgv,
14
14
  resolveClaudeBridgeEnabled
15
- } from "./cli-1smbv79b.js";
16
- import"./cli-sebnvgzq.js";
15
+ } from "./cli-er2z53kh.js";
16
+ import"./cli-jt7k9yw5.js";
17
17
  import"./cli-a3pkfpqs.js";
18
18
  import"./cli-z0f80e8e.js";
19
19
  import"./cli-hp1n6zq3.js";
@@ -27,6 +27,7 @@ import"./cli-spx3gtdd.js";
27
27
  import"./cli-e7d20cty.js";
28
28
  import"./cli-3dpj7atn.js";
29
29
  import"./cli-f14fvzag.js";
30
+ import"./cli-y89t4nca.js";
30
31
  import"./cli-dr5tcz68.js";
31
32
  import"./cli-bsakbbkm.js";
32
33
  import"./cli-whrvct19.js";
@@ -37,7 +38,7 @@ import"./cli-xbyjkasx.js";
37
38
  import"./cli-nanaxrz6.js";
38
39
  import"./cli-s35981d0.js";
39
40
  import"./cli-pqv5gvyf.js";
40
- import"./cli-2dycsvxt.js";
41
+ import"./cli-vf5b436q.js";
41
42
  import"./cli-mkq1rk7b.js";
42
43
  import"./cli-c4eeb5q2.js";
43
44
  import"./cli-00w4hbam.js";