import { type AppendRunEntryInput, type RunKind, type RunLedgerMetrics, type RunLedgerStore, type RunLedgerWriteResult } from "../audit/run-ledger.js"; import { type ServiceManager } from "../schedule/service-plan.js"; import type { TicketQueueRecord } from "../tickets/store.js"; declare const RUN_TICKET_ADMISSION: unique symbol; export interface TicketAdmissionSnapshot { readonly ticket_id: string; readonly initial_version: number; readonly initial_attempt: number; readonly initial_state: Exclude; readonly source_ref_sha256: string; readonly content_sha256: string; readonly policy_version: number; readonly policy_digest: string; readonly gate_digest: string | null; } export interface RunStartIntent { readonly schema_version: 1; readonly intent_id: string; readonly operation_id: string; readonly start_nonce: string; readonly expected_run_id: string; readonly run_kind: RunKind; readonly manager: ServiceManager; readonly executable_path: string; readonly created_at: string; readonly policy_digest: string; readonly verification_gate_digest: string; readonly ticket_set_digest: string; readonly service_plan_digest: string; readonly service_plan_directory: string; readonly state_root: string; readonly workspace_root: string; readonly ticket_snapshot: readonly TicketAdmissionSnapshot[]; } export interface RunManifest { readonly schema_version: 1; readonly manifest_id: string; readonly run_id: string; readonly run_kind: RunKind; readonly start_intent_id: string; readonly created_at: string; readonly policy_digest: string; readonly verification_gate_digest: string; readonly ticket_set_digest: string; readonly service_plan_digest: string; readonly service_plan_directory: string; readonly state_root: string; readonly workspace_root: string; readonly selected_ticket_ids: readonly string[]; readonly ticket_snapshot: readonly TicketAdmissionSnapshot[]; readonly provider_started: false; readonly manual_conductor_start_required: true; readonly certifying: false; readonly release: "not_stable"; readonly merge_disposition: "human_hold"; } export type ConductorRouteAction = "human-start-required" | "await-native-hook" | "wait-resume" | "human-hold" | "queue-empty"; export interface ConductorRoute { readonly schema_version: 1; readonly decision_id: string; readonly operation_nonce: string; readonly run_id: string; readonly ticket_id: string | null; readonly ticket_version: number | null; readonly ticket_attempt: number | null; readonly ticket_state: Exclude | null; readonly policy_digest: string; readonly gate_digest: string | null; readonly action: ConductorRouteAction; readonly eligible_role_ids: readonly ("oms.ticket-executor" | "oms.goal-long-executor")[]; readonly evidence_paths: readonly string[]; readonly manual_start_required: boolean; readonly provider_started: false; readonly reason: string; } export interface RunControllerStatus { readonly manifest: RunManifest; readonly audit: RunLedgerMetrics; readonly ticket_counts: Readonly>; readonly provider_started: false; readonly certifying: false; readonly release: "not_stable"; readonly human_hold: true; readonly next_action: "none" | "run-tick" | "manual-conductor" | "await-native-hook" | "wait-resume" | "human-hold" | "observe"; } export interface RunTicketAdmissionGate { readonly [RUN_TICKET_ADMISSION]: true; readonly run_id: string; readonly ticket_id: string; readonly manifest_id: string; } export interface RunControllerRecoveryResult { readonly recovered: true; readonly lock_id: "run-controller"; readonly generation_id: string; readonly recovered_by: string; readonly previous_process_id: number; readonly recovery_evidence_path: string; } export declare function startAuditRun(options: { packageRoot: string; configRoot: string; stateRoot: string; workspaceRoot: string; executablePath: string; manager: ServiceManager; runKind: RunKind; }): Readonly<{ status: "created" | "replayed"; manifest: RunManifest; }>; export declare function conductorNext(options: { packageRoot: string; configRoot: string; stateRoot: string; runId: string; }): Readonly<{ status: "created" | "replayed"; decision: ConductorRoute; absolute_path: string; }>; export declare function tickAuditRun(options: { packageRoot: string; configRoot: string; stateRoot: string; runId: string; }): Readonly<{ status: RunControllerStatus; route: ConductorRoute | null; }>; export declare function closeTimedAuditRun(options: { packageRoot: string; configRoot: string; stateRoot: string; runId: string; }): RunControllerStatus; export declare function abortAuditRun(options: { packageRoot: string; configRoot: string; stateRoot: string; runId: string; reason: string; }): RunControllerStatus; export declare function recoverRunControllerAuthority(options: { packageRoot: string; stateRoot: string; expectedGenerationId: string; reason: string; }): RunControllerRecoveryResult; export declare function readRunStatus(options: { packageRoot: string; configRoot: string; stateRoot: string; runId: string; }): RunControllerStatus; export declare function listRunStatuses(options: { packageRoot: string; configRoot: string; stateRoot: string; }): readonly RunControllerStatus[]; export declare function assertRunTicketAdmission(options: { packageRoot: string; configRoot: string; stateRoot: string; runId: string; ticket: TicketQueueRecord; }): RunTicketAdmissionGate; export declare function findActiveRunTicketAdmission(options: { packageRoot: string; configRoot: string; stateRoot: string; ticket: TicketQueueRecord; }): RunTicketAdmissionGate | null; export declare function assertRunCurrentAuthority(manifest: RunManifest, packageRoot: string, configRoot: string): void; export declare function assertRunTicketAdmissionGate(value: unknown): asserts value is RunTicketAdmissionGate; /** * Appends one audit-only event while preserving process continuity across * short-lived CLI invocations. The head compare-and-swap keeps a restart * marker adjacent to the first event from its process. */ export declare function appendRunAuditEvent(ledger: RunLedgerStore, input: Omit & { readonly entryKind: Exclude; }): RunLedgerWriteResult; export declare function readRunManifest(packageRoot: string, stateRoot: string, runId: string): RunManifest; export declare function assertRunManifestLedgerBinding(ledger: RunLedgerStore, manifest: RunManifest): void; export declare function withRunControllerAuthority(stateRoot: string, operation: () => T): T; export {};