/** * Lemma API v2 — Wire types (Lane 0) * * The contract for the six /v2 routes. Frozen here so lanes C..K can implement * against a stable shape and the TS SDK can generate identically-shaped clients. */ import type { Evidence } from './evidence'; /** * Verifiability state of a memory or claim. This is the differentiator of the * product and the fail-closed invariant lives here (see plan §0): * * fresh — every tracked path hashes identical to what was stored. * stale — a tracked path hashed differently (with which files changed). * unverified — the verifier cannot prove validity (client sent no current * evidence, or omitted a tracked path). NEVER `fresh` by guess. * contradicted — two stored claims about the same subject now diverge. */ export type MemoryState = 'fresh' | 'stale' | 'unverified' | 'contradicted'; /** One fact a memory asserts, self-contained. */ export interface MemoryClaim { id: string; text: string; fileHashes?: Evidence['files']; symbolHashes?: Evidence['symbols']; symbolNormalizedHashes?: Evidence['symbolsNormalized']; } /** A worker result inside /v2/recall or /v2/verify. */ export interface VerifiedResult { id: string; state: MemoryState; /** Paths (or `path::symbol`) that no longer hash the same, when stale. */ staleFiles?: string[]; /** Cosmetic-only changes ignored under semantic diff, when applicable. */ cosmeticChanges?: string[]; /** The original memory/claim payload, when the caller asked for it. */ memory?: unknown; } export interface CreateMemoryRequest { claims: Array<{ text: string; filePaths?: string[]; symbols?: Array<{ filePath: string; symbolName: string; }>; }>; evidence: Evidence; /** Optional ids this memory was derived from (transitive freshness). */ derivedFrom?: string[]; } export interface CreateMemoryResponse { id: string; claims: MemoryClaim[]; } export interface RecallRequest { query: string; /** The client's current evidence for the candidate set, if it has any. */ currentEvidence?: Evidence; limit?: number; } export interface RecallResponse { results: VerifiedResult[]; query: string; } export interface VerifyRequest { /** Ids whose freshness to resolve. */ ids: string[]; currentEvidence: Evidence; } export interface VerifyResponse { results: VerifiedResult[]; } /** Outcome of a batch forget. */ export interface ForgetResponse { forged: string[]; } export interface ScrubFinding { type: string; offset: number; length: number; } export interface ScrubRequest { text?: string; toolCallJson?: string; mode?: 'mask' | 'detect'; } export interface ScrubResponse { text?: string; toolCallJson?: string; findings: ScrubFinding[]; } /** A single auditable usage number. Every value here is measured, never estimated. */ export interface UsageStat { measurement: 'counted'; value: number; } export interface UsageResponse { /** Keyed by metric name → counted value. */ metrics: Record; /** How many ledger events were excluded for lacking a reliable count. */ excludedEvents: number; } //# sourceMappingURL=api-v2.types.d.ts.map