/**
 * Git-worktree lifecycle helpers — ArtifactRecorder, WorktreeSession,
 * MergeMemoryAdapter, MultiTierConsensusPolicy.
 */
import type { MemoryBackend } from '../../engines/runtime-backends.js';
import type { SkillBinding } from '../../engines/skill-runtime.js';
import { type WorktreeHealthSnapshot } from '../../engines/worktree-health.js';
import type { MergeDecision } from '../index.js';
import type { RuntimeWorkerResult, WorkerRole } from '../runtime.js';
import { type CommandRecord } from './worker.js';
export interface BindingApplicationResult {
    modifiedFiles: string[];
    commandRecords: CommandRecord[];
}
/**
 * Lightweight per-run artifact writer. Maintains a flat index of paths
 * written so callers can recover the full run artifact layout.
 */
export declare class ArtifactRecorder {
    readonly runId: string;
    readonly runDir: string;
    readonly index: Record<string, string>;
    constructor(runId: string, baseDir?: string);
    workerDir(workerId: string): string;
    writeJson(relativePath: string, value: unknown): string;
    writeText(relativePath: string, value: string): string;
}
/**
 * Manages the lifecycle of a single git worktree for one worker.
 * Handles creation, command execution, file mutations, diff capture,
 * patch application, and cleanup.
 */
export declare class WorktreeSession {
    private repoRoot;
    private workerId;
    private role;
    private recorder;
    private reportHealth?;
    readonly worktreeDir: string;
    constructor(repoRoot: string, workerId: string, role: WorkerRole, recorder: ArtifactRecorder, reportHealth?: (snapshot: WorktreeHealthSnapshot) => void);
    create(): Promise<void>;
    run(command: string, allowFailure?: boolean, timeoutMs?: number): Promise<CommandRecord>;
    applyBindings(bindings: SkillBinding[], timeoutMs?: number): Promise<BindingApplicationResult>;
    captureDiff(): Promise<string>;
    applyPatchContent(diff: string): Promise<void>;
    cleanup(): Promise<void>;
    private resolve;
    private linkWorkspaceDependencies;
}
/** Thin adapter that wraps a MemoryBackend for use inside MergeOracle. */
export declare class MergeMemoryAdapter {
    private readonly backend;
    constructor(backend: MemoryBackend);
    store(content: string, priority: number, tags: string[]): Promise<string>;
}
/**
 * Two-level Byzantine consensus: run-level (per-execution) and global
 * (cross-execution promotion). Uses MergeOracle for the final merge decision.
 */
export declare class MultiTierConsensusPolicy {
    readonly descriptor: {
        kind: string;
        mode: "default";
    };
    private localOracle;
    private runConsensus;
    private globalConsensus;
    constructor(memory: MemoryBackend);
    registerAgents(agentIds: string[]): void;
    merge(results: RuntimeWorkerResult[]): Promise<MergeDecision>;
    approveRunLevelChange(agentIds: string[], delta?: number[]): boolean;
    approveGlobalPromotion(agentIds: string[], delta?: number[]): boolean;
    shadowStats(): Record<string, unknown>;
}
