opencode-swarm 7.0.0-beta.1 → 8.0.1-beta.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/index.js +182 -129
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -62769,150 +62769,203 @@ var write_retro = createSwarmTool({
|
|
|
62769
62769
|
init_src2();
|
|
62770
62770
|
|
|
62771
62771
|
// src/index.ts
|
|
62772
|
+
console.log("[opencode-swarm] Module loaded \u2014 dist/index.js executing");
|
|
62772
62773
|
var OpenCodeSwarm = async (ctx) => {
|
|
62773
|
-
|
|
62774
|
-
|
|
62775
|
-
|
|
62776
|
-
|
|
62777
|
-
|
|
62778
|
-
|
|
62779
|
-
|
|
62780
|
-
|
|
62781
|
-
|
|
62782
|
-
|
|
62783
|
-
|
|
62784
|
-
|
|
62785
|
-
|
|
62786
|
-
|
|
62787
|
-
|
|
62788
|
-
|
|
62789
|
-
console.
|
|
62790
|
-
|
|
62791
|
-
console.
|
|
62792
|
-
|
|
62793
|
-
|
|
62794
|
-
|
|
62795
|
-
|
|
62796
|
-
|
|
62797
|
-
|
|
62798
|
-
|
|
62799
|
-
|
|
62800
|
-
|
|
62801
|
-
|
|
62802
|
-
|
|
62803
|
-
|
|
62804
|
-
|
|
62805
|
-
|
|
62806
|
-
|
|
62807
|
-
|
|
62808
|
-
|
|
62809
|
-
|
|
62810
|
-
|
|
62811
|
-
|
|
62812
|
-
|
|
62813
|
-
|
|
62814
|
-
|
|
62815
|
-
|
|
62816
|
-
|
|
62817
|
-
|
|
62774
|
+
console.log("[opencode-swarm] \uD83D\uDE80 Plugin startup begin \u2014 version 8.0.0-beta.0");
|
|
62775
|
+
console.log("[opencode-swarm] ctx.directory:", ctx.directory);
|
|
62776
|
+
let config4;
|
|
62777
|
+
let loadedFromFile;
|
|
62778
|
+
try {
|
|
62779
|
+
const result = loadPluginConfigWithMeta2(ctx.directory);
|
|
62780
|
+
config4 = result.config;
|
|
62781
|
+
loadedFromFile = result.loadedFromFile;
|
|
62782
|
+
console.log("[opencode-swarm] \u2713 Config loaded, loadedFromFile:", loadedFromFile);
|
|
62783
|
+
} catch (err2) {
|
|
62784
|
+
console.error("[opencode-swarm] \u2717 FATAL: loadPluginConfigWithMeta failed:", err2 instanceof Error ? err2.stack : err2);
|
|
62785
|
+
throw err2;
|
|
62786
|
+
}
|
|
62787
|
+
try {
|
|
62788
|
+
console.log("[opencode-swarm] \u2192 loadSnapshot...");
|
|
62789
|
+
await loadSnapshot(ctx.directory);
|
|
62790
|
+
console.log("[opencode-swarm] \u2713 loadSnapshot complete");
|
|
62791
|
+
} catch (err2) {
|
|
62792
|
+
console.error("[opencode-swarm] \u2717 FATAL: loadSnapshot failed:", err2 instanceof Error ? err2.stack : err2);
|
|
62793
|
+
throw err2;
|
|
62794
|
+
}
|
|
62795
|
+
let agents2;
|
|
62796
|
+
let agentDefinitions;
|
|
62797
|
+
let pipelineHook;
|
|
62798
|
+
let systemEnhancerHook;
|
|
62799
|
+
let compactionHook;
|
|
62800
|
+
let contextBudgetHandler;
|
|
62801
|
+
let commandHandler;
|
|
62802
|
+
let activityHooks;
|
|
62803
|
+
let delegationGateHooks;
|
|
62804
|
+
let delegationSanitizerHook;
|
|
62805
|
+
let guardrailsConfig;
|
|
62806
|
+
let delegationHandler;
|
|
62807
|
+
let guardrailsHooks;
|
|
62808
|
+
let summaryConfig;
|
|
62809
|
+
let toolSummarizerHook;
|
|
62810
|
+
let knowledgeConfig;
|
|
62811
|
+
let knowledgeCuratorHook;
|
|
62812
|
+
let hivePromoterHook;
|
|
62813
|
+
let knowledgeInjectorHook;
|
|
62814
|
+
let steeringConsumedHook;
|
|
62815
|
+
let coChangeSuggesterHook;
|
|
62816
|
+
let darkMatterDetectorHook;
|
|
62817
|
+
let snapshotWriterHook;
|
|
62818
|
+
let automationConfig;
|
|
62818
62819
|
let automationManager;
|
|
62819
62820
|
let preflightTriggerManager;
|
|
62820
|
-
|
|
62821
|
-
|
|
62822
|
-
|
|
62823
|
-
|
|
62824
|
-
|
|
62825
|
-
|
|
62826
|
-
|
|
62827
|
-
|
|
62828
|
-
|
|
62829
|
-
|
|
62830
|
-
|
|
62831
|
-
|
|
62832
|
-
|
|
62833
|
-
|
|
62834
|
-
|
|
62835
|
-
|
|
62836
|
-
|
|
62837
|
-
|
|
62838
|
-
|
|
62839
|
-
|
|
62840
|
-
|
|
62841
|
-
|
|
62842
|
-
|
|
62843
|
-
|
|
62844
|
-
|
|
62821
|
+
try {
|
|
62822
|
+
console.log("[opencode-swarm] \u2192 initializing hooks and managers...");
|
|
62823
|
+
agents2 = getAgentConfigs(config4);
|
|
62824
|
+
agentDefinitions = createAgents(config4);
|
|
62825
|
+
pipelineHook = createPipelineTrackerHook(config4, ctx.directory);
|
|
62826
|
+
systemEnhancerHook = createSystemEnhancerHook(config4, ctx.directory);
|
|
62827
|
+
compactionHook = createCompactionCustomizerHook(config4, ctx.directory);
|
|
62828
|
+
contextBudgetHandler = createContextBudgetHandler(config4);
|
|
62829
|
+
commandHandler = createSwarmCommandHandler(ctx.directory, Object.fromEntries(agentDefinitions.map((agent) => [agent.name, agent])));
|
|
62830
|
+
activityHooks = createAgentActivityHooks(config4, ctx.directory);
|
|
62831
|
+
delegationGateHooks = createDelegationGateHook(config4, ctx.directory);
|
|
62832
|
+
delegationSanitizerHook = createDelegationSanitizerHook(ctx.directory);
|
|
62833
|
+
const guardrailsFallback = config4.guardrails?.enabled === false ? { ...config4.guardrails, enabled: false } : config4.guardrails ?? {};
|
|
62834
|
+
guardrailsConfig = GuardrailsConfigSchema.parse(guardrailsFallback);
|
|
62835
|
+
if (loadedFromFile && guardrailsConfig.enabled === false) {
|
|
62836
|
+
console.warn("");
|
|
62837
|
+
console.warn("\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550");
|
|
62838
|
+
console.warn("[opencode-swarm] \uD83D\uDD34 SECURITY WARNING: GUARDRAILS ARE DISABLED");
|
|
62839
|
+
console.warn("\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550");
|
|
62840
|
+
console.warn("Guardrails have been explicitly disabled in user configuration.");
|
|
62841
|
+
console.warn("This disables safety measures including:");
|
|
62842
|
+
console.warn(" - Tool call limits");
|
|
62843
|
+
console.warn(" - Duration limits");
|
|
62844
|
+
console.warn(" - Repetition detection");
|
|
62845
|
+
console.warn(" - Error rate limits");
|
|
62846
|
+
console.warn(" - Idle timeouts");
|
|
62847
|
+
console.warn("");
|
|
62848
|
+
console.warn("Only disable guardrails if you fully understand the security implications.");
|
|
62849
|
+
console.warn('To re-enable guardrails, set "guardrails.enabled" to true in your config.');
|
|
62850
|
+
console.warn("\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550");
|
|
62851
|
+
console.warn("");
|
|
62852
|
+
}
|
|
62853
|
+
delegationHandler = createDelegationTrackerHook(config4, guardrailsConfig.enabled);
|
|
62854
|
+
guardrailsHooks = createGuardrailsHooks(ctx.directory, guardrailsConfig);
|
|
62855
|
+
summaryConfig = SummaryConfigSchema.parse(config4.summaries ?? {});
|
|
62856
|
+
toolSummarizerHook = createToolSummarizerHook(summaryConfig, ctx.directory);
|
|
62857
|
+
knowledgeConfig = KnowledgeConfigSchema.parse(config4.knowledge ?? {});
|
|
62858
|
+
knowledgeCuratorHook = knowledgeConfig.enabled ? createKnowledgeCuratorHook(ctx.directory, knowledgeConfig) : undefined;
|
|
62859
|
+
hivePromoterHook = knowledgeConfig.enabled && knowledgeConfig.hive_enabled ? createHivePromoterHook(ctx.directory, knowledgeConfig) : undefined;
|
|
62860
|
+
knowledgeInjectorHook = knowledgeConfig.enabled ? createKnowledgeInjectorHook(ctx.directory, knowledgeConfig) : undefined;
|
|
62861
|
+
steeringConsumedHook = createSteeringConsumedHook(ctx.directory);
|
|
62862
|
+
coChangeSuggesterHook = createCoChangeSuggesterHook(ctx.directory);
|
|
62863
|
+
darkMatterDetectorHook = createDarkMatterDetectorHook(ctx.directory);
|
|
62864
|
+
snapshotWriterHook = createSnapshotWriterHook(ctx.directory);
|
|
62865
|
+
automationConfig = AutomationConfigSchema.parse(config4.automation ?? {});
|
|
62866
|
+
if (automationConfig.mode !== "manual") {
|
|
62867
|
+
automationManager = createAutomationManager(automationConfig);
|
|
62868
|
+
const { PreflightTriggerManager: PTM } = await Promise.resolve().then(() => (init_src2(), exports_src));
|
|
62869
|
+
preflightTriggerManager = new PTM(automationConfig);
|
|
62870
|
+
const { AutomationStatusArtifact: ASA } = await Promise.resolve().then(() => (init_src2(), exports_src));
|
|
62871
|
+
const swarmDir = path55.resolve(ctx.directory, ".swarm");
|
|
62872
|
+
const statusArtifact = new ASA(swarmDir);
|
|
62873
|
+
statusArtifact.updateConfig(automationConfig.mode, automationConfig.capabilities);
|
|
62874
|
+
if (automationConfig.capabilities?.evidence_auto_summaries === true) {
|
|
62875
|
+
const { createEvidenceSummaryIntegration: createEvidenceSummaryIntegration2 } = await Promise.resolve().then(() => (init_src2(), exports_src));
|
|
62876
|
+
createEvidenceSummaryIntegration2({
|
|
62845
62877
|
automationConfig,
|
|
62846
62878
|
directory: ctx.directory,
|
|
62847
|
-
swarmDir
|
|
62848
|
-
|
|
62849
|
-
preflightTriggerManager = manager;
|
|
62850
|
-
log("Preflight integration initialized", { directory: ctx.directory });
|
|
62851
|
-
} catch (err2) {
|
|
62852
|
-
log("Preflight integration failed to initialize (non-fatal)", {
|
|
62853
|
-
error: err2 instanceof Error ? err2.message : String(err2)
|
|
62879
|
+
swarmDir: ctx.directory,
|
|
62880
|
+
summaryFilename: "evidence-summary.json"
|
|
62854
62881
|
});
|
|
62855
|
-
|
|
62856
|
-
}
|
|
62857
|
-
if (automationConfig.capabilities?.plan_sync === true) {
|
|
62858
|
-
try {
|
|
62859
|
-
const planSyncWorker = new PlanSyncWorker({
|
|
62882
|
+
log("Evidence summary integration initialized", {
|
|
62860
62883
|
directory: ctx.directory
|
|
62861
62884
|
});
|
|
62862
|
-
planSyncWorker.start();
|
|
62863
|
-
log("PlanSyncWorker initialized", { directory: ctx.directory });
|
|
62864
|
-
} catch (err2) {
|
|
62865
|
-
log("PlanSyncWorker failed to initialize (non-fatal)", {
|
|
62866
|
-
error: err2 instanceof Error ? err2.message : String(err2)
|
|
62867
|
-
});
|
|
62868
62885
|
}
|
|
62869
|
-
|
|
62870
|
-
|
|
62871
|
-
|
|
62872
|
-
|
|
62873
|
-
|
|
62874
|
-
|
|
62875
|
-
|
|
62876
|
-
|
|
62877
|
-
|
|
62878
|
-
|
|
62879
|
-
|
|
62880
|
-
|
|
62881
|
-
|
|
62882
|
-
|
|
62883
|
-
|
|
62884
|
-
|
|
62885
|
-
|
|
62886
|
-
|
|
62886
|
+
if (automationConfig.capabilities?.phase_preflight === true) {
|
|
62887
|
+
const { createPreflightIntegration: createPreflightIntegration2 } = await Promise.resolve().then(() => (init_src2(), exports_src));
|
|
62888
|
+
try {
|
|
62889
|
+
const { manager } = createPreflightIntegration2({
|
|
62890
|
+
automationConfig,
|
|
62891
|
+
directory: ctx.directory,
|
|
62892
|
+
swarmDir
|
|
62893
|
+
});
|
|
62894
|
+
preflightTriggerManager = manager;
|
|
62895
|
+
log("Preflight integration initialized", {
|
|
62896
|
+
directory: ctx.directory
|
|
62897
|
+
});
|
|
62898
|
+
} catch (err2) {
|
|
62899
|
+
log("Preflight integration failed to initialize (non-fatal)", {
|
|
62900
|
+
error: err2 instanceof Error ? err2.message : String(err2)
|
|
62901
|
+
});
|
|
62902
|
+
}
|
|
62903
|
+
}
|
|
62904
|
+
if (automationConfig.capabilities?.plan_sync === true) {
|
|
62905
|
+
try {
|
|
62906
|
+
const planSyncWorker = new PlanSyncWorker({
|
|
62907
|
+
directory: ctx.directory
|
|
62908
|
+
});
|
|
62909
|
+
planSyncWorker.start();
|
|
62910
|
+
log("PlanSyncWorker initialized", { directory: ctx.directory });
|
|
62911
|
+
} catch (err2) {
|
|
62912
|
+
log("PlanSyncWorker failed to initialize (non-fatal)", {
|
|
62913
|
+
error: err2 instanceof Error ? err2.message : String(err2)
|
|
62887
62914
|
});
|
|
62888
62915
|
}
|
|
62889
|
-
}
|
|
62890
|
-
|
|
62891
|
-
|
|
62916
|
+
}
|
|
62917
|
+
log("Automation framework initialized", {
|
|
62918
|
+
mode: automationConfig.mode,
|
|
62919
|
+
enabled: automationManager?.isEnabled(),
|
|
62920
|
+
preflightEnabled: preflightTriggerManager?.isEnabled()
|
|
62921
|
+
});
|
|
62922
|
+
}
|
|
62923
|
+
if (shouldRunOnStartup(automationConfig)) {
|
|
62924
|
+
const enableAutofix = automationConfig.capabilities?.config_doctor_autofix === true;
|
|
62925
|
+
Promise.resolve().then(() => (init_src2(), exports_src)).then(({ runConfigDoctorWithFixes: runConfigDoctorWithFixes2 }) => {
|
|
62926
|
+
runConfigDoctorWithFixes2(ctx.directory, config4, enableAutofix).then((doctorResult) => {
|
|
62927
|
+
if (doctorResult.result.findings.length > 0) {
|
|
62928
|
+
log("Config Doctor ran on startup", {
|
|
62929
|
+
findings: doctorResult.result.findings.length,
|
|
62930
|
+
errors: doctorResult.result.summary.error,
|
|
62931
|
+
warnings: doctorResult.result.summary.warn,
|
|
62932
|
+
appliedFixes: doctorResult.appliedFixes.length,
|
|
62933
|
+
autofixEnabled: enableAutofix
|
|
62934
|
+
});
|
|
62935
|
+
}
|
|
62936
|
+
}).catch((err2) => {
|
|
62937
|
+
log("Config Doctor error (non-fatal)", {
|
|
62938
|
+
error: err2 instanceof Error ? err2.message : String(err2)
|
|
62939
|
+
});
|
|
62892
62940
|
});
|
|
62893
62941
|
});
|
|
62942
|
+
}
|
|
62943
|
+
log("Plugin initialized", {
|
|
62944
|
+
maxIterations: config4.max_iterations,
|
|
62945
|
+
agentCount: Object.keys(agents2).length,
|
|
62946
|
+
hooks: {
|
|
62947
|
+
pipeline: !!pipelineHook["experimental.chat.messages.transform"],
|
|
62948
|
+
systemEnhancer: !!systemEnhancerHook["experimental.chat.system.transform"],
|
|
62949
|
+
compaction: !!compactionHook["experimental.session.compacting"],
|
|
62950
|
+
contextBudget: !!contextBudgetHandler,
|
|
62951
|
+
commands: true,
|
|
62952
|
+
agentActivity: config4.hooks?.agent_activity !== false,
|
|
62953
|
+
delegationTracker: config4.hooks?.delegation_tracker === true,
|
|
62954
|
+
guardrails: guardrailsConfig.enabled,
|
|
62955
|
+
toolSummarizer: summaryConfig.enabled,
|
|
62956
|
+
knowledge: knowledgeConfig.enabled
|
|
62957
|
+
},
|
|
62958
|
+
automation: {
|
|
62959
|
+
mode: automationConfig.mode,
|
|
62960
|
+
capabilities: automationConfig.capabilities
|
|
62961
|
+
}
|
|
62894
62962
|
});
|
|
62963
|
+
console.log("[opencode-swarm] \u2713 all hooks initialized");
|
|
62964
|
+
} catch (err2) {
|
|
62965
|
+
console.error("[opencode-swarm] \u2717 FATAL: hook/manager initialization failed:", err2 instanceof Error ? err2.stack : err2);
|
|
62966
|
+
throw err2;
|
|
62895
62967
|
}
|
|
62896
|
-
log("Plugin
|
|
62897
|
-
maxIterations: config4.max_iterations,
|
|
62898
|
-
agentCount: Object.keys(agents2).length,
|
|
62899
|
-
hooks: {
|
|
62900
|
-
pipeline: !!pipelineHook["experimental.chat.messages.transform"],
|
|
62901
|
-
systemEnhancer: !!systemEnhancerHook["experimental.chat.system.transform"],
|
|
62902
|
-
compaction: !!compactionHook["experimental.session.compacting"],
|
|
62903
|
-
contextBudget: !!contextBudgetHandler,
|
|
62904
|
-
commands: true,
|
|
62905
|
-
agentActivity: config4.hooks?.agent_activity !== false,
|
|
62906
|
-
delegationTracker: config4.hooks?.delegation_tracker === true,
|
|
62907
|
-
guardrails: guardrailsConfig.enabled,
|
|
62908
|
-
toolSummarizer: summaryConfig.enabled,
|
|
62909
|
-
knowledge: knowledgeConfig.enabled
|
|
62910
|
-
},
|
|
62911
|
-
automation: {
|
|
62912
|
-
mode: automationConfig.mode,
|
|
62913
|
-
capabilities: automationConfig.capabilities
|
|
62914
|
-
}
|
|
62915
|
-
});
|
|
62968
|
+
console.log("[opencode-swarm] \u2713 Plugin startup complete \u2014 returning plugin object");
|
|
62916
62969
|
return {
|
|
62917
62970
|
name: "opencode-swarm",
|
|
62918
62971
|
agent: agents2,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-swarm",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "8.0.1-beta.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
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"prepublishOnly": "bun run build"
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
|
-
"@opencode-swarm/core": "
|
|
52
|
+
"@opencode-swarm/core": "8.0.0-beta.0",
|
|
53
53
|
"@opencode-ai/plugin": "^1.1.53",
|
|
54
54
|
"@opencode-ai/sdk": "^1.1.53",
|
|
55
55
|
"zod": "^4.1.8"
|