import { MeshStore, type MeshEvent, type MeshIdentity, type MeshStateEntry } from "../mesh/store.js"; export declare const STATE_TOPIC = "fabric.state"; export declare const CURRENT_KEY = "state/current"; export declare const GOAL_KEY = "state/goal"; export declare const COMPLEXITY_KEY_PREFIX = "state/complexity/"; export type StateTransitionKind = "state" | "representation"; type StateCertificationStatus = "pending" | "certified"; export interface StateTransitionInput { label: string; from?: string; to: string; summary: string; evidence?: string[]; tags?: string[]; kind?: StateTransitionKind; complexity?: { files: string[]; }; force?: boolean; } interface StateComplexityDelta { file: string; supported: boolean; language?: string; previous?: number; current?: number; delta?: number; baseline?: boolean; } interface StateTransitionComplexity { files: StateComplexityDelta[]; netDelta: number; } interface StateComplexityFile { file: string; supported: boolean; language?: string; current?: number; recorded?: number; delta?: number; recordedDelta?: number; } export interface StateComplexityResult { files: StateComplexityFile[]; netDelta: number; } export interface StateComplexitySummary { files: number; decisionPoints: number; lastNetDelta: number; } export interface StateTransitionRecord { transitionId: string; sequence: number; label: string; from?: string; to: string; summary: string; evidence?: string[]; tags?: string[]; kind: StateTransitionKind; complexity?: StateTransitionComplexity; certificationStatus?: StateCertificationStatus; certificate?: StateCertificate; ts: number; } interface StateHeadCommitProof { version: 1; status: "pending" | "committed"; } interface StateHeadValue { protocolVersion?: number; commitProof?: StateHeadCommitProof; transitionSequence?: number; label: string; from?: string; to: string; summary: string; evidence?: string[]; tags?: string[]; kind: StateTransitionKind; complexity?: StateTransitionComplexity; transitionId: string; certificationStatus?: StateCertificationStatus; certificate?: StateCertificate; ts: number; } export interface StateHead extends StateHeadValue { version: number; } export interface StateGoal { check: string; description?: string; } type VerifyStatus = "confirmed" | "violated" | "error"; interface VerifyResult { claim: string; claimDigest: string; claimOmittedBytes?: number; command: string; commandDigest: string; commandOmittedBytes?: number; status: VerifyStatus; exitCode: number | null; output: string; outputBytes: number; outputOmittedBytes: number; outputDigest: string; error?: string; errorDigest?: string; errorOmittedBytes?: number; } interface StateCertificationTarget { transitionId: string; label: string; to: string; } interface StateCertificationHead { transitionId: string; label: string; labelDigest?: string; labelOmittedBytes?: number; to: string; toDigest?: string; toOmittedBytes?: number; version: number; } export interface StateCertificate { certificateId: string; sequence: number; certificationStatus: "certified"; targets: StateCertificationTarget[]; head: StateCertificationHead | null; evidenceDigest: string; resultDigest: string; ts: number; current: boolean; } interface VerificationFailure { reason: "missing-target" | "missing-evidence" | "nonzero-exit" | "execution-error" | "reporting-error"; message: string; transitionId?: string; label?: string; command?: string; status?: VerifyStatus; exitCode?: number | null; error?: string; } export interface VerificationReport { results: VerifyResult[]; certified: boolean; violated: boolean; certificationStatus: "certified" | "failed"; evidenceDigest: string; resultDigest: string; failures: VerificationFailure[]; certificate?: StateCertificate; reportingError?: string; } export interface AdvanceHeadInput { payload: StateHeadValue; from: string | undefined; force: boolean; expectedVersion: number; identity: MeshIdentity; } export declare class StateStore { readonly store: MeshStore; constructor(store: MeshStore); toHead(entry: MeshStateEntry): StateHead; get(): { head: StateHead | null; goal: StateGoal | null; complexity: StateComplexitySummary; certification: { current: StateCertificate | null; recent: StateCertificate[]; }; }; getHead(): StateHead | null; transition(input: StateTransitionInput, identity: MeshIdentity, cwd?: string): Promise<{ event: MeshEvent; head: StateHead; }>; private markHeadCommitted; advanceHead(input: AdvanceHeadInput): Promise; private advanceHeadWithBefore; private rollbackWrites; private stateEvents; private lastDeletedVersion; history(input?: { label?: string; limit?: number; includeArchived?: boolean; }): { transitions: StateTransitionRecord[]; labels: string[]; certifications: StateCertificate[]; }; complexity(input: { files?: string[]; cwd: string; }): StateComplexityResult; private prepareComplexity; private complexityLedgers; private readComplexityLedger; private complexityKey; private normalizeComplexityFiles; goal(input: { check: string; description?: string; }, identity: MeshIdentity): Promise; checkGoal(input: { cwd: string; timeoutMs?: number; signal?: AbortSignal | undefined; identity: MeshIdentity; }): Promise<{ passed: boolean; output: string; exitCode: number | null; error?: string; }>; private persistCurrentCertificate; private revokeCurrentCertificate; verify(input: { labels?: string[]; includeArchived?: boolean; cwd: string; timeoutMs?: number; signal?: AbortSignal | undefined; identity: MeshIdentity; }): Promise; } export {}; //# sourceMappingURL=store.d.ts.map