autosnippet 3.2.18 → 3.2.20
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 +73 -104
- package/dashboard/dist/assets/{index-CKMy5LY6.js → index-DdvZE4Yd.js} +1 -1
- package/dashboard/dist/index.html +1 -1
- package/dist/bin/cli.js +45 -10
- package/dist/lib/agent/AgentEventBus.js +3 -3
- package/dist/lib/agent/AgentFactory.d.ts +3 -3
- package/dist/lib/agent/AgentFactory.js +4 -4
- package/dist/lib/agent/AgentMessage.d.ts +8 -8
- package/dist/lib/agent/AgentMessage.js +8 -8
- package/dist/lib/agent/AgentRuntime.js +2 -2
- package/dist/lib/agent/AgentState.js +4 -4
- package/dist/lib/agent/ConversationStore.d.ts +1 -1
- package/dist/lib/agent/ConversationStore.js +1 -1
- package/dist/lib/agent/PipelineStrategy.js +1 -1
- package/dist/lib/agent/context/ContextWindow.d.ts +2 -2
- package/dist/lib/agent/context/ContextWindow.js +7 -7
- package/dist/lib/agent/context/ExplorationTracker.js +9 -9
- package/dist/lib/agent/context/exploration/PlanTracker.js +2 -2
- package/dist/lib/agent/context/exploration/SignalDetector.d.ts +1 -1
- package/dist/lib/agent/context/exploration/SignalDetector.js +1 -1
- package/dist/lib/agent/core/LoopContext.d.ts +21 -21
- package/dist/lib/agent/core/LoopContext.js +21 -21
- package/dist/lib/agent/core/SystemPromptBuilder.js +4 -4
- package/dist/lib/agent/domain/EvidenceCollector.js +5 -5
- package/dist/lib/agent/memory/ActiveContext.js +1 -1
- package/dist/lib/agent/memory/MemoryRetriever.js +1 -1
- package/dist/lib/agent/memory/MemoryStore.js +2 -2
- package/dist/lib/agent/memory/SessionStore.js +3 -3
- package/dist/lib/agent/policies.d.ts +1 -1
- package/dist/lib/agent/policies.js +1 -1
- package/dist/lib/agent/strategies.d.ts +1 -1
- package/dist/lib/agent/strategies.js +4 -4
- package/dist/lib/agent/tools/_shared.d.ts +1 -1
- package/dist/lib/agent/tools/_shared.js +1 -1
- package/dist/lib/agent/tools/infrastructure.js +2 -2
- package/dist/lib/cli/SetupService.d.ts +25 -25
- package/dist/lib/cli/SetupService.js +28 -15
- package/dist/lib/cli/deploy/FileDeployer.d.ts +9 -2
- package/dist/lib/cli/deploy/FileDeployer.js +139 -46
- package/dist/lib/cli/deploy/FileManifest.d.ts +23 -39
- package/dist/lib/cli/deploy/FileManifest.js +22 -27
- package/dist/lib/core/AstAnalyzer.d.ts +2 -2
- package/dist/lib/core/AstAnalyzer.js +2 -2
- package/dist/lib/core/analysis/CallEdgeResolver.d.ts +7 -7
- package/dist/lib/core/analysis/CallEdgeResolver.js +9 -9
- package/dist/lib/core/analysis/CallGraphAnalyzer.d.ts +4 -4
- package/dist/lib/core/analysis/CallGraphAnalyzer.js +2 -2
- package/dist/lib/core/analysis/ImportPathResolver.d.ts +0 -2
- package/dist/lib/core/analysis/ImportPathResolver.js +2 -4
- package/dist/lib/core/ast/ProjectGraph.js +7 -7
- package/dist/lib/core/capability/CapabilityProbe.js +6 -14
- package/dist/lib/domain/knowledge/UnifiedValidator.js +2 -2
- package/dist/lib/domain/knowledge/values/Constraints.js +4 -4
- package/dist/lib/domain/knowledge/values/Content.js +6 -6
- package/dist/lib/domain/knowledge/values/Quality.js +5 -5
- package/dist/lib/domain/knowledge/values/Reasoning.js +5 -5
- package/dist/lib/domain/knowledge/values/Relations.js +1 -1
- package/dist/lib/domain/knowledge/values/Stats.js +6 -6
- package/dist/lib/domain/task/TaskIdGenerator.d.ts +4 -4
- package/dist/lib/domain/task/TaskIdGenerator.js +2 -2
- package/dist/lib/external/lark/LarkTransport.js +4 -4
- package/dist/lib/external/mcp/McpServer.d.ts +3 -7
- package/dist/lib/external/mcp/McpServer.js +9 -13
- package/dist/lib/external/mcp/handlers/bootstrap/ExternalSubmissionTracker.js +5 -5
- package/dist/lib/external/mcp/handlers/bootstrap/MissionBriefingBuilder.js +4 -3
- package/dist/lib/external/mcp/handlers/bootstrap/pipeline/BootstrapSnapshot.d.ts +3 -3
- package/dist/lib/external/mcp/handlers/bootstrap/pipeline/BootstrapSnapshot.js +3 -3
- package/dist/lib/external/mcp/handlers/bootstrap/pipeline/IncrementalBootstrap.d.ts +1 -1
- package/dist/lib/external/mcp/handlers/bootstrap/pipeline/IncrementalBootstrap.js +1 -1
- package/dist/lib/external/mcp/handlers/bootstrap/pipeline/dimension-context.js +3 -3
- package/dist/lib/external/mcp/handlers/bootstrap/shared/dimension-sop.js +27 -14
- package/dist/lib/external/mcp/handlers/bootstrap-external.js +6 -0
- package/dist/lib/external/mcp/handlers/dimension-complete-external.js +55 -1
- package/dist/lib/external/mcp/handlers/skill.js +9 -31
- package/dist/lib/external/mcp/handlers/system.js +2 -2
- package/dist/lib/external/mcp/handlers/task.js +16 -1
- package/dist/lib/external/mcp/tools.d.ts +12 -10
- package/dist/lib/external/mcp/tools.js +97 -69
- package/dist/lib/http/utils/routeHelpers.d.ts +1 -1
- package/dist/lib/http/utils/routeHelpers.js +1 -1
- package/dist/lib/http/utils/sse-sessions.d.ts +1 -1
- package/dist/lib/http/utils/sse-sessions.js +1 -1
- package/dist/lib/infrastructure/cache/CacheService.js +1 -1
- package/dist/lib/infrastructure/vector/AsyncPersistence.js +8 -8
- package/dist/lib/infrastructure/vector/BatchEmbedder.d.ts +1 -1
- package/dist/lib/infrastructure/vector/BatchEmbedder.js +2 -2
- package/dist/lib/infrastructure/vector/HnswIndex.d.ts +4 -4
- package/dist/lib/infrastructure/vector/HnswIndex.js +5 -5
- package/dist/lib/infrastructure/vector/HnswVectorAdapter.js +8 -8
- package/dist/lib/infrastructure/vector/ScalarQuantizer.d.ts +1 -1
- package/dist/lib/infrastructure/vector/ScalarQuantizer.js +4 -4
- package/dist/lib/infrastructure/vector/VectorStore.d.ts +1 -1
- package/dist/lib/infrastructure/vector/VectorStore.js +1 -1
- package/dist/lib/injection/ServiceContainer.d.ts +1 -1
- package/dist/lib/injection/ServiceContainer.js +1 -1
- package/dist/lib/platform/NativeUi.d.ts +1 -1
- package/dist/lib/platform/NativeUi.js +1 -1
- package/dist/lib/platform/ios/spm/DependencyGraph.d.ts +1 -1
- package/dist/lib/platform/ios/spm/DependencyGraph.js +1 -1
- package/dist/lib/platform/ios/spm/PolicyEngine.d.ts +1 -1
- package/dist/lib/platform/ios/spm/PolicyEngine.js +1 -1
- package/dist/lib/platform/ios/spm/SpmDiscoverer.js +1 -1
- package/dist/lib/platform/ios/spm/SpmHelper.js +3 -3
- package/dist/lib/platform/ios/xcode/SaveEventFilter.js +2 -2
- package/dist/lib/platform/ios/xcode/XcodeIntegration.js +1 -1
- package/dist/lib/repository/base/BaseRepository.js +1 -1
- package/dist/lib/repository/task/TaskRepository.impl.d.ts +2 -2
- package/dist/lib/repository/task/TaskRepository.impl.js +1 -1
- package/dist/lib/repository/token/TokenUsageStore.js +1 -1
- package/dist/lib/service/automation/ActionPipeline.d.ts +1 -1
- package/dist/lib/service/automation/ActionPipeline.js +1 -1
- package/dist/lib/service/bootstrap/BootstrapEventEmitter.js +2 -2
- package/dist/lib/service/bootstrap/BootstrapTaskManager.d.ts +1 -1
- package/dist/lib/service/bootstrap/BootstrapTaskManager.js +2 -2
- package/dist/lib/service/bootstrap/DimensionCopyRegistry.d.ts +2 -2
- package/dist/lib/service/bootstrap/DimensionCopyRegistry.js +2 -2
- package/dist/lib/service/delivery/AgentInstructionsGenerator.d.ts +6 -15
- package/dist/lib/service/delivery/AgentInstructionsGenerator.js +53 -189
- package/dist/lib/service/delivery/CursorDeliveryPipeline.d.ts +6 -16
- package/dist/lib/service/delivery/CursorDeliveryPipeline.js +14 -19
- package/dist/lib/service/delivery/KnowledgeCompressor.d.ts +1 -1
- package/dist/lib/service/delivery/KnowledgeCompressor.js +1 -1
- package/dist/lib/service/delivery/RulesGenerator.d.ts +10 -3
- package/dist/lib/service/delivery/RulesGenerator.js +43 -3
- package/dist/lib/service/delivery/SkillsSyncer.d.ts +21 -7
- package/dist/lib/service/delivery/SkillsSyncer.js +46 -10
- package/dist/lib/service/delivery/TopicClassifier.d.ts +3 -6
- package/dist/lib/service/delivery/TopicClassifier.js +0 -3
- package/dist/lib/service/guard/ExclusionManager.d.ts +1 -1
- package/dist/lib/service/guard/ExclusionManager.js +1 -1
- package/dist/lib/service/guard/GuardCheckEngine.d.ts +3 -3
- package/dist/lib/service/guard/GuardCheckEngine.js +5 -5
- package/dist/lib/service/guard/GuardCrossFileChecks.d.ts +1 -1
- package/dist/lib/service/guard/GuardFeedbackLoop.d.ts +3 -3
- package/dist/lib/service/guard/GuardFeedbackLoop.js +3 -3
- package/dist/lib/service/guard/GuardPatternUtils.js +1 -1
- package/dist/lib/service/guard/GuardService.d.ts +1 -15
- package/dist/lib/service/guard/GuardService.js +0 -1
- package/dist/lib/service/guard/RuleLearner.d.ts +1 -1
- package/dist/lib/service/guard/RuleLearner.js +1 -1
- package/dist/lib/service/knowledge/CodeEntityGraph.d.ts +3 -3
- package/dist/lib/service/knowledge/CodeEntityGraph.js +3 -3
- package/dist/lib/service/knowledge/KnowledgeService.d.ts +0 -1
- package/dist/lib/service/knowledge/KnowledgeService.js +0 -1
- package/dist/lib/service/module/ModuleService.d.ts +1 -1
- package/dist/lib/service/module/ModuleService.js +2 -2
- package/dist/lib/service/search/HybridRetriever.d.ts +2 -2
- package/dist/lib/service/search/HybridRetriever.js +2 -2
- package/dist/lib/service/search/SearchEngine.d.ts +1 -3
- package/dist/lib/service/search/SearchEngine.js +1 -3
- package/dist/lib/service/search/contextBoost.d.ts +1 -1
- package/dist/lib/service/skills/EventAggregator.js +2 -2
- package/dist/lib/service/skills/SignalCollector.js +1 -1
- package/dist/lib/service/snippet/codecs/VSCodeCodec.js +1 -1
- package/dist/lib/service/task/TaskGraphService.d.ts +0 -3
- package/dist/lib/service/task/TaskGraphService.js +0 -3
- package/dist/lib/service/task/TaskKnowledgeBridge.d.ts +8 -27
- package/dist/lib/service/task/TaskKnowledgeBridge.js +0 -8
- package/dist/lib/service/task/TaskReadyEngine.d.ts +1 -2
- package/dist/lib/service/task/TaskReadyEngine.js +0 -1
- package/dist/lib/service/wiki/WikiRenderers.js +0 -1
- package/dist/lib/service/wiki/WikiUtils.js +2 -7
- package/dist/lib/shared/PathGuard.js +6 -6
- package/dist/lib/shared/schemas/mcp-tools.js +84 -43
- package/dist/scripts/install-vscode-copilot.js +14 -4
- package/package.json +1 -1
- package/skills/autosnippet-create/SKILL.md +131 -131
- package/skills/autosnippet-devdocs/SKILL.md +1 -2
- package/skills/autosnippet-guard/SKILL.md +20 -89
- package/skills/autosnippet-recipes/SKILL.md +35 -117
- package/skills/autosnippet-structure/SKILL.md +23 -55
- package/templates/cursor-rules/autosnippet-skills.mdc +17 -33
- package/templates/instructions/agent-static.md +24 -0
- package/templates/instructions/conventions.md +42 -0
- package/skills/autosnippet-analysis/SKILL.md +0 -169
- package/skills/autosnippet-candidates/SKILL.md +0 -367
- package/skills/autosnippet-coldstart/SKILL.md +0 -988
- package/skills/autosnippet-concepts/SKILL.md +0 -630
- package/skills/autosnippet-intent/SKILL.md +0 -55
- package/skills/autosnippet-lifecycle/SKILL.md +0 -100
- package/templates/copilot-instructions.md +0 -66
- package/templates/cursor-rules/autosnippet-conventions.mdc +0 -172
- package/templates/cursor-rules/autosnippet-workflow.mdc +0 -76
|
@@ -460,9 +460,9 @@ export class GuardCheckEngine {
|
|
|
460
460
|
this._astRulesCache = null;
|
|
461
461
|
this._cacheTime = 0;
|
|
462
462
|
this._cacheTTL = options.cacheTTL || 60_000; // 1min
|
|
463
|
-
/**
|
|
463
|
+
/** Enhancement Pack 注入的外部规则 */
|
|
464
464
|
this._externalRules = new Map();
|
|
465
|
-
/**
|
|
465
|
+
/** EP 规则是否已注入(幂等标记,避免每次请求重复注入) */
|
|
466
466
|
this._epInjected = false;
|
|
467
467
|
/** Guard 配置 — 允许禁用特定规则或调整 Code-Level 检查阈值 */
|
|
468
468
|
this._guardConfig = options.guardConfig || {};
|
|
@@ -470,7 +470,7 @@ export class GuardCheckEngine {
|
|
|
470
470
|
/**
|
|
471
471
|
* 注入 Enhancement Pack 外部规则(支持 RegExp 和 string pattern)
|
|
472
472
|
* 与 BUILT_IN_RULES 合并检查,自动跳过 ruleId 重复的规则
|
|
473
|
-
* @param
|
|
473
|
+
* @param rules
|
|
474
474
|
*/
|
|
475
475
|
injectExternalRules(rules) {
|
|
476
476
|
if (!Array.isArray(rules)) {
|
|
@@ -855,7 +855,7 @@ export class GuardCheckEngine {
|
|
|
855
855
|
}
|
|
856
856
|
/**
|
|
857
857
|
* 将 Guard 命中计数回写到对应 Recipe 的 guard_hit_count
|
|
858
|
-
* @param
|
|
858
|
+
* @param violations
|
|
859
859
|
*/
|
|
860
860
|
trackGuardHits(violations) {
|
|
861
861
|
if (!violations?.length || !this.db) {
|
|
@@ -915,7 +915,7 @@ export class GuardCheckEngine {
|
|
|
915
915
|
}
|
|
916
916
|
/**
|
|
917
917
|
* 批量文件审计
|
|
918
|
-
* @param
|
|
918
|
+
* @param files
|
|
919
919
|
* @param options {scope: 'file'|'target'|'project'}
|
|
920
920
|
* @returns }
|
|
921
921
|
*/
|
|
@@ -14,7 +14,7 @@ export declare function resolveImportPath(fromDir: string, importPath: string):
|
|
|
14
14
|
export declare function normalizeFilePath(filePath: string): string;
|
|
15
15
|
/**
|
|
16
16
|
* 跨文件检查 — 需要多文件上下文才能发现的问题
|
|
17
|
-
* @param
|
|
17
|
+
* @param files
|
|
18
18
|
* @param [options.disabledRules] 禁用的规则 ID 列表
|
|
19
19
|
* @returns >}
|
|
20
20
|
*/
|
|
@@ -46,20 +46,20 @@ export declare class GuardFeedbackLoop {
|
|
|
46
46
|
});
|
|
47
47
|
/**
|
|
48
48
|
* 对比当前和历史 violations,检测已修复的违规
|
|
49
|
-
* @param
|
|
49
|
+
* @param currentResult 本次检查结果
|
|
50
50
|
* @param filePath 文件路径
|
|
51
51
|
* @returns >} 已修复且有 Recipe 关联的列表
|
|
52
52
|
*/
|
|
53
53
|
detectFixedViolations(currentResult: CheckResult, filePath: string): FixedViolation[];
|
|
54
54
|
/**
|
|
55
55
|
* 对已修复的违规自动确认使用
|
|
56
|
-
* @param
|
|
56
|
+
* @param fixedList
|
|
57
57
|
*/
|
|
58
58
|
autoConfirmUsage(fixedList: FixedViolation[]): void;
|
|
59
59
|
/**
|
|
60
60
|
* 一站式处理:检测修复 + 自动确认
|
|
61
61
|
* 供 MCP handler、GuardHandler、HTTP guard/file 端点集成调用
|
|
62
|
-
* @param
|
|
62
|
+
* @param currentResult
|
|
63
63
|
*/
|
|
64
64
|
processFixDetection(currentResult: CheckResult, filePath: string): FixedViolation[];
|
|
65
65
|
/**
|
|
@@ -21,7 +21,7 @@ export class GuardFeedbackLoop {
|
|
|
21
21
|
}
|
|
22
22
|
/**
|
|
23
23
|
* 对比当前和历史 violations,检测已修复的违规
|
|
24
|
-
* @param
|
|
24
|
+
* @param currentResult 本次检查结果
|
|
25
25
|
* @param filePath 文件路径
|
|
26
26
|
* @returns >} 已修复且有 Recipe 关联的列表
|
|
27
27
|
*/
|
|
@@ -57,7 +57,7 @@ export class GuardFeedbackLoop {
|
|
|
57
57
|
}
|
|
58
58
|
/**
|
|
59
59
|
* 对已修复的违规自动确认使用
|
|
60
|
-
* @param
|
|
60
|
+
* @param fixedList
|
|
61
61
|
*/
|
|
62
62
|
autoConfirmUsage(fixedList) {
|
|
63
63
|
if (!this.feedbackCollector || !fixedList?.length) {
|
|
@@ -81,7 +81,7 @@ export class GuardFeedbackLoop {
|
|
|
81
81
|
/**
|
|
82
82
|
* 一站式处理:检测修复 + 自动确认
|
|
83
83
|
* 供 MCP handler、GuardHandler、HTTP guard/file 端点集成调用
|
|
84
|
-
* @param
|
|
84
|
+
* @param currentResult
|
|
85
85
|
*/
|
|
86
86
|
processFixDetection(currentResult, filePath) {
|
|
87
87
|
const fixed = this.detectFixedViolations(currentResult, filePath);
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* - detectLanguage: 文件扩展名推断语言
|
|
10
10
|
*/
|
|
11
11
|
import { LanguageService } from '../../shared/LanguageService.js';
|
|
12
|
-
/**
|
|
12
|
+
/** 已编译的正则缓存 (pattern string → RegExp) */
|
|
13
13
|
const _regexCache = new Map();
|
|
14
14
|
/** 编译正则模式(支持 RegExp 对象和 string,带缓存) */
|
|
15
15
|
export function compilePattern(pattern) {
|
|
@@ -158,22 +158,8 @@ export declare class GuardService {
|
|
|
158
158
|
}[]>;
|
|
159
159
|
/**
|
|
160
160
|
* 仅 DB 规则的简化检查(降级路径)
|
|
161
|
-
* @private
|
|
162
161
|
*/
|
|
163
|
-
_checkCodeDbOnly
|
|
164
|
-
language?: string | null;
|
|
165
|
-
}): Promise<{
|
|
166
|
-
ruleId: string;
|
|
167
|
-
ruleName: string;
|
|
168
|
-
severity: string;
|
|
169
|
-
message: string;
|
|
170
|
-
matches: {
|
|
171
|
-
match: string;
|
|
172
|
-
index: number | undefined;
|
|
173
|
-
line: number;
|
|
174
|
-
}[];
|
|
175
|
-
matchCount: number;
|
|
176
|
-
}[]>;
|
|
162
|
+
private _checkCodeDbOnly;
|
|
177
163
|
/** 查询规则列表 (kind='rule' + knowledgeType='boundary-constraint') */
|
|
178
164
|
listRules(filters?: Record<string, unknown>, pagination?: {
|
|
179
165
|
page?: number;
|
|
@@ -186,7 +186,7 @@ export declare class CodeEntityGraph {
|
|
|
186
186
|
/**
|
|
187
187
|
* 从候选的 Relations 字段提取边写入图谱 (Phase 5/6)
|
|
188
188
|
*
|
|
189
|
-
* @param
|
|
189
|
+
* @param candidates 扁平关系数组或 Relations 对象
|
|
190
190
|
*/
|
|
191
191
|
populateFromCandidateRelations(candidates: CandidateWithRelations[] | null): GraphPopulateResult;
|
|
192
192
|
/** 获取单个实体信息 */
|
|
@@ -273,8 +273,8 @@ export declare class CodeEntityGraph {
|
|
|
273
273
|
/**
|
|
274
274
|
* 从解析后的调用边填充图谱 (Phase 5)
|
|
275
275
|
*
|
|
276
|
-
* @param
|
|
277
|
-
* @param
|
|
276
|
+
* @param callEdges
|
|
277
|
+
* @param dataFlowEdges
|
|
278
278
|
*/
|
|
279
279
|
populateCallGraph(callEdges: CallEdge[], dataFlowEdges: DataFlowEdge[]): GraphPopulateResult;
|
|
280
280
|
/**
|
|
@@ -182,7 +182,7 @@ export class CodeEntityGraph {
|
|
|
182
182
|
/**
|
|
183
183
|
* 从候选的 Relations 字段提取边写入图谱 (Phase 5/6)
|
|
184
184
|
*
|
|
185
|
-
* @param
|
|
185
|
+
* @param candidates 扁平关系数组或 Relations 对象
|
|
186
186
|
*/
|
|
187
187
|
populateFromCandidateRelations(candidates) {
|
|
188
188
|
if (!candidates?.length) {
|
|
@@ -588,8 +588,8 @@ export class CodeEntityGraph {
|
|
|
588
588
|
/**
|
|
589
589
|
* 从解析后的调用边填充图谱 (Phase 5)
|
|
590
590
|
*
|
|
591
|
-
* @param
|
|
592
|
-
* @param
|
|
591
|
+
* @param callEdges
|
|
592
|
+
* @param dataFlowEdges
|
|
593
593
|
*/
|
|
594
594
|
populateCallGraph(callEdges, dataFlowEdges) {
|
|
595
595
|
const t0 = Date.now();
|
|
@@ -101,7 +101,6 @@ export declare class KnowledgeService {
|
|
|
101
101
|
publish(id: string, context: ServiceContext): Promise<KnowledgeEntry>;
|
|
102
102
|
/**
|
|
103
103
|
* 触发 Cursor Delivery Pipeline(非阻塞、容错)
|
|
104
|
-
* @private
|
|
105
104
|
*/
|
|
106
105
|
_triggerCursorDeliveryAsync(): void;
|
|
107
106
|
/** 弃用 (pending|active → deprecated) */
|
|
@@ -65,7 +65,7 @@ const SOURCE_CODE_EXTS = new Set([
|
|
|
65
65
|
export class ModuleService {
|
|
66
66
|
#projectRoot;
|
|
67
67
|
#registry;
|
|
68
|
-
/**
|
|
68
|
+
/** >} */
|
|
69
69
|
#activeDiscoverers = [];
|
|
70
70
|
#loaded = false;
|
|
71
71
|
#logger;
|
|
@@ -233,7 +233,7 @@ export class ModuleService {
|
|
|
233
233
|
}
|
|
234
234
|
/**
|
|
235
235
|
* 获取依赖关系图
|
|
236
|
-
* @param
|
|
236
|
+
* @param [options]
|
|
237
237
|
* @returns [] }>}
|
|
238
238
|
*/
|
|
239
239
|
async getDependencyGraph(options = {}) {
|
|
@@ -42,8 +42,8 @@ export declare class HybridRetriever {
|
|
|
42
42
|
* Dense: vectorStore 向量搜索 (HNSW or brute-force)
|
|
43
43
|
* Sparse: BM25 关键词搜索 (由外部传入结果)
|
|
44
44
|
*
|
|
45
|
-
* @param
|
|
46
|
-
* @param
|
|
45
|
+
* @param params.denseResults - 向量搜索结果
|
|
46
|
+
* @param params.sparseResults - 关键词搜索结果
|
|
47
47
|
* @param [params.alpha=0.5] Dense 权重
|
|
48
48
|
* @returns >}
|
|
49
49
|
*/
|
|
@@ -31,8 +31,8 @@ export class HybridRetriever {
|
|
|
31
31
|
* Dense: vectorStore 向量搜索 (HNSW or brute-force)
|
|
32
32
|
* Sparse: BM25 关键词搜索 (由外部传入结果)
|
|
33
33
|
*
|
|
34
|
-
* @param
|
|
35
|
-
* @param
|
|
34
|
+
* @param params.denseResults - 向量搜索结果
|
|
35
|
+
* @param params.sparseResults - 关键词搜索结果
|
|
36
36
|
* @param [params.alpha=0.5] Dense 权重
|
|
37
37
|
* @returns >}
|
|
38
38
|
*/
|
|
@@ -130,7 +130,7 @@ export declare class SearchEngine {
|
|
|
130
130
|
* - 已删除 → scorer.removeDocument()
|
|
131
131
|
* 3. 清空缓存以确保搜索结果刷新
|
|
132
132
|
*
|
|
133
|
-
* @param
|
|
133
|
+
* @param [opts] - force=true 强制全量重建
|
|
134
134
|
*/
|
|
135
135
|
refreshIndex(opts?: {
|
|
136
136
|
force?: boolean;
|
|
@@ -141,12 +141,10 @@ export declare class SearchEngine {
|
|
|
141
141
|
* 使用 BM25F 思想:高价值字段(title, trigger)重复出现以提升 TF 权重
|
|
142
142
|
* — title ×3, trigger ×2, description ×1.5(通过重复 token 实现)
|
|
143
143
|
* 这确保标题匹配的文档获得显著更高的 BM25 分数
|
|
144
|
-
* @private
|
|
145
144
|
*/
|
|
146
145
|
_buildDocText(r: DbRow): string;
|
|
147
146
|
/**
|
|
148
147
|
* 从 DB 行构建文档 meta
|
|
149
|
-
* @private
|
|
150
148
|
*/
|
|
151
149
|
_buildDocMeta(r: DbRow): {
|
|
152
150
|
type: string;
|
|
@@ -636,7 +636,7 @@ export class SearchEngine {
|
|
|
636
636
|
* - 已删除 → scorer.removeDocument()
|
|
637
637
|
* 3. 清空缓存以确保搜索结果刷新
|
|
638
638
|
*
|
|
639
|
-
* @param
|
|
639
|
+
* @param [opts] - force=true 强制全量重建
|
|
640
640
|
*/
|
|
641
641
|
refreshIndex(opts = {}) {
|
|
642
642
|
if (opts.force || !this._indexed || !this._lastIndexTime) {
|
|
@@ -689,7 +689,6 @@ export class SearchEngine {
|
|
|
689
689
|
* 使用 BM25F 思想:高价值字段(title, trigger)重复出现以提升 TF 权重
|
|
690
690
|
* — title ×3, trigger ×2, description ×1.5(通过重复 token 实现)
|
|
691
691
|
* 这确保标题匹配的文档获得显著更高的 BM25 分数
|
|
692
|
-
* @private
|
|
693
692
|
*/
|
|
694
693
|
_buildDocText(r) {
|
|
695
694
|
let contentText = '';
|
|
@@ -731,7 +730,6 @@ export class SearchEngine {
|
|
|
731
730
|
}
|
|
732
731
|
/**
|
|
733
732
|
* 从 DB 行构建文档 meta
|
|
734
|
-
* @private
|
|
735
733
|
*/
|
|
736
734
|
_buildDocMeta(r) {
|
|
737
735
|
let parsedTags = [];
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
*/
|
|
12
12
|
/**
|
|
13
13
|
* @param items 已排序的候选列表(需有 rankerScore / coarseScore / score)
|
|
14
|
-
* @param
|
|
14
|
+
* @param [context.sessionHistory]
|
|
15
15
|
* @returns 含 contextScore / contextBoost 字段的排序列表
|
|
16
16
|
*/
|
|
17
17
|
export interface SearchItem {
|
|
@@ -22,9 +22,9 @@ const DEFAULT_WINDOW_MS = 5000; // 5 秒聚合窗口
|
|
|
22
22
|
const DEFAULT_MAX_BATCH = 50; // 单次 batch 最大事件数
|
|
23
23
|
const DEFAULT_DEDUPE_MS = 60_000; // 60 秒去重窗口
|
|
24
24
|
export class EventAggregator {
|
|
25
|
-
/**
|
|
25
|
+
/** >} */
|
|
26
26
|
#buckets = new Map();
|
|
27
|
-
/**
|
|
27
|
+
/** 已处理事件的 hash → 最后处理时间 */
|
|
28
28
|
#dedupeMap = new Map();
|
|
29
29
|
#listeners = new Map();
|
|
30
30
|
#windowMs;
|
|
@@ -61,7 +61,7 @@ export class VSCodeCodec extends SnippetCodec {
|
|
|
61
61
|
getBundleFilename() {
|
|
62
62
|
return BUNDLE_FILENAME;
|
|
63
63
|
}
|
|
64
|
-
/**
|
|
64
|
+
/** SnippetSpec → VSCode snippet entry */
|
|
65
65
|
#specToEntry(spec) {
|
|
66
66
|
const code = Array.isArray(spec.code) ? spec.code.join('\n') : spec.code || '';
|
|
67
67
|
// 自动将 Xcode 占位符转为 VSCode 格式
|
|
@@ -211,15 +211,12 @@ export declare class TaskGraphService {
|
|
|
211
211
|
* P2: 获取决策过期阈值(秒)
|
|
212
212
|
* 默认 30 天 = 2592000 秒。可通过容器内 'config' 服务配置。
|
|
213
213
|
* 返回 0 表示禁用过期检测。
|
|
214
|
-
* @private
|
|
215
214
|
*/
|
|
216
215
|
_getDecisionStaleThreshold(): number;
|
|
217
216
|
/**
|
|
218
217
|
* 查找因 closedTaskId 完成而新解除阻塞的任务
|
|
219
|
-
* @private
|
|
220
218
|
*/
|
|
221
219
|
_checkNewlyUnblocked(closedTaskId: string): string[];
|
|
222
|
-
/** @private */
|
|
223
220
|
_logEvent(taskId: string, eventType: string, oldValue: string | null, newValue: string | null): void;
|
|
224
221
|
}
|
|
225
222
|
export default TaskGraphService;
|
|
@@ -542,7 +542,6 @@ export class TaskGraphService {
|
|
|
542
542
|
* P2: 获取决策过期阈值(秒)
|
|
543
543
|
* 默认 30 天 = 2592000 秒。可通过容器内 'config' 服务配置。
|
|
544
544
|
* 返回 0 表示禁用过期检测。
|
|
545
|
-
* @private
|
|
546
545
|
*/
|
|
547
546
|
_getDecisionStaleThreshold() {
|
|
548
547
|
try {
|
|
@@ -565,7 +564,6 @@ export class TaskGraphService {
|
|
|
565
564
|
}
|
|
566
565
|
/**
|
|
567
566
|
* 查找因 closedTaskId 完成而新解除阻塞的任务
|
|
568
|
-
* @private
|
|
569
567
|
*/
|
|
570
568
|
_checkNewlyUnblocked(closedTaskId) {
|
|
571
569
|
const dependents = this.repo.getDependents(closedTaskId);
|
|
@@ -587,7 +585,6 @@ export class TaskGraphService {
|
|
|
587
585
|
}
|
|
588
586
|
return newlyReady;
|
|
589
587
|
}
|
|
590
|
-
/** @private */
|
|
591
588
|
_logEvent(taskId, eventType, oldValue, newValue) {
|
|
592
589
|
try {
|
|
593
590
|
this.repo.logEvent(taskId, eventType, oldValue, newValue);
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { type SlimSearchResult } from '#service/search/SearchTypes.js';
|
|
2
1
|
import type { Task } from '../../domain/task/Task.js';
|
|
3
2
|
import Logger from '../../infrastructure/logging/Logger.js';
|
|
4
3
|
/** 知识注入的上下文选项(从 prime / ready / claim 透传) */
|
|
@@ -10,8 +9,6 @@ export interface KnowledgeEnrichOptions {
|
|
|
10
9
|
/** 当前编程语言 */
|
|
11
10
|
language?: string;
|
|
12
11
|
}
|
|
13
|
-
/** 投影后的知识条目(返回给 Agent)— 使用统一投影类型 */
|
|
14
|
-
type SlimKnowledgeItem = SlimSearchResult;
|
|
15
12
|
/**
|
|
16
13
|
* TaskKnowledgeBridge — 任务 ↔ 知识桥接服务
|
|
17
14
|
*
|
|
@@ -54,13 +51,8 @@ export declare class TaskKnowledgeBridge {
|
|
|
54
51
|
}): Promise<Record<string, unknown> | null>;
|
|
55
52
|
/**
|
|
56
53
|
* 为单个任务构建知识上下文(v2 — multi-query + 上下文 + 缓存)
|
|
57
|
-
* @private
|
|
58
54
|
*/
|
|
59
|
-
_buildContext
|
|
60
|
-
relatedKnowledge: SlimSearchResult[];
|
|
61
|
-
guardRules: SlimSearchResult[];
|
|
62
|
-
searchQuery: string;
|
|
63
|
-
} | null>;
|
|
55
|
+
private _buildContext;
|
|
64
56
|
/**
|
|
65
57
|
* P2: 构建多条互补搜索查询
|
|
66
58
|
*
|
|
@@ -69,45 +61,34 @@ export declare class TaskKnowledgeBridge {
|
|
|
69
61
|
* Q2 (语义): 用户输入 — 包含更丰富的自然语义
|
|
70
62
|
* Q3 (关键词): 从描述/用户输入提取技术术语
|
|
71
63
|
*
|
|
72
|
-
* @private
|
|
73
64
|
*/
|
|
74
|
-
_buildSearchQueries
|
|
65
|
+
private _buildSearchQueries;
|
|
75
66
|
/**
|
|
76
67
|
* P2: 从文本中提取技术术语(类名、文件名、API 名等)
|
|
77
|
-
* @private
|
|
78
68
|
*/
|
|
79
|
-
_extractTechTerms
|
|
69
|
+
private _extractTechTerms;
|
|
80
70
|
/**
|
|
81
71
|
* P2 + P3: Multi-Query 搜索 + 合并去重
|
|
82
72
|
*
|
|
83
73
|
* 对每个 query 执行搜索(并行),合并结果并按 score 去重保留最高分。
|
|
84
|
-
* @private
|
|
85
74
|
*/
|
|
86
|
-
_multiQuerySearch
|
|
87
|
-
language?: string;
|
|
88
|
-
}): Promise<Array<Record<string, unknown>>>;
|
|
75
|
+
private _multiQuerySearch;
|
|
89
76
|
/**
|
|
90
77
|
* 执行单次搜索(含 P3 上下文透传)
|
|
91
|
-
* @private
|
|
92
78
|
*/
|
|
93
|
-
_singleSearch
|
|
94
|
-
language?: string;
|
|
95
|
-
}): Promise<Array<Record<string, unknown>>>;
|
|
79
|
+
private _singleSearch;
|
|
96
80
|
/**
|
|
97
81
|
* P4: 相关性阈值判断
|
|
98
|
-
* @private
|
|
99
82
|
*/
|
|
100
|
-
_aboveThreshold
|
|
83
|
+
private _aboveThreshold;
|
|
101
84
|
/**
|
|
102
85
|
* P4: 增强投影 — 使用统一 slimSearchResult() 投影函数
|
|
103
|
-
* @private
|
|
104
86
|
*/
|
|
105
|
-
_projectItem
|
|
87
|
+
private _projectItem;
|
|
106
88
|
/**
|
|
107
89
|
* P6: 缓存键 — 基于 taskQuery + userQuery 的内容指纹
|
|
108
|
-
* @private
|
|
109
90
|
*/
|
|
110
|
-
_contentKey
|
|
91
|
+
private _contentKey;
|
|
111
92
|
/** 清除全部缓存(测试 / 索引重建后使用) */
|
|
112
93
|
clearCache(): void;
|
|
113
94
|
}
|
|
@@ -112,7 +112,6 @@ export class TaskKnowledgeBridge {
|
|
|
112
112
|
// ═══ 私有方法 ═══════════════════════════════════════
|
|
113
113
|
/**
|
|
114
114
|
* 为单个任务构建知识上下文(v2 — multi-query + 上下文 + 缓存)
|
|
115
|
-
* @private
|
|
116
115
|
*/
|
|
117
116
|
async _buildContext(task, options) {
|
|
118
117
|
const taskQuery = `${task.title} ${task.description}`.trim();
|
|
@@ -174,7 +173,6 @@ export class TaskKnowledgeBridge {
|
|
|
174
173
|
* Q2 (语义): 用户输入 — 包含更丰富的自然语义
|
|
175
174
|
* Q3 (关键词): 从描述/用户输入提取技术术语
|
|
176
175
|
*
|
|
177
|
-
* @private
|
|
178
176
|
*/
|
|
179
177
|
_buildSearchQueries(task, userQuery) {
|
|
180
178
|
const queries = [];
|
|
@@ -209,7 +207,6 @@ export class TaskKnowledgeBridge {
|
|
|
209
207
|
}
|
|
210
208
|
/**
|
|
211
209
|
* P2: 从文本中提取技术术语(类名、文件名、API 名等)
|
|
212
|
-
* @private
|
|
213
210
|
*/
|
|
214
211
|
_extractTechTerms(text) {
|
|
215
212
|
if (!text) {
|
|
@@ -234,7 +231,6 @@ export class TaskKnowledgeBridge {
|
|
|
234
231
|
* P2 + P3: Multi-Query 搜索 + 合并去重
|
|
235
232
|
*
|
|
236
233
|
* 对每个 query 执行搜索(并行),合并结果并按 score 去重保留最高分。
|
|
237
|
-
* @private
|
|
238
234
|
*/
|
|
239
235
|
async _multiQuerySearch(queries, options) {
|
|
240
236
|
if (queries.length === 0) {
|
|
@@ -262,7 +258,6 @@ export class TaskKnowledgeBridge {
|
|
|
262
258
|
}
|
|
263
259
|
/**
|
|
264
260
|
* 执行单次搜索(含 P3 上下文透传)
|
|
265
|
-
* @private
|
|
266
261
|
*/
|
|
267
262
|
async _singleSearch(query, options) {
|
|
268
263
|
const searchResult = await this._search.search(query, {
|
|
@@ -278,7 +273,6 @@ export class TaskKnowledgeBridge {
|
|
|
278
273
|
}
|
|
279
274
|
/**
|
|
280
275
|
* P4: 相关性阈值判断
|
|
281
|
-
* @private
|
|
282
276
|
*/
|
|
283
277
|
_aboveThreshold(item) {
|
|
284
278
|
const score = item.score || 0;
|
|
@@ -286,14 +280,12 @@ export class TaskKnowledgeBridge {
|
|
|
286
280
|
}
|
|
287
281
|
/**
|
|
288
282
|
* P4: 增强投影 — 使用统一 slimSearchResult() 投影函数
|
|
289
|
-
* @private
|
|
290
283
|
*/
|
|
291
284
|
_projectItem(item) {
|
|
292
285
|
return slimSearchResult(item);
|
|
293
286
|
}
|
|
294
287
|
/**
|
|
295
288
|
* P6: 缓存键 — 基于 taskQuery + userQuery 的内容指纹
|
|
296
|
-
* @private
|
|
297
289
|
*/
|
|
298
290
|
_contentKey(taskQuery, userQuery) {
|
|
299
291
|
return `${taskQuery}||${userQuery || ''}`;
|
|
@@ -15,8 +15,7 @@ export declare class TaskReadyEngine {
|
|
|
15
15
|
_readyStmt: ReturnType<import('better-sqlite3').Database['prepare']>;
|
|
16
16
|
/** @param db raw SQLite handle */
|
|
17
17
|
constructor(db: import('better-sqlite3').Database);
|
|
18
|
-
|
|
19
|
-
_prepareStatements(): void;
|
|
18
|
+
private _prepareStatements;
|
|
20
19
|
/**
|
|
21
20
|
* 获取就绪任务(核心方法)
|
|
22
21
|
*
|
|
@@ -1100,7 +1100,6 @@ export function renderGettingStarted(project, modules, ast, isZh) {
|
|
|
1100
1100
|
const BUILD_SYSTEM_FILES = Object.fromEntries(LanguageService.buildSystemMarkers.map((m) => [m.buildTool, m.file]));
|
|
1101
1101
|
/**
|
|
1102
1102
|
* 按生态系统输出构建步骤
|
|
1103
|
-
* @private
|
|
1104
1103
|
*/
|
|
1105
1104
|
function _pushBuildSteps(lines, buildSys, projectName, isZh) {
|
|
1106
1105
|
const { eco, buildTool } = buildSys;
|
|
@@ -548,7 +548,7 @@ export function profileFolders(projectInfo, options = {}) {
|
|
|
548
548
|
const root = projectInfo.root;
|
|
549
549
|
const sourceFiles = projectInfo.sourceFiles || [];
|
|
550
550
|
// ── 1. 按文件夹分组源文件 ──
|
|
551
|
-
/**
|
|
551
|
+
/** relDir → [relFilePath, ...] */
|
|
552
552
|
const folderFiles = new Map();
|
|
553
553
|
for (const relFile of sourceFiles) {
|
|
554
554
|
const dir = path.dirname(relFile);
|
|
@@ -558,7 +558,7 @@ export function profileFolders(projectInfo, options = {}) {
|
|
|
558
558
|
folderFiles.get(dir).push(relFile);
|
|
559
559
|
}
|
|
560
560
|
// ── 2. 聚合: 将子文件夹的文件计入父文件夹 (递归) ──
|
|
561
|
-
/**
|
|
561
|
+
/** relDir → 所有递归子文件 */
|
|
562
562
|
const folderRecursive = new Map();
|
|
563
563
|
for (const [dir, files] of folderFiles) {
|
|
564
564
|
// 把文件计入 dir 本身及所有祖先
|
|
@@ -612,7 +612,6 @@ export function profileFolders(projectInfo, options = {}) {
|
|
|
612
612
|
}
|
|
613
613
|
/**
|
|
614
614
|
* 修剪冗余文件夹: 如果子目录文件数与父目录接近 (>80%), 仅保留父目录
|
|
615
|
-
* @private
|
|
616
615
|
*/
|
|
617
616
|
function _pruneRedundantFolders(candidates, maxFolders) {
|
|
618
617
|
const kept = [];
|
|
@@ -649,7 +648,6 @@ function _pruneRedundantFolders(candidates, maxFolders) {
|
|
|
649
648
|
}
|
|
650
649
|
/**
|
|
651
650
|
* 为单个文件夹构建 FolderProfile
|
|
652
|
-
* @private
|
|
653
651
|
*/
|
|
654
652
|
function _buildFolderProfile(relDir, files, depth, projectRoot, sampleLines) {
|
|
655
653
|
const fullDir = path.join(projectRoot, relDir);
|
|
@@ -735,7 +733,6 @@ function _buildFolderProfile(relDir, files, depth, projectRoot, sampleLines) {
|
|
|
735
733
|
}
|
|
736
734
|
/**
|
|
737
735
|
* 从文件名列表检测命名约定
|
|
738
|
-
* @private
|
|
739
736
|
* @param fileNames basename 列表
|
|
740
737
|
*/
|
|
741
738
|
function _detectNamingPatterns(fileNames) {
|
|
@@ -781,7 +778,6 @@ function _detectNamingPatterns(fileNames) {
|
|
|
781
778
|
}
|
|
782
779
|
/**
|
|
783
780
|
* 从文件顶部提取 import/require 语句,推断文件夹级依赖
|
|
784
|
-
* @private
|
|
785
781
|
*/
|
|
786
782
|
function _extractImports(keyFiles, projectRoot, sampleLines, currentDir) {
|
|
787
783
|
const importTargets = new Set();
|
|
@@ -883,7 +879,6 @@ function _extractImports(keyFiles, projectRoot, sampleLines, currentDir) {
|
|
|
883
879
|
}
|
|
884
880
|
/**
|
|
885
881
|
* 提取文件头部注释 (第一个注释块)
|
|
886
|
-
* @private
|
|
887
882
|
*/
|
|
888
883
|
function _extractHeaderComment(fullPath) {
|
|
889
884
|
try {
|