autosnippet 3.3.7 → 3.3.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dashboard/dist/assets/icons-BMNb0V6L.js +1 -0
- package/dashboard/dist/assets/index-DHJ1Dj7u.css +1 -0
- package/dashboard/dist/assets/index-DV8biUkH.js +112 -0
- package/dashboard/dist/index.html +3 -3
- package/dist/bin/cli.js +7 -4
- package/dist/lib/agent/core/ChatAgentPrompts.js +57 -21
- package/dist/lib/agent/core/LoopContext.d.ts +1 -0
- package/dist/lib/agent/core/ToolExecutionPipeline.js +13 -0
- package/dist/lib/agent/memory/ActiveContext.d.ts +0 -2
- package/dist/lib/agent/memory/ActiveContext.js +0 -2
- package/dist/lib/agent/memory/MemoryEmbeddingStore.d.ts +49 -0
- package/dist/lib/agent/memory/MemoryEmbeddingStore.js +159 -0
- package/dist/lib/agent/memory/MemoryRetriever.d.ts +2 -0
- package/dist/lib/agent/memory/MemoryRetriever.js +25 -11
- package/dist/lib/agent/memory/MemoryStore.d.ts +8 -41
- package/dist/lib/agent/memory/MemoryStore.js +196 -261
- package/dist/lib/agent/memory/PersistentMemory.d.ts +2 -0
- package/dist/lib/agent/memory/PersistentMemory.js +4 -5
- package/dist/lib/agent/memory/SessionStore.d.ts +0 -2
- package/dist/lib/agent/memory/SessionStore.js +0 -2
- package/dist/lib/agent/tools/ast-graph.js +21 -19
- package/dist/lib/agent/tools/infrastructure.js +3 -2
- package/dist/lib/agent/tools/project-access.d.ts +2 -2
- package/dist/lib/agent/tools/project-access.js +5 -4
- package/dist/lib/bootstrap.js +2 -1
- package/dist/lib/cli/AiScanService.js +4 -17
- package/dist/lib/cli/KnowledgeSyncService.d.ts +7 -37
- package/dist/lib/cli/KnowledgeSyncService.js +23 -51
- package/dist/lib/core/ast/ProjectGraph.js +5 -27
- package/dist/lib/core/discovery/CustomConfigDiscoverer.d.ts +0 -2
- package/dist/lib/core/discovery/CustomConfigDiscoverer.js +0 -2
- package/dist/lib/domain/dimension/DimensionRegistry.d.ts +0 -2
- package/dist/lib/domain/dimension/DimensionRegistry.js +0 -2
- package/dist/lib/domain/dimension/DimensionSop.js +44 -33
- package/dist/lib/domain/dimension/UnifiedDimension.d.ts +0 -2
- package/dist/lib/domain/dimension/UnifiedDimension.js +0 -2
- package/dist/lib/domain/knowledge/Lifecycle.d.ts +26 -0
- package/dist/lib/domain/knowledge/Lifecycle.js +42 -0
- package/dist/lib/domain/knowledge/index.d.ts +2 -1
- package/dist/lib/domain/knowledge/index.js +1 -1
- package/dist/lib/external/mcp/handlers/bootstrap/pipeline/BootstrapSnapshot.d.ts +2 -1
- package/dist/lib/external/mcp/handlers/bootstrap/pipeline/BootstrapSnapshot.js +102 -153
- package/dist/lib/external/mcp/handlers/bootstrap/pipeline/orchestrator.js +33 -16
- package/dist/lib/external/mcp/handlers/bootstrap/shared/bootstrap-phases.d.ts +1 -1
- package/dist/lib/external/mcp/handlers/bootstrap/shared/bootstrap-phases.js +41 -37
- package/dist/lib/external/mcp/handlers/bootstrap-external.js +1 -1
- package/dist/lib/external/mcp/handlers/dimension-complete-external.js +7 -3
- package/dist/lib/external/mcp/handlers/evolve-external.d.ts +1 -0
- package/dist/lib/external/mcp/handlers/evolve-external.js +13 -16
- package/dist/lib/external/mcp/handlers/guard.js +15 -24
- package/dist/lib/external/mcp/handlers/panorama.js +9 -9
- package/dist/lib/external/mcp/handlers/rescan-external.js +7 -6
- package/dist/lib/external/mcp/handlers/rescan-internal.js +9 -5
- package/dist/lib/external/mcp/handlers/search.js +3 -1
- package/dist/lib/external/mcp/handlers/skill.js +4 -4
- package/dist/lib/external/mcp/handlers/structure.js +8 -12
- package/dist/lib/external/mcp/handlers/system.js +10 -34
- package/dist/lib/http/routes/ai.js +11 -13
- package/dist/lib/http/routes/guardReport.js +3 -5
- package/dist/lib/http/routes/panorama.js +12 -12
- package/dist/lib/http/routes/recipes.js +59 -8
- package/dist/lib/http/routes/remote.js +3 -13
- package/dist/lib/http/routes/search.js +11 -8
- package/dist/lib/infrastructure/audit/AuditLogger.d.ts +20 -3
- package/dist/lib/infrastructure/audit/AuditStore.d.ts +28 -29
- package/dist/lib/infrastructure/audit/AuditStore.js +81 -88
- package/dist/lib/infrastructure/database/drizzle/schema.d.ts +180 -2
- package/dist/lib/infrastructure/database/drizzle/schema.js +23 -3
- package/dist/lib/injection/ServiceContainer.js +7 -4
- package/dist/lib/injection/ServiceMap.d.ts +20 -0
- package/dist/lib/injection/modules/AppModule.js +2 -1
- package/dist/lib/injection/modules/GuardModule.js +5 -5
- package/dist/lib/injection/modules/InfraModule.js +60 -0
- package/dist/lib/injection/modules/KnowledgeModule.js +86 -51
- package/dist/lib/injection/modules/PanoramaModule.js +16 -10
- package/dist/lib/injection/modules/VectorModule.js +3 -0
- package/dist/lib/repository/audit/AuditRepository.d.ts +107 -0
- package/dist/lib/repository/audit/AuditRepository.js +272 -0
- package/dist/lib/repository/base/RepositoryBase.d.ts +46 -0
- package/dist/lib/repository/base/RepositoryBase.js +32 -0
- package/dist/lib/repository/bootstrap/BootstrapRepository.d.ts +94 -0
- package/dist/lib/repository/bootstrap/BootstrapRepository.js +246 -0
- package/dist/lib/repository/code/CodeEntityRepository.d.ts +91 -0
- package/dist/lib/repository/code/CodeEntityRepository.js +361 -0
- package/dist/lib/repository/delivery/DeliveryRepoAdapter.d.ts +39 -0
- package/dist/lib/repository/delivery/DeliveryRepoAdapter.js +23 -0
- package/dist/lib/repository/evolution/LifecycleEventRepository.d.ts +51 -0
- package/dist/lib/repository/evolution/LifecycleEventRepository.js +119 -0
- package/dist/lib/repository/evolution/ProposalRepository.d.ts +9 -12
- package/dist/lib/repository/evolution/ProposalRepository.js +114 -57
- package/dist/lib/repository/guard/GuardViolationRepository.d.ts +104 -0
- package/dist/lib/repository/guard/GuardViolationRepository.js +217 -0
- package/dist/lib/repository/knowledge/KnowledgeEdgeRepository.d.ts +129 -0
- package/dist/lib/repository/knowledge/KnowledgeEdgeRepository.js +475 -0
- package/dist/lib/repository/knowledge/KnowledgeFileStore.d.ts +39 -0
- package/dist/lib/repository/knowledge/KnowledgeFileStore.js +12 -0
- package/dist/lib/repository/knowledge/KnowledgeRepository.impl.d.ts +295 -11
- package/dist/lib/repository/knowledge/KnowledgeRepository.impl.js +608 -13
- package/dist/lib/repository/knowledge/KnowledgeUnitOfWork.d.ts +61 -0
- package/dist/lib/repository/knowledge/KnowledgeUnitOfWork.js +156 -0
- package/dist/lib/repository/memory/MemoryRepository.d.ts +90 -0
- package/dist/lib/repository/memory/MemoryRepository.js +260 -0
- package/dist/lib/repository/search/SearchRepoAdapter.d.ts +92 -0
- package/dist/lib/repository/search/SearchRepoAdapter.js +124 -0
- package/dist/lib/repository/session/SessionRepository.d.ts +46 -0
- package/dist/lib/repository/session/SessionRepository.js +110 -0
- package/dist/lib/repository/sourceref/RecipeSourceRefRepository.d.ts +66 -0
- package/dist/lib/repository/sourceref/RecipeSourceRefRepository.js +182 -0
- package/dist/lib/repository/sync/SyncRepoAdapter.d.ts +58 -0
- package/dist/lib/repository/sync/SyncRepoAdapter.js +58 -0
- package/dist/lib/service/bootstrap/UiStartupTasks.js +5 -6
- package/dist/lib/service/bootstrap/bootstrap-event-types.d.ts +0 -1
- package/dist/lib/service/bootstrap/bootstrap-event-types.js +0 -1
- package/dist/lib/service/cleanup/CleanupService.js +8 -4
- package/dist/lib/service/delivery/CursorDeliveryPipeline.js +6 -8
- package/dist/lib/service/evolution/ConsolidationAdvisor.d.ts +4 -9
- package/dist/lib/service/evolution/ConsolidationAdvisor.js +34 -70
- package/dist/lib/service/evolution/ContentPatcher.d.ts +4 -12
- package/dist/lib/service/evolution/ContentPatcher.js +48 -19
- package/dist/lib/service/evolution/ContradictionDetector.d.ts +3 -7
- package/dist/lib/service/evolution/ContradictionDetector.js +17 -24
- package/dist/lib/service/evolution/DecayDetector.d.ts +10 -9
- package/dist/lib/service/evolution/DecayDetector.js +63 -57
- package/dist/lib/service/evolution/EnhancementSuggester.d.ts +3 -9
- package/dist/lib/service/evolution/EnhancementSuggester.js +42 -86
- package/dist/lib/service/evolution/KnowledgeMetabolism.d.ts +4 -4
- package/dist/lib/service/evolution/KnowledgeMetabolism.js +102 -71
- package/dist/lib/service/evolution/ProposalExecutor.d.ts +5 -12
- package/dist/lib/service/evolution/ProposalExecutor.js +64 -69
- package/dist/lib/service/evolution/RecipeLifecycleSupervisor.d.ts +9 -14
- package/dist/lib/service/evolution/RecipeLifecycleSupervisor.js +94 -155
- package/dist/lib/service/evolution/RecipeRelevanceAuditor.d.ts +4 -1
- package/dist/lib/service/evolution/RecipeRelevanceAuditor.js +50 -49
- package/dist/lib/service/evolution/RedundancyAnalyzer.d.ts +3 -7
- package/dist/lib/service/evolution/RedundancyAnalyzer.js +15 -22
- package/dist/lib/service/evolution/StagingManager.d.ts +6 -15
- package/dist/lib/service/evolution/StagingManager.js +37 -95
- package/dist/lib/service/evolution/createSupersedeProposal.d.ts +1 -1
- package/dist/lib/service/evolution/createSupersedeProposal.js +7 -8
- package/dist/lib/service/guard/CoverageAnalyzer.d.ts +3 -7
- package/dist/lib/service/guard/CoverageAnalyzer.js +9 -11
- package/dist/lib/service/guard/GuardCheckEngine.d.ts +3 -0
- package/dist/lib/service/guard/GuardCheckEngine.js +14 -22
- package/dist/lib/service/guard/ReverseGuard.d.ts +4 -7
- package/dist/lib/service/guard/ReverseGuard.js +21 -31
- package/dist/lib/service/guard/ViolationsStore.d.ts +15 -21
- package/dist/lib/service/guard/ViolationsStore.js +75 -69
- package/dist/lib/service/knowledge/CodeEntityGraph.d.ts +39 -63
- package/dist/lib/service/knowledge/CodeEntityGraph.js +418 -512
- package/dist/lib/service/knowledge/ConfidenceRouter.js +18 -9
- package/dist/lib/service/knowledge/KnowledgeFileWriter.d.ts +2 -1
- package/dist/lib/service/knowledge/KnowledgeGraphService.d.ts +18 -60
- package/dist/lib/service/knowledge/KnowledgeGraphService.js +58 -109
- package/dist/lib/service/knowledge/KnowledgeService.d.ts +15 -1
- package/dist/lib/service/knowledge/KnowledgeService.js +76 -38
- package/dist/lib/service/knowledge/RecipeProductionGateway.d.ts +0 -2
- package/dist/lib/service/knowledge/RecipeProductionGateway.js +0 -2
- package/dist/lib/service/knowledge/SourceRefReconciler.d.ts +5 -13
- package/dist/lib/service/knowledge/SourceRefReconciler.js +58 -78
- package/dist/lib/service/panorama/CouplingAnalyzer.d.ts +5 -3
- package/dist/lib/service/panorama/CouplingAnalyzer.js +102 -39
- package/dist/lib/service/panorama/DimensionAnalyzer.d.ts +7 -4
- package/dist/lib/service/panorama/DimensionAnalyzer.js +72 -25
- package/dist/lib/service/panorama/LayerInferrer.js +1 -1
- package/dist/lib/service/panorama/ModuleDiscoverer.d.ts +7 -6
- package/dist/lib/service/panorama/ModuleDiscoverer.js +174 -82
- package/dist/lib/service/panorama/PanoramaAggregator.d.ts +10 -3
- package/dist/lib/service/panorama/PanoramaAggregator.js +67 -79
- package/dist/lib/service/panorama/PanoramaScanner.d.ts +5 -1
- package/dist/lib/service/panorama/PanoramaScanner.js +32 -31
- package/dist/lib/service/panorama/PanoramaService.d.ts +11 -8
- package/dist/lib/service/panorama/PanoramaService.js +41 -66
- package/dist/lib/service/panorama/PanoramaTypes.d.ts +3 -0
- package/dist/lib/service/panorama/RoleRefiner.d.ts +8 -5
- package/dist/lib/service/panorama/RoleRefiner.js +52 -283
- package/dist/lib/service/panorama/TechStackProfiler.js +7 -119
- package/dist/lib/service/quality/QualityScorer.d.ts +45 -26
- package/dist/lib/service/quality/QualityScorer.js +157 -83
- package/dist/lib/service/search/SearchEngine.d.ts +1 -0
- package/dist/lib/service/search/SearchEngine.js +32 -37
- package/dist/lib/service/signal/HitRecorder.js +5 -5
- package/dist/lib/service/skills/RuleRecallStrategy.js +7 -3
- package/dist/lib/service/skills/SignalCollector.d.ts +5 -8
- package/dist/lib/service/skills/SignalCollector.js +28 -55
- package/dist/lib/service/skills/SkillAdvisor.d.ts +7 -13
- package/dist/lib/service/skills/SkillAdvisor.js +30 -79
- package/dist/lib/service/vector/SyncCoordinator.d.ts +3 -1
- package/dist/lib/service/vector/SyncCoordinator.js +25 -3
- package/dist/lib/service/vector/VectorService.d.ts +2 -0
- package/dist/lib/service/vector/VectorService.js +3 -0
- package/dist/lib/service/wiki/WikiGenerator.js +1 -1
- package/dist/lib/shared/LanguageProfiles.d.ts +109 -0
- package/dist/lib/shared/LanguageProfiles.js +939 -0
- package/dist/lib/shared/LanguageService.d.ts +6 -0
- package/dist/lib/shared/LanguageService.js +16 -0
- package/dist/lib/shared/constants.d.ts +19 -19
- package/dist/lib/shared/constants.js +10 -10
- package/dist/lib/shared/schemas/mcp-tools.d.ts +1 -1
- package/dist/lib/types/project-snapshot-builder.d.ts +0 -1
- package/dist/lib/types/project-snapshot-builder.js +0 -1
- package/dist/lib/types/project-snapshot.d.ts +0 -1
- package/dist/lib/types/project-snapshot.js +0 -1
- package/dist/lib/types/snapshot-views.d.ts +0 -2
- package/dist/lib/types/snapshot-views.js +0 -1
- package/package.json +2 -1
- package/dashboard/dist/assets/icons-FHns2ypa.js +0 -1
- package/dashboard/dist/assets/index-BRJv5Y3r.js +0 -135
- package/dashboard/dist/assets/index-DzoB7kxK.css +0 -1
- package/dist/lib/repository/base/BaseRepository.d.ts +0 -53
- package/dist/lib/repository/base/BaseRepository.js +0 -226
|
@@ -1,15 +1,16 @@
|
|
|
1
|
+
import type { Database } from 'better-sqlite3';
|
|
2
|
+
import type { Logger as WinstonLogger } from 'winston';
|
|
1
3
|
import { KnowledgeEntry } from '../../domain/knowledge/index.js';
|
|
2
4
|
import type { DrizzleDB } from '../../infrastructure/database/drizzle/index.js';
|
|
3
|
-
import { BaseRepository } from '../base/BaseRepository.js';
|
|
4
5
|
/** Database connection wrapper interface */
|
|
5
6
|
interface KnowledgeDatabaseWrapper {
|
|
6
|
-
getDb():
|
|
7
|
+
getDb(): Database;
|
|
7
8
|
}
|
|
8
9
|
/** Filters accepted by findWithPagination */
|
|
9
10
|
interface KnowledgeFilters {
|
|
10
11
|
_tagLike?: string;
|
|
11
12
|
_search?: string;
|
|
12
|
-
lifecycle?: string;
|
|
13
|
+
lifecycle?: string | string[];
|
|
13
14
|
kind?: string;
|
|
14
15
|
language?: string;
|
|
15
16
|
category?: string;
|
|
@@ -32,14 +33,27 @@ interface KnowledgePaginationOptions {
|
|
|
32
33
|
* - CRUD (create/findById/update/delete/findActiveRules) → drizzle 类型安全 API
|
|
33
34
|
* - 复杂动态查询 (findWithPagination/getStats) → 保留 raw SQL→渐进迁移
|
|
34
35
|
*/
|
|
35
|
-
export declare class KnowledgeRepositoryImpl
|
|
36
|
+
export declare class KnowledgeRepositoryImpl {
|
|
36
37
|
#private;
|
|
38
|
+
/** Raw DB for complex dynamic queries (ORM limitation — used within repository layer) */
|
|
39
|
+
db: Database;
|
|
40
|
+
logger: WinstonLogger;
|
|
37
41
|
constructor(database: KnowledgeDatabaseWrapper, drizzle?: DrizzleDB);
|
|
42
|
+
/**
|
|
43
|
+
* Validate column name is safe for SQL interpolation (copied from retired BaseRepository).
|
|
44
|
+
* Rejects anything that doesn't match /^[a-zA-Z_]\w*$/ or is not a real column.
|
|
45
|
+
*/
|
|
46
|
+
_assertSafeColumn(key: string): void;
|
|
47
|
+
/**
|
|
48
|
+
* 按 ID 查找
|
|
49
|
+
* ★ Drizzle 类型安全 SELECT
|
|
50
|
+
*/
|
|
51
|
+
findById(id: string): Promise<KnowledgeEntry | null>;
|
|
38
52
|
/**
|
|
39
53
|
* 创建 KnowledgeEntry
|
|
40
54
|
* ★ Drizzle 类型安全 INSERT — 列名拼写编译期检查
|
|
41
55
|
*/
|
|
42
|
-
create(entry: KnowledgeEntry): Promise<
|
|
56
|
+
create(entry: KnowledgeEntry): Promise<KnowledgeEntry | null>;
|
|
43
57
|
/**
|
|
44
58
|
* 按标题精确查找(大小写不敏感)
|
|
45
59
|
*/
|
|
@@ -48,12 +62,22 @@ export declare class KnowledgeRepositoryImpl extends BaseRepository {
|
|
|
48
62
|
* 更新 KnowledgeEntry(接受完整实体或部分数据)
|
|
49
63
|
* ★ Drizzle 类型安全 UPDATE
|
|
50
64
|
*/
|
|
51
|
-
update(id: string, updates: KnowledgeEntry | Record<string, unknown>): Promise<
|
|
65
|
+
update(id: string, updates: KnowledgeEntry | Record<string, unknown>): Promise<KnowledgeEntry | null>;
|
|
52
66
|
/**
|
|
53
67
|
* 删除
|
|
54
68
|
* ★ Drizzle 类型安全 DELETE
|
|
55
69
|
*/
|
|
56
70
|
delete(id: string): Promise<boolean>;
|
|
71
|
+
/**
|
|
72
|
+
* 更新生命周期状态
|
|
73
|
+
* ★ Drizzle 类型安全 UPDATE — 供 RecipeLifecycleSupervisor / ProposalExecutor 使用
|
|
74
|
+
*/
|
|
75
|
+
updateLifecycle(id: string, lifecycle: string): Promise<boolean>;
|
|
76
|
+
/**
|
|
77
|
+
* 更新 stats JSON 字段
|
|
78
|
+
* ★ Drizzle 类型安全 UPDATE — 供 HitRecorder / RecipeLifecycleSupervisor 使用
|
|
79
|
+
*/
|
|
80
|
+
updateStats(id: string, stats: Record<string, unknown>): Promise<boolean>;
|
|
57
81
|
/**
|
|
58
82
|
* 分页查询
|
|
59
83
|
* @override
|
|
@@ -94,6 +118,50 @@ export declare class KnowledgeRepositoryImpl extends BaseRepository {
|
|
|
94
118
|
* ★ Drizzle 类型安全查询
|
|
95
119
|
*/
|
|
96
120
|
findActiveRules(): Promise<(KnowledgeEntry | null)[]>;
|
|
121
|
+
/**
|
|
122
|
+
* Guard 专用:active 的 rule + boundary-constraint
|
|
123
|
+
* ★ Phase 5b: supply guard.ts _loadRuleRecipes
|
|
124
|
+
*/
|
|
125
|
+
findActiveGuardRecipes(): Promise<KnowledgeEntry[]>;
|
|
126
|
+
/**
|
|
127
|
+
* 按 source 字段查询 ID 列表
|
|
128
|
+
* ★ Phase 5b: supply ai.ts mock cleanup
|
|
129
|
+
*/
|
|
130
|
+
findIdsBySource(source: string): Promise<string[]>;
|
|
131
|
+
/**
|
|
132
|
+
* 统计指定 lifecycle 集合中的条目数量
|
|
133
|
+
* ★ Phase 5b: supply recipes.ts pre-check
|
|
134
|
+
*/
|
|
135
|
+
countByLifecycles(lifecycles: readonly string[]): Promise<number>;
|
|
136
|
+
/**
|
|
137
|
+
* 查询指定 lifecycle 集合中的所有条目(不分页)
|
|
138
|
+
* ★ Phase 5c: supply Evolution domain services (ContradictionDetector, RedundancyAnalyzer, etc.)
|
|
139
|
+
*/
|
|
140
|
+
findAllByLifecycles(lifecycles: readonly string[]): Promise<KnowledgeEntry[]>;
|
|
141
|
+
/**
|
|
142
|
+
* 查询指定 lifecycle + category 的条目(带 limit)
|
|
143
|
+
* ★ Phase 5c: supply ConsolidationAdvisor category-filtered query
|
|
144
|
+
*/
|
|
145
|
+
findAllByLifecyclesAndCategory(lifecycles: readonly string[], category: string, limit: number): Promise<KnowledgeEntry[]>;
|
|
146
|
+
/**
|
|
147
|
+
* 查询指定 lifecycle 中 trigger 匹配前缀且排除指定 category 的条目
|
|
148
|
+
* ★ Phase 5c: supply ConsolidationAdvisor trigger-prefix fallback
|
|
149
|
+
*/
|
|
150
|
+
findByLifecyclesAndTriggerPrefix(lifecycles: readonly string[], excludeCategory: string, triggerPrefix: string, limit: number): Promise<KnowledgeEntry[]>;
|
|
151
|
+
/**
|
|
152
|
+
* 按 lifecycle 分组统计全部条目数量
|
|
153
|
+
* ★ Phase 5c: supply RecipeLifecycleSupervisor health summary
|
|
154
|
+
*/
|
|
155
|
+
countGroupByLifecycle(): Promise<Record<string, number>>;
|
|
156
|
+
/**
|
|
157
|
+
* 反向查找 relations JSON 中包含指定 nodeId 的条目
|
|
158
|
+
* ★ Phase 5b: supply structure.ts relation graph
|
|
159
|
+
*/
|
|
160
|
+
findByRelationLike(nodeId: string, excludeId: string): Promise<Array<{
|
|
161
|
+
id: string;
|
|
162
|
+
title: string;
|
|
163
|
+
relations: string;
|
|
164
|
+
}>>;
|
|
97
165
|
/** 根据语言查询 */
|
|
98
166
|
findByLanguage(language: string, pagination?: KnowledgePaginationOptions): Promise<{
|
|
99
167
|
data: (KnowledgeEntry | null)[];
|
|
@@ -126,6 +194,155 @@ export declare class KnowledgeRepositoryImpl extends BaseRepository {
|
|
|
126
194
|
}>;
|
|
127
195
|
/** 获取统计信息 */
|
|
128
196
|
getStats(): Promise<unknown>;
|
|
197
|
+
/**
|
|
198
|
+
* Find all entries with non-empty reasoning (for SourceRefReconciler)
|
|
199
|
+
* ★ Drizzle 类型安全 SELECT — 仅返回 id + reasoning
|
|
200
|
+
*/
|
|
201
|
+
findAllIdAndReasoning(): Promise<Array<{
|
|
202
|
+
id: string;
|
|
203
|
+
reasoning: string;
|
|
204
|
+
}>>;
|
|
205
|
+
/**
|
|
206
|
+
* Find sourceFile and reasoning for a single entry (for SourceRefReconciler.applyRepairs)
|
|
207
|
+
* ★ Drizzle 类型安全 SELECT — 仅返回 sourceFile + reasoning
|
|
208
|
+
*/
|
|
209
|
+
findSourceFileAndReasoning(id: string): Promise<{
|
|
210
|
+
sourceFile: string | null;
|
|
211
|
+
reasoning: string | null;
|
|
212
|
+
} | null>;
|
|
213
|
+
/**
|
|
214
|
+
* Update reasoning JSON field directly (for SourceRefReconciler.applyRepairs)
|
|
215
|
+
* ★ Drizzle 类型安全 UPDATE — 精确更新 reasoning + updatedAt
|
|
216
|
+
*/
|
|
217
|
+
updateReasoning(id: string, reasoning: string, updatedAt: number): Promise<boolean>;
|
|
218
|
+
/**
|
|
219
|
+
* 获取活跃 Recipe 的元数据 (title, category, topicHint, kind)
|
|
220
|
+
* 用于 DimensionAnalyzer 维度分类分析
|
|
221
|
+
*/
|
|
222
|
+
findRecipeMetadata(lifecycles: readonly string[]): Promise<Array<{
|
|
223
|
+
title: string;
|
|
224
|
+
category: string;
|
|
225
|
+
topicHint: string;
|
|
226
|
+
kind: string;
|
|
227
|
+
}>>;
|
|
228
|
+
/**
|
|
229
|
+
* 按模块相关关键词搜索 Recipe (PanoramaService.#findModuleRecipes)
|
|
230
|
+
* @param lifecycles - 活跃生命周期
|
|
231
|
+
* @param moduleName - 模块名
|
|
232
|
+
* @param categories - 角色关联的分类列表
|
|
233
|
+
* @param limit - 结果上限
|
|
234
|
+
*/
|
|
235
|
+
findModuleRecipes(lifecycles: readonly string[], moduleName: string, categories: string[], limit?: number): Promise<Array<{
|
|
236
|
+
id: string;
|
|
237
|
+
title: string;
|
|
238
|
+
trigger: string;
|
|
239
|
+
kind: string;
|
|
240
|
+
}>>;
|
|
241
|
+
/**
|
|
242
|
+
* 统计 COUNTABLE_LIFECYCLES 范围内的知识条目数 (PanoramaAggregator.#getProjectRecipeCount)
|
|
243
|
+
*/
|
|
244
|
+
countByCountableLifecycles(): Promise<number>;
|
|
245
|
+
/**
|
|
246
|
+
* Guard 规则查询 — kind='rule' OR knowledgeType='boundary-constraint' + lifecycle 过滤
|
|
247
|
+
* (GuardCheckEngine._loadCustomRules)
|
|
248
|
+
*/
|
|
249
|
+
findGuardRulesSync(lifecycles: readonly string[]): Array<{
|
|
250
|
+
id: string;
|
|
251
|
+
title: string;
|
|
252
|
+
description: string | null;
|
|
253
|
+
language: string;
|
|
254
|
+
scope: string | null;
|
|
255
|
+
constraints: string | null;
|
|
256
|
+
lifecycle: string;
|
|
257
|
+
}>;
|
|
258
|
+
/**
|
|
259
|
+
* Guard 命中次数递增 — stats.guardHits += count
|
|
260
|
+
* (GuardCheckEngine._recordHits)
|
|
261
|
+
*/
|
|
262
|
+
incrementGuardHitsSync(id: string, hits: number): void;
|
|
263
|
+
/**
|
|
264
|
+
* 活跃规则 + content 中的 coreCode / pattern 字段 + stats
|
|
265
|
+
* (ReverseGuard.#loadActiveRules)
|
|
266
|
+
*/
|
|
267
|
+
findActiveRulesWithContentSync(): Array<{
|
|
268
|
+
id: string;
|
|
269
|
+
title: string;
|
|
270
|
+
coreCode: string;
|
|
271
|
+
guardPattern: string;
|
|
272
|
+
stats: string | null;
|
|
273
|
+
}>;
|
|
274
|
+
/**
|
|
275
|
+
* 获取单条记录的 guardHits 数
|
|
276
|
+
* (ReverseGuard.#historicalGuardHits)
|
|
277
|
+
*/
|
|
278
|
+
getGuardHitsSync(id: string): number;
|
|
279
|
+
/**
|
|
280
|
+
* 活跃规则的 id + language (CoverageAnalyzer.#loadActiveRules) — sync
|
|
281
|
+
*/
|
|
282
|
+
findActiveRuleIdsSync(): Array<{
|
|
283
|
+
id: string;
|
|
284
|
+
language: string;
|
|
285
|
+
}>;
|
|
286
|
+
/**
|
|
287
|
+
* 活跃条目按 category 分布
|
|
288
|
+
* (SkillAdvisor.#getKBDistribution)
|
|
289
|
+
*/
|
|
290
|
+
countGroupByCategory(): Promise<Array<{
|
|
291
|
+
category: string;
|
|
292
|
+
cnt: number;
|
|
293
|
+
}>>;
|
|
294
|
+
/**
|
|
295
|
+
* 活跃条目按 language 分布
|
|
296
|
+
* (SkillAdvisor.#getKBDistribution)
|
|
297
|
+
*/
|
|
298
|
+
countGroupByLanguage(): Promise<Array<{
|
|
299
|
+
language: string;
|
|
300
|
+
cnt: number;
|
|
301
|
+
}>>;
|
|
302
|
+
/**
|
|
303
|
+
* 高使用率活跃 Recipe (adoptions + applications >= minUsage)
|
|
304
|
+
* (SkillAdvisor.#getKBDistribution)
|
|
305
|
+
*/
|
|
306
|
+
findHotRecipesByUsage(minUsage: number, limit: number): Promise<Array<{
|
|
307
|
+
title: string;
|
|
308
|
+
category: string;
|
|
309
|
+
totalUsage: number;
|
|
310
|
+
}>>;
|
|
311
|
+
/**
|
|
312
|
+
* 全库生命周期统计 (total / pending / deprecated)
|
|
313
|
+
* (SkillAdvisor.#getKBDistribution)
|
|
314
|
+
*/
|
|
315
|
+
getLifecycleCounts(): Promise<{
|
|
316
|
+
total: number;
|
|
317
|
+
pending: number;
|
|
318
|
+
deprecated: number;
|
|
319
|
+
}>;
|
|
320
|
+
/**
|
|
321
|
+
* 活跃 Recipe 信号 (SignalCollector.#collectRecipeSignals)
|
|
322
|
+
*/
|
|
323
|
+
findActiveRecipeSignals(limit: number): Promise<Array<{
|
|
324
|
+
id: string;
|
|
325
|
+
title: string;
|
|
326
|
+
knowledgeType: string;
|
|
327
|
+
category: string;
|
|
328
|
+
language: string;
|
|
329
|
+
adoptionCount: number;
|
|
330
|
+
applicationCount: number;
|
|
331
|
+
qualityOverall: number;
|
|
332
|
+
updatedAt: number;
|
|
333
|
+
}>>;
|
|
334
|
+
/**
|
|
335
|
+
* 待审核 Candidate (SignalCollector.#collectCandidateSignals)
|
|
336
|
+
*/
|
|
337
|
+
findPendingCandidates(limit: number): Promise<Array<{
|
|
338
|
+
id: string;
|
|
339
|
+
source: string;
|
|
340
|
+
status: string;
|
|
341
|
+
language: string;
|
|
342
|
+
category: string;
|
|
343
|
+
title: string;
|
|
344
|
+
createdAt: number;
|
|
345
|
+
}>>;
|
|
129
346
|
/** DB Row → KnowledgeEntry (camelCase 列名 = 属性名,直传) */
|
|
130
347
|
_rowToEntity(row: Record<string, unknown>): KnowledgeEntry | null;
|
|
131
348
|
/** KnowledgeEntry → DB Row (camelCase 列名 = 属性名,直传) */
|
|
@@ -175,10 +392,77 @@ export declare class KnowledgeRepositoryImpl extends BaseRepository {
|
|
|
175
392
|
publishedBy: string | null;
|
|
176
393
|
staging_deadline: number | null;
|
|
177
394
|
};
|
|
178
|
-
/**
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
395
|
+
/** 查询所有非 deprecated 条目(buildIndex 用) */
|
|
396
|
+
findNonDeprecatedSync(): {
|
|
397
|
+
id: string;
|
|
398
|
+
title: string;
|
|
399
|
+
description: string | null;
|
|
400
|
+
language: string;
|
|
401
|
+
category: string;
|
|
402
|
+
knowledgeType: string | null;
|
|
403
|
+
kind: string | null;
|
|
404
|
+
content: string | null;
|
|
405
|
+
lifecycle: string;
|
|
406
|
+
tags: string | null;
|
|
407
|
+
trigger: string | null;
|
|
408
|
+
difficulty: string | null;
|
|
409
|
+
quality: string | null;
|
|
410
|
+
stats: string | null;
|
|
411
|
+
updatedAt: number;
|
|
412
|
+
createdAt: number;
|
|
413
|
+
}[];
|
|
414
|
+
/** LIKE 关键词搜索(_keywordSearch 用) */
|
|
415
|
+
keywordSearchSync(pattern: string, limit: number): {
|
|
416
|
+
id: string;
|
|
417
|
+
title: string;
|
|
418
|
+
description: string | null;
|
|
419
|
+
language: string;
|
|
420
|
+
category: string;
|
|
421
|
+
knowledgeType: string | null;
|
|
422
|
+
kind: string | null;
|
|
423
|
+
lifecycle: string;
|
|
424
|
+
content: string | null;
|
|
425
|
+
trigger: string | null;
|
|
426
|
+
headers: string | null;
|
|
427
|
+
moduleName: string | null;
|
|
428
|
+
}[];
|
|
429
|
+
/** 按 ID 列表查询详情(_supplementDetails 用) */
|
|
430
|
+
findByIdsDetailSync(ids: string[]): {
|
|
431
|
+
id: string;
|
|
432
|
+
content: string | null;
|
|
433
|
+
description: string | null;
|
|
434
|
+
trigger: string | null;
|
|
435
|
+
headers: string | null;
|
|
436
|
+
moduleName: string | null;
|
|
437
|
+
tags: string | null;
|
|
438
|
+
language: string;
|
|
439
|
+
category: string;
|
|
440
|
+
updatedAt: number;
|
|
441
|
+
createdAt: number;
|
|
442
|
+
quality: string | null;
|
|
443
|
+
stats: string | null;
|
|
444
|
+
difficulty: string | null;
|
|
445
|
+
whenClause: string | null;
|
|
446
|
+
doClause: string | null;
|
|
447
|
+
}[];
|
|
448
|
+
/** 查询指定时间之后更新的条目(refreshIndex 用) */
|
|
449
|
+
findUpdatedSinceSync(sinceIso: string): {
|
|
450
|
+
id: string;
|
|
451
|
+
title: string;
|
|
452
|
+
description: string | null;
|
|
453
|
+
language: string;
|
|
454
|
+
category: string;
|
|
455
|
+
knowledgeType: string | null;
|
|
456
|
+
kind: string | null;
|
|
457
|
+
content: string | null;
|
|
458
|
+
lifecycle: string;
|
|
459
|
+
tags: string | null;
|
|
460
|
+
trigger: string | null;
|
|
461
|
+
difficulty: string | null;
|
|
462
|
+
quality: string | null;
|
|
463
|
+
stats: string | null;
|
|
464
|
+
updatedAt: number;
|
|
465
|
+
createdAt: number;
|
|
466
|
+
}[];
|
|
183
467
|
}
|
|
184
468
|
export default KnowledgeRepositoryImpl;
|