export declare const PROPOSAL_VERSION = 1; export declare function sha256Hex(text: string): string; /** Exact full 64-character lowercase hex sha256 (no uppercase tolerance). */ export declare function isSha256Hex(value: unknown): value is string; export declare function isRecordValue(value: unknown): value is Record; export declare function isSafeIntegerAtLeast(value: unknown, minimum: number): value is number; export declare function isIsoTimestamp(value: unknown): value is string; export interface GoalCompletionProposalInput { readonly goalId: string; readonly goalRevision: number; readonly todoGraphRevision: number; readonly requirementsChecked: readonly string[]; readonly evidenceRefs: readonly string[]; readonly validationCommands: readonly string[]; readonly knownRisks: readonly string[]; readonly completionSummary: string; readonly noShip: boolean; /** Injected ISO timestamp (D-P2): the builder never reads the clock. */ readonly proposedAt: string; } export interface GoalCompletionProposal { readonly proposalVersion: 1; readonly proposalHash: string; readonly goalId: string; readonly goalRevision: number; readonly todoGraphRevision: number; readonly requirementsHash: string; readonly requirementsCount: number; readonly evidenceHash: string; readonly evidenceCount: number; readonly validationHash: string; readonly validationCount: number; readonly risksHash: string; readonly risksCount: number; readonly summaryHash: string; readonly noShip: boolean; readonly proposedAt: string; readonly bodyStored: false; } declare const validatedProposalBrand: unique symbol; /** * A proposal that passed validateGoalCompletionProposal. Obtainable only * from the validator (type-level brand); builders that need an exact, * recompute-verified proposal (the oracle decision) require this type and * re-verify at runtime against JS callers. */ export type ValidatedGoalCompletionProposal = GoalCompletionProposal & { readonly [validatedProposalBrand]: true; }; /** Ordered-array hashing: caller order and duplicates are preserved (D-P3). */ export declare function hashProposalArray(values: readonly string[]): string; /** Body-free proposal shape the canonical hash runs over. */ export type ProposalHashBody = Omit; export declare function goalCompletionProposalHash(proposal: ProposalHashBody): string; export type GoalCompletionProposalValidationCode = "not_a_record" | "missing_fields" | "unexpected_fields" | "invalid_proposal_version" | "invalid_goal_id" | "invalid_goal_revision" | "invalid_todo_graph_revision" | "invalid_hash" | "invalid_count" | "invalid_no_ship" | "invalid_proposed_at" | "invalid_body_stored" | "proposal_hash_mismatch"; export type GoalCompletionProposalValidation = { readonly valid: true; readonly proposal: ValidatedGoalCompletionProposal; } | { readonly valid: false; readonly code: GoalCompletionProposalValidationCode; readonly message: string; }; /** * Strict single-schema validator: exact 17-key record, proposalVersion 1, * bodyStored false, exact full sha256 fields, safe-integer revisions * (goalRevision >= 1, todoGraphRevision >= 0, counts >= 0), boolean noShip, * parseable ISO proposedAt, and a proposalHash recompute as the final gate * (D-P5). Returns a frozen canonical clone on success. */ export declare function validateGoalCompletionProposal(value: unknown): GoalCompletionProposalValidation; /** * Build a strict single-schema proposal. Gates (zob parity): non-empty * goalId, safe-integer revisions (goalRevision >= 1, todoGraphRevision >= 0), * and an injected parseable ISO proposedAt (D-P2 — no clock default). */ export declare function buildGoalCompletionProposal(input: GoalCompletionProposalInput): GoalCompletionProposal; export {};