opencode-swarm 7.21.5 → 7.22.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.
package/dist/cli/index.js CHANGED
@@ -34,7 +34,7 @@ var package_default;
34
34
  var init_package = __esm(() => {
35
35
  package_default = {
36
36
  name: "opencode-swarm",
37
- version: "7.21.5",
37
+ version: "7.22.0",
38
38
  description: "Architect-centric agentic swarm plugin for OpenCode - hub-and-spoke orchestration with SME consultation, code generation, and QA review",
39
39
  main: "dist/index.js",
40
40
  types: "dist/index.d.ts",
@@ -17455,6 +17455,14 @@ var init_schema = __esm(() => {
17455
17455
  const trimmed = v.trim();
17456
17456
  return trimmed === "" ? undefined : trimmed;
17457
17457
  }),
17458
+ auto_select_architect: exports_external.union([exports_external.boolean(), exports_external.string()]).optional().transform((v) => {
17459
+ if (v === undefined)
17460
+ return;
17461
+ if (typeof v === "boolean")
17462
+ return v;
17463
+ const trimmed = v.trim();
17464
+ return trimmed === "" ? false : trimmed;
17465
+ }),
17458
17466
  swarms: exports_external.record(exports_external.string(), SwarmConfigSchema).optional(),
17459
17467
  max_iterations: exports_external.number().min(1).max(10).default(5),
17460
17468
  pipeline: PipelineConfigSchema.optional(),
@@ -828,6 +828,7 @@ export declare const PluginConfigSchema: z.ZodObject<{
828
828
  fallback_models: z.ZodOptional<z.ZodArray<z.ZodString>>;
829
829
  }, z.core.$strip>>>;
830
830
  default_agent: z.ZodPipe<z.ZodOptional<z.ZodString>, z.ZodTransform<string | undefined, string | undefined>>;
831
+ auto_select_architect: z.ZodPipe<z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodString]>>, z.ZodTransform<string | boolean | undefined, string | boolean | undefined>>;
831
832
  swarms: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
832
833
  name: z.ZodOptional<z.ZodString>;
833
834
  agents: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
package/dist/index.js CHANGED
@@ -33,7 +33,7 @@ var package_default;
33
33
  var init_package = __esm(() => {
34
34
  package_default = {
35
35
  name: "opencode-swarm",
36
- version: "7.21.5",
36
+ version: "7.22.0",
37
37
  description: "Architect-centric agentic swarm plugin for OpenCode - hub-and-spoke orchestration with SME consultation, code generation, and QA review",
38
38
  main: "dist/index.js",
39
39
  types: "dist/index.d.ts",
@@ -15668,6 +15668,14 @@ var init_schema = __esm(() => {
15668
15668
  const trimmed = v.trim();
15669
15669
  return trimmed === "" ? undefined : trimmed;
15670
15670
  }),
15671
+ auto_select_architect: exports_external.union([exports_external.boolean(), exports_external.string()]).optional().transform((v) => {
15672
+ if (v === undefined)
15673
+ return;
15674
+ if (typeof v === "boolean")
15675
+ return v;
15676
+ const trimmed = v.trim();
15677
+ return trimmed === "" ? false : trimmed;
15678
+ }),
15671
15679
  swarms: exports_external.record(exports_external.string(), SwarmConfigSchema).optional(),
15672
15680
  max_iterations: exports_external.number().min(1).max(10).default(5),
15673
15681
  pipeline: PipelineConfigSchema.optional(),
@@ -105323,11 +105331,65 @@ async function initializeOpenCodeSwarm(ctx) {
105323
105331
  swarm_command: createSwarmCommandTool(agentDefinitionMap)
105324
105332
  },
105325
105333
  config: async (opencodeConfig) => {
105334
+ if (!opencodeConfig.agent || typeof opencodeConfig.agent !== "object") {
105335
+ opencodeConfig.agent = {};
105336
+ }
105326
105337
  if (!opencodeConfig.agent) {
105327
105338
  opencodeConfig.agent = { ...agents };
105328
105339
  } else {
105329
105340
  Object.assign(opencodeConfig.agent, agents);
105330
105341
  }
105342
+ const autoSelect = config3?.auto_select_architect;
105343
+ if (autoSelect) {
105344
+ const hasArchitect = Object.keys(agents).some((name2) => stripKnownSwarmPrefix(name2) === "architect");
105345
+ if (hasArchitect) {
105346
+ for (const builtin of ["build", "plan"]) {
105347
+ const existing = opencodeConfig.agent?.[builtin];
105348
+ if (existing && typeof existing === "object" && existing.disable === true) {
105349
+ continue;
105350
+ }
105351
+ opencodeConfig.agent[builtin] = {
105352
+ ...existing && typeof existing === "object" ? existing : {},
105353
+ disable: true
105354
+ };
105355
+ }
105356
+ if (autoSelect === true) {
105357
+ const primaryArchitects = Object.entries(agents).filter(([name2, cfg]) => stripKnownSwarmPrefix(name2) === "architect" && cfg.mode === "primary");
105358
+ if (primaryArchitects.length > 1) {
105359
+ const names = primaryArchitects.map(([n]) => n).join(", ");
105360
+ addDeferredWarning(`[swarm] auto_select_architect is true but ${primaryArchitects.length} architect agents are primary (${names}). Consider setting auto_select_architect to a specific agent name.`);
105361
+ }
105362
+ }
105363
+ if (typeof autoSelect === "string" && autoSelect !== "") {
105364
+ const targetName = autoSelect;
105365
+ const targetIsArchitect = Object.hasOwn(agents, targetName) && stripKnownSwarmPrefix(targetName) === "architect";
105366
+ if (targetIsArchitect) {
105367
+ for (const [name2, cfg] of Object.entries(agents)) {
105368
+ if (stripKnownSwarmPrefix(name2) === "architect" && name2 !== targetName) {
105369
+ if (opencodeConfig.agent && typeof opencodeConfig.agent === "object") {
105370
+ opencodeConfig.agent[name2] = {
105371
+ ...cfg && typeof cfg === "object" ? cfg : {},
105372
+ mode: "subagent"
105373
+ };
105374
+ }
105375
+ }
105376
+ }
105377
+ if (opencodeConfig.agent && typeof opencodeConfig.agent === "object") {
105378
+ const targetExisting = opencodeConfig.agent[targetName];
105379
+ opencodeConfig.agent[targetName] = {
105380
+ ...targetExisting && typeof targetExisting === "object" ? targetExisting : {},
105381
+ ...agents[targetName] && typeof agents[targetName] === "object" ? agents[targetName] : {},
105382
+ mode: "primary"
105383
+ };
105384
+ }
105385
+ } else {
105386
+ addDeferredWarning(`[swarm] auto_select_architect is set to "${targetName}" but that is not a known architect agent. No architect demotion applied.`);
105387
+ }
105388
+ }
105389
+ } else {
105390
+ addDeferredWarning("[swarm] auto_select_architect is enabled but no architect agents were found in the generated set. The option has no effect.");
105391
+ }
105392
+ }
105331
105393
  opencodeConfig.command = {
105332
105394
  ...opencodeConfig.command || {},
105333
105395
  swarm: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-swarm",
3
- "version": "7.21.5",
3
+ "version": "7.22.0",
4
4
  "description": "Architect-centric agentic swarm plugin for OpenCode - hub-and-spoke orchestration with SME consultation, code generation, and QA review",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",