/**
 * Swarm Orchestrator — Ruflo + Agentics Platform Integration
 *
 * Coordinates Ruflo swarm agents with Agentics platform services:
 *   1. Ensures Ruflo (claude-flow) is installed as a first-class dependency
 *   2. Initializes hierarchical swarm with anti-drift config
 *   3. Dispatches swarm agents + agentics platform agents per phase
 *   4. Stores all results in swarm memory for cross-phase coordination
 *   5. Runs quality/security reviews using agentics agents after each phase
 *
 * Ruflo swarm coordinates. Agentics agents do real work.
 * Together they form a team that produces enterprise-grade artifacts.
 */
export interface SwarmConfig {
    readonly topology: 'hierarchical' | 'hierarchical-mesh' | 'mesh';
    readonly maxAgents: number;
    readonly strategy: 'specialized' | 'balanced';
    readonly traceId: string;
    readonly runDir: string;
}
export interface PhaseAgent {
    readonly role: string;
    readonly type: string;
    readonly description: string;
}
/** Agentics platform service invocation for a pipeline phase. */
export interface AgenticsServiceCall {
    readonly domain: string;
    readonly agent: string;
    readonly role: string;
}
export interface SwarmPhaseConfig {
    readonly phase: number;
    readonly label: string;
    readonly agents: PhaseAgent[];
    readonly agenticsServices: AgenticsServiceCall[];
    readonly memoryNamespace: string;
}
export interface AgenticsServiceResult {
    readonly domain: string;
    readonly agent: string;
    readonly role: string;
    readonly status: number;
    readonly response: unknown;
    readonly timing: number;
}
export interface SwarmStatus {
    readonly initialized: boolean;
    readonly available: boolean;
    readonly agentCount: number;
    readonly agenticsServicesInvoked: number;
    readonly tasksCompleted: number;
    readonly memoryEntries: number;
}
/**
 * Agent teams dispatched per pipeline phase.
 *
 * Each phase has:
 *   - `agents`: Ruflo swarm agents (coordination, spawned via claude-flow CLI)
 *   - `agenticsServices`: Agentics platform agents (real work, invoked via agentics CLI)
 *
 * The swarm agents coordinate; the agentics agents analyze, validate, and enrich.
 */
export declare const PHASE_AGENTS: Record<number, SwarmPhaseConfig>;
/**
 * Scan scenario text + phase context for keywords and return additional
 * agentics agents to dispatch alongside the fixed defaults.
 *
 * Deduplicates against already-scheduled agents to avoid double-invocation.
 */
export declare function inferContextualAgents(scenarioQuery: string, phaseConfig: SwarmPhaseConfig, runDir: string): AgenticsServiceCall[];
/**
 * Invoke the Ruflo coding swarm to build a complete prototype.
 *
 * Uses ruflo's actual working commands (swarm init, task create, swarm start)
 * to orchestrate an agent team that generates frontend, backend, middleware,
 * SQL, and tests — all driven by SPARC/ADR/DDD/TDD artifacts.
 */
export declare function invokeRufloCodingSwarm(traceId: string, runDir: string): {
    invoked: boolean;
    filesModified: number;
    timing: number;
};
/**
 * Ensure Ruflo (claude-flow) is installed and functional.
 *
 * claude-flow is a declared dependency in package.json. If the binary is
 * missing (e.g. node_modules was cleared), we re-install it automatically.
 * This guarantees the swarm orchestrator always has its runtime available.
 *
 * Returns the path to the binary, or null if installation failed.
 */
export declare function ensureRufloInstalled(): string | null;
/**
 * Check if Ruflo is available. On first call, ensures installation.
 */
export declare function isClaudeFlowAvailable(): boolean;
/** Reset the availability cache (for testing). */
export declare function resetAvailabilityCache(): void;
/** State exposed by `CloudCircuitBreaker.state()`. */
export interface CloudBreakerState {
    readonly tripped: boolean;
    readonly after_n_timeouts: number;
    readonly agents: ReadonlyArray<string>;
}
/**
 * ADR-094 D7 — per-fanout circuit breaker that trips after N consecutive
 * cloud-tier failures and short-circuits remaining cloud invocations.
 * Local-tier successes do not reset the streak; they bypass the breaker.
 *
 * Cloud-tier successes DO reset the streak — if even one cloud call works,
 * we trust the cloud is alive again. This matches the originating-run
 * failure mode where an entire backend fleet was down at once.
 *
 * Resets per phase. Exported for unit tests.
 */
export declare class CloudCircuitBreaker {
    private consecutiveCloudFailures;
    private trippedFlag;
    private trippedAfterN;
    private readonly trippedAgents;
    private readonly threshold;
    constructor(threshold?: number);
    /**
     * Record an invocation outcome. `tier` is the tier the call was dispatched
     * on. `failed=true` AND `tier='cloud'` increments the consecutive-failure
     * counter; a cloud success resets it.
     */
    record(failed: boolean, tier: 'cloud' | 'local' | 'unknown', agentLabel: string): void;
    /** Returns true once the breaker has tripped. */
    shouldSkip(): boolean;
    /** Snapshot of the breaker state for status.json / gate-decision-log. */
    state(): CloudBreakerState;
}
/**
 * Resolve the cloud-breaker threshold from env (`AGENTICS_CLOUD_BREAKER_THRESHOLD`).
 * Falls back to the default constant. Exposed so callers can centralize the
 * threshold lookup instead of duplicating env-var parsing.
 */
export declare function resolveCloudBreakerThreshold(): number;
/**
 * ADR-094 D7 — read the breaker state recorded by `dispatchAgenticsServices`
 * onto the returned results array. Returns `undefined` when the breaker did
 * not trip (or when the array did not come from this dispatcher).
 */
export declare function getCloudBreakerState(results: ReadonlyArray<AgenticsServiceResult>): CloudBreakerState | undefined;
/**
 * Initialize the Ruflo swarm for the pipeline.
 *
 * Ensures claude-flow is installed (first-class dependency), then initializes
 * the hierarchical swarm with anti-drift configuration.
 *
 * Returns true if swarm was initialized, false on failure.
 */
export declare function initSwarm(config: SwarmConfig): boolean;
/**
 * Dispatch swarm agents + agentics platform agents for a pipeline phase.
 *
 * The Ruflo swarm coordinates agent teams while agentics platform services
 * (deployed in GCloud, cached locally) do real analysis, validation, and
 * enrichment work. Together they form a team.
 */
export declare function dispatchPhaseAgents(phaseConfig: SwarmPhaseConfig, traceId: string, runDir: string, scenarioQuery?: string): Promise<AgenticsServiceResult[]>;
/**
 * Store phase artifacts in swarm memory for cross-phase coordination.
 */
export declare function storePhaseArtifacts(phaseConfig: SwarmPhaseConfig, traceId: string, runDir: string, artifacts: string[], timing: number): void;
/**
 * Run quality review on phase output using both swarm agents and agentics services.
 *
 * Post-phase review dispatches:
 *   - Ruflo reviewer agent (swarm coordination)
 *   - Agentics quality/security agents (real validation)
 */
export declare function reviewPhaseOutput(phaseConfig: SwarmPhaseConfig, traceId: string, runDir: string): Promise<AgenticsServiceResult[]>;
/**
 * Record a phase failure in swarm memory.
 */
export declare function recordPhaseFailure(phaseConfig: SwarmPhaseConfig, traceId: string, error: string): void;
/**
 * Shutdown the swarm and persist metrics.
 */
export declare function shutdownSwarm(traceId: string, success: boolean, totalTiming: number): void;
/**
 * Get current swarm status including agentics service stats.
 */
export declare function getSwarmStatus(): SwarmStatus;
//# sourceMappingURL=swarm-orchestrator.d.ts.map