/** * DictionaryService — 术语 CRUD + 生命周期 + 版本触发 * FR-H01, FR-H04 * * 术语是 KnowledgeEntry 的特化视图(type=fact, domain=system-dictionary)。 * definition/constraints 变更触发新版本,其他字段原地更新。 */ import type { KnowledgeEntry } from '../types/index.js'; import type { StorageAdapter } from '../storage/storage-types.js'; import type { TermRegistrationInput, TermUpdatePatch, DictionaryConfig, TermChangeHandler } from './term-types.js'; import type { TermConflictChecker } from './term-conflict-checker.js'; export interface DictionaryServiceOptions { store: StorageAdapter; conflictChecker?: TermConflictChecker; config?: Partial; } export declare class DictionaryService { private readonly store; private readonly conflictChecker?; readonly config: DictionaryConfig; private readonly changeHandlers; private registerMutex; constructor(options: DictionaryServiceOptions); /** 注册术语变更事件监听器 (P0-1: FR-H04-AC5) */ onTermChange(handler: TermChangeHandler): void; /** 移除术语变更事件监听器 */ offTermChange(handler: TermChangeHandler): void; private emitChange; /** 注册新术语 (P0-2: mutex 防 TOCTOU 竞态) */ register(input: TermRegistrationInput): Promise; /** 更新术语 — definition/constraints 变更触发新版本 */ update(id: string, patch: TermUpdatePatch, expectedVersion: number): Promise; /** 废弃术语(保持 active 状态,仅记录废弃元数据) */ deprecate(id: string, reason: string, replacementTermId?: string): Promise; /** 合并术语 (P1-5: supersedes 指向 + 回退能力) */ merge(sourceIds: string[], targetId: string): Promise; /** 回退合并操作:恢复被合并条目的原始状态 */ rollbackMerge(sourceIds: string[]): Promise; /** 按术语名查找 */ getByTerm(term: string, scope?: string): Promise; /** 按 scope 列出术语 */ listByScope(scope: string, page?: number, pageSize?: number): Promise; /** 获取所有活跃术语 */ queryAllActiveTerms(): Promise; private buildEntry; private dictionaryFilter; private ensureUnique; private ensureTermUniqueInScope; private ensureAliasesUnique; } //# sourceMappingURL=dictionary-service.d.ts.map