opencode-swarm 7.164.11 → 7.164.13

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 (127) hide show
  1. package/.opencode/skills/engineering-conventions/SKILL.md +1 -1
  2. package/.opencode/skills/loop/SKILL.md +1 -1
  3. package/.opencode/skills/{plan → swarm-plan}/SKILL.md +1 -1
  4. package/dist/background/pending-delegations.d.ts +7 -2
  5. package/dist/background/pr-subscriptions.d.ts +3 -3
  6. package/dist/cli/{coder-settlement-0rfk8y11.js → coder-settlement-em2fgg4p.js} +16 -17
  7. package/dist/cli/{config-doctor-j17b7qq2.js → config-doctor-1m4mrybp.js} +4 -4
  8. package/dist/cli/{core-evhjjrtt.js → core-zbzdffha.js} +3 -3
  9. package/dist/cli/{curation-policy-vj6z5hvr.js → curation-policy-bqpmry2n.js} +5 -6
  10. package/dist/cli/{curator-drift-ez81vg2t.js → curator-drift-hbc3w5zj.js} +14 -12
  11. package/dist/cli/curator-llm-factory-j76c96t7.js +70 -0
  12. package/dist/cli/{curator-vqd5yeck.js → curator-tn3x5j02.js} +49 -47
  13. package/dist/cli/{dispatch-dqybvj8v.js → dispatch-c7xjt7js.js} +3 -3
  14. package/dist/cli/{evidence-summary-service-937x7rbg.js → evidence-summary-service-7cn9z4sn.js} +25 -24
  15. package/dist/cli/{gate-evidence-q1cehr4k.js → gate-evidence-deyzt3hz.js} +10 -11
  16. package/dist/cli/guardrail-explain-4k2pqj46.js +71 -0
  17. package/dist/cli/{guardrail-log-3g93f3g2.js → guardrail-log-cnbv6vry.js} +11 -11
  18. package/dist/cli/{guardrail-reset-qe2r5qzq.js → guardrail-reset-xhh61cax.js} +49 -47
  19. package/dist/cli/hive-promoter-1m8zpz4d.js +85 -0
  20. package/dist/cli/{index-rhqdsc1x.js → index-0mwjamha.js} +9 -9
  21. package/dist/cli/{index-y1yqmkv7.js → index-3c0z1jnc.js} +56 -52
  22. package/dist/cli/{index-kch6yenm.js → index-4fhcbe14.js} +8 -8
  23. package/dist/cli/{index-ww6zm5hr.js → index-5ebgzb5a.js} +3 -3
  24. package/dist/cli/{index-4vb6qa73.js → index-5h60rtaa.js} +37 -3
  25. package/dist/cli/{index-w3gtqey0.js → index-6chhqq2n.js} +4 -4
  26. package/dist/cli/index-6m24v15v.js +429 -0
  27. package/dist/cli/{index-vdn32nws.js → index-6rx1rdaq.js} +3 -3
  28. package/dist/cli/{index-x43debgx.js → index-74514zkh.js} +15 -17
  29. package/dist/cli/{index-1ww7wj8d.js → index-7f2r3ysr.js} +41 -17
  30. package/dist/cli/{index-kc2tgcm7.js → index-7z9zqxqt.js} +4 -4
  31. package/dist/cli/{index-n8688d12.js → index-8bdk7124.js} +2 -2
  32. package/dist/cli/{index-3146wmgv.js → index-8d90gzaz.js} +1 -1
  33. package/dist/cli/{index-b2nj04q6.js → index-9ss2m4rs.js} +1 -434
  34. package/dist/cli/{index-50j914b5.js → index-a0d4fp6r.js} +29 -7
  35. package/dist/cli/{index-ggtmsm84.js → index-ajknebrc.js} +1 -1
  36. package/dist/cli/{index-zjg4chy2.js → index-anxs69ad.js} +2 -2
  37. package/dist/cli/{index-aqppaaqx.js → index-asey3tb3.js} +6 -4
  38. package/dist/cli/{index-kv2tdkk5.js → index-bvkd7at6.js} +1 -1
  39. package/dist/cli/{index-r656jh9j.js → index-c98rjgjq.js} +4301 -2877
  40. package/dist/cli/{index-r5q5gd2a.js → index-d224mhr9.js} +3 -3
  41. package/dist/cli/{index-nqsj0g5y.js → index-dh5th4jn.js} +8 -8
  42. package/dist/cli/index-e45htt92.js +361 -0
  43. package/dist/cli/{index-w95vxjde.js → index-f36hy1x4.js} +39 -8
  44. package/dist/cli/{index-hp22pzn5.js → index-f8jdar6q.js} +2 -2
  45. package/dist/cli/{index-47kh2103.js → index-fnyw5rzg.js} +14 -14
  46. package/dist/cli/{index-7m32fjb4.js → index-g11h1qpk.js} +9 -9
  47. package/dist/cli/{index-d9entpn3.js → index-g9weyhq6.js} +4 -4
  48. package/dist/cli/{index-qbw3yw2d.js → index-grn6tkbt.js} +11 -11
  49. package/dist/cli/{index-9gxbjkts.js → index-gy0nyfbw.js} +24 -21
  50. package/dist/cli/{index-5jx22kwc.js → index-hhzzyjm3.js} +544 -15
  51. package/dist/cli/{index-dsg9dw3b.js → index-j2svfhzk.js} +2 -2
  52. package/dist/cli/{index-2bgr671r.js → index-jre6tm3v.js} +20 -2
  53. package/dist/cli/{index-77z98j76.js → index-mpf1tvwf.js} +314 -130
  54. package/dist/cli/{index-e90em0x4.js → index-ndjjvxzz.js} +12 -17
  55. package/dist/cli/{index-r3mvsbtq.js → index-p612v1mv.js} +7 -1
  56. package/dist/cli/{index-zfs3zqeq.js → index-ptsqnxwd.js} +771 -21
  57. package/dist/cli/{index-ggrp3v00.js → index-qtxevgdx.js} +15 -17
  58. package/dist/cli/{index-c5v1w13g.js → index-s3k7xbqd.js} +807 -629
  59. package/dist/cli/{index-pp2nya9v.js → index-tqw8w2n5.js} +2 -4
  60. package/dist/cli/index-w6988bbc.js +675 -0
  61. package/dist/cli/{index-4gqxppcx.js → index-xwbn7c8m.js} +2 -2
  62. package/dist/cli/{index-mmjamc9b.js → index-y5hfk7ya.js} +6 -6
  63. package/dist/cli/{index-5kcvrpkt.js → index-zb6gdym8.js} +2 -2
  64. package/dist/cli/index.js +161 -80
  65. package/dist/cli/{knowledge-escalator-j04g450p.js → knowledge-escalator-3fax9y3s.js} +18 -19
  66. package/dist/cli/{knowledge-events-53z45rs0.js → knowledge-events-9cpdyhmb.js} +16 -17
  67. package/dist/cli/{knowledge-link-a6kfg3qm.js → knowledge-link-dgvbqjqg.js} +4 -5
  68. package/dist/cli/{knowledge-store-whm0gagt.js → knowledge-store-y35rka0p.js} +6 -7
  69. package/dist/cli/{knowledge-validator-h8m7065g.js → knowledge-validator-fd761gpx.js} +8 -9
  70. package/dist/cli/{model-preflight-288nsgpw.js → model-preflight-3s1c0zpc.js} +1 -1
  71. package/dist/cli/{pending-delegations-6hkpe5ze.js → pending-delegations-t3y19j3n.js} +17 -8
  72. package/dist/cli/{pr-subscriptions-11zca1mh.js → pr-subscriptions-00zp69mt.js} +17 -8
  73. package/dist/cli/{pr-workflow-gate-6g29rkg7.js → pr-workflow-gate-2h0j8c92.js} +51 -49
  74. package/dist/cli/{runner-5abw3t35.js → runner-0e3bjeev.js} +6 -7
  75. package/dist/cli/{scan-cursor-mkfx410t.js → scan-cursor-wppe2gxw.js} +9 -10
  76. package/dist/cli/{schema-jbbam3ev.js → schema-sec49ppy.js} +2 -2
  77. package/dist/cli/{scope-persistence-q1ct4k42.js → scope-persistence-59eyqaz4.js} +20 -13
  78. package/dist/cli/{skill-generator-cv8fg96x.js → skill-generator-56rbmpj7.js} +21 -22
  79. package/dist/cli/snapshot-coordination-init-dnkdc7gx.js +84 -0
  80. package/dist/cli/{telemetry-mbqqamsj.js → telemetry-a1yvjerj.js} +1 -1
  81. package/dist/cli/{workspace-snapshot-eh18vgkn.js → workspace-snapshot-6z9rk7xw.js} +3 -3
  82. package/dist/cli/{worktree-collision-ownership-xgnn8dsq.js → worktree-collision-ownership-fj9n4mhk.js} +21 -12
  83. package/dist/cli/{worktree-isolation-k2dgfmeg.js → worktree-isolation-vd1s86ya.js} +49 -47
  84. package/dist/commands/benchmark.d.ts +5 -1
  85. package/dist/commands/close.d.ts +13 -6
  86. package/dist/commands/registry.d.ts +34 -43
  87. package/dist/commands/reset-session.d.ts +4 -0
  88. package/dist/commands/turbo.d.ts +1 -1
  89. package/dist/config/bundled-skills.d.ts +4 -3
  90. package/dist/config/constants.d.ts +13 -0
  91. package/dist/db/coordination-store.d.ts +85 -0
  92. package/dist/db/durability.d.ts +22 -5
  93. package/dist/db/index.d.ts +1 -0
  94. package/dist/db/project-db.d.ts +12 -0
  95. package/dist/hooks/extractors.d.ts +9 -0
  96. package/dist/hooks/non-architect-advisory.d.ts +18 -0
  97. package/dist/hooks/repo-graph-injection.d.ts +16 -0
  98. package/dist/index.js +837 -730
  99. package/dist/memory/schema.d.ts +3 -3
  100. package/dist/pr-review/authorization.d.ts +5 -4
  101. package/dist/pr-review/persistence.d.ts +10 -1
  102. package/dist/scope/scope-binding.d.ts +10 -0
  103. package/dist/scope/scope-persistence.d.ts +10 -0
  104. package/dist/services/decision-drift-analyzer.d.ts +7 -0
  105. package/dist/services/handoff-service.d.ts +12 -0
  106. package/dist/services/status-service.d.ts +31 -0
  107. package/dist/session/snapshot-coordination-init.d.ts +49 -0
  108. package/dist/session/snapshot-reader.d.ts +2 -0
  109. package/dist/session/snapshot-store.d.ts +42 -0
  110. package/dist/session/snapshot-writer.d.ts +4 -1
  111. package/dist/state.d.ts +14 -3
  112. package/dist/tools/repo-graph/builder.d.ts +1 -25
  113. package/dist/tools/repo-graph/cache.d.ts +5 -1
  114. package/dist/tools/repo-graph/fallback-scanner.d.ts +71 -0
  115. package/dist/tools/repo-graph/indexed-storage.d.ts +11 -0
  116. package/dist/tools/repo-graph/storage.d.ts +7 -0
  117. package/dist/turbo/epic/state.d.ts +4 -20
  118. package/dist/utils/bun-compat.d.ts +10 -0
  119. package/dist/utils/context-decisions.d.ts +77 -0
  120. package/dist/utils/external-tool-runner.d.ts +2 -0
  121. package/dist/utils/sanitize-display.d.ts +7 -0
  122. package/package.json +5 -3
  123. package/dist/cli/curator-llm-factory-sxcpmcqq.js +0 -68
  124. package/dist/cli/guardrail-explain-xv9aw1bf.js +0 -69
  125. package/dist/cli/hive-promoter-09yc9mp5.js +0 -83
  126. package/dist/cli/index-xnb3tk7x.js +0 -24
  127. package/dist/cli/{ast-diff-ekd9v10f.js → ast-diff-b0esr2kf.js} +3 -3
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  _internals,
4
4
  resolveWorktreeIsolationConfig
5
- } from "./index-r5q5gd2a.js";
5
+ } from "./index-d224mhr9.js";
6
6
  import {
7
7
  ApprovalEvidenceSchema,
8
8
  BaseEvidenceSchema,
@@ -44,7 +44,9 @@ import {
44
44
  loadPluginConfigWithMeta,
45
45
  loadPluginConfigWithMetaAsync,
46
46
  resetConfigAdvisoryDedup
47
- } from "./index-rhqdsc1x.js";
47
+ } from "./index-0mwjamha.js";
48
+ import"./index-9e6fdz2h.js";
49
+ import"./index-4rhhvd1a.js";
48
50
  import {
49
51
  AUTO_REVIEW_V8_BURN_IN_DECISION,
50
52
  AgentOverrideConfigSchema,
@@ -68,9 +70,7 @@ import {
68
70
  TurboConfigSchema,
69
71
  WorktreeIsolationConfigSchema,
70
72
  resolveAutoReviewConfig
71
- } from "./index-aqppaaqx.js";
72
- import"./index-9e6fdz2h.js";
73
- import"./index-4rhhvd1a.js";
73
+ } from "./index-asey3tb3.js";
74
74
  import {
75
75
  ALL_AGENT_NAMES,
76
76
  ALL_SUBAGENT_NAMES,
@@ -80,7 +80,7 @@ import {
80
80
  QA_AGENTS,
81
81
  isQAAgent,
82
82
  isSubagent
83
- } from "./index-50j914b5.js";
83
+ } from "./index-a0d4fp6r.js";
84
84
  import"./index-zjygnfay.js";
85
85
  import"./index-bk5tah7q.js";
86
86
  import"./index-bpmtbmy9.js";
@@ -12,13 +12,13 @@ import {
12
12
  PluginConfigSchema,
13
13
  init_schema,
14
14
  stripKnownSwarmPrefix
15
- } from "./index-aqppaaqx.js";
15
+ } from "./index-asey3tb3.js";
16
16
  import {
17
17
  ALL_AGENT_NAMES,
18
18
  TOOL_NAME_SET,
19
19
  init_constants,
20
20
  init_tool_metadata
21
- } from "./index-50j914b5.js";
21
+ } from "./index-a0d4fp6r.js";
22
22
  import {
23
23
  log
24
24
  } from "./index-zgwm4ryv.js";
package/dist/cli/index.js CHANGED
@@ -5,78 +5,82 @@ import {
5
5
  VALID_COMMANDS,
6
6
  VERSION_PINNED_LEAF,
7
7
  discoverVersionPinnedCachePaths,
8
+ formatCommandNotFound,
9
+ getHostConfigDir,
8
10
  getPluginCachePaths,
9
- getPluginConfigDir,
10
11
  getPluginLockFilePaths,
12
+ isCommandFailure,
11
13
  readCachePackageVersion,
12
14
  resolveCommand,
13
15
  safeRealpathSync
14
- } from "./index-r656jh9j.js";
15
- import"./index-w95vxjde.js";
16
- import"./index-kch6yenm.js";
17
- import"./index-5kcvrpkt.js";
18
- import"./index-77z98j76.js";
19
- import"./index-pp2nya9v.js";
16
+ } from "./index-c98rjgjq.js";
17
+ import"./index-8d90gzaz.js";
18
+ import"./index-f36hy1x4.js";
19
+ import"./index-4fhcbe14.js";
20
+ import"./index-zb6gdym8.js";
21
+ import"./index-mpf1tvwf.js";
22
+ import"./index-tqw8w2n5.js";
20
23
  import"./index-txdagbh7.js";
21
24
  import"./index-cw912re7.js";
22
- import"./index-3146wmgv.js";
23
- import"./index-1ww7wj8d.js";
24
- import"./index-7m32fjb4.js";
25
- import"./index-d9entpn3.js";
25
+ import"./index-7f2r3ysr.js";
26
+ import"./index-g11h1qpk.js";
27
+ import"./index-g9weyhq6.js";
26
28
  import"./index-70ha9e09.js";
27
- import"./index-nqsj0g5y.js";
28
- import"./index-b2nj04q6.js";
29
- import"./index-n4fzmqz8.js";
30
- import"./index-zfs3zqeq.js";
29
+ import"./index-dh5th4jn.js";
30
+ import"./index-9ss2m4rs.js";
31
+ import"./index-ptsqnxwd.js";
31
32
  import"./index-zsrtt42s.js";
32
- import"./index-47kh2103.js";
33
- import"./index-w3gtqey0.js";
34
- import"./index-n8688d12.js";
35
- import"./index-kc2tgcm7.js";
36
- import"./index-ggtmsm84.js";
37
- import"./index-rtry5xyf.js";
38
- import"./index-x43debgx.js";
39
- import"./index-4vb6qa73.js";
40
- import"./index-5jx22kwc.js";
41
- import"./index-c5v1w13g.js";
42
- import"./index-e90em0x4.js";
43
- import"./index-ry16d01s.js";
44
- import"./index-4gqxppcx.js";
45
- import"./index-556ja8an.js";
46
- import"./index-4fwbbad3.js";
33
+ import"./index-fnyw5rzg.js";
34
+ import"./index-6chhqq2n.js";
35
+ import"./index-8bdk7124.js";
47
36
  import"./index-b43rt5ph.js";
48
37
  import"./index-q7sjgr1y.js";
49
- import"./index-qbw3yw2d.js";
50
- import"./index-ggrp3v00.js";
51
- import"./index-r5q5gd2a.js";
38
+ import"./index-74514zkh.js";
39
+ import"./index-5h60rtaa.js";
40
+ import"./index-hhzzyjm3.js";
41
+ import"./index-qtxevgdx.js";
42
+ import"./index-anxs69ad.js";
43
+ import"./index-z6xqpmqg.js";
44
+ import"./index-p612v1mv.js";
45
+ import"./index-7z9zqxqt.js";
46
+ import"./index-ajknebrc.js";
47
+ import"./index-rtry5xyf.js";
48
+ import"./index-d224mhr9.js";
52
49
  import"./index-3qf1vxtb.js";
53
50
  import"./index-n832052r.js";
54
- import"./index-zjg4chy2.js";
55
- import"./index-z6xqpmqg.js";
56
- import"./index-r3mvsbtq.js";
57
- import"./index-rhqdsc1x.js";
51
+ import"./index-s3k7xbqd.js";
52
+ import"./index-ndjjvxzz.js";
53
+ import"./index-xwbn7c8m.js";
54
+ import"./index-556ja8an.js";
55
+ import"./index-6m24v15v.js";
56
+ import"./index-e45htt92.js";
57
+ import"./index-w6988bbc.js";
58
+ import"./index-ry16d01s.js";
59
+ import"./index-n4fzmqz8.js";
60
+ import"./index-j2svfhzk.js";
61
+ import"./index-grn6tkbt.js";
62
+ import"./index-ae75rja9.js";
63
+ import"./index-6rx1rdaq.js";
64
+ import"./index-7qefgq4j.js";
65
+ import"./index-jre6tm3v.js";
66
+ import"./index-gy0nyfbw.js";
67
+ import"./index-5ebgzb5a.js";
68
+ import"./index-7g4c7s5r.js";
69
+ import"./index-0mwjamha.js";
70
+ import"./index-9e6fdz2h.js";
71
+ import"./index-4rhhvd1a.js";
58
72
  import {
59
73
  init_package,
60
74
  package_default
61
- } from "./index-aqppaaqx.js";
62
- import"./index-9e6fdz2h.js";
63
- import"./index-4rhhvd1a.js";
64
- import"./index-dsg9dw3b.js";
75
+ } from "./index-asey3tb3.js";
65
76
  import {
66
77
  DEFAULT_AGENT_CONFIGS,
67
78
  init_constants
68
- } from "./index-50j914b5.js";
79
+ } from "./index-a0d4fp6r.js";
69
80
  import"./index-zjygnfay.js";
70
- import"./index-ae75rja9.js";
71
- import"./index-vdn32nws.js";
72
- import"./index-xnb3tk7x.js";
73
81
  import"./index-bk5tah7q.js";
74
- import"./index-7qefgq4j.js";
75
- import"./index-2bgr671r.js";
76
- import"./index-9gxbjkts.js";
77
- import"./index-ww6zm5hr.js";
78
- import"./index-7g4c7s5r.js";
79
82
  import"./index-bpmtbmy9.js";
83
+ import"./index-4fwbbad3.js";
80
84
  import"./index-zgwm4ryv.js";
81
85
  import"./index-a76rekgs.js";
82
86
 
@@ -96,7 +100,7 @@ var CONFIG_SCHEMA_REF = `https://unpkg.com/opencode-swarm@${package_default.vers
96
100
  // src/cli/index.ts
97
101
  var { version } = package_default;
98
102
  var PACKAGE_ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..", "..");
99
- var CONFIG_DIR = getPluginConfigDir();
103
+ var CONFIG_DIR = getHostConfigDir();
100
104
  var OPENCODE_CONFIG_PATH = path.join(CONFIG_DIR, "opencode.json");
101
105
  var PLUGIN_CONFIG_PATH = path.join(CONFIG_DIR, "opencode-swarm.json");
102
106
  var PROMPTS_DIR = path.join(CONFIG_DIR, "opencode-swarm");
@@ -212,42 +216,88 @@ function saveJson(filepath, data) {
212
216
  fs.writeFileSync(filepath, `${JSON.stringify(data, null, 2)}
213
217
  `, "utf-8");
214
218
  }
219
+ function stableJsonStringify(value) {
220
+ return JSON.stringify(sortKeysDeep(value));
221
+ }
222
+ function sortKeysDeep(value) {
223
+ if (Array.isArray(value)) {
224
+ return value.map(sortKeysDeep);
225
+ }
226
+ if (value && typeof value === "object") {
227
+ const record = value;
228
+ const sorted = {};
229
+ for (const key of Object.keys(record).sort()) {
230
+ sorted[key] = sortKeysDeep(record[key]);
231
+ }
232
+ return sorted;
233
+ }
234
+ return value;
235
+ }
215
236
  async function install() {
216
237
  console.log(`\uD83D\uDC1D Installing OpenCode Swarm...
217
238
  `);
218
239
  ensureDir(CONFIG_DIR);
219
240
  ensureDir(PROMPTS_DIR);
220
241
  const LEGACY_CONFIG_PATH = path.join(CONFIG_DIR, "config.json");
221
- let opencodeConfig = loadJson(OPENCODE_CONFIG_PATH);
222
- if (!opencodeConfig) {
242
+ const configExisted = fs.existsSync(OPENCODE_CONFIG_PATH);
243
+ const originalConfigRaw = configExisted ? fs.readFileSync(OPENCODE_CONFIG_PATH, "utf-8") : null;
244
+ const originalConfig = loadJson(OPENCODE_CONFIG_PATH);
245
+ let opencodeConfig;
246
+ if (originalConfig) {
247
+ opencodeConfig = structuredClone(originalConfig);
248
+ } else {
223
249
  const legacyConfig = loadJson(LEGACY_CONFIG_PATH);
224
250
  if (legacyConfig) {
225
251
  console.log("\u26A0 Migrating existing config from config.json to opencode.json...");
226
- opencodeConfig = legacyConfig;
252
+ opencodeConfig = structuredClone(legacyConfig);
227
253
  } else {
254
+ if (configExisted) {
255
+ console.warn("\u26A0 opencode.json exists but could not be parsed as JSON. " + "Starting from a fresh config; the original file is preserved in the backup written by this install.");
256
+ }
228
257
  opencodeConfig = {};
229
258
  }
230
259
  }
231
- if (!opencodeConfig.plugin) {
260
+ if (!Array.isArray(opencodeConfig.plugin)) {
261
+ if (opencodeConfig.plugin) {
262
+ console.warn(`\u26A0 opencode.json "plugin" field has an unexpected type (${typeof opencodeConfig.plugin}); replacing it with a plugin array.`);
263
+ }
232
264
  opencodeConfig.plugin = [];
233
265
  }
234
266
  const pluginName = "opencode-swarm";
235
267
  opencodeConfig.plugin = opencodeConfig.plugin.filter((p) => p !== pluginName && !p.startsWith(`${pluginName}@`));
236
268
  opencodeConfig.plugin.push(pluginName);
237
- if (!opencodeConfig.agent) {
269
+ const agentIsRecord = typeof opencodeConfig.agent === "object" && opencodeConfig.agent !== null && !Array.isArray(opencodeConfig.agent);
270
+ if (!agentIsRecord) {
271
+ if (opencodeConfig.agent) {
272
+ console.warn(`\u26A0 opencode.json "agent" field has an unexpected type (${Array.isArray(opencodeConfig.agent) ? "array" : typeof opencodeConfig.agent}); replacing it with agent overrides.`);
273
+ }
238
274
  opencodeConfig.agent = {};
239
275
  }
240
- opencodeConfig.agent.explore = {
241
- ...typeof opencodeConfig.agent.explore === "object" && opencodeConfig.agent.explore !== null ? opencodeConfig.agent.explore : {},
242
- disable: true
243
- };
244
- opencodeConfig.agent.general = {
245
- ...typeof opencodeConfig.agent.general === "object" && opencodeConfig.agent.general !== null ? opencodeConfig.agent.general : {},
246
- disable: true
247
- };
248
- saveJson(OPENCODE_CONFIG_PATH, opencodeConfig);
249
- console.log("\u2713 Added opencode-swarm to OpenCode plugins");
250
- console.log("\u2713 Disabled default OpenCode agents (explore, general)");
276
+ const agentRecord = opencodeConfig.agent;
277
+ for (const builtinAgent of ["explore", "general"]) {
278
+ const existing = agentRecord[builtinAgent];
279
+ const existingRecord = typeof existing === "object" && existing !== null && !Array.isArray(existing) ? existing : null;
280
+ if (existingRecord && existingRecord.disable !== undefined) {
281
+ continue;
282
+ }
283
+ agentRecord[builtinAgent] = {
284
+ ...existingRecord ?? {},
285
+ disable: true
286
+ };
287
+ }
288
+ const semanticallyChanged = !originalConfig || stableJsonStringify(opencodeConfig) !== stableJsonStringify(originalConfig);
289
+ if (semanticallyChanged) {
290
+ if (configExisted && originalConfigRaw !== null) {
291
+ const backupPath = path.join(CONFIG_DIR, "opencode.swarm-install-backup.json");
292
+ fs.writeFileSync(backupPath, originalConfigRaw, "utf-8");
293
+ console.log(`\u2713 Backed up existing config to ${path.basename(backupPath)}`);
294
+ }
295
+ saveJson(OPENCODE_CONFIG_PATH, opencodeConfig);
296
+ console.log("\u2713 Added opencode-swarm to OpenCode plugins");
297
+ console.log("\u2713 Disabled default OpenCode agents (explore, general)");
298
+ } else {
299
+ console.log("\u2713 OpenCode config already up to date (no rewrite)");
300
+ }
251
301
  const evicted = evictPluginCaches();
252
302
  if (evicted.cleared.length > 0) {
253
303
  console.log(`\u2713 Cleared opencode plugin cache (next start will fetch latest): ${evicted.cleared.join(", ")}`);
@@ -268,7 +318,8 @@ async function install() {
268
318
  const defaultConfig = {
269
319
  $schema: CONFIG_SCHEMA_REF,
270
320
  agents: { ...DEFAULT_AGENT_CONFIGS },
271
- max_iterations: 5
321
+ max_iterations: 5,
322
+ auto_select_architect: true
272
323
  };
273
324
  saveJson(PLUGIN_CONFIG_PATH, defaultConfig);
274
325
  console.log("\u2713 Created default plugin config at:", PLUGIN_CONFIG_PATH);
@@ -421,7 +472,14 @@ async function uninstall() {
421
472
  return 0;
422
473
  }
423
474
  }
424
- if (!opencodeConfig.plugin || opencodeConfig.plugin.length === 0) {
475
+ if (!Array.isArray(opencodeConfig.plugin)) {
476
+ if (opencodeConfig.plugin) {
477
+ console.warn('\u26A0 opencode.json "plugin" field has an unexpected type (expected array); refusing to modify it.');
478
+ }
479
+ console.log("\u26A0 opencode-swarm is not installed (no plugins configured).");
480
+ return 0;
481
+ }
482
+ if (opencodeConfig.plugin.length === 0) {
425
483
  console.log("\u26A0 opencode-swarm is not installed (no plugins configured).");
426
484
  return 0;
427
485
  }
@@ -432,7 +490,7 @@ async function uninstall() {
432
490
  return 0;
433
491
  }
434
492
  opencodeConfig.plugin = filteredPlugins;
435
- if (opencodeConfig.agent) {
493
+ if (typeof opencodeConfig.agent === "object" && opencodeConfig.agent !== null && !Array.isArray(opencodeConfig.agent)) {
436
494
  delete opencodeConfig.agent.explore;
437
495
  delete opencodeConfig.agent.general;
438
496
  if (Object.keys(opencodeConfig.agent).length === 0) {
@@ -464,6 +522,17 @@ async function uninstall() {
464
522
  cleaned = true;
465
523
  }
466
524
  }
525
+ const backupPath = path.join(CONFIG_DIR, "opencode.swarm-install-backup.json");
526
+ if (fs.existsSync(backupPath)) {
527
+ const canonical = safeRealpathSync(backupPath, backupPath);
528
+ if (canonical === null || path.basename(canonical) !== "opencode.swarm-install-backup.json" || path.basename(path.dirname(canonical)) !== path.basename(CONFIG_DIR)) {
529
+ console.log(`\u2717 Refused to remove install backup (failed safety check): ${canonical ?? backupPath}`);
530
+ } else {
531
+ fs.unlinkSync(canonical);
532
+ console.log(`\u2713 Removed install backup: ${canonical}`);
533
+ cleaned = true;
534
+ }
535
+ }
467
536
  if (!cleaned) {
468
537
  console.log("\u2713 No config files to clean up");
469
538
  }
@@ -567,10 +636,12 @@ Valid commands: ${VALID_COMMANDS.join(", ")}`);
567
636
  }
568
637
  const resolved = resolveCommand(args);
569
638
  if (!resolved) {
570
- console.error(`Unknown command: ${args[0]}
571
- Valid commands: ${VALID_COMMANDS.join(", ")}`);
639
+ console.error(formatCommandNotFound(args));
572
640
  return 1;
573
641
  }
642
+ if (resolved.warning) {
643
+ console.error(resolved.warning);
644
+ }
574
645
  let policy = resolved.entry.toolPolicy;
575
646
  if (!policy) {
576
647
  const aliasOf = resolved.entry.aliasOf;
@@ -583,14 +654,24 @@ Valid commands: ${VALID_COMMANDS.join(", ")}`);
583
654
  console.error(`Refusing to run human-only command '${resolved.key}' from a non-interactive shell. ` + "Run it yourself in a terminal, or set SWARM_ALLOW_HUMAN_ONLY_CLI=1 if this is an explicitly approved automation.");
584
655
  return 1;
585
656
  }
586
- const result = await resolved.entry.handler({
587
- directory: cwd,
588
- args: resolved.remainingArgs,
589
- sessionID: "",
590
- agents: {},
591
- source: "cli",
592
- packageRoot: PACKAGE_ROOT
593
- });
657
+ let result;
658
+ try {
659
+ result = await resolved.entry.handler({
660
+ directory: cwd,
661
+ args: resolved.remainingArgs,
662
+ sessionID: "",
663
+ agents: {},
664
+ source: "cli",
665
+ packageRoot: PACKAGE_ROOT
666
+ });
667
+ } catch (error) {
668
+ console.error(`Error executing command '${resolved.key}': ${error instanceof Error ? error.message : String(error)}`);
669
+ return 1;
670
+ }
671
+ if (isCommandFailure(result)) {
672
+ console.log(result.text);
673
+ return result.exitCode ?? 1;
674
+ }
594
675
  console.log(result);
595
676
  return 0;
596
677
  }
@@ -9,31 +9,30 @@ import {
9
9
  maybeEscalateOnViolation,
10
10
  maybeQuarantineOnContradiction,
11
11
  readRecentEscalations
12
- } from "./index-7m32fjb4.js";
13
- import"./index-qbw3yw2d.js";
14
- import"./index-ggrp3v00.js";
15
- import"./index-r5q5gd2a.js";
12
+ } from "./index-g11h1qpk.js";
13
+ import"./index-qtxevgdx.js";
14
+ import"./index-anxs69ad.js";
15
+ import"./index-z6xqpmqg.js";
16
+ import"./index-p612v1mv.js";
17
+ import"./index-d224mhr9.js";
16
18
  import"./index-3qf1vxtb.js";
17
19
  import"./index-n832052r.js";
18
- import"./index-zjg4chy2.js";
19
- import"./index-z6xqpmqg.js";
20
- import"./index-r3mvsbtq.js";
21
- import"./index-rhqdsc1x.js";
22
- import"./index-aqppaaqx.js";
20
+ import"./index-j2svfhzk.js";
21
+ import"./index-grn6tkbt.js";
22
+ import"./index-ae75rja9.js";
23
+ import"./index-6rx1rdaq.js";
24
+ import"./index-7qefgq4j.js";
25
+ import"./index-jre6tm3v.js";
26
+ import"./index-gy0nyfbw.js";
27
+ import"./index-5ebgzb5a.js";
28
+ import"./index-7g4c7s5r.js";
29
+ import"./index-0mwjamha.js";
23
30
  import"./index-9e6fdz2h.js";
24
31
  import"./index-4rhhvd1a.js";
25
- import"./index-dsg9dw3b.js";
26
- import"./index-50j914b5.js";
32
+ import"./index-asey3tb3.js";
33
+ import"./index-a0d4fp6r.js";
27
34
  import"./index-zjygnfay.js";
28
- import"./index-ae75rja9.js";
29
- import"./index-vdn32nws.js";
30
- import"./index-xnb3tk7x.js";
31
35
  import"./index-bk5tah7q.js";
32
- import"./index-7qefgq4j.js";
33
- import"./index-2bgr671r.js";
34
- import"./index-9gxbjkts.js";
35
- import"./index-ww6zm5hr.js";
36
- import"./index-7g4c7s5r.js";
37
36
  import"./index-bpmtbmy9.js";
38
37
  import"./index-zgwm4ryv.js";
39
38
  import"./index-a76rekgs.js";
@@ -29,29 +29,28 @@ import {
29
29
  resolveKnowledgeCounterBaselinePath,
30
30
  resolveKnowledgeEventsPath,
31
31
  resolveLegacyApplicationLogPath
32
- } from "./index-ggrp3v00.js";
33
- import"./index-r5q5gd2a.js";
32
+ } from "./index-qtxevgdx.js";
33
+ import"./index-anxs69ad.js";
34
+ import"./index-z6xqpmqg.js";
35
+ import"./index-p612v1mv.js";
36
+ import"./index-d224mhr9.js";
34
37
  import"./index-3qf1vxtb.js";
35
38
  import"./index-n832052r.js";
36
- import"./index-zjg4chy2.js";
37
- import"./index-z6xqpmqg.js";
38
- import"./index-r3mvsbtq.js";
39
- import"./index-rhqdsc1x.js";
40
- import"./index-aqppaaqx.js";
39
+ import"./index-j2svfhzk.js";
40
+ import"./index-ae75rja9.js";
41
+ import"./index-6rx1rdaq.js";
42
+ import"./index-7qefgq4j.js";
43
+ import"./index-jre6tm3v.js";
44
+ import"./index-gy0nyfbw.js";
45
+ import"./index-5ebgzb5a.js";
46
+ import"./index-7g4c7s5r.js";
47
+ import"./index-0mwjamha.js";
41
48
  import"./index-9e6fdz2h.js";
42
49
  import"./index-4rhhvd1a.js";
43
- import"./index-dsg9dw3b.js";
44
- import"./index-50j914b5.js";
50
+ import"./index-asey3tb3.js";
51
+ import"./index-a0d4fp6r.js";
45
52
  import"./index-zjygnfay.js";
46
- import"./index-ae75rja9.js";
47
- import"./index-vdn32nws.js";
48
- import"./index-xnb3tk7x.js";
49
53
  import"./index-bk5tah7q.js";
50
- import"./index-7qefgq4j.js";
51
- import"./index-2bgr671r.js";
52
- import"./index-9gxbjkts.js";
53
- import"./index-ww6zm5hr.js";
54
- import"./index-7g4c7s5r.js";
55
54
  import"./index-bpmtbmy9.js";
56
55
  import"./index-zgwm4ryv.js";
57
56
  import"./index-a76rekgs.js";
@@ -12,12 +12,11 @@ import {
12
12
  resolveLinkDir,
13
13
  sanitizeLinkId,
14
14
  writeLinkPointer
15
- } from "./index-vdn32nws.js";
16
- import"./index-xnb3tk7x.js";
15
+ } from "./index-6rx1rdaq.js";
17
16
  import"./index-7qefgq4j.js";
18
- import"./index-2bgr671r.js";
19
- import"./index-9gxbjkts.js";
20
- import"./index-ww6zm5hr.js";
17
+ import"./index-jre6tm3v.js";
18
+ import"./index-gy0nyfbw.js";
19
+ import"./index-5ebgzb5a.js";
21
20
  import"./index-7g4c7s5r.js";
22
21
  import"./index-bpmtbmy9.js";
23
22
  import"./index-zgwm4ryv.js";
@@ -42,18 +42,17 @@ import {
42
42
  transactKnowledge,
43
43
  transactKnowledgeWithCas,
44
44
  wordBigrams
45
- } from "./index-qbw3yw2d.js";
45
+ } from "./index-grn6tkbt.js";
46
46
  import {
47
47
  resolveHiveDataDir
48
48
  } from "./index-ae75rja9.js";
49
- import"./index-vdn32nws.js";
50
- import"./index-xnb3tk7x.js";
51
- import"./index-bk5tah7q.js";
49
+ import"./index-6rx1rdaq.js";
52
50
  import"./index-7qefgq4j.js";
53
- import"./index-2bgr671r.js";
54
- import"./index-9gxbjkts.js";
55
- import"./index-ww6zm5hr.js";
51
+ import"./index-jre6tm3v.js";
52
+ import"./index-gy0nyfbw.js";
53
+ import"./index-5ebgzb5a.js";
56
54
  import"./index-7g4c7s5r.js";
55
+ import"./index-bk5tah7q.js";
57
56
  import"./index-bpmtbmy9.js";
58
57
  import"./index-zgwm4ryv.js";
59
58
  import"./index-a76rekgs.js";
@@ -23,19 +23,18 @@ import {
23
23
  validateLesson,
24
24
  validateSkillCandidatePath,
25
25
  validateSkillPath
26
- } from "./index-kc2tgcm7.js";
27
- import"./index-ggtmsm84.js";
26
+ } from "./index-7z9zqxqt.js";
27
+ import"./index-ajknebrc.js";
28
28
  import"./index-rtry5xyf.js";
29
- import"./index-qbw3yw2d.js";
29
+ import"./index-grn6tkbt.js";
30
30
  import"./index-ae75rja9.js";
31
- import"./index-vdn32nws.js";
32
- import"./index-xnb3tk7x.js";
33
- import"./index-bk5tah7q.js";
31
+ import"./index-6rx1rdaq.js";
34
32
  import"./index-7qefgq4j.js";
35
- import"./index-2bgr671r.js";
36
- import"./index-9gxbjkts.js";
37
- import"./index-ww6zm5hr.js";
33
+ import"./index-jre6tm3v.js";
34
+ import"./index-gy0nyfbw.js";
35
+ import"./index-5ebgzb5a.js";
38
36
  import"./index-7g4c7s5r.js";
37
+ import"./index-bk5tah7q.js";
39
38
  import"./index-bpmtbmy9.js";
40
39
  import"./index-zgwm4ryv.js";
41
40
  import"./index-a76rekgs.js";
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  DEFAULT_MODELS,
4
4
  init_constants
5
- } from "./index-50j914b5.js";
5
+ } from "./index-a0d4fp6r.js";
6
6
  import"./index-zjygnfay.js";
7
7
  import"./index-a76rekgs.js";
8
8
 
@@ -66,17 +66,26 @@ import {
66
66
  sweepStaleDelegations,
67
67
  updateCoderSettlement,
68
68
  writeDelegationFallback
69
- } from "./index-5jx22kwc.js";
70
- import"./index-zjg4chy2.js";
69
+ } from "./index-hhzzyjm3.js";
70
+ import"./index-anxs69ad.js";
71
71
  import"./index-z6xqpmqg.js";
72
- import"./index-r3mvsbtq.js";
73
- import"./index-dsg9dw3b.js";
74
- import"./index-zjygnfay.js";
72
+ import"./index-p612v1mv.js";
73
+ import"./index-6m24v15v.js";
74
+ import"./index-e45htt92.js";
75
+ import"./index-w6988bbc.js";
76
+ import"./index-ry16d01s.js";
77
+ import"./index-n4fzmqz8.js";
78
+ import"./index-j2svfhzk.js";
79
+ import"./index-grn6tkbt.js";
80
+ import"./index-ae75rja9.js";
81
+ import"./index-6rx1rdaq.js";
75
82
  import"./index-7qefgq4j.js";
76
- import"./index-2bgr671r.js";
77
- import"./index-9gxbjkts.js";
78
- import"./index-ww6zm5hr.js";
83
+ import"./index-jre6tm3v.js";
84
+ import"./index-gy0nyfbw.js";
85
+ import"./index-5ebgzb5a.js";
79
86
  import"./index-7g4c7s5r.js";
87
+ import"./index-zjygnfay.js";
88
+ import"./index-bk5tah7q.js";
80
89
  import"./index-bpmtbmy9.js";
81
90
  import"./index-zgwm4ryv.js";
82
91
  import"./index-a76rekgs.js";
@@ -14,17 +14,26 @@ import {
14
14
  sweepStale,
15
15
  unsubscribe,
16
16
  updateSnapshot
17
- } from "./index-zfs3zqeq.js";
18
- import"./index-zjg4chy2.js";
17
+ } from "./index-ptsqnxwd.js";
18
+ import"./index-anxs69ad.js";
19
19
  import"./index-z6xqpmqg.js";
20
- import"./index-r3mvsbtq.js";
21
- import"./index-dsg9dw3b.js";
22
- import"./index-zjygnfay.js";
20
+ import"./index-p612v1mv.js";
21
+ import"./index-6m24v15v.js";
22
+ import"./index-e45htt92.js";
23
+ import"./index-w6988bbc.js";
24
+ import"./index-ry16d01s.js";
25
+ import"./index-n4fzmqz8.js";
26
+ import"./index-j2svfhzk.js";
27
+ import"./index-grn6tkbt.js";
28
+ import"./index-ae75rja9.js";
29
+ import"./index-6rx1rdaq.js";
23
30
  import"./index-7qefgq4j.js";
24
- import"./index-2bgr671r.js";
25
- import"./index-9gxbjkts.js";
26
- import"./index-ww6zm5hr.js";
31
+ import"./index-jre6tm3v.js";
32
+ import"./index-gy0nyfbw.js";
33
+ import"./index-5ebgzb5a.js";
27
34
  import"./index-7g4c7s5r.js";
35
+ import"./index-zjygnfay.js";
36
+ import"./index-bk5tah7q.js";
28
37
  import"./index-bpmtbmy9.js";
29
38
  import"./index-zgwm4ryv.js";
30
39
  import"./index-a76rekgs.js";