/** * Lease tokens: portable proof of what a response served (change: add-session-lease-tokens). * * `orient` and `recall` return a `leaseToken` naming the functions and files they served, with a * hash of their exact text at that moment. Any process on the same clone can later ask * `verify_claim` (`lease-current`) whether that text is still current — a sub-agent checking what its * parent read, or an agent after a pause. * * Issuing reads files and the cached index only (no parsing on the response path): a served function * is located by the index's span (file, name, start line), and its raw text is hashed along with its * first characters, so the check can find it again after edits above it. A served name the index * cannot locate (a class, a symbol not indexed) is listed as not covered, never compared at file * level. Whole files (specs) are hashed as text, whitespace-normalized for Markdown, YAML, and JSON. * * A token is a small JSON file in `.openlore/session-ledger/tokens/` (never committed), valid for * {@link LEASE_TTL_MS}. The check never writes; anything it cannot settle makes the claim unverifiable. */ /** How long a token resolves. */ export declare const LEASE_TTL_MS: number; export interface LeaseEntry { file: string; /** A served function: its name, span, raw-text hash, and first characters. */ name?: string; start?: number; end?: number; hash?: string; head?: string; /** A served whole file: its text hash (whitespace-normalized for Markdown, YAML, JSON). */ fileHash?: string; } export interface ServedItem { file: string; name?: string; startLine?: number; } /** What a response served. */ export declare function servedForLease(tool: string, result: unknown): ServedItem[]; /** Issue a token for what a response served; undefined when nothing could be leased or it cannot be written. */ export declare function issueLeaseToken(root: string, items: readonly ServedItem[]): Promise; export type LeaseCheck = { status: 'unknown' | 'expired'; reason: string; } | { status: 'checked'; createdAt: string; entries: number; changed: Array<{ file: string; name?: string; why: 'changed' | 'removed'; }>; /** Entries the check could not settle (a file it could not read, other than a missing one). */ unsettled: Array<{ file: string; name?: string; reason: string; }>; notCovered: string[]; }; /** A function served in this worktree, from a recent token: its span, raw-text hash, and when. */ export interface RecentServed { file: string; name: string; start: number; end: number; hash: string; head: string; servedAt: string; } /** The raw-text hash tokens use, for callers that compare served text elsewhere. */ export declare const leaseTextHash: (text: string) => string; /** * Functions served by tokens issued within `windowMs` (newest serve of each kept), read-only. * Bounded: the newest {@link MAX_RECENT_TOKENS} tokens and {@link MAX_ENTRIES} functions. */ export declare function recentServedFunctions(root: string, windowMs: number, now?: number): Promise; /** Whether every entry of a token still has the same text. */ export declare function checkLease(root: string, token: string): Promise; //# sourceMappingURL=lease-tokens.d.ts.map