autosnippet 3.3.4 → 3.3.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +174 -83
- package/config/constitution.yaml +2 -0
- package/dashboard/dist/assets/icons-D1aVZYFW.js +1 -0
- package/dashboard/dist/assets/index-CxHOu8Hd.css +1 -0
- package/dashboard/dist/assets/index-DDdAOpYT.js +128 -0
- package/dashboard/dist/index.html +3 -3
- package/dist/bin/api-server.js +1 -0
- package/dist/bin/cli.d.ts +1 -0
- package/dist/bin/cli.js +136 -9
- package/dist/lib/agent/AgentFactory.d.ts +0 -17
- package/dist/lib/agent/AgentFactory.js +1 -25
- package/dist/lib/agent/capabilities.d.ts +11 -0
- package/dist/lib/agent/capabilities.js +29 -5
- package/dist/lib/agent/context/ExplorationTracker.js +10 -1
- package/dist/lib/agent/context/exploration/ExplorationStrategies.d.ts +2 -0
- package/dist/lib/agent/context/exploration/ExplorationStrategies.js +2 -2
- package/dist/lib/agent/domain/insight-analyst.d.ts +47 -3
- package/dist/lib/agent/domain/insight-analyst.js +111 -11
- package/dist/lib/agent/domain/insight-evolver.d.ts +69 -0
- package/dist/lib/agent/domain/insight-evolver.js +230 -0
- package/dist/lib/agent/domain/insight-gate.d.ts +42 -0
- package/dist/lib/agent/domain/insight-gate.js +41 -0
- package/dist/lib/agent/domain/insight-producer.d.ts +27 -2
- package/dist/lib/agent/domain/insight-producer.js +60 -5
- package/dist/lib/agent/domain/scan-prompts.js +10 -7
- package/dist/lib/agent/memory/ActiveContext.d.ts +2 -28
- package/dist/lib/agent/memory/MemoryCoordinator.d.ts +2 -2
- package/dist/lib/agent/memory/SessionStore.d.ts +6 -12
- package/dist/lib/agent/memory/SessionStore.js +9 -15
- package/dist/lib/agent/memory/memory-flush-contract.d.ts +49 -0
- package/dist/lib/agent/memory/memory-flush-contract.js +16 -0
- package/dist/lib/agent/memory/session-store-schema.d.ts +20 -0
- package/dist/lib/agent/memory/session-store-schema.js +41 -0
- package/dist/lib/agent/presets.d.ts +89 -1
- package/dist/lib/agent/presets.js +53 -5
- package/dist/lib/agent/tools/_shared.d.ts +7 -15
- package/dist/lib/agent/tools/_shared.js +20 -21
- package/dist/lib/agent/tools/composite.d.ts +25 -22
- package/dist/lib/agent/tools/composite.js +108 -109
- package/dist/lib/agent/tools/evolution-tools.d.ts +145 -0
- package/dist/lib/agent/tools/evolution-tools.js +161 -0
- package/dist/lib/agent/tools/index.d.ts +163 -92
- package/dist/lib/agent/tools/index.js +9 -1
- package/dist/lib/agent/tools/lifecycle.d.ts +7 -1
- package/dist/lib/agent/tools/lifecycle.js +59 -75
- package/dist/lib/cli/AiScanService.js +1 -1
- package/dist/lib/cli/KnowledgeSyncService.d.ts +5 -1
- package/dist/lib/cli/KnowledgeSyncService.js +6 -3
- package/dist/lib/core/AstAnalyzer.d.ts +1 -0
- package/dist/lib/{service/bootstrap/DimensionCopyRegistry.d.ts → domain/dimension/DimensionCopy.d.ts} +2 -2
- package/dist/lib/{service/bootstrap/DimensionCopyRegistry.js → domain/dimension/DimensionCopy.js} +22 -72
- package/dist/lib/domain/dimension/DimensionRegistry.d.ts +54 -0
- package/dist/lib/domain/dimension/DimensionRegistry.js +620 -0
- package/dist/lib/domain/dimension/DimensionSop.d.ts +55 -0
- package/dist/lib/domain/dimension/DimensionSop.js +1604 -0
- package/dist/lib/domain/dimension/UnifiedDimension.d.ts +61 -0
- package/dist/lib/domain/dimension/UnifiedDimension.js +53 -0
- package/dist/lib/domain/dimension/index.d.ts +10 -0
- package/dist/lib/domain/dimension/index.js +9 -0
- package/dist/lib/domain/knowledge/FieldSpec.d.ts +1 -1
- package/dist/lib/domain/knowledge/FieldSpec.js +29 -16
- package/dist/lib/domain/knowledge/KnowledgeEntry.d.ts +33 -111
- package/dist/lib/domain/knowledge/KnowledgeEntry.js +27 -6
- package/dist/lib/domain/knowledge/KnowledgeRepository.d.ts +1 -0
- package/dist/lib/domain/knowledge/KnowledgeRepository.js +3 -0
- package/dist/lib/domain/knowledge/Lifecycle.js +1 -1
- package/dist/lib/domain/knowledge/StyleGuide.d.ts +1 -1
- package/dist/lib/domain/knowledge/StyleGuide.js +1 -1
- package/dist/lib/domain/knowledge/UnifiedValidator.js +15 -0
- package/dist/lib/domain/knowledge/values/Stats.d.ts +1 -1
- package/dist/lib/domain/knowledge/values/Stats.js +2 -2
- package/dist/lib/external/mcp/McpServer.js +4 -0
- package/dist/lib/external/mcp/handlers/TargetClassifier.d.ts +1 -1
- package/dist/lib/external/mcp/handlers/bootstrap/BootstrapSession.d.ts +8 -16
- package/dist/lib/external/mcp/handlers/bootstrap/BootstrapSession.js +10 -10
- package/dist/lib/external/mcp/handlers/bootstrap/ExternalSubmissionTracker.d.ts +7 -0
- package/dist/lib/external/mcp/handlers/bootstrap/ExternalSubmissionTracker.js +20 -0
- package/dist/lib/external/mcp/handlers/bootstrap/MissionBriefingBuilder.d.ts +52 -132
- package/dist/lib/external/mcp/handlers/bootstrap/MissionBriefingBuilder.js +204 -17
- package/dist/lib/external/mcp/handlers/bootstrap/base-dimensions.d.ts +11 -75
- package/dist/lib/external/mcp/handlers/bootstrap/base-dimensions.js +40 -191
- package/dist/lib/external/mcp/handlers/bootstrap/pipeline/dimension-configs.d.ts +13 -78
- package/dist/lib/external/mcp/handlers/bootstrap/pipeline/dimension-configs.js +30 -52
- package/dist/lib/external/mcp/handlers/bootstrap/pipeline/dimension-context.d.ts +0 -1
- package/dist/lib/external/mcp/handlers/bootstrap/pipeline/orchestrator.d.ts +99 -12
- package/dist/lib/external/mcp/handlers/bootstrap/pipeline/orchestrator.js +172 -161
- package/dist/lib/external/mcp/handlers/bootstrap/pipeline/tier-scheduler.js +7 -17
- package/dist/lib/external/mcp/handlers/bootstrap/shared/async-fill-helpers.d.ts +46 -0
- package/dist/lib/external/mcp/handlers/bootstrap/shared/async-fill-helpers.js +58 -0
- package/dist/lib/external/mcp/handlers/bootstrap/shared/audit-helpers.d.ts +25 -0
- package/dist/lib/external/mcp/handlers/bootstrap/shared/audit-helpers.js +47 -0
- package/dist/lib/external/mcp/handlers/bootstrap/shared/bootstrap-phases.d.ts +50 -12
- package/dist/lib/external/mcp/handlers/bootstrap/shared/bootstrap-phases.js +30 -10
- package/dist/lib/external/mcp/handlers/bootstrap/shared/dimension-text.js +1 -1
- package/dist/lib/external/mcp/handlers/bootstrap/shared/handler-types.d.ts +24 -0
- package/dist/lib/external/mcp/handlers/bootstrap/shared/handler-types.js +14 -0
- package/dist/lib/external/mcp/handlers/bootstrap/shared/panorama-utils.d.ts +14 -0
- package/dist/lib/external/mcp/handlers/bootstrap/shared/panorama-utils.js +48 -0
- package/dist/lib/external/mcp/handlers/bootstrap/shared/session-helpers.d.ts +21 -0
- package/dist/lib/external/mcp/handlers/bootstrap/shared/session-helpers.js +45 -0
- package/dist/lib/external/mcp/handlers/bootstrap/shared/skill-generator.d.ts +1 -1
- package/dist/lib/external/mcp/handlers/bootstrap/shared/target-file-map.d.ts +27 -0
- package/dist/lib/external/mcp/handlers/bootstrap/shared/target-file-map.js +44 -0
- package/dist/lib/external/mcp/handlers/bootstrap-external.d.ts +14 -10
- package/dist/lib/external/mcp/handlers/bootstrap-external.js +39 -51
- package/dist/lib/external/mcp/handlers/bootstrap-internal.d.ts +2 -0
- package/dist/lib/external/mcp/handlers/bootstrap-internal.js +115 -82
- package/dist/lib/external/mcp/handlers/consolidated.d.ts +4 -4
- package/dist/lib/external/mcp/handlers/consolidated.js +115 -162
- package/dist/lib/external/mcp/handlers/dimension-complete-external.js +69 -1
- package/dist/lib/external/mcp/handlers/evolve-external.d.ts +54 -0
- package/dist/lib/external/mcp/handlers/evolve-external.js +226 -0
- package/dist/lib/external/mcp/handlers/knowledge.js +26 -2
- package/dist/lib/external/mcp/handlers/rescan-external.d.ts +76 -0
- package/dist/lib/external/mcp/handlers/rescan-external.js +335 -0
- package/dist/lib/external/mcp/handlers/rescan-internal.d.ts +120 -0
- package/dist/lib/external/mcp/handlers/rescan-internal.js +359 -0
- package/dist/lib/external/mcp/handlers/search.d.ts +6 -5
- package/dist/lib/external/mcp/handlers/search.js +6 -5
- package/dist/lib/external/mcp/handlers/types.d.ts +2 -1
- package/dist/lib/external/mcp/handlers/wiki-external.js +2 -2
- package/dist/lib/external/mcp/tools.d.ts +8 -18
- package/dist/lib/external/mcp/tools.js +60 -3
- package/dist/lib/http/routes/knowledge.js +122 -1
- package/dist/lib/http/routes/modules.js +25 -3
- package/dist/lib/http/routes/panorama.js +16 -4
- package/dist/lib/infrastructure/cache/CacheCoordinator.d.ts +41 -0
- package/dist/lib/infrastructure/cache/CacheCoordinator.js +105 -0
- package/dist/lib/infrastructure/database/migrations/006_lifecycle_transition_events.d.ts +7 -0
- package/dist/lib/infrastructure/database/migrations/006_lifecycle_transition_events.js +28 -0
- package/dist/lib/infrastructure/vector/HnswVectorAdapter.js +1 -1
- package/dist/lib/injection/ServiceContainer.js +55 -0
- package/dist/lib/injection/ServiceMap.d.ts +8 -1
- package/dist/lib/injection/modules/InfraModule.js +4 -1
- package/dist/lib/injection/modules/KnowledgeModule.js +38 -1
- package/dist/lib/repository/evolution/ProposalRepository.d.ts +99 -0
- package/dist/lib/repository/evolution/ProposalRepository.js +255 -0
- package/dist/lib/repository/knowledge/KnowledgeRepository.impl.d.ts +4 -0
- package/dist/lib/repository/knowledge/KnowledgeRepository.impl.js +16 -1
- package/dist/lib/service/bootstrap/BootstrapEventEmitter.d.ts +3 -2
- package/dist/lib/service/bootstrap/BootstrapEventEmitter.js +1 -1
- package/dist/lib/service/bootstrap/DeliveryVerifier.d.ts +51 -0
- package/dist/lib/service/bootstrap/DeliveryVerifier.js +163 -0
- package/dist/lib/service/bootstrap/UiStartupTasks.d.ts +22 -4
- package/dist/lib/service/bootstrap/UiStartupTasks.js +73 -5
- package/dist/lib/service/bootstrap/bootstrap-event-types.d.ts +54 -0
- package/dist/lib/service/bootstrap/bootstrap-event-types.js +10 -0
- package/dist/lib/service/cleanup/CleanupService.d.ts +85 -0
- package/dist/lib/service/cleanup/CleanupService.js +324 -0
- package/dist/lib/service/delivery/AgentInstructionsGenerator.js +39 -43
- package/dist/lib/service/delivery/FileProtection.d.ts +20 -0
- package/dist/lib/service/delivery/FileProtection.js +54 -0
- package/dist/lib/service/delivery/SkillsSyncer.js +16 -21
- package/dist/lib/service/evolution/ContentPatcher.d.ts +44 -0
- package/dist/lib/service/evolution/ContentPatcher.js +310 -0
- package/dist/lib/service/evolution/DecayDetector.d.ts +4 -3
- package/dist/lib/service/evolution/DecayDetector.js +97 -22
- package/dist/lib/service/evolution/KnowledgeMetabolism.d.ts +4 -2
- package/dist/lib/service/evolution/KnowledgeMetabolism.js +29 -2
- package/dist/lib/service/evolution/ProposalExecutor.d.ts +66 -0
- package/dist/lib/service/evolution/ProposalExecutor.js +424 -0
- package/dist/lib/service/evolution/RecipeLifecycleSupervisor.d.ts +64 -0
- package/dist/lib/service/evolution/RecipeLifecycleSupervisor.js +458 -0
- package/dist/lib/service/evolution/RecipeRelevanceAuditor.d.ts +89 -0
- package/dist/lib/service/evolution/RecipeRelevanceAuditor.js +492 -0
- package/dist/lib/service/evolution/StagingManager.js +5 -3
- package/dist/lib/service/evolution/createSupersedeProposal.d.ts +44 -0
- package/dist/lib/service/evolution/createSupersedeProposal.js +81 -0
- package/dist/lib/service/guard/ComplianceReporter.d.ts +4 -0
- package/dist/lib/service/guard/ComplianceReporter.js +51 -0
- package/dist/lib/service/guard/GuardCheckEngine.js +5 -4
- package/dist/lib/service/guard/GuardCrossFileChecks.js +2 -0
- package/dist/lib/service/guard/ReverseGuard.d.ts +1 -1
- package/dist/lib/service/guard/ReverseGuard.js +32 -2
- package/dist/lib/service/knowledge/ConfidenceRouter.js +1 -1
- package/dist/lib/service/knowledge/KnowledgeService.d.ts +11 -1
- package/dist/lib/service/knowledge/KnowledgeService.js +44 -4
- package/dist/lib/service/knowledge/RecipeProductionGateway.d.ts +225 -0
- package/dist/lib/service/knowledge/RecipeProductionGateway.js +384 -0
- package/dist/lib/service/knowledge/SourceRefReconciler.d.ts +2 -0
- package/dist/lib/service/knowledge/SourceRefReconciler.js +48 -0
- package/dist/lib/service/panorama/DimensionAnalyzer.d.ts +3 -2
- package/dist/lib/service/panorama/DimensionAnalyzer.js +15 -140
- package/dist/lib/service/search/BM25Scorer.d.ts +2 -2
- package/dist/lib/service/search/SearchEngine.d.ts +11 -10
- package/dist/lib/service/search/SearchEngine.js +38 -36
- package/dist/lib/service/search/SearchTypes.d.ts +14 -8
- package/dist/lib/service/search/SearchTypes.js +1 -1
- package/dist/lib/service/search/tokenizer.d.ts +1 -1
- package/dist/lib/service/search/tokenizer.js +2 -2
- package/dist/lib/shared/schemas/common.d.ts +4 -4
- package/dist/lib/shared/schemas/http-requests.d.ts +12 -1
- package/dist/lib/shared/schemas/http-requests.js +8 -0
- package/dist/lib/shared/schemas/mcp-tools.d.ts +33 -2
- package/dist/lib/shared/schemas/mcp-tools.js +42 -0
- package/dist/lib/types/evolution.d.ts +135 -0
- package/dist/lib/types/evolution.js +6 -0
- package/dist/lib/types/graph-shared.d.ts +25 -0
- package/dist/lib/types/graph-shared.js +7 -0
- package/dist/lib/types/knowledge-wire.d.ts +131 -0
- package/dist/lib/types/knowledge-wire.js +7 -0
- package/dist/lib/types/project-snapshot-builder.d.ts +19 -0
- package/dist/lib/types/project-snapshot-builder.js +189 -0
- package/dist/lib/types/project-snapshot.d.ts +399 -0
- package/dist/lib/types/project-snapshot.js +17 -0
- package/dist/lib/types/search-wire.d.ts +46 -0
- package/dist/lib/types/search-wire.js +7 -0
- package/dist/lib/types/snapshot-views.d.ts +58 -0
- package/dist/lib/types/snapshot-views.js +103 -0
- package/package.json +1 -1
- package/skills/autosnippet-recipes/SKILL.md +1 -1
- package/templates/instructions/agent-static.md +2 -0
- package/templates/instructions/conventions.md +3 -1
- package/templates/recipes-setup/README.md +2 -2
- package/dashboard/dist/assets/icons-BJ2mUBi8.js +0 -1
- package/dashboard/dist/assets/index-B659K9t5.js +0 -128
- package/dashboard/dist/assets/index-NCm40PMD.css +0 -1
- package/dist/lib/external/mcp/handlers/bootstrap/pipeline/noAiFallback.d.ts +0 -169
- package/dist/lib/external/mcp/handlers/bootstrap/pipeline/noAiFallback.js +0 -727
- package/dist/lib/external/mcp/handlers/bootstrap/shared/dimension-sop.d.ts +0 -370
- package/dist/lib/external/mcp/handlers/bootstrap/shared/dimension-sop.js +0 -821
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* evolution-tools.ts — Evolution Agent 专用工具
|
|
3
|
+
*
|
|
4
|
+
* 三个提案驱动的决策工具,供 Evolution Agent 在 rescan 时对现有 Recipe 做出明确决策:
|
|
5
|
+
* - propose_evolution: 附加进化提案(代码已变但知识仍有价值)
|
|
6
|
+
* - confirm_deprecation: 确认 Recipe 应被废弃(加速 deprecate 流程)
|
|
7
|
+
* - skip_evolution: 显式跳过进化决策(仍然有效或信息不足)
|
|
8
|
+
*
|
|
9
|
+
* @module agent/tools/evolution-tools
|
|
10
|
+
*/
|
|
11
|
+
// ──────────────────────────────────────────────────────────
|
|
12
|
+
// propose_evolution — 为现有 Recipe 附加进化提案
|
|
13
|
+
// ──────────────────────────────────────────────────────────
|
|
14
|
+
export const proposeEvolution = {
|
|
15
|
+
name: 'propose_evolution',
|
|
16
|
+
description: '为现有 Recipe 附加进化提案(代码已变化但知识仍有价值时使用,不创建新 Recipe)',
|
|
17
|
+
parameters: {
|
|
18
|
+
type: 'object',
|
|
19
|
+
properties: {
|
|
20
|
+
recipeId: { type: 'string', description: '目标 Recipe ID' },
|
|
21
|
+
type: {
|
|
22
|
+
type: 'string',
|
|
23
|
+
enum: ['enhance', 'correction'],
|
|
24
|
+
description: '提案类型: enhance=增强补充(代码迁移/扩展), correction=纠正错误(代码变更导致描述不准确)',
|
|
25
|
+
},
|
|
26
|
+
description: {
|
|
27
|
+
type: 'string',
|
|
28
|
+
description: '描述发生了什么变化、为什么需要更新(人类可读)',
|
|
29
|
+
},
|
|
30
|
+
evidence: {
|
|
31
|
+
type: 'object',
|
|
32
|
+
description: '代码验证证据',
|
|
33
|
+
properties: {
|
|
34
|
+
sourceStatus: {
|
|
35
|
+
type: 'string',
|
|
36
|
+
enum: ['exists', 'moved', 'modified', 'deleted'],
|
|
37
|
+
description: '源文件状态: exists=存在但内容变化, moved=迁移到新位置, modified=签名/结构变化, deleted=已删除但有替代',
|
|
38
|
+
},
|
|
39
|
+
currentCode: {
|
|
40
|
+
type: 'string',
|
|
41
|
+
description: '当前实际代码片段(验证时读到的)',
|
|
42
|
+
},
|
|
43
|
+
newLocation: {
|
|
44
|
+
type: 'string',
|
|
45
|
+
description: '新文件路径(仅 moved 时填写)',
|
|
46
|
+
},
|
|
47
|
+
suggestedChanges: {
|
|
48
|
+
type: 'string',
|
|
49
|
+
description: '建议对 Recipe 做出的具体更新',
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
required: ['sourceStatus', 'suggestedChanges'],
|
|
53
|
+
},
|
|
54
|
+
confidence: {
|
|
55
|
+
type: 'number',
|
|
56
|
+
description: '置信度 0.0-1.0(基于代码验证的确定程度)',
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
required: ['recipeId', 'type', 'description', 'evidence', 'confidence'],
|
|
60
|
+
},
|
|
61
|
+
handler: async (params, ctx) => {
|
|
62
|
+
const { recipeId, type, description, evidence, confidence } = params;
|
|
63
|
+
// 通过 ProposalRepository 创建提案
|
|
64
|
+
const proposalRepo = ctx.container.get('proposalRepository');
|
|
65
|
+
if (!proposalRepo) {
|
|
66
|
+
return {
|
|
67
|
+
status: 'error',
|
|
68
|
+
message: 'ProposalRepository not available',
|
|
69
|
+
recipeId,
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
const proposal = proposalRepo.create({
|
|
73
|
+
type,
|
|
74
|
+
targetRecipeId: recipeId,
|
|
75
|
+
relatedRecipeIds: [],
|
|
76
|
+
confidence: Math.max(0, Math.min(1, confidence)),
|
|
77
|
+
source: 'decay-scan',
|
|
78
|
+
description,
|
|
79
|
+
evidence: [
|
|
80
|
+
{
|
|
81
|
+
sourceStatus: evidence.sourceStatus,
|
|
82
|
+
currentCode: evidence.currentCode,
|
|
83
|
+
newLocation: evidence.newLocation,
|
|
84
|
+
suggestedChanges: evidence.suggestedChanges,
|
|
85
|
+
verifiedBy: 'evolution-agent',
|
|
86
|
+
verifiedAt: Date.now(),
|
|
87
|
+
},
|
|
88
|
+
],
|
|
89
|
+
});
|
|
90
|
+
if (!proposal) {
|
|
91
|
+
return {
|
|
92
|
+
status: 'error',
|
|
93
|
+
message: 'Failed to create proposal (target recipe may not exist or duplicate proposal)',
|
|
94
|
+
recipeId,
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
return {
|
|
98
|
+
status: 'proposed',
|
|
99
|
+
proposalId: proposal.id,
|
|
100
|
+
recipeId,
|
|
101
|
+
type,
|
|
102
|
+
expiresAt: proposal.expiresAt,
|
|
103
|
+
};
|
|
104
|
+
},
|
|
105
|
+
};
|
|
106
|
+
// ──────────────────────────────────────────────────────────
|
|
107
|
+
// confirm_deprecation — 确认 Recipe 应被废弃
|
|
108
|
+
// ──────────────────────────────────────────────────────────
|
|
109
|
+
export const confirmDeprecation = {
|
|
110
|
+
name: 'confirm_deprecation',
|
|
111
|
+
description: '确认一个衰退 Recipe 应被废弃(加速废弃流程,跳过观察窗口)',
|
|
112
|
+
parameters: {
|
|
113
|
+
type: 'object',
|
|
114
|
+
properties: {
|
|
115
|
+
recipeId: { type: 'string', description: '要废弃的 Recipe ID' },
|
|
116
|
+
reason: { type: 'string', description: '废弃原因(人类可读)' },
|
|
117
|
+
},
|
|
118
|
+
required: ['recipeId', 'reason'],
|
|
119
|
+
},
|
|
120
|
+
handler: async (params, ctx) => {
|
|
121
|
+
const { recipeId, reason } = params;
|
|
122
|
+
// 1. 通过 knowledgeService 将 lifecycle 转为 deprecated
|
|
123
|
+
const knowledgeService = ctx.container.get('knowledgeService');
|
|
124
|
+
const result = knowledgeService.deprecate(recipeId, reason, { userId: 'evolution-agent' });
|
|
125
|
+
// 2. 尝试解决关联的 deprecate proposal(status → executed)
|
|
126
|
+
try {
|
|
127
|
+
const proposalRepo = ctx.container.get('proposalRepository');
|
|
128
|
+
if (proposalRepo) {
|
|
129
|
+
const existing = proposalRepo.findByTarget(recipeId);
|
|
130
|
+
for (const p of existing) {
|
|
131
|
+
if (p.type === 'deprecate') {
|
|
132
|
+
proposalRepo.markExecuted(p.id, `Evolution Agent confirmed deprecation: ${reason}`, 'evolution-agent');
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
catch {
|
|
138
|
+
// ProposalRepository 不可用时静默失败
|
|
139
|
+
}
|
|
140
|
+
return { status: 'deprecated', recipeId, reason, result };
|
|
141
|
+
},
|
|
142
|
+
};
|
|
143
|
+
// ──────────────────────────────────────────────────────────
|
|
144
|
+
// skip_evolution — 显式跳过进化决策
|
|
145
|
+
// ──────────────────────────────────────────────────────────
|
|
146
|
+
export const skipEvolution = {
|
|
147
|
+
name: 'skip_evolution',
|
|
148
|
+
description: '显式跳过一个 Recipe 的进化决策(信息不足或不紧急,交给时限机制处理)',
|
|
149
|
+
parameters: {
|
|
150
|
+
type: 'object',
|
|
151
|
+
properties: {
|
|
152
|
+
recipeId: { type: 'string', description: '跳过的 Recipe ID' },
|
|
153
|
+
reason: { type: 'string', description: '跳过原因' },
|
|
154
|
+
},
|
|
155
|
+
required: ['recipeId', 'reason'],
|
|
156
|
+
},
|
|
157
|
+
handler: async (params, _ctx) => {
|
|
158
|
+
// 不修改 proposal 状态,仅记录决策
|
|
159
|
+
return { status: 'skipped', recipeId: params.recipeId, reason: params.reason };
|
|
160
|
+
},
|
|
161
|
+
};
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
import { enrichCandidate, refineBootstrapCandidates } from './ai-analysis.js';
|
|
7
7
|
import { getCategoryMap, getClassHierarchy, getClassInfo, getMethodOverrides, getPreviousAnalysis, getPreviousEvidence, getProjectOverview, getProtocolInfo, noteFinding, queryCallGraph, queryCodeGraph } from './ast-graph.js';
|
|
8
8
|
import { analyzeCode, getToolDetails, knowledgeOverview, planTask, reviewMyOutput, submitWithCheck } from './composite.js';
|
|
9
|
+
import { confirmDeprecation, proposeEvolution, skipEvolution } from './evolution-tools.js';
|
|
9
10
|
import { getRecommendations, guardCheckCode, listGuardRules, queryViolations } from './guard.js';
|
|
10
11
|
import { bootstrapKnowledgeTool, createSkillTool, graphImpactAnalysis, loadSkill, queryAuditLog, rebuildIndex, suggestSkills } from './infrastructure.js';
|
|
11
12
|
import { addGraphEdge, checkDuplicate } from './knowledge-graph.js';
|
|
@@ -14,76 +15,8 @@ import { getFileSummary, listProjectStructure, readProjectFile, searchProjectCod
|
|
|
14
15
|
import { getProjectStats, getRecipeDetail, getRelatedRecipes, searchCandidates, searchKnowledge, searchRecipes } from './query.js';
|
|
15
16
|
import { collectScanRecipe } from './scan-recipe.js';
|
|
16
17
|
import { getEnvironmentInfo, runSafeCommand, writeProjectFile } from './system-interaction.js';
|
|
17
|
-
export { searchProjectCode, readProjectFile, listProjectStructure, getFileSummary, semanticSearchCode, searchRecipes, searchCandidates, getRecipeDetail, getProjectStats, searchKnowledge, getRelatedRecipes, enrichCandidate, refineBootstrapCandidates, listGuardRules, getRecommendations, guardCheckCode, queryViolations, checkDuplicate, addGraphEdge, submitCandidate, approveCandidate, rejectCandidate, publishRecipe, deprecateRecipe, updateRecipe, recordUsage, qualityScore, validateCandidate, getFeedbackStats, graphImpactAnalysis, rebuildIndex, queryAuditLog, loadSkill, createSkillTool, suggestSkills, bootstrapKnowledgeTool, analyzeCode, knowledgeOverview, submitWithCheck, getToolDetails, planTask, reviewMyOutput, getProjectOverview, getClassHierarchy, getClassInfo, getProtocolInfo, getMethodOverrides, getCategoryMap, getPreviousAnalysis, noteFinding, getPreviousEvidence, queryCodeGraph, queryCallGraph, collectScanRecipe, runSafeCommand, writeProjectFile, getEnvironmentInfo, };
|
|
18
|
+
export { searchProjectCode, readProjectFile, listProjectStructure, getFileSummary, semanticSearchCode, searchRecipes, searchCandidates, getRecipeDetail, getProjectStats, searchKnowledge, getRelatedRecipes, enrichCandidate, refineBootstrapCandidates, listGuardRules, getRecommendations, guardCheckCode, queryViolations, checkDuplicate, addGraphEdge, submitCandidate, approveCandidate, rejectCandidate, publishRecipe, deprecateRecipe, updateRecipe, recordUsage, qualityScore, validateCandidate, getFeedbackStats, graphImpactAnalysis, rebuildIndex, queryAuditLog, loadSkill, createSkillTool, suggestSkills, bootstrapKnowledgeTool, analyzeCode, knowledgeOverview, submitWithCheck, getToolDetails, planTask, reviewMyOutput, getProjectOverview, getClassHierarchy, getClassInfo, getProtocolInfo, getMethodOverrides, getCategoryMap, getPreviousAnalysis, noteFinding, getPreviousEvidence, queryCodeGraph, queryCallGraph, collectScanRecipe, runSafeCommand, writeProjectFile, getEnvironmentInfo, proposeEvolution, confirmDeprecation, skipEvolution, };
|
|
18
19
|
export declare const ALL_TOOLS: ({
|
|
19
|
-
name: string;
|
|
20
|
-
description: string;
|
|
21
|
-
parameters: {
|
|
22
|
-
type: string;
|
|
23
|
-
properties: {
|
|
24
|
-
candidateIds: {
|
|
25
|
-
type: string;
|
|
26
|
-
items: {
|
|
27
|
-
type: string;
|
|
28
|
-
};
|
|
29
|
-
description: string;
|
|
30
|
-
};
|
|
31
|
-
};
|
|
32
|
-
required: string[];
|
|
33
|
-
};
|
|
34
|
-
handler: (params: Record<string, unknown>, ctx: import("./_shared.js").ToolHandlerContext) => Promise<{
|
|
35
|
-
total: number;
|
|
36
|
-
needsEnrichment: number;
|
|
37
|
-
needsRecipeFields: number;
|
|
38
|
-
fullyComplete: number;
|
|
39
|
-
entries: import("../../external/mcp/handlers/types.js").EnrichResultEntry[];
|
|
40
|
-
hint: string;
|
|
41
|
-
} | {
|
|
42
|
-
success: boolean;
|
|
43
|
-
errorCode: string | null;
|
|
44
|
-
message: string;
|
|
45
|
-
data: {
|
|
46
|
-
total: number;
|
|
47
|
-
needsEnrichment: number;
|
|
48
|
-
needsRecipeFields: number;
|
|
49
|
-
fullyComplete: number;
|
|
50
|
-
entries: import("../../external/mcp/handlers/types.js").EnrichResultEntry[];
|
|
51
|
-
hint: string;
|
|
52
|
-
} | null;
|
|
53
|
-
meta: {
|
|
54
|
-
source?: string | undefined;
|
|
55
|
-
responseTimeMs?: number | undefined;
|
|
56
|
-
version: string;
|
|
57
|
-
tool?: string | undefined;
|
|
58
|
-
};
|
|
59
|
-
} | {
|
|
60
|
-
error: string;
|
|
61
|
-
}>;
|
|
62
|
-
} | {
|
|
63
|
-
name: string;
|
|
64
|
-
description: string;
|
|
65
|
-
parameters: {
|
|
66
|
-
type: string;
|
|
67
|
-
properties: {
|
|
68
|
-
candidateIds: {
|
|
69
|
-
type: string;
|
|
70
|
-
items: {
|
|
71
|
-
type: string;
|
|
72
|
-
};
|
|
73
|
-
description: string;
|
|
74
|
-
};
|
|
75
|
-
userPrompt: {
|
|
76
|
-
type: string;
|
|
77
|
-
description: string;
|
|
78
|
-
};
|
|
79
|
-
dryRun: {
|
|
80
|
-
type: string;
|
|
81
|
-
description: string;
|
|
82
|
-
};
|
|
83
|
-
};
|
|
84
|
-
};
|
|
85
|
-
handler: (params: Record<string, unknown>, ctx: import("./_shared.js").ToolHandlerContext) => Promise<{}>;
|
|
86
|
-
} | {
|
|
87
20
|
name: string;
|
|
88
21
|
description: string;
|
|
89
22
|
parameters: {
|
|
@@ -397,13 +330,14 @@ export declare const ALL_TOOLS: ({
|
|
|
397
330
|
type: string;
|
|
398
331
|
description: string;
|
|
399
332
|
};
|
|
333
|
+
supersedes: {
|
|
334
|
+
type: string;
|
|
335
|
+
description: string;
|
|
336
|
+
};
|
|
400
337
|
};
|
|
401
338
|
required: string[];
|
|
402
339
|
};
|
|
403
340
|
handler: (params: import("./composite.js").SubmitWithCheckParams, ctx: import("./_shared.js").ToolHandlerContext) => Promise<{
|
|
404
|
-
status: string;
|
|
405
|
-
reason: string;
|
|
406
|
-
} | {
|
|
407
341
|
submitted: boolean;
|
|
408
342
|
status: string;
|
|
409
343
|
reason: string;
|
|
@@ -413,10 +347,19 @@ export declare const ALL_TOOLS: ({
|
|
|
413
347
|
confidence: string;
|
|
414
348
|
hint: string;
|
|
415
349
|
};
|
|
350
|
+
error?: undefined;
|
|
351
|
+
similar?: undefined;
|
|
352
|
+
highestSimilarity?: undefined;
|
|
353
|
+
} | {
|
|
354
|
+
submitted: boolean;
|
|
355
|
+
reason: string;
|
|
356
|
+
error: string;
|
|
357
|
+
status?: undefined;
|
|
358
|
+
errors?: undefined;
|
|
359
|
+
warnings?: undefined;
|
|
360
|
+
_meta?: undefined;
|
|
416
361
|
similar?: undefined;
|
|
417
362
|
highestSimilarity?: undefined;
|
|
418
|
-
entry?: undefined;
|
|
419
|
-
error?: undefined;
|
|
420
363
|
} | {
|
|
421
364
|
submitted: boolean;
|
|
422
365
|
reason: string;
|
|
@@ -433,37 +376,28 @@ export declare const ALL_TOOLS: ({
|
|
|
433
376
|
status?: undefined;
|
|
434
377
|
errors?: undefined;
|
|
435
378
|
warnings?: undefined;
|
|
436
|
-
entry?: undefined;
|
|
437
379
|
error?: undefined;
|
|
438
380
|
} | {
|
|
381
|
+
_meta: {
|
|
382
|
+
confidence: string;
|
|
383
|
+
hint: string;
|
|
384
|
+
};
|
|
385
|
+
_supersedeProposal?: {
|
|
386
|
+
proposalId: string;
|
|
387
|
+
} | undefined;
|
|
439
388
|
submitted: boolean;
|
|
440
|
-
entry:
|
|
389
|
+
entry: unknown;
|
|
441
390
|
similar: {
|
|
442
391
|
file: string;
|
|
443
392
|
title: string;
|
|
444
393
|
similarity: number;
|
|
445
394
|
}[];
|
|
446
|
-
_meta: {
|
|
447
|
-
confidence: string;
|
|
448
|
-
hint: string;
|
|
449
|
-
};
|
|
450
395
|
status?: undefined;
|
|
451
396
|
reason?: undefined;
|
|
452
397
|
errors?: undefined;
|
|
453
398
|
warnings?: undefined;
|
|
454
|
-
highestSimilarity?: undefined;
|
|
455
399
|
error?: undefined;
|
|
456
|
-
} | {
|
|
457
|
-
submitted: boolean;
|
|
458
|
-
reason: string;
|
|
459
|
-
error: string;
|
|
460
|
-
status?: undefined;
|
|
461
|
-
errors?: undefined;
|
|
462
|
-
warnings?: undefined;
|
|
463
|
-
_meta?: undefined;
|
|
464
|
-
similar?: undefined;
|
|
465
400
|
highestSimilarity?: undefined;
|
|
466
|
-
entry?: undefined;
|
|
467
401
|
}>;
|
|
468
402
|
} | {
|
|
469
403
|
name: string;
|
|
@@ -592,6 +526,71 @@ export declare const ALL_TOOLS: ({
|
|
|
592
526
|
}[];
|
|
593
527
|
message: string;
|
|
594
528
|
}>;
|
|
529
|
+
} | {
|
|
530
|
+
name: string;
|
|
531
|
+
description: string;
|
|
532
|
+
parameters: {
|
|
533
|
+
type: string;
|
|
534
|
+
properties: {
|
|
535
|
+
recipeId: {
|
|
536
|
+
type: string;
|
|
537
|
+
description: string;
|
|
538
|
+
};
|
|
539
|
+
type: {
|
|
540
|
+
type: string;
|
|
541
|
+
enum: string[];
|
|
542
|
+
description: string;
|
|
543
|
+
};
|
|
544
|
+
description: {
|
|
545
|
+
type: string;
|
|
546
|
+
description: string;
|
|
547
|
+
};
|
|
548
|
+
evidence: {
|
|
549
|
+
type: string;
|
|
550
|
+
description: string;
|
|
551
|
+
properties: {
|
|
552
|
+
sourceStatus: {
|
|
553
|
+
type: string;
|
|
554
|
+
enum: string[];
|
|
555
|
+
description: string;
|
|
556
|
+
};
|
|
557
|
+
currentCode: {
|
|
558
|
+
type: string;
|
|
559
|
+
description: string;
|
|
560
|
+
};
|
|
561
|
+
newLocation: {
|
|
562
|
+
type: string;
|
|
563
|
+
description: string;
|
|
564
|
+
};
|
|
565
|
+
suggestedChanges: {
|
|
566
|
+
type: string;
|
|
567
|
+
description: string;
|
|
568
|
+
};
|
|
569
|
+
};
|
|
570
|
+
required: string[];
|
|
571
|
+
};
|
|
572
|
+
confidence: {
|
|
573
|
+
type: string;
|
|
574
|
+
description: string;
|
|
575
|
+
};
|
|
576
|
+
};
|
|
577
|
+
required: string[];
|
|
578
|
+
};
|
|
579
|
+
handler: (params: import("./evolution-tools.js").ProposeEvolutionParams, ctx: import("./_shared.js").ToolHandlerContext) => Promise<{
|
|
580
|
+
status: "error";
|
|
581
|
+
message: string;
|
|
582
|
+
recipeId: string;
|
|
583
|
+
proposalId?: undefined;
|
|
584
|
+
type?: undefined;
|
|
585
|
+
expiresAt?: undefined;
|
|
586
|
+
} | {
|
|
587
|
+
status: "proposed";
|
|
588
|
+
proposalId: string;
|
|
589
|
+
recipeId: string;
|
|
590
|
+
type: "enhance" | "correction";
|
|
591
|
+
expiresAt: number;
|
|
592
|
+
message?: undefined;
|
|
593
|
+
}>;
|
|
595
594
|
} | {
|
|
596
595
|
name: string;
|
|
597
596
|
description: string;
|
|
@@ -1024,10 +1023,14 @@ export declare const ALL_TOOLS: ({
|
|
|
1024
1023
|
type: string;
|
|
1025
1024
|
description: string;
|
|
1026
1025
|
};
|
|
1026
|
+
supersedes: {
|
|
1027
|
+
type: string;
|
|
1028
|
+
description: string;
|
|
1029
|
+
};
|
|
1027
1030
|
};
|
|
1028
1031
|
required: string[];
|
|
1029
1032
|
};
|
|
1030
|
-
handler: (params: import("./lifecycle.js").SubmitKnowledgeParams, ctx: import("./_shared.js").ToolHandlerContext) => Promise<
|
|
1033
|
+
handler: (params: import("./lifecycle.js").SubmitKnowledgeParams, ctx: import("./_shared.js").ToolHandlerContext) => Promise<Record<string, unknown>>;
|
|
1031
1034
|
} | {
|
|
1032
1035
|
name: string;
|
|
1033
1036
|
description: string;
|
|
@@ -1850,5 +1853,73 @@ export declare const ALL_TOOLS: ({
|
|
|
1850
1853
|
required: never[];
|
|
1851
1854
|
};
|
|
1852
1855
|
handler: (params: import("./system-interaction.js").GetEnvironmentInfoParams, ctx: import("./_shared.js").ToolHandlerContext) => Promise<import("./system-interaction.js").EnvironmentInfo>;
|
|
1856
|
+
} | {
|
|
1857
|
+
name: string;
|
|
1858
|
+
description: string;
|
|
1859
|
+
parameters: {
|
|
1860
|
+
type: string;
|
|
1861
|
+
properties: {
|
|
1862
|
+
candidateIds: {
|
|
1863
|
+
type: string;
|
|
1864
|
+
items: {
|
|
1865
|
+
type: string;
|
|
1866
|
+
};
|
|
1867
|
+
description: string;
|
|
1868
|
+
};
|
|
1869
|
+
};
|
|
1870
|
+
required: string[];
|
|
1871
|
+
};
|
|
1872
|
+
handler: (params: Record<string, unknown>, ctx: import("./_shared.js").ToolHandlerContext) => Promise<{
|
|
1873
|
+
total: number;
|
|
1874
|
+
needsEnrichment: number;
|
|
1875
|
+
needsRecipeFields: number;
|
|
1876
|
+
fullyComplete: number;
|
|
1877
|
+
entries: import("../../external/mcp/handlers/types.js").EnrichResultEntry[];
|
|
1878
|
+
hint: string;
|
|
1879
|
+
} | {
|
|
1880
|
+
success: boolean;
|
|
1881
|
+
errorCode: string | null;
|
|
1882
|
+
message: string;
|
|
1883
|
+
data: {
|
|
1884
|
+
total: number;
|
|
1885
|
+
needsEnrichment: number;
|
|
1886
|
+
needsRecipeFields: number;
|
|
1887
|
+
fullyComplete: number;
|
|
1888
|
+
entries: import("../../external/mcp/handlers/types.js").EnrichResultEntry[];
|
|
1889
|
+
hint: string;
|
|
1890
|
+
} | null;
|
|
1891
|
+
meta: {
|
|
1892
|
+
source?: string | undefined;
|
|
1893
|
+
responseTimeMs?: number | undefined;
|
|
1894
|
+
version: string;
|
|
1895
|
+
tool?: string | undefined;
|
|
1896
|
+
};
|
|
1897
|
+
} | {
|
|
1898
|
+
error: string;
|
|
1899
|
+
}>;
|
|
1900
|
+
} | {
|
|
1901
|
+
name: string;
|
|
1902
|
+
description: string;
|
|
1903
|
+
parameters: {
|
|
1904
|
+
type: string;
|
|
1905
|
+
properties: {
|
|
1906
|
+
candidateIds: {
|
|
1907
|
+
type: string;
|
|
1908
|
+
items: {
|
|
1909
|
+
type: string;
|
|
1910
|
+
};
|
|
1911
|
+
description: string;
|
|
1912
|
+
};
|
|
1913
|
+
userPrompt: {
|
|
1914
|
+
type: string;
|
|
1915
|
+
description: string;
|
|
1916
|
+
};
|
|
1917
|
+
dryRun: {
|
|
1918
|
+
type: string;
|
|
1919
|
+
description: string;
|
|
1920
|
+
};
|
|
1921
|
+
};
|
|
1922
|
+
};
|
|
1923
|
+
handler: (params: Record<string, unknown>, ctx: import("./_shared.js").ToolHandlerContext) => Promise<{}>;
|
|
1853
1924
|
})[];
|
|
1854
1925
|
export default ALL_TOOLS;
|
|
@@ -9,6 +9,8 @@ import { enrichCandidate, refineBootstrapCandidates } from './ai-analysis.js';
|
|
|
9
9
|
import { getCategoryMap, getClassHierarchy, getClassInfo, getMethodOverrides, getPreviousAnalysis, getPreviousEvidence, getProjectOverview, getProtocolInfo, noteFinding, queryCallGraph, queryCodeGraph, } from './ast-graph.js';
|
|
10
10
|
// ── 组合工具 + 元工具 (6) ──
|
|
11
11
|
import { analyzeCode, getToolDetails, knowledgeOverview, planTask, reviewMyOutput, submitWithCheck, } from './composite.js';
|
|
12
|
+
// ── Evolution Agent 工具 (3) ──
|
|
13
|
+
import { confirmDeprecation, proposeEvolution, skipEvolution } from './evolution-tools.js';
|
|
12
14
|
// ── Guard 安全类 (4) ──
|
|
13
15
|
import { getRecommendations, guardCheckCode, listGuardRules, queryViolations } from './guard.js';
|
|
14
16
|
// ── 基础设施类 (7) ──
|
|
@@ -54,7 +56,9 @@ queryCallGraph,
|
|
|
54
56
|
// 扫描 Recipe 收集
|
|
55
57
|
collectScanRecipe,
|
|
56
58
|
// 系统交互类
|
|
57
|
-
runSafeCommand, writeProjectFile, getEnvironmentInfo,
|
|
59
|
+
runSafeCommand, writeProjectFile, getEnvironmentInfo,
|
|
60
|
+
// Evolution Agent 工具
|
|
61
|
+
proposeEvolution, confirmDeprecation, skipEvolution, };
|
|
58
62
|
// ── ALL_TOOLS 数组(与原始 tools.js 顺序一致)──
|
|
59
63
|
export const ALL_TOOLS = [
|
|
60
64
|
// 项目数据访问 (5) — 含 v10 Agent-Pull 工具
|
|
@@ -131,5 +135,9 @@ export const ALL_TOOLS = [
|
|
|
131
135
|
getEnvironmentInfo,
|
|
132
136
|
// 扫描 Recipe 收集 (1) — scanKnowledge produce 阶段专用
|
|
133
137
|
collectScanRecipe,
|
|
138
|
+
// Evolution Agent 工具 (3) — 提案驱动的 Recipe 进化决策
|
|
139
|
+
proposeEvolution,
|
|
140
|
+
confirmDeprecation,
|
|
141
|
+
skipEvolution,
|
|
134
142
|
];
|
|
135
143
|
export default ALL_TOOLS;
|
|
@@ -42,6 +42,8 @@ export interface SubmitKnowledgeParams {
|
|
|
42
42
|
usageGuide?: string;
|
|
43
43
|
sourceFile?: string;
|
|
44
44
|
_category?: string;
|
|
45
|
+
/** 被替代的旧 Recipe ID(进化架构入口) */
|
|
46
|
+
supersedes?: string;
|
|
45
47
|
[key: string]: unknown;
|
|
46
48
|
}
|
|
47
49
|
export declare const submitCandidate: {
|
|
@@ -132,10 +134,14 @@ export declare const submitCandidate: {
|
|
|
132
134
|
type: string;
|
|
133
135
|
description: string;
|
|
134
136
|
};
|
|
137
|
+
supersedes: {
|
|
138
|
+
type: string;
|
|
139
|
+
description: string;
|
|
140
|
+
};
|
|
135
141
|
};
|
|
136
142
|
required: string[];
|
|
137
143
|
};
|
|
138
|
-
handler: (params: SubmitKnowledgeParams, ctx: ToolHandlerContext) => Promise<
|
|
144
|
+
handler: (params: SubmitKnowledgeParams, ctx: ToolHandlerContext) => Promise<Record<string, unknown>>;
|
|
139
145
|
};
|
|
140
146
|
export declare const approveCandidate: {
|
|
141
147
|
name: string;
|