import type { RecoveryFsRoot } from "@gajae-code/natives"; import type { RecoveryHydrationContext, ResumeSessionIdentity, SessionDestinationInput, SessionManager, SessionManagerCheckpointRevisionStrings, StrictSessionOpenFailure } from "./session-manager"; export interface MemoryGuardTranscriptDescriptorV1 { bytes: string; relative_path: string; sha256: string; } export interface MemoryGuardCheckpointBlobAuthorityV1 { kind: "checkpoint_blob_tree_v1"; manifest_relative_path: string; manifest_sha256: string; root_relative_path: string; } export interface MemoryGuardCheckpointBlobManifestEntryV1 { bytes: string; relative_path: string; sha256: string; } export interface MemoryGuardCheckpointBlobManifestV1 { entries: MemoryGuardCheckpointBlobManifestEntryV1[]; schema_version: 1; } export interface MemoryGuardSessionManagerCheckpointV1 { blob_authority: MemoryGuardCheckpointBlobAuthorityV1; revisions: SessionManagerCheckpointRevisionStrings; schema_version: 1; session_id: string; session_name: string | null; transcript: MemoryGuardTranscriptDescriptorV1; } export interface MemoryGuardParticipantDescriptorV1 { ordinal: number; checkpoint: MemoryGuardCheckpointBlobAuthorityV1; revisions: SessionManagerCheckpointRevisionStrings; session_id: string; session_name: string | null; transcript: MemoryGuardTranscriptDescriptorV1; } export interface MemoryGuardParticipantIngressLease { readonly token: symbol; release(): void; } export interface MemoryGuardCreateCheckpointInput { ingressLease: MemoryGuardParticipantIngressLease; checkpointRoot: string; } export type MemoryGuardRestoreBlockedReason = StrictSessionOpenFailure["reason"] | "checkpoint-mismatch" | "participant-mismatch" | "transcript-mismatch" | "blob-manifest-mismatch" | "blob-missing" | "blob-hash-mismatch" | "blob-authority-mismatch" | "destination-unavailable"; export interface MemoryGuardRestoreInput { incidentAuthority: RecoveryFsRoot; participant: MemoryGuardParticipantDescriptorV1; checkpoint: MemoryGuardSessionManagerCheckpointV1; destination: SessionDestinationInput; } export type MemoryGuardRestoreResult = { kind: "staged"; manager: SessionManager; hydrationContext: RecoveryHydrationContext; transcriptIdentity: ResumeSessionIdentity; cleanup: () => Promise; } | { kind: "blocked"; reason: MemoryGuardRestoreBlockedReason; }; export declare function memoryGuardCanonicalJson(value: unknown): string; export declare function memoryGuardSha256Hex(value: Uint8Array | string): string; export declare function isMemoryGuardDecimalString(value: unknown): value is string; export declare function isMemoryGuardSha256Hex(value: unknown): value is string; export declare function isMemoryGuardRelativePath(value: unknown): value is string; export declare function hasOnlyKeys(value: Record, allowed: readonly string[]): boolean;