autosnippet
Version:
Extract code patterns into a knowledge base for AI coding assistants
91 lines (90 loc) • 2.42 kB
TypeScript
/**
* knowledge-graph.js — 知识图谱类工具 (2)
*
* 10. check_duplicate 候选查重
* 12. add_graph_edge 手动添加图谱边
*
* 注意: discover_relations 已删除。
* 关系发现由 Agent LLM 直接推理完成,利用通用工具(search_knowledge, query_code_graph 等)。
*/
import type { ToolHandlerContext } from './_shared.js';
export declare const checkDuplicate: {
name: string;
description: string;
parameters: {
type: string;
properties: {
candidate: {
type: string;
description: string;
};
candidateId: {
type: string;
description: string;
};
projectRoot: {
type: string;
description: string;
};
threshold: {
type: string;
description: string;
};
};
};
handler: (params: Record<string, unknown>, ctx: ToolHandlerContext) => Promise<{
similar: never[];
message: string;
hasDuplicate?: undefined;
highestSimilarity?: undefined;
_meta?: undefined;
} | {
similar: {
file: string;
title: string;
similarity: number;
}[];
hasDuplicate: boolean;
highestSimilarity: number;
_meta: {
confidence: string;
hint: string;
};
message?: undefined;
}>;
};
export declare const addGraphEdge: {
name: string;
description: string;
parameters: {
type: string;
properties: {
fromId: {
type: string;
description: string;
};
fromType: {
type: string;
description: string;
};
toId: {
type: string;
description: string;
};
toType: {
type: string;
description: string;
};
relation: {
type: string;
description: string;
};
weight: {
type: string;
description: string;
};
};
required: string[];
};
handler: (params: Record<string, unknown>, ctx: ToolHandlerContext) => Promise<any>;
};