opencode-swarm-plugin 0.11.0 → 0.11.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/README.md +1 -1
- package/bin/swarm.ts +116 -15
- package/package.json +1 -1
package/README.md
CHANGED
package/bin/swarm.ts
CHANGED
|
@@ -347,11 +347,22 @@ const DEPENDENCIES: Dependency[] = [
|
|
|
347
347
|
},
|
|
348
348
|
{
|
|
349
349
|
name: "Agent Mail",
|
|
350
|
-
command: "
|
|
351
|
-
checkArgs: [
|
|
350
|
+
command: "curl",
|
|
351
|
+
checkArgs: [
|
|
352
|
+
"-s",
|
|
353
|
+
"-X",
|
|
354
|
+
"POST",
|
|
355
|
+
"http://localhost:8765/mcp",
|
|
356
|
+
"-H",
|
|
357
|
+
"Content-Type: application/json",
|
|
358
|
+
"-d",
|
|
359
|
+
"{}",
|
|
360
|
+
"-o",
|
|
361
|
+
"/dev/null",
|
|
362
|
+
],
|
|
352
363
|
required: false,
|
|
353
|
-
install: "
|
|
354
|
-
installType: "
|
|
364
|
+
install: "https://github.com/Dicklesworthstone/mcp_agent_mail",
|
|
365
|
+
installType: "manual",
|
|
355
366
|
description: "Multi-agent coordination & file reservations",
|
|
356
367
|
},
|
|
357
368
|
{
|
|
@@ -375,7 +386,7 @@ const DEPENDENCIES: Dependency[] = [
|
|
|
375
386
|
{
|
|
376
387
|
name: "semantic-memory",
|
|
377
388
|
command: "semantic-memory",
|
|
378
|
-
checkArgs: ["
|
|
389
|
+
checkArgs: ["stats"],
|
|
379
390
|
required: false,
|
|
380
391
|
install: "npm install -g semantic-memory",
|
|
381
392
|
installType: "npm",
|
|
@@ -622,6 +633,104 @@ async function setup() {
|
|
|
622
633
|
|
|
623
634
|
p.intro("opencode-swarm-plugin v" + VERSION);
|
|
624
635
|
|
|
636
|
+
// Check if already configured FIRST
|
|
637
|
+
const configDir = join(homedir(), ".config", "opencode");
|
|
638
|
+
const pluginsDir = join(configDir, "plugins");
|
|
639
|
+
const commandsDir = join(configDir, "commands");
|
|
640
|
+
const agentsDir = join(configDir, "agents");
|
|
641
|
+
|
|
642
|
+
const pluginPath = join(pluginsDir, "swarm.ts");
|
|
643
|
+
const commandPath = join(commandsDir, "swarm.md");
|
|
644
|
+
const plannerAgentPath = join(agentsDir, "swarm-planner.md");
|
|
645
|
+
const workerAgentPath = join(agentsDir, "swarm-worker.md");
|
|
646
|
+
|
|
647
|
+
const existingFiles = [
|
|
648
|
+
pluginPath,
|
|
649
|
+
commandPath,
|
|
650
|
+
plannerAgentPath,
|
|
651
|
+
workerAgentPath,
|
|
652
|
+
].filter((f) => existsSync(f));
|
|
653
|
+
|
|
654
|
+
if (existingFiles.length > 0) {
|
|
655
|
+
p.log.success("Swarm is already configured!");
|
|
656
|
+
p.log.message(dim(" Found " + existingFiles.length + "/4 config files"));
|
|
657
|
+
|
|
658
|
+
const action = await p.select({
|
|
659
|
+
message: "What would you like to do?",
|
|
660
|
+
options: [
|
|
661
|
+
{
|
|
662
|
+
value: "skip",
|
|
663
|
+
label: "Keep existing config",
|
|
664
|
+
hint: "Exit without changes",
|
|
665
|
+
},
|
|
666
|
+
{
|
|
667
|
+
value: "models",
|
|
668
|
+
label: "Update agent models",
|
|
669
|
+
hint: "Keep customizations, just change models",
|
|
670
|
+
},
|
|
671
|
+
{
|
|
672
|
+
value: "reinstall",
|
|
673
|
+
label: "Reinstall everything",
|
|
674
|
+
hint: "Check deps and regenerate all config files",
|
|
675
|
+
},
|
|
676
|
+
],
|
|
677
|
+
});
|
|
678
|
+
|
|
679
|
+
if (p.isCancel(action) || action === "skip") {
|
|
680
|
+
p.outro("Config unchanged. Run 'swarm config' to see file locations.");
|
|
681
|
+
return;
|
|
682
|
+
}
|
|
683
|
+
|
|
684
|
+
if (action === "models") {
|
|
685
|
+
// Quick model update flow
|
|
686
|
+
const coordinatorModel = await p.select({
|
|
687
|
+
message: "Select coordinator model:",
|
|
688
|
+
options: COORDINATOR_MODELS,
|
|
689
|
+
initialValue: "anthropic/claude-sonnet-4-5",
|
|
690
|
+
});
|
|
691
|
+
|
|
692
|
+
if (p.isCancel(coordinatorModel)) {
|
|
693
|
+
p.cancel("Setup cancelled");
|
|
694
|
+
process.exit(0);
|
|
695
|
+
}
|
|
696
|
+
|
|
697
|
+
const workerModel = await p.select({
|
|
698
|
+
message: "Select worker model:",
|
|
699
|
+
options: WORKER_MODELS,
|
|
700
|
+
initialValue: "anthropic/claude-haiku-4-5",
|
|
701
|
+
});
|
|
702
|
+
|
|
703
|
+
if (p.isCancel(workerModel)) {
|
|
704
|
+
p.cancel("Setup cancelled");
|
|
705
|
+
process.exit(0);
|
|
706
|
+
}
|
|
707
|
+
|
|
708
|
+
// Update model lines in agent files
|
|
709
|
+
if (existsSync(plannerAgentPath)) {
|
|
710
|
+
const content = readFileSync(plannerAgentPath, "utf-8");
|
|
711
|
+
const updated = content.replace(
|
|
712
|
+
/^model: .+$/m,
|
|
713
|
+
`model: ${coordinatorModel}`,
|
|
714
|
+
);
|
|
715
|
+
writeFileSync(plannerAgentPath, updated);
|
|
716
|
+
p.log.success("Planner: " + coordinatorModel);
|
|
717
|
+
}
|
|
718
|
+
if (existsSync(workerAgentPath)) {
|
|
719
|
+
const content = readFileSync(workerAgentPath, "utf-8");
|
|
720
|
+
const updated = content.replace(
|
|
721
|
+
/^model: .+$/m,
|
|
722
|
+
`model: ${workerModel}`,
|
|
723
|
+
);
|
|
724
|
+
writeFileSync(workerAgentPath, updated);
|
|
725
|
+
p.log.success("Worker: " + workerModel);
|
|
726
|
+
}
|
|
727
|
+
p.outro("Models updated! Your customizations are preserved.");
|
|
728
|
+
return;
|
|
729
|
+
}
|
|
730
|
+
// action === "reinstall" - fall through to full setup
|
|
731
|
+
}
|
|
732
|
+
|
|
733
|
+
// Full setup flow
|
|
625
734
|
const s = p.spinner();
|
|
626
735
|
s.start("Checking dependencies...");
|
|
627
736
|
|
|
@@ -676,6 +785,7 @@ async function setup() {
|
|
|
676
785
|
}
|
|
677
786
|
}
|
|
678
787
|
|
|
788
|
+
// Only prompt for optional deps if there are missing ones
|
|
679
789
|
if (optionalMissing.length > 0) {
|
|
680
790
|
const installable = optionalMissing.filter(
|
|
681
791
|
(r) => r.dep.installType !== "manual",
|
|
@@ -844,22 +954,13 @@ async function setup() {
|
|
|
844
954
|
|
|
845
955
|
p.log.step("Setting up OpenCode integration...");
|
|
846
956
|
|
|
847
|
-
|
|
848
|
-
const pluginsDir = join(configDir, "plugins");
|
|
849
|
-
const commandsDir = join(configDir, "commands");
|
|
850
|
-
const agentsDir = join(configDir, "agents");
|
|
851
|
-
|
|
957
|
+
// Create directories if needed
|
|
852
958
|
for (const dir of [pluginsDir, commandsDir, agentsDir]) {
|
|
853
959
|
if (!existsSync(dir)) {
|
|
854
960
|
mkdirSync(dir, { recursive: true });
|
|
855
961
|
}
|
|
856
962
|
}
|
|
857
963
|
|
|
858
|
-
const pluginPath = join(pluginsDir, "swarm.ts");
|
|
859
|
-
const commandPath = join(commandsDir, "swarm.md");
|
|
860
|
-
const plannerAgentPath = join(agentsDir, "swarm-planner.md");
|
|
861
|
-
const workerAgentPath = join(agentsDir, "swarm-worker.md");
|
|
862
|
-
|
|
863
964
|
writeFileSync(pluginPath, PLUGIN_WRAPPER);
|
|
864
965
|
p.log.success("Plugin: " + pluginPath);
|
|
865
966
|
|
package/package.json
CHANGED