"use strict";
/**
 * Agent Orchestration System - Phase 5A (Minimal Orchestration)
 *
 * Provides multi-agent orchestration with:
 * - Agent registry and capability matching
 * - Inter-agent communication (pub/sub + request/response)
 * - Task decomposition and agent spawning
 * - Sequential execution orchestration
 * - Append-only event logging
 *
 * Philosophy: Earn complexity through validation, not ambition
 * Current: Sequential execution (parallel DAG comes after validation)
 */
Object.defineProperty(exports, "__esModule", { value: true });
exports.EventStore = exports.AgentOrchestrator = exports.AgentSpawner = exports.MessageBus = exports.AgentRegistry = void 0;
exports.createOrchestrationSystem = createOrchestrationSystem;
// Import classes for internal use
const AgentRegistry_1 = require("./AgentRegistry");
const MessageBus_1 = require("./MessageBus");
const AgentSpawner_1 = require("./AgentSpawner");
const AgentOrchestrator_1 = require("./AgentOrchestrator");
const EventStore_1 = require("./EventStore");
// Registry
var AgentRegistry_2 = require("./AgentRegistry");
Object.defineProperty(exports, "AgentRegistry", { enumerable: true, get: function () { return AgentRegistry_2.AgentRegistry; } });
// Message Bus
var MessageBus_2 = require("./MessageBus");
Object.defineProperty(exports, "MessageBus", { enumerable: true, get: function () { return MessageBus_2.MessageBus; } });
// Spawner
var AgentSpawner_2 = require("./AgentSpawner");
Object.defineProperty(exports, "AgentSpawner", { enumerable: true, get: function () { return AgentSpawner_2.AgentSpawner; } });
// Orchestrator
var AgentOrchestrator_2 = require("./AgentOrchestrator");
Object.defineProperty(exports, "AgentOrchestrator", { enumerable: true, get: function () { return AgentOrchestrator_2.AgentOrchestrator; } });
// Event Store
var EventStore_2 = require("./EventStore");
Object.defineProperty(exports, "EventStore", { enumerable: true, get: function () { return EventStore_2.EventStore; } });
/**
 * Create orchestration system with default configuration
 */
async function createOrchestrationSystem(baseDir) {
    // Initialize registry
    const registry = new AgentRegistry_1.AgentRegistry(baseDir);
    await registry.init();
    // Initialize message bus
    const messageBus = new MessageBus_1.MessageBus();
    messageBus.start();
    // Initialize spawner
    const spawner = new AgentSpawner_1.AgentSpawner(registry, messageBus);
    // Initialize orchestrator
    const orchestrator = new AgentOrchestrator_1.AgentOrchestrator(registry, messageBus, spawner);
    // Initialize event store
    const eventStore = new EventStore_1.EventStore(baseDir);
    await eventStore.init();
    // Wire up orchestrator events to event store
    messageBus.subscribe("orchestrator:*", async (message) => {
        await eventStore.append(message.topic, message.payload, {
            agentType: message.from,
        });
    });
    return {
        registry,
        messageBus,
        spawner,
        orchestrator,
        eventStore,
    };
}
//# sourceMappingURL=index.js.map