@phren/cli
Version:
Knowledge layer for AI agents - CLI, MCP server, and data layer
34 lines (33 loc) • 1.49 kB
TypeScript
import { type CitationState } from "./citation.js";
export declare const CITATION_STATES_FILE = "citation-states.json";
export declare const CITATION_GIT_CALLS_PER_RUN = 300;
export interface CitationStateEntry {
state: CitationState;
checkedAt: string;
}
export type CitationStates = Record<string, CitationStateEntry>;
export interface CitationSweep {
states: CitationStates;
checked: number;
pending: number;
gitCalls: number;
}
/**
* A bullet's text as the store file and the search index both give it: metadata comments and the index's
* `[from:actor@machine]` attribution removed (the index drops `created` and turns `source` into that).
* The sweep and retrieval key unrecorded-fid bullets by it, so they cannot disagree.
*/
export declare function bulletKeyText(bullet: string): string;
/** The finding's fid, else a hash of the file it is in and its bullet's key text. */
export declare function citationStateKey(file: string, bullet: string): string;
/** The recorded states; reading never creates `.runtime` (store health is read-only). */
export declare function readCitationStates(phrenPath: string): CitationStates;
/** Checks the targets' citations, least recently checked first, until `maxGitCalls` git processes have run. */
export declare function sweepCitationStates(phrenPath: string, targets: Array<{
storePath: string;
project: string;
}>, opts?: {
maxGitCalls?: number;
save?: boolean;
now?: number;
}): CitationSweep;