/** * Orchestrator Adapter — Wrap a child SwarmOrchestrator as an agent * * This adapter enables hierarchical multi-orchestrator coordination. * A parent SwarmOrchestrator treats a child SwarmOrchestrator as just * another agent via the adapter system. Each child has its own * LockedBlackboard with its own filesystem mutex, so the propose → * validate → commit pattern prevents overwrites at every level. * * Usage: * const child = new SwarmOrchestrator('./boards/child-project', childRegistry); * const adapter = new OrchestratorAdapter(); * adapter.registerOrchestrator('child-team', child, { * description: 'Backend team orchestrator', * }); * * // Parent orchestrator delegates to the child as a normal agent * await parentOrchestrator.addAdapter(adapter); * await parentOrchestrator.execute('delegate_task', { * targetAgent: 'orchestrator:child-team', * taskPayload: { instruction: 'Refactor the auth module' }, * }, { agentId: 'root' }); * * The child orchestrator receives the task, decomposes it across its own * agents, and returns the aggregated result. The parent sees it as one * atomic response — the hierarchy is transparent. * * @module OrchestratorAdapter * @version 1.0.0 */ import { BaseAdapter } from './base-adapter'; import type { AdapterCapabilities, AgentPayload, AgentContext, AgentResult } from '../types/agent-adapter'; import type { SkillResult } from '../lib/orchestrator-types'; /** * Configuration for a child orchestrator registered with this adapter. */ export interface ChildOrchestratorConfig { /** Human-readable description of the child orchestrator's domain */ description?: string; /** Capabilities the child orchestrator advertises */ capabilities?: string[]; /** Default agent in the child swarm to target (if not specified in payload) */ defaultTargetAgent?: string; /** Timeout for child orchestrator execution in ms (default: 120_000) */ timeout?: number; } /** * Minimal interface for a SwarmOrchestrator. We don't import the concrete * class to avoid circular dependencies — adapters stay self-contained. */ export interface OrchestratorLike { name: string; execute(action: string, params: Record, context: { agentId: string; taskId?: string; sessionId?: string; }): Promise; } /** * Snapshot of a child orchestrator's internal state, surfaced to the * parent for unified visibility. */ export interface ChildOrchestratorState { /** The registered orchestrator id */ orchestratorId: string; /** Whether the child is currently processing a task */ busy: boolean; /** The swarm state snapshot (agents, blackboard, tasks) */ swarmState: unknown; /** Timestamp of the last query */ queriedAt: string; } export declare class OrchestratorAdapter extends BaseAdapter { readonly name = "orchestrator"; readonly version = "1.0.0"; private children; get capabilities(): AdapterCapabilities; /** * Register a child SwarmOrchestrator as an agent. * The child keeps its own blackboard, adapters, and lock — full isolation. */ registerOrchestrator(orchestratorId: string, orchestrator: OrchestratorLike, config?: ChildOrchestratorConfig): void; /** * Remove a child orchestrator from this adapter. */ removeOrchestrator(orchestratorId: string): boolean; /** * Execute a task on a child orchestrator. * * The payload is translated into a `delegate_task` call on the child. * If `handoff.targetAgent` is set, it becomes the target within the child * swarm. Otherwise, the child's `defaultTargetAgent` is used, or the * child decides its own routing. */ executeAgent(agentId: string, payload: AgentPayload, context: AgentContext): Promise; /** * Query the internal state of a child orchestrator. * Returns agents, blackboard snapshot, and tasks from the child swarm. * The parent can use this for unified visibility across the hierarchy. */ queryChildState(orchestratorId: string, scope?: 'all' | 'agents' | 'blackboard' | 'tasks'): Promise; /** * Query state of all registered child orchestrators. * This is the foundation for the unified ControlPlane view. */ queryAllChildStates(scope?: 'all' | 'agents' | 'blackboard' | 'tasks'): Promise; /** * Get the list of registered child orchestrator IDs. */ listOrchestrators(): string[]; /** * Check if a specific child orchestrator is currently busy. */ isChildBusy(orchestratorId: string): boolean; shutdown(): Promise; private timeoutAfter; } //# sourceMappingURL=orchestrator-adapter.d.ts.map