opencode-swarm 1.0.14 → 2.0.1
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/agents/index.d.ts +1 -1
- package/dist/agents/sme-unified.d.ts +3 -0
- package/dist/config/constants.d.ts +5 -6
- package/dist/config/index.d.ts +4 -4
- package/dist/config/loader.d.ts +0 -4
- package/dist/config/schema.d.ts +1 -27
- package/dist/index.d.ts +1 -1
- package/dist/index.js +64 -390
- package/package.json +2 -2
package/dist/agents/index.d.ts
CHANGED
|
@@ -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 {
|
|
19
|
+
export { createUnifiedSMEAgent, AVAILABLE_DOMAINS } from './sme-unified';
|
|
@@ -1,20 +1,19 @@
|
|
|
1
|
-
export declare const
|
|
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 ["
|
|
6
|
-
export declare const ALL_AGENT_NAMES: readonly ["architect", "
|
|
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(
|
|
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;
|
package/dist/config/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { ALL_AGENT_NAMES, ALL_SUBAGENT_NAMES, CATEGORY_PREFIXES, DEFAULT_MODELS, DOMAIN_PATTERNS, ORCHESTRATOR_NAME, PIPELINE_AGENTS, QA_AGENTS,
|
|
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,
|
|
4
|
-
export type { AgentOverrideConfig, PluginConfig,
|
|
5
|
-
export {
|
|
3
|
+
export { AgentOverrideConfigSchema, PluginConfigSchema, } from './schema';
|
|
4
|
+
export type { AgentOverrideConfig, PluginConfig, } from './schema';
|
|
5
|
+
export { loadAgentPrompt, loadPluginConfig, } from './loader';
|
package/dist/config/loader.d.ts
CHANGED
|
@@ -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;
|
package/dist/config/schema.d.ts
CHANGED
|
@@ -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
|
-
|
|
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,
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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(
|
|
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
|
-
|
|
13794
|
+
multi_domain_sme: true,
|
|
13819
13795
|
auto_detect_domains: true,
|
|
13820
|
-
inject_phase_reminders:
|
|
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,
|
|
13832
|
+
**Role**: Analyze requests, consult SME for domain expertise, delegate implementation, and manage QA review.
|
|
13871
13833
|
|
|
13872
13834
|
**Agents**:
|
|
13873
13835
|
|
|
13874
|
-
@
|
|
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
|
|
13848
|
+
Identify which domains are relevant.
|
|
13896
13849
|
Create initial specification.
|
|
13897
13850
|
|
|
13898
|
-
## 2. SME Consultation (
|
|
13899
|
-
|
|
13900
|
-
|
|
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
|
|
13904
|
-
|
|
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 @
|
|
13881
|
+
- Brief delegation notices: "Consulting @sme for windows, powershell..."
|
|
13928
13882
|
|
|
13929
13883
|
**Communication**:
|
|
13930
13884
|
- Be direct, no preamble or flattery
|
|
@@ -14187,56 +14141,60 @@ ${customAppendPrompt}`;
|
|
|
14187
14141
|
};
|
|
14188
14142
|
}
|
|
14189
14143
|
|
|
14190
|
-
// src/agents/sme
|
|
14191
|
-
|
|
14192
|
-
|
|
14193
|
-
|
|
14194
|
-
|
|
14195
|
-
|
|
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.
|
|
14196
14159
|
|
|
14197
|
-
**
|
|
14198
|
-
${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.
|
|
14199
14161
|
|
|
14200
14162
|
**Behavior**:
|
|
14201
|
-
-
|
|
14202
|
-
- Be
|
|
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
|
|
14203
14166
|
- Be actionable: information the Coder can directly use
|
|
14204
|
-
- Focus on implementation-relevant details only
|
|
14205
|
-
- Include version-specific notes if applicable
|
|
14206
|
-
|
|
14207
|
-
**Output Format**:
|
|
14208
|
-
<${domain2}_context>
|
|
14209
|
-
**Critical Considerations**:
|
|
14210
|
-
[Must-know information that affects implementation]
|
|
14211
14167
|
|
|
14212
|
-
**
|
|
14213
|
-
[
|
|
14168
|
+
**Domain Expertise Available**:
|
|
14169
|
+
${Object.entries(DOMAIN_EXPERTISE).map(([domain2, desc]) => `- ${domain2}: ${desc}`).join(`
|
|
14170
|
+
`)}
|
|
14214
14171
|
|
|
14215
|
-
**
|
|
14216
|
-
|
|
14172
|
+
**Output Format**:
|
|
14173
|
+
<sme_context>
|
|
14174
|
+
For each relevant domain, provide:
|
|
14217
14175
|
|
|
14218
|
-
**
|
|
14219
|
-
|
|
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
|
|
14220
14182
|
|
|
14221
|
-
|
|
14222
|
-
[Required modules, services, permissions]
|
|
14183
|
+
</sme_context>
|
|
14223
14184
|
|
|
14224
|
-
|
|
14225
|
-
|
|
14226
|
-
|
|
14227
|
-
}
|
|
14228
|
-
function createSMEAgent(agentName, domainConfig, model, customPrompt, customAppendPrompt) {
|
|
14229
|
-
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;
|
|
14230
14188
|
if (customPrompt) {
|
|
14231
14189
|
prompt = customPrompt;
|
|
14232
14190
|
} else if (customAppendPrompt) {
|
|
14233
|
-
prompt = `${
|
|
14191
|
+
prompt = `${UNIFIED_SME_PROMPT}
|
|
14234
14192
|
|
|
14235
14193
|
${customAppendPrompt}`;
|
|
14236
14194
|
}
|
|
14237
14195
|
return {
|
|
14238
|
-
name:
|
|
14239
|
-
description:
|
|
14196
|
+
name: "sme",
|
|
14197
|
+
description: "Multi-domain subject matter expert. Provides technical context for multiple domains in a single call.",
|
|
14240
14198
|
config: {
|
|
14241
14199
|
model,
|
|
14242
14200
|
temperature: 0.2,
|
|
@@ -14244,284 +14202,14 @@ ${customAppendPrompt}`;
|
|
|
14244
14202
|
}
|
|
14245
14203
|
};
|
|
14246
14204
|
}
|
|
14247
|
-
|
|
14248
|
-
// src/agents/sme/active-directory.ts
|
|
14249
|
-
var activeDirectorySMEConfig = {
|
|
14250
|
-
domain: "active_directory",
|
|
14251
|
-
description: "Active Directory and identity management",
|
|
14252
|
-
guidance: `For Active Directory tasks, provide:
|
|
14253
|
-
- AD PowerShell module cmdlets (Get-ADUser, Set-ADUser, etc.)
|
|
14254
|
-
- LDAP filter syntax and examples
|
|
14255
|
-
- Distinguished name (DN) formats
|
|
14256
|
-
- Group Policy structure and processing order
|
|
14257
|
-
- Kerberos authentication flow considerations
|
|
14258
|
-
- SPN (Service Principal Name) configuration
|
|
14259
|
-
- AD schema and common attributes
|
|
14260
|
-
- Replication and site topology concepts
|
|
14261
|
-
- Organizational Unit (OU) design patterns
|
|
14262
|
-
- Security group types (Domain Local, Global, Universal)
|
|
14263
|
-
- Delegation of control patterns
|
|
14264
|
-
- Fine-grained password policies
|
|
14265
|
-
- AD object GUIDs and SIDs
|
|
14266
|
-
- Trust relationships
|
|
14267
|
-
- ADSI/DirectoryServices .NET classes
|
|
14268
|
-
- Common AD error codes and resolutions
|
|
14269
|
-
- Group Policy preferences vs policies`
|
|
14270
|
-
};
|
|
14271
|
-
|
|
14272
|
-
// src/agents/sme/azure.ts
|
|
14273
|
-
var azureSMEConfig = {
|
|
14274
|
-
domain: "azure",
|
|
14275
|
-
description: "Microsoft Azure cloud services",
|
|
14276
|
-
guidance: `For Azure tasks, provide:
|
|
14277
|
-
- Az PowerShell module cmdlets (Az.Accounts, Az.Compute, etc.)
|
|
14278
|
-
- Azure CLI (az) command syntax
|
|
14279
|
-
- ARM template structure and syntax
|
|
14280
|
-
- Bicep syntax and patterns
|
|
14281
|
-
- Entra ID (formerly Azure AD) configuration
|
|
14282
|
-
- RBAC role assignments and custom roles
|
|
14283
|
-
- Resource naming conventions and constraints
|
|
14284
|
-
- Service principal and managed identity configuration
|
|
14285
|
-
- Azure resource provider namespaces
|
|
14286
|
-
- Common Azure resource types and properties
|
|
14287
|
-
- Subscription and resource group scoping
|
|
14288
|
-
- Azure networking (VNet, NSG, Load Balancer)
|
|
14289
|
-
- Storage account types and access tiers
|
|
14290
|
-
- Azure Key Vault integration patterns
|
|
14291
|
-
- Cost management considerations
|
|
14292
|
-
- Azure Government differences if applicable`
|
|
14293
|
-
};
|
|
14294
|
-
|
|
14295
|
-
// src/agents/sme/linux.ts
|
|
14296
|
-
var linuxSMEConfig = {
|
|
14297
|
-
domain: "linux",
|
|
14298
|
-
description: "Linux system administration",
|
|
14299
|
-
guidance: `For Linux tasks, provide:
|
|
14300
|
-
- Distribution-specific commands (RHEL/CentOS vs Ubuntu/Debian)
|
|
14301
|
-
- Systemd unit file structure (service, timer, socket units)
|
|
14302
|
-
- File permissions and ownership (chmod, chown, ACLs)
|
|
14303
|
-
- SELinux/AppArmor considerations (contexts, policies, booleans)
|
|
14304
|
-
- Package management commands (yum/dnf vs apt)
|
|
14305
|
-
- Cron syntax and systemd timer alternatives
|
|
14306
|
-
- Log file locations (/var/log, journalctl)
|
|
14307
|
-
- Service management patterns (systemctl, enable, start)
|
|
14308
|
-
- User and group management
|
|
14309
|
-
- Filesystem hierarchy standard (FHS) paths
|
|
14310
|
-
- Shell scripting best practices (bash, POSIX compliance)
|
|
14311
|
-
- Process management (ps, top, kill signals)
|
|
14312
|
-
- Network configuration (nmcli, ip, netplan)
|
|
14313
|
-
- Environment variables and profile scripts`
|
|
14314
|
-
};
|
|
14315
|
-
|
|
14316
|
-
// src/agents/sme/network.ts
|
|
14317
|
-
var networkSMEConfig = {
|
|
14318
|
-
domain: "network",
|
|
14319
|
-
description: "network architecture, protocols, and security",
|
|
14320
|
-
guidance: `For network tasks, provide:
|
|
14321
|
-
- Protocol specifications and standard port numbers
|
|
14322
|
-
- Firewall rule syntax (Windows Firewall, iptables, firewalld)
|
|
14323
|
-
- DNS record types and configuration (A, AAAA, CNAME, MX, TXT, SRV)
|
|
14324
|
-
- Certificate requirements and chain validation
|
|
14325
|
-
- TLS/SSL configuration best practices (cipher suites, protocols)
|
|
14326
|
-
- Load balancer and proxy considerations
|
|
14327
|
-
- Network troubleshooting commands (ping, tracert, nslookup, netstat)
|
|
14328
|
-
- Security group and ACL patterns
|
|
14329
|
-
- IP addressing and subnetting
|
|
14330
|
-
- VLAN configuration concepts
|
|
14331
|
-
- NAT and port forwarding
|
|
14332
|
-
- HTTP/HTTPS specifics (headers, status codes, methods)
|
|
14333
|
-
- Socket programming considerations
|
|
14334
|
-
- Common network errors and their causes`
|
|
14335
|
-
};
|
|
14336
|
-
|
|
14337
|
-
// src/agents/sme/oracle.ts
|
|
14338
|
-
var oracleSMEConfig = {
|
|
14339
|
-
domain: "oracle",
|
|
14340
|
-
description: "Oracle Database administration and SQL/PLSQL",
|
|
14341
|
-
guidance: `For Oracle tasks, provide:
|
|
14342
|
-
- Correct SQL syntax for Oracle (not MySQL/SQL Server)
|
|
14343
|
-
- PL/SQL block structure and exception handling
|
|
14344
|
-
- CDB/PDB architecture considerations
|
|
14345
|
-
- Parameter names and valid values (init.ora, spfile)
|
|
14346
|
-
- Required privileges and roles (DBA, SYSDBA, specific grants)
|
|
14347
|
-
- Data dictionary views (DBA_*, ALL_*, USER_*, V$*, GV$*)
|
|
14348
|
-
- RMAN commands and syntax
|
|
14349
|
-
- TNS configuration and connectivity (tnsnames.ora, listener.ora)
|
|
14350
|
-
- Oracle-specific functions (NVL, DECODE, LISTAGG, etc.)
|
|
14351
|
-
- Bind variable usage for performance
|
|
14352
|
-
- Transaction handling (COMMIT, ROLLBACK, savepoints)
|
|
14353
|
-
- LOB handling (CLOB, BLOB operations)
|
|
14354
|
-
- Date/timestamp handling (TO_DATE, TO_TIMESTAMP, NLS settings)
|
|
14355
|
-
- Execution plan analysis (EXPLAIN PLAN, hints)`
|
|
14356
|
-
};
|
|
14357
|
-
|
|
14358
|
-
// src/agents/sme/powershell.ts
|
|
14359
|
-
var powershellSMEConfig = {
|
|
14360
|
-
domain: "powershell",
|
|
14361
|
-
description: "PowerShell scripting and automation",
|
|
14362
|
-
guidance: `For PowerShell tasks, provide:
|
|
14363
|
-
- Correct cmdlet names, parameters, and syntax
|
|
14364
|
-
- Required modules and how to import them (Import-Module, #Requires)
|
|
14365
|
-
- Pipeline patterns and object handling
|
|
14366
|
-
- Error handling with try/catch and $ErrorActionPreference
|
|
14367
|
-
- Output formatting and object types ([PSCustomObject], etc.)
|
|
14368
|
-
- Remote execution (PSSession, Invoke-Command, -ComputerName)
|
|
14369
|
-
- Module compatibility (Windows PowerShell 5.1 vs PowerShell 7+)
|
|
14370
|
-
- Common parameter patterns (-Verbose, -WhatIf, -Confirm, -ErrorAction)
|
|
14371
|
-
- Splatting for complex parameter sets
|
|
14372
|
-
- Advanced function patterns ([CmdletBinding()], param blocks)
|
|
14373
|
-
- Pester testing patterns for the code
|
|
14374
|
-
- Credential handling (Get-Credential, [PSCredential])
|
|
14375
|
-
- Output streams (Write-Output, Write-Verbose, Write-Error)`
|
|
14376
|
-
};
|
|
14377
|
-
|
|
14378
|
-
// src/agents/sme/python.ts
|
|
14379
|
-
var pythonSMEConfig = {
|
|
14380
|
-
domain: "python",
|
|
14381
|
-
description: "Python development and ecosystem",
|
|
14382
|
-
guidance: `For Python tasks, provide:
|
|
14383
|
-
- Recommended libraries for the task (stdlib vs third-party)
|
|
14384
|
-
- Windows-specific modules (pywin32, wmi, winreg, ctypes)
|
|
14385
|
-
- Correct API usage patterns and idioms
|
|
14386
|
-
- Virtual environment considerations (venv, pip install)
|
|
14387
|
-
- Type hints and dataclass usage
|
|
14388
|
-
- Exception handling patterns (specific exceptions, context managers)
|
|
14389
|
-
- File handling (pathlib vs os.path, encoding considerations)
|
|
14390
|
-
- Cross-platform compatibility notes
|
|
14391
|
-
- Async patterns if applicable (asyncio, aiohttp)
|
|
14392
|
-
- Logging configuration (logging module setup)
|
|
14393
|
-
- Package structure for larger scripts
|
|
14394
|
-
- Python version compatibility (3.8+ features)
|
|
14395
|
-
- Common gotchas (mutable default arguments, import cycles)`
|
|
14396
|
-
};
|
|
14397
|
-
|
|
14398
|
-
// src/agents/sme/security.ts
|
|
14399
|
-
var securitySMEConfig = {
|
|
14400
|
-
domain: "security",
|
|
14401
|
-
description: "cybersecurity, compliance, and hardening",
|
|
14402
|
-
guidance: `For security tasks, provide:
|
|
14403
|
-
- STIG requirements and check IDs (V-#####, SV-#####)
|
|
14404
|
-
- DISA compliance requirements
|
|
14405
|
-
- FIPS 140-2/3 considerations (approved algorithms, modes)
|
|
14406
|
-
- CAC/PIV/PKI implementation details
|
|
14407
|
-
- Encryption standards and key management
|
|
14408
|
-
- Audit logging requirements (what to log, retention)
|
|
14409
|
-
- Least privilege patterns
|
|
14410
|
-
- Secure configuration baselines
|
|
14411
|
-
- CIS Benchmark references if applicable
|
|
14412
|
-
- Common vulnerability patterns to avoid
|
|
14413
|
-
- Authentication and authorization best practices
|
|
14414
|
-
- Secrets management (no hardcoding, secure storage)
|
|
14415
|
-
- Input validation and sanitization
|
|
14416
|
-
- Secure communication requirements (TLS versions, cipher suites)
|
|
14417
|
-
- DoD/Federal specific requirements if applicable`
|
|
14418
|
-
};
|
|
14419
|
-
|
|
14420
|
-
// src/agents/sme/ui-ux.ts
|
|
14421
|
-
var uiUxSMEConfig = {
|
|
14422
|
-
domain: "ui_ux",
|
|
14423
|
-
description: "UI/UX design, interaction patterns, and visual systems",
|
|
14424
|
-
guidance: `For UI/UX tasks, provide:
|
|
14425
|
-
- Information architecture and navigation flow
|
|
14426
|
-
- Interaction patterns and states (loading, empty, error, success)
|
|
14427
|
-
- Responsive layout guidance and breakpoints
|
|
14428
|
-
- Typography scale and hierarchy recommendations
|
|
14429
|
-
- Spacing system (8px grid, consistent margins/padding)
|
|
14430
|
-
- Color usage (primary, secondary, semantic colors)
|
|
14431
|
-
- Contrast and accessibility requirements (WCAG 2.1 AA)
|
|
14432
|
-
- Component structure and reusability patterns
|
|
14433
|
-
- Form design best practices (labels, validation, feedback)
|
|
14434
|
-
- Motion/animation guidance (purposeful, not excessive)
|
|
14435
|
-
- Touch target sizes for mobile (44px minimum)
|
|
14436
|
-
- Focus management for keyboard navigation
|
|
14437
|
-
- Icon usage and consistency
|
|
14438
|
-
- Empty states and error message design
|
|
14439
|
-
- Progressive disclosure patterns
|
|
14440
|
-
- Loading and skeleton states`
|
|
14441
|
-
};
|
|
14442
|
-
|
|
14443
|
-
// src/agents/sme/vmware.ts
|
|
14444
|
-
var vmwareSMEConfig = {
|
|
14445
|
-
domain: "vmware",
|
|
14446
|
-
description: "VMware vSphere and virtualization",
|
|
14447
|
-
guidance: `For VMware tasks, provide:
|
|
14448
|
-
- PowerCLI cmdlet names and syntax (Get-VM, Set-VM, etc.)
|
|
14449
|
-
- vSphere API objects and methods
|
|
14450
|
-
- ESXi shell commands (esxcli, vim-cmd)
|
|
14451
|
-
- Datastore path formats ([datastore1] path/to/file.vmdk)
|
|
14452
|
-
- VM hardware version compatibility
|
|
14453
|
-
- vMotion and DRS requirements and constraints
|
|
14454
|
-
- Storage policy configuration (SPBM)
|
|
14455
|
-
- Network adapter types and configurations (vmxnet3, e1000e)
|
|
14456
|
-
- Snapshot management considerations
|
|
14457
|
-
- Template and clone operations
|
|
14458
|
-
- Resource pool and cluster concepts
|
|
14459
|
-
- vCenter Server connection handling
|
|
14460
|
-
- Certificate and authentication requirements
|
|
14461
|
-
- Common vSphere error codes and solutions
|
|
14462
|
-
- Performance metrics and monitoring (Get-Stat)`
|
|
14463
|
-
};
|
|
14464
|
-
|
|
14465
|
-
// src/agents/sme/windows.ts
|
|
14466
|
-
var windowsSMEConfig = {
|
|
14467
|
-
domain: "windows",
|
|
14468
|
-
description: "Windows operating system internals and administration",
|
|
14469
|
-
guidance: `For Windows tasks, provide:
|
|
14470
|
-
- Registry paths and correct hive locations (HKLM, HKCU, HKU)
|
|
14471
|
-
- WMI/CIM class names and properties (Win32_*, CIM_*)
|
|
14472
|
-
- Service names (exact), dependencies, and startup types
|
|
14473
|
-
- File system locations (System32, SysWOW64, ProgramData, AppData)
|
|
14474
|
-
- Permission requirements (admin, SYSTEM, TrustedInstaller)
|
|
14475
|
-
- COM objects and interfaces when relevant
|
|
14476
|
-
- Event log sources, channels, and event IDs
|
|
14477
|
-
- Scheduled task configuration (triggers, actions, principals)
|
|
14478
|
-
- Windows API calls if needed (P/Invoke signatures)
|
|
14479
|
-
- UAC considerations and elevation requirements
|
|
14480
|
-
- 32-bit vs 64-bit considerations (WoW64 redirection)`
|
|
14481
|
-
};
|
|
14482
|
-
|
|
14483
|
-
// src/agents/sme/index.ts
|
|
14484
|
-
var SME_CONFIGS = {
|
|
14485
|
-
windows: windowsSMEConfig,
|
|
14486
|
-
powershell: powershellSMEConfig,
|
|
14487
|
-
python: pythonSMEConfig,
|
|
14488
|
-
oracle: oracleSMEConfig,
|
|
14489
|
-
network: networkSMEConfig,
|
|
14490
|
-
security: securitySMEConfig,
|
|
14491
|
-
linux: linuxSMEConfig,
|
|
14492
|
-
vmware: vmwareSMEConfig,
|
|
14493
|
-
azure: azureSMEConfig,
|
|
14494
|
-
active_directory: activeDirectorySMEConfig,
|
|
14495
|
-
ui_ux: uiUxSMEConfig
|
|
14496
|
-
};
|
|
14497
|
-
var AGENT_TO_DOMAIN = {
|
|
14498
|
-
sme_windows: "windows",
|
|
14499
|
-
sme_powershell: "powershell",
|
|
14500
|
-
sme_python: "python",
|
|
14501
|
-
sme_oracle: "oracle",
|
|
14502
|
-
sme_network: "network",
|
|
14503
|
-
sme_security: "security",
|
|
14504
|
-
sme_linux: "linux",
|
|
14505
|
-
sme_vmware: "vmware",
|
|
14506
|
-
sme_azure: "azure",
|
|
14507
|
-
sme_active_directory: "active_directory",
|
|
14508
|
-
sme_ui_ux: "ui_ux"
|
|
14509
|
-
};
|
|
14510
|
-
function createAllSMEAgents(getModel, loadPrompt) {
|
|
14511
|
-
return Object.entries(AGENT_TO_DOMAIN).map(([agentName, domain2]) => {
|
|
14512
|
-
const config2 = SME_CONFIGS[domain2];
|
|
14513
|
-
const model = getModel(agentName);
|
|
14514
|
-
const prompts = loadPrompt(agentName);
|
|
14515
|
-
return createSMEAgent(agentName, config2, model, prompts.prompt, prompts.appendPrompt);
|
|
14516
|
-
});
|
|
14517
|
-
}
|
|
14205
|
+
var AVAILABLE_DOMAINS = Object.keys(DOMAIN_EXPERTISE);
|
|
14518
14206
|
|
|
14519
14207
|
// src/agents/index.ts
|
|
14520
14208
|
function getModelForAgent(agentName, config2) {
|
|
14521
14209
|
const explicit = config2?.agents?.[agentName]?.model;
|
|
14522
14210
|
if (explicit)
|
|
14523
14211
|
return explicit;
|
|
14524
|
-
if (
|
|
14212
|
+
if (agentName === "sme") {
|
|
14525
14213
|
const categoryModel = config2?.agents?.[CATEGORY_PREFIXES.sme]?.model;
|
|
14526
14214
|
if (categoryModel)
|
|
14527
14215
|
return categoryModel;
|
|
@@ -14557,11 +14245,10 @@ function createAgents(config2) {
|
|
|
14557
14245
|
const architect = createArchitectAgent(getModel("architect"), architectPrompts.prompt, architectPrompts.appendPrompt);
|
|
14558
14246
|
agents.push(applyOverrides(architect, config2));
|
|
14559
14247
|
}
|
|
14560
|
-
|
|
14561
|
-
|
|
14562
|
-
|
|
14563
|
-
|
|
14564
|
-
}
|
|
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));
|
|
14565
14252
|
}
|
|
14566
14253
|
if (!isAgentDisabled("coder", config2)) {
|
|
14567
14254
|
const coderPrompts = getPrompts("coder");
|
|
@@ -27134,7 +26821,6 @@ var OpenCodeSwarm = async (ctx) => {
|
|
|
27134
26821
|
const pipelineHook = createPipelineTrackerHook(config3);
|
|
27135
26822
|
log("Plugin initialized", {
|
|
27136
26823
|
directory: ctx.directory,
|
|
27137
|
-
swarmMode: config3.swarm_mode,
|
|
27138
26824
|
maxIterations: config3.max_iterations,
|
|
27139
26825
|
agentCount: Object.keys(agents).length
|
|
27140
26826
|
});
|
|
@@ -27145,18 +26831,6 @@ var OpenCodeSwarm = async (ctx) => {
|
|
|
27145
26831
|
detect_domains,
|
|
27146
26832
|
extract_code_blocks
|
|
27147
26833
|
},
|
|
27148
|
-
config: async (opencodeConfig) => {
|
|
27149
|
-
opencodeConfig.default_agent = "architect";
|
|
27150
|
-
if (!opencodeConfig.agent) {
|
|
27151
|
-
opencodeConfig.agent = { ...agents };
|
|
27152
|
-
} else {
|
|
27153
|
-
Object.assign(opencodeConfig.agent, agents);
|
|
27154
|
-
}
|
|
27155
|
-
log("Config applied", {
|
|
27156
|
-
defaultAgent: "architect",
|
|
27157
|
-
agents: Object.keys(agents)
|
|
27158
|
-
});
|
|
27159
|
-
},
|
|
27160
26834
|
"experimental.chat.messages.transform": pipelineHook["experimental.chat.messages.transform"]
|
|
27161
26835
|
};
|
|
27162
26836
|
};
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-swarm",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.1",
|
|
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",
|
|
7
7
|
"bin": {
|
|
8
|
-
"opencode-swarm": "
|
|
8
|
+
"opencode-swarm": "dist/cli/index.js"
|
|
9
9
|
},
|
|
10
10
|
"type": "module",
|
|
11
11
|
"license": "MIT",
|