import { type ContradictionStatus, type Memory, type Tier, type NodeRef, type Entity, type Scopes, type FactSourceType, type FactCategory, type StructuredStore, type VectorStore, type Logger } from '@kybernesis/arcana-contracts'; /** * Input for `command.recordFact`. Mirrors the v1.0.0 `Fact` schema (ADR 013): * - `fact` (sentence form) is required. * - `entities` (denormalised list of entity names this fact mentions) — at * least one entity required. * - `category` defaults to `'general'` when omitted (matches KB extractor * convention). * - `attribute` and `value` (triple decomposition) remain optional per * ADR 004. * - `sourceMemoryId` / `sourcePath` / `sourceConversationId` are backlinks * for provenance + Layer-0 fact-FTS fan-out. */ export interface RecordFactInput { fact: string; entities: string[]; attribute?: string; value?: string; confidence: number; sourceType: FactSourceType; /** Defaults to 'general' when omitted. */ category?: FactCategory; sourceMemoryId?: string; sourcePath?: string; sourceConversationId?: string; expiresAt?: string; scopes?: Scopes; } /** * Input for `command.storeContradiction`. Kernel mints `id` + `createdAt`. * `status` defaults to `'pending'` when omitted. `rationale` captures the * detection-time explanation (typically LLM-extracted) and is optional; * `resolution` is reserved for the resolve flow (out of scope for create). * See ADR 006. */ export interface StoreContradictionInput { factAId: string; factBId: string; status?: ContradictionStatus; rationale?: string; } export interface LinkNodesOptions { /** 0..1 confidence in the relation. Defaults to 1.0. */ confidence?: number; /** Tags shared between the two nodes (drives some retrieval scoring). */ sharedTags?: string[]; /** How this edge was produced (jaccard | llm-derived | manual | consumer-mirror | ...). Defaults to 'consumer-mirror'. */ method?: string; /** Optional human-readable justification. */ rationale?: string; } /** * Public shape for `command.updateMemory`. Excludes `id` (immutable) and * `contentHash` (kernel-derived from content). Supplying `content` triggers * automatic contentHash recomputation; consumers don't think about hashes. * * `scopes` replaces (not merges) the existing scopes object. See ADR 005. */ export type UpdateMemoryFields = Partial>; export interface CommandDeps { structured: StructuredStore; vector: VectorStore; logger: Logger; } export interface CommandApi { /** Upsert an entity (insert or replace by id). */ upsertEntity(entity: Entity): Promise; /** Delete an entity by id. */ deleteEntity(id: string): Promise; /** * Record a fact. `fact` (sentence form) and `entity` are required; * `attribute`/`value` triple decomposition is optional. See ADR 004. */ recordFact(input: RecordFactInput): Promise; /** * Mark an existing fact as superseded by another. Pure link operation: * updates `isLatest=false` and `supersededBy=newFactId` on the old fact. * The new fact must already exist (typically created via `recordFact`). * See ADR 006. */ markFactSuperseded(oldFactId: string, newFactId: string): Promise; /** * Mark an existing memory as superseded by another. Pure link operation: * updates `isLatest=false` and `supersededBy=newMemoryId` on the old memory. * The new memory must already exist (typically created via `ingest.storeMemory`). * Mirrors `markFactSuperseded`. See ADR 007 §3.2. */ markMemorySuperseded(oldMemoryId: string, newMemoryId: string): Promise; /** * Store a contradiction between two facts. Kernel mints id + createdAt; * status defaults to `'pending'`. `rationale` captures the why-detected * signal (e.g., LLM-extracted explanation). Returns the new contradiction id. * See ADR 006. */ storeContradiction(input: StoreContradictionInput): Promise; /** * Create a typed edge between two nodes (memory↔memory, memory↔entity, * or entity↔entity). Returns the edge id. */ linkNodes(from: NodeRef, to: NodeRef, relation: string, opts?: LinkNodesOptions): Promise; /** * Partial in-place update of a Memory. Only supplied fields change. * `contentHash` is recomputed automatically when `content` is provided. * `scopes` replaces (not merges) the previous scopes object. * * See ADR 005 — Memory was never append-only by design; this primitive * unblocks pin / moveToTier and lets consumers update tracked fields * (accessCount, decayScore, tier, content) without orphaning records. */ updateMemory(id: string, fields: UpdateMemoryFields): Promise; /** Pin a memory so decay/tier transitions skip it. */ pin(memoryId: string): Promise; /** Force-move a memory to a specific tier. */ moveToTier(memoryId: string, tier: Tier): Promise; /** Permanently delete a memory and its associated chunks/edges/facts. */ deleteMemory(id: string): Promise; /** Update one of the agent's own memory blocks. */ updateBlock(label: string, content: string, changedBy?: string): Promise; } export declare function createCommand(deps: CommandDeps): CommandApi; //# sourceMappingURL=index.d.ts.map