/**
 * Run-management I/O functions extracted from OrchestratorEngine.
 * Each function takes a narrow `RunManagerContext` instead of `this`, making
 * them testable in isolation and safe to call from any module.
 *
 * OrchestratorEngine delegates to these via thin wrapper methods that pass
 * `this._runMgrCtx()` as the first argument.
 */
import { getSharedSummarizer } from '../self-summarizer.js';
import { type FilePrior } from '../priors/file-priors.js';
import type { MemoryEngine } from '../memory.js';
import type { ExecutionRun } from '../../phantom/index.js';
import type { ArtifactOutcomeHistoryMap, AutonomyIntent, PersistedFilePriorState, SessionAutonomyState } from './types.js';
/**
 * Narrow slice of OrchestratorEngine state required by run-management functions.
 * Construct this in OrchestratorEngine._runMgrCtx() and pass it through.
 */
export interface RunManagerContext {
    /** Absolute path to the repository root. */
    repoRoot: string;
    /** Directory where per-session autonomy-state JSON files are stored. */
    sessionsDir: string;
    /** workspace state root (workspaceContext.stateRoot). */
    stateRoot: string;
    /** Returns the current runtime ID (used for session file naming). */
    getRuntimeId: () => string;
    /** Returns the session DNA session ID, if available. */
    getSessionId: () => string | undefined;
    /** The live session state object (mutated in place by the engine). */
    sessionState: SessionAutonomyState;
    /** Memory engine — for project-memory recovery. */
    memory: MemoryEngine;
    /** Returns a repo-scoped ID string for a given scope label. */
    getRepoScopedId: (scope: 'repo' | 'workspace' | 'project') => string;
    /** Returns token usage snapshot for the current runtime. */
    getUsageSnapshot: () => {
        tokens?: {
            grossInputTokens?: number;
        };
    };
    /** The last completed execution run, or null. */
    lastRun: ExecutionRun | null;
    /** Resolves a repo-relative or absolute path to an absolute path, or null. */
    resolveRepoScopedPath: (filePath: string) => string | null;
}
/** Returns the files that should be included in the session summary snapshot. */
export declare function getSummaryActiveFiles(ctx: RunManagerContext): string[];
/**
 * Persist a session summary snapshot to the shared summarizer.
 * Returns the summarizer result, or null if summarization fails.
 * (public — called from dispose() and from MCP layer)
 */
export declare function persistSessionSummary(ctx: RunManagerContext, currentTokenCount?: number): ReturnType<ReturnType<typeof getSharedSummarizer>['summarize']> | null;
/**
 * Attempts to recover a prior session summary for bootstrapping context.
 * Returns a summary info object, or undefined if none exists.
 */
export declare function recoverSessionSummaryBootstrap(ctx: RunManagerContext, projectId: string): {
    summary: string;
    summaryTokens: number;
    originalTokens: number;
    savedTokens: number;
} | undefined;
/**
 * Attempts to recover recent project-scoped memory excerpts for bootstrapping.
 * Returns a count + excerpts object, or undefined if no relevant memory found.
 */
export declare function recoverProjectMemoryBootstrap(ctx: RunManagerContext, repoId: string): {
    count: number;
    excerpts: string[];
} | undefined;
/**
 * Returns a list of currently modified (dirty) files in the working tree,
 * resolved to absolute paths. Best-effort — returns [] on any error.
 */
export declare function summarizeCurrentDirtyFiles(ctx: RunManagerContext, limit?: number): Promise<string[]>;
/** Absolute path to the persisted file-prior state JSON. */
export declare function filePriorStatePath(ctx: RunManagerContext): string;
/** Loads the persisted file-prior state from disk, returning an empty baseline on any failure. */
export declare function loadFilePriorState(ctx: RunManagerContext): Promise<PersistedFilePriorState>;
/** Persists the file-prior state to disk. Logs on error but does not throw. */
export declare function saveFilePriorState(ctx: RunManagerContext, state: PersistedFilePriorState): Promise<void>;
/** Returns a Map from resolved absolute file path to FilePrior. */
export declare function getFilePriorMap(ctx: RunManagerContext): Promise<Map<string, FilePrior>>;
/** Updates file-prior history based on the outcomes of a completed execution run. */
export declare function updateFilePriorsFromRun(ctx: RunManagerContext, run: ExecutionRun): Promise<void>;
/**
 * Normalizes a raw (possibly legacy or partial) artifact outcome history value
 * into the canonical `ArtifactOutcomeHistoryMap` shape.
 */
export declare function normalizeArtifactOutcomeHistory(value: unknown): ArtifactOutcomeHistoryMap;
/** Absolute path to the JSON file for the current runtime's autonomy session. */
export declare function sessionStatePath(ctx: RunManagerContext): string;
/**
 * Loads session autonomy state from disk for the current runtime.
 * Returns a fresh default state (keyed to the current session/runtime) if the
 * file does not exist or is corrupt.
 */
export declare function loadSessionState(ctx: RunManagerContext): Promise<SessionAutonomyState>;
/**
 * Persists the current session state from `ctx.sessionState` to disk.
 * Logs on error but does not throw.
 */
export declare function persistSessionState(ctx: RunManagerContext): Promise<void>;
/** Removes autonomy-session JSON files older than 14 days. Best-effort. */
export declare function pruneStaleAutonomySessions(ctx: RunManagerContext): Promise<void>;
/**
 * Generates a human-readable orchestration plan markdown file under
 * `<repoRoot>/.nexus-prime/orchestration_plan.md`.
 *
 * The `workerPlan` and `instructionPacket` parameters use `any` intentionally:
 * their shapes span the planner and catalog layers which are not yet extracted.
 */
export declare function generateOrchestrationPlan(ctx: RunManagerContext, task: string, intent: AutonomyIntent, workerPlan: any, instructionPacket: any): Promise<void>;
