import type { CortexStore, MemoryItemFilter, ParsedMemoryItem } from '../db/store.js'; export declare const DEFAULT_PAGE_LIMIT = 20; /** * Hard ceiling on one page, applied by `listMemory` to every caller that goes * through it — which is every path that renders a page. This is the clause * that makes "never dumps the whole store" a property of the code rather than * a habit of its callers: a cap that lives inline in a CLI action is a cap * nobody can test across its boundary. * * It is not a ceiling on the *store* method. `listMemoryItemsFiltered` * deliberately treats an absent limit as unlimited (SQLite `LIMIT -1`) because * internal callers need that; the guarantee belongs to this layer, not below it. */ export declare const MAX_PAGE_LIMIT = 200; /** * Stated ordering criterion, printed with every page (AC #1). It names the * tiebreaker as well as the sort key, because the tiebreaker is what makes the * order *total* — a script author paging this output needs to know that. */ export declare const MEMORY_LIST_ORDER = "newest first (created_at DESC, rowid DESC)"; /** How many retrieval-log entries an inspection reports. */ export declare const ACCESS_HISTORY_LIMIT = 10; /** * Commander hands options through as raw strings, so `parseInt` failures * arrive here as `NaN` rather than as an error. Anything not a usable page * size — absent, non-finite, zero, negative — falls back to the default * instead of reaching SQLite, where a negative LIMIT means "no limit" and * would dump the store the cap exists to bound. */ export declare function resolvePageLimit(raw: number | undefined): number; /** * Offsets are clamped to a safe integer, not merely floored at zero. * better-sqlite3 refuses to bind a float beyond `Number.MAX_SAFE_INTEGER`, so * an offset like `9223372036854775807` — a plausible typo — otherwise reaches * the driver and surfaces as a raw `datatype mismatch` stack trace instead of * an empty page. */ export declare function resolvePageOffset(raw: number | undefined): number; export interface MemoryListOptions extends MemoryItemFilter { limit?: number; offset?: number; } export interface MemoryListPage { items: ParsedMemoryItem[]; /** Items matching the filter, independent of this page's size. */ total: number; limit: number; offset: number; order: string; filter: { scopeKeys: string[] | null; kinds: string[] | null; states: string[] | null; }; } /** * One page of stored memory items (FR-21). * * No state filter is applied by default, `archived` included — every other * query surface excludes it, but this one exists to answer "what does Cortex * actually hold", and a listing that quietly omits rows cannot. */ export declare function listMemory(store: CortexStore, options?: MemoryListOptions): MemoryListPage; export interface MemoryReferenceDetail { raw_reference: string; normalized_path: string; status: string; moved_to: string | null; } export interface MemoryConflictCounterpart { id: string; kind: string; subject: string | null; timestamp: string; } export interface MemoryConflictStatus { /** `notes.conflict`, the authoritative column. Null when not note-backed. */ conflict: boolean | null; /** `notes.status`, the authoritative column. Null when not note-backed. */ note_status: string | null; /** What every *other* surface reads: the projected memory text. */ projected_contested: boolean; projected_superseded: boolean; /** True when the column and the projection disagree about this item. */ diverged: boolean; counterparts: MemoryConflictCounterpart[]; alternatives: string[] | null; } export interface MemoryAccessRetrieval { topic: string; created_at: string; session_id: string | null; } export interface MemoryAccessHistory { /** Durable, and the figure to trust. */ access_count: number; last_accessed_at: string | null; /** * Recent retrievals. `cortex gc` prunes `retrieval_log` to its newest rows, * so this list is bounded and lossy in a way `access_count` is not. */ retrievals: MemoryAccessRetrieval[]; } export interface MemoryCorrectionEntry { operation: string; created_at: string; prior_text: string; new_text: string | null; } export interface MemoryInspection { item: ParsedMemoryItem; /** Verbatim and untruncated — every other surface snippets, this one must not. */ text: string; /** The same one-word trust summary retrieval prints (`describeValidity`). */ trust: string; references: MemoryReferenceDetail[]; conflict: MemoryConflictStatus; access: MemoryAccessHistory; /** * Prior versions recorded by `edit-memory` / `delete-memory` (FR-22). * Without this the audit trail is written and reachable only by hand-querying * SQLite — and `edit-memory` tells the user this command shows it. */ corrections: MemoryCorrectionEntry[]; } /** * Everything stored about one memory item (FR-21), by memory-item id or by * the id of the note behind it. Returns null when neither resolves. * * Reads only: no `touchMemoryItems`, because a tool for revealing what * ranking holds must not change that ranking by being used. Reference * validation does persist corrected `memory_references` statuses, exactly as * it does on the retrieval path — that is repair of derived data, not * reinforcement. */ export declare function inspectMemory(store: CortexStore, id: string): MemoryInspection | null; //# sourceMappingURL=inspect.d.ts.map