autosnippet 3.3.4 → 3.3.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +174 -83
- package/config/constitution.yaml +2 -0
- package/dashboard/dist/assets/icons-D1aVZYFW.js +1 -0
- package/dashboard/dist/assets/index-CxHOu8Hd.css +1 -0
- package/dashboard/dist/assets/index-DDdAOpYT.js +128 -0
- package/dashboard/dist/index.html +3 -3
- package/dist/bin/api-server.js +1 -0
- package/dist/bin/cli.d.ts +1 -0
- package/dist/bin/cli.js +136 -9
- package/dist/lib/agent/AgentFactory.d.ts +0 -17
- package/dist/lib/agent/AgentFactory.js +1 -25
- package/dist/lib/agent/capabilities.d.ts +11 -0
- package/dist/lib/agent/capabilities.js +29 -5
- package/dist/lib/agent/context/ExplorationTracker.js +10 -1
- package/dist/lib/agent/context/exploration/ExplorationStrategies.d.ts +2 -0
- package/dist/lib/agent/context/exploration/ExplorationStrategies.js +2 -2
- package/dist/lib/agent/domain/insight-analyst.d.ts +47 -3
- package/dist/lib/agent/domain/insight-analyst.js +111 -11
- package/dist/lib/agent/domain/insight-evolver.d.ts +69 -0
- package/dist/lib/agent/domain/insight-evolver.js +230 -0
- package/dist/lib/agent/domain/insight-gate.d.ts +42 -0
- package/dist/lib/agent/domain/insight-gate.js +41 -0
- package/dist/lib/agent/domain/insight-producer.d.ts +27 -2
- package/dist/lib/agent/domain/insight-producer.js +60 -5
- package/dist/lib/agent/domain/scan-prompts.js +10 -7
- package/dist/lib/agent/memory/ActiveContext.d.ts +2 -28
- package/dist/lib/agent/memory/MemoryCoordinator.d.ts +2 -2
- package/dist/lib/agent/memory/SessionStore.d.ts +6 -12
- package/dist/lib/agent/memory/SessionStore.js +9 -15
- package/dist/lib/agent/memory/memory-flush-contract.d.ts +49 -0
- package/dist/lib/agent/memory/memory-flush-contract.js +16 -0
- package/dist/lib/agent/memory/session-store-schema.d.ts +20 -0
- package/dist/lib/agent/memory/session-store-schema.js +41 -0
- package/dist/lib/agent/presets.d.ts +89 -1
- package/dist/lib/agent/presets.js +53 -5
- package/dist/lib/agent/tools/_shared.d.ts +7 -15
- package/dist/lib/agent/tools/_shared.js +20 -21
- package/dist/lib/agent/tools/composite.d.ts +25 -22
- package/dist/lib/agent/tools/composite.js +108 -109
- package/dist/lib/agent/tools/evolution-tools.d.ts +145 -0
- package/dist/lib/agent/tools/evolution-tools.js +161 -0
- package/dist/lib/agent/tools/index.d.ts +163 -92
- package/dist/lib/agent/tools/index.js +9 -1
- package/dist/lib/agent/tools/lifecycle.d.ts +7 -1
- package/dist/lib/agent/tools/lifecycle.js +59 -75
- package/dist/lib/cli/AiScanService.js +1 -1
- package/dist/lib/cli/KnowledgeSyncService.d.ts +5 -1
- package/dist/lib/cli/KnowledgeSyncService.js +6 -3
- package/dist/lib/core/AstAnalyzer.d.ts +1 -0
- package/dist/lib/{service/bootstrap/DimensionCopyRegistry.d.ts → domain/dimension/DimensionCopy.d.ts} +2 -2
- package/dist/lib/{service/bootstrap/DimensionCopyRegistry.js → domain/dimension/DimensionCopy.js} +22 -72
- package/dist/lib/domain/dimension/DimensionRegistry.d.ts +54 -0
- package/dist/lib/domain/dimension/DimensionRegistry.js +620 -0
- package/dist/lib/domain/dimension/DimensionSop.d.ts +55 -0
- package/dist/lib/domain/dimension/DimensionSop.js +1604 -0
- package/dist/lib/domain/dimension/UnifiedDimension.d.ts +61 -0
- package/dist/lib/domain/dimension/UnifiedDimension.js +53 -0
- package/dist/lib/domain/dimension/index.d.ts +10 -0
- package/dist/lib/domain/dimension/index.js +9 -0
- package/dist/lib/domain/knowledge/FieldSpec.d.ts +1 -1
- package/dist/lib/domain/knowledge/FieldSpec.js +29 -16
- package/dist/lib/domain/knowledge/KnowledgeEntry.d.ts +33 -111
- package/dist/lib/domain/knowledge/KnowledgeEntry.js +27 -6
- package/dist/lib/domain/knowledge/KnowledgeRepository.d.ts +1 -0
- package/dist/lib/domain/knowledge/KnowledgeRepository.js +3 -0
- package/dist/lib/domain/knowledge/Lifecycle.js +1 -1
- package/dist/lib/domain/knowledge/StyleGuide.d.ts +1 -1
- package/dist/lib/domain/knowledge/StyleGuide.js +1 -1
- package/dist/lib/domain/knowledge/UnifiedValidator.js +15 -0
- package/dist/lib/domain/knowledge/values/Stats.d.ts +1 -1
- package/dist/lib/domain/knowledge/values/Stats.js +2 -2
- package/dist/lib/external/mcp/McpServer.js +4 -0
- package/dist/lib/external/mcp/handlers/TargetClassifier.d.ts +1 -1
- package/dist/lib/external/mcp/handlers/bootstrap/BootstrapSession.d.ts +8 -16
- package/dist/lib/external/mcp/handlers/bootstrap/BootstrapSession.js +10 -10
- package/dist/lib/external/mcp/handlers/bootstrap/ExternalSubmissionTracker.d.ts +7 -0
- package/dist/lib/external/mcp/handlers/bootstrap/ExternalSubmissionTracker.js +20 -0
- package/dist/lib/external/mcp/handlers/bootstrap/MissionBriefingBuilder.d.ts +52 -132
- package/dist/lib/external/mcp/handlers/bootstrap/MissionBriefingBuilder.js +204 -17
- package/dist/lib/external/mcp/handlers/bootstrap/base-dimensions.d.ts +11 -75
- package/dist/lib/external/mcp/handlers/bootstrap/base-dimensions.js +40 -191
- package/dist/lib/external/mcp/handlers/bootstrap/pipeline/dimension-configs.d.ts +13 -78
- package/dist/lib/external/mcp/handlers/bootstrap/pipeline/dimension-configs.js +30 -52
- package/dist/lib/external/mcp/handlers/bootstrap/pipeline/dimension-context.d.ts +0 -1
- package/dist/lib/external/mcp/handlers/bootstrap/pipeline/orchestrator.d.ts +99 -12
- package/dist/lib/external/mcp/handlers/bootstrap/pipeline/orchestrator.js +172 -161
- package/dist/lib/external/mcp/handlers/bootstrap/pipeline/tier-scheduler.js +7 -17
- package/dist/lib/external/mcp/handlers/bootstrap/shared/async-fill-helpers.d.ts +46 -0
- package/dist/lib/external/mcp/handlers/bootstrap/shared/async-fill-helpers.js +58 -0
- package/dist/lib/external/mcp/handlers/bootstrap/shared/audit-helpers.d.ts +25 -0
- package/dist/lib/external/mcp/handlers/bootstrap/shared/audit-helpers.js +47 -0
- package/dist/lib/external/mcp/handlers/bootstrap/shared/bootstrap-phases.d.ts +50 -12
- package/dist/lib/external/mcp/handlers/bootstrap/shared/bootstrap-phases.js +30 -10
- package/dist/lib/external/mcp/handlers/bootstrap/shared/dimension-text.js +1 -1
- package/dist/lib/external/mcp/handlers/bootstrap/shared/handler-types.d.ts +24 -0
- package/dist/lib/external/mcp/handlers/bootstrap/shared/handler-types.js +14 -0
- package/dist/lib/external/mcp/handlers/bootstrap/shared/panorama-utils.d.ts +14 -0
- package/dist/lib/external/mcp/handlers/bootstrap/shared/panorama-utils.js +48 -0
- package/dist/lib/external/mcp/handlers/bootstrap/shared/session-helpers.d.ts +21 -0
- package/dist/lib/external/mcp/handlers/bootstrap/shared/session-helpers.js +45 -0
- package/dist/lib/external/mcp/handlers/bootstrap/shared/skill-generator.d.ts +1 -1
- package/dist/lib/external/mcp/handlers/bootstrap/shared/target-file-map.d.ts +27 -0
- package/dist/lib/external/mcp/handlers/bootstrap/shared/target-file-map.js +44 -0
- package/dist/lib/external/mcp/handlers/bootstrap-external.d.ts +14 -10
- package/dist/lib/external/mcp/handlers/bootstrap-external.js +39 -51
- package/dist/lib/external/mcp/handlers/bootstrap-internal.d.ts +2 -0
- package/dist/lib/external/mcp/handlers/bootstrap-internal.js +115 -82
- package/dist/lib/external/mcp/handlers/consolidated.d.ts +4 -4
- package/dist/lib/external/mcp/handlers/consolidated.js +115 -162
- package/dist/lib/external/mcp/handlers/dimension-complete-external.js +69 -1
- package/dist/lib/external/mcp/handlers/evolve-external.d.ts +54 -0
- package/dist/lib/external/mcp/handlers/evolve-external.js +226 -0
- package/dist/lib/external/mcp/handlers/knowledge.js +26 -2
- package/dist/lib/external/mcp/handlers/rescan-external.d.ts +76 -0
- package/dist/lib/external/mcp/handlers/rescan-external.js +335 -0
- package/dist/lib/external/mcp/handlers/rescan-internal.d.ts +120 -0
- package/dist/lib/external/mcp/handlers/rescan-internal.js +359 -0
- package/dist/lib/external/mcp/handlers/search.d.ts +6 -5
- package/dist/lib/external/mcp/handlers/search.js +6 -5
- package/dist/lib/external/mcp/handlers/types.d.ts +2 -1
- package/dist/lib/external/mcp/handlers/wiki-external.js +2 -2
- package/dist/lib/external/mcp/tools.d.ts +8 -18
- package/dist/lib/external/mcp/tools.js +60 -3
- package/dist/lib/http/routes/knowledge.js +122 -1
- package/dist/lib/http/routes/modules.js +25 -3
- package/dist/lib/http/routes/panorama.js +16 -4
- package/dist/lib/infrastructure/cache/CacheCoordinator.d.ts +41 -0
- package/dist/lib/infrastructure/cache/CacheCoordinator.js +105 -0
- package/dist/lib/infrastructure/database/migrations/006_lifecycle_transition_events.d.ts +7 -0
- package/dist/lib/infrastructure/database/migrations/006_lifecycle_transition_events.js +28 -0
- package/dist/lib/infrastructure/vector/HnswVectorAdapter.js +1 -1
- package/dist/lib/injection/ServiceContainer.js +55 -0
- package/dist/lib/injection/ServiceMap.d.ts +8 -1
- package/dist/lib/injection/modules/InfraModule.js +4 -1
- package/dist/lib/injection/modules/KnowledgeModule.js +38 -1
- package/dist/lib/repository/evolution/ProposalRepository.d.ts +99 -0
- package/dist/lib/repository/evolution/ProposalRepository.js +255 -0
- package/dist/lib/repository/knowledge/KnowledgeRepository.impl.d.ts +4 -0
- package/dist/lib/repository/knowledge/KnowledgeRepository.impl.js +16 -1
- package/dist/lib/service/bootstrap/BootstrapEventEmitter.d.ts +3 -2
- package/dist/lib/service/bootstrap/BootstrapEventEmitter.js +1 -1
- package/dist/lib/service/bootstrap/DeliveryVerifier.d.ts +51 -0
- package/dist/lib/service/bootstrap/DeliveryVerifier.js +163 -0
- package/dist/lib/service/bootstrap/UiStartupTasks.d.ts +22 -4
- package/dist/lib/service/bootstrap/UiStartupTasks.js +73 -5
- package/dist/lib/service/bootstrap/bootstrap-event-types.d.ts +54 -0
- package/dist/lib/service/bootstrap/bootstrap-event-types.js +10 -0
- package/dist/lib/service/cleanup/CleanupService.d.ts +85 -0
- package/dist/lib/service/cleanup/CleanupService.js +324 -0
- package/dist/lib/service/delivery/AgentInstructionsGenerator.js +39 -43
- package/dist/lib/service/delivery/FileProtection.d.ts +20 -0
- package/dist/lib/service/delivery/FileProtection.js +54 -0
- package/dist/lib/service/delivery/SkillsSyncer.js +16 -21
- package/dist/lib/service/evolution/ContentPatcher.d.ts +44 -0
- package/dist/lib/service/evolution/ContentPatcher.js +310 -0
- package/dist/lib/service/evolution/DecayDetector.d.ts +4 -3
- package/dist/lib/service/evolution/DecayDetector.js +97 -22
- package/dist/lib/service/evolution/KnowledgeMetabolism.d.ts +4 -2
- package/dist/lib/service/evolution/KnowledgeMetabolism.js +29 -2
- package/dist/lib/service/evolution/ProposalExecutor.d.ts +66 -0
- package/dist/lib/service/evolution/ProposalExecutor.js +424 -0
- package/dist/lib/service/evolution/RecipeLifecycleSupervisor.d.ts +64 -0
- package/dist/lib/service/evolution/RecipeLifecycleSupervisor.js +458 -0
- package/dist/lib/service/evolution/RecipeRelevanceAuditor.d.ts +89 -0
- package/dist/lib/service/evolution/RecipeRelevanceAuditor.js +492 -0
- package/dist/lib/service/evolution/StagingManager.js +5 -3
- package/dist/lib/service/evolution/createSupersedeProposal.d.ts +44 -0
- package/dist/lib/service/evolution/createSupersedeProposal.js +81 -0
- package/dist/lib/service/guard/ComplianceReporter.d.ts +4 -0
- package/dist/lib/service/guard/ComplianceReporter.js +51 -0
- package/dist/lib/service/guard/GuardCheckEngine.js +5 -4
- package/dist/lib/service/guard/GuardCrossFileChecks.js +2 -0
- package/dist/lib/service/guard/ReverseGuard.d.ts +1 -1
- package/dist/lib/service/guard/ReverseGuard.js +32 -2
- package/dist/lib/service/knowledge/ConfidenceRouter.js +1 -1
- package/dist/lib/service/knowledge/KnowledgeService.d.ts +11 -1
- package/dist/lib/service/knowledge/KnowledgeService.js +44 -4
- package/dist/lib/service/knowledge/RecipeProductionGateway.d.ts +225 -0
- package/dist/lib/service/knowledge/RecipeProductionGateway.js +384 -0
- package/dist/lib/service/knowledge/SourceRefReconciler.d.ts +2 -0
- package/dist/lib/service/knowledge/SourceRefReconciler.js +48 -0
- package/dist/lib/service/panorama/DimensionAnalyzer.d.ts +3 -2
- package/dist/lib/service/panorama/DimensionAnalyzer.js +15 -140
- package/dist/lib/service/search/BM25Scorer.d.ts +2 -2
- package/dist/lib/service/search/SearchEngine.d.ts +11 -10
- package/dist/lib/service/search/SearchEngine.js +38 -36
- package/dist/lib/service/search/SearchTypes.d.ts +14 -8
- package/dist/lib/service/search/SearchTypes.js +1 -1
- package/dist/lib/service/search/tokenizer.d.ts +1 -1
- package/dist/lib/service/search/tokenizer.js +2 -2
- package/dist/lib/shared/schemas/common.d.ts +4 -4
- package/dist/lib/shared/schemas/http-requests.d.ts +12 -1
- package/dist/lib/shared/schemas/http-requests.js +8 -0
- package/dist/lib/shared/schemas/mcp-tools.d.ts +33 -2
- package/dist/lib/shared/schemas/mcp-tools.js +42 -0
- package/dist/lib/types/evolution.d.ts +135 -0
- package/dist/lib/types/evolution.js +6 -0
- package/dist/lib/types/graph-shared.d.ts +25 -0
- package/dist/lib/types/graph-shared.js +7 -0
- package/dist/lib/types/knowledge-wire.d.ts +131 -0
- package/dist/lib/types/knowledge-wire.js +7 -0
- package/dist/lib/types/project-snapshot-builder.d.ts +19 -0
- package/dist/lib/types/project-snapshot-builder.js +189 -0
- package/dist/lib/types/project-snapshot.d.ts +399 -0
- package/dist/lib/types/project-snapshot.js +17 -0
- package/dist/lib/types/search-wire.d.ts +46 -0
- package/dist/lib/types/search-wire.js +7 -0
- package/dist/lib/types/snapshot-views.d.ts +58 -0
- package/dist/lib/types/snapshot-views.js +103 -0
- package/package.json +1 -1
- package/skills/autosnippet-recipes/SKILL.md +1 -1
- package/templates/instructions/agent-static.md +2 -0
- package/templates/instructions/conventions.md +3 -1
- package/templates/recipes-setup/README.md +2 -2
- package/dashboard/dist/assets/icons-BJ2mUBi8.js +0 -1
- package/dashboard/dist/assets/index-B659K9t5.js +0 -128
- package/dashboard/dist/assets/index-NCm40PMD.css +0 -1
- package/dist/lib/external/mcp/handlers/bootstrap/pipeline/noAiFallback.d.ts +0 -169
- package/dist/lib/external/mcp/handlers/bootstrap/pipeline/noAiFallback.js +0 -727
- package/dist/lib/external/mcp/handlers/bootstrap/shared/dimension-sop.d.ts +0 -370
- package/dist/lib/external/mcp/handlers/bootstrap/shared/dimension-sop.js +0 -821
|
@@ -7,24 +7,29 @@
|
|
|
7
7
|
* - discovererRegistry, enhancementRegistry, languageService, dimensionCopy
|
|
8
8
|
* - constitution, aiProvider, projectGraph
|
|
9
9
|
*/
|
|
10
|
+
import { DimensionCopy } from '#domain/dimension/DimensionCopy.js';
|
|
10
11
|
import { resolveProjectRoot } from '#shared/resolveProjectRoot.js';
|
|
11
12
|
import { getDiscovererRegistry } from '../../core/discovery/index.js';
|
|
12
13
|
import { getEnhancementRegistry } from '../../core/enhancement/index.js';
|
|
13
14
|
import { HnswVectorAdapter } from '../../infrastructure/vector/HnswVectorAdapter.js';
|
|
14
15
|
import { IndexingPipeline } from '../../infrastructure/vector/IndexingPipeline.js';
|
|
15
16
|
import { JsonVectorAdapter } from '../../infrastructure/vector/JsonVectorAdapter.js';
|
|
16
|
-
import {
|
|
17
|
+
import { ProposalRepository } from '../../repository/evolution/ProposalRepository.js';
|
|
17
18
|
import { ConsolidationAdvisor } from '../../service/evolution/ConsolidationAdvisor.js';
|
|
19
|
+
import { ContentPatcher } from '../../service/evolution/ContentPatcher.js';
|
|
18
20
|
import { ContradictionDetector } from '../../service/evolution/ContradictionDetector.js';
|
|
19
21
|
import { DecayDetector } from '../../service/evolution/DecayDetector.js';
|
|
20
22
|
import { EnhancementSuggester } from '../../service/evolution/EnhancementSuggester.js';
|
|
21
23
|
import { KnowledgeMetabolism } from '../../service/evolution/KnowledgeMetabolism.js';
|
|
24
|
+
import { ProposalExecutor } from '../../service/evolution/ProposalExecutor.js';
|
|
25
|
+
import { RecipeLifecycleSupervisor } from '../../service/evolution/RecipeLifecycleSupervisor.js';
|
|
22
26
|
import { RedundancyAnalyzer } from '../../service/evolution/RedundancyAnalyzer.js';
|
|
23
27
|
import { StagingManager } from '../../service/evolution/StagingManager.js';
|
|
24
28
|
import { CodeEntityGraph } from '../../service/knowledge/CodeEntityGraph.js';
|
|
25
29
|
import { ConfidenceRouter } from '../../service/knowledge/ConfidenceRouter.js';
|
|
26
30
|
import { KnowledgeGraphService } from '../../service/knowledge/KnowledgeGraphService.js';
|
|
27
31
|
import { KnowledgeService } from '../../service/knowledge/KnowledgeService.js';
|
|
32
|
+
import { SourceRefReconciler } from '../../service/knowledge/SourceRefReconciler.js';
|
|
28
33
|
import { HybridRetriever } from '../../service/search/HybridRetriever.js';
|
|
29
34
|
import { SearchEngine } from '../../service/search/SearchEngine.js';
|
|
30
35
|
import { LanguageService } from '../../shared/LanguageService.js';
|
|
@@ -129,6 +134,13 @@ export function register(c) {
|
|
|
129
134
|
c.register('aiProvider', () => c.singletons.aiProvider || null);
|
|
130
135
|
c.register('projectGraph', () => c.singletons.projectGraph || null);
|
|
131
136
|
// ═══ Governance / Evolution ═══
|
|
137
|
+
c.singleton('sourceRefReconciler', (ct) => {
|
|
138
|
+
const db = ct.get('database');
|
|
139
|
+
const projectRoot = resolveProjectRoot();
|
|
140
|
+
return new SourceRefReconciler(projectRoot, db.getDb(), {
|
|
141
|
+
signalBus: ct.singletons.signalBus || undefined,
|
|
142
|
+
});
|
|
143
|
+
});
|
|
132
144
|
c.singleton('stagingManager', (ct) => {
|
|
133
145
|
const db = ct.get('database');
|
|
134
146
|
return new StagingManager(db.getDb(), {
|
|
@@ -165,6 +177,31 @@ export function register(c) {
|
|
|
165
177
|
redundancyAnalyzer: ct.get('redundancyAnalyzer'),
|
|
166
178
|
decayDetector: ct.get('decayDetector'),
|
|
167
179
|
signalBus: ct.singletons.signalBus || undefined,
|
|
180
|
+
proposalRepository: ct.services.proposalRepository
|
|
181
|
+
? ct.get('proposalRepository')
|
|
182
|
+
: undefined,
|
|
183
|
+
});
|
|
184
|
+
});
|
|
185
|
+
c.singleton('proposalRepository', (ct) => {
|
|
186
|
+
const db = ct.get('database');
|
|
187
|
+
return new ProposalRepository(db.getDb());
|
|
188
|
+
});
|
|
189
|
+
c.singleton('contentPatcher', (ct) => {
|
|
190
|
+
const db = ct.get('database');
|
|
191
|
+
return new ContentPatcher(db.getDb());
|
|
192
|
+
});
|
|
193
|
+
c.singleton('lifecycleSupervisor', (ct) => {
|
|
194
|
+
const db = ct.get('database');
|
|
195
|
+
return new RecipeLifecycleSupervisor(db.getDb(), {
|
|
196
|
+
signalBus: ct.singletons.signalBus || undefined,
|
|
197
|
+
});
|
|
198
|
+
});
|
|
199
|
+
c.singleton('proposalExecutor', (ct) => {
|
|
200
|
+
const db = ct.get('database');
|
|
201
|
+
return new ProposalExecutor(db.getDb(), ct.get('proposalRepository'), {
|
|
202
|
+
signalBus: ct.singletons.signalBus || undefined,
|
|
203
|
+
contentPatcher: ct.get('contentPatcher'),
|
|
204
|
+
supervisor: ct.get('lifecycleSupervisor'),
|
|
168
205
|
});
|
|
169
206
|
});
|
|
170
207
|
c.singleton('consolidationAdvisor', (ct) => {
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ProposalRepository — evolution_proposals 表 CRUD
|
|
3
|
+
*
|
|
4
|
+
* 操作 evolution_proposals 表,存储进化提案(merge/supersede/enhance/deprecate/
|
|
5
|
+
* reorganize/contradiction/correction)。
|
|
6
|
+
*
|
|
7
|
+
* 设计要求:
|
|
8
|
+
* - 去重:同 target + 同 type 不允许多个 observing 状态的 Proposal
|
|
9
|
+
* - Rate Limit:同一 target 不允许同时存在多个相同类型的 observing Proposal
|
|
10
|
+
* - JSON 字段(evidence/related_recipe_ids)序列化/反序列化
|
|
11
|
+
*/
|
|
12
|
+
interface DatabaseLike {
|
|
13
|
+
prepare(sql: string): {
|
|
14
|
+
all(...params: unknown[]): Record<string, unknown>[];
|
|
15
|
+
get(...params: unknown[]): Record<string, unknown> | undefined;
|
|
16
|
+
run(...params: unknown[]): {
|
|
17
|
+
changes: number;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
/** Proposal 类型 — 统一标准 */
|
|
22
|
+
export type ProposalType = 'merge' | 'supersede' | 'enhance' | 'deprecate' | 'reorganize' | 'contradiction' | 'correction';
|
|
23
|
+
/** Proposal 来源 */
|
|
24
|
+
export type ProposalSource = 'ide-agent' | 'metabolism' | 'decay-scan';
|
|
25
|
+
/** Proposal 状态 */
|
|
26
|
+
export type ProposalStatus = 'pending' | 'observing' | 'executed' | 'rejected' | 'expired';
|
|
27
|
+
/** evolution_proposals 行对象 */
|
|
28
|
+
export interface ProposalRecord {
|
|
29
|
+
id: string;
|
|
30
|
+
type: ProposalType;
|
|
31
|
+
targetRecipeId: string;
|
|
32
|
+
relatedRecipeIds: string[];
|
|
33
|
+
confidence: number;
|
|
34
|
+
source: ProposalSource;
|
|
35
|
+
description: string;
|
|
36
|
+
evidence: Record<string, unknown>[];
|
|
37
|
+
status: ProposalStatus;
|
|
38
|
+
proposedAt: number;
|
|
39
|
+
expiresAt: number;
|
|
40
|
+
resolvedAt: number | null;
|
|
41
|
+
resolvedBy: string | null;
|
|
42
|
+
resolution: string | null;
|
|
43
|
+
}
|
|
44
|
+
/** 创建 Proposal 输入 */
|
|
45
|
+
export interface CreateProposalInput {
|
|
46
|
+
type: ProposalType;
|
|
47
|
+
targetRecipeId: string;
|
|
48
|
+
relatedRecipeIds?: string[];
|
|
49
|
+
confidence: number;
|
|
50
|
+
source: ProposalSource;
|
|
51
|
+
description: string;
|
|
52
|
+
evidence?: Record<string, unknown>[];
|
|
53
|
+
status?: ProposalStatus;
|
|
54
|
+
expiresAt?: number;
|
|
55
|
+
}
|
|
56
|
+
/** 查询过滤器 */
|
|
57
|
+
export interface ProposalFilter {
|
|
58
|
+
status?: ProposalStatus | ProposalStatus[];
|
|
59
|
+
type?: ProposalType;
|
|
60
|
+
targetRecipeId?: string;
|
|
61
|
+
source?: ProposalSource;
|
|
62
|
+
expiredBefore?: number;
|
|
63
|
+
}
|
|
64
|
+
export declare class ProposalRepository {
|
|
65
|
+
#private;
|
|
66
|
+
constructor(db: DatabaseLike);
|
|
67
|
+
/**
|
|
68
|
+
* 创建 Proposal 并写入 DB。
|
|
69
|
+
*
|
|
70
|
+
* - 自动生成 ID(ep-{timestamp}-{random})
|
|
71
|
+
* - 自动设定 expiresAt(按 type 默认窗口)
|
|
72
|
+
* - 自动判断 status(低风险 + 高置信度 → observing,否则 pending)
|
|
73
|
+
* - 去重:同 target + 同 type 已有 pending/observing 时拒绝创建
|
|
74
|
+
*/
|
|
75
|
+
create(input: CreateProposalInput): ProposalRecord | null;
|
|
76
|
+
/** 按 ID 查询 */
|
|
77
|
+
findById(id: string): ProposalRecord | null;
|
|
78
|
+
/** 按条件查询 */
|
|
79
|
+
find(filter?: ProposalFilter): ProposalRecord[];
|
|
80
|
+
/** 查询已到期的 observing 状态 Proposal */
|
|
81
|
+
findExpiredObserving(): ProposalRecord[];
|
|
82
|
+
/** 查询所有未完成的 Proposal(pending + observing) */
|
|
83
|
+
findActive(): ProposalRecord[];
|
|
84
|
+
/** 按 target Recipe ID 查询活跃 Proposal */
|
|
85
|
+
findByTarget(targetRecipeId: string): ProposalRecord[];
|
|
86
|
+
/** 将 Proposal 状态转为 observing */
|
|
87
|
+
startObserving(id: string): boolean;
|
|
88
|
+
/** 标记 Proposal 为已执行 */
|
|
89
|
+
markExecuted(id: string, resolution: string, resolvedBy?: string): boolean;
|
|
90
|
+
/** 标记 Proposal 为已拒绝 */
|
|
91
|
+
markRejected(id: string, resolution: string, resolvedBy?: string): boolean;
|
|
92
|
+
/** 标记 Proposal 为过期 */
|
|
93
|
+
markExpired(id: string): boolean;
|
|
94
|
+
/** 更新 evidence(用于追加观察期指标快照) */
|
|
95
|
+
updateEvidence(id: string, evidence: Record<string, unknown>[]): boolean;
|
|
96
|
+
/** 统计各状态的 Proposal 数量 */
|
|
97
|
+
stats(): Record<ProposalStatus, number>;
|
|
98
|
+
}
|
|
99
|
+
export {};
|
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ProposalRepository — evolution_proposals 表 CRUD
|
|
3
|
+
*
|
|
4
|
+
* 操作 evolution_proposals 表,存储进化提案(merge/supersede/enhance/deprecate/
|
|
5
|
+
* reorganize/contradiction/correction)。
|
|
6
|
+
*
|
|
7
|
+
* 设计要求:
|
|
8
|
+
* - 去重:同 target + 同 type 不允许多个 observing 状态的 Proposal
|
|
9
|
+
* - Rate Limit:同一 target 不允许同时存在多个相同类型的 observing Proposal
|
|
10
|
+
* - JSON 字段(evidence/related_recipe_ids)序列化/反序列化
|
|
11
|
+
*/
|
|
12
|
+
import { randomBytes } from 'node:crypto';
|
|
13
|
+
/* ────────────────────── Constants ────────────────────── */
|
|
14
|
+
/** 默认观察窗口:7 天 */
|
|
15
|
+
const DEFAULT_OBSERVATION_WINDOW = 7 * 24 * 60 * 60 * 1000;
|
|
16
|
+
/** 各 Proposal 类型的默认观察窗口(ms) */
|
|
17
|
+
const OBSERVATION_WINDOWS = {
|
|
18
|
+
enhance: 48 * 60 * 60 * 1000, // 48h
|
|
19
|
+
correction: 24 * 60 * 60 * 1000, // 24h
|
|
20
|
+
merge: 72 * 60 * 60 * 1000, // 72h
|
|
21
|
+
supersede: 72 * 60 * 60 * 1000, // 72h
|
|
22
|
+
deprecate: 7 * 24 * 60 * 60 * 1000, // 7d
|
|
23
|
+
contradiction: 7 * 24 * 60 * 60 * 1000, // 7d
|
|
24
|
+
reorganize: 7 * 24 * 60 * 60 * 1000, // 7d
|
|
25
|
+
};
|
|
26
|
+
/** 自动进入观察状态的置信度阈值 */
|
|
27
|
+
const AUTO_OBSERVE_THRESHOLDS = {
|
|
28
|
+
enhance: 0.7,
|
|
29
|
+
correction: 0.7,
|
|
30
|
+
merge: 0.75,
|
|
31
|
+
supersede: 0.8,
|
|
32
|
+
deprecate: 0.0, // decayScore ≤ 40 即可
|
|
33
|
+
contradiction: Infinity, // 需开发者确认
|
|
34
|
+
reorganize: Infinity, // 需开发者确认
|
|
35
|
+
};
|
|
36
|
+
/* ────────────────────── Class ────────────────────── */
|
|
37
|
+
export class ProposalRepository {
|
|
38
|
+
#db;
|
|
39
|
+
constructor(db) {
|
|
40
|
+
this.#db = db;
|
|
41
|
+
}
|
|
42
|
+
/* ═══════════════════ Create ═══════════════════ */
|
|
43
|
+
/**
|
|
44
|
+
* 创建 Proposal 并写入 DB。
|
|
45
|
+
*
|
|
46
|
+
* - 自动生成 ID(ep-{timestamp}-{random})
|
|
47
|
+
* - 自动设定 expiresAt(按 type 默认窗口)
|
|
48
|
+
* - 自动判断 status(低风险 + 高置信度 → observing,否则 pending)
|
|
49
|
+
* - 去重:同 target + 同 type 已有 pending/observing 时拒绝创建
|
|
50
|
+
*/
|
|
51
|
+
create(input) {
|
|
52
|
+
const now = Date.now();
|
|
53
|
+
// 去重检查
|
|
54
|
+
if (this.#hasDuplicate(input.targetRecipeId, input.type)) {
|
|
55
|
+
return null;
|
|
56
|
+
}
|
|
57
|
+
const id = ProposalRepository.#generateId(now);
|
|
58
|
+
const expiresAt = input.expiresAt ?? now + (OBSERVATION_WINDOWS[input.type] ?? DEFAULT_OBSERVATION_WINDOW);
|
|
59
|
+
const status = input.status ?? this.#resolveInitialStatus(input.type, input.confidence);
|
|
60
|
+
const record = {
|
|
61
|
+
id,
|
|
62
|
+
type: input.type,
|
|
63
|
+
targetRecipeId: input.targetRecipeId,
|
|
64
|
+
relatedRecipeIds: input.relatedRecipeIds ?? [],
|
|
65
|
+
confidence: input.confidence,
|
|
66
|
+
source: input.source,
|
|
67
|
+
description: input.description,
|
|
68
|
+
evidence: input.evidence ?? [],
|
|
69
|
+
status,
|
|
70
|
+
proposedAt: now,
|
|
71
|
+
expiresAt,
|
|
72
|
+
resolvedAt: null,
|
|
73
|
+
resolvedBy: null,
|
|
74
|
+
resolution: null,
|
|
75
|
+
};
|
|
76
|
+
this.#db
|
|
77
|
+
.prepare(`INSERT INTO evolution_proposals
|
|
78
|
+
(id, type, target_recipe_id, related_recipe_ids, confidence, source, description, evidence, status, proposed_at, expires_at)
|
|
79
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`)
|
|
80
|
+
.run(record.id, record.type, record.targetRecipeId, JSON.stringify(record.relatedRecipeIds), record.confidence, record.source, record.description, JSON.stringify(record.evidence), record.status, record.proposedAt, record.expiresAt);
|
|
81
|
+
return record;
|
|
82
|
+
}
|
|
83
|
+
/* ═══════════════════ Read ═══════════════════ */
|
|
84
|
+
/** 按 ID 查询 */
|
|
85
|
+
findById(id) {
|
|
86
|
+
const row = this.#db.prepare(`SELECT * FROM evolution_proposals WHERE id = ?`).get(id);
|
|
87
|
+
return row ? ProposalRepository.#mapRow(row) : null;
|
|
88
|
+
}
|
|
89
|
+
/** 按条件查询 */
|
|
90
|
+
find(filter = {}) {
|
|
91
|
+
const conditions = [];
|
|
92
|
+
const params = [];
|
|
93
|
+
if (filter.status) {
|
|
94
|
+
if (Array.isArray(filter.status)) {
|
|
95
|
+
const placeholders = filter.status.map(() => '?').join(', ');
|
|
96
|
+
conditions.push(`status IN (${placeholders})`);
|
|
97
|
+
params.push(...filter.status);
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
100
|
+
conditions.push('status = ?');
|
|
101
|
+
params.push(filter.status);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
if (filter.type) {
|
|
105
|
+
conditions.push('type = ?');
|
|
106
|
+
params.push(filter.type);
|
|
107
|
+
}
|
|
108
|
+
if (filter.targetRecipeId) {
|
|
109
|
+
conditions.push('target_recipe_id = ?');
|
|
110
|
+
params.push(filter.targetRecipeId);
|
|
111
|
+
}
|
|
112
|
+
if (filter.source) {
|
|
113
|
+
conditions.push('source = ?');
|
|
114
|
+
params.push(filter.source);
|
|
115
|
+
}
|
|
116
|
+
if (filter.expiredBefore) {
|
|
117
|
+
conditions.push('expires_at <= ?');
|
|
118
|
+
params.push(filter.expiredBefore);
|
|
119
|
+
}
|
|
120
|
+
const where = conditions.length > 0 ? `WHERE ${conditions.join(' AND ')}` : '';
|
|
121
|
+
const rows = this.#db
|
|
122
|
+
.prepare(`SELECT * FROM evolution_proposals ${where} ORDER BY proposed_at DESC`)
|
|
123
|
+
.all(...params);
|
|
124
|
+
return rows.map(ProposalRepository.#mapRow);
|
|
125
|
+
}
|
|
126
|
+
/** 查询已到期的 observing 状态 Proposal */
|
|
127
|
+
findExpiredObserving() {
|
|
128
|
+
return this.find({
|
|
129
|
+
status: 'observing',
|
|
130
|
+
expiredBefore: Date.now(),
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
/** 查询所有未完成的 Proposal(pending + observing) */
|
|
134
|
+
findActive() {
|
|
135
|
+
return this.find({
|
|
136
|
+
status: ['pending', 'observing'],
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
/** 按 target Recipe ID 查询活跃 Proposal */
|
|
140
|
+
findByTarget(targetRecipeId) {
|
|
141
|
+
return this.find({
|
|
142
|
+
targetRecipeId,
|
|
143
|
+
status: ['pending', 'observing'],
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
/* ═══════════════════ Update ═══════════════════ */
|
|
147
|
+
/** 将 Proposal 状态转为 observing */
|
|
148
|
+
startObserving(id) {
|
|
149
|
+
const now = Date.now();
|
|
150
|
+
const proposal = this.findById(id);
|
|
151
|
+
if (!proposal || proposal.status !== 'pending') {
|
|
152
|
+
return false;
|
|
153
|
+
}
|
|
154
|
+
const expiresAt = now + (OBSERVATION_WINDOWS[proposal.type] ?? DEFAULT_OBSERVATION_WINDOW);
|
|
155
|
+
const result = this.#db
|
|
156
|
+
.prepare(`UPDATE evolution_proposals SET status = 'observing', expires_at = ? WHERE id = ? AND status = 'pending'`)
|
|
157
|
+
.run(expiresAt, id);
|
|
158
|
+
return result.changes > 0;
|
|
159
|
+
}
|
|
160
|
+
/** 标记 Proposal 为已执行 */
|
|
161
|
+
markExecuted(id, resolution, resolvedBy = 'auto') {
|
|
162
|
+
const result = this.#db
|
|
163
|
+
.prepare(`UPDATE evolution_proposals SET status = 'executed', resolved_at = ?, resolved_by = ?, resolution = ? WHERE id = ? AND status = 'observing'`)
|
|
164
|
+
.run(Date.now(), resolvedBy, resolution, id);
|
|
165
|
+
return result.changes > 0;
|
|
166
|
+
}
|
|
167
|
+
/** 标记 Proposal 为已拒绝 */
|
|
168
|
+
markRejected(id, resolution, resolvedBy = 'auto') {
|
|
169
|
+
const result = this.#db
|
|
170
|
+
.prepare(`UPDATE evolution_proposals SET status = 'rejected', resolved_at = ?, resolved_by = ?, resolution = ? WHERE id = ? AND status IN ('pending', 'observing')`)
|
|
171
|
+
.run(Date.now(), resolvedBy, resolution, id);
|
|
172
|
+
return result.changes > 0;
|
|
173
|
+
}
|
|
174
|
+
/** 标记 Proposal 为过期 */
|
|
175
|
+
markExpired(id) {
|
|
176
|
+
const result = this.#db
|
|
177
|
+
.prepare(`UPDATE evolution_proposals SET status = 'expired', resolved_at = ? WHERE id = ? AND status IN ('pending', 'observing')`)
|
|
178
|
+
.run(Date.now(), id);
|
|
179
|
+
return result.changes > 0;
|
|
180
|
+
}
|
|
181
|
+
/** 更新 evidence(用于追加观察期指标快照) */
|
|
182
|
+
updateEvidence(id, evidence) {
|
|
183
|
+
const result = this.#db
|
|
184
|
+
.prepare(`UPDATE evolution_proposals SET evidence = ? WHERE id = ?`)
|
|
185
|
+
.run(JSON.stringify(evidence), id);
|
|
186
|
+
return result.changes > 0;
|
|
187
|
+
}
|
|
188
|
+
/* ═══════════════════ Stats ═══════════════════ */
|
|
189
|
+
/** 统计各状态的 Proposal 数量 */
|
|
190
|
+
stats() {
|
|
191
|
+
const rows = this.#db
|
|
192
|
+
.prepare(`SELECT status, COUNT(*) as count FROM evolution_proposals GROUP BY status`)
|
|
193
|
+
.all();
|
|
194
|
+
const result = {
|
|
195
|
+
pending: 0,
|
|
196
|
+
observing: 0,
|
|
197
|
+
executed: 0,
|
|
198
|
+
rejected: 0,
|
|
199
|
+
expired: 0,
|
|
200
|
+
};
|
|
201
|
+
for (const row of rows) {
|
|
202
|
+
result[row.status] = row.count;
|
|
203
|
+
}
|
|
204
|
+
return result;
|
|
205
|
+
}
|
|
206
|
+
/* ═══════════════════ Private ═══════════════════ */
|
|
207
|
+
/** 去重检查:同 target + 同 type 是否已有 pending/observing Proposal */
|
|
208
|
+
#hasDuplicate(targetRecipeId, type) {
|
|
209
|
+
const row = this.#db
|
|
210
|
+
.prepare(`SELECT 1 FROM evolution_proposals WHERE target_recipe_id = ? AND type = ? AND status IN ('pending', 'observing') LIMIT 1`)
|
|
211
|
+
.get(targetRecipeId, type);
|
|
212
|
+
return row !== undefined;
|
|
213
|
+
}
|
|
214
|
+
/** 根据 type + confidence 判断初始状态 */
|
|
215
|
+
#resolveInitialStatus(type, confidence) {
|
|
216
|
+
const threshold = AUTO_OBSERVE_THRESHOLDS[type];
|
|
217
|
+
return confidence >= threshold ? 'observing' : 'pending';
|
|
218
|
+
}
|
|
219
|
+
/** 生成 Proposal ID */
|
|
220
|
+
static #generateId(timestamp) {
|
|
221
|
+
const rand = randomBytes(4).toString('hex');
|
|
222
|
+
return `ep-${timestamp}-${rand}`;
|
|
223
|
+
}
|
|
224
|
+
/** DB 行 → ProposalRecord */
|
|
225
|
+
static #mapRow(row) {
|
|
226
|
+
return {
|
|
227
|
+
id: row.id,
|
|
228
|
+
type: row.type,
|
|
229
|
+
targetRecipeId: row.target_recipe_id,
|
|
230
|
+
relatedRecipeIds: safeJsonParse(row.related_recipe_ids, []),
|
|
231
|
+
confidence: row.confidence,
|
|
232
|
+
source: row.source,
|
|
233
|
+
description: row.description,
|
|
234
|
+
evidence: safeJsonParse(row.evidence, []),
|
|
235
|
+
status: row.status,
|
|
236
|
+
proposedAt: row.proposed_at,
|
|
237
|
+
expiresAt: row.expires_at,
|
|
238
|
+
resolvedAt: row.resolved_at ?? null,
|
|
239
|
+
resolvedBy: row.resolved_by ?? null,
|
|
240
|
+
resolution: row.resolution ?? null,
|
|
241
|
+
};
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
/* ────────────────────── Util ────────────────────── */
|
|
245
|
+
function safeJsonParse(json, fallback) {
|
|
246
|
+
if (!json) {
|
|
247
|
+
return fallback;
|
|
248
|
+
}
|
|
249
|
+
try {
|
|
250
|
+
return JSON.parse(json);
|
|
251
|
+
}
|
|
252
|
+
catch {
|
|
253
|
+
return fallback;
|
|
254
|
+
}
|
|
255
|
+
}
|
|
@@ -40,6 +40,10 @@ export declare class KnowledgeRepositoryImpl extends BaseRepository {
|
|
|
40
40
|
* ★ Drizzle 类型安全 INSERT — 列名拼写编译期检查
|
|
41
41
|
*/
|
|
42
42
|
create(entry: KnowledgeEntry): Promise<unknown>;
|
|
43
|
+
/**
|
|
44
|
+
* 按标题精确查找(大小写不敏感)
|
|
45
|
+
*/
|
|
46
|
+
findByTitle(title: string): Promise<KnowledgeEntry | null>;
|
|
43
47
|
/**
|
|
44
48
|
* 更新 KnowledgeEntry(接受完整实体或部分数据)
|
|
45
49
|
* ★ Drizzle 类型安全 UPDATE
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { and, eq } from 'drizzle-orm';
|
|
1
|
+
import { and, eq, sql } from 'drizzle-orm';
|
|
2
2
|
import { inferKind, KnowledgeEntry } from '../../domain/knowledge/index.js';
|
|
3
3
|
import { getDrizzle } from '../../infrastructure/database/drizzle/index.js';
|
|
4
4
|
import { knowledgeEntries } from '../../infrastructure/database/drizzle/schema.js';
|
|
@@ -45,6 +45,21 @@ export class KnowledgeRepositoryImpl extends BaseRepository {
|
|
|
45
45
|
throw error;
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
|
+
/**
|
|
49
|
+
* 按标题精确查找(大小写不敏感)
|
|
50
|
+
*/
|
|
51
|
+
async findByTitle(title) {
|
|
52
|
+
const rows = this.#drizzle
|
|
53
|
+
.select()
|
|
54
|
+
.from(knowledgeEntries)
|
|
55
|
+
.where(sql `lower(${knowledgeEntries.title}) = lower(${title})`)
|
|
56
|
+
.limit(1)
|
|
57
|
+
.all();
|
|
58
|
+
if (rows.length === 0) {
|
|
59
|
+
return null;
|
|
60
|
+
}
|
|
61
|
+
return this._rowToEntity(rows[0]);
|
|
62
|
+
}
|
|
48
63
|
/**
|
|
49
64
|
* 更新 KnowledgeEntry(接受完整实体或部分数据)
|
|
50
65
|
* ★ Drizzle 类型安全 UPDATE
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* @module shared/BootstrapEventEmitter
|
|
8
8
|
*/
|
|
9
|
+
import type { DimensionCompletePayload, ProgressPayload } from './bootstrap-event-types.js';
|
|
9
10
|
export declare class BootstrapEventEmitter {
|
|
10
11
|
#private;
|
|
11
12
|
/** @param container DI Container */
|
|
@@ -23,7 +24,7 @@ export declare class BootstrapEventEmitter {
|
|
|
23
24
|
* @param [data.skillCreated] 是否生成了 Skill
|
|
24
25
|
* @param [data.recipesBound] 关联的 recipe 数量
|
|
25
26
|
*/
|
|
26
|
-
emitDimensionComplete(dimId: string, data
|
|
27
|
+
emitDimensionComplete(dimId: string, data: DimensionCompletePayload): void;
|
|
27
28
|
/**
|
|
28
29
|
* 推送全部维度完成事件
|
|
29
30
|
*
|
|
@@ -51,6 +52,6 @@ export declare class BootstrapEventEmitter {
|
|
|
51
52
|
* @param event 事件名
|
|
52
53
|
* @param data 事件数据
|
|
53
54
|
*/
|
|
54
|
-
emitProgress(event: string, data?:
|
|
55
|
+
emitProgress(event: string, data?: ProgressPayload): void;
|
|
55
56
|
}
|
|
56
57
|
export default BootstrapEventEmitter;
|
|
@@ -39,7 +39,7 @@ export class BootstrapEventEmitter {
|
|
|
39
39
|
* @param [data.skillCreated] 是否生成了 Skill
|
|
40
40
|
* @param [data.recipesBound] 关联的 recipe 数量
|
|
41
41
|
*/
|
|
42
|
-
emitDimensionComplete(dimId, data
|
|
42
|
+
emitDimensionComplete(dimId, data) {
|
|
43
43
|
// TaskManager 标记
|
|
44
44
|
try {
|
|
45
45
|
this.#taskManager?.markTaskCompleted?.(dimId, data);
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DeliveryVerifier — Bootstrap/Rescan 完成后交付完整性检查
|
|
3
|
+
*
|
|
4
|
+
* 验证以下交付物是否正确生成:
|
|
5
|
+
* - Channel A: autosnippet-project-rules.mdc
|
|
6
|
+
* - Channel B: autosnippet-patterns 系列文件
|
|
7
|
+
* - Channel C: .cursor/skills/ 目录
|
|
8
|
+
* - Channel F: AGENTS.md, CLAUDE.md, copilot-instructions.md
|
|
9
|
+
* - Wiki: meta.json
|
|
10
|
+
* - Skills: project 级 Skill 目录
|
|
11
|
+
* - 向量索引: asvec 文件
|
|
12
|
+
*
|
|
13
|
+
* @module service/bootstrap/DeliveryVerifier
|
|
14
|
+
*/
|
|
15
|
+
/** §10.5 交付通道标识 */
|
|
16
|
+
export type DeliveryChannel = 'channelA' | 'channelB' | 'channelC' | 'channelF' | 'wiki' | 'skills' | 'vectorIndex';
|
|
17
|
+
/** 单通道验证结果 */
|
|
18
|
+
export interface ChannelVerification {
|
|
19
|
+
generated: boolean;
|
|
20
|
+
file?: string;
|
|
21
|
+
files?: string[];
|
|
22
|
+
count?: number;
|
|
23
|
+
size?: number;
|
|
24
|
+
skillCount?: number;
|
|
25
|
+
pageCount?: number;
|
|
26
|
+
documentCount?: number;
|
|
27
|
+
agentsMd?: boolean;
|
|
28
|
+
claudeMd?: boolean;
|
|
29
|
+
copilotInstructions?: boolean;
|
|
30
|
+
rebuilt?: boolean;
|
|
31
|
+
}
|
|
32
|
+
/** 完整验证结果 */
|
|
33
|
+
export interface DeliveryVerification {
|
|
34
|
+
channelA: ChannelVerification;
|
|
35
|
+
channelB: ChannelVerification;
|
|
36
|
+
channelC: ChannelVerification;
|
|
37
|
+
channelF: ChannelVerification;
|
|
38
|
+
wiki: ChannelVerification;
|
|
39
|
+
skills: ChannelVerification;
|
|
40
|
+
vectorIndex: ChannelVerification;
|
|
41
|
+
allPassed: boolean;
|
|
42
|
+
failures: string[];
|
|
43
|
+
}
|
|
44
|
+
export declare class DeliveryVerifier {
|
|
45
|
+
#private;
|
|
46
|
+
constructor(projectRoot: string);
|
|
47
|
+
/**
|
|
48
|
+
* 验证所有交付物是否正确生成
|
|
49
|
+
*/
|
|
50
|
+
verify(): DeliveryVerification;
|
|
51
|
+
}
|