/**
 * Nexus Prime - Enhanced with Engines
 *
 * Local-first MCP control plane for coding agents.
 */
import { NexusConfig, Experience, NetworkMessage, Agent, AgentType } from './core/types.js';
import { Adapter, AdapterType } from './agents/adapters.js';
import { type OrchestratorEngine } from './engines/index.js';
import { type SessionSearchHit, type SessionSearchOptions, type SessionSnapshotRecord } from './engines/session-dna.js';
import { ClientRegistry } from './engines/client-registry.js';
import { type ExecutionRun, type ExecutionTask, type SubAgentRuntime } from './phantom/index.js';
import { type SynapseRuntime } from './synapse/index.js';
import { type ArchitectsRuntime } from './architects/index.js';
import { type RuntimeHealthEnvelope } from './engines/runtime-health.js';
import { type WorkspaceContext } from './engines/workspace-resolver.js';
import { type ChannelArtifactEnvelope, type ChannelArtifactEnvelopeInput, type ChannelThreadMapping, type ChannelThreadMappingInput } from './channels/gateway.js';
export declare class NexusPrime {
    private config;
    private adapters;
    private agents;
    private memories;
    private tokenOptimizer;
    private contextEngine;
    private memoryEngine;
    private orchestrator;
    private runtime;
    private learner;
    private sessionDNA;
    private clientRegistry;
    private deferOrchestratorInit;
    private readonly inspectionStartup;
    private runtimeDeferred;
    private coordinator;
    private evolution;
    private fission;
    private attention;
    private context;
    private running;
    private runtimeHotAt;
    private dashboardServer;
    private synapse;
    private architects;
    private synapseInitError;
    private workspaceContext;
    private synapseHealth;
    private architectsHealth;
    private scheduledAutomationTicker;
    private deferredStartupPromise;
    private _cachedTokenStats;
    private _cachedTokenStatsAt;
    constructor(config?: Partial<NexusConfig>);
    start(): Promise<void>;
    private finishEngineStartup;
    stop(): Promise<void>;
    private startScheduledAutomationTicker;
    /** Flush memory engine to SQLite (call before process exit) */
    flushMemory(): void;
    /** Load memory from SQLite (call on startup) */
    loadMemory(): void;
    /** Get the memory engine instance */
    get memory(): any;
    /** Get memory tier stats (used by nexus_memory_stats MCP tool) */
    getMemoryStats(): {
        schemaVersion: number;
        prefrontal: number;
        hippocampus: number;
        cortex: number;
        totalLinks: number;
        oldestEntry: number | null;
        purgeEligible: number;
        quarantineBacklog: number;
        lastHygieneAt: number | null;
        topTags: string[];
    };
    addAdapter(type: AdapterType, customName?: string): Promise<void>;
    createAgent(type: AgentType, options?: {
        id?: string;
        capabilities?: string[];
        memory?: boolean;
    }): Promise<Agent>;
    getAgent(id: string): Agent | undefined;
    getAllAgents(): Agent[];
    getAdapters(): Adapter[];
    /**
     * Optimize tokens using TokenOptimizer
     */
    optimizeTokens(task: string): Promise<any>;
    /**
     * Add to context
     */
    addContext(content: string): void;
    /**
     * Get relevant context
     */
    getContext(query: string): string[];
    /**
     * Store in memory
     */
    storeMemory(content: string, priority?: number, tags?: string[], parentId?: string, depth?: number, options?: {
        verbatim?: boolean;
        agentId?: string;
    }): string;
    /**
     * Recall from memory
     */
    recallMemory(query: string, k?: number, agentId?: string): Promise<string[]>;
    /**
     * Expose the graph memory engine for temporal queries.
     */
    getGraphMemory(): any;
    /**
     * Audit evolution candidates — returns structured analysis.
     */
    auditEvolution(): Promise<{
        candidates: import("./engines/memory.js").MemoryItem[];
        hotspots: Map<string, number>;
        recommendations: string[];
    }>;
    /**
     * Analyze result for learning
     */
    analyzeLearning(goal: string, decision: any): Promise<void>;
    /**
     * Execute via orchestrator
     */
    orchestrate(task: string, options?: Partial<ExecutionTask>): Promise<ExecutionRun>;
    /**
     * Push-mode dispatch: spawn a headless coding agent child process for the given goal.
     * Returns { runId, pid, invoker } immediately; the run proceeds in the background.
     * Stream progress via nexusEventBus 'dispatch.*' events.
     */
    pushDispatch(opts: import('./engines/dispatch/push-dispatch.js').PushDispatchOptions): Promise<import('./engines/dispatch/push-dispatch.js').PushDispatchResult>;
    getMemoryHealth(): import("./engines/runtime-registry.js").RuntimeMemoryHealthSnapshot;
    /** Run the tier promotion sweep. Called at session end (nexus_session_dna generate). */
    runTierPromotion(): {
        toHippocampus: number;
        toCortex: number;
        durationMs: number;
    } | null;
    getMemoryScopeUsage(): import("./engines/runtime-registry.js").RuntimeMemoryScopeUsageSnapshot;
    getSharedMemorySnapshot(limit?: number): {
        id: string;
        excerpt: string;
        scope: string;
        state: string;
        importanceScore: number;
        relevanceScore: number;
        tags: string[];
    }[];
    getMemoryReconciliationSummary(): import("./engines/runtime-registry.js").RuntimeMemoryReconciliationSummary;
    traceMemory(id: string): import("./engines/memory.js").MemoryTraceDetail;
    updateMemory(id: string, patch: Parameters<SubAgentRuntime['updateMemory']>[1]): import("./engines/memory.js").MemoryUpdateResult;
    deleteMemory(id: string, options?: Parameters<SubAgentRuntime['deleteMemory']>[1]): import("./engines/memory.js").MemoryDeleteResult;
    getMemoryHistory(id: string, limit?: number): import("./engines/memory.js").MemoryHistoryEntry[];
    submitMemoryFeedback(id: string, input?: Parameters<SubAgentRuntime['submitMemoryFeedback']>[1]): import("./engines/memory.js").MemoryFeedbackResult;
    maintainMemory(): import("./engines/memory-control-plane.js").MemoryMaintenanceResult;
    runMemoryHygiene(options?: {
        mode?: 'report' | 'apply';
        batchSize?: number;
        states?: Array<'active' | 'quarantined' | 'scrap' | 'expired'>;
        auditLimit?: number;
    }): import("./engines/memory.js").MemoryHygieneResult;
    exportMemoryBundle(options?: {
        limit?: number;
        scope?: 'session' | 'project' | 'user' | 'promoted' | 'shared';
        state?: 'active' | 'quarantined' | 'scrap';
        sessionId?: string;
    }): import("./engines/memory.js").MemoryExportBundle;
    backupMemoryBundle(options?: {
        limit?: number;
        scope?: 'session' | 'project' | 'user' | 'promoted' | 'shared';
        state?: 'active' | 'quarantined' | 'scrap';
        sessionId?: string;
    }): {
        path: string;
        bundle: import("./engines/memory.js").MemoryExportBundle;
    };
    importMemoryBundle(input: {
        path?: string;
        bundle?: unknown;
    }): Promise<import("./engines/memory.js").MemoryImportResult | {
        imported: number;
        duplicates: number;
        quarantined: number;
        importedIds: any[];
    }>;
    listScheduledAutomations(options?: {
        now?: number;
    }): import("./engines/automation-runtime.js").ScheduledAutomationSnapshot[];
    dispatchScheduledAutomations(options?: Parameters<SubAgentRuntime['dispatchScheduledAutomations']>[0]): Promise<{
        dispatches: import("./engines/automation-runtime.js").AutomationDispatch[];
        runs: ExecutionRun[];
        failures: Array<{
            automationId: string;
            error: string;
        }>;
    }>;
    listSessionSnapshots(sessionsDir?: string): SessionSnapshotRecord[];
    searchSessionHistory(query: string, options?: SessionSearchOptions): SessionSearchHit[];
    mapChannelThread(input: ChannelThreadMappingInput): ChannelThreadMapping;
    createChannelArtifactEnvelope(input: ChannelArtifactEnvelopeInput): ChannelArtifactEnvelope;
    execute(agentId: string, task: string, options?: Partial<ExecutionTask>): Promise<{
        result: string;
        experience: Experience;
        execution: ExecutionRun;
    }>;
    getRuntime(): SubAgentRuntime;
    getOrchestrator(): OrchestratorEngine;
    /**
     * Resolves when the server has finished deferred engine startup.
     * MCP adapters should await this before creating or using the orchestrator.
     */
    awaitReady(): Promise<void>;
    getClientRegistry(): ClientRegistry;
    getRuntimeHotAt(): number | null;
    getDashboardAddress(): string | null;
    getSynapse(): SynapseRuntime | null;
    getArchitects(): ArchitectsRuntime | null;
    /**
     * Lazy-init Synapse if it wasn't initialized at startup (e.g. native module failed).
     * Called automatically on first nexus_synapse_* tool call.
     */
    ensureSynapseInit(): void;
    getSynapseInitError(): {
        message: string;
        stack: string | null;
        at: number;
    } | null;
    /**
     * Lazy-init Architects if it wasn't initialized at startup.
     * Called automatically on first nexus_architects_* tool call.
     */
    ensureArchitectsInit(): void;
    /**
     * Re-wire the Synapse coordination bridge after Architects becomes available.
     * Safe to call multiple times — only updates if both Synapse and Architects are live.
     */
    private reconnectSynapseCoordination;
    getWorkspaceContext(): WorkspaceContext;
    /**
     * Promote a hinted workspace context (e.g. resolved from nexus_session_bootstrap
     * file hints) so the dashboard + downstream consumers stop showing the stdio
     * MCP fallback ("/" → "workspace"). Only accepts contexts that look like a
     * real project root — never filesystem root, never the installed-package dir.
     */
    setWorkspaceContext(next: WorkspaceContext): boolean;
    getRuntimeHealthEnvelope(): RuntimeHealthEnvelope;
    private ensureOrchestrator;
    private createInspectionRuntime;
    private ensureFullRuntime;
    private ensureLearner;
    diagnoseRuntime(): {
        ok: boolean;
        issues: string[];
        envelope: RuntimeHealthEnvelope;
        bootstrapManifest: import("./engines/client-bootstrap.js").BootstrapManifestStatus;
    };
    autofixRuntime(): {
        bootstrapManifest: import("./engines/client-bootstrap.js").BootstrapManifestStatus;
        memoryMaintenance: import("./engines/memory-control-plane.js").MemoryMaintenanceResult;
        diagnosis: {
            ok: boolean;
            issues: string[];
            envelope: RuntimeHealthEnvelope;
            bootstrapManifest: import("./engines/client-bootstrap.js").BootstrapManifestStatus;
        };
    };
    getSelectionLedger(): {
        audit: import("./engines/runtime-registry.js").RuntimeArtifactSelectionAudit;
        outcomes: import("./engines/runtime-registry.js").RuntimeArtifactOutcomeSnapshot;
        workerPlan: import("./engines/runtime-registry.js").RuntimeWorkerPlanSnapshot;
        taskGraph: import("./engines/runtime-registry.js").RuntimeTaskGraphSnapshot;
        catalogHealth: import("./engines/runtime-registry.js").RuntimeCatalogHealthSnapshot;
    };
    private createSynapseCoordinationBridge;
    evolve(): void;
    getGrammar(): import("./nexus-prime.js").GrammarRule[];
    broadcast(message: Omit<NetworkMessage, 'id' | 'timestamp'>): Promise<void>;
    getConfig(): NexusConfig;
    getStats(): any;
    getRuntimeStats(): any;
    private getDefaultCapabilities;
}
export declare const createNexusPrime: (config?: Partial<NexusConfig>) => NexusPrime;
export { GhostPass, PhantomOrchestrator, PhantomWorker } from './phantom/index.js';
export type { GhostReport, WorkerTask, WorkerResult, MergeDecision } from './phantom/index.js';
export { MemoryEngine, createMemoryEngine } from './engines/memory.js';
export { SessionDNAManager } from './engines/session-dna.js';
export type { SessionDNA } from './engines/session-dna.js';
export { GithubBridge, getSharedGithubBridge } from './engines/github-bridge.js';
export type { GithubPromotionInput, GithubPromotionResult } from './engines/github-bridge.js';
