/**
 * Autonomy Orchestrator
 *
 * Mandatory control plane for high-level Nexus Prime execution.
 * Raw prompts flow through this layer before the runtime executes work.
 */
import { MemoryEngine } from './memory.js';
import { SessionDNAManager } from './session-dna.js';
import type { ClientRegistry } from './client-registry.js';
import type { RagIngestInput } from './rag-collections.js';
import { type ExecutionRun, type ExecutionTask, type SubAgentRuntime } from '../phantom/index.js';
export * from './orchestrator/types.js';
import { type Agent, type AutonomyIntent, type BootstrapRequestOptions, type SessionAutonomyState, type SessionBootstrapResult, type OrchestratorOptions } from './orchestrator/types.js';
import { decideWorkers } from './orchestrator/scoring.js';
export declare class OrchestratorEngine {
    private agents;
    private memory;
    private agentCounter;
    private runtime;
    private lastRun;
    private clientRegistry?;
    private sessionDNA?;
    private repoRoot;
    private workspaceContext;
    private readonly workspaceEnvelope;
    private tokenEngine;
    private instructionGateway;
    private knowledgeFabric;
    private sessionsDir;
    private sessionState;
    private flushInterval?;
    private compactionSentinel?;
    private memoryBackgroundWorker?;
    private unsubscribePreCompaction?;
    private repoTreeGenerator;
    private skillRuntime;
    private skillLearner;
    private executionDedupeStore;
    private circuitOpenUntil;
    private consecutiveFailures;
    private readonly CIRCUIT_THRESHOLD;
    private readonly CIRCUIT_COOLDOWN_MS;
    private lifecyclePolicy;
    private readonly _keywordsCache;
    private trackedRepoFilesCache?;
    private gitIndexPath?;
    private skillCatalogCache?;
    private workflowCatalogCache?;
    private hookCatalogCache?;
    private automationCatalogCache?;
    private clientSnapshotCache?;
    private readonly CLIENT_SNAPSHOT_CACHE_TTL_MS;
    private readonly specialistCatalogItems;
    private readonly crewCatalogItems;
    private crGraphClient?;
    constructor(options?: OrchestratorOptions);
    /**
     * Induces a specialized army of agents based on the prompt.
     * This remains a planning signal for runtime execution, not a direct executor.
     */
    induce(task: string): Promise<Agent[]>;
    decomposeTask(task: string): string[];
    private shouldAutoGhostPass;
    private autoGhostPass;
    private toFileRefs;
    private resolveRepoScopedPath;
    private filterRepoScopedFiles;
    private getWorkspaceEnvelope;
    private _prepareExecution;
    private checkCircuit;
    private getRunFingerprint;
    private buildWorkspaceRecallFilters;
    private getRepoScopedId;
    private nextRepeatedFailures;
    private updateCircuitState;
    private getSummaryActiveFiles;
    getMemoryEngine(): MemoryEngine;
    classifyIntent(task: string): AutonomyIntent;
    decideWorkers(...args: Parameters<typeof decideWorkers>): number;
    dispose(): void;
    persistSessionSummary(currentTokenCount?: number): import("./self-summarizer.js").SelfSummary;
    bootstrapSession(task: string, options?: BootstrapRequestOptions): Promise<SessionBootstrapResult>;
    private ensurePeriodicFlushAndSentinel;
    orchestrate(task: string, options?: Partial<ExecutionTask>): Promise<ExecutionRun>;
    /**
     * Backward-compatible alias for the old high-level entrypoint.
     */
    executeSwarm(task: string, options?: Partial<ExecutionTask>): Promise<ExecutionRun>;
    getAgents(): Agent[];
    getLastRun(): ExecutionRun | null;
    getSessionState(): SessionAutonomyState;
    getKnowledgeFabricSnapshot(): import("./knowledge-fabric.js").KnowledgeFabricSnapshot;
    getKnowledgeFabricProvenance(): import("./knowledge-fabric.js").ContextProvenanceTrace;
    listRagCollections(): import("./rag-collections.js").RagCollectionSummary[];
    getRagCollection(collectionId: string): import("./rag-collections.js").RagCollection;
    createRagCollection(input: {
        name: string;
        description?: string;
        tags?: string[];
        scope?: 'session' | 'project';
    }): import("./rag-collections.js").RagCollection;
    ingestRagCollection(collectionId: string, inputs: RagIngestInput[]): Promise<{
        collection: import("./rag-collections.js").RagCollection;
        sourcesAdded: number;
        chunksAdded: number;
    }>;
    attachRagCollection(collectionId: string): import("./rag-collections.js").RagCollection;
    detachRagCollection(collectionId: string): import("./rag-collections.js").RagCollection;
    deleteRagCollection(collectionId: string): boolean;
    listPatterns(): import("./pattern-registry.js").PatternCard[];
    searchPatterns(query: string, limit?: number): import("./pattern-registry.js").PatternSearchResult[];
    getModelTierTrace(): {
        policy?: import("./knowledge-fabric.js").ModelTierPolicy;
        trace: import("./knowledge-fabric.js").ModelTierTrace[];
    };
    plan(task: string, options?: Partial<ExecutionTask>): Promise<import("./task-planner.js").TaskPlannerState>;
    private composeKnowledgeFabric;
    private getRuntimeIdentity;
    private recallBootstrapMemory;
    private recoverSessionSummaryBootstrap;
    private recoverProjectMemoryBootstrap;
    /**
     * Run two async phases in parallel, but fail fast: if either rejects the
     * combined promise rejects immediately with that error. Both settle before
     * any resolved value is used, so no dangling promise is silently swallowed.
     */
    private runParallelPhases;
    private summarizeCurrentDirtyFiles;
    private filePriorStatePath;
    private loadFilePriorState;
    private saveFilePriorState;
    private getFilePriorMap;
    private updateFilePriorsFromRun;
    private normalizeArtifactOutcomeHistory;
    private loadSessionState;
    private persistSessionState;
    private sessionStatePath;
    /** Remove autonomy-session files older than 14 days */
    private pruneStaleAutonomySessions;
    private resolvePrimaryClient;
    private listDetectedClients;
    private getClientSnapshot;
    private detectCurrentClientFromEnv;
    private toClientSnapshot;
    private toRuntimeOrchestrationSnapshot;
    private toGovernanceSnapshot;
    private toClientFamily;
    private discoverCandidateFiles;
    private listRepoFilesForDiscovery;
    private listTrackedRepoFiles;
    private getGitIndexPath;
    private filterDiscoverableFiles;
    private getFilePriorBoost;
    private buildAtlasRoutingSignals;
    private isAtlasRoutingHealthy;
    private buildCandidateFileBoosts;
    private resolveKnowledgeStageHint;
    private walkRepo;
    private getRepoSearchPrefix;
    private getRepoSearchTermPrefix;
    private getRepoSearchManifestPath;
    private loadRepoSearchManifest;
    private saveRepoSearchManifest;
    private getRepoSearchTermDocId;
    private getRepoSearchIndex;
    /**
     * Build the n-gram repo search index up-front so the first nexus_orchestrate
     * / nexus_optimize_tokens call doesn't pay the cold-build cost (which is the
     * primary cause of Codex 120s timeouts on cold repos). Safe to call multiple
     * times — ensureRepoSearchIndex skips files whose mtime hasn't changed.
     *
     * Called by the daemon at startup via setImmediate so it doesn't block the
     * accept loop. Errors are swallowed: if pre-warming fails, the on-demand
     * path will rebuild the index normally.
     */
    warmRepoSearchIndex(): Promise<void>;
    /**
     * Returns a flat list of tracked repo file paths for topology rendering.
     * Clamped to `limit` (default 150). Used by /api/knowledge-topology.
     */
    listTopologyFiles(limit?: number): Promise<string[]>;
    private ensureRepoSearchIndex;
    private searchIndexedRepoCandidates;
    private toFileRef;
    private resolveSelections;
    private inferRuntimeCatalogHints;
    private filterExistingCatalogSelectors;
    private getSkillCatalogItems;
    private getWorkflowCatalogItems;
    private getHookCatalogItems;
    private getAutomationCatalogItems;
    private resolveCatalogVotes;
    private getCatalogSourcePrecedence;
    private isCatalogVoteSelected;
    private toArtifactAuditEntry;
    private evaluateCatalogEligibility;
    private isCodingSelectionIntent;
    private allowOperationalAutoSelection;
    private classifyCatalogItem;
    private getAuthorityTier;
    private pickCatalogNames;
    private pickCatalogEntries;
    private scanCatalogHealth;
    private generateOrchestrationPlan;
    /**
     * Returns the narrow context object consumed by all RunManagement standalone functions.
     * Fields that may be absent on stub engines (Object.create prototype stubs used in tests)
     * fall back to safe empty values; the RunManagement functions themselves wrap bodies in
     * try/catch so any downstream failure stays contained.
     */
    private _runMgrCtx;
}
export declare const createOrchestrator: (memory?: MemoryEngine, runtime?: SubAgentRuntime, clientRegistry?: ClientRegistry, sessionDNA?: SessionDNAManager, repoRoot?: string) => OrchestratorEngine;
