autosnippet 3.3.5 → 3.3.7
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-FHns2ypa.js +1 -0
- package/dashboard/dist/assets/index-BRJv5Y3r.js +135 -0
- package/dashboard/dist/assets/index-DzoB7kxK.css +1 -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 +137 -9
- package/dist/lib/agent/AgentFactory.d.ts +0 -17
- package/dist/lib/agent/AgentFactory.js +1 -25
- package/dist/lib/agent/AgentRuntime.d.ts +2 -2
- package/dist/lib/agent/AgentRuntime.js +26 -18
- 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/ChatAgentTasks.js +4 -0
- 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/forced-summary.js +7 -2
- 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 +5 -5
- package/dist/lib/cli/KnowledgeSyncService.js +1 -1
- package/dist/lib/core/AstAnalyzer.d.ts +1 -0
- package/dist/lib/core/discovery/ConfigWatcher.d.ts +64 -0
- package/dist/lib/core/discovery/ConfigWatcher.js +336 -0
- package/dist/lib/core/discovery/CustomConfigDiscoverer.d.ts +30 -0
- package/dist/lib/core/discovery/CustomConfigDiscoverer.js +1305 -0
- package/dist/lib/core/discovery/DiscovererPreference.d.ts +44 -0
- package/dist/lib/core/discovery/DiscovererPreference.js +141 -0
- package/dist/lib/core/discovery/DiscovererRegistry.d.ts +10 -1
- package/dist/lib/core/discovery/DiscovererRegistry.js +42 -2
- package/dist/lib/core/discovery/ProjectDiscoverer.d.ts +19 -0
- package/dist/lib/core/discovery/index.d.ts +2 -0
- package/dist/lib/core/discovery/index.js +4 -0
- package/dist/lib/core/discovery/parsers/CMakeParser.d.ts +32 -0
- package/dist/lib/core/discovery/parsers/CMakeParser.js +148 -0
- package/dist/lib/core/discovery/parsers/GradleDslParser.d.ts +43 -0
- package/dist/lib/core/discovery/parsers/GradleDslParser.js +171 -0
- package/dist/lib/core/discovery/parsers/JsonConfigParser.d.ts +45 -0
- package/dist/lib/core/discovery/parsers/JsonConfigParser.js +122 -0
- package/dist/lib/core/discovery/parsers/RubyDslParser.d.ts +49 -0
- package/dist/lib/core/discovery/parsers/RubyDslParser.js +282 -0
- package/dist/lib/core/discovery/parsers/StarlarkParser.d.ts +33 -0
- package/dist/lib/core/discovery/parsers/StarlarkParser.js +229 -0
- package/dist/lib/core/discovery/parsers/YamlConfigParser.d.ts +37 -0
- package/dist/lib/core/discovery/parsers/YamlConfigParser.js +212 -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 +40 -112
- package/dist/lib/domain/knowledge/KnowledgeEntry.js +44 -9
- 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/external/ai/AiProvider.d.ts +12 -0
- package/dist/lib/external/ai/AiProvider.js +24 -0
- package/dist/lib/external/ai/AiProviderManager.d.ts +101 -0
- package/dist/lib/external/ai/AiProviderManager.js +193 -0
- package/dist/lib/external/ai/providers/ClaudeProvider.js +11 -0
- package/dist/lib/external/ai/providers/GoogleGeminiProvider.js +18 -0
- package/dist/lib/external/ai/providers/MockProvider.d.ts +21 -3
- package/dist/lib/external/ai/providers/MockProvider.js +290 -14
- package/dist/lib/external/ai/providers/OpenAiProvider.js +16 -0
- package/dist/lib/external/lark/LarkTransport.d.ts +5 -1
- package/dist/lib/external/lark/LarkTransport.js +10 -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/mock-pipeline.d.ts +20 -0
- package/dist/lib/external/mcp/handlers/bootstrap/pipeline/mock-pipeline.js +432 -0
- package/dist/lib/external/mcp/handlers/bootstrap/pipeline/orchestrator.d.ts +99 -12
- package/dist/lib/external/mcp/handlers/bootstrap/pipeline/orchestrator.js +188 -169
- package/dist/lib/external/mcp/handlers/bootstrap/pipeline/tier-scheduler.js +7 -17
- package/dist/lib/external/mcp/handlers/bootstrap/refine.js +8 -0
- 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 +23 -10
- package/dist/lib/external/mcp/handlers/bootstrap-external.js +41 -51
- package/dist/lib/external/mcp/handlers/bootstrap-internal.d.ts +2 -0
- package/dist/lib/external/mcp/handlers/bootstrap-internal.js +117 -82
- package/dist/lib/external/mcp/handlers/consolidated.d.ts +4 -4
- package/dist/lib/external/mcp/handlers/consolidated.js +108 -332
- package/dist/lib/external/mcp/handlers/dimension-complete-external.js +71 -2
- package/dist/lib/external/mcp/handlers/evolve-external.d.ts +54 -0
- package/dist/lib/external/mcp/handlers/evolve-external.js +229 -0
- package/dist/lib/external/mcp/handlers/knowledge.js +30 -5
- 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 +58 -2
- package/dist/lib/http/routes/ai.js +111 -30
- package/dist/lib/http/routes/candidates.js +11 -4
- package/dist/lib/http/routes/commands.js +10 -1
- package/dist/lib/http/routes/health.js +11 -0
- package/dist/lib/http/routes/knowledge.js +122 -1
- package/dist/lib/http/routes/modules.js +52 -3
- package/dist/lib/http/routes/panorama.js +16 -4
- package/dist/lib/http/routes/recipes.js +7 -0
- package/dist/lib/http/utils/routeHelpers.js +2 -1
- 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.d.ts +6 -5
- package/dist/lib/injection/ServiceContainer.js +64 -25
- package/dist/lib/injection/ServiceMap.d.ts +10 -1
- package/dist/lib/injection/modules/AiModule.d.ts +6 -9
- package/dist/lib/injection/modules/AiModule.js +82 -39
- package/dist/lib/injection/modules/KnowledgeModule.js +15 -1
- package/dist/lib/injection/modules/PanoramaModule.js +1 -1
- 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 +5 -0
- package/dist/lib/service/bootstrap/UiStartupTasks.js +20 -0
- 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 +132 -0
- package/dist/lib/service/cleanup/CleanupService.js +571 -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/ProposalExecutor.d.ts +4 -0
- package/dist/lib/service/evolution/ProposalExecutor.js +77 -13
- 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/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/knowledge/CodeEntityGraph.d.ts +6 -0
- package/dist/lib/service/knowledge/CodeEntityGraph.js +16 -0
- 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 +67 -14
- package/dist/lib/service/knowledge/RecipeProductionGateway.d.ts +225 -0
- package/dist/lib/service/knowledge/RecipeProductionGateway.js +384 -0
- package/dist/lib/service/module/ModuleService.js +10 -19
- package/dist/lib/service/panorama/CouplingAnalyzer.d.ts +10 -1
- package/dist/lib/service/panorama/CouplingAnalyzer.js +44 -2
- package/dist/lib/service/panorama/DimensionAnalyzer.d.ts +4 -3
- package/dist/lib/service/panorama/DimensionAnalyzer.js +40 -151
- package/dist/lib/service/panorama/LayerInferrer.d.ts +16 -1
- package/dist/lib/service/panorama/LayerInferrer.js +118 -1
- package/dist/lib/service/panorama/ModuleDiscoverer.d.ts +9 -0
- package/dist/lib/service/panorama/ModuleDiscoverer.js +58 -2
- package/dist/lib/service/panorama/PanoramaAggregator.d.ts +6 -2
- package/dist/lib/service/panorama/PanoramaAggregator.js +84 -6
- package/dist/lib/service/panorama/PanoramaScanner.js +28 -0
- package/dist/lib/service/panorama/PanoramaService.js +10 -5
- package/dist/lib/service/panorama/PanoramaTypes.d.ts +38 -0
- package/dist/lib/service/panorama/RoleRefiner.d.ts +2 -0
- package/dist/lib/service/panorama/RoleRefiner.js +41 -0
- package/dist/lib/service/panorama/TechStackProfiler.d.ts +13 -0
- package/dist/lib/service/panorama/TechStackProfiler.js +191 -0
- 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/service/skills/SignalCollector.d.ts +1 -0
- package/dist/lib/service/skills/SignalCollector.js +6 -5
- package/dist/lib/service/vector/ContextualEnricher.d.ts +1 -0
- package/dist/lib/service/vector/ContextualEnricher.js +4 -0
- package/dist/lib/shared/LanguageService.js +3 -0
- package/dist/lib/shared/developer-identity.d.ts +18 -0
- package/dist/lib/shared/developer-identity.js +62 -0
- package/dist/lib/shared/schemas/common.d.ts +4 -4
- package/dist/lib/shared/schemas/http-requests.d.ts +20 -18
- package/dist/lib/shared/schemas/http-requests.js +17 -6
- package/dist/lib/shared/schemas/mcp-tools.d.ts +32 -2
- package/dist/lib/shared/schemas/mcp-tools.js +38 -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 +132 -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,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* UnifiedDimension — 统一维度类型定义
|
|
3
|
+
*
|
|
4
|
+
* Bootstrap / Panorama / Rescan 共用的维度接口,
|
|
5
|
+
* 消除三套维度体系之间的 ID 不一致和字段缺失问题。
|
|
6
|
+
*
|
|
7
|
+
* 设计文档: docs/copilot/unified-dimension-design.md §4
|
|
8
|
+
*
|
|
9
|
+
* @module domain/dimension/UnifiedDimension
|
|
10
|
+
*/
|
|
11
|
+
/** 统一维度定义 — Bootstrap/Panorama/Rescan 共用 */
|
|
12
|
+
export interface UnifiedDimension {
|
|
13
|
+
/** 维度唯一 ID,kebab-case */
|
|
14
|
+
readonly id: string;
|
|
15
|
+
/** 维度中文标签(Dashboard 分组标签) */
|
|
16
|
+
readonly label: string;
|
|
17
|
+
/** 层级: universal | language | framework */
|
|
18
|
+
readonly layer: 'universal' | 'language' | 'framework';
|
|
19
|
+
/** Lucide 图标名 */
|
|
20
|
+
readonly icon: string;
|
|
21
|
+
/** Tailwind 颜色族(如 'violet', 'fuchsia', 'sky') */
|
|
22
|
+
readonly colorFamily: string;
|
|
23
|
+
/** 提取指南 — 告诉 Agent 从项目中挖掘什么 */
|
|
24
|
+
readonly extractionGuide: string;
|
|
25
|
+
/** 允许的 knowledgeType */
|
|
26
|
+
readonly allowedKnowledgeTypes: readonly string[];
|
|
27
|
+
/** 输出模式(当前阶段仅 candidate-only,Skill 后续规划) */
|
|
28
|
+
readonly outputMode: 'candidate-only';
|
|
29
|
+
/** 健康评估描述 */
|
|
30
|
+
readonly qualityDescription: string;
|
|
31
|
+
/** 主匹配字段: topicHint */
|
|
32
|
+
readonly matchTopics: readonly string[];
|
|
33
|
+
/** 次匹配字段: category */
|
|
34
|
+
readonly matchCategories: readonly string[];
|
|
35
|
+
/** 维度权重 (0-1, Panorama 加权平均) */
|
|
36
|
+
readonly weight: number;
|
|
37
|
+
/** gap 时的建议主题 */
|
|
38
|
+
readonly suggestedTopics: readonly string[];
|
|
39
|
+
/** 关联模块角色 (gap 优先级推断) */
|
|
40
|
+
readonly relatedRoles: readonly string[];
|
|
41
|
+
readonly conditions?: {
|
|
42
|
+
readonly languages?: readonly string[];
|
|
43
|
+
readonly frameworks?: readonly string[];
|
|
44
|
+
};
|
|
45
|
+
/** 1=最先 (Tier 1), 2=中间, 3=最后 */
|
|
46
|
+
readonly tierHint?: number;
|
|
47
|
+
/** Dashboard 展示分组 */
|
|
48
|
+
readonly displayGroup: 'architecture' | 'best-practice' | 'data-event-flow' | 'deep-scan';
|
|
49
|
+
}
|
|
50
|
+
/** Layer 1: 通用维度 ID */
|
|
51
|
+
export declare const UNIVERSAL_DIM_IDS: readonly ["architecture", "coding-standards", "design-patterns", "error-resilience", "concurrency-async", "data-event-flow", "networking-api", "ui-interaction", "testing-quality", "security-auth", "performance-optimization", "observability-logging", "agent-guidelines"];
|
|
52
|
+
/** Layer 2: 语言维度 ID */
|
|
53
|
+
export declare const LANGUAGE_DIM_IDS: readonly ["swift-objc-idiom", "ts-js-module", "python-structure", "jvm-annotation", "go-module", "rust-ownership", "csharp-dotnet"];
|
|
54
|
+
/** Layer 3: 框架维度 ID */
|
|
55
|
+
export declare const FRAMEWORK_DIM_IDS: readonly ["react-patterns", "vue-patterns", "spring-patterns", "swiftui-patterns", "django-fastapi"];
|
|
56
|
+
export type UniversalDimId = (typeof UNIVERSAL_DIM_IDS)[number];
|
|
57
|
+
export type LanguageDimId = (typeof LANGUAGE_DIM_IDS)[number];
|
|
58
|
+
export type FrameworkDimId = (typeof FRAMEWORK_DIM_IDS)[number];
|
|
59
|
+
export type DimensionId = UniversalDimId | LanguageDimId | FrameworkDimId;
|
|
60
|
+
/** 所有维度 ID 数组 */
|
|
61
|
+
export declare const ALL_DIMENSION_IDS: readonly ["architecture", "coding-standards", "design-patterns", "error-resilience", "concurrency-async", "data-event-flow", "networking-api", "ui-interaction", "testing-quality", "security-auth", "performance-optimization", "observability-logging", "agent-guidelines", "swift-objc-idiom", "ts-js-module", "python-structure", "jvm-annotation", "go-module", "rust-ownership", "csharp-dotnet", "react-patterns", "vue-patterns", "spring-patterns", "swiftui-patterns", "django-fastapi"];
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* UnifiedDimension — 统一维度类型定义
|
|
3
|
+
*
|
|
4
|
+
* Bootstrap / Panorama / Rescan 共用的维度接口,
|
|
5
|
+
* 消除三套维度体系之间的 ID 不一致和字段缺失问题。
|
|
6
|
+
*
|
|
7
|
+
* 设计文档: docs/copilot/unified-dimension-design.md §4
|
|
8
|
+
*
|
|
9
|
+
* @module domain/dimension/UnifiedDimension
|
|
10
|
+
*/
|
|
11
|
+
// ═══════════════════════════════════════════════════════════
|
|
12
|
+
// 维度 ID 常量
|
|
13
|
+
// ═══════════════════════════════════════════════════════════
|
|
14
|
+
/** Layer 1: 通用维度 ID */
|
|
15
|
+
export const UNIVERSAL_DIM_IDS = [
|
|
16
|
+
'architecture',
|
|
17
|
+
'coding-standards',
|
|
18
|
+
'design-patterns',
|
|
19
|
+
'error-resilience',
|
|
20
|
+
'concurrency-async',
|
|
21
|
+
'data-event-flow',
|
|
22
|
+
'networking-api',
|
|
23
|
+
'ui-interaction',
|
|
24
|
+
'testing-quality',
|
|
25
|
+
'security-auth',
|
|
26
|
+
'performance-optimization',
|
|
27
|
+
'observability-logging',
|
|
28
|
+
'agent-guidelines',
|
|
29
|
+
];
|
|
30
|
+
/** Layer 2: 语言维度 ID */
|
|
31
|
+
export const LANGUAGE_DIM_IDS = [
|
|
32
|
+
'swift-objc-idiom',
|
|
33
|
+
'ts-js-module',
|
|
34
|
+
'python-structure',
|
|
35
|
+
'jvm-annotation',
|
|
36
|
+
'go-module',
|
|
37
|
+
'rust-ownership',
|
|
38
|
+
'csharp-dotnet',
|
|
39
|
+
];
|
|
40
|
+
/** Layer 3: 框架维度 ID */
|
|
41
|
+
export const FRAMEWORK_DIM_IDS = [
|
|
42
|
+
'react-patterns',
|
|
43
|
+
'vue-patterns',
|
|
44
|
+
'spring-patterns',
|
|
45
|
+
'swiftui-patterns',
|
|
46
|
+
'django-fastapi',
|
|
47
|
+
];
|
|
48
|
+
/** 所有维度 ID 数组 */
|
|
49
|
+
export const ALL_DIMENSION_IDS = [
|
|
50
|
+
...UNIVERSAL_DIM_IDS,
|
|
51
|
+
...LANGUAGE_DIM_IDS,
|
|
52
|
+
...FRAMEWORK_DIM_IDS,
|
|
53
|
+
];
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* dimension domain — 统一维度体系
|
|
3
|
+
*
|
|
4
|
+
* @module domain/dimension
|
|
5
|
+
*/
|
|
6
|
+
export { DimensionCopy } from './DimensionCopy.js';
|
|
7
|
+
export { buildTierPlan, classifyRecipeToDimension, DIMENSION_DISPLAY_GROUP, DIMENSION_REGISTRY, getDimension, getDimensionsByLayer, resolveActiveDimensions, } from './DimensionRegistry.js';
|
|
8
|
+
export { getDimensionFocusKeywords, getDimensionSOP, PRE_SUBMIT_CHECKLIST, sopToCompactText, } from './DimensionSop.js';
|
|
9
|
+
export type { DimensionId, FrameworkDimId, LanguageDimId, UnifiedDimension, UniversalDimId, } from './UnifiedDimension.js';
|
|
10
|
+
export { ALL_DIMENSION_IDS, FRAMEWORK_DIM_IDS, LANGUAGE_DIM_IDS, UNIVERSAL_DIM_IDS, } from './UnifiedDimension.js';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* dimension domain — 统一维度体系
|
|
3
|
+
*
|
|
4
|
+
* @module domain/dimension
|
|
5
|
+
*/
|
|
6
|
+
export { DimensionCopy } from './DimensionCopy.js';
|
|
7
|
+
export { buildTierPlan, classifyRecipeToDimension, DIMENSION_DISPLAY_GROUP, DIMENSION_REGISTRY, getDimension, getDimensionsByLayer, resolveActiveDimensions, } from './DimensionRegistry.js';
|
|
8
|
+
export { getDimensionFocusKeywords, getDimensionSOP, PRE_SUBMIT_CHECKLIST, sopToCompactText, } from './DimensionSop.js';
|
|
9
|
+
export { ALL_DIMENSION_IDS, FRAMEWORK_DIM_IDS, LANGUAGE_DIM_IDS, UNIVERSAL_DIM_IDS, } from './UnifiedDimension.js';
|
|
@@ -54,7 +54,7 @@ export declare const V3_FIELD_SPEC: ({
|
|
|
54
54
|
systemInjected?: undefined;
|
|
55
55
|
})[];
|
|
56
56
|
export declare const STANDARD_CATEGORIES: string[];
|
|
57
|
-
/** category 白名单 —
|
|
57
|
+
/** category 白名单 — 统一维度 ID + 特殊流程中的合法 category */
|
|
58
58
|
export declare const WHITELISTED_CATEGORIES: string[];
|
|
59
59
|
export declare const VALID_KINDS: string[];
|
|
60
60
|
export declare const VALID_TOPIC_HINTS: string[];
|
|
@@ -32,7 +32,7 @@ export const V3_FIELD_SPEC = [
|
|
|
32
32
|
name: 'title',
|
|
33
33
|
level: FieldLevel.REQUIRED,
|
|
34
34
|
type: 'string',
|
|
35
|
-
rule: '中文 ≤20
|
|
35
|
+
rule: '中文 ≤20 字,引用项目真实类名(不以项目名开头)',
|
|
36
36
|
pipeline: 'identity + dedup + search + QualityScorer(completeness 0.25)',
|
|
37
37
|
},
|
|
38
38
|
{
|
|
@@ -226,24 +226,37 @@ export const STANDARD_CATEGORIES = [
|
|
|
226
226
|
'UI',
|
|
227
227
|
'Utility',
|
|
228
228
|
];
|
|
229
|
-
/** category 白名单 —
|
|
229
|
+
/** category 白名单 — 统一维度 ID + 特殊流程中的合法 category */
|
|
230
230
|
export const WHITELISTED_CATEGORIES = [
|
|
231
|
-
//
|
|
231
|
+
// ── Layer 1: 通用维度 ──
|
|
232
232
|
'architecture',
|
|
233
|
-
'
|
|
234
|
-
'
|
|
235
|
-
'
|
|
233
|
+
'coding-standards',
|
|
234
|
+
'design-patterns',
|
|
235
|
+
'error-resilience',
|
|
236
|
+
'concurrency-async',
|
|
237
|
+
'data-event-flow',
|
|
238
|
+
'networking-api',
|
|
239
|
+
'ui-interaction',
|
|
240
|
+
'testing-quality',
|
|
241
|
+
'security-auth',
|
|
242
|
+
'performance-optimization',
|
|
243
|
+
'observability-logging',
|
|
236
244
|
'agent-guidelines',
|
|
237
|
-
//
|
|
238
|
-
'
|
|
239
|
-
'
|
|
240
|
-
'
|
|
241
|
-
'
|
|
242
|
-
'module
|
|
243
|
-
'
|
|
244
|
-
'
|
|
245
|
-
|
|
246
|
-
|
|
245
|
+
// ── Layer 2: 语言维度 ──
|
|
246
|
+
'swift-objc-idiom',
|
|
247
|
+
'ts-js-module',
|
|
248
|
+
'python-structure',
|
|
249
|
+
'jvm-annotation',
|
|
250
|
+
'go-module',
|
|
251
|
+
'rust-ownership',
|
|
252
|
+
'csharp-dotnet',
|
|
253
|
+
// ── Layer 3: 框架维度 ──
|
|
254
|
+
'react-patterns',
|
|
255
|
+
'vue-patterns',
|
|
256
|
+
'spring-patterns',
|
|
257
|
+
'swiftui-patterns',
|
|
258
|
+
'django-fastapi',
|
|
259
|
+
// ── 特殊来源 ──
|
|
247
260
|
'bootstrap',
|
|
248
261
|
'knowledge',
|
|
249
262
|
'general',
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { KnowledgeEntryWire } from '#types/knowledge-wire.js';
|
|
2
2
|
import { Constraints, Content, Quality, Reasoning, Relations, Stats } from './values/index.js';
|
|
3
3
|
export interface KnowledgeEntryProps {
|
|
4
4
|
id?: string;
|
|
@@ -61,6 +61,7 @@ export declare class KnowledgeEntry {
|
|
|
61
61
|
from: string;
|
|
62
62
|
to: string;
|
|
63
63
|
at: number;
|
|
64
|
+
by?: string;
|
|
64
65
|
}>;
|
|
65
66
|
autoApprovable: boolean;
|
|
66
67
|
stagingDeadline: number | null;
|
|
@@ -104,29 +105,59 @@ export declare class KnowledgeEntry {
|
|
|
104
105
|
publishedBy: string | null;
|
|
105
106
|
constructor(props?: KnowledgeEntryProps);
|
|
106
107
|
/**
|
|
107
|
-
* 发布 (pending → active)
|
|
108
|
-
* @returns }
|
|
108
|
+
* 发布 (pending|staging|evolving → active)
|
|
109
109
|
*/
|
|
110
110
|
publish(publisher: string): {
|
|
111
111
|
success: boolean;
|
|
112
112
|
error?: string;
|
|
113
113
|
};
|
|
114
114
|
/**
|
|
115
|
-
*
|
|
116
|
-
|
|
115
|
+
* 进入暂存期 (pending → staging)
|
|
116
|
+
*/
|
|
117
|
+
stage(): {
|
|
118
|
+
success: boolean;
|
|
119
|
+
error?: string;
|
|
120
|
+
};
|
|
121
|
+
/**
|
|
122
|
+
* 进入进化态 (active → evolving)
|
|
123
|
+
*/
|
|
124
|
+
evolve(): {
|
|
125
|
+
success: boolean;
|
|
126
|
+
error?: string;
|
|
127
|
+
};
|
|
128
|
+
/**
|
|
129
|
+
* 进入衰退观察 (active|evolving → decaying)
|
|
130
|
+
*/
|
|
131
|
+
decay(): {
|
|
132
|
+
success: boolean;
|
|
133
|
+
error?: string;
|
|
134
|
+
};
|
|
135
|
+
/**
|
|
136
|
+
* 恢复为已发布 (decaying|evolving → active),不更新 publishedAt
|
|
137
|
+
*/
|
|
138
|
+
restore(): {
|
|
139
|
+
success: boolean;
|
|
140
|
+
error?: string;
|
|
141
|
+
};
|
|
142
|
+
/**
|
|
143
|
+
* 弃用 (pending|active|decaying → deprecated)
|
|
117
144
|
*/
|
|
118
145
|
deprecate(reason: string): {
|
|
119
146
|
success: boolean;
|
|
120
147
|
error?: string;
|
|
121
148
|
};
|
|
122
149
|
/**
|
|
123
|
-
* 重新激活 (deprecated → pending)
|
|
124
|
-
* @returns }
|
|
150
|
+
* 重新激活 (deprecated|staging → pending)
|
|
125
151
|
*/
|
|
126
152
|
reactivate(): {
|
|
127
153
|
success: boolean;
|
|
128
154
|
error?: string;
|
|
129
155
|
};
|
|
156
|
+
/**
|
|
157
|
+
* 将最后一条 lifecycleHistory 条目标记操作人。
|
|
158
|
+
* 由 KnowledgeService._lifecycleTransition() 在 entity method 执行后调用。
|
|
159
|
+
*/
|
|
160
|
+
stampLastTransition(by: string): void;
|
|
130
161
|
/** 是否处于候选阶段 */
|
|
131
162
|
isCandidate(): boolean;
|
|
132
163
|
/** 是否可被 Guard/Search/Export 消费 */
|
|
@@ -165,114 +196,11 @@ export declare class KnowledgeEntry {
|
|
|
165
196
|
* Domain → JSON (camelCase 直出,全链路统一)
|
|
166
197
|
* 注意: tags 保留原始值(含系统标签),对外 API 使用 sanitizeForAPI() 过滤
|
|
167
198
|
*/
|
|
168
|
-
toJSON():
|
|
169
|
-
id: string;
|
|
170
|
-
title: string;
|
|
171
|
-
description: string;
|
|
172
|
-
lifecycle: string;
|
|
173
|
-
lifecycleHistory: {
|
|
174
|
-
from: string;
|
|
175
|
-
to: string;
|
|
176
|
-
at: number;
|
|
177
|
-
}[];
|
|
178
|
-
autoApprovable: boolean;
|
|
179
|
-
language: string;
|
|
180
|
-
category: string;
|
|
181
|
-
kind: string;
|
|
182
|
-
knowledgeType: string;
|
|
183
|
-
complexity: string;
|
|
184
|
-
scope: string;
|
|
185
|
-
difficulty: string | null;
|
|
186
|
-
tags: string[];
|
|
187
|
-
trigger: string;
|
|
188
|
-
topicHint: string;
|
|
189
|
-
whenClause: string;
|
|
190
|
-
doClause: string;
|
|
191
|
-
dontClause: string;
|
|
192
|
-
coreCode: string;
|
|
193
|
-
usageGuide: string;
|
|
194
|
-
content: {
|
|
195
|
-
pattern: string;
|
|
196
|
-
markdown: string;
|
|
197
|
-
rationale: string;
|
|
198
|
-
steps: {
|
|
199
|
-
title?: string;
|
|
200
|
-
description?: string;
|
|
201
|
-
code?: string;
|
|
202
|
-
}[];
|
|
203
|
-
codeChanges: {
|
|
204
|
-
file: string;
|
|
205
|
-
before: string;
|
|
206
|
-
after: string;
|
|
207
|
-
explanation: string;
|
|
208
|
-
}[];
|
|
209
|
-
verification: {
|
|
210
|
-
method?: string;
|
|
211
|
-
expected_result?: string;
|
|
212
|
-
test_code?: string;
|
|
213
|
-
} | null;
|
|
214
|
-
};
|
|
215
|
-
relations: {
|
|
216
|
-
[x: string]: import("./values/Relations.js").RelationEntry[];
|
|
217
|
-
};
|
|
218
|
-
constraints: {
|
|
219
|
-
guards: Guard[];
|
|
220
|
-
boundaries: string[];
|
|
221
|
-
preconditions: string[];
|
|
222
|
-
sideEffects: string[];
|
|
223
|
-
};
|
|
224
|
-
reasoning: {
|
|
225
|
-
whyStandard: string;
|
|
226
|
-
sources: string[];
|
|
227
|
-
confidence: number;
|
|
228
|
-
qualitySignals: Record<string, number>;
|
|
229
|
-
alternatives: string[];
|
|
230
|
-
};
|
|
231
|
-
quality: {
|
|
232
|
-
completeness: number;
|
|
233
|
-
adaptation: number;
|
|
234
|
-
documentation: number;
|
|
235
|
-
overall: number;
|
|
236
|
-
grade: string;
|
|
237
|
-
};
|
|
238
|
-
stats: {
|
|
239
|
-
views: number;
|
|
240
|
-
adoptions: number;
|
|
241
|
-
applications: number;
|
|
242
|
-
guardHits: number;
|
|
243
|
-
searchHits: number;
|
|
244
|
-
authority: number;
|
|
245
|
-
lastHitAt: number | null;
|
|
246
|
-
lastSearchedAt: number | null;
|
|
247
|
-
lastGuardHitAt: number | null;
|
|
248
|
-
hitsLast30d: number;
|
|
249
|
-
hitsLast90d: number;
|
|
250
|
-
searchHitsLast30d: number;
|
|
251
|
-
version: number;
|
|
252
|
-
ruleFalsePositiveRate: number | null;
|
|
253
|
-
};
|
|
254
|
-
headers: string[];
|
|
255
|
-
headerPaths: string[];
|
|
256
|
-
moduleName: string;
|
|
257
|
-
includeHeaders: boolean;
|
|
258
|
-
agentNotes: string | null;
|
|
259
|
-
aiInsight: string | null;
|
|
260
|
-
reviewedBy: string | null;
|
|
261
|
-
reviewedAt: number | null;
|
|
262
|
-
rejectionReason: string | null;
|
|
263
|
-
source: string;
|
|
264
|
-
sourceFile: string | null;
|
|
265
|
-
sourceCandidateId: string | null;
|
|
266
|
-
createdBy: string;
|
|
267
|
-
createdAt: number;
|
|
268
|
-
updatedAt: number;
|
|
269
|
-
publishedAt: number | null;
|
|
270
|
-
publishedBy: string | null;
|
|
271
|
-
};
|
|
199
|
+
toJSON(): KnowledgeEntryWire;
|
|
272
200
|
/** JSON → Domain (camelCase 直入) */
|
|
273
201
|
static fromJSON(data: unknown): KnowledgeEntry;
|
|
274
202
|
/** @returns } */
|
|
275
|
-
_transition(to: string): {
|
|
203
|
+
_transition(to: string, by?: string): {
|
|
276
204
|
success: boolean;
|
|
277
205
|
error?: string;
|
|
278
206
|
};
|
|
@@ -116,8 +116,7 @@ export class KnowledgeEntry {
|
|
|
116
116
|
}
|
|
117
117
|
/* ═══ 生命周期操作 ═══════════════════════════════════ */
|
|
118
118
|
/**
|
|
119
|
-
* 发布 (pending → active)
|
|
120
|
-
* @returns }
|
|
119
|
+
* 发布 (pending|staging|evolving → active)
|
|
121
120
|
*/
|
|
122
121
|
publish(publisher) {
|
|
123
122
|
if (!this.isValid()) {
|
|
@@ -131,8 +130,31 @@ export class KnowledgeEntry {
|
|
|
131
130
|
return result;
|
|
132
131
|
}
|
|
133
132
|
/**
|
|
134
|
-
*
|
|
135
|
-
|
|
133
|
+
* 进入暂存期 (pending → staging)
|
|
134
|
+
*/
|
|
135
|
+
stage() {
|
|
136
|
+
return this._transition(Lifecycle.STAGING);
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* 进入进化态 (active → evolving)
|
|
140
|
+
*/
|
|
141
|
+
evolve() {
|
|
142
|
+
return this._transition(Lifecycle.EVOLVING);
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* 进入衰退观察 (active|evolving → decaying)
|
|
146
|
+
*/
|
|
147
|
+
decay() {
|
|
148
|
+
return this._transition(Lifecycle.DECAYING);
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* 恢复为已发布 (decaying|evolving → active),不更新 publishedAt
|
|
152
|
+
*/
|
|
153
|
+
restore() {
|
|
154
|
+
return this._transition(Lifecycle.ACTIVE);
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* 弃用 (pending|active|decaying → deprecated)
|
|
136
158
|
*/
|
|
137
159
|
deprecate(reason) {
|
|
138
160
|
const result = this._transition(Lifecycle.DEPRECATED);
|
|
@@ -142,8 +164,7 @@ export class KnowledgeEntry {
|
|
|
142
164
|
return result;
|
|
143
165
|
}
|
|
144
166
|
/**
|
|
145
|
-
* 重新激活 (deprecated → pending)
|
|
146
|
-
* @returns }
|
|
167
|
+
* 重新激活 (deprecated|staging → pending)
|
|
147
168
|
*/
|
|
148
169
|
reactivate() {
|
|
149
170
|
const result = this._transition(Lifecycle.PENDING);
|
|
@@ -152,6 +173,16 @@ export class KnowledgeEntry {
|
|
|
152
173
|
}
|
|
153
174
|
return result;
|
|
154
175
|
}
|
|
176
|
+
/**
|
|
177
|
+
* 将最后一条 lifecycleHistory 条目标记操作人。
|
|
178
|
+
* 由 KnowledgeService._lifecycleTransition() 在 entity method 执行后调用。
|
|
179
|
+
*/
|
|
180
|
+
stampLastTransition(by) {
|
|
181
|
+
const last = this.lifecycleHistory[this.lifecycleHistory.length - 1];
|
|
182
|
+
if (last) {
|
|
183
|
+
last.by = by;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
155
186
|
/* ═══ 谓词 ═══════════════════════════════════════════ */
|
|
156
187
|
/** 是否处于候选阶段 */
|
|
157
188
|
isCandidate() {
|
|
@@ -268,18 +299,22 @@ export class KnowledgeEntry {
|
|
|
268
299
|
}
|
|
269
300
|
/* ═══ 私有 ═══════════════════════════════════════════ */
|
|
270
301
|
/** @returns } */
|
|
271
|
-
_transition(to) {
|
|
302
|
+
_transition(to, by) {
|
|
272
303
|
if (!isValidTransition(this.lifecycle, to)) {
|
|
273
304
|
return {
|
|
274
305
|
success: false,
|
|
275
306
|
error: `Invalid lifecycle transition: ${this.lifecycle} → ${to}`,
|
|
276
307
|
};
|
|
277
308
|
}
|
|
278
|
-
|
|
309
|
+
const entry = {
|
|
279
310
|
from: this.lifecycle,
|
|
280
311
|
to,
|
|
281
312
|
at: this._now(),
|
|
282
|
-
}
|
|
313
|
+
};
|
|
314
|
+
if (by) {
|
|
315
|
+
entry.by = by;
|
|
316
|
+
}
|
|
317
|
+
this.lifecycleHistory.push(entry);
|
|
283
318
|
this.lifecycle = to;
|
|
284
319
|
this.updatedAt = this._now();
|
|
285
320
|
return { success: true };
|
|
@@ -16,6 +16,7 @@ export interface PaginatedResult {
|
|
|
16
16
|
export declare class KnowledgeRepository {
|
|
17
17
|
create(entry: KnowledgeEntry): Promise<KnowledgeEntry>;
|
|
18
18
|
findById(id: string): Promise<KnowledgeEntry | null>;
|
|
19
|
+
findByTitle(title: string): Promise<KnowledgeEntry | null>;
|
|
19
20
|
findWithPagination(filters?: Record<string, unknown>, options?: PaginationOptions & {
|
|
20
21
|
orderBy?: string;
|
|
21
22
|
order?: string;
|
|
@@ -11,6 +11,9 @@ export class KnowledgeRepository {
|
|
|
11
11
|
async findById(id) {
|
|
12
12
|
throw new Error('Not implemented');
|
|
13
13
|
}
|
|
14
|
+
async findByTitle(title) {
|
|
15
|
+
throw new Error('Not implemented');
|
|
16
|
+
}
|
|
14
17
|
async findWithPagination(filters, options) {
|
|
15
18
|
throw new Error('Not implemented');
|
|
16
19
|
}
|
|
@@ -33,7 +33,7 @@ const VALID_TRANSITIONS = {
|
|
|
33
33
|
[Lifecycle.PENDING]: [Lifecycle.STAGING, Lifecycle.ACTIVE, Lifecycle.DEPRECATED],
|
|
34
34
|
[Lifecycle.STAGING]: [Lifecycle.ACTIVE, Lifecycle.PENDING],
|
|
35
35
|
[Lifecycle.ACTIVE]: [Lifecycle.EVOLVING, Lifecycle.DECAYING, Lifecycle.DEPRECATED],
|
|
36
|
-
[Lifecycle.EVOLVING]: [Lifecycle.ACTIVE, Lifecycle.DECAYING],
|
|
36
|
+
[Lifecycle.EVOLVING]: [Lifecycle.STAGING, Lifecycle.ACTIVE, Lifecycle.DECAYING],
|
|
37
37
|
[Lifecycle.DECAYING]: [Lifecycle.ACTIVE, Lifecycle.DEPRECATED],
|
|
38
38
|
[Lifecycle.DEPRECATED]: [Lifecycle.PENDING],
|
|
39
39
|
};
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* @module shared/StyleGuide
|
|
8
8
|
*/
|
|
9
|
-
export declare const PROJECT_SNAPSHOT_STYLE_GUIDE = "# \u300C\u9879\u76EE\u7279\u5199\u300D\u5199\u4F5C\u8981\u6C42\n\nsubmit_knowledge \u7684 content.markdown \u5B57\u6BB5\u5FC5\u987B\u662F\u300C\u9879\u76EE\u7279\u5199\u300D\u3002\n\n## \u4EC0\u4E48\u662F\u300C\u9879\u76EE\u7279\u5199\u300D\n\u5C06\u4E00\u79CD\u6280\u672F\u7684**\u57FA\u672C\u7528\u6CD5**\u4E0E**\u672C\u9879\u76EE\u7684\u5177\u4F53\u7279\u5F81**\u878D\u5408\u4E3A\u4E00\u4F53\u3002\n\n## \u56DB\u5927\u6838\u5FC3\u5185\u5BB9\n1. **\u9879\u76EE\u9009\u62E9\u4E86\u4EC0\u4E48** \u2014 \u91C7\u7528\u4E86\u54EA\u79CD\u5199\u6CD5/\u6A21\u5F0F/\u7EA6\u5B9A\n2. **\u4E3A\u4EC0\u4E48\u8FD9\u6837\u9009** \u2014 \u7EDF\u8BA1\u5206\u5E03\u3001\u5360\u6BD4\u3001\u5386\u53F2\u51B3\u7B56\n3. **\u9879\u76EE\u7981\u6B62\u4EC0\u4E48** \u2014 \u53CD\u6A21\u5F0F\u3001\u5DF2\u5E9F\u5F03\u5199\u6CD5\n4. **\u65B0\u4EE3\u7801\u600E\u4E48\u5199** \u2014 \u53EF\u76F4\u63A5\u590D\u5236\u4F7F\u7528\u7684\u4EE3\u7801\u6A21\u677F + \u6765\u6E90\u6807\u6CE8 (\u6765\u6E90: FileName.ext:\u884C\u53F7)\n\n## \u683C\u5F0F\u8981\u6C42\n- \u6807\u9898\u4F7F\u7528\u9879\u76EE\u771F\u5B9E\u7C7B\u540D/\u524D\u7F00\uFF0C\u4E0D\u7528\u5360\u4F4D\u540D\n- \u4EE3\u7801\u6765\u6E90\u6807\u6CE8: (\u6765\u6E90: FileName.ext:\u884C\u53F7)\n- \u4E0D\u8981\u7EAF\u4EE3\u7801\u7F57\u5217\uFF0C\u5FC5\u987B\u6709\u9879\u76EE\u4E0A\u4E0B\u6587\n- \u6807\u9898\u548C\u6B63\u6587\u4E2D\u4E0D\u5F97\u51FA\u73B0 \"Agent\" \u5B57\u6837";
|
|
9
|
+
export declare const PROJECT_SNAPSHOT_STYLE_GUIDE = "# \u300C\u9879\u76EE\u7279\u5199\u300D\u5199\u4F5C\u8981\u6C42\n\nsubmit_knowledge \u7684 content.markdown \u5B57\u6BB5\u5FC5\u987B\u662F\u300C\u9879\u76EE\u7279\u5199\u300D\u3002\n\n## \u4EC0\u4E48\u662F\u300C\u9879\u76EE\u7279\u5199\u300D\n\u5C06\u4E00\u79CD\u6280\u672F\u7684**\u57FA\u672C\u7528\u6CD5**\u4E0E**\u672C\u9879\u76EE\u7684\u5177\u4F53\u7279\u5F81**\u878D\u5408\u4E3A\u4E00\u4F53\u3002\n\n## \u56DB\u5927\u6838\u5FC3\u5185\u5BB9\n1. **\u9879\u76EE\u9009\u62E9\u4E86\u4EC0\u4E48** \u2014 \u91C7\u7528\u4E86\u54EA\u79CD\u5199\u6CD5/\u6A21\u5F0F/\u7EA6\u5B9A\n2. **\u4E3A\u4EC0\u4E48\u8FD9\u6837\u9009** \u2014 \u7EDF\u8BA1\u5206\u5E03\u3001\u5360\u6BD4\u3001\u5386\u53F2\u51B3\u7B56\n3. **\u9879\u76EE\u7981\u6B62\u4EC0\u4E48** \u2014 \u53CD\u6A21\u5F0F\u3001\u5DF2\u5E9F\u5F03\u5199\u6CD5\n4. **\u65B0\u4EE3\u7801\u600E\u4E48\u5199** \u2014 \u53EF\u76F4\u63A5\u590D\u5236\u4F7F\u7528\u7684\u4EE3\u7801\u6A21\u677F + \u6765\u6E90\u6807\u6CE8 (\u6765\u6E90: FileName.ext:\u884C\u53F7)\n\n## \u683C\u5F0F\u8981\u6C42\n- \u6807\u9898\u4F7F\u7528\u9879\u76EE\u771F\u5B9E\u7C7B\u540D/\u524D\u7F00\uFF0C\u4E0D\u7528\u5360\u4F4D\u540D\uFF0C\u4E0D\u4EE5\u9879\u76EE\u540D\u5F00\u5934\n- \u4EE3\u7801\u6765\u6E90\u6807\u6CE8: (\u6765\u6E90: FileName.ext:\u884C\u53F7)\n- \u4E0D\u8981\u7EAF\u4EE3\u7801\u7F57\u5217\uFF0C\u5FC5\u987B\u6709\u9879\u76EE\u4E0A\u4E0B\u6587\n- \u6807\u9898\u548C\u6B63\u6587\u4E2D\u4E0D\u5F97\u51FA\u73B0 \"Agent\" \u5B57\u6837";
|
|
10
10
|
/** 生成 Cursor 交付字段规范文本(供 Producer STYLE_GUIDE 和 MissionBriefing 使用) */
|
|
11
11
|
export declare function getCursorDeliverySpec(): string;
|
|
12
12
|
/** 构建完整的 Producer STYLE_GUIDE(合并项目特写要求 + Cursor 交付字段规范) */
|
|
@@ -22,7 +22,7 @@ submit_knowledge 的 content.markdown 字段必须是「项目特写」。
|
|
|
22
22
|
4. **新代码怎么写** — 可直接复制使用的代码模板 + 来源标注 (来源: FileName.ext:行号)
|
|
23
23
|
|
|
24
24
|
## 格式要求
|
|
25
|
-
-
|
|
25
|
+
- 标题使用项目真实类名/前缀,不用占位名,不以项目名开头
|
|
26
26
|
- 代码来源标注: (来源: FileName.ext:行号)
|
|
27
27
|
- 不要纯代码罗列,必须有项目上下文
|
|
28
28
|
- 标题和正文中不得出现 "Agent" 字样`;
|
|
@@ -132,6 +132,12 @@ export class UnifiedValidator {
|
|
|
132
132
|
if (!hasSourceRef) {
|
|
133
133
|
warnings.push('建议在内容中标注代码来源 (来源: FileName.ext:行号)');
|
|
134
134
|
}
|
|
135
|
+
// 源码位置质量检查 — 优先使用完整相对路径
|
|
136
|
+
const hasFullPathRef = /来源[::]\s*\S+\/\S+\.\w+:\d+/.test(markdown) || /\(\S+\/\S+\.\w+:\d+\)/.test(markdown);
|
|
137
|
+
const hasBareName = /来源[::]\s*[A-Z]\w+\.\w+:\d+/.test(markdown) || /\([A-Z]\w+\.\w+:\d+\)/.test(markdown);
|
|
138
|
+
if (hasBareName && !hasFullPathRef) {
|
|
139
|
+
warnings.push('源码位置应使用完整相对路径+行号(如 Packages/ModuleName/Sources/.../FileName.swift:42),而非仅文件名');
|
|
140
|
+
}
|
|
135
141
|
}
|
|
136
142
|
// coreCode 语法完整性
|
|
137
143
|
{
|
|
@@ -156,6 +162,15 @@ export class UnifiedValidator {
|
|
|
156
162
|
warnings.push(`内容仅 ${lines.length} 行 — 建议包含更多代码片段和设计意图描述`);
|
|
157
163
|
}
|
|
158
164
|
}
|
|
165
|
+
// reasoning.sources 路径质量检查 — 应包含路径分隔符,而非仅类名/文件名
|
|
166
|
+
const reasoning = candidate.reasoning;
|
|
167
|
+
const sources = reasoning?.sources;
|
|
168
|
+
if (Array.isArray(sources) && sources.length > 0) {
|
|
169
|
+
const bareSources = sources.filter((s) => typeof s === 'string' && !s.includes('/') && !s.includes('\\'));
|
|
170
|
+
if (bareSources.length > 0 && bareSources.length === sources.length) {
|
|
171
|
+
warnings.push(`reasoning.sources 中的路径缺少目录结构(如 "${bareSources[0]}")— 应使用完整相对路径(如 Packages/ModuleName/Sources/.../FileName.swift)`);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
159
174
|
}
|
|
160
175
|
// ── Layer 3: 去重 ────────────────────────────────────────
|
|
161
176
|
#checkUniqueness(candidate, errors) {
|
|
@@ -148,6 +148,13 @@ export declare class AiProvider {
|
|
|
148
148
|
name: string;
|
|
149
149
|
timeout: number;
|
|
150
150
|
_fallbackFrom?: string;
|
|
151
|
+
/**
|
|
152
|
+
* Token 用量回调 — 每次 API 调用后触发(包括 chat / chatWithStructuredOutput / chatWithTools)
|
|
153
|
+
* 由外部(如 DI 容器)注入以实现全局 token 计量。
|
|
154
|
+
*/
|
|
155
|
+
_onTokenUsage: ((usage: TokenUsage & {
|
|
156
|
+
source?: string;
|
|
157
|
+
}) => void) | null;
|
|
151
158
|
constructor(config?: AiProviderConfig);
|
|
152
159
|
_acquireRequestSlot(): Promise<void>;
|
|
153
160
|
_releaseRequestSlot(): void;
|
|
@@ -158,6 +165,11 @@ export declare class AiProvider {
|
|
|
158
165
|
* @param context {history: [], temperature, maxTokens}
|
|
159
166
|
*/
|
|
160
167
|
chat(prompt: string, context?: ChatContext): Promise<string>;
|
|
168
|
+
/**
|
|
169
|
+
* 从 API 原始响应中提取 token 用量并触发回调。
|
|
170
|
+
* 子类在 chat() / chatWithStructuredOutput() 中调用。
|
|
171
|
+
*/
|
|
172
|
+
_emitTokenUsage(usage: TokenUsage | null | undefined, source?: string): void;
|
|
161
173
|
/** 摘要 - 对代码/文档生成结构化摘要 */
|
|
162
174
|
summarize(code: string): Promise<unknown>;
|
|
163
175
|
/** 向量嵌入 - 返回浮点数组 */
|
|
@@ -21,6 +21,11 @@ export class AiProvider {
|
|
|
21
21
|
name;
|
|
22
22
|
timeout;
|
|
23
23
|
_fallbackFrom;
|
|
24
|
+
/**
|
|
25
|
+
* Token 用量回调 — 每次 API 调用后触发(包括 chat / chatWithStructuredOutput / chatWithTools)
|
|
26
|
+
* 由外部(如 DI 容器)注入以实现全局 token 计量。
|
|
27
|
+
*/
|
|
28
|
+
_onTokenUsage = null;
|
|
24
29
|
constructor(config = {}) {
|
|
25
30
|
this.model = config.model || '';
|
|
26
31
|
this.apiKey = config.apiKey || '';
|
|
@@ -79,6 +84,25 @@ export class AiProvider {
|
|
|
79
84
|
async chat(prompt, context = {}) {
|
|
80
85
|
throw new Error(`${this.name}.chat() not implemented`);
|
|
81
86
|
}
|
|
87
|
+
/**
|
|
88
|
+
* 从 API 原始响应中提取 token 用量并触发回调。
|
|
89
|
+
* 子类在 chat() / chatWithStructuredOutput() 中调用。
|
|
90
|
+
*/
|
|
91
|
+
_emitTokenUsage(usage, source) {
|
|
92
|
+
if (!usage || !this._onTokenUsage) {
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
const total = (usage.inputTokens || 0) + (usage.outputTokens || 0);
|
|
96
|
+
if (total === 0) {
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
try {
|
|
100
|
+
this._onTokenUsage({ ...usage, source });
|
|
101
|
+
}
|
|
102
|
+
catch {
|
|
103
|
+
/* token tracking should never break execution */
|
|
104
|
+
}
|
|
105
|
+
}
|
|
82
106
|
/** 摘要 - 对代码/文档生成结构化摘要 */
|
|
83
107
|
async summarize(code) {
|
|
84
108
|
throw new Error(`${this.name}.summarize() not implemented`);
|