import { z } from "zod"; import { type AttributionSummary, type AttributionConfidence, type CausalEvent, type CausalFootprint, type Evidence, type LocalHistoryContinuityOperation, type SourceLayer } from "../contracts/causal-ontology.js"; import type { JsonCodec } from "../ports/codec.js"; import type { FileSystem } from "../ports/filesystem.js"; import type { RepoObservation } from "./repo-state.js"; import { type PersistedLocalHistoryGraphContext } from "./persisted-local-history-graph.js"; import { type RepoConcurrencySummary } from "./repo-concurrency.js"; import type { GitTransitionHookEvent } from "./runtime-workspace-overlay.js"; import type { RuntimeCausalContext } from "./runtime-causal-context.js"; import type { RuntimeStagedTargetFullFile } from "./runtime-staged-target.js"; import type { WorkspaceStatus } from "./workspace-router.js"; declare const continuityRecordSchema: z.ZodObject<{ recordId: z.ZodString; continuityKey: z.ZodString; operation: z.ZodEnum<{ start: "start"; attach: "attach"; resume: "resume"; fork: "fork"; park: "park"; }>; repoId: z.ZodString; worktreeId: z.ZodString; transportSessionId: z.ZodString; workspaceSliceId: z.ZodString; causalSessionId: z.ZodString; strandId: z.ZodString; checkoutEpochId: z.ZodString; workspaceOverlayId: z.ZodNullable; occurredAt: z.ZodString; continuedFromRecordId: z.ZodNullable; continuedFromCausalSessionId: z.ZodNullable; continuedFromStrandId: z.ZodNullable; continuityConfidence: z.ZodEnum<{ unknown: "unknown"; high: "high"; medium: "medium"; low: "low"; }>; continuityEvidence: z.ZodArray; source: z.ZodString; capturedAt: z.ZodString; strength: z.ZodEnum<{ direct: "direct"; strong: "strong"; weak: "weak"; conflicted: "conflicted"; }>; details: z.ZodRecord; }, z.core.$strict>>; attribution: z.ZodObject<{ actor: z.ZodObject<{ actorId: z.ZodString; actorKind: z.ZodEnum<{ git: "git"; daemon: "daemon"; human: "human"; agent: "agent"; unknown: "unknown"; }>; displayName: z.ZodOptional; source: z.ZodString; authorityScope: z.ZodEnum<{ authoritative: "authoritative"; declared: "declared"; inferred: "inferred"; mixed: "mixed"; }>; }, z.core.$strict>; confidence: z.ZodEnum<{ unknown: "unknown"; high: "high"; medium: "medium"; low: "low"; }>; basis: z.ZodEnum<{ explicit_declaration: "explicit_declaration"; git_transition: "git_transition"; transport_session: "transport_session"; session_continuity: "session_continuity"; environment_inference: "environment_inference"; unknown_fallback: "unknown_fallback"; conflicting_signals: "conflicting_signals"; }>; evidence: z.ZodArray; source: z.ZodString; capturedAt: z.ZodString; strength: z.ZodEnum<{ direct: "direct"; strong: "strong"; weak: "weak"; conflicted: "conflicted"; }>; details: z.ZodRecord; }, z.core.$strict>>; }, z.core.$strict>; }, z.core.$strict>; export type ContinuityRecord = z.infer; declare const continuityStateSchema: z.ZodObject<{ continuityKey: z.ZodString; repoId: z.ZodString; worktreeId: z.ZodString; activeRecordId: z.ZodNullable; records: z.ZodArray; repoId: z.ZodString; worktreeId: z.ZodString; transportSessionId: z.ZodString; workspaceSliceId: z.ZodString; causalSessionId: z.ZodString; strandId: z.ZodString; checkoutEpochId: z.ZodString; workspaceOverlayId: z.ZodNullable; occurredAt: z.ZodString; continuedFromRecordId: z.ZodNullable; continuedFromCausalSessionId: z.ZodNullable; continuedFromStrandId: z.ZodNullable; continuityConfidence: z.ZodEnum<{ unknown: "unknown"; high: "high"; medium: "medium"; low: "low"; }>; continuityEvidence: z.ZodArray; source: z.ZodString; capturedAt: z.ZodString; strength: z.ZodEnum<{ direct: "direct"; strong: "strong"; weak: "weak"; conflicted: "conflicted"; }>; details: z.ZodRecord; }, z.core.$strict>>; attribution: z.ZodObject<{ actor: z.ZodObject<{ actorId: z.ZodString; actorKind: z.ZodEnum<{ git: "git"; daemon: "daemon"; human: "human"; agent: "agent"; unknown: "unknown"; }>; displayName: z.ZodOptional; source: z.ZodString; authorityScope: z.ZodEnum<{ authoritative: "authoritative"; declared: "declared"; inferred: "inferred"; mixed: "mixed"; }>; }, z.core.$strict>; confidence: z.ZodEnum<{ unknown: "unknown"; high: "high"; medium: "medium"; low: "low"; }>; basis: z.ZodEnum<{ explicit_declaration: "explicit_declaration"; git_transition: "git_transition"; transport_session: "transport_session"; session_continuity: "session_continuity"; environment_inference: "environment_inference"; unknown_fallback: "unknown_fallback"; conflicting_signals: "conflicting_signals"; }>; evidence: z.ZodArray; source: z.ZodString; capturedAt: z.ZodString; strength: z.ZodEnum<{ direct: "direct"; strong: "strong"; weak: "weak"; conflicted: "conflicted"; }>; details: z.ZodRecord; }, z.core.$strict>>; }, z.core.$strict>; }, z.core.$strict>>; readEvents: z.ZodArray; checkoutEpochId: z.ZodNullable; workspaceOverlayId: z.ZodNullable; transportSessionId: z.ZodNullable; workspaceSliceId: z.ZodNullable; causalSessionId: z.ZodNullable; strandId: z.ZodNullable; actorId: z.ZodNullable; confidence: z.ZodEnum<{ unknown: "unknown"; high: "high"; medium: "medium"; low: "low"; }>; evidenceIds: z.ZodArray; attribution: z.ZodObject<{ actor: z.ZodObject<{ actorId: z.ZodString; actorKind: z.ZodEnum<{ git: "git"; daemon: "daemon"; human: "human"; agent: "agent"; unknown: "unknown"; }>; displayName: z.ZodOptional; source: z.ZodString; authorityScope: z.ZodEnum<{ authoritative: "authoritative"; declared: "declared"; inferred: "inferred"; mixed: "mixed"; }>; }, z.core.$strict>; confidence: z.ZodEnum<{ unknown: "unknown"; high: "high"; medium: "medium"; low: "low"; }>; basis: z.ZodEnum<{ explicit_declaration: "explicit_declaration"; git_transition: "git_transition"; transport_session: "transport_session"; session_continuity: "session_continuity"; environment_inference: "environment_inference"; unknown_fallback: "unknown_fallback"; conflicting_signals: "conflicting_signals"; }>; evidence: z.ZodArray; source: z.ZodString; capturedAt: z.ZodString; strength: z.ZodEnum<{ direct: "direct"; strong: "strong"; weak: "weak"; conflicted: "conflicted"; }>; details: z.ZodRecord; }, z.core.$strict>>; }, z.core.$strict>; footprint: z.ZodObject<{ paths: z.ZodArray; symbols: z.ZodArray; regions: z.ZodArray; endColumn: z.ZodOptional; }, z.core.$strict>>; }, z.core.$strict>; occurredAt: z.ZodString; eventKind: z.ZodLiteral<"read">; payload: z.ZodObject<{ surface: z.ZodString; projection: z.ZodString; sourceLayer: z.ZodEnum<{ canonical_structural_truth: "canonical_structural_truth"; workspace_overlay: "workspace_overlay"; strand_local_speculation: "strand_local_speculation"; }>; reason: z.ZodString; }, z.core.$strict>; }, z.core.$strict>>; stageEvents: z.ZodArray; checkoutEpochId: z.ZodNullable; workspaceOverlayId: z.ZodNullable; transportSessionId: z.ZodNullable; workspaceSliceId: z.ZodNullable; causalSessionId: z.ZodNullable; strandId: z.ZodNullable; actorId: z.ZodNullable; confidence: z.ZodEnum<{ unknown: "unknown"; high: "high"; medium: "medium"; low: "low"; }>; evidenceIds: z.ZodArray; attribution: z.ZodObject<{ actor: z.ZodObject<{ actorId: z.ZodString; actorKind: z.ZodEnum<{ git: "git"; daemon: "daemon"; human: "human"; agent: "agent"; unknown: "unknown"; }>; displayName: z.ZodOptional; source: z.ZodString; authorityScope: z.ZodEnum<{ authoritative: "authoritative"; declared: "declared"; inferred: "inferred"; mixed: "mixed"; }>; }, z.core.$strict>; confidence: z.ZodEnum<{ unknown: "unknown"; high: "high"; medium: "medium"; low: "low"; }>; basis: z.ZodEnum<{ explicit_declaration: "explicit_declaration"; git_transition: "git_transition"; transport_session: "transport_session"; session_continuity: "session_continuity"; environment_inference: "environment_inference"; unknown_fallback: "unknown_fallback"; conflicting_signals: "conflicting_signals"; }>; evidence: z.ZodArray; source: z.ZodString; capturedAt: z.ZodString; strength: z.ZodEnum<{ direct: "direct"; strong: "strong"; weak: "weak"; conflicted: "conflicted"; }>; details: z.ZodRecord; }, z.core.$strict>>; }, z.core.$strict>; footprint: z.ZodObject<{ paths: z.ZodArray; symbols: z.ZodArray; regions: z.ZodArray; endColumn: z.ZodOptional; }, z.core.$strict>>; }, z.core.$strict>; occurredAt: z.ZodString; eventKind: z.ZodLiteral<"stage">; payload: z.ZodObject<{ targetId: z.ZodString; footprint: z.ZodObject<{ paths: z.ZodArray; symbols: z.ZodArray; regions: z.ZodArray; endColumn: z.ZodOptional; }, z.core.$strict>>; }, z.core.$strict>; selectionKind: z.ZodEnum<{ full_file: "full_file"; partial_file: "partial_file"; symbol_subset: "symbol_subset"; }>; }, z.core.$strict>; }, z.core.$strict>>; transitionEvents: z.ZodArray; checkoutEpochId: z.ZodNullable; workspaceOverlayId: z.ZodNullable; transportSessionId: z.ZodNullable; workspaceSliceId: z.ZodNullable; causalSessionId: z.ZodNullable; strandId: z.ZodNullable; actorId: z.ZodNullable; confidence: z.ZodEnum<{ unknown: "unknown"; high: "high"; medium: "medium"; low: "low"; }>; evidenceIds: z.ZodArray; attribution: z.ZodObject<{ actor: z.ZodObject<{ actorId: z.ZodString; actorKind: z.ZodEnum<{ git: "git"; daemon: "daemon"; human: "human"; agent: "agent"; unknown: "unknown"; }>; displayName: z.ZodOptional; source: z.ZodString; authorityScope: z.ZodEnum<{ authoritative: "authoritative"; declared: "declared"; inferred: "inferred"; mixed: "mixed"; }>; }, z.core.$strict>; confidence: z.ZodEnum<{ unknown: "unknown"; high: "high"; medium: "medium"; low: "low"; }>; basis: z.ZodEnum<{ explicit_declaration: "explicit_declaration"; git_transition: "git_transition"; transport_session: "transport_session"; session_continuity: "session_continuity"; environment_inference: "environment_inference"; unknown_fallback: "unknown_fallback"; conflicting_signals: "conflicting_signals"; }>; evidence: z.ZodArray; source: z.ZodString; capturedAt: z.ZodString; strength: z.ZodEnum<{ direct: "direct"; strong: "strong"; weak: "weak"; conflicted: "conflicted"; }>; details: z.ZodRecord; }, z.core.$strict>>; }, z.core.$strict>; footprint: z.ZodObject<{ paths: z.ZodArray; symbols: z.ZodArray; regions: z.ZodArray; endColumn: z.ZodOptional; }, z.core.$strict>>; }, z.core.$strict>; occurredAt: z.ZodString; eventKind: z.ZodLiteral<"transition">; payload: z.ZodObject<{ semanticKind: z.ZodEnum<{ unknown: "unknown"; index_update: "index_update"; conflict_resolution: "conflict_resolution"; merge_phase: "merge_phase"; rebase_phase: "rebase_phase"; bulk_transition: "bulk_transition"; }>; authority: z.ZodEnum<{ authoritative_git_state: "authoritative_git_state"; repo_snapshot: "repo_snapshot"; }>; phase: z.ZodNullable>; summary: z.ZodString; transitionKind: z.ZodNullable>; fromRef: z.ZodNullable; toRef: z.ZodNullable; createdCheckoutEpochId: z.ZodNullable; }, z.core.$strict>; }, z.core.$strict>>; }, z.core.$strict>; export type ContinuityState = z.infer; export interface PersistedLocalHistoryContext { readonly repoId: string; readonly worktreeId: string; readonly transportSessionId: string; readonly workspaceSliceId: string; readonly causalSessionId: string; readonly strandId: string; readonly checkoutEpochId: string; readonly workspaceOverlayId: string | null; readonly observedAt: string; readonly warpWriterId: string; readonly transitionKind: RepoObservation["lastTransition"] extends infer T ? T extends { kind: infer K; } | null ? K | null : null : null; readonly transitionReflogSubject: string | null; readonly hookTransitionName: GitTransitionHookEvent["hookName"] | null; readonly hookTransitionArgs: readonly string[] | null; readonly hookTransitionObservedAt: string | null; } export interface PersistedLocalHistoryAttachDeclaration { readonly actorKind: "human" | "agent"; readonly actorId?: string | undefined; readonly fromActorId?: string | undefined; readonly note?: string | undefined; } export interface PersistedLocalHistorySharedAttachSource { readonly sourceSessionId: string; readonly causalSessionId: string; readonly strandId: string; } export interface PersistedLocalHistorySummaryNone { readonly availability: "none"; readonly persistence: "persisted_local_history"; readonly historyPath: null; readonly totalContinuityRecords: 0; readonly active: false; readonly lastOperation: null; readonly lastObservedAt: null; readonly continuityKey: null; readonly causalSessionId: null; readonly strandId: null; readonly checkoutEpochId: null; readonly continuedFromCausalSessionId: null; readonly continuityConfidence: AttributionConfidence; readonly continuityEvidence: readonly Evidence[]; readonly attribution: AttributionSummary; readonly latestReadEvent: null; readonly latestStageEvent: null; readonly latestTransitionEvent: null; readonly preserves: readonly string[]; readonly excludes: readonly string[]; readonly nextAction: "bind_workspace_to_begin_local_history"; } export interface PersistedLocalHistorySummaryPresent { readonly availability: "present"; readonly persistence: "persisted_local_history"; readonly historyPath: string | null; readonly totalContinuityRecords: number; readonly active: boolean; readonly lastOperation: LocalHistoryContinuityOperation; readonly lastObservedAt: string; readonly continuityKey: string; readonly causalSessionId: string; readonly strandId: string; readonly checkoutEpochId: string; readonly continuedFromCausalSessionId: string | null; readonly continuityConfidence: AttributionConfidence; readonly continuityEvidence: readonly Evidence[]; readonly attribution: AttributionSummary; readonly latestReadEvent: Extract | null; readonly latestStageEvent: Extract | null; readonly latestTransitionEvent: Extract | null; readonly preserves: readonly string[]; readonly excludes: readonly string[]; readonly nextAction: "continue_active_causal_workspace" | "review_transition_boundary_before_continuing" | "inspect_or_resume_local_history"; } export type PersistedLocalHistorySummary = PersistedLocalHistorySummaryNone | PersistedLocalHistorySummaryPresent; export interface PersistedLocalActivityContinuityItem { readonly itemKind: "continuity"; readonly recordId: string; readonly operation: LocalHistoryContinuityOperation; readonly occurredAt: string; readonly causalSessionId: string; readonly strandId: string; readonly attribution: AttributionSummary; readonly continuedFromCausalSessionId: string | null; readonly continuedFromStrandId: string | null; } export type PersistedLocalActivityItem = PersistedLocalActivityContinuityItem | Extract; export interface PersistedLocalActivityWindow { readonly historyPath: string | null; readonly limit: number; readonly totalMatchingItems: number; readonly truncated: boolean; readonly items: readonly PersistedLocalActivityItem[]; } export type { RepoConcurrencySummary } from "./repo-concurrency.js"; export declare class PersistedLocalHistoryAttachUnavailableError extends Error { readonly code = "NO_ATTACHABLE_HISTORY"; constructor(message?: string); } export declare function buildContinuityKey(repoId: string, worktreeId: string): string; export interface PersistedLocalHistoryMigrationResult { graftDir: string; discoveredArtifacts: number; migratedArtifacts: number; malformedArtifacts: number; importedContinuityRecords: number; importedReadEvents: number; importedStageEvents: number; importedTransitionEvents: number; skippedContinuityRecords: number; skippedReadEvents: number; skippedStageEvents: number; skippedTransitionEvents: number; } export declare function migrateLegacyPersistedLocalHistoryToGraph(input: { readonly fs: FileSystem; readonly codec: JsonCodec; readonly graftDir: string; readonly graph: PersistedLocalHistoryGraphContext; }): Promise; export declare class PersistedLocalHistoryStore { private readonly deps; constructor(deps: { readonly fs: FileSystem; readonly codec: JsonCodec; readonly graftDir: string; }); noteBinding(input: { readonly current: PersistedLocalHistoryContext; readonly previous?: PersistedLocalHistoryContext | null; readonly currentGraph?: PersistedLocalHistoryGraphContext | null; readonly previousGraph?: PersistedLocalHistoryGraphContext | null; }): Promise; noteCheckoutBoundary(input: { readonly previous: PersistedLocalHistoryContext; readonly current: PersistedLocalHistoryContext; readonly graph?: PersistedLocalHistoryGraphContext | null; }): Promise; summarize(status: WorkspaceStatus, causalContext: RuntimeCausalContext, graph?: PersistedLocalHistoryGraphContext | null): Promise; summarizeRepoConcurrency(status: WorkspaceStatus, graph?: PersistedLocalHistoryGraphContext | null): Promise; listRecentActivity(status: WorkspaceStatus, causalContext: RuntimeCausalContext, limit: number, graph?: PersistedLocalHistoryGraphContext | null): Promise; declareAttach(input: { readonly current: PersistedLocalHistoryContext; readonly declaration: PersistedLocalHistoryAttachDeclaration; readonly graph?: PersistedLocalHistoryGraphContext | null; }): Promise; declareSharedAttach(input: { readonly current: PersistedLocalHistoryContext; readonly declaration: PersistedLocalHistoryAttachDeclaration; readonly source: PersistedLocalHistorySharedAttachSource; readonly graph?: PersistedLocalHistoryGraphContext | null; }): Promise; noteStageObservation(input: { readonly current: PersistedLocalHistoryContext; readonly stagedTarget: RuntimeStagedTargetFullFile; readonly attribution: AttributionSummary; readonly graph?: PersistedLocalHistoryGraphContext | null; }): Promise; noteReadObservation(input: { readonly current: PersistedLocalHistoryContext; readonly attribution: AttributionSummary; readonly surface: string; readonly projection: string; readonly sourceLayer: SourceLayer; readonly reason: string; readonly footprint: CausalFootprint; readonly graph?: PersistedLocalHistoryGraphContext | null; }): Promise; noteSemanticTransitionObservation(input: { readonly current: PersistedLocalHistoryContext; readonly semanticTransition: NonNullable; readonly transition: RepoObservation["lastTransition"]; readonly attribution: AttributionSummary; readonly graph?: PersistedLocalHistoryGraphContext | null; }): Promise; buildContext(status: WorkspaceStatus, causalContext: RuntimeCausalContext, repoState: RepoObservation, hookEvent?: GitTransitionHookEvent | null): PersistedLocalHistoryContext | null; private loadWritableState; } //# sourceMappingURL=persisted-local-history.d.ts.map