export type { ProjectMemoryKind } from './project-memory-service.js'; import type { ProjectMemoryKind } from './project-memory-service.js'; /** * One entry in `.peaks/memory/index.json` after the on-disk `hot[]` + * `cold[]` arrays are flattened. Mirrors the field shape that the * existing `project-memory-service.ts` writer emits. */ export interface MemoryIndexEntry { name: string; kind: ProjectMemoryKind; description: string; sourcePath: string; sourceArtifact: string | null; updatedAt: string; } /** * The full snapshot of `.peaks/memory/index.json`. */ export interface MemoryIndexSnapshot { indexPath: string; version: number; updatedAt: string; entries: MemoryIndexEntry[]; } /** * Input to `searchMemory`. `projectRoot` defaults to the resolved * peaks project root (CLI resolves this before calling). `query` is * required and non-empty. */ export interface MemorySearchInput { query: string; projectRoot?: string; limit?: number; kind?: ProjectMemoryKind; } /** * One hit returned by `searchMemory`. Mirrors the entry shape with a * normalized score in [0, 1] (top of batch = 1.0) and the char indices * in the searchable text that contributed to the match. */ export interface MemorySearchResult { name: string; kind: ProjectMemoryKind; description: string; sourcePath: string; score: number; positions: number[]; } /** * Read `.peaks/memory/index.json` and flatten the on-disk `hot[][]` * + `cold[]` shape into a single `entries[]` array. Throws structured * errors with stable `code` markers that the CLI converts to the * peaks envelope. */ export declare function loadMemoryIndex(projectRoot: string): MemoryIndexSnapshot; /** * Run the generic fuzzy kernel against the on-disk memory index. The * searchable text is `name + " " + description` for each entry (per * spec §Component Details). */ export declare function searchMemory(input: MemorySearchInput): MemorySearchResult[]; /** * Envelope for the optional headroom-compressed version of the search * result text. The compressed text is intended for the LLM-side prompt * (it preserves the entry names + descriptions in a more token-efficient * form); the structured `matches` array is unchanged and remains the * machine-readable form. `null` when compression was not requested, * did not run, or failed (see `warning` for the reason). */ export interface CompressedResultsEnvelope { readonly mode: 'balanced' | 'aggressive' | 'conservative'; readonly originalSize: number; readonly compressedSize: number; readonly compressionRatio: number; readonly compressedText: string; readonly warning: string | null; } export interface MemorySearchWithResults { readonly matches: MemorySearchResult[]; readonly compressedResults: CompressedResultsEnvelope | null; } export interface MemorySearchOptions { /** When true, read preferences.headroom.perTouchpoint.memorySearch and * compress joined match text via headroom-ai. Falls back silently to * the structured `matches` array when compression is unavailable. */ readonly compressResults?: boolean; } /** * Run the search + optionally compress the joined match text via headroom. * The structured `matches` array is the canonical output. The * `compressedResults` is a derived view for LLM-side prompt assembly. */ export declare function searchMemoryWithResults(input: MemorySearchInput, options?: MemorySearchOptions): Promise;