UNPKG

autosnippet

Version:

Extract code patterns into a knowledge base for AI coding assistants

146 lines (145 loc) 4.09 kB
/** * evolution-tools.ts Evolution Agent 专用工具 * * 三个提案驱动的决策工具,供 Evolution Agent rescan 时对现有 Recipe 做出明确决策: * - propose_evolution: 附加进化提案(代码已变但知识仍有价值) * - confirm_deprecation: 确认 Recipe 应被废弃(加速 deprecate 流程) * - skip_evolution: 显式跳过进化决策(仍然有效或信息不足) * * @module agent/tools/evolution-tools */ import type { ToolHandlerContext } from './_shared.js'; export interface ProposeEvolutionParams { recipeId: string; type: 'enhance' | 'correction'; description: string; evidence: { sourceStatus: 'exists' | 'moved' | 'modified' | 'deleted'; currentCode?: string; newLocation?: string; suggestedChanges: string; }; confidence: number; } interface ConfirmDeprecationParams { recipeId: string; reason: string; } interface SkipEvolutionParams { recipeId: string; reason: string; } export declare const proposeEvolution: { name: string; description: string; parameters: { type: string; properties: { recipeId: { type: string; description: string; }; type: { type: string; enum: string[]; description: string; }; description: { type: string; description: string; }; evidence: { type: string; description: string; properties: { sourceStatus: { type: string; enum: string[]; description: string; }; currentCode: { type: string; description: string; }; newLocation: { type: string; description: string; }; suggestedChanges: { type: string; description: string; }; }; required: string[]; }; confidence: { type: string; description: string; }; }; required: string[]; }; handler: (params: ProposeEvolutionParams, ctx: ToolHandlerContext) => Promise<{ status: "error"; message: string; recipeId: string; proposalId?: undefined; type?: undefined; expiresAt?: undefined; } | { status: "proposed"; proposalId: string; recipeId: string; type: "enhance" | "correction"; expiresAt: number; message?: undefined; }>; }; export declare const confirmDeprecation: { name: string; description: string; parameters: { type: string; properties: { recipeId: { type: string; description: string; }; reason: { type: string; description: string; }; }; required: string[]; }; handler: (params: ConfirmDeprecationParams, ctx: ToolHandlerContext) => Promise<{ status: string; recipeId: string; reason: string; result: unknown; }>; }; export declare const skipEvolution: { name: string; description: string; parameters: { type: string; properties: { recipeId: { type: string; description: string; }; reason: { type: string; description: string; }; }; required: string[]; }; handler: (params: SkipEvolutionParams, _ctx: ToolHandlerContext) => Promise<{ status: string; recipeId: string; reason: string; }>; }; export {};