import { type MemoryReflection, type ObservationEntryData, type ObservationRecord, type ReflectionRecord } from "./types.js"; export type Entry = { type: string; id: string; timestamp?: string; message?: unknown; content?: unknown; customType?: string; summary?: unknown; fromId?: string; data?: unknown; details?: unknown; firstKeptEntryId?: string; }; export declare function isSourceEntry(entry: Entry): boolean; export type RecallObservationMatch = { status: "ok"; observation: ObservationRecord; observationEntryId: string; sourceEntryIds: string[]; sourceEntries: Entry[]; } | { status: "no_source"; observation: ObservationRecord; observationEntryId: string; } | { status: "source_unavailable"; observation: ObservationRecord; observationEntryId: string; sourceEntryIds: string[]; missingSourceEntryIds: string[]; nonSourceEntryIds: string[]; }; export type RecallObservationSourcesResult = { status: "not_found"; observationId: string; matches: []; collision: false; } | { status: "found"; observationId: string; matches: RecallObservationMatch[]; collision: boolean; }; export type RecallMemoryObservation = { status: "ok"; observation: ObservationRecord; observationEntryId: string; observationRecordIndex: number; sourceEntryIds: string[]; sourceEntries: Entry[]; } | { status: "no_source"; observation: ObservationRecord; observationEntryId: string; observationRecordIndex: number; } | { status: "source_unavailable"; observation: ObservationRecord; observationEntryId: string; observationRecordIndex: number; sourceEntryIds: string[]; sourceEntries: Entry[]; missingSourceEntryIds: string[]; nonSourceEntryIds: string[]; }; export type RecallMemoryReflectionMatch = { reflection: ReflectionRecord; reflectionIndex: number; }; export type RecallUnavailableSupportingObservation = { reflection: ReflectionRecord; reflectionIndex: number; observationId: string; }; export type RecallUnavailableReflectionProvenance = { reflection: ReflectionRecord; reflectionIndex: number; reason: "legacy"; }; export type RecallMemorySourcesResult = { status: "not_found"; memoryId: string; reflectionMatches: []; directObservationMatches: []; observations: []; sourceEntries: []; unavailableSupportingObservations: []; unavailableReflectionProvenance: []; missingSourceEntryIds: []; nonSourceEntryIds: []; collision: false; partial: false; } | { status: "found"; memoryId: string; reflectionMatches: RecallMemoryReflectionMatch[]; directObservationMatches: RecallMemoryObservation[]; observations: RecallMemoryObservation[]; sourceEntries: Entry[]; unavailableSupportingObservations: RecallUnavailableSupportingObservation[]; unavailableReflectionProvenance: RecallUnavailableReflectionProvenance[]; missingSourceEntryIds: string[]; nonSourceEntryIds: string[]; collision: boolean; partial: boolean; }; export declare function findLastCompactionIndex(entries: Entry[]): number; export declare function lastObservationCoverEndIdx(entries: Entry[]): number; export declare function rawTokensSinceLastBound(entries: Entry[]): number; export declare function rawTokensSinceLastCompaction(entries: Entry[]): number; export declare function firstRawIdAfter(entries: Entry[], afterIndex: number): string | undefined; export declare function gapRawEntries(entries: Entry[], newFirstKeptEntryId: string): Entry[]; export declare function rawTailEntriesBetween(entries: Entry[], fromId: string, untilId: string): Entry[]; export declare function recallObservationSources(entries: Entry[], observationId: string): RecallObservationSourcesResult; export declare function recallMemorySources(entries: Entry[], memoryId: string): RecallMemorySourcesResult; export declare function collectObservationsByCoverage(entries: Entry[], priorFirstKeptEntryId: string | undefined, newFirstKeptEntryId: string): ObservationEntryData[]; export interface MemoryState { reflections: MemoryReflection[]; committedObs: ObservationRecord[]; pendingObs: ObservationRecord[]; } export declare function getMemoryState(entries: Entry[]): MemoryState; /** * Build a synthetic branch entry array that is sufficient for * `recallMemorySources` to recover the same memory id outside of its original * session/branch. * * This is the cross-session recall archive unit: it contains only the source * entries referenced by the requested observation/reflection, the observation * entries needed to resolve direct and supporting observations, and (for * reflections) a restored-memory snapshot entry carrying the reflection * provenance. It is deliberately keyed by memory id so it can be persisted in * the project-scoped store without dragging the whole branch along. */ export declare function buildRecallSourceArchiveEntries(entries: Entry[], memoryState: Pick, memoryId: string): Entry[] | undefined; //# sourceMappingURL=branch.d.ts.map