import type { SessionManager, SessionInfo } from "./session-manager.js";
import type { RoleStore } from "./role-store.js";
import type { ColorStore } from "./color-store.js";
import type { TaskManager } from "./task-manager.js";
export interface SwarmAgent {
    sessionId: string;
    role: string;
    worktreePath: string;
    branch: string;
    task: string;
    createdAt: number;
}
export interface SwarmAgentInfo {
    sessionId: string;
    role: string;
    status: string;
    worktreePath: string;
    branch: string;
    task: string;
    createdAt: number;
}
export interface SwarmState {
    goalId: string;
    teamLeadSessionId: string | null;
    agents: SwarmAgentInfo[];
    maxConcurrent: number;
}
/**
 * Manages swarm goal lifecycles — team lead sessions and role agent sessions
 * with isolated git worktrees.
 */
export interface SwarmManagerConfig {
    /** Color store for assigning unique palette indices to swarm sessions */
    colorStore: ColorStore;
    /** Task manager for looking up tasks assigned to sessions */
    taskManager: TaskManager;
    /** Role store for looking up role definitions (prompts, accessories, tools) */
    roleStore?: RoleStore;
}
export declare class SwarmManager {
    private sessionManager;
    private config;
    private taskManager;
    private swarms;
    private store;
    /** Reverse lookup: sessionId → goalId for quick dismissal. */
    private sessionToGoal;
    constructor(sessionManager: SessionManager, config: SwarmManagerConfig);
    /** Pick a palette index (0-19) not already used by any session, with randomisation. */
    private assignUniqueColor;
    /**
     * Convert an in-memory SwarmEntry to a PersistedSwarmEntry for storage.
     */
    private toPersistedEntry;
    /**
     * Persist the current state of a swarm entry to disk.
     */
    private persistEntry;
    /**
     * Restore swarms from disk persistence.
     * Reconstructs the in-memory Maps from the persisted store.
     */
    private restoreSwarms;
    private get goalManager();
    /**
     * Start a swarm for the given goal.
     * Creates a Team Lead session and returns it.
     */
    startSwarm(goalId: string): Promise<SessionInfo>;
    /**
     * Spawn a role agent for a swarm goal.
     * Creates an isolated git worktree and a session with the role's system prompt.
     * Sends the task as the first prompt.
     */
    spawnRole(goalId: string, role: string, task: string): Promise<{
        sessionId: string;
        worktreePath: string;
    }>;
    /**
     * Notify the team lead that a worker agent has gone idle.
     * Sends a steer message with task context so the team lead can decide next steps.
     */
    private notifyTeamLead;
    /**
     * Notify the team lead when a task transitions to a terminal state.
     * Called from the task transition REST endpoint so the team lead wakes up
     * even if the worker continues with another task without going idle.
     */
    notifyTeamLeadOfTaskCompletion(goalId: string, taskTitle: string, taskState: string): void;
    /**
     * Dismiss (terminate) a role agent session and clean up its worktree.
     */
    dismissRole(sessionId: string): Promise<boolean>;
    /**
     * List all active agents for a goal.
     */
    listAgents(goalId: string): SwarmAgentInfo[];
    /**
     * Complete a swarm: dismiss all role agents but keep the team lead alive.
     * The team lead remains active to present a report and await further instructions.
     */
    completeSwarm(goalId: string): Promise<void>;
    /**
     * Fully tear down a swarm: dismiss all agents AND terminate the team lead.
     * Use this when explicitly shutting down everything.
     */
    teardownSwarm(goalId: string): Promise<void>;
    /**
     * Get the full swarm state for a goal.
     */
    getSwarmState(goalId: string): SwarmState | undefined;
}
//# sourceMappingURL=swarm-manager.d.ts.map