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
|
@@ -649,6 +649,45 @@ function buildExecutionPlan(activeDimensions) {
|
|
|
649
649
|
workflow: '对每个维度: (1) 用你的原生能力阅读代码分析 → (2) 调用 autosnippet_submit_knowledge_batch 批量提交候选(**每维度最少 3 条,目标 5 条**,将不同关注点拆分为独立候选,1-2 条视为不合格) → (3) 调用 autosnippet_dimension_complete 完成维度(必须传 referencedFiles=[分析过的文件路径] 和 keyFindings=[3-5条关键发现])',
|
|
650
650
|
};
|
|
651
651
|
}
|
|
652
|
+
// ── Panorama 摘要构建 ──────────────────────────────────────
|
|
653
|
+
/**
|
|
654
|
+
* 从 PanoramaResult 提取 layers / couplingHotspots / cycles / gaps
|
|
655
|
+
* 用于注入 MissionBriefing,使外部 Agent 获得项目全景视野
|
|
656
|
+
*/
|
|
657
|
+
function summarizePanorama(panoramaResult) {
|
|
658
|
+
if (!panoramaResult) {
|
|
659
|
+
return null;
|
|
660
|
+
}
|
|
661
|
+
try {
|
|
662
|
+
// PanoramaResult.layers: LayerHierarchy { levels: LayerLevel[] }
|
|
663
|
+
const layerHierarchy = panoramaResult.layers;
|
|
664
|
+
const layers = layerHierarchy?.levels ?? [];
|
|
665
|
+
// PanoramaResult.modules: Map<string, PanoramaModule>
|
|
666
|
+
const modules = panoramaResult.modules;
|
|
667
|
+
const couplingHotspots = [];
|
|
668
|
+
if (modules instanceof Map) {
|
|
669
|
+
for (const [, mod] of modules) {
|
|
670
|
+
if (mod.fanIn >= 10 || mod.fanOut >= 10) {
|
|
671
|
+
couplingHotspots.push({ module: mod.name, fanIn: mod.fanIn, fanOut: mod.fanOut });
|
|
672
|
+
}
|
|
673
|
+
}
|
|
674
|
+
couplingHotspots.sort((a, b) => b.fanIn + b.fanOut - (a.fanIn + a.fanOut));
|
|
675
|
+
}
|
|
676
|
+
// PanoramaResult.cycles: CyclicDependency[]
|
|
677
|
+
const cycles = panoramaResult.cycles ?? [];
|
|
678
|
+
// PanoramaResult.gaps: KnowledgeGap[] (dimension-based)
|
|
679
|
+
const gaps = panoramaResult.gaps ?? [];
|
|
680
|
+
return {
|
|
681
|
+
layers: layers.slice(0, 10),
|
|
682
|
+
couplingHotspots: couplingHotspots.slice(0, 10),
|
|
683
|
+
cyclicDependencies: cycles.slice(0, 10),
|
|
684
|
+
knowledgeGaps: gaps.slice(0, 20),
|
|
685
|
+
};
|
|
686
|
+
}
|
|
687
|
+
catch {
|
|
688
|
+
return null;
|
|
689
|
+
}
|
|
690
|
+
}
|
|
652
691
|
// ── Mission Briefing 主构建函数 ──────────────────────────────
|
|
653
692
|
/**
|
|
654
693
|
* 构建 Mission Briefing
|
|
@@ -667,6 +706,7 @@ function buildExecutionPlan(activeDimensions) {
|
|
|
667
706
|
export function buildMissionBriefing({ projectMeta, astData, codeEntityResult, callGraphResult, depGraphData, guardAudit, targets, activeDimensions, session, languageExtension, // §7.1: 语言扩展(反模式、Guard 规则、Agent 注意事项)
|
|
668
707
|
incrementalPlan, // §7.3: 增量 Bootstrap 评估结果
|
|
669
708
|
languageStats, // §7.4: 完整语言分布统计
|
|
709
|
+
panoramaResult, // §M1: Phase 1.8 全景数据
|
|
670
710
|
}) {
|
|
671
711
|
const scheduler = new TierScheduler();
|
|
672
712
|
// ── 构建维度任务列表 (v2: 附带 evidenceStarters) ──
|
|
@@ -727,6 +767,7 @@ languageStats, // §7.4: 完整语言分布统计
|
|
|
727
767
|
// 完整语言统计(按文件扩展名计数)
|
|
728
768
|
languageStats: languageStats || null,
|
|
729
769
|
executionPlan: buildExecutionPlan(activeDimensions),
|
|
770
|
+
panorama: summarizePanorama(panoramaResult ?? null),
|
|
730
771
|
session: session.toJSON(),
|
|
731
772
|
};
|
|
732
773
|
// ── 体积检测 + 渐进式压缩 ──
|
|
@@ -35,6 +35,53 @@ import { runNoAiFallback } from './noAiFallback.js';
|
|
|
35
35
|
import { TierScheduler } from './tier-scheduler.js';
|
|
36
36
|
const logger = Logger.getInstance();
|
|
37
37
|
// ──────────────────────────────────────────────────────────────────
|
|
38
|
+
// Panorama Context for strategyContext injection (M1 §5.2)
|
|
39
|
+
// ──────────────────────────────────────────────────────────────────
|
|
40
|
+
/**
|
|
41
|
+
* 从 fillContext.panoramaResult 提取维度级全景上下文
|
|
42
|
+
* 注入 strategyContext.panorama,使 Agent 获得模块角色/层级/耦合/空白区信息
|
|
43
|
+
*/
|
|
44
|
+
function buildPanoramaContext(fillContext, _dimConfig) {
|
|
45
|
+
const panoramaResult = fillContext.panoramaResult;
|
|
46
|
+
if (!panoramaResult) {
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
49
|
+
try {
|
|
50
|
+
const modules = panoramaResult.modules;
|
|
51
|
+
const layers = panoramaResult.layers;
|
|
52
|
+
const gaps = panoramaResult.gaps ?? [];
|
|
53
|
+
// 构建紧凑上下文
|
|
54
|
+
const layerNames = (layers?.levels ?? []).map((l) => `L${l.level}:${l.name}`).join(' → ');
|
|
55
|
+
const knownGaps = gaps.slice(0, 5).flatMap((g) => g.suggestedFocus ?? []);
|
|
56
|
+
// 找到与当前维度最相关的模块(如果 dimConfig 有 target 信息)
|
|
57
|
+
let moduleRole = null;
|
|
58
|
+
let moduleLayer = null;
|
|
59
|
+
let moduleCoupling = null;
|
|
60
|
+
if (modules instanceof Map && modules.size > 0) {
|
|
61
|
+
// 使用第一个模块作为代表(维度覆盖多模块时)
|
|
62
|
+
const firstMod = modules.values().next().value;
|
|
63
|
+
if (firstMod) {
|
|
64
|
+
moduleRole = firstMod.refinedRole ?? firstMod.inferredRole ?? null;
|
|
65
|
+
moduleLayer = firstMod.layer ?? null;
|
|
66
|
+
moduleCoupling = {
|
|
67
|
+
fanIn: firstMod.fanIn ?? 0,
|
|
68
|
+
fanOut: firstMod.fanOut ?? 0,
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
return {
|
|
73
|
+
moduleRole,
|
|
74
|
+
moduleLayer,
|
|
75
|
+
moduleCoupling,
|
|
76
|
+
knownGaps: [...new Set(knownGaps)],
|
|
77
|
+
layerContext: layerNames || null,
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
catch {
|
|
81
|
+
return null;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
// ──────────────────────────────────────────────────────────────────
|
|
38
85
|
// fillDimensionsV3 — v3.0 管线入口
|
|
39
86
|
// ──────────────────────────────────────────────────────────────────
|
|
40
87
|
/**
|
|
@@ -537,6 +584,8 @@ export async function fillDimensionsV3(fillContext) {
|
|
|
537
584
|
dimId,
|
|
538
585
|
activeContext: memoryCoordinator.getActiveContext(analystScopeId),
|
|
539
586
|
outputType: dimConfig.outputType || 'analysis',
|
|
587
|
+
// §M1: Panorama 全景上下文 (Phase 1.8 数据注入)
|
|
588
|
+
panorama: buildPanoramaContext(fillContext, dimConfig),
|
|
540
589
|
// ── 引擎增强参数 (PipelineStrategy → reactLoop 透传) ──
|
|
541
590
|
contextWindow: agentFactory.createContextWindow({ isSystem: true }),
|
|
542
591
|
// B1 fix: 分析阶段使用 analyst 策略 (SCAN→EXPLORE→VERIFY→SUMMARIZE)
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
* Phase 1 → 文件收集(DiscovererRegistry → 多语言项目类型检测)
|
|
10
10
|
* Phase 1.5 → AST 代码结构分析(tree-sitter + SFC 预处理)
|
|
11
11
|
* Phase 1.6 → Code Entity Graph(代码实体关系图谱)
|
|
12
|
+
* Phase 1.8 → Panorama 全景汇总(RoleRefiner + CouplingAnalyzer + LayerInferrer)
|
|
12
13
|
* Phase 2 → 依赖关系 → knowledge_edges
|
|
13
14
|
* Phase 2.1 → Module 实体写入 Entity Graph
|
|
14
15
|
* Phase 3 → Guard 规则审计
|
|
@@ -297,6 +298,7 @@ export declare function runAllPhases(projectRoot: string, ctx: AllPhasesContext,
|
|
|
297
298
|
warnings: string[];
|
|
298
299
|
report: {};
|
|
299
300
|
incrementalPlan: null;
|
|
301
|
+
panoramaResult: null;
|
|
300
302
|
detectedFrameworks: never[];
|
|
301
303
|
isEmpty: boolean;
|
|
302
304
|
} | {
|
|
@@ -342,6 +344,7 @@ export declare function runAllPhases(projectRoot: string, ctx: AllPhasesContext,
|
|
|
342
344
|
warnings: string[];
|
|
343
345
|
report: PhaseReport | null;
|
|
344
346
|
incrementalPlan: Record<string, any> | null;
|
|
347
|
+
panoramaResult: Record<string, unknown> | null;
|
|
345
348
|
isEmpty: boolean;
|
|
346
349
|
}>;
|
|
347
350
|
export {};
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
* Phase 1 → 文件收集(DiscovererRegistry → 多语言项目类型检测)
|
|
10
10
|
* Phase 1.5 → AST 代码结构分析(tree-sitter + SFC 预处理)
|
|
11
11
|
* Phase 1.6 → Code Entity Graph(代码实体关系图谱)
|
|
12
|
+
* Phase 1.8 → Panorama 全景汇总(RoleRefiner + CouplingAnalyzer + LayerInferrer)
|
|
12
13
|
* Phase 2 → 依赖关系 → knowledge_edges
|
|
13
14
|
* Phase 2.1 → Module 实体写入 Entity Graph
|
|
14
15
|
* Phase 3 → Guard 规则审计
|
|
@@ -577,6 +578,7 @@ export async function runAllPhases(projectRoot, ctx, options = {}) {
|
|
|
577
578
|
warnings,
|
|
578
579
|
report: report || {},
|
|
579
580
|
incrementalPlan: null,
|
|
581
|
+
panoramaResult: null,
|
|
580
582
|
detectedFrameworks: [],
|
|
581
583
|
isEmpty: true,
|
|
582
584
|
};
|
|
@@ -635,6 +637,30 @@ export async function runAllPhases(projectRoot, ctx, options = {}) {
|
|
|
635
637
|
if (report) {
|
|
636
638
|
report.phases.callGraph = { result: phase1_7.callGraphResult, ms: Date.now() - p17Start };
|
|
637
639
|
}
|
|
640
|
+
// ── Phase 1.8: Panorama 全景汇总 ──
|
|
641
|
+
let panoramaResult = null;
|
|
642
|
+
try {
|
|
643
|
+
const panoramaService = ctx.container?.resolve?.('panoramaService');
|
|
644
|
+
if (panoramaService &&
|
|
645
|
+
typeof panoramaService.invalidate === 'function') {
|
|
646
|
+
const p18Start = Date.now();
|
|
647
|
+
panoramaService.invalidate();
|
|
648
|
+
const result = panoramaService.getResult();
|
|
649
|
+
panoramaResult = result;
|
|
650
|
+
ctx.logger.info(`[Bootstrap] Phase 1.8: Panorama computed in ${Date.now() - p18Start}ms`);
|
|
651
|
+
if (report) {
|
|
652
|
+
const overview = panoramaService.getOverview();
|
|
653
|
+
report.phases.panorama = {
|
|
654
|
+
moduleCount: overview.moduleCount ?? 0,
|
|
655
|
+
layerCount: overview.layerCount ?? 0,
|
|
656
|
+
ms: Date.now() - p18Start,
|
|
657
|
+
};
|
|
658
|
+
}
|
|
659
|
+
}
|
|
660
|
+
}
|
|
661
|
+
catch (err) {
|
|
662
|
+
warnings.push(`Phase 1.8 panorama failed (non-blocking): ${err instanceof Error ? err.message : String(err)}`);
|
|
663
|
+
}
|
|
638
664
|
// ── Phase 2: 依赖图 ──
|
|
639
665
|
const p2Start = Date.now();
|
|
640
666
|
const phase2 = await runPhase2_DependencyGraph(discoverer, ctx.container, ctx.logger, options.sourceTag || 'bootstrap');
|
|
@@ -720,6 +746,7 @@ export async function runAllPhases(projectRoot, ctx, options = {}) {
|
|
|
720
746
|
warnings,
|
|
721
747
|
report, // NEW: Phase 级报告 (null if generateReport=false)
|
|
722
748
|
incrementalPlan, // NEW: 增量评估结果 (null if incremental=false)
|
|
749
|
+
panoramaResult, // Phase 1.8: 全景汇总 (null if panoramaService unavailable)
|
|
723
750
|
isEmpty: false,
|
|
724
751
|
};
|
|
725
752
|
}
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
*/
|
|
11
11
|
import fs from 'node:fs';
|
|
12
12
|
import path from 'node:path';
|
|
13
|
-
import { SKILLS_DIR } from '
|
|
13
|
+
import { SKILLS_DIR } from '#shared/package-root.js';
|
|
14
14
|
const COLDSTART_SKILL_NAME = 'autosnippet-coldstart';
|
|
15
15
|
/**
|
|
16
16
|
* 加载 Bootstrap 相关 Skills(仅 coldstart Skill)
|
|
@@ -136,6 +136,7 @@ export async function bootstrapExternal(ctx) {
|
|
|
136
136
|
languageExtension: buildLanguageExtension(primaryLang), // §7.1
|
|
137
137
|
incrementalPlan,
|
|
138
138
|
languageStats: langStats,
|
|
139
|
+
panoramaResult: phaseResults.panoramaResult, // §M1: Phase 1.8 全景数据
|
|
139
140
|
});
|
|
140
141
|
// 附加 warnings
|
|
141
142
|
if (phaseResults.warnings.length > 0) {
|
|
@@ -351,6 +351,8 @@ export async function bootstrapKnowledge(ctx, args) {
|
|
|
351
351
|
projectRoot,
|
|
352
352
|
// v5.0: 增量 Bootstrap 计划
|
|
353
353
|
incrementalPlan,
|
|
354
|
+
// M1: Phase 1.8 全景数据 → strategyContext.panorama
|
|
355
|
+
panoramaResult: phaseResults.panoramaResult,
|
|
354
356
|
};
|
|
355
357
|
// 使用 setImmediate 避免阻塞 HTTP 响应
|
|
356
358
|
// skipAsyncFill: CLI 非 --wait 模式跳过异步填充,避免进程退出后 DB 断连
|
|
@@ -67,6 +67,7 @@ export declare function getRecipe(ctx: McpContext, args: BrowseGetArgs): Promise
|
|
|
67
67
|
} | undefined;
|
|
68
68
|
headers: string[] | undefined;
|
|
69
69
|
reasoning: {
|
|
70
|
+
sources?: unknown[] | undefined;
|
|
70
71
|
confidence?: number | undefined;
|
|
71
72
|
whyStandard?: string | undefined;
|
|
72
73
|
} | undefined;
|
|
@@ -74,11 +74,12 @@ function _projectForAgent(json) {
|
|
|
74
74
|
...((json.content.steps?.length ?? 0) > 0 ? { steps: json.content.steps } : {}),
|
|
75
75
|
}
|
|
76
76
|
: undefined;
|
|
77
|
-
// reasoning
|
|
77
|
+
// reasoning 精简:保留 whyStandard + confidence + sources(可信度证据链)
|
|
78
78
|
const reasoning = json.reasoning
|
|
79
79
|
? {
|
|
80
80
|
...(json.reasoning.whyStandard ? { whyStandard: json.reasoning.whyStandard } : {}),
|
|
81
81
|
...(json.reasoning.confidence != null ? { confidence: json.reasoning.confidence } : {}),
|
|
82
|
+
...((json.reasoning.sources?.length ?? 0) > 0 ? { sources: json.reasoning.sources } : {}),
|
|
82
83
|
}
|
|
83
84
|
: undefined;
|
|
84
85
|
// constraints 精简:仅保留 guards 和 sideEffects
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
*/
|
|
11
11
|
import * as guardHandlers from './guard.js';
|
|
12
12
|
import * as structureHandlers from './structure.js';
|
|
13
|
-
import type { ConsolidatedGraphArgs, ConsolidatedGuardArgs, ConsolidatedKnowledgeArgs, ConsolidatedSearchArgs, ConsolidatedSkillArgs, ConsolidatedStructureArgs, McpContext
|
|
13
|
+
import type { ConsolidatedGraphArgs, ConsolidatedGuardArgs, ConsolidatedKnowledgeArgs, ConsolidatedSearchArgs, ConsolidatedSkillArgs, ConsolidatedStructureArgs, McpContext } from './types.js';
|
|
14
14
|
/**
|
|
15
15
|
* 统合搜索:根据 mode 参数路由到对应搜索 handler
|
|
16
16
|
* auto (默认) → search()
|
|
@@ -112,6 +112,7 @@ export declare function consolidatedKnowledge(ctx: McpContext, args: Consolidate
|
|
|
112
112
|
} | undefined;
|
|
113
113
|
headers: string[] | undefined;
|
|
114
114
|
reasoning: {
|
|
115
|
+
sources?: unknown[] | undefined;
|
|
115
116
|
confidence?: number | undefined;
|
|
116
117
|
whyStandard?: string | undefined;
|
|
117
118
|
} | undefined;
|
|
@@ -307,6 +308,9 @@ export declare function consolidatedGraph(ctx: McpContext, args: ConsolidatedGra
|
|
|
307
308
|
}>;
|
|
308
309
|
/**
|
|
309
310
|
* Guard 检查:按参数自动路由
|
|
311
|
+
* operation: 'reverse_audit' → guardReverseAudit() (Recipe→Code 反向验证)
|
|
312
|
+
* operation: 'coverage_matrix' → guardCoverageMatrix() (模块覆盖率矩阵)
|
|
313
|
+
* operation: 'compliance_report' → guardComplianceReport() (3D 合规报告)
|
|
310
314
|
* 无参数 → guardReview() (自动 git diff 检测 + inline recipe)
|
|
311
315
|
* 有 files → guardReview() (指定文件 + inline recipe) — files 为 string[] 或 {path}[]
|
|
312
316
|
* 有 code → guardCheck() (单文件内联检查)
|
|
@@ -389,6 +393,12 @@ export declare function consolidatedGuard(ctx: McpContext, args: ConsolidatedGua
|
|
|
389
393
|
errorCode: string | null;
|
|
390
394
|
message: string;
|
|
391
395
|
data: {
|
|
396
|
+
uncertainSummary?: {
|
|
397
|
+
total: number;
|
|
398
|
+
byLayer: Record<string, number>;
|
|
399
|
+
byReason: Record<string, number>;
|
|
400
|
+
} | undefined;
|
|
401
|
+
uncertainResults?: unknown[] | undefined;
|
|
392
402
|
passed: boolean;
|
|
393
403
|
reviewRound: any;
|
|
394
404
|
fileSource: string;
|
|
@@ -407,6 +417,100 @@ export declare function consolidatedGuard(ctx: McpContext, args: ConsolidatedGua
|
|
|
407
417
|
version: string;
|
|
408
418
|
tool?: string | undefined;
|
|
409
419
|
};
|
|
420
|
+
} | {
|
|
421
|
+
success: boolean;
|
|
422
|
+
errorCode: string | null;
|
|
423
|
+
message: string;
|
|
424
|
+
data: {
|
|
425
|
+
totalRecipes: number;
|
|
426
|
+
healthy: number;
|
|
427
|
+
investigate: number;
|
|
428
|
+
decay: number;
|
|
429
|
+
drifts: {
|
|
430
|
+
recipeId: string;
|
|
431
|
+
title: string;
|
|
432
|
+
recommendation: import("../../../service/guard/ReverseGuard.js").ReverseRecommendation;
|
|
433
|
+
signals: import("../../../service/guard/ReverseGuard.js").PatternDriftSignal[];
|
|
434
|
+
}[];
|
|
435
|
+
allResults: {
|
|
436
|
+
recipeId: string;
|
|
437
|
+
title: string;
|
|
438
|
+
recommendation: import("../../../service/guard/ReverseGuard.js").ReverseRecommendation;
|
|
439
|
+
signalCount: number;
|
|
440
|
+
}[];
|
|
441
|
+
} | null;
|
|
442
|
+
meta: {
|
|
443
|
+
source?: string | undefined;
|
|
444
|
+
responseTimeMs?: number | undefined;
|
|
445
|
+
version: string;
|
|
446
|
+
tool?: string | undefined;
|
|
447
|
+
};
|
|
448
|
+
} | {
|
|
449
|
+
success: boolean;
|
|
450
|
+
errorCode: string | null;
|
|
451
|
+
message: string;
|
|
452
|
+
data: {
|
|
453
|
+
overallCoverage: number;
|
|
454
|
+
zeroModules: string[];
|
|
455
|
+
lowModules: string[];
|
|
456
|
+
modules: import("../../../service/guard/CoverageAnalyzer.js").ModuleCoverage[];
|
|
457
|
+
} | null;
|
|
458
|
+
meta: {
|
|
459
|
+
source?: string | undefined;
|
|
460
|
+
responseTimeMs?: number | undefined;
|
|
461
|
+
version: string;
|
|
462
|
+
tool?: string | undefined;
|
|
463
|
+
};
|
|
464
|
+
} | {
|
|
465
|
+
success: boolean;
|
|
466
|
+
errorCode: string | null;
|
|
467
|
+
message: string;
|
|
468
|
+
data: {
|
|
469
|
+
scores: {
|
|
470
|
+
compliance: number;
|
|
471
|
+
coverage: number;
|
|
472
|
+
confidence: number;
|
|
473
|
+
};
|
|
474
|
+
qualityGate: {
|
|
475
|
+
status: string;
|
|
476
|
+
score: number;
|
|
477
|
+
thresholds: {
|
|
478
|
+
maxErrors: number;
|
|
479
|
+
maxWarnings: number;
|
|
480
|
+
minScore: number;
|
|
481
|
+
};
|
|
482
|
+
};
|
|
483
|
+
summary: {
|
|
484
|
+
filesScanned: number;
|
|
485
|
+
totalViolations: number;
|
|
486
|
+
errors: number;
|
|
487
|
+
warnings: number;
|
|
488
|
+
infos: number;
|
|
489
|
+
};
|
|
490
|
+
uncertainSummary: {
|
|
491
|
+
total: number;
|
|
492
|
+
byLayer: Record<string, number>;
|
|
493
|
+
byReason: Record<string, number>;
|
|
494
|
+
};
|
|
495
|
+
boundaries: {
|
|
496
|
+
type: string;
|
|
497
|
+
description: string;
|
|
498
|
+
affectedRules: string[];
|
|
499
|
+
suggestedAction: string;
|
|
500
|
+
}[];
|
|
501
|
+
topViolations: any[];
|
|
502
|
+
trend: {
|
|
503
|
+
errorsChange: number;
|
|
504
|
+
warningsChange: number;
|
|
505
|
+
hasHistory: boolean;
|
|
506
|
+
};
|
|
507
|
+
} | null;
|
|
508
|
+
meta: {
|
|
509
|
+
source?: string | undefined;
|
|
510
|
+
responseTimeMs?: number | undefined;
|
|
511
|
+
version: string;
|
|
512
|
+
tool?: string | undefined;
|
|
513
|
+
};
|
|
410
514
|
}>;
|
|
411
515
|
/**
|
|
412
516
|
* Skill 管理:根据 operation 参数路由
|
|
@@ -419,15 +523,22 @@ export declare function consolidatedGuard(ctx: McpContext, args: ConsolidatedGua
|
|
|
419
523
|
*/
|
|
420
524
|
export declare function consolidatedSkill(ctx: McpContext, args: ConsolidatedSkillArgs): Promise<string>;
|
|
421
525
|
/**
|
|
422
|
-
*
|
|
423
|
-
*
|
|
424
|
-
*
|
|
526
|
+
* 统一提交管线:单条与批量走同一代码路径。
|
|
527
|
+
*
|
|
528
|
+
* 流程:
|
|
529
|
+
* 1. 解析 items[] → 限流
|
|
530
|
+
* 2. 严格校验所有条目(UnifiedValidator)→ valid[] + rejected[]
|
|
531
|
+
* 3. 融合分析(ConsolidationAdvisor.analyzeBatch)→ submittable[] + blocked[]
|
|
532
|
+
* 4. 提交 submittable → enrich + service.create()
|
|
533
|
+
* 5. 返回统一结果
|
|
425
534
|
*
|
|
426
535
|
* 设计原则:
|
|
427
536
|
* - 不降级:缺字段不自动补全,要求 Agent 一次性生成完整数据
|
|
428
|
-
* -
|
|
537
|
+
* - 不碎片化:优先增强已有 Recipe,而非总新建
|
|
538
|
+
* - 不重复提交:拒绝时不创建任何记录
|
|
539
|
+
* - 单条/批量完全一致的校验与融合逻辑
|
|
429
540
|
*/
|
|
430
|
-
export declare function enhancedSubmitKnowledge(ctx: McpContext, args:
|
|
541
|
+
export declare function enhancedSubmitKnowledge(ctx: McpContext, args: Record<string, unknown>): Promise<{
|
|
431
542
|
success: boolean;
|
|
432
543
|
errorCode: string | null;
|
|
433
544
|
message: string;
|