/** * Knowledge Keeper Core * 核心逻辑,不依赖 OpenClaw SDK,可被 MCP Server 复用 * * v0.5.0 新增:Obsidian vault 兼容 */ export type KnowledgeType = "concept" | "decision" | "todo" | "note" | "project"; export interface KnowledgePoint { id: string; type: KnowledgeType; title: string; content: string; tags: string[]; links: string[]; created: string; updated: string; source: "conversation" | "manual" | "mcp"; } export declare class KnowledgeError extends Error { code: string; details?: Record | undefined; constructor(message: string, code: string, details?: Record | undefined); } export declare function getVaultDir(): string; export declare function generateId(type: KnowledgeType): string; export declare function loadAllEntries(): Promise; export declare function saveKnowledge(params: { type: KnowledgeType; title: string; content: string; tags?: string[]; links?: string[]; }): Promise; export declare function searchKnowledge(params: { query: string; type?: KnowledgeType; tags?: string[]; limit?: number; }): Promise; export declare function getKnowledge(id: string): Promise; export declare function updateKnowledge(id: string, params: { title?: string; content?: string; tags?: string[]; appendTags?: string[]; }): Promise; export declare function deleteKnowledge(id: string): Promise; export declare function listTags(): Promise>; export declare function reviewKnowledge(params: { period?: "today" | "week" | "month" | "all"; type?: KnowledgeType; }): Promise<{ stats: Record; recent: KnowledgePoint[]; }>; export declare function semanticSearch(params: { query: string; topK?: number; threshold?: number; }): Promise>; export declare function getSemanticStats(): Promise<{ count: number; model: string; dimension: number; }>; export declare function bm25Search(params: { query: string; topK?: number; }): Promise>; export declare function getBM25IndexStats(): Promise<{ docCount: number; avgDocLength: number; termCount: number; lastUpdate: number; }>; export interface KnowledgeLink { from: string; to: string; relation: string; created: string; } export declare function addLink(from: string, to: string, relation: string, bidirectional?: boolean): Promise; export declare function getLinks(id: string, relation?: string, direction?: "outgoing" | "incoming" | "both"): Promise>; export declare function removeLink(from: string, to?: string, relation?: string): Promise; /** * Tokenize text for similarity comparison (Chinese + English support) * English: split on whitespace, filter words > 1 char * Chinese: individual characters */ export declare function tokenizeForSimilarity(text: string, minWordLength?: number): Set;