import { type NotesIdentity } from "./identity.js"; import { type NoteMeta, type Origin } from "./frontmatter.js"; import { type Scope } from "./paths.js"; export type { NoteMeta, Origin, Scope }; export type NoteRow = { address: string; scope: Scope; path: string; meta: NoteMeta; body: string; sizeBytes: number; }; export type NoteMatch = { line: number; text: string; /** Code-point offset into the note body, not into the serialized file. */ offsetChars: number; }; export type NoteSearchRow = { address: string; scope: Scope; path: string; meta: NoteMeta; matches: NoteMatch[]; }; export type EditOperation = { oldText: string; newText: string; }; export type WriteOptions = { origin?: Origin; }; export type EditOptions = { origin?: Origin; crumpled?: boolean; replaceAll?: boolean; }; export type NotesQuery = ({ scope?: undefined; who?: never; } | { scope: "session" | "project" | "human"; who?: never; } | { scope: "agent" | "model"; who?: string; }) & { pattern?: string; wastebasket?: boolean; }; /** A read exposes metadata and the pure body; the serialized frontmatter is never part of the body. */ export type NoteReadResult = { meta: NoteMeta; body: string; resolvedScope: Scope; }; export type NoteWriteResult = { meta: NoteMeta; outcome: "created" | "overwrote" | "uncrumpled"; }; export type NoteChange = { kind: "none"; before: ""; after: ""; } | { kind: "body" | "metadata" | "file"; before: string; after: string; }; export type NoteEditResult = { meta: NoteMeta; applied: number; resolvedScope: Scope; change: NoteChange; }; export type NoteRenameResult = { meta: NoteMeta; replacedCrumpledTarget: boolean; }; export type NoteQueryStatus = { crumpledExcluded: number; homesUnavailable: string[]; }; export type NoteQueryResult = { rows: T[]; status: NoteQueryStatus; }; /** Public identity resolved for an operation, never a filesystem path. */ export declare function noteIdentity(identity: NotesIdentity, address: string): { address: string; project_key?: string; }; /** Host-neutral, filesystem-backed notes API. */ export interface NotesStore { write(address: string, content: string, options?: WriteOptions): Promise; read(address: string): Promise; update(address: string, edits?: EditOperation[], options?: EditOptions): Promise; rename(fromAddress: string, toAddress: string): Promise; list(options?: NotesQuery): Promise; search(queries: string[], options?: NotesQuery): Promise; listWithStatus(options?: NotesQuery): Promise>; searchWithStatus(queries: string[], options?: NotesQuery): Promise>; } /** Create a store over one validated, immutable snapshot of the supplied explicit identity. */ export declare function createNotesStore(input: NotesIdentity): NotesStore;