import type { KnowledgeService } from './service.js'; import type { ArtifactFetchMode } from '../artifacts/types.js'; import { type KnowledgeInjection } from '../state/knowledge-injection.js'; import type { MemoryAddOptions, MemoryBundle, MemoryDoctorReport, MemoryImportResult, MemoryLink, MemoryRecord, MemoryReviewPatch, MemoryScope, MemorySearchFilter, MemorySemanticSearchResult } from '../state/memory-store.js'; import type { MemoryVectorStats } from '../state/memory-vector-store.js'; import type { MemoryRegistry } from '../state/memory-registry.js'; import type { CodeChunkMode, CodeContextResult, CodeIndexBuildStats, CodeIndexStats, CodeIndexStore } from '../state/code-index-store.js'; export type { ArtifactFetchMode } from '../artifacts/types.js'; export type { KnowledgeInjection, } from '../state/knowledge-injection.js'; export type { KnowledgeInjectionIngestMode, KnowledgeInjectionProvenance, KnowledgeInjectionRetention, KnowledgeInjectionTrustTier, KnowledgeInjectionUseAs, } from './shared.js'; type UsageListInput = Parameters[1]; type SourceQueryInput = Parameters[0]; type NodeQueryInput = Parameters[0]; type IssueQueryInput = Parameters[0]; type IssueReviewInput = Parameters[0]; type NodeReviewInput = Parameters[0]; type NeighborInput = Parameters[2]; type RecordUsageInput = Parameters[0]; type IngestUrlInput = Parameters[0]; type IngestArtifactInput = Parameters[0]; type ImportBookmarksInput = Parameters[0]; type ImportUrlsInput = Parameters[0]; type BrowserHistoryInput = Parameters[0]; type BookmarkSeedsInput = Parameters[0]; type ConnectorInput = Parameters[0]; type KnowledgeMapInput = Parameters[0]; type ProjectionRenderInput = Parameters[0]; type ProjectionMaterializeInput = Parameters[0]; type PacketTask = Parameters[0]; type PacketWriteScope = Parameters[1]; type PacketLimit = Parameters[2]; type PacketOptions = Parameters[3]; type ScheduleSaveInput = Parameters[0]; type ConsolidationDecision = Parameters[1]; type ConsolidationDecisionInput = Parameters[2]; type RunJobInput = Parameters[1]; type CandidateListInput = Parameters[1]; type RemoteKnowledgeFetchMode = Extract; export interface KnowledgeApiUrlIngestInput extends Omit { readonly fetchMode?: RemoteKnowledgeFetchMode | undefined; readonly metadata?: Record | undefined; } export interface KnowledgeApiArtifactIngestInput extends Omit { readonly fetchMode?: RemoteKnowledgeFetchMode | undefined; readonly metadata?: Record | undefined; } export interface MemoryExplainResult { readonly injections: readonly KnowledgeInjection[]; readonly prompt: string | null; } export interface MemoryApi { add(input: MemoryAddOptions): Promise; search(filter?: MemorySearchFilter): readonly MemoryRecord[]; searchSemantic(filter?: MemorySearchFilter): readonly MemorySemanticSearchResult[]; vectorStats(): MemoryVectorStats; rebuildVectors(): MemoryVectorStats; rebuildVectorsAsync(): Promise; doctor(): Promise; reviewQueue(limit?: number, scope?: MemoryScope): readonly MemoryRecord[]; exportBundle(filter?: MemorySearchFilter): MemoryBundle; importBundle(bundle: MemoryBundle): Promise; get(id: string): MemoryRecord | null; getAll(): readonly MemoryRecord[]; link(fromId: string, toId: string, relation: string): Promise; linksFor(id: string): readonly MemoryLink[]; update(id: string, patch: { scope?: MemoryScope; summary?: string; detail?: string; tags?: string[]; }): MemoryRecord | null; review(id: string, patch: MemoryReviewPatch): MemoryRecord | null; delete(id: string): boolean; explain(task: string, writeScope?: readonly string[], limit?: number): MemoryExplainResult; } export type MemoryApiRegistry = Pick; /** * memory-api-parallel query surface for the repo source-tree code index * (Stage A, see CHANGELOG 0.38.0). Deliberately NOT folded into MemoryApi: * CodeContextResult/CodeIndexStats are a different record shape than * MemoryRecord, and code-index retrieval carries no cls/reviewState/trustTier * provenance semantics, see createCodeIndexApi / createMemoryApi below. */ export interface CodeIndexApi { search(query: string, opts?: { limit?: number; }): readonly CodeContextResult[]; stats(): CodeIndexStats; reindex(): Promise; scheduleReindex(): void; reindexFile(absPath: string): Promise<{ indexed: boolean; mode: CodeChunkMode; }>; /** Stated once, honest: why auto-retrieval would be absent right now (no semantic embedding provider). Null when available. */ describeDegradation(): string | null; } export type CodeIndexApiRegistry = Pick; export interface CreateKnowledgeApiOptions { readonly memoryRegistry?: MemoryApiRegistry | undefined; readonly codeIndexStore?: CodeIndexApiRegistry | undefined; } export interface KnowledgeApi { readonly status: { get(): ReturnType; lint(): ReturnType; reindex(): ReturnType; }; readonly sources: { list(limit?: number): ReturnType; query(input?: SourceQueryInput): ReturnType; delete(id: string): ReturnType; }; readonly graph: { nodes: { list(limit?: number): ReturnType; query(input?: NodeQueryInput): ReturnType; history(id: string): ReturnType; delete(id: string): ReturnType; merge(loserId: string, winnerId: string): ReturnType; review(input: NodeReviewInput): ReturnType; }; issues: { list(limit?: number): ReturnType; query(input?: IssueQueryInput): ReturnType; review(input: IssueReviewInput): ReturnType; }; extractions: { list(limit?: number, sourceId?: string): ReturnType; get(id: string): ReturnType; getBySourceId(sourceId: string): ReturnType; }; items: { get(id: string): ReturnType; getMany(ids: readonly string[]): ReturnType; neighbors(kind: Parameters[0], id: string, input?: NeighborInput): ReturnType; search(query: string, limit?: number): ReturnType; }; map(input?: KnowledgeMapInput): ReturnType; }; readonly usage: { list(limit?: number, input?: UsageListInput): ReturnType; record(input: RecordUsageInput): ReturnType; }; readonly connectors: { list(): ReturnType; get(id: string): ReturnType; doctor(id: string): ReturnType; register(connector: Parameters[0], options?: Parameters[1]): void; }; readonly ingest: { url(input: KnowledgeApiUrlIngestInput): ReturnType; artifact(input: KnowledgeApiArtifactIngestInput): ReturnType; browserHistory(input?: BrowserHistoryInput): ReturnType; bookmarksFile(input: ImportBookmarksInput): ReturnType; urlsFile(input: ImportUrlsInput): ReturnType; bookmarkSeeds(input: BookmarkSeedsInput): ReturnType; withConnector(connectorId: Parameters[0], input: Parameters[1], sessionId?: Parameters[2]): ReturnType; connectorInput(input: ConnectorInput): ReturnType; }; readonly packets: { build(task: PacketTask, writeScope?: PacketWriteScope, limit?: PacketLimit, options?: PacketOptions): ReturnType; buildSync(task: PacketTask, writeScope?: PacketWriteScope, limit?: PacketLimit, options?: PacketOptions): ReturnType; buildPrompt(task: PacketTask, writeScope?: PacketWriteScope, limit?: PacketLimit, options?: PacketOptions): ReturnType; buildPromptSync(task: PacketTask, writeScope?: PacketWriteScope, limit?: PacketLimit, options?: PacketOptions): ReturnType; }; readonly projections: { listTargets(limit?: number): ReturnType; render(input: ProjectionRenderInput): ReturnType; materialize(input: ProjectionMaterializeInput): ReturnType; }; readonly jobs: { list(): ReturnType; get(id: string): ReturnType; runs(limit?: number, jobId?: string): ReturnType; run(id: string, input?: RunJobInput): ReturnType; schedules: { list(limit?: number): ReturnType; get(id: string): ReturnType; save(input: ScheduleSaveInput): ReturnType; delete(id: string): ReturnType; setEnabled(id: string, enabled: boolean): ReturnType; }; }; readonly consolidation: { candidates(limit?: number, input?: CandidateListInput): ReturnType; getCandidate(id: string): ReturnType; reports(limit?: number): ReturnType; getReport(id: string): ReturnType; decide(candidateId: string, decision: ConsolidationDecision, input?: ConsolidationDecisionInput): ReturnType; }; readonly memory?: MemoryApi | undefined; readonly codeIndex?: CodeIndexApi | undefined; } export declare function createMemoryApi(memoryRegistry: MemoryApiRegistry): MemoryApi; export declare function createCodeIndexApi(codeIndexStore: CodeIndexApiRegistry): CodeIndexApi; export declare function createKnowledgeApi(knowledgeService: KnowledgeService, options?: CreateKnowledgeApiOptions): KnowledgeApi; //# sourceMappingURL=knowledge-api.d.ts.map