import type { CallOptions, IKnowledgeRagHandle, IToolsRagHandle, KnowledgeEntry, KnowledgeEntryMetadata, KnowledgeFilter, LlmTool } from '@mcp-abap-adt/llm-agent'; /** * Persistence + retrieval port for the knowledge blackboard. The server * wires a concrete backend (vector store for semantic query + a durable * per-session entry log for exhaustive list/rehydrate). The in-memory * backend below is the default for stateless deployments and tests. */ export interface KnowledgeBackend { /** Durably store the full entry (content + metadata) AND index its * content for semantic query. Keyed by sessionId for isolation. * `options` is forwarded to the embedder so write-time upsert embeds are * metered via `options.requestLogger`. */ put(sessionId: string, entry: KnowledgeEntry, options?: CallOptions): Promise; /** Semantic similarity search within a session, relevance-capped by k. When * `filter` is given it MUST be applied to the candidate set BEFORE the K cap * (so a runId filter is never starved by other runs' artifacts crowding the * cap), preserving the backend's native ranking. `options` is forwarded to * the embedder so recall-time embeds are metered via `options.requestLogger`. */ semanticQuery(sessionId: string, text: string, k?: number, filter?: KnowledgeFilter, options?: CallOptions): Promise; /** Exhaustive durable scan of ALL entries for a session (no relevance * cap). Used by list() and by rehydrate. */ scan(sessionId: string): Promise; /** Evict ALL entries for a session so a subsequent same-id request does not * rehydrate stale knowledge. Backs DELETE /v1/sessions/:id — without it a * long-lived in-memory backend would retain entries after a session delete. */ deleteSession(sessionId: string): Promise; /** True iff the backend supports embedding-based semantic recall (an index is * attached). The controller asserts this before wiring run-scoped recall. */ readonly semanticRecallCapable?: boolean; } /** * Per-session blackboard. write() → backend.put (durable + indexed). * query() → backend.semanticQuery (k-capped, planner RAG-first). list() → * exhaustive scan, metadata-filtered (root finalizer). init() rehydrates * the local mirror from the backend so list()/fingerprint() are correct * immediately after a resume. */ export declare class KnowledgeRag implements IKnowledgeRagHandle { private readonly backend; private readonly sessionId; private mirror; constructor(backend: KnowledgeBackend, sessionId: string); /** Call once after construction for a RESUMED session to rehydrate the * local mirror from the durable backend. For a brand-new session it is * a cheap no-op (empty scan). */ init(): Promise; write(entry: { content: string; metadata: KnowledgeEntryMetadata; }, options?: CallOptions): Promise; query(text: string, opts?: { k?: number; filter?: KnowledgeFilter; options?: CallOptions; }): Promise; list(filter: KnowledgeFilter): Promise; fingerprint(): string; /** Exact-match identity lookup (18.1 dedup): true if a fetched artefact with * this identityKey is already in the store. Uses the durable scan ∪ mirror so * it is correct across a resume and within-process writes. */ hasArtifact(identityKey: string): Promise; /** The set of fetched-artefact identities (for the planner's "already fetched" * manifest). De-duplicated by identityKey, earliest createdAt kept. */ listArtifacts(): Promise>; /** Content of the stored artefact with this identityKey, for cross-step reuse. * Returns the LATEST write (read-after-write: "the last result is read"), so a * re-fetched/updated artefact supersedes an earlier one. Undefined if absent. */ getArtifact(identityKey: string): Promise; } export declare function matches(m: KnowledgeEntryMetadata, f: KnowledgeFilter): boolean; /** Default in-memory backend — no persistence across process restart, used * for stateless deployments and tests. (The "RESUME" test reuses the same * instance to simulate a durable backend; a true persistent backend ships * in the server package, see Task 13 note.) */ export declare class InMemoryKnowledgeBackend implements KnowledgeBackend { private readonly semantic?; private readonly bySession; /** Optional embedder-backed index; when present, semanticQuery delegates to it * (real ranking) — else filter + insertion order (pure unit tests). */ constructor(semantic?: { upsert(sid: string, e: KnowledgeEntry, options?: CallOptions): Promise; query(sid: string, text: string, k?: number, filter?: KnowledgeFilter, options?: CallOptions): Promise; deleteSession(sid: string): void; } | undefined); private of; put(sid: string, entry: KnowledgeEntry, options?: CallOptions): Promise; semanticQuery(sid: string, text: string, k?: number, filter?: KnowledgeFilter, options?: CallOptions): Promise; scan(sid: string): Promise; deleteSession(sid: string): Promise; get semanticRecallCapable(): boolean; } /** * Thin wrapper around a tools store (query + lookup). Adapts the store's * shape to IToolsRagHandle for use in Stepper contexts. */ export declare class ToolsRag implements IToolsRagHandle { private readonly store; constructor(store: { query(text: string, k?: number): Promise; lookup(name: string): LlmTool | undefined; }); query(text: string, k?: number): Promise; lookup(name: string): LlmTool | undefined; } //# sourceMappingURL=knowledge-rag.d.ts.map