import type { CompiledDeliveryContractV2, FinalReceiptV2, InitialTaskBaseV2, ProgressRecordV2, VerifierIdentityV2 } from "./long-task-delivery-types.js"; import type { AuthorityRevisionProposalV2 } from "./long-task-authority-revision-types.js"; export interface ActiveLongTaskAuthorityV3 { schema_version: "active-long-task-authority-v3"; task_id: string; repository_root: string; worktree_identity: string; workdir: string; active_authority_identity: string; authority_revision: number; initial_task_base: InitialTaskBaseV2; verifier_identity: VerifierIdentityV2; activated_at: string; authority_snapshot: CompiledDeliveryContractV2; authority_snapshot_sha256: string; } export type CompiledCacheStatusV3 = "compiled_cache_matching" | "compiled_cache_missing_repairable" | "compiled_cache_mismatched_ignored"; export interface ActiveAuthorityLoadResultV3 { authority: ActiveLongTaskAuthorityV3 | null; source: "none" | "active_authority_v3"; migrated: boolean; } export type ActiveAuthorityLockOperation = "commit" | "clear" | "abandon" | "migrate"; export interface ActiveAuthorityIdentityExpectation { task_id: string; authority_revision: number; compiled_identity: string; worktree_identity?: string; } export interface ClearActiveBindingCasOptions extends ActiveAuthorityIdentityExpectation { repository_root: string; workdir: string; } export interface StagedCompiledDeliveryContractV2 { publish(): Promise; discard(): Promise; } export interface PendingAuthorityRevisionV2 extends AuthorityRevisionProposalV2 { schema_version: "long-task-authority-revision-pending-v2"; created_at: string; } export declare function runtimePath(workdir: string, file?: string): string; export declare function worktreeIdentity(repositoryRoot: string): string; export declare function activeRecordPath(repositoryRoot: string): Promise; export declare function activeAuthorityLockPath(repositoryRoot: string): Promise; export declare function activeAuthorityLockExists(repositoryRoot: string): Promise; export declare function withActiveAuthorityLock(repositoryRoot: string, operation: ActiveAuthorityLockOperation, action: () => Promise): Promise; export declare function writeCompiledDeliveryContract(compiled: CompiledDeliveryContractV2): Promise; export declare function stageCompiledDeliveryContract(compiled: CompiledDeliveryContractV2): Promise; export declare function readCompiledDeliveryContract(workdir: string): Promise; export declare function loadActiveLongTaskAuthority(repositoryRoot: string, _options?: { migrate_legacy?: boolean; }): Promise; export declare function loadActiveCompiledAuthority(repositoryRoot: string, workdir?: string, options?: { migrate_legacy?: boolean; }): Promise; export declare function readActiveLongTaskBinding(repositoryRoot: string): Promise; export declare function inspectCompiledCache(authority: ActiveLongTaskAuthorityV3): Promise; export declare function commitActiveAuthority(options: { candidate: CompiledDeliveryContractV2; expected_previous_identity: string | null; }): Promise; export declare function activateDeliveryContract(compiled: CompiledDeliveryContractV2): Promise; export declare function assertMatchingActiveBinding(compiled: CompiledDeliveryContractV2): Promise; export declare function writeProgressRecord(workdir: string, record: ProgressRecordV2): Promise; export declare function readProgressRecords(workdir: string): Promise>; export declare function writePendingAuthorityRevision(workdir: string, pending: PendingAuthorityRevisionV2): Promise; export declare function readPendingAuthorityRevision(workdir: string): Promise; export declare function approvePendingAuthorityRevision(workdir: string, revision: string): Promise; export declare function authorityRevisionApproved(workdir: string, revision: string): Promise; export declare function clearAuthorityRevision(workdir: string): Promise; export declare function invalidateDerivedProgress(workdir: string): Promise; export declare function writeFinalReceipt(repositoryRoot: string, workdir: string, unsigned: Omit): Promise; export declare function readFinalReceipt(_repositoryRoot: string, workdir: string): Promise; export declare function activeAuthorityIdentityMatches(authority: ActiveLongTaskAuthorityV3, expected: ActiveAuthorityIdentityExpectation): boolean; export declare function clearActiveBindingCas(options: ClearActiveBindingCasOptions): Promise; export declare function abandonLongTaskState(repositoryRoot: string, workdir: string): Promise; export declare function forceClearCorruptActiveState(repositoryRoot: string, workdir: string): Promise; export declare function clearFinalReceipt(repositoryRoot: string, workdir: string): Promise;