/**
 * Kernel Execution — service.
 *
 * Concrete, worktree-backed implementation of the step / verify / merge
 * path. Every mutation lives in an isolated `git worktree`; verify hashes
 * the changed set; merge fast-forwards the target branch only when the
 * hashes still match. All three operations append one row to the kernel
 * ledger.
 *
 * Deliberately not a framework:
 *   - no plugin bus
 *   - no DSL for mutations beyond write_file / append_file / delete_file / run_command
 *   - no attempt to replace phantom's SubAgentRuntime (that is PR 3)
 */
import type { KernelExecutionService } from './contracts.js';
import { type KernelLedger } from './ledger.js';
import type { RunMergeRequest, RunMergeResult, RunStepRequest, RunStepResult, RunVerifyRequest, RunVerifyResult, VerifyStatus } from './types.js';
import type { RuntimeBackend } from '../runtime/contracts.js';
import type { RuntimeExecuteInput, ExecutedStep } from '../runtime/types.js';
/**
 * A verifier that can be plugged in at service construction. Intentionally
 * minimal: a verifier sees the worktree path + the set of changed files,
 * and returns pass/fail. No hooks, no priorities, no async event stream.
 */
export interface KernelVerifier {
    id: string;
    run(input: {
        worktreePath: string;
        changedFiles: string[];
        stepId: string;
        runId: string;
    }): Promise<{
        status: VerifyStatus;
        output?: string;
    }>;
}
export interface KernelExecutionServiceOptions {
    /** Absolute path to the repo that owns the step branches. Required. */
    repoRoot: string;
    /** Pluggable ledger. Defaults to the process-wide JSONL ledger. */
    ledger?: KernelLedger;
    /** Root dir for kernel-owned worktrees. Defaults to <stateDir>/kernel-execution/worktrees. */
    worktreeRoot?: string;
    /** Registered verifiers, looked up by id. */
    verifiers?: KernelVerifier[];
    /**
     * Runtime backend for AI-driven execution (Phantom/SubAgentRuntime in PR 3).
     * Required when calling execute(); step/verify/merge use raw git and don't need it.
     */
    backend?: RuntimeBackend;
}
export declare class KernelExecutionServiceImpl implements KernelExecutionService {
    private readonly repoRoot;
    private readonly ledger;
    private readonly worktreeRoot;
    private readonly verifiers;
    private readonly backend;
    constructor(opts: KernelExecutionServiceOptions);
    step(input: RunStepRequest): Promise<RunStepResult>;
    verify(input: RunVerifyRequest): Promise<RunVerifyResult>;
    merge(input: RunMergeRequest): Promise<RunMergeResult>;
    /**
     * Execute a task via the configured RuntimeBackend (Phantom/SubAgentRuntime
     * in the default installation). Requires a backend to be set in options.
     * Records one ledger entry — same pattern as step/verify/merge.
     */
    execute(input: RuntimeExecuteInput): Promise<ExecutedStep>;
    private rejectMerge;
}
export declare function getKernelExecutionService(opts?: KernelExecutionServiceOptions): KernelExecutionServiceImpl;
export declare function configureKernelExecutionService(opts: KernelExecutionServiceOptions): KernelExecutionServiceImpl;
export declare function __resetKernelExecutionServiceForTests(): void;
/** Build a fresh, in-memory service against a temp ledger. Test-only sugar. */
export declare function createTestExecutionService(opts: {
    repoRoot: string;
    worktreeRoot: string;
    ledgerPath?: string;
    verifiers?: KernelVerifier[];
}): KernelExecutionServiceImpl;
