autosnippet 3.3.0 → 3.3.3
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/dashboard/dist/assets/icons-BJ2mUBi8.js +1 -0
- package/dashboard/dist/assets/index-B659K9t5.js +128 -0
- package/dashboard/dist/assets/index-NCm40PMD.css +1 -0
- package/dashboard/dist/index.html +3 -3
- package/dist/bin/cli.d.ts +1 -0
- package/dist/bin/cli.js +284 -142
- package/dist/lib/agent/context/ExplorationTracker.d.ts +2 -0
- package/dist/lib/agent/context/ExplorationTracker.js +21 -3
- package/dist/lib/agent/core/ToolExecutionPipeline.d.ts +3 -1
- package/dist/lib/agent/core/ToolExecutionPipeline.js +8 -1
- package/dist/lib/agent/forge/DynamicComposer.d.ts +58 -0
- package/dist/lib/agent/forge/DynamicComposer.js +99 -0
- package/dist/lib/agent/forge/SandboxRunner.d.ts +60 -0
- package/dist/lib/agent/forge/SandboxRunner.js +251 -0
- package/dist/lib/agent/forge/TemporaryToolRegistry.d.ts +76 -0
- package/dist/lib/agent/forge/TemporaryToolRegistry.js +154 -0
- package/dist/lib/agent/forge/ToolForge.d.ts +92 -0
- package/dist/lib/agent/forge/ToolForge.js +239 -0
- package/dist/lib/agent/forge/ToolRequirementAnalyzer.d.ts +44 -0
- package/dist/lib/agent/forge/ToolRequirementAnalyzer.js +119 -0
- package/dist/lib/agent/tools/ToolRegistry.d.ts +2 -0
- package/dist/lib/agent/tools/ToolRegistry.js +4 -0
- package/dist/lib/agent/tools/composite.js +0 -1
- package/dist/lib/agent/tools/index.d.ts +2 -50
- package/dist/lib/agent/tools/index.js +2 -3
- package/dist/lib/agent/tools/lifecycle.d.ts +1 -58
- package/dist/lib/agent/tools/lifecycle.js +2 -75
- package/dist/lib/cli/KnowledgeSyncService.d.ts +26 -0
- package/dist/lib/cli/KnowledgeSyncService.js +33 -1
- package/dist/lib/cli/deploy/FileManifest.d.ts +0 -21
- package/dist/lib/cli/deploy/FileManifest.js +0 -11
- package/dist/lib/domain/knowledge/KnowledgeEntry.d.ts +10 -0
- package/dist/lib/domain/knowledge/KnowledgeEntry.js +2 -0
- package/dist/lib/domain/knowledge/Lifecycle.d.ts +19 -2
- package/dist/lib/domain/knowledge/Lifecycle.js +32 -6
- package/dist/lib/domain/knowledge/UnifiedValidator.d.ts +1 -5
- package/dist/lib/domain/knowledge/UnifiedValidator.js +7 -44
- package/dist/lib/domain/knowledge/values/Stats.d.ts +29 -0
- package/dist/lib/domain/knowledge/values/Stats.js +41 -0
- package/dist/lib/external/mcp/McpServer.d.ts +19 -38
- package/dist/lib/external/mcp/McpServer.js +145 -117
- package/dist/lib/external/mcp/autoApproveInjector.js +0 -2
- package/dist/lib/external/mcp/handlers/bootstrap/MissionBriefingBuilder.d.ts +26 -1
- package/dist/lib/external/mcp/handlers/bootstrap/MissionBriefingBuilder.js +41 -0
- package/dist/lib/external/mcp/handlers/bootstrap/pipeline/orchestrator.js +49 -0
- package/dist/lib/external/mcp/handlers/bootstrap/shared/bootstrap-phases.d.ts +3 -0
- package/dist/lib/external/mcp/handlers/bootstrap/shared/bootstrap-phases.js +27 -0
- package/dist/lib/external/mcp/handlers/bootstrap/skills.js +1 -1
- package/dist/lib/external/mcp/handlers/bootstrap-external.js +1 -0
- package/dist/lib/external/mcp/handlers/bootstrap-internal.js +2 -0
- package/dist/lib/external/mcp/handlers/browse.d.ts +1 -0
- package/dist/lib/external/mcp/handlers/browse.js +2 -1
- package/dist/lib/external/mcp/handlers/consolidated.d.ts +117 -6
- package/dist/lib/external/mcp/handlers/consolidated.js +251 -71
- package/dist/lib/external/mcp/handlers/guard.d.ts +150 -0
- package/dist/lib/external/mcp/handlers/guard.js +239 -5
- package/dist/lib/external/mcp/handlers/knowledge.d.ts +0 -29
- package/dist/lib/external/mcp/handlers/knowledge.js +1 -76
- package/dist/lib/external/mcp/handlers/panorama.d.ts +36 -0
- package/dist/lib/external/mcp/handlers/panorama.js +156 -0
- package/dist/lib/external/mcp/handlers/system.d.ts +2 -54
- package/dist/lib/external/mcp/handlers/system.js +3 -113
- package/dist/lib/external/mcp/handlers/task.d.ts +13 -24
- package/dist/lib/external/mcp/handlers/task.js +218 -557
- package/dist/lib/external/mcp/handlers/types.d.ts +91 -8
- package/dist/lib/external/mcp/handlers/types.js +18 -1
- package/dist/lib/external/mcp/handlers/wiki-external.d.ts +18 -1
- package/dist/lib/external/mcp/handlers/wiki-external.js +16 -1
- package/dist/lib/external/mcp/tools.d.ts +18 -24
- package/dist/lib/external/mcp/tools.js +132 -159
- package/dist/lib/http/HttpServer.js +52 -0
- package/dist/lib/http/middleware/validate.js +7 -3
- package/dist/lib/http/routes/audit.d.ts +8 -0
- package/dist/lib/http/routes/audit.js +51 -0
- package/dist/lib/http/routes/guardReport.d.ts +10 -0
- package/dist/lib/http/routes/guardReport.js +143 -0
- package/dist/lib/http/routes/knowledge.js +32 -1
- package/dist/lib/http/routes/panorama.d.ts +11 -0
- package/dist/lib/http/routes/panorama.js +322 -0
- package/dist/lib/http/routes/signals.d.ts +10 -0
- package/dist/lib/http/routes/signals.js +104 -0
- package/dist/lib/http/routes/task.d.ts +2 -3
- package/dist/lib/http/routes/task.js +17 -347
- package/dist/lib/http/routes/violations.js +1 -1
- package/dist/lib/infrastructure/audit/AuditLogger.d.ts +6 -1
- package/dist/lib/infrastructure/audit/AuditLogger.js +14 -1
- package/dist/lib/infrastructure/database/drizzle/schema.d.ts +202 -504
- package/dist/lib/infrastructure/database/drizzle/schema.js +38 -69
- package/dist/lib/infrastructure/database/migrations/004_evolution_proposals.d.ts +8 -0
- package/dist/lib/infrastructure/database/migrations/004_evolution_proposals.js +43 -0
- package/dist/lib/infrastructure/database/migrations/005_recipe_source_refs.d.ts +9 -0
- package/dist/lib/infrastructure/database/migrations/005_recipe_source_refs.js +24 -0
- package/dist/lib/infrastructure/logging/Logger.d.ts +2 -0
- package/dist/lib/infrastructure/logging/Logger.js +34 -7
- package/dist/lib/infrastructure/monitoring/ErrorTracker.js +3 -1
- package/dist/lib/infrastructure/monitoring/PerformanceMonitor.d.ts +2 -2
- package/dist/lib/infrastructure/monitoring/PerformanceMonitor.js +12 -10
- package/dist/lib/infrastructure/notification/LarkNotifier.d.ts +24 -0
- package/dist/lib/infrastructure/notification/LarkNotifier.js +97 -0
- package/dist/lib/infrastructure/report/ReportStore.d.ts +45 -0
- package/dist/lib/infrastructure/report/ReportStore.js +133 -0
- package/dist/lib/infrastructure/signal/SignalAggregator.d.ts +18 -0
- package/dist/lib/infrastructure/signal/SignalAggregator.js +84 -0
- package/dist/lib/infrastructure/signal/SignalBridge.d.ts +13 -0
- package/dist/lib/infrastructure/signal/SignalBridge.js +20 -0
- package/dist/lib/infrastructure/signal/SignalBus.d.ts +63 -0
- package/dist/lib/infrastructure/signal/SignalBus.js +106 -0
- package/dist/lib/infrastructure/signal/SignalTraceWriter.d.ts +36 -0
- package/dist/lib/infrastructure/signal/SignalTraceWriter.js +130 -0
- package/dist/lib/infrastructure/vector/HnswVectorAdapter.js +18 -2
- package/dist/lib/injection/ServiceContainer.js +8 -0
- package/dist/lib/injection/ServiceMap.d.ts +16 -10
- package/dist/lib/injection/modules/AgentModule.d.ts +1 -1
- package/dist/lib/injection/modules/AgentModule.js +7 -1
- package/dist/lib/injection/modules/AppModule.d.ts +1 -1
- package/dist/lib/injection/modules/AppModule.js +4 -13
- package/dist/lib/injection/modules/GuardModule.js +27 -2
- package/dist/lib/injection/modules/InfraModule.d.ts +0 -1
- package/dist/lib/injection/modules/InfraModule.js +9 -7
- package/dist/lib/injection/modules/KnowledgeModule.d.ts +5 -0
- package/dist/lib/injection/modules/KnowledgeModule.js +131 -0
- package/dist/lib/injection/modules/PanoramaModule.d.ts +18 -0
- package/dist/lib/injection/modules/PanoramaModule.js +76 -0
- package/dist/lib/injection/modules/SignalModule.d.ts +10 -0
- package/dist/lib/injection/modules/SignalModule.js +84 -0
- package/dist/lib/repository/knowledge/KnowledgeRepository.impl.d.ts +1 -0
- package/dist/lib/repository/knowledge/KnowledgeRepository.impl.js +6 -0
- package/dist/lib/service/bootstrap/BootstrapTaskManager.d.ts +3 -1
- package/dist/lib/service/bootstrap/BootstrapTaskManager.js +20 -1
- package/dist/lib/service/bootstrap/UiStartupTasks.d.ts +45 -0
- package/dist/lib/service/bootstrap/UiStartupTasks.js +101 -0
- package/dist/lib/service/delivery/AgentInstructionsGenerator.js +4 -5
- package/dist/lib/service/delivery/CursorDeliveryPipeline.d.ts +3 -1
- package/dist/lib/service/delivery/CursorDeliveryPipeline.js +13 -10
- package/dist/lib/service/delivery/RulesGenerator.js +3 -2
- package/dist/lib/service/evolution/ConsolidationAdvisor.d.ts +114 -0
- package/dist/lib/service/evolution/ConsolidationAdvisor.js +542 -0
- package/dist/lib/service/evolution/ContradictionDetector.d.ts +54 -0
- package/dist/lib/service/evolution/ContradictionDetector.js +253 -0
- package/dist/lib/service/evolution/DecayDetector.d.ts +71 -0
- package/dist/lib/service/evolution/DecayDetector.js +244 -0
- package/dist/lib/service/evolution/EnhancementSuggester.d.ts +38 -0
- package/dist/lib/service/evolution/EnhancementSuggester.js +220 -0
- package/dist/lib/service/evolution/KnowledgeMetabolism.d.ts +82 -0
- package/dist/lib/service/evolution/KnowledgeMetabolism.js +167 -0
- package/dist/lib/service/evolution/RedundancyAnalyzer.d.ts +53 -0
- package/dist/lib/service/evolution/RedundancyAnalyzer.js +210 -0
- package/dist/lib/service/evolution/StagingManager.d.ts +57 -0
- package/dist/lib/service/evolution/StagingManager.js +201 -0
- package/dist/lib/service/guard/ComplianceReporter.d.ts +42 -2
- package/dist/lib/service/guard/ComplianceReporter.js +43 -5
- package/dist/lib/service/guard/CoverageAnalyzer.d.ts +54 -0
- package/dist/lib/service/guard/CoverageAnalyzer.js +149 -0
- package/dist/lib/service/guard/GuardCheckEngine.d.ts +42 -0
- package/dist/lib/service/guard/GuardCheckEngine.js +465 -14
- package/dist/lib/service/guard/GuardFeedbackLoop.d.ts +3 -0
- package/dist/lib/service/guard/GuardFeedbackLoop.js +9 -0
- package/dist/lib/service/guard/ReverseGuard.d.ts +73 -0
- package/dist/lib/service/guard/ReverseGuard.js +256 -0
- package/dist/lib/service/guard/RuleLearner.d.ts +12 -0
- package/dist/lib/service/guard/RuleLearner.js +38 -0
- package/dist/lib/service/guard/UncertaintyCollector.d.ts +83 -0
- package/dist/lib/service/guard/UncertaintyCollector.js +149 -0
- package/dist/lib/service/guard/ViolationsStore.d.ts +1 -0
- package/dist/lib/service/guard/ViolationsStore.js +33 -3
- package/dist/lib/service/knowledge/ConfidenceRouter.d.ts +13 -0
- package/dist/lib/service/knowledge/ConfidenceRouter.js +14 -0
- package/dist/lib/service/knowledge/KnowledgeService.js +22 -4
- package/dist/lib/service/knowledge/SourceRefReconciler.d.ts +68 -0
- package/dist/lib/service/knowledge/SourceRefReconciler.js +309 -0
- package/dist/lib/service/panorama/CouplingAnalyzer.d.ts +27 -0
- package/dist/lib/service/panorama/CouplingAnalyzer.js +192 -0
- package/dist/lib/service/panorama/DimensionAnalyzer.d.ts +28 -0
- package/dist/lib/service/panorama/DimensionAnalyzer.js +320 -0
- package/dist/lib/service/panorama/LayerInferrer.d.ts +19 -0
- package/dist/lib/service/panorama/LayerInferrer.js +182 -0
- package/dist/lib/service/panorama/ModuleDiscoverer.d.ts +24 -0
- package/dist/lib/service/panorama/ModuleDiscoverer.js +185 -0
- package/dist/lib/service/panorama/PanoramaAggregator.d.ts +29 -0
- package/dist/lib/service/panorama/PanoramaAggregator.js +228 -0
- package/dist/lib/service/panorama/PanoramaScanner.d.ts +52 -0
- package/dist/lib/service/panorama/PanoramaScanner.js +188 -0
- package/dist/lib/service/panorama/PanoramaService.d.ts +125 -0
- package/dist/lib/service/panorama/PanoramaService.js +363 -0
- package/dist/lib/service/panorama/PanoramaTypes.d.ts +134 -0
- package/dist/lib/service/panorama/PanoramaTypes.js +6 -0
- package/dist/lib/service/panorama/RoleRefiner.d.ts +48 -0
- package/dist/lib/service/panorama/RoleRefiner.js +535 -0
- package/dist/lib/service/search/BM25Scorer.d.ts +2 -2
- package/dist/lib/service/search/CoarseRanker.d.ts +7 -6
- package/dist/lib/service/search/CoarseRanker.js +11 -10
- package/dist/lib/service/search/FieldWeightedScorer.d.ts +81 -0
- package/dist/lib/service/search/FieldWeightedScorer.js +318 -0
- package/dist/lib/service/search/MultiSignalRanker.d.ts +3 -2
- package/dist/lib/service/search/MultiSignalRanker.js +17 -1
- package/dist/lib/service/search/SearchEngine.d.ts +9 -7
- package/dist/lib/service/search/SearchEngine.js +67 -10
- package/dist/lib/service/search/SearchTypes.d.ts +25 -3
- package/dist/lib/service/search/SearchTypes.js +6 -1
- package/dist/lib/service/signal/HitRecorder.d.ts +68 -0
- package/dist/lib/service/signal/HitRecorder.js +173 -0
- package/dist/lib/service/skills/SignalCollector.d.ts +3 -1
- package/dist/lib/service/skills/SignalCollector.js +31 -1
- package/dist/lib/service/task/IntentExtractor.d.ts +66 -0
- package/dist/lib/service/task/IntentExtractor.js +256 -0
- package/dist/lib/service/task/PrimeSearchPipeline.d.ts +54 -0
- package/dist/lib/service/task/PrimeSearchPipeline.js +113 -0
- package/dist/lib/service/vector/VectorService.d.ts +3 -0
- package/dist/lib/service/vector/VectorService.js +38 -4
- package/dist/lib/shared/schemas/mcp-tools.d.ts +41 -96
- package/dist/lib/shared/schemas/mcp-tools.js +59 -119
- package/dist/scripts/analyze-signals.d.ts +20 -0
- package/dist/scripts/analyze-signals.js +155 -0
- package/dist/scripts/diagnose-mcp.js +1 -1
- package/package.json +1 -1
- package/skills/autosnippet-create/SKILL.md +98 -89
- package/skills/autosnippet-devdocs/SKILL.md +55 -57
- package/templates/claude-code/hooks/autosnippet-session.sh +10 -15
- package/templates/cursor-hooks/hooks/session-start.sh +1 -1
- package/templates/guard-ci.yml +2 -2
- package/templates/instructions/agent-static.md +2 -1
- package/templates/instructions/conventions.md +5 -6
- package/templates/recipes-setup/README.md +1 -2
- package/templates/recipes-setup/_template.md +39 -39
- package/dashboard/dist/assets/icons-BofcEZ3f.js +0 -1
- package/dashboard/dist/assets/index-D0whuycy.css +0 -1
- package/dashboard/dist/assets/index-SiN1GChm.js +0 -128
- package/dist/lib/domain/task/Task.d.ts +0 -140
- package/dist/lib/domain/task/Task.js +0 -254
- package/dist/lib/domain/task/TaskDependency.d.ts +0 -23
- package/dist/lib/domain/task/TaskDependency.js +0 -34
- package/dist/lib/domain/task/TaskIdGenerator.d.ts +0 -40
- package/dist/lib/domain/task/TaskIdGenerator.js +0 -75
- package/dist/lib/domain/task/index.d.ts +0 -4
- package/dist/lib/domain/task/index.js +0 -4
- package/dist/lib/infrastructure/database/migrations/002_add_tasks.d.ts +0 -11
- package/dist/lib/infrastructure/database/migrations/002_add_tasks.js +0 -86
- package/dist/lib/repository/task/TaskRepository.impl.d.ts +0 -171
- package/dist/lib/repository/task/TaskRepository.impl.js +0 -347
- package/dist/lib/service/task/TaskGraphService.d.ts +0 -222
- package/dist/lib/service/task/TaskGraphService.js +0 -597
- package/dist/lib/service/task/TaskKnowledgeBridge.d.ts +0 -95
- package/dist/lib/service/task/TaskKnowledgeBridge.js +0 -298
- package/dist/lib/service/task/TaskReadyEngine.d.ts +0 -84
- package/dist/lib/service/task/TaskReadyEngine.js +0 -115
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ToolForge — 工具锻造主编排器
|
|
3
|
+
*
|
|
4
|
+
* 三级锻造策略:
|
|
5
|
+
* Reuse (0ms) → 直接重用注册表中已有工具
|
|
6
|
+
* Compose (10ms) → 通过 DynamicComposer 组合已有原子工具
|
|
7
|
+
* Generate (5s) → LLM 生成工具代码 → SandboxRunner 验证 → 注册
|
|
8
|
+
*
|
|
9
|
+
* 瀑布逻辑:reuse → compose → generate,首个成功即返回。
|
|
10
|
+
*/
|
|
11
|
+
import type { SignalBus } from '#infra/signal/SignalBus.js';
|
|
12
|
+
import type { CompositionSpec } from './DynamicComposer.js';
|
|
13
|
+
import type { SandboxTestCase } from './SandboxRunner.js';
|
|
14
|
+
import { TemporaryToolRegistry } from './TemporaryToolRegistry.js';
|
|
15
|
+
import type { AnalysisResult, ToolRequirement } from './ToolRequirementAnalyzer.js';
|
|
16
|
+
import { ToolRequirementAnalyzer } from './ToolRequirementAnalyzer.js';
|
|
17
|
+
interface ToolRegistryLike {
|
|
18
|
+
has(name: string): boolean;
|
|
19
|
+
getToolNames(): string[];
|
|
20
|
+
execute(name: string, params: Record<string, unknown>, context?: Record<string, unknown>): Promise<unknown>;
|
|
21
|
+
register(toolDef: {
|
|
22
|
+
name: string;
|
|
23
|
+
description: string;
|
|
24
|
+
parameters?: Record<string, unknown>;
|
|
25
|
+
handler: Function;
|
|
26
|
+
}): void;
|
|
27
|
+
unregister(name: string): boolean;
|
|
28
|
+
}
|
|
29
|
+
export interface ForgeRequest {
|
|
30
|
+
/** 用户意图 */
|
|
31
|
+
intent: string;
|
|
32
|
+
/** 关键动作 */
|
|
33
|
+
action: string;
|
|
34
|
+
/** 目标对象 */
|
|
35
|
+
target: string;
|
|
36
|
+
/** 约束条件 */
|
|
37
|
+
constraints?: string[];
|
|
38
|
+
/** LLM 代码生成回调 — 仅 generate 模式时调用 */
|
|
39
|
+
codeGenerator?: (requirement: ToolRequirement) => Promise<GeneratedTool | null>;
|
|
40
|
+
}
|
|
41
|
+
export interface GeneratedTool {
|
|
42
|
+
/** 工具名 */
|
|
43
|
+
name: string;
|
|
44
|
+
/** 描述 */
|
|
45
|
+
description: string;
|
|
46
|
+
/** JSON Schema 参数 */
|
|
47
|
+
parameters: Record<string, unknown>;
|
|
48
|
+
/** 工具代码(需包含 toolHandler 函数) */
|
|
49
|
+
code: string;
|
|
50
|
+
/** 测试用例 */
|
|
51
|
+
testCases: SandboxTestCase[];
|
|
52
|
+
}
|
|
53
|
+
export interface ForgeResult {
|
|
54
|
+
/** 是否成功 */
|
|
55
|
+
success: boolean;
|
|
56
|
+
/** 使用的模式 */
|
|
57
|
+
mode: 'reuse' | 'compose' | 'generate';
|
|
58
|
+
/** 工具名称 */
|
|
59
|
+
toolName?: string;
|
|
60
|
+
/** 需求分析结果 */
|
|
61
|
+
analysis: AnalysisResult;
|
|
62
|
+
/** 失败原因 */
|
|
63
|
+
error?: string;
|
|
64
|
+
}
|
|
65
|
+
export interface ToolForgeOptions {
|
|
66
|
+
signalBus?: SignalBus;
|
|
67
|
+
/** 生成工具的默认 TTL(ms),默认 30 分钟 */
|
|
68
|
+
defaultTtlMs?: number;
|
|
69
|
+
/** compose 模式下的组合 spec 生成器 */
|
|
70
|
+
compositionSpecBuilder?: (analysis: AnalysisResult, requirement: ToolRequirement) => CompositionSpec | null;
|
|
71
|
+
}
|
|
72
|
+
export declare class ToolForge {
|
|
73
|
+
#private;
|
|
74
|
+
constructor(registry: ToolRegistryLike, options?: ToolForgeOptions);
|
|
75
|
+
/**
|
|
76
|
+
* 锻造工具 — 瀑布流:reuse → compose → generate
|
|
77
|
+
*/
|
|
78
|
+
forge(request: ForgeRequest): Promise<ForgeResult>;
|
|
79
|
+
/**
|
|
80
|
+
* 获取临时工具注册表(暴露给 Pipeline 集成用)
|
|
81
|
+
*/
|
|
82
|
+
get temporaryRegistry(): TemporaryToolRegistry;
|
|
83
|
+
/**
|
|
84
|
+
* 获取分析器
|
|
85
|
+
*/
|
|
86
|
+
get analyzer(): ToolRequirementAnalyzer;
|
|
87
|
+
/**
|
|
88
|
+
* 销毁 Forge(清理临时工具和定时器)
|
|
89
|
+
*/
|
|
90
|
+
dispose(): void;
|
|
91
|
+
}
|
|
92
|
+
export {};
|
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ToolForge — 工具锻造主编排器
|
|
3
|
+
*
|
|
4
|
+
* 三级锻造策略:
|
|
5
|
+
* Reuse (0ms) → 直接重用注册表中已有工具
|
|
6
|
+
* Compose (10ms) → 通过 DynamicComposer 组合已有原子工具
|
|
7
|
+
* Generate (5s) → LLM 生成工具代码 → SandboxRunner 验证 → 注册
|
|
8
|
+
*
|
|
9
|
+
* 瀑布逻辑:reuse → compose → generate,首个成功即返回。
|
|
10
|
+
*/
|
|
11
|
+
import Logger from '#infra/logging/Logger.js';
|
|
12
|
+
import { DynamicComposer } from './DynamicComposer.js';
|
|
13
|
+
import { SandboxRunner } from './SandboxRunner.js';
|
|
14
|
+
import { TemporaryToolRegistry } from './TemporaryToolRegistry.js';
|
|
15
|
+
import { ToolRequirementAnalyzer } from './ToolRequirementAnalyzer.js';
|
|
16
|
+
/* ────────────────────── Class ────────────────────── */
|
|
17
|
+
export class ToolForge {
|
|
18
|
+
#registry;
|
|
19
|
+
#analyzer;
|
|
20
|
+
#composer;
|
|
21
|
+
#sandbox;
|
|
22
|
+
#tempRegistry;
|
|
23
|
+
#signalBus;
|
|
24
|
+
#logger = Logger.getInstance();
|
|
25
|
+
#defaultTtlMs;
|
|
26
|
+
#compositionSpecBuilder;
|
|
27
|
+
constructor(registry, options = {}) {
|
|
28
|
+
this.#registry = registry;
|
|
29
|
+
this.#signalBus = options.signalBus ?? null;
|
|
30
|
+
this.#defaultTtlMs = options.defaultTtlMs ?? 30 * 60 * 1000;
|
|
31
|
+
this.#compositionSpecBuilder = options.compositionSpecBuilder;
|
|
32
|
+
this.#analyzer = new ToolRequirementAnalyzer(registry);
|
|
33
|
+
this.#composer = new DynamicComposer(registry);
|
|
34
|
+
this.#sandbox = new SandboxRunner();
|
|
35
|
+
this.#tempRegistry = new TemporaryToolRegistry(registry, {
|
|
36
|
+
signalBus: this.#signalBus ?? undefined,
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
/* ────────── Public API ────────── */
|
|
40
|
+
/**
|
|
41
|
+
* 锻造工具 — 瀑布流:reuse → compose → generate
|
|
42
|
+
*/
|
|
43
|
+
async forge(request) {
|
|
44
|
+
const requirement = {
|
|
45
|
+
intent: request.intent,
|
|
46
|
+
action: request.action,
|
|
47
|
+
target: request.target,
|
|
48
|
+
constraints: request.constraints,
|
|
49
|
+
};
|
|
50
|
+
// Step 1: 需求分析
|
|
51
|
+
const analysis = this.#analyzer.analyze(requirement);
|
|
52
|
+
this.#logger.info(`ToolForge: analysis for "${request.intent}" → mode=${analysis.mode}, confidence=${analysis.confidence}`);
|
|
53
|
+
// Step 2: 按推荐模式尝试,失败则降级
|
|
54
|
+
const result = (await this.#tryReuse(analysis, requirement)) ??
|
|
55
|
+
(await this.#tryCompose(analysis, requirement)) ??
|
|
56
|
+
(await this.#tryGenerate(analysis, requirement, request.codeGenerator));
|
|
57
|
+
if (result) {
|
|
58
|
+
this.#emitSignal('forge_complete', {
|
|
59
|
+
mode: result.mode,
|
|
60
|
+
tool: result.toolName,
|
|
61
|
+
analysis,
|
|
62
|
+
});
|
|
63
|
+
return result;
|
|
64
|
+
}
|
|
65
|
+
// 全部失败
|
|
66
|
+
return {
|
|
67
|
+
success: false,
|
|
68
|
+
mode: 'generate',
|
|
69
|
+
analysis,
|
|
70
|
+
error: 'All forge modes exhausted. Cannot satisfy tool requirement.',
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* 获取临时工具注册表(暴露给 Pipeline 集成用)
|
|
75
|
+
*/
|
|
76
|
+
get temporaryRegistry() {
|
|
77
|
+
return this.#tempRegistry;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* 获取分析器
|
|
81
|
+
*/
|
|
82
|
+
get analyzer() {
|
|
83
|
+
return this.#analyzer;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* 销毁 Forge(清理临时工具和定时器)
|
|
87
|
+
*/
|
|
88
|
+
dispose() {
|
|
89
|
+
this.#tempRegistry.dispose();
|
|
90
|
+
}
|
|
91
|
+
/* ────────── Forge Modes ────────── */
|
|
92
|
+
async #tryReuse(analysis, _requirement) {
|
|
93
|
+
if (analysis.mode !== 'reuse' || !analysis.matchedTool) {
|
|
94
|
+
// 即便分析推荐 compose/generate,也尝试检查直接匹配
|
|
95
|
+
if (analysis.matchedTool && this.#registry.has(analysis.matchedTool)) {
|
|
96
|
+
return {
|
|
97
|
+
success: true,
|
|
98
|
+
mode: 'reuse',
|
|
99
|
+
toolName: analysis.matchedTool,
|
|
100
|
+
analysis,
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
return null;
|
|
104
|
+
}
|
|
105
|
+
if (!this.#registry.has(analysis.matchedTool)) {
|
|
106
|
+
return null;
|
|
107
|
+
}
|
|
108
|
+
this.#logger.debug(`ToolForge: reuse existing tool "${analysis.matchedTool}"`);
|
|
109
|
+
return {
|
|
110
|
+
success: true,
|
|
111
|
+
mode: 'reuse',
|
|
112
|
+
toolName: analysis.matchedTool,
|
|
113
|
+
analysis,
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
async #tryCompose(analysis, requirement) {
|
|
117
|
+
if (!analysis.composableTools || analysis.composableTools.length < 2) {
|
|
118
|
+
return null;
|
|
119
|
+
}
|
|
120
|
+
// 如果有外部 spec builder,使用它
|
|
121
|
+
const spec = this.#compositionSpecBuilder?.(analysis, requirement);
|
|
122
|
+
if (!spec) {
|
|
123
|
+
// 默认构建 sequential 组合
|
|
124
|
+
const defaultSpec = this.#buildDefaultCompositionSpec(analysis, requirement);
|
|
125
|
+
if (!defaultSpec) {
|
|
126
|
+
return null;
|
|
127
|
+
}
|
|
128
|
+
return this.#executeComposition(defaultSpec, analysis);
|
|
129
|
+
}
|
|
130
|
+
return this.#executeComposition(spec, analysis);
|
|
131
|
+
}
|
|
132
|
+
#buildDefaultCompositionSpec(analysis, requirement) {
|
|
133
|
+
const tools = analysis.composableTools;
|
|
134
|
+
if (!tools || tools.length < 2) {
|
|
135
|
+
return null;
|
|
136
|
+
}
|
|
137
|
+
const composedName = `composed_${requirement.action}_${requirement.target}`;
|
|
138
|
+
return {
|
|
139
|
+
name: composedName,
|
|
140
|
+
description: `Auto-composed tool for: ${requirement.intent}`,
|
|
141
|
+
steps: tools.map((tool) => ({
|
|
142
|
+
tool,
|
|
143
|
+
args: (prevResult) => {
|
|
144
|
+
if (typeof prevResult === 'object' && prevResult !== null) {
|
|
145
|
+
return prevResult;
|
|
146
|
+
}
|
|
147
|
+
return {};
|
|
148
|
+
},
|
|
149
|
+
})),
|
|
150
|
+
mergeStrategy: 'sequential',
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
async #executeComposition(spec, analysis) {
|
|
154
|
+
const result = this.#composer.compose(spec);
|
|
155
|
+
if (!result.success || !result.handler) {
|
|
156
|
+
this.#logger.debug(`ToolForge: composition failed — ${result.error}`);
|
|
157
|
+
return null;
|
|
158
|
+
}
|
|
159
|
+
// 注册为临时工具
|
|
160
|
+
this.#tempRegistry.registerTemporary({
|
|
161
|
+
name: spec.name,
|
|
162
|
+
description: spec.description,
|
|
163
|
+
parameters: spec.parameters ?? {},
|
|
164
|
+
handler: result.handler,
|
|
165
|
+
forgeMode: 'compose',
|
|
166
|
+
}, this.#defaultTtlMs);
|
|
167
|
+
this.#logger.info(`ToolForge: composed tool "${spec.name}" from ${spec.steps.length} steps`);
|
|
168
|
+
return {
|
|
169
|
+
success: true,
|
|
170
|
+
mode: 'compose',
|
|
171
|
+
toolName: spec.name,
|
|
172
|
+
analysis,
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
async #tryGenerate(analysis, requirement, codeGenerator) {
|
|
176
|
+
if (!codeGenerator) {
|
|
177
|
+
this.#logger.debug('ToolForge: generate mode skipped (no codeGenerator provided)');
|
|
178
|
+
return null;
|
|
179
|
+
}
|
|
180
|
+
// 调用 LLM 生成工具
|
|
181
|
+
const generated = await codeGenerator(requirement);
|
|
182
|
+
if (!generated) {
|
|
183
|
+
return null;
|
|
184
|
+
}
|
|
185
|
+
// 安全检查
|
|
186
|
+
const safety = this.#sandbox.checkSafety(generated.code);
|
|
187
|
+
if (!safety.passed) {
|
|
188
|
+
this.#logger.warn(`ToolForge: generated code failed safety check — ${safety.violations.join(', ')}`);
|
|
189
|
+
return {
|
|
190
|
+
success: false,
|
|
191
|
+
mode: 'generate',
|
|
192
|
+
analysis,
|
|
193
|
+
error: `Safety violations: ${safety.violations.join(', ')}`,
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
// 沙箱测试
|
|
197
|
+
if (generated.testCases.length > 0) {
|
|
198
|
+
const testResult = await this.#sandbox.run(generated.code, generated.testCases);
|
|
199
|
+
if (!testResult.success) {
|
|
200
|
+
const failures = testResult.testResults
|
|
201
|
+
.filter((t) => !t.passed)
|
|
202
|
+
.map((t) => t.description)
|
|
203
|
+
.join(', ');
|
|
204
|
+
this.#logger.warn(`ToolForge: generated code failed tests — ${failures}`);
|
|
205
|
+
return {
|
|
206
|
+
success: false,
|
|
207
|
+
mode: 'generate',
|
|
208
|
+
analysis,
|
|
209
|
+
error: `Test failures: ${failures}`,
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
// 构建 handler 包装
|
|
214
|
+
const handler = this.#sandbox.createHandler(generated.code);
|
|
215
|
+
// 注册为临时工具
|
|
216
|
+
this.#tempRegistry.registerTemporary({
|
|
217
|
+
name: generated.name,
|
|
218
|
+
description: generated.description,
|
|
219
|
+
parameters: generated.parameters,
|
|
220
|
+
handler,
|
|
221
|
+
forgeMode: 'generate',
|
|
222
|
+
}, this.#defaultTtlMs);
|
|
223
|
+
this.#logger.info(`ToolForge: generated and registered tool "${generated.name}"`);
|
|
224
|
+
return {
|
|
225
|
+
success: true,
|
|
226
|
+
mode: 'generate',
|
|
227
|
+
toolName: generated.name,
|
|
228
|
+
analysis,
|
|
229
|
+
};
|
|
230
|
+
}
|
|
231
|
+
/* ────────── Signal ────────── */
|
|
232
|
+
#emitSignal(action, data) {
|
|
233
|
+
if (this.#signalBus) {
|
|
234
|
+
this.#signalBus.send('forge', 'ToolForge', 1, {
|
|
235
|
+
metadata: { action, ...data },
|
|
236
|
+
});
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ToolRequirementAnalyzer — 工具需求分析器
|
|
3
|
+
*
|
|
4
|
+
* 分析结构化意图,确定满足需求的最佳路径:
|
|
5
|
+
* 1. Reuse — 注册表中已有完全匹配的工具
|
|
6
|
+
* 2. Compose — 可通过组合已有工具满足
|
|
7
|
+
* 3. Generate — 必须由 LLM 生成新工具代码
|
|
8
|
+
*/
|
|
9
|
+
interface ToolRegistryLike {
|
|
10
|
+
has(name: string): boolean;
|
|
11
|
+
getToolNames(): string[];
|
|
12
|
+
}
|
|
13
|
+
export interface ToolRequirement {
|
|
14
|
+
/** 用户意图描述 */
|
|
15
|
+
intent: string;
|
|
16
|
+
/** 关键动作词(如 read / search / transform / validate) */
|
|
17
|
+
action: string;
|
|
18
|
+
/** 目标对象(如 file / database / API) */
|
|
19
|
+
target: string;
|
|
20
|
+
/** 附加约束 */
|
|
21
|
+
constraints?: string[];
|
|
22
|
+
}
|
|
23
|
+
export type ForgeMode = 'reuse' | 'compose' | 'generate';
|
|
24
|
+
export interface AnalysisResult {
|
|
25
|
+
/** 推荐的 Forge 模式 */
|
|
26
|
+
mode: ForgeMode;
|
|
27
|
+
/** 置信度 0-1 */
|
|
28
|
+
confidence: number;
|
|
29
|
+
/** 推理理由 */
|
|
30
|
+
reasoning: string;
|
|
31
|
+
/** mode=reuse 时:匹配的工具名 */
|
|
32
|
+
matchedTool?: string;
|
|
33
|
+
/** mode=compose 时:建议参与组合的工具列表 */
|
|
34
|
+
composableTools?: string[];
|
|
35
|
+
}
|
|
36
|
+
export declare class ToolRequirementAnalyzer {
|
|
37
|
+
#private;
|
|
38
|
+
constructor(registry: ToolRegistryLike);
|
|
39
|
+
/**
|
|
40
|
+
* 分析需求并推荐 Forge 模式
|
|
41
|
+
*/
|
|
42
|
+
analyze(requirement: ToolRequirement): AnalysisResult;
|
|
43
|
+
}
|
|
44
|
+
export {};
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ToolRequirementAnalyzer — 工具需求分析器
|
|
3
|
+
*
|
|
4
|
+
* 分析结构化意图,确定满足需求的最佳路径:
|
|
5
|
+
* 1. Reuse — 注册表中已有完全匹配的工具
|
|
6
|
+
* 2. Compose — 可通过组合已有工具满足
|
|
7
|
+
* 3. Generate — 必须由 LLM 生成新工具代码
|
|
8
|
+
*/
|
|
9
|
+
import Logger from '#infra/logging/Logger.js';
|
|
10
|
+
/* ────────────── Action → Tool Keyword mapping ────────────── */
|
|
11
|
+
const ACTION_TOOL_HINTS = {
|
|
12
|
+
read: ['read', 'get', 'fetch', 'load', 'file'],
|
|
13
|
+
search: ['search', 'find', 'query', 'lookup'],
|
|
14
|
+
write: ['write', 'save', 'create', 'update', 'set'],
|
|
15
|
+
delete: ['delete', 'remove', 'clear'],
|
|
16
|
+
transform: ['transform', 'convert', 'parse', 'format'],
|
|
17
|
+
validate: ['validate', 'check', 'guard', 'lint'],
|
|
18
|
+
analyse: ['analyze', 'analyse', 'inspect', 'stats'],
|
|
19
|
+
list: ['list', 'browse', 'enumerate'],
|
|
20
|
+
execute: ['execute', 'run', 'invoke', 'call'],
|
|
21
|
+
};
|
|
22
|
+
/* ────────────────────── Class ────────────────────── */
|
|
23
|
+
export class ToolRequirementAnalyzer {
|
|
24
|
+
#registry;
|
|
25
|
+
#logger = Logger.getInstance();
|
|
26
|
+
constructor(registry) {
|
|
27
|
+
this.#registry = registry;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* 分析需求并推荐 Forge 模式
|
|
31
|
+
*/
|
|
32
|
+
analyze(requirement) {
|
|
33
|
+
// 1. 尝试精确匹配
|
|
34
|
+
const exactMatch = this.#tryExactMatch(requirement);
|
|
35
|
+
if (exactMatch) {
|
|
36
|
+
return exactMatch;
|
|
37
|
+
}
|
|
38
|
+
// 2. 尝试组合匹配
|
|
39
|
+
const composeMatch = this.#tryComposeMatch(requirement);
|
|
40
|
+
if (composeMatch) {
|
|
41
|
+
return composeMatch;
|
|
42
|
+
}
|
|
43
|
+
// 3. Fallback: 需要生成
|
|
44
|
+
return {
|
|
45
|
+
mode: 'generate',
|
|
46
|
+
confidence: 0.5,
|
|
47
|
+
reasoning: `No existing tool matches "${requirement.action} ${requirement.target}". Code generation required.`,
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
/* ── Internal ── */
|
|
51
|
+
#tryExactMatch(req) {
|
|
52
|
+
// 直接检查 action_target 形式的工具名
|
|
53
|
+
const directName = `${req.action}_${req.target}`.toLowerCase();
|
|
54
|
+
if (this.#registry.has(directName)) {
|
|
55
|
+
return {
|
|
56
|
+
mode: 'reuse',
|
|
57
|
+
confidence: 1.0,
|
|
58
|
+
reasoning: `Exact tool match: "${directName}"`,
|
|
59
|
+
matchedTool: directName,
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
// 模糊匹配:遍历已注册工具,看名称是否同时包含 action 和 target 关键词
|
|
63
|
+
const allTools = this.#registry.getToolNames();
|
|
64
|
+
const actionLower = req.action.toLowerCase();
|
|
65
|
+
const targetLower = req.target.toLowerCase();
|
|
66
|
+
for (const tool of allTools) {
|
|
67
|
+
const toolLower = tool.toLowerCase();
|
|
68
|
+
if (toolLower.includes(actionLower) && toolLower.includes(targetLower)) {
|
|
69
|
+
return {
|
|
70
|
+
mode: 'reuse',
|
|
71
|
+
confidence: 0.85,
|
|
72
|
+
reasoning: `Fuzzy match: tool "${tool}" contains both "${req.action}" and "${req.target}"`,
|
|
73
|
+
matchedTool: tool,
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
// 通过 action hint 词尝试
|
|
78
|
+
const hints = ACTION_TOOL_HINTS[actionLower] ?? [actionLower];
|
|
79
|
+
for (const tool of allTools) {
|
|
80
|
+
const toolLower = tool.toLowerCase();
|
|
81
|
+
const matchesHint = hints.some((h) => toolLower.includes(h));
|
|
82
|
+
const matchesTarget = toolLower.includes(targetLower);
|
|
83
|
+
if (matchesHint && matchesTarget) {
|
|
84
|
+
return {
|
|
85
|
+
mode: 'reuse',
|
|
86
|
+
confidence: 0.7,
|
|
87
|
+
reasoning: `Hint match: tool "${tool}" matches action hint and target "${req.target}"`,
|
|
88
|
+
matchedTool: tool,
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
return null;
|
|
93
|
+
}
|
|
94
|
+
#tryComposeMatch(req) {
|
|
95
|
+
const allTools = this.#registry.getToolNames();
|
|
96
|
+
const actionLower = req.action.toLowerCase();
|
|
97
|
+
const targetLower = req.target.toLowerCase();
|
|
98
|
+
const hints = ACTION_TOOL_HINTS[actionLower] ?? [actionLower];
|
|
99
|
+
// 寻找和 action 相关的工具
|
|
100
|
+
const actionRelated = allTools.filter((t) => {
|
|
101
|
+
const tl = t.toLowerCase();
|
|
102
|
+
return hints.some((h) => tl.includes(h));
|
|
103
|
+
});
|
|
104
|
+
// 寻找和 target 相关的工具
|
|
105
|
+
const targetRelated = allTools.filter((t) => t.toLowerCase().includes(targetLower));
|
|
106
|
+
// 取并集
|
|
107
|
+
const candidates = [...new Set([...actionRelated, ...targetRelated])];
|
|
108
|
+
if (candidates.length >= 2) {
|
|
109
|
+
this.#logger.debug(`ToolRequirementAnalyzer: compose candidates for "${req.intent}": ${candidates.join(', ')}`);
|
|
110
|
+
return {
|
|
111
|
+
mode: 'compose',
|
|
112
|
+
confidence: 0.65,
|
|
113
|
+
reasoning: `Found ${candidates.length} composable tools for "${req.action} ${req.target}"`,
|
|
114
|
+
composableTools: candidates.slice(0, 5),
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
return null;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
@@ -46,6 +46,8 @@ export declare class ToolRegistry {
|
|
|
46
46
|
execute(name: string, params: Record<string, unknown>, context?: Record<string, unknown>): Promise<unknown>;
|
|
47
47
|
/** 检查工具是否存在 */
|
|
48
48
|
has(name: string): boolean;
|
|
49
|
+
/** 移除一个已注册的工具(Forge TTL 回收用) */
|
|
50
|
+
unregister(name: string): boolean;
|
|
49
51
|
/** 获取所有工具名 */
|
|
50
52
|
getToolNames(): string[];
|
|
51
53
|
/** 工具数量 */
|
|
@@ -174,6 +174,10 @@ export class ToolRegistry {
|
|
|
174
174
|
has(name) {
|
|
175
175
|
return this.#tools.has(name);
|
|
176
176
|
}
|
|
177
|
+
/** 移除一个已注册的工具(Forge TTL 回收用) */
|
|
178
|
+
unregister(name) {
|
|
179
|
+
return this.#tools.delete(name);
|
|
180
|
+
}
|
|
177
181
|
/** 获取所有工具名 */
|
|
178
182
|
getToolNames() {
|
|
179
183
|
return [...this.#tools.keys()];
|
|
@@ -214,7 +214,6 @@ export const submitWithCheck = {
|
|
|
214
214
|
existingFingerprints: ctx._submittedPatterns || new Set(),
|
|
215
215
|
});
|
|
216
216
|
const validResult = validator.validate(params, {
|
|
217
|
-
mode: 'strict',
|
|
218
217
|
systemInjectedFields: getSystemInjectedFields(),
|
|
219
218
|
});
|
|
220
219
|
if (!validResult.pass) {
|
|
@@ -9,12 +9,12 @@ import { analyzeCode, getToolDetails, knowledgeOverview, planTask, reviewMyOutpu
|
|
|
9
9
|
import { getRecommendations, guardCheckCode, listGuardRules, queryViolations } from './guard.js';
|
|
10
10
|
import { bootstrapKnowledgeTool, createSkillTool, graphImpactAnalysis, loadSkill, queryAuditLog, rebuildIndex, suggestSkills } from './infrastructure.js';
|
|
11
11
|
import { addGraphEdge, checkDuplicate } from './knowledge-graph.js';
|
|
12
|
-
import { approveCandidate, deprecateRecipe, getFeedbackStats, publishRecipe, qualityScore, recordUsage, rejectCandidate,
|
|
12
|
+
import { approveCandidate, deprecateRecipe, getFeedbackStats, publishRecipe, qualityScore, recordUsage, rejectCandidate, submitCandidate, updateRecipe, validateCandidate } from './lifecycle.js';
|
|
13
13
|
import { getFileSummary, listProjectStructure, readProjectFile, searchProjectCode, semanticSearchCode } from './project-access.js';
|
|
14
14
|
import { getProjectStats, getRecipeDetail, getRelatedRecipes, searchCandidates, searchKnowledge, searchRecipes } from './query.js';
|
|
15
15
|
import { collectScanRecipe } from './scan-recipe.js';
|
|
16
16
|
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,
|
|
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
18
|
export declare const ALL_TOOLS: ({
|
|
19
19
|
name: string;
|
|
20
20
|
description: string;
|
|
@@ -1028,54 +1028,6 @@ export declare const ALL_TOOLS: ({
|
|
|
1028
1028
|
required: string[];
|
|
1029
1029
|
};
|
|
1030
1030
|
handler: (params: import("./lifecycle.js").SubmitKnowledgeParams, ctx: import("./_shared.js").ToolHandlerContext) => Promise<any>;
|
|
1031
|
-
} | {
|
|
1032
|
-
name: string;
|
|
1033
|
-
description: string;
|
|
1034
|
-
parameters: {
|
|
1035
|
-
type: string;
|
|
1036
|
-
properties: {
|
|
1037
|
-
title: {
|
|
1038
|
-
type: string;
|
|
1039
|
-
description: string;
|
|
1040
|
-
};
|
|
1041
|
-
markdown: {
|
|
1042
|
-
type: string;
|
|
1043
|
-
description: string;
|
|
1044
|
-
};
|
|
1045
|
-
description: {
|
|
1046
|
-
type: string;
|
|
1047
|
-
description: string;
|
|
1048
|
-
};
|
|
1049
|
-
tags: {
|
|
1050
|
-
type: string;
|
|
1051
|
-
items: {
|
|
1052
|
-
type: string;
|
|
1053
|
-
};
|
|
1054
|
-
description: string;
|
|
1055
|
-
};
|
|
1056
|
-
scope: {
|
|
1057
|
-
type: string;
|
|
1058
|
-
enum: string[];
|
|
1059
|
-
description: string;
|
|
1060
|
-
};
|
|
1061
|
-
};
|
|
1062
|
-
required: string[];
|
|
1063
|
-
};
|
|
1064
|
-
handler: (params: import("./lifecycle.js").SaveDocumentParams, ctx: import("./_shared.js").ToolHandlerContext) => Promise<{
|
|
1065
|
-
error: boolean;
|
|
1066
|
-
message: string;
|
|
1067
|
-
id?: undefined;
|
|
1068
|
-
title?: undefined;
|
|
1069
|
-
lifecycle?: undefined;
|
|
1070
|
-
knowledgeType?: undefined;
|
|
1071
|
-
} | {
|
|
1072
|
-
id: any;
|
|
1073
|
-
title: any;
|
|
1074
|
-
lifecycle: string;
|
|
1075
|
-
knowledgeType: string;
|
|
1076
|
-
message: string;
|
|
1077
|
-
error?: undefined;
|
|
1078
|
-
}>;
|
|
1079
1031
|
} | {
|
|
1080
1032
|
name: string;
|
|
1081
1033
|
description: string;
|
|
@@ -16,7 +16,7 @@ import { bootstrapKnowledgeTool, createSkillTool, graphImpactAnalysis, loadSkill
|
|
|
16
16
|
// ── 知识图谱类 (2) ──
|
|
17
17
|
import { addGraphEdge, checkDuplicate } from './knowledge-graph.js';
|
|
18
18
|
// ── 生命周期操作类 (11) ──
|
|
19
|
-
import { approveCandidate, deprecateRecipe, getFeedbackStats, publishRecipe, qualityScore, recordUsage, rejectCandidate,
|
|
19
|
+
import { approveCandidate, deprecateRecipe, getFeedbackStats, publishRecipe, qualityScore, recordUsage, rejectCandidate, submitCandidate, updateRecipe, validateCandidate, } from './lifecycle.js';
|
|
20
20
|
// ── 项目数据访问 (5) ──
|
|
21
21
|
import { getFileSummary, listProjectStructure, readProjectFile, searchProjectCode, semanticSearchCode, } from './project-access.js';
|
|
22
22
|
// ── 查询类 (6) ──
|
|
@@ -38,7 +38,7 @@ listGuardRules, getRecommendations, guardCheckCode, queryViolations,
|
|
|
38
38
|
// 知识图谱类
|
|
39
39
|
checkDuplicate, addGraphEdge,
|
|
40
40
|
// 生命周期操作类
|
|
41
|
-
submitCandidate,
|
|
41
|
+
submitCandidate, approveCandidate, rejectCandidate, publishRecipe, deprecateRecipe, updateRecipe, recordUsage, qualityScore, validateCandidate, getFeedbackStats,
|
|
42
42
|
// 基础设施类
|
|
43
43
|
graphImpactAnalysis, rebuildIndex, queryAuditLog, loadSkill, createSkillTool, suggestSkills, bootstrapKnowledgeTool,
|
|
44
44
|
// 组合工具 + 元工具
|
|
@@ -80,7 +80,6 @@ export const ALL_TOOLS = [
|
|
|
80
80
|
queryViolations,
|
|
81
81
|
// 生命周期操作类 (7)
|
|
82
82
|
submitCandidate,
|
|
83
|
-
saveDocument,
|
|
84
83
|
approveCandidate,
|
|
85
84
|
rejectCandidate,
|
|
86
85
|
publishRecipe,
|