opencode-swarm 1.0.13 → 2.0.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.
@@ -16,4 +16,4 @@ export { createCoderAgent } from './coder';
16
16
  export { createSecurityReviewerAgent } from './security-reviewer';
17
17
  export { createAuditorAgent } from './auditor';
18
18
  export { createTestEngineerAgent } from './test-engineer';
19
- export { createAllSMEAgents, createSMEAgent, listDomains } from './sme';
19
+ export { createUnifiedSMEAgent, AVAILABLE_DOMAINS } from './sme-unified';
@@ -0,0 +1,3 @@
1
+ import type { AgentDefinition } from './architect';
2
+ export declare function createUnifiedSMEAgent(model: string, customPrompt?: string, customAppendPrompt?: string): AgentDefinition;
3
+ export declare const AVAILABLE_DOMAINS: string[];
@@ -1,20 +1,19 @@
1
- export declare const SME_AGENTS: readonly ["sme_windows", "sme_powershell", "sme_python", "sme_oracle", "sme_network", "sme_security", "sme_linux", "sme_vmware", "sme_azure", "sme_active_directory", "sme_ui_ux"];
1
+ export declare const SME_AGENT: "sme";
2
2
  export declare const QA_AGENTS: readonly ["security_reviewer", "auditor"];
3
3
  export declare const PIPELINE_AGENTS: readonly ["coder", "test_engineer"];
4
4
  export declare const ORCHESTRATOR_NAME: "architect";
5
- export declare const ALL_SUBAGENT_NAMES: readonly ["sme_windows", "sme_powershell", "sme_python", "sme_oracle", "sme_network", "sme_security", "sme_linux", "sme_vmware", "sme_azure", "sme_active_directory", "sme_ui_ux", "security_reviewer", "auditor", "coder", "test_engineer"];
6
- export declare const ALL_AGENT_NAMES: readonly ["architect", "sme_windows", "sme_powershell", "sme_python", "sme_oracle", "sme_network", "sme_security", "sme_linux", "sme_vmware", "sme_azure", "sme_active_directory", "sme_ui_ux", "security_reviewer", "auditor", "coder", "test_engineer"];
7
- export type SMEAgentName = (typeof SME_AGENTS)[number];
5
+ export declare const ALL_SUBAGENT_NAMES: readonly ["sme", "security_reviewer", "auditor", "coder", "test_engineer"];
6
+ export declare const ALL_AGENT_NAMES: readonly ["architect", "sme", "security_reviewer", "auditor", "coder", "test_engineer"];
8
7
  export type QAAgentName = (typeof QA_AGENTS)[number];
9
8
  export type PipelineAgentName = (typeof PIPELINE_AGENTS)[number];
10
9
  export type AgentName = (typeof ALL_AGENT_NAMES)[number];
10
+ export type SMEAgentName = 'sme';
11
11
  export declare const CATEGORY_PREFIXES: {
12
12
  readonly sme: "_sme";
13
13
  readonly qa: "_qa";
14
14
  };
15
15
  export declare const DEFAULT_MODELS: Record<string, string>;
16
16
  export declare const DOMAIN_PATTERNS: Record<string, RegExp[]>;
17
- export declare function domainToAgentName(domain: string): SMEAgentName;
18
- export declare function isSMEAgent(name: string): name is SMEAgentName;
17
+ export declare function domainToAgentName(_domain: string): 'sme';
19
18
  export declare function isQAAgent(name: string): name is QAAgentName;
20
19
  export declare function isSubagent(name: string): boolean;
@@ -1,5 +1,5 @@
1
- export { ALL_AGENT_NAMES, ALL_SUBAGENT_NAMES, CATEGORY_PREFIXES, DEFAULT_MODELS, DOMAIN_PATTERNS, ORCHESTRATOR_NAME, PIPELINE_AGENTS, QA_AGENTS, SME_AGENTS, domainToAgentName, isQAAgent, isSMEAgent, isSubagent, } from './constants';
1
+ export { ALL_AGENT_NAMES, ALL_SUBAGENT_NAMES, CATEGORY_PREFIXES, DEFAULT_MODELS, DOMAIN_PATTERNS, ORCHESTRATOR_NAME, PIPELINE_AGENTS, QA_AGENTS, SME_AGENT, domainToAgentName, isQAAgent, isSubagent, } from './constants';
2
2
  export type { AgentName, PipelineAgentName, QAAgentName, SMEAgentName, } from './constants';
3
- export { AgentOverrideConfigSchema, PluginConfigSchema, PresetSchema, SwarmModeSchema, } from './schema';
4
- export type { AgentOverrideConfig, PluginConfig, Preset, SwarmMode, } from './schema';
5
- export { getOutputDir, loadAgentPrompt, loadPluginConfig, } from './loader';
3
+ export { AgentOverrideConfigSchema, PluginConfigSchema, } from './schema';
4
+ export type { AgentOverrideConfig, PluginConfig, } from './schema';
5
+ export { loadAgentPrompt, loadPluginConfig, } from './loader';
@@ -17,7 +17,3 @@ export declare function loadAgentPrompt(agentName: string): {
17
17
  prompt?: string;
18
18
  appendPrompt?: string;
19
19
  };
20
- /**
21
- * Get the output directory for generated files.
22
- */
23
- export declare function getOutputDir(config: PluginConfig, projectDir: string): string;
@@ -5,40 +5,14 @@ export declare const AgentOverrideConfigSchema: z.ZodObject<{
5
5
  disabled: z.ZodOptional<z.ZodBoolean>;
6
6
  }, z.core.$strip>;
7
7
  export type AgentOverrideConfig = z.infer<typeof AgentOverrideConfigSchema>;
8
- export declare const PresetSchema: z.ZodRecord<z.ZodString, z.ZodObject<{
9
- model: z.ZodOptional<z.ZodString>;
10
- temperature: z.ZodOptional<z.ZodNumber>;
11
- disabled: z.ZodOptional<z.ZodBoolean>;
12
- }, z.core.$strip>>;
13
- export type Preset = z.infer<typeof PresetSchema>;
14
- export declare const SwarmModeSchema: z.ZodEnum<{
15
- remote: "remote";
16
- hybrid: "hybrid";
17
- }>;
18
- export type SwarmMode = z.infer<typeof SwarmModeSchema>;
19
8
  export declare const PluginConfigSchema: z.ZodObject<{
20
- preset: z.ZodOptional<z.ZodString>;
21
- presets: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodObject<{
22
- model: z.ZodOptional<z.ZodString>;
23
- temperature: z.ZodOptional<z.ZodNumber>;
24
- disabled: z.ZodOptional<z.ZodBoolean>;
25
- }, z.core.$strip>>>>;
26
9
  agents: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
27
10
  model: z.ZodOptional<z.ZodString>;
28
11
  temperature: z.ZodOptional<z.ZodNumber>;
29
12
  disabled: z.ZodOptional<z.ZodBoolean>;
30
13
  }, z.core.$strip>>>;
31
14
  max_iterations: z.ZodDefault<z.ZodNumber>;
32
- output_dir: z.ZodOptional<z.ZodString>;
33
- swarm_mode: z.ZodDefault<z.ZodEnum<{
34
- remote: "remote";
35
- hybrid: "hybrid";
36
- }>>;
37
- gpu_url: z.ZodOptional<z.ZodString>;
38
- gpu_model: z.ZodOptional<z.ZodString>;
39
- npu_url: z.ZodOptional<z.ZodString>;
40
- npu_model: z.ZodOptional<z.ZodString>;
41
- global_fallback_models: z.ZodOptional<z.ZodArray<z.ZodString>>;
15
+ multi_domain_sme: z.ZodDefault<z.ZodBoolean>;
42
16
  auto_detect_domains: z.ZodDefault<z.ZodBoolean>;
43
17
  inject_phase_reminders: z.ZodDefault<z.ZodBoolean>;
44
18
  }, z.core.$strip>;
package/dist/index.d.ts CHANGED
@@ -11,5 +11,5 @@ import type { Plugin } from '@opencode-ai/plugin';
11
11
  */
12
12
  declare const OpenCodeSwarm: Plugin;
13
13
  export default OpenCodeSwarm;
14
- export type { AgentName, PluginConfig, SMEAgentName, QAAgentName, PipelineAgentName, SwarmMode, } from './config';
14
+ export type { AgentName, PluginConfig, SMEAgentName, QAAgentName, PipelineAgentName, } from './config';
15
15
  export type { AgentDefinition } from './agents';
package/dist/index.js CHANGED
@@ -11,24 +11,12 @@ var __export = (target, all) => {
11
11
  };
12
12
 
13
13
  // src/config/constants.ts
14
- var SME_AGENTS = [
15
- "sme_windows",
16
- "sme_powershell",
17
- "sme_python",
18
- "sme_oracle",
19
- "sme_network",
20
- "sme_security",
21
- "sme_linux",
22
- "sme_vmware",
23
- "sme_azure",
24
- "sme_active_directory",
25
- "sme_ui_ux"
26
- ];
14
+ var SME_AGENT = "sme";
27
15
  var QA_AGENTS = ["security_reviewer", "auditor"];
28
16
  var PIPELINE_AGENTS = ["coder", "test_engineer"];
29
17
  var ORCHESTRATOR_NAME = "architect";
30
18
  var ALL_SUBAGENT_NAMES = [
31
- ...SME_AGENTS,
19
+ SME_AGENT,
32
20
  ...QA_AGENTS,
33
21
  ...PIPELINE_AGENTS
34
22
  ];
@@ -42,7 +30,8 @@ var CATEGORY_PREFIXES = {
42
30
  };
43
31
  var DEFAULT_MODELS = {
44
32
  architect: "anthropic/claude-sonnet-4.5",
45
- coder: "openai/gpt-5.2-codex",
33
+ sme: "google/gemini-3-flash",
34
+ coder: "anthropic/claude-sonnet-4.5",
46
35
  test_engineer: "google/gemini-3-flash",
47
36
  _sme: "google/gemini-3-flash",
48
37
  _qa: "google/gemini-3-flash",
@@ -202,9 +191,6 @@ var DOMAIN_PATTERNS = {
202
191
  /\bresponsive\b/i
203
192
  ]
204
193
  };
205
- function isSMEAgent(name) {
206
- return SME_AGENTS.includes(name);
207
- }
208
194
  function isQAAgent(name) {
209
195
  return QA_AGENTS.includes(name);
210
196
  }
@@ -13749,22 +13735,12 @@ var AgentOverrideConfigSchema = exports_external.object({
13749
13735
  temperature: exports_external.number().min(0).max(2).optional(),
13750
13736
  disabled: exports_external.boolean().optional()
13751
13737
  });
13752
- var PresetSchema = exports_external.record(exports_external.string(), AgentOverrideConfigSchema);
13753
- var SwarmModeSchema = exports_external.enum(["remote", "hybrid"]);
13754
13738
  var PluginConfigSchema = exports_external.object({
13755
- preset: exports_external.string().optional(),
13756
- presets: exports_external.record(exports_external.string(), PresetSchema).optional(),
13757
13739
  agents: exports_external.record(exports_external.string(), AgentOverrideConfigSchema).optional(),
13758
13740
  max_iterations: exports_external.number().min(1).max(10).default(5),
13759
- output_dir: exports_external.string().optional(),
13760
- swarm_mode: SwarmModeSchema.default("remote"),
13761
- gpu_url: exports_external.string().optional(),
13762
- gpu_model: exports_external.string().optional(),
13763
- npu_url: exports_external.string().optional(),
13764
- npu_model: exports_external.string().optional(),
13765
- global_fallback_models: exports_external.array(exports_external.string()).optional(),
13741
+ multi_domain_sme: exports_external.boolean().default(true),
13766
13742
  auto_detect_domains: exports_external.boolean().default(true),
13767
- inject_phase_reminders: exports_external.boolean().default(true)
13743
+ inject_phase_reminders: exports_external.boolean().default(false)
13768
13744
  });
13769
13745
  // src/config/loader.ts
13770
13746
  import * as fs from "fs";
@@ -13815,9 +13791,9 @@ function loadPluginConfig(directory) {
13815
13791
  const projectConfigPath = path.join(directory, ".opencode", CONFIG_FILENAME);
13816
13792
  let config2 = loadConfigFromPath(userConfigPath) ?? {
13817
13793
  max_iterations: 5,
13818
- swarm_mode: "remote",
13794
+ multi_domain_sme: true,
13819
13795
  auto_detect_domains: true,
13820
- inject_phase_reminders: true
13796
+ inject_phase_reminders: false
13821
13797
  };
13822
13798
  const projectConfig = loadConfigFromPath(projectConfigPath);
13823
13799
  if (projectConfig) {
@@ -13827,20 +13803,6 @@ function loadPluginConfig(directory) {
13827
13803
  agents: deepMerge(config2.agents, projectConfig.agents)
13828
13804
  };
13829
13805
  }
13830
- const envPreset = process.env.OPENCODE_SWARM_PRESET;
13831
- if (envPreset) {
13832
- config2.preset = envPreset;
13833
- }
13834
- if (config2.preset) {
13835
- const preset = config2.presets?.[config2.preset];
13836
- if (preset) {
13837
- config2.agents = deepMerge(preset, config2.agents);
13838
- } else {
13839
- const presetSource = envPreset === config2.preset ? "environment variable" : "config file";
13840
- const availablePresets = config2.presets ? Object.keys(config2.presets).join(", ") : "none";
13841
- console.warn(`[opencode-swarm] Preset "${config2.preset}" not found (from ${presetSource}). Available: ${availablePresets}`);
13842
- }
13843
- }
13844
13806
  return config2;
13845
13807
  }
13846
13808
  function loadAgentPrompt(agentName) {
@@ -13867,41 +13829,33 @@ function loadAgentPrompt(agentName) {
13867
13829
  // src/agents/architect.ts
13868
13830
  var ARCHITECT_PROMPT = `You are Architect - an AI coding orchestrator that coordinates specialists to deliver quality code.
13869
13831
 
13870
- **Role**: Analyze requests, coordinate SME consultations, delegate implementation, and manage QA review.
13832
+ **Role**: Analyze requests, consult SME for domain expertise, delegate implementation, and manage QA review.
13871
13833
 
13872
13834
  **Agents**:
13873
13835
 
13874
- @sme_windows - Windows OS internals, registry, services, WMI/CIM
13875
- @sme_powershell - PowerShell scripting, cmdlets, modules, remoting
13876
- @sme_python - Python ecosystem, libraries, best practices
13877
- @sme_oracle - Oracle Database, SQL/PLSQL, administration
13878
- @sme_network - Networking, firewalls, DNS, TLS/SSL, load balancing
13879
- @sme_security - STIG compliance, hardening, CVE, encryption, PKI
13880
- @sme_linux - Linux administration, systemd, package management
13881
- @sme_vmware - VMware vSphere, ESXi, PowerCLI, virtualization
13882
- @sme_azure - Azure cloud services, Entra ID, ARM/Bicep
13883
- @sme_active_directory - Active Directory, LDAP, Group Policy, Kerberos
13884
- @sme_ui_ux - UI/UX design, interaction patterns, accessibility
13885
-
13836
+ @sme - Multi-domain subject matter expert (handles all technical domains in one call)
13886
13837
  @coder - Implementation specialist, writes production code
13887
13838
  @security_reviewer - Security audit, vulnerability assessment
13888
13839
  @auditor - Code quality review, correctness verification
13889
13840
  @test_engineer - Test case generation and validation scripts
13890
13841
 
13842
+ **Available SME Domains**: windows, powershell, python, oracle, network, security, linux, vmware, azure, active_directory, ui_ux
13843
+
13891
13844
  **Workflow**:
13892
13845
 
13893
13846
  ## 1. Analyze (you do this)
13894
13847
  Parse request: explicit requirements + implicit needs.
13895
- Identify which SME domains are relevant.
13848
+ Identify which domains are relevant.
13896
13849
  Create initial specification.
13897
13850
 
13898
- ## 2. SME Consultation (delegate serially)
13899
- For each relevant domain, delegate to @sme_* agent one at a time.
13900
- Wait for each response before calling the next.
13851
+ ## 2. SME Consultation (single call to @sme)
13852
+ Delegate to @sme with ALL relevant domains in one request.
13853
+ Example: "I need expertise for: windows, powershell, security"
13854
+ Wait for response.
13901
13855
 
13902
13856
  ## 3. Collate (you do this)
13903
- Synthesize SME inputs into unified specification.
13904
- Resolve conflicts, remove redundancy, ensure clarity.
13857
+ Synthesize SME input into unified specification.
13858
+ Ensure clarity and completeness.
13905
13859
 
13906
13860
  ## 4. Code (delegate to @coder)
13907
13861
  Send unified specification to @coder.
@@ -13924,7 +13878,7 @@ Send approved code to @test_engineer for test generation.
13924
13878
  - All agents run serially (one at a time)
13925
13879
  - Wait for each agent response before calling the next
13926
13880
  - Reference paths/lines, don't paste entire files
13927
- - Brief delegation notices: "Consulting @sme_powershell..." not lengthy explanations
13881
+ - Brief delegation notices: "Consulting @sme for windows, powershell..."
13928
13882
 
13929
13883
  **Communication**:
13930
13884
  - Be direct, no preamble or flattery
@@ -14025,13 +13979,15 @@ var CODER_PROMPT = `You are Coder - a fast, focused implementation specialist.
14025
13979
  **Behavior**:
14026
13980
  - Read files before using edit/write tools and gather exact content before making changes
14027
13981
  - Execute the task specification provided by the Architect
14028
- - Be fast and direct - implement, don't plan or research
13982
+ - Be fast and direct - implement the code, don't research or look up documentation
14029
13983
  - Report completion with summary of changes
14030
13984
 
14031
13985
  **Constraints**:
14032
13986
  - No delegation to other agents
14033
- - No external research
14034
- - If context is insufficient, read the files; only ask for missing inputs you cannot retrieve
13987
+ - No web searches or fetching external URLs
13988
+ - No looking up documentation online
13989
+ - Just write the code based on the specification you received
13990
+ - If you don't know an API, use your training knowledge or make reasonable choices
14035
13991
 
14036
13992
  **Output Format**:
14037
13993
  <summary>
@@ -14185,56 +14141,60 @@ ${customAppendPrompt}`;
14185
14141
  };
14186
14142
  }
14187
14143
 
14188
- // src/agents/sme/base.ts
14189
- function createSMEPrompt(config2) {
14190
- const { domain: domain2, description, guidance } = config2;
14191
- return `You are ${domain2}_SME - a subject matter expert in ${description}.
14192
-
14193
- **Role**: Provide domain-specific technical context to enhance the Architect's specification. Your output will be read by the Architect for collation, not directly by a human or coder.
14144
+ // src/agents/sme-unified.ts
14145
+ var DOMAIN_EXPERTISE = {
14146
+ windows: `Windows OS: Registry, services, WMI/CIM, event logs, scheduled tasks, Group Policy, installers, WinRM`,
14147
+ powershell: `PowerShell: Cmdlets, modules, remoting, Pester testing, pipeline, error handling, PSCustomObject`,
14148
+ python: `Python: pip, venv, Django, Flask, pandas, numpy, pytest, async/await, type hints`,
14149
+ oracle: `Oracle DB: SQL/PLSQL, tablespaces, RMAN, DataGuard, ASM, RAC, TNS, ORA errors`,
14150
+ network: `Networking: TCP/UDP, DNS, DHCP, firewalls, VLANs, routing, load balancing, TLS/SSL, certificates`,
14151
+ security: `Security: STIG compliance, hardening, CVE remediation, SCAP, FIPS, PKI, encryption, CAC`,
14152
+ linux: `Linux: systemd, bash, yum/apt, cron, permissions, SELinux, journalctl`,
14153
+ vmware: `VMware: vSphere, ESXi, vCenter, VSAN, NSX, PowerCLI, datastores, vMotion`,
14154
+ azure: `Azure: Entra ID, ARM/Bicep, KeyVault, Blob storage, Azure DevOps, managed identities`,
14155
+ active_directory: `Active Directory: LDAP, Group Policy, Kerberos, SPNs, domain trusts, ADUC, replication`,
14156
+ ui_ux: `UI/UX: Interaction patterns, accessibility (WCAG), responsive design, typography, color theory, layout`
14157
+ };
14158
+ var UNIFIED_SME_PROMPT = `You are SME (Subject Matter Expert) - a multi-domain technical specialist.
14194
14159
 
14195
- **Domain Expertise**:
14196
- ${guidance}
14160
+ **Role**: Provide domain-specific technical context for all requested domains in a single response. Your output will be read by the Architect for collation.
14197
14161
 
14198
14162
  **Behavior**:
14199
- - Be specific: exact names, paths, parameters, not general advice
14200
- - Be concise: under 4000 characters
14163
+ - Address ALL domains listed in the request
14164
+ - Be specific: exact names, paths, parameters, API signatures
14165
+ - Be concise: focus only on implementation-relevant details
14201
14166
  - Be actionable: information the Coder can directly use
14202
- - Focus on implementation-relevant details only
14203
- - Include version-specific notes if applicable
14204
-
14205
- **Output Format**:
14206
- <${domain2}_context>
14207
- **Critical Considerations**:
14208
- [Must-know information that affects implementation]
14209
14167
 
14210
- **Recommended Approach**:
14211
- [Best practices and patterns for this domain]
14168
+ **Domain Expertise Available**:
14169
+ ${Object.entries(DOMAIN_EXPERTISE).map(([domain2, desc]) => `- ${domain2}: ${desc}`).join(`
14170
+ `)}
14212
14171
 
14213
- **API/Syntax Details**:
14214
- [Exact cmdlet names, function signatures, class names]
14172
+ **Output Format**:
14173
+ <sme_context>
14174
+ For each relevant domain, provide:
14215
14175
 
14216
- **Gotchas**:
14217
- [Common mistakes to avoid]
14176
+ **[Domain Name]**:
14177
+ - Critical considerations for implementation
14178
+ - Recommended approach and patterns
14179
+ - Specific APIs, cmdlets, or functions to use
14180
+ - Common gotchas to avoid
14181
+ - Dependencies required
14218
14182
 
14219
- **Dependencies**:
14220
- [Required modules, services, permissions]
14183
+ </sme_context>
14221
14184
 
14222
- **Code Patterns**:
14223
- [Short snippets showing correct usage if helpful]
14224
- </${domain2}_context>`;
14225
- }
14226
- function createSMEAgent(agentName, domainConfig, model, customPrompt, customAppendPrompt) {
14227
- let prompt = createSMEPrompt(domainConfig);
14185
+ Keep total response under 4000 characters for efficient processing.`;
14186
+ function createUnifiedSMEAgent(model, customPrompt, customAppendPrompt) {
14187
+ let prompt = UNIFIED_SME_PROMPT;
14228
14188
  if (customPrompt) {
14229
14189
  prompt = customPrompt;
14230
14190
  } else if (customAppendPrompt) {
14231
- prompt = `${prompt}
14191
+ prompt = `${UNIFIED_SME_PROMPT}
14232
14192
 
14233
14193
  ${customAppendPrompt}`;
14234
14194
  }
14235
14195
  return {
14236
- name: agentName,
14237
- description: `Subject matter expert for ${domainConfig.description}. Provides domain-specific technical context for the Architect.`,
14196
+ name: "sme",
14197
+ description: "Multi-domain subject matter expert. Provides technical context for multiple domains in a single call.",
14238
14198
  config: {
14239
14199
  model,
14240
14200
  temperature: 0.2,
@@ -14242,284 +14202,14 @@ ${customAppendPrompt}`;
14242
14202
  }
14243
14203
  };
14244
14204
  }
14245
-
14246
- // src/agents/sme/active-directory.ts
14247
- var activeDirectorySMEConfig = {
14248
- domain: "active_directory",
14249
- description: "Active Directory and identity management",
14250
- guidance: `For Active Directory tasks, provide:
14251
- - AD PowerShell module cmdlets (Get-ADUser, Set-ADUser, etc.)
14252
- - LDAP filter syntax and examples
14253
- - Distinguished name (DN) formats
14254
- - Group Policy structure and processing order
14255
- - Kerberos authentication flow considerations
14256
- - SPN (Service Principal Name) configuration
14257
- - AD schema and common attributes
14258
- - Replication and site topology concepts
14259
- - Organizational Unit (OU) design patterns
14260
- - Security group types (Domain Local, Global, Universal)
14261
- - Delegation of control patterns
14262
- - Fine-grained password policies
14263
- - AD object GUIDs and SIDs
14264
- - Trust relationships
14265
- - ADSI/DirectoryServices .NET classes
14266
- - Common AD error codes and resolutions
14267
- - Group Policy preferences vs policies`
14268
- };
14269
-
14270
- // src/agents/sme/azure.ts
14271
- var azureSMEConfig = {
14272
- domain: "azure",
14273
- description: "Microsoft Azure cloud services",
14274
- guidance: `For Azure tasks, provide:
14275
- - Az PowerShell module cmdlets (Az.Accounts, Az.Compute, etc.)
14276
- - Azure CLI (az) command syntax
14277
- - ARM template structure and syntax
14278
- - Bicep syntax and patterns
14279
- - Entra ID (formerly Azure AD) configuration
14280
- - RBAC role assignments and custom roles
14281
- - Resource naming conventions and constraints
14282
- - Service principal and managed identity configuration
14283
- - Azure resource provider namespaces
14284
- - Common Azure resource types and properties
14285
- - Subscription and resource group scoping
14286
- - Azure networking (VNet, NSG, Load Balancer)
14287
- - Storage account types and access tiers
14288
- - Azure Key Vault integration patterns
14289
- - Cost management considerations
14290
- - Azure Government differences if applicable`
14291
- };
14292
-
14293
- // src/agents/sme/linux.ts
14294
- var linuxSMEConfig = {
14295
- domain: "linux",
14296
- description: "Linux system administration",
14297
- guidance: `For Linux tasks, provide:
14298
- - Distribution-specific commands (RHEL/CentOS vs Ubuntu/Debian)
14299
- - Systemd unit file structure (service, timer, socket units)
14300
- - File permissions and ownership (chmod, chown, ACLs)
14301
- - SELinux/AppArmor considerations (contexts, policies, booleans)
14302
- - Package management commands (yum/dnf vs apt)
14303
- - Cron syntax and systemd timer alternatives
14304
- - Log file locations (/var/log, journalctl)
14305
- - Service management patterns (systemctl, enable, start)
14306
- - User and group management
14307
- - Filesystem hierarchy standard (FHS) paths
14308
- - Shell scripting best practices (bash, POSIX compliance)
14309
- - Process management (ps, top, kill signals)
14310
- - Network configuration (nmcli, ip, netplan)
14311
- - Environment variables and profile scripts`
14312
- };
14313
-
14314
- // src/agents/sme/network.ts
14315
- var networkSMEConfig = {
14316
- domain: "network",
14317
- description: "network architecture, protocols, and security",
14318
- guidance: `For network tasks, provide:
14319
- - Protocol specifications and standard port numbers
14320
- - Firewall rule syntax (Windows Firewall, iptables, firewalld)
14321
- - DNS record types and configuration (A, AAAA, CNAME, MX, TXT, SRV)
14322
- - Certificate requirements and chain validation
14323
- - TLS/SSL configuration best practices (cipher suites, protocols)
14324
- - Load balancer and proxy considerations
14325
- - Network troubleshooting commands (ping, tracert, nslookup, netstat)
14326
- - Security group and ACL patterns
14327
- - IP addressing and subnetting
14328
- - VLAN configuration concepts
14329
- - NAT and port forwarding
14330
- - HTTP/HTTPS specifics (headers, status codes, methods)
14331
- - Socket programming considerations
14332
- - Common network errors and their causes`
14333
- };
14334
-
14335
- // src/agents/sme/oracle.ts
14336
- var oracleSMEConfig = {
14337
- domain: "oracle",
14338
- description: "Oracle Database administration and SQL/PLSQL",
14339
- guidance: `For Oracle tasks, provide:
14340
- - Correct SQL syntax for Oracle (not MySQL/SQL Server)
14341
- - PL/SQL block structure and exception handling
14342
- - CDB/PDB architecture considerations
14343
- - Parameter names and valid values (init.ora, spfile)
14344
- - Required privileges and roles (DBA, SYSDBA, specific grants)
14345
- - Data dictionary views (DBA_*, ALL_*, USER_*, V$*, GV$*)
14346
- - RMAN commands and syntax
14347
- - TNS configuration and connectivity (tnsnames.ora, listener.ora)
14348
- - Oracle-specific functions (NVL, DECODE, LISTAGG, etc.)
14349
- - Bind variable usage for performance
14350
- - Transaction handling (COMMIT, ROLLBACK, savepoints)
14351
- - LOB handling (CLOB, BLOB operations)
14352
- - Date/timestamp handling (TO_DATE, TO_TIMESTAMP, NLS settings)
14353
- - Execution plan analysis (EXPLAIN PLAN, hints)`
14354
- };
14355
-
14356
- // src/agents/sme/powershell.ts
14357
- var powershellSMEConfig = {
14358
- domain: "powershell",
14359
- description: "PowerShell scripting and automation",
14360
- guidance: `For PowerShell tasks, provide:
14361
- - Correct cmdlet names, parameters, and syntax
14362
- - Required modules and how to import them (Import-Module, #Requires)
14363
- - Pipeline patterns and object handling
14364
- - Error handling with try/catch and $ErrorActionPreference
14365
- - Output formatting and object types ([PSCustomObject], etc.)
14366
- - Remote execution (PSSession, Invoke-Command, -ComputerName)
14367
- - Module compatibility (Windows PowerShell 5.1 vs PowerShell 7+)
14368
- - Common parameter patterns (-Verbose, -WhatIf, -Confirm, -ErrorAction)
14369
- - Splatting for complex parameter sets
14370
- - Advanced function patterns ([CmdletBinding()], param blocks)
14371
- - Pester testing patterns for the code
14372
- - Credential handling (Get-Credential, [PSCredential])
14373
- - Output streams (Write-Output, Write-Verbose, Write-Error)`
14374
- };
14375
-
14376
- // src/agents/sme/python.ts
14377
- var pythonSMEConfig = {
14378
- domain: "python",
14379
- description: "Python development and ecosystem",
14380
- guidance: `For Python tasks, provide:
14381
- - Recommended libraries for the task (stdlib vs third-party)
14382
- - Windows-specific modules (pywin32, wmi, winreg, ctypes)
14383
- - Correct API usage patterns and idioms
14384
- - Virtual environment considerations (venv, pip install)
14385
- - Type hints and dataclass usage
14386
- - Exception handling patterns (specific exceptions, context managers)
14387
- - File handling (pathlib vs os.path, encoding considerations)
14388
- - Cross-platform compatibility notes
14389
- - Async patterns if applicable (asyncio, aiohttp)
14390
- - Logging configuration (logging module setup)
14391
- - Package structure for larger scripts
14392
- - Python version compatibility (3.8+ features)
14393
- - Common gotchas (mutable default arguments, import cycles)`
14394
- };
14395
-
14396
- // src/agents/sme/security.ts
14397
- var securitySMEConfig = {
14398
- domain: "security",
14399
- description: "cybersecurity, compliance, and hardening",
14400
- guidance: `For security tasks, provide:
14401
- - STIG requirements and check IDs (V-#####, SV-#####)
14402
- - DISA compliance requirements
14403
- - FIPS 140-2/3 considerations (approved algorithms, modes)
14404
- - CAC/PIV/PKI implementation details
14405
- - Encryption standards and key management
14406
- - Audit logging requirements (what to log, retention)
14407
- - Least privilege patterns
14408
- - Secure configuration baselines
14409
- - CIS Benchmark references if applicable
14410
- - Common vulnerability patterns to avoid
14411
- - Authentication and authorization best practices
14412
- - Secrets management (no hardcoding, secure storage)
14413
- - Input validation and sanitization
14414
- - Secure communication requirements (TLS versions, cipher suites)
14415
- - DoD/Federal specific requirements if applicable`
14416
- };
14417
-
14418
- // src/agents/sme/ui-ux.ts
14419
- var uiUxSMEConfig = {
14420
- domain: "ui_ux",
14421
- description: "UI/UX design, interaction patterns, and visual systems",
14422
- guidance: `For UI/UX tasks, provide:
14423
- - Information architecture and navigation flow
14424
- - Interaction patterns and states (loading, empty, error, success)
14425
- - Responsive layout guidance and breakpoints
14426
- - Typography scale and hierarchy recommendations
14427
- - Spacing system (8px grid, consistent margins/padding)
14428
- - Color usage (primary, secondary, semantic colors)
14429
- - Contrast and accessibility requirements (WCAG 2.1 AA)
14430
- - Component structure and reusability patterns
14431
- - Form design best practices (labels, validation, feedback)
14432
- - Motion/animation guidance (purposeful, not excessive)
14433
- - Touch target sizes for mobile (44px minimum)
14434
- - Focus management for keyboard navigation
14435
- - Icon usage and consistency
14436
- - Empty states and error message design
14437
- - Progressive disclosure patterns
14438
- - Loading and skeleton states`
14439
- };
14440
-
14441
- // src/agents/sme/vmware.ts
14442
- var vmwareSMEConfig = {
14443
- domain: "vmware",
14444
- description: "VMware vSphere and virtualization",
14445
- guidance: `For VMware tasks, provide:
14446
- - PowerCLI cmdlet names and syntax (Get-VM, Set-VM, etc.)
14447
- - vSphere API objects and methods
14448
- - ESXi shell commands (esxcli, vim-cmd)
14449
- - Datastore path formats ([datastore1] path/to/file.vmdk)
14450
- - VM hardware version compatibility
14451
- - vMotion and DRS requirements and constraints
14452
- - Storage policy configuration (SPBM)
14453
- - Network adapter types and configurations (vmxnet3, e1000e)
14454
- - Snapshot management considerations
14455
- - Template and clone operations
14456
- - Resource pool and cluster concepts
14457
- - vCenter Server connection handling
14458
- - Certificate and authentication requirements
14459
- - Common vSphere error codes and solutions
14460
- - Performance metrics and monitoring (Get-Stat)`
14461
- };
14462
-
14463
- // src/agents/sme/windows.ts
14464
- var windowsSMEConfig = {
14465
- domain: "windows",
14466
- description: "Windows operating system internals and administration",
14467
- guidance: `For Windows tasks, provide:
14468
- - Registry paths and correct hive locations (HKLM, HKCU, HKU)
14469
- - WMI/CIM class names and properties (Win32_*, CIM_*)
14470
- - Service names (exact), dependencies, and startup types
14471
- - File system locations (System32, SysWOW64, ProgramData, AppData)
14472
- - Permission requirements (admin, SYSTEM, TrustedInstaller)
14473
- - COM objects and interfaces when relevant
14474
- - Event log sources, channels, and event IDs
14475
- - Scheduled task configuration (triggers, actions, principals)
14476
- - Windows API calls if needed (P/Invoke signatures)
14477
- - UAC considerations and elevation requirements
14478
- - 32-bit vs 64-bit considerations (WoW64 redirection)`
14479
- };
14480
-
14481
- // src/agents/sme/index.ts
14482
- var SME_CONFIGS = {
14483
- windows: windowsSMEConfig,
14484
- powershell: powershellSMEConfig,
14485
- python: pythonSMEConfig,
14486
- oracle: oracleSMEConfig,
14487
- network: networkSMEConfig,
14488
- security: securitySMEConfig,
14489
- linux: linuxSMEConfig,
14490
- vmware: vmwareSMEConfig,
14491
- azure: azureSMEConfig,
14492
- active_directory: activeDirectorySMEConfig,
14493
- ui_ux: uiUxSMEConfig
14494
- };
14495
- var AGENT_TO_DOMAIN = {
14496
- sme_windows: "windows",
14497
- sme_powershell: "powershell",
14498
- sme_python: "python",
14499
- sme_oracle: "oracle",
14500
- sme_network: "network",
14501
- sme_security: "security",
14502
- sme_linux: "linux",
14503
- sme_vmware: "vmware",
14504
- sme_azure: "azure",
14505
- sme_active_directory: "active_directory",
14506
- sme_ui_ux: "ui_ux"
14507
- };
14508
- function createAllSMEAgents(getModel, loadPrompt) {
14509
- return Object.entries(AGENT_TO_DOMAIN).map(([agentName, domain2]) => {
14510
- const config2 = SME_CONFIGS[domain2];
14511
- const model = getModel(agentName);
14512
- const prompts = loadPrompt(agentName);
14513
- return createSMEAgent(agentName, config2, model, prompts.prompt, prompts.appendPrompt);
14514
- });
14515
- }
14205
+ var AVAILABLE_DOMAINS = Object.keys(DOMAIN_EXPERTISE);
14516
14206
 
14517
14207
  // src/agents/index.ts
14518
14208
  function getModelForAgent(agentName, config2) {
14519
14209
  const explicit = config2?.agents?.[agentName]?.model;
14520
14210
  if (explicit)
14521
14211
  return explicit;
14522
- if (isSMEAgent(agentName)) {
14212
+ if (agentName === "sme") {
14523
14213
  const categoryModel = config2?.agents?.[CATEGORY_PREFIXES.sme]?.model;
14524
14214
  if (categoryModel)
14525
14215
  return categoryModel;
@@ -14555,11 +14245,10 @@ function createAgents(config2) {
14555
14245
  const architect = createArchitectAgent(getModel("architect"), architectPrompts.prompt, architectPrompts.appendPrompt);
14556
14246
  agents.push(applyOverrides(architect, config2));
14557
14247
  }
14558
- const smeAgents = createAllSMEAgents(getModel, getPrompts);
14559
- for (const sme of smeAgents) {
14560
- if (!isAgentDisabled(sme.name, config2)) {
14561
- agents.push(applyOverrides(sme, config2));
14562
- }
14248
+ if (!isAgentDisabled("sme", config2)) {
14249
+ const smePrompts = getPrompts("sme");
14250
+ const sme = createUnifiedSMEAgent(getModel("sme"), smePrompts.prompt, smePrompts.appendPrompt);
14251
+ agents.push(applyOverrides(sme, config2));
14563
14252
  }
14564
14253
  if (!isAgentDisabled("coder", config2)) {
14565
14254
  const coderPrompts = getPrompts("coder");
@@ -27132,7 +26821,6 @@ var OpenCodeSwarm = async (ctx) => {
27132
26821
  const pipelineHook = createPipelineTrackerHook(config3);
27133
26822
  log("Plugin initialized", {
27134
26823
  directory: ctx.directory,
27135
- swarmMode: config3.swarm_mode,
27136
26824
  maxIterations: config3.max_iterations,
27137
26825
  agentCount: Object.keys(agents).length
27138
26826
  });
@@ -27143,18 +26831,6 @@ var OpenCodeSwarm = async (ctx) => {
27143
26831
  detect_domains,
27144
26832
  extract_code_blocks
27145
26833
  },
27146
- config: async (opencodeConfig) => {
27147
- opencodeConfig.default_agent = "architect";
27148
- if (!opencodeConfig.agent) {
27149
- opencodeConfig.agent = { ...agents };
27150
- } else {
27151
- Object.assign(opencodeConfig.agent, agents);
27152
- }
27153
- log("Config applied", {
27154
- defaultAgent: "architect",
27155
- agents: Object.keys(agents)
27156
- });
27157
- },
27158
26834
  "experimental.chat.messages.transform": pipelineHook["experimental.chat.messages.transform"]
27159
26835
  };
27160
26836
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-swarm",
3
- "version": "1.0.13",
3
+ "version": "2.0.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",