opencode-swarm 3.2.1 → 3.3.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.
@@ -0,0 +1,2 @@
1
+ import type { SMEDomainConfig } from './base';
2
+ export declare const aiSMEConfig: SMEDomainConfig;
@@ -29,6 +29,7 @@ export declare const PluginConfigSchema: z.ZodObject<{
29
29
  }, z.core.$strip>>>;
30
30
  }, z.core.$strip>>>;
31
31
  max_iterations: z.ZodDefault<z.ZodNumber>;
32
+ qa_retry_limit: z.ZodDefault<z.ZodNumber>;
32
33
  multi_domain_sme: z.ZodDefault<z.ZodBoolean>;
33
34
  auto_detect_domains: z.ZodDefault<z.ZodBoolean>;
34
35
  inject_phase_reminders: z.ZodDefault<z.ZodBoolean>;
package/dist/index.js CHANGED
@@ -13759,9 +13759,10 @@ var PluginConfigSchema = exports_external.object({
13759
13759
  agents: exports_external.record(exports_external.string(), AgentOverrideConfigSchema).optional(),
13760
13760
  swarms: exports_external.record(exports_external.string(), SwarmConfigSchema).optional(),
13761
13761
  max_iterations: exports_external.number().min(1).max(10).default(5),
13762
+ qa_retry_limit: exports_external.number().min(1).max(10).default(3),
13762
13763
  multi_domain_sme: exports_external.boolean().default(true),
13763
13764
  auto_detect_domains: exports_external.boolean().default(true),
13764
- inject_phase_reminders: exports_external.boolean().default(false)
13765
+ inject_phase_reminders: exports_external.boolean().default(true)
13765
13766
  });
13766
13767
  // src/config/loader.ts
13767
13768
  import * as fs from "fs";
@@ -13812,9 +13813,10 @@ function loadPluginConfig(directory) {
13812
13813
  const projectConfigPath = path.join(directory, ".opencode", CONFIG_FILENAME);
13813
13814
  let config2 = loadConfigFromPath(userConfigPath) ?? {
13814
13815
  max_iterations: 5,
13816
+ qa_retry_limit: 3,
13815
13817
  multi_domain_sme: true,
13816
13818
  auto_detect_domains: true,
13817
- inject_phase_reminders: false
13819
+ inject_phase_reminders: true
13818
13820
  };
13819
13821
  const projectConfig = loadConfigFromPath(projectConfigPath);
13820
13822
  if (projectConfig) {
@@ -13868,12 +13870,12 @@ You THINK. Subagents DO. You have the largest context window and strongest reaso
13868
13870
  1. DELEGATE all coding to @{{AGENT_PREFIX}}coder. You do NOT write code.
13869
13871
  2. ONE agent per message. Send, STOP, wait for response.
13870
13872
  3. ONE task per @{{AGENT_PREFIX}}coder call. Never batch.
13871
- 4. Fallback: Only code yourself after 3 @{{AGENT_PREFIX}}coder failures on same task.
13873
+ 4. Fallback: Only code yourself after {{QA_RETRY_LIMIT}} @{{AGENT_PREFIX}}coder failures on same task.
13872
13874
 
13873
13875
  ## AGENTS
13874
13876
 
13875
13877
  @{{AGENT_PREFIX}}explorer - Codebase analysis
13876
- @{{AGENT_PREFIX}}sme_[domain] - Domain expertise (windows, powershell, python, oracle, network, security, linux, vmware, azure, active_directory, ui_ux, web, database, devops, api)
13878
+ @{{AGENT_PREFIX}}sme_[domain] - Domain expertise (windows, powershell, python, oracle, network, security, linux, vmware, azure, active_directory, ui_ux, web, database, devops, api, ai)
13877
13879
  @{{AGENT_PREFIX}}coder - Implementation (one task at a time)
13878
13880
  @{{AGENT_PREFIX}}test_engineer - Test generation
13879
13881
  @{{AGENT_PREFIX}}security_reviewer - Vulnerability review
@@ -13969,8 +13971,8 @@ For each task (respecting dependencies):
13969
13971
  5c. @{{AGENT_PREFIX}}auditor - Verify
13970
13972
  5d. Result:
13971
13973
  - APPROVED \u2192 5e
13972
- - REJECTED (attempt 1-2) \u2192 Feedback to @{{AGENT_PREFIX}}coder, retry
13973
- - REJECTED (attempt 3) \u2192 Escalate, handle directly
13974
+ - REJECTED (attempt < {{QA_RETRY_LIMIT}}) \u2192 Feedback to @{{AGENT_PREFIX}}coder, retry
13975
+ - REJECTED (attempt {{QA_RETRY_LIMIT}}) \u2192 Escalate, handle directly
13974
13976
  5e. @{{AGENT_PREFIX}}test_engineer - Generate tests
13975
13977
  5f. Update plan.md [x], proceed to next task
13976
13978
 
@@ -14348,6 +14350,20 @@ var activeDirectorySMEConfig = {
14348
14350
  - ADSI/DirectoryServices .NET`
14349
14351
  };
14350
14352
 
14353
+ // src/agents/sme/ai.ts
14354
+ var aiSMEConfig = {
14355
+ domain: "ai",
14356
+ description: "AI/LLM systems and prompt engineering",
14357
+ guidance: `- Prompt engineering (CoT, few-shot, structured output)
14358
+ - Context window management, token optimization
14359
+ - Model selection tradeoffs (cost, latency, capability)
14360
+ - Agent orchestration patterns (delegation, handoff)
14361
+ - RAG architectures, embedding strategies
14362
+ - Fine-tuning vs prompting decisions
14363
+ - Safety/alignment considerations
14364
+ - Tool use and function calling patterns`
14365
+ };
14366
+
14351
14367
  // src/agents/sme/api.ts
14352
14368
  var apiSMEConfig = {
14353
14369
  domain: "api",
@@ -14561,7 +14577,8 @@ var SME_CONFIGS = {
14561
14577
  web: webSMEConfig,
14562
14578
  database: databaseSMEConfig,
14563
14579
  devops: devopsSMEConfig,
14564
- api: apiSMEConfig
14580
+ api: apiSMEConfig,
14581
+ ai: aiSMEConfig
14565
14582
  };
14566
14583
  var AGENT_TO_DOMAIN = {
14567
14584
  sme_windows: "windows",
@@ -14578,7 +14595,8 @@ var AGENT_TO_DOMAIN = {
14578
14595
  sme_web: "web",
14579
14596
  sme_database: "database",
14580
14597
  sme_devops: "devops",
14581
- sme_api: "api"
14598
+ sme_api: "api",
14599
+ sme_ai: "ai"
14582
14600
  };
14583
14601
  function createAllSMEAgents(getModel, loadPrompt) {
14584
14602
  return Object.entries(AGENT_TO_DOMAIN).map(([agentName, domain2]) => {
@@ -14633,11 +14651,12 @@ function applyOverrides(agent, swarmAgents, swarmPrefix) {
14633
14651
  }
14634
14652
  return agent;
14635
14653
  }
14636
- function createSwarmAgents(swarmId, swarmConfig, isDefault) {
14654
+ function createSwarmAgents(swarmId, swarmConfig, isDefault, pluginConfig) {
14637
14655
  const agents = [];
14638
14656
  const swarmAgents = swarmConfig.agents;
14639
14657
  const prefix = isDefault ? "" : `${swarmId}_`;
14640
14658
  const swarmPrefix = isDefault ? undefined : swarmId;
14659
+ const qaRetryLimit = pluginConfig?.qa_retry_limit ?? 3;
14641
14660
  const getModel = (baseName) => getModelForAgent(baseName, swarmAgents, swarmPrefix);
14642
14661
  const getPrompts = (name) => loadAgentPrompt(name);
14643
14662
  const prefixName = (name) => `${prefix}${name}`;
@@ -14649,7 +14668,7 @@ function createSwarmAgents(swarmId, swarmConfig, isDefault) {
14649
14668
  const swarmName = swarmConfig.name || swarmId;
14650
14669
  const swarmIdentity = isDefault ? "default" : swarmId;
14651
14670
  const agentPrefix = prefix;
14652
- architect.config.prompt = architect.config.prompt?.replace(/\{\{SWARM_ID\}\}/g, swarmIdentity).replace(/\{\{AGENT_PREFIX\}\}/g, agentPrefix);
14671
+ architect.config.prompt = architect.config.prompt?.replace(/\{\{SWARM_ID\}\}/g, swarmIdentity).replace(/\{\{AGENT_PREFIX\}\}/g, agentPrefix).replace(/\{\{QA_RETRY_LIMIT\}\}/g, String(qaRetryLimit));
14653
14672
  if (!isDefault) {
14654
14673
  architect.description = `[${swarmName}] ${architect.description}`;
14655
14674
  const swarmHeader = `## \u26A0\uFE0F YOU ARE THE ${swarmName.toUpperCase()} SWARM ARCHITECT
@@ -14711,7 +14730,7 @@ function createAgents(config2) {
14711
14730
  for (const swarmId of swarmIds) {
14712
14731
  const swarmConfig = swarms[swarmId];
14713
14732
  const isDefault = swarmId === defaultSwarmId;
14714
- const swarmAgents = createSwarmAgents(swarmId, swarmConfig, isDefault);
14733
+ const swarmAgents = createSwarmAgents(swarmId, swarmConfig, isDefault, config2);
14715
14734
  allAgents.push(...swarmAgents);
14716
14735
  }
14717
14736
  } else {
@@ -14719,7 +14738,7 @@ function createAgents(config2) {
14719
14738
  name: "Default",
14720
14739
  agents: config2?.agents
14721
14740
  };
14722
- const swarmAgents = createSwarmAgents("default", legacySwarmConfig, true);
14741
+ const swarmAgents = createSwarmAgents("default", legacySwarmConfig, true, config2);
14723
14742
  allAgents.push(...swarmAgents);
14724
14743
  }
14725
14744
  return allAgents;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-swarm",
3
- "version": "3.2.1",
3
+ "version": "3.3.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",