#!/usr/bin/env npx tsx
import { fileURLToPath as __fileURLToPath } from 'url';
import { dirname as __pathDirname } from 'path';
const __filename = __fileURLToPath(import.meta.url);
const __dirname = __pathDirname(__filename);
import "dotenv/config";
import { SwarmCoordinator } from "../src/integrations/ralph/swarm/swarm-coordinator.js";
import { SwarmRegistry } from "../src/integrations/ralph/monitoring/swarm-registry.js";
import { logger } from "../src/core/monitoring/logger.js";
async function runSimpleSwarm() {
  try {
    console.log("\u{1F9BE} Starting Simple Ralph Swarm Demo...");
    const registry = SwarmRegistry.getInstance();
    const coordinator = new SwarmCoordinator({
      maxAgents: 2,
      timeout: 3e4,
      enableGitWorkflow: false,
      // Disable git workflow to avoid branch conflicts
      enableStackMemoryBridge: false
      // Disable StackMemory integration temporarily
    });
    await coordinator.initialize();
    console.log("\u2705 Swarm coordinator initialized");
    const task = {
      id: "simple-demo-task",
      description: "Demonstrate basic swarm functionality without database dependencies",
      type: "demonstration",
      priority: "medium",
      estimatedDuration: 3e4,
      requirements: [
        "Show swarm initialization",
        "Demonstrate agent coordination",
        "Validate basic functionality"
      ]
    };
    console.log("\u{1F4CB} Task defined:", task.description);
    const swarmId = registry.registerSwarm(
      coordinator,
      "Simple Demo Swarm - No Database Dependencies"
    );
    console.log("\u{1F194} Swarm registered:", swarmId);
    const result = await coordinator.launchSwarm(
      task.description,
      [
        {
          role: "developer",
          specialization: "basic-functionality"
        }
      ],
      {
        enableRalphBridge: false,
        // Disable Ralph bridge to avoid database issues
        enableGitWorkflow: false
        // Already disabled in coordinator init
      }
    );
    console.log("\u{1F680} Swarm launched successfully!");
    console.log("\u{1F4CA} Result:", {
      swarmId: result.swarmId,
      agentCount: result.agents?.length || 0,
      status: result.status
    });
    const activeSwarms = registry.listActiveSwarms();
    console.log("\u{1F4C8} Active swarms:", activeSwarms.length);
    console.log("\u23F3 Simulating swarm work for 5 seconds...");
    await new Promise((resolve) => setTimeout(resolve, 5e3));
    console.log("\u{1F6D1} Stopping swarm...");
    await coordinator.stopSwarm();
    console.log("");
    console.log("\u{1F389} Simple swarm demo completed successfully!");
    console.log("");
    console.log("\u2705 Demonstrated:");
    console.log("   - Basic swarm coordinator initialization");
    console.log("   - Swarm registry management");
    console.log("   - Agent configuration without database dependencies");
    console.log("   - Simple task execution workflow");
    console.log("");
    console.log("\u{1F527} This approach bypasses:");
    console.log("   - Complex SessionManager database setup");
    console.log("   - StackMemory FrameManager initialization");
    console.log("   - Git workflow branch conflicts");
    console.log("   - Ralph-StackMemory bridge complications");
  } catch (error) {
    console.error("\u274C Simple swarm demo failed:", error.message);
    logger.error("Simple swarm demo error", error);
    process.exit(1);
  }
}
runSimpleSwarm();
//# sourceMappingURL=simple-swarm-demo.js.map
