autosnippet 3.2.18 → 3.2.21

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.
Files changed (189) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +73 -104
  3. package/config/default.json +1 -1
  4. package/dashboard/dist/assets/{index-CKMy5LY6.js → index-DdvZE4Yd.js} +1 -1
  5. package/dashboard/dist/index.html +1 -1
  6. package/dist/bin/cli.js +45 -10
  7. package/dist/lib/agent/AgentEventBus.js +3 -3
  8. package/dist/lib/agent/AgentFactory.d.ts +3 -3
  9. package/dist/lib/agent/AgentFactory.js +4 -4
  10. package/dist/lib/agent/AgentMessage.d.ts +8 -8
  11. package/dist/lib/agent/AgentMessage.js +8 -8
  12. package/dist/lib/agent/AgentRuntime.js +2 -2
  13. package/dist/lib/agent/AgentState.js +4 -4
  14. package/dist/lib/agent/ConversationStore.d.ts +1 -1
  15. package/dist/lib/agent/ConversationStore.js +1 -1
  16. package/dist/lib/agent/PipelineStrategy.js +1 -1
  17. package/dist/lib/agent/context/ContextWindow.d.ts +2 -2
  18. package/dist/lib/agent/context/ContextWindow.js +7 -7
  19. package/dist/lib/agent/context/ExplorationTracker.js +9 -9
  20. package/dist/lib/agent/context/exploration/PlanTracker.js +2 -2
  21. package/dist/lib/agent/context/exploration/SignalDetector.d.ts +1 -1
  22. package/dist/lib/agent/context/exploration/SignalDetector.js +1 -1
  23. package/dist/lib/agent/core/LoopContext.d.ts +21 -21
  24. package/dist/lib/agent/core/LoopContext.js +21 -21
  25. package/dist/lib/agent/core/SystemPromptBuilder.js +4 -4
  26. package/dist/lib/agent/domain/EvidenceCollector.js +5 -5
  27. package/dist/lib/agent/memory/ActiveContext.js +1 -1
  28. package/dist/lib/agent/memory/MemoryRetriever.js +1 -1
  29. package/dist/lib/agent/memory/MemoryStore.js +2 -2
  30. package/dist/lib/agent/memory/SessionStore.js +3 -3
  31. package/dist/lib/agent/policies.d.ts +1 -1
  32. package/dist/lib/agent/policies.js +1 -1
  33. package/dist/lib/agent/strategies.d.ts +1 -1
  34. package/dist/lib/agent/strategies.js +4 -4
  35. package/dist/lib/agent/tools/_shared.d.ts +1 -1
  36. package/dist/lib/agent/tools/_shared.js +1 -1
  37. package/dist/lib/agent/tools/infrastructure.js +2 -2
  38. package/dist/lib/cli/SetupService.d.ts +25 -25
  39. package/dist/lib/cli/SetupService.js +28 -15
  40. package/dist/lib/cli/deploy/FileDeployer.d.ts +9 -2
  41. package/dist/lib/cli/deploy/FileDeployer.js +139 -46
  42. package/dist/lib/cli/deploy/FileManifest.d.ts +23 -39
  43. package/dist/lib/cli/deploy/FileManifest.js +22 -33
  44. package/dist/lib/core/AstAnalyzer.d.ts +2 -2
  45. package/dist/lib/core/AstAnalyzer.js +2 -2
  46. package/dist/lib/core/analysis/CallEdgeResolver.d.ts +7 -7
  47. package/dist/lib/core/analysis/CallEdgeResolver.js +9 -9
  48. package/dist/lib/core/analysis/CallGraphAnalyzer.d.ts +4 -4
  49. package/dist/lib/core/analysis/CallGraphAnalyzer.js +2 -2
  50. package/dist/lib/core/analysis/ImportPathResolver.d.ts +0 -2
  51. package/dist/lib/core/analysis/ImportPathResolver.js +2 -4
  52. package/dist/lib/core/ast/ProjectGraph.js +7 -7
  53. package/dist/lib/core/capability/CapabilityProbe.js +6 -14
  54. package/dist/lib/domain/knowledge/UnifiedValidator.js +2 -2
  55. package/dist/lib/domain/knowledge/values/Constraints.js +4 -4
  56. package/dist/lib/domain/knowledge/values/Content.js +6 -6
  57. package/dist/lib/domain/knowledge/values/Quality.js +5 -5
  58. package/dist/lib/domain/knowledge/values/Reasoning.js +5 -5
  59. package/dist/lib/domain/knowledge/values/Relations.js +1 -1
  60. package/dist/lib/domain/knowledge/values/Stats.js +6 -6
  61. package/dist/lib/domain/task/TaskIdGenerator.d.ts +4 -4
  62. package/dist/lib/domain/task/TaskIdGenerator.js +2 -2
  63. package/dist/lib/external/lark/LarkTransport.js +4 -4
  64. package/dist/lib/external/mcp/McpServer.d.ts +3 -7
  65. package/dist/lib/external/mcp/McpServer.js +9 -13
  66. package/dist/lib/external/mcp/handlers/bootstrap/ExternalSubmissionTracker.js +5 -5
  67. package/dist/lib/external/mcp/handlers/bootstrap/MissionBriefingBuilder.js +4 -3
  68. package/dist/lib/external/mcp/handlers/bootstrap/pipeline/BootstrapSnapshot.d.ts +3 -3
  69. package/dist/lib/external/mcp/handlers/bootstrap/pipeline/BootstrapSnapshot.js +3 -3
  70. package/dist/lib/external/mcp/handlers/bootstrap/pipeline/IncrementalBootstrap.d.ts +1 -1
  71. package/dist/lib/external/mcp/handlers/bootstrap/pipeline/IncrementalBootstrap.js +1 -1
  72. package/dist/lib/external/mcp/handlers/bootstrap/pipeline/dimension-context.js +3 -3
  73. package/dist/lib/external/mcp/handlers/bootstrap/shared/dimension-sop.js +27 -14
  74. package/dist/lib/external/mcp/handlers/bootstrap-external.js +6 -0
  75. package/dist/lib/external/mcp/handlers/dimension-complete-external.js +55 -1
  76. package/dist/lib/external/mcp/handlers/skill.js +9 -31
  77. package/dist/lib/external/mcp/handlers/system.js +6 -4
  78. package/dist/lib/external/mcp/handlers/task.js +16 -1
  79. package/dist/lib/external/mcp/tools.d.ts +12 -10
  80. package/dist/lib/external/mcp/tools.js +97 -69
  81. package/dist/lib/http/utils/routeHelpers.d.ts +1 -1
  82. package/dist/lib/http/utils/routeHelpers.js +1 -1
  83. package/dist/lib/http/utils/sse-sessions.d.ts +1 -1
  84. package/dist/lib/http/utils/sse-sessions.js +1 -1
  85. package/dist/lib/infrastructure/cache/CacheService.js +1 -1
  86. package/dist/lib/infrastructure/logging/Logger.js +1 -1
  87. package/dist/lib/infrastructure/monitoring/ErrorTracker.js +1 -1
  88. package/dist/lib/infrastructure/vector/AsyncPersistence.js +8 -8
  89. package/dist/lib/infrastructure/vector/BatchEmbedder.d.ts +1 -1
  90. package/dist/lib/infrastructure/vector/BatchEmbedder.js +2 -2
  91. package/dist/lib/infrastructure/vector/HnswIndex.d.ts +4 -4
  92. package/dist/lib/infrastructure/vector/HnswIndex.js +5 -5
  93. package/dist/lib/infrastructure/vector/HnswVectorAdapter.js +8 -8
  94. package/dist/lib/infrastructure/vector/ScalarQuantizer.d.ts +1 -1
  95. package/dist/lib/infrastructure/vector/ScalarQuantizer.js +4 -4
  96. package/dist/lib/infrastructure/vector/VectorStore.d.ts +1 -1
  97. package/dist/lib/infrastructure/vector/VectorStore.js +1 -1
  98. package/dist/lib/injection/ServiceContainer.d.ts +1 -1
  99. package/dist/lib/injection/ServiceContainer.js +1 -1
  100. package/dist/lib/injection/modules/KnowledgeModule.js +4 -5
  101. package/dist/lib/platform/NativeUi.d.ts +1 -1
  102. package/dist/lib/platform/NativeUi.js +1 -1
  103. package/dist/lib/platform/ios/spm/DependencyGraph.d.ts +1 -1
  104. package/dist/lib/platform/ios/spm/DependencyGraph.js +1 -1
  105. package/dist/lib/platform/ios/spm/PolicyEngine.d.ts +1 -1
  106. package/dist/lib/platform/ios/spm/PolicyEngine.js +1 -1
  107. package/dist/lib/platform/ios/spm/SpmDiscoverer.js +1 -1
  108. package/dist/lib/platform/ios/spm/SpmHelper.js +3 -3
  109. package/dist/lib/platform/ios/xcode/SaveEventFilter.js +2 -2
  110. package/dist/lib/platform/ios/xcode/XcodeIntegration.js +1 -1
  111. package/dist/lib/repository/base/BaseRepository.js +1 -1
  112. package/dist/lib/repository/task/TaskRepository.impl.d.ts +2 -2
  113. package/dist/lib/repository/task/TaskRepository.impl.js +1 -1
  114. package/dist/lib/repository/token/TokenUsageStore.js +1 -1
  115. package/dist/lib/service/automation/ActionPipeline.d.ts +1 -1
  116. package/dist/lib/service/automation/ActionPipeline.js +1 -1
  117. package/dist/lib/service/bootstrap/BootstrapEventEmitter.js +2 -2
  118. package/dist/lib/service/bootstrap/BootstrapTaskManager.d.ts +1 -1
  119. package/dist/lib/service/bootstrap/BootstrapTaskManager.js +2 -2
  120. package/dist/lib/service/bootstrap/DimensionCopyRegistry.d.ts +2 -2
  121. package/dist/lib/service/bootstrap/DimensionCopyRegistry.js +2 -2
  122. package/dist/lib/service/delivery/AgentInstructionsGenerator.d.ts +6 -15
  123. package/dist/lib/service/delivery/AgentInstructionsGenerator.js +53 -189
  124. package/dist/lib/service/delivery/CursorDeliveryPipeline.d.ts +6 -16
  125. package/dist/lib/service/delivery/CursorDeliveryPipeline.js +14 -19
  126. package/dist/lib/service/delivery/KnowledgeCompressor.d.ts +1 -1
  127. package/dist/lib/service/delivery/KnowledgeCompressor.js +1 -1
  128. package/dist/lib/service/delivery/RulesGenerator.d.ts +10 -3
  129. package/dist/lib/service/delivery/RulesGenerator.js +43 -3
  130. package/dist/lib/service/delivery/SkillsSyncer.d.ts +21 -7
  131. package/dist/lib/service/delivery/SkillsSyncer.js +46 -10
  132. package/dist/lib/service/delivery/TopicClassifier.d.ts +3 -6
  133. package/dist/lib/service/delivery/TopicClassifier.js +0 -3
  134. package/dist/lib/service/guard/ExclusionManager.d.ts +1 -1
  135. package/dist/lib/service/guard/ExclusionManager.js +1 -1
  136. package/dist/lib/service/guard/GuardCheckEngine.d.ts +3 -3
  137. package/dist/lib/service/guard/GuardCheckEngine.js +5 -5
  138. package/dist/lib/service/guard/GuardCrossFileChecks.d.ts +1 -1
  139. package/dist/lib/service/guard/GuardFeedbackLoop.d.ts +3 -3
  140. package/dist/lib/service/guard/GuardFeedbackLoop.js +3 -3
  141. package/dist/lib/service/guard/GuardPatternUtils.js +1 -1
  142. package/dist/lib/service/guard/GuardService.d.ts +1 -15
  143. package/dist/lib/service/guard/GuardService.js +0 -1
  144. package/dist/lib/service/guard/RuleLearner.d.ts +1 -1
  145. package/dist/lib/service/guard/RuleLearner.js +1 -1
  146. package/dist/lib/service/knowledge/CodeEntityGraph.d.ts +3 -3
  147. package/dist/lib/service/knowledge/CodeEntityGraph.js +3 -3
  148. package/dist/lib/service/knowledge/KnowledgeService.d.ts +0 -1
  149. package/dist/lib/service/knowledge/KnowledgeService.js +0 -1
  150. package/dist/lib/service/module/ModuleService.d.ts +1 -1
  151. package/dist/lib/service/module/ModuleService.js +2 -2
  152. package/dist/lib/service/search/HybridRetriever.d.ts +2 -2
  153. package/dist/lib/service/search/HybridRetriever.js +2 -2
  154. package/dist/lib/service/search/SearchEngine.d.ts +1 -3
  155. package/dist/lib/service/search/SearchEngine.js +1 -3
  156. package/dist/lib/service/search/contextBoost.d.ts +1 -1
  157. package/dist/lib/service/skills/EventAggregator.js +2 -2
  158. package/dist/lib/service/skills/SignalCollector.js +1 -1
  159. package/dist/lib/service/snippet/codecs/VSCodeCodec.js +1 -1
  160. package/dist/lib/service/task/TaskGraphService.d.ts +0 -3
  161. package/dist/lib/service/task/TaskGraphService.js +0 -3
  162. package/dist/lib/service/task/TaskKnowledgeBridge.d.ts +8 -27
  163. package/dist/lib/service/task/TaskKnowledgeBridge.js +0 -8
  164. package/dist/lib/service/task/TaskReadyEngine.d.ts +1 -2
  165. package/dist/lib/service/task/TaskReadyEngine.js +0 -1
  166. package/dist/lib/service/wiki/WikiRenderers.js +0 -1
  167. package/dist/lib/service/wiki/WikiUtils.js +2 -7
  168. package/dist/lib/shared/PathGuard.js +6 -6
  169. package/dist/lib/shared/schemas/config.js +1 -1
  170. package/dist/lib/shared/schemas/mcp-tools.js +84 -43
  171. package/dist/scripts/install-vscode-copilot.js +14 -4
  172. package/package.json +1 -1
  173. package/skills/autosnippet-create/SKILL.md +131 -131
  174. package/skills/autosnippet-devdocs/SKILL.md +1 -2
  175. package/skills/autosnippet-guard/SKILL.md +20 -89
  176. package/skills/autosnippet-recipes/SKILL.md +35 -117
  177. package/skills/autosnippet-structure/SKILL.md +23 -55
  178. package/templates/cursor-rules/autosnippet-skills.mdc +17 -33
  179. package/templates/instructions/agent-static.md +24 -0
  180. package/templates/instructions/conventions.md +42 -0
  181. package/skills/autosnippet-analysis/SKILL.md +0 -169
  182. package/skills/autosnippet-candidates/SKILL.md +0 -367
  183. package/skills/autosnippet-coldstart/SKILL.md +0 -988
  184. package/skills/autosnippet-concepts/SKILL.md +0 -630
  185. package/skills/autosnippet-intent/SKILL.md +0 -55
  186. package/skills/autosnippet-lifecycle/SKILL.md +0 -100
  187. package/templates/copilot-instructions.md +0 -66
  188. package/templates/cursor-rules/autosnippet-conventions.mdc +0 -172
  189. package/templates/cursor-rules/autosnippet-workflow.mdc +0 -76
@@ -98,7 +98,7 @@ function analyzeFile(source, lang, options = {}) {
98
98
  }
99
99
  /**
100
100
  * 批量分析多文件,返回项目级汇总
101
- * @param {{ name: string, relativePath: string, content: string }[]} files
101
+ * @param files
102
102
  * @param | null }} [options]
103
103
  */
104
104
  function analyzeProject(files, lang, options) {
@@ -633,7 +633,7 @@ function findCallExpressions(source, lang, targetCallee) {
633
633
  * @param source 源代码
634
634
  * @param lang 'objectivec' | 'swift'
635
635
  * @param pattern 要查找的文本模式(普通字符串匹配)
636
- * @param {{ forbiddenContext?: string, requiredContext?: string }} contextFilter
636
+ * @param contextFilter
637
637
  * forbiddenContext: 如果在此上下文中出现则报告 (如 'dealloc')
638
638
  * requiredContext: 如果不在此上下文中出现则报告
639
639
  * @returns >}
@@ -71,7 +71,7 @@ export declare class CallEdgeResolver {
71
71
  propertyTypes: Map<string, Map<string, string>>;
72
72
  symbolTable: SymbolTable;
73
73
  /**
74
- * @param {Array<{from: string, to: string, type: string}>} [inheritanceGraph=[]] 继承图边
74
+ * @param [inheritanceGraph=[]] 继承图边
75
75
  */
76
76
  constructor(symbolTable: SymbolTable, importResolver: ImportPathResolver, inheritanceGraph?: InheritanceEdge[]);
77
77
  /**
@@ -81,7 +81,7 @@ export declare class CallEdgeResolver {
81
81
  * @param callerFile 调用者文件路径 (相对)
82
82
  */
83
83
  resolveFile(callSites: CallSite[], callerFile: string): ResolvedEdge[];
84
- /** @private 构建局部 import 映射 */
84
+ /** 构建局部 import 映射 */
85
85
  _buildImportMap(fileImports: Array<{
86
86
  path?: string;
87
87
  symbols?: string[];
@@ -91,13 +91,13 @@ export declare class CallEdgeResolver {
91
91
  file: string;
92
92
  namespace: boolean;
93
93
  }>;
94
- /** @private 解析单个调用点 */
94
+ /** 解析单个调用点 */
95
95
  _resolveCallSite(cs: CallSite, callerFile: string, importedSymbols: Map<string, {
96
96
  file: string;
97
97
  namespace: boolean;
98
98
  }>): ResolvedEdge | null;
99
99
  /**
100
- * @private CHA (Class Hierarchy Analysis): 沿继承链向上搜索方法
100
+ * CHA (Class Hierarchy Analysis): 沿继承链向上搜索方法
101
101
  *
102
102
  * 使用 BFS 遍历 inheritanceGraph,从 className 向上搜索直到找到
103
103
  * 定义了 methodName 的祖先类。只跟踪 'inherits' 类型的边。
@@ -108,7 +108,7 @@ export declare class CallEdgeResolver {
108
108
  */
109
109
  _resolveByCHA(methodName: string, className: string): string | null;
110
110
  /**
111
- * @private 从字段名推断类型(DI/IoC 命名约定推断)
111
+ * 从字段名推断类型(DI/IoC 命名约定推断)
112
112
  *
113
113
  * 常见模式:
114
114
  * - userRepo → UserRepo
@@ -120,12 +120,12 @@ export declare class CallEdgeResolver {
120
120
  */
121
121
  _inferFieldType(fieldName: string): string | null;
122
122
  /**
123
- * @private 在指定文件中查找声明 (使用 fileIndex 优化,避免全表扫描)
123
+ * 在指定文件中查找声明 (使用 fileIndex 优化,避免全表扫描)
124
124
  * @param name 符号名 (可以是 "ClassName.methodName" 或 "functionName")
125
125
  * @returns 匹配的 FQN 列表
126
126
  */
127
127
  _findInFile(name: string, file: string): string[];
128
- /** @private 构建 ResolvedEdge */
128
+ /** 构建 ResolvedEdge */
129
129
  _makeEdge(callerFqn: string, calleeFqn: string, resolveMethod: string, cs: CallSite, callerFile: string): ResolvedEdge;
130
130
  }
131
131
  export default CallEdgeResolver;
@@ -21,7 +21,7 @@ export class CallEdgeResolver {
21
21
  propertyTypes;
22
22
  symbolTable;
23
23
  /**
24
- * @param {Array<{from: string, to: string, type: string}>} [inheritanceGraph=[]] 继承图边
24
+ * @param [inheritanceGraph=[]] 继承图边
25
25
  */
26
26
  constructor(symbolTable, importResolver, inheritanceGraph = []) {
27
27
  this.symbolTable = symbolTable;
@@ -34,7 +34,7 @@ export class CallEdgeResolver {
34
34
  // 构建反向索引: symbolName → [fqn1, fqn2, ...]
35
35
  this.nameIndex = new Map();
36
36
  // 构建文件级索引: file → [{ name, qualifiedName, fqn }] (Issue #14 性能优化)
37
- /** @type {Map<string, Array<{name: string, qualifiedName: string, fqn: string}>>} */
37
+ /** >>} */
38
38
  this.fileIndex = new Map();
39
39
  // Phase 5.3: 类名集合索引 (用于 _inferFieldType 优化,避免全表扫描)
40
40
  this.classNames = new Set();
@@ -86,9 +86,9 @@ export class CallEdgeResolver {
86
86
  }
87
87
  return edges;
88
88
  }
89
- /** @private 构建局部 import 映射 */
89
+ /** 构建局部 import 映射 */
90
90
  _buildImportMap(fileImports, callerFile) {
91
- /** @type {Map<string, { file: string, namespace: boolean }>} */
91
+ /** >} */
92
92
  const importedSymbols = new Map();
93
93
  for (const imp of fileImports) {
94
94
  const targetFile = this.importResolver.resolve(imp.path || String(imp), callerFile);
@@ -117,7 +117,7 @@ export class CallEdgeResolver {
117
117
  }
118
118
  return importedSymbols;
119
119
  }
120
- /** @private 解析单个调用点 */
120
+ /** 解析单个调用点 */
121
121
  _resolveCallSite(cs, callerFile, importedSymbols) {
122
122
  const callerFqn = `${callerFile}::${cs.callerClass ? `${cs.callerClass}.` : ''}${cs.callerMethod}`;
123
123
  // Priority 0: super.xxx() — 父类方法调用 (CHA 解析,禁止 fallthrough 防止自引用边)
@@ -264,7 +264,7 @@ export class CallEdgeResolver {
264
264
  return null;
265
265
  }
266
266
  /**
267
- * @private CHA (Class Hierarchy Analysis): 沿继承链向上搜索方法
267
+ * CHA (Class Hierarchy Analysis): 沿继承链向上搜索方法
268
268
  *
269
269
  * 使用 BFS 遍历 inheritanceGraph,从 className 向上搜索直到找到
270
270
  * 定义了 methodName 的祖先类。只跟踪 'inherits' 类型的边。
@@ -306,7 +306,7 @@ export class CallEdgeResolver {
306
306
  return null;
307
307
  }
308
308
  /**
309
- * @private 从字段名推断类型(DI/IoC 命名约定推断)
309
+ * 从字段名推断类型(DI/IoC 命名约定推断)
310
310
  *
311
311
  * 常见模式:
312
312
  * - userRepo → UserRepo
@@ -328,7 +328,7 @@ export class CallEdgeResolver {
328
328
  return this.classNames.has(pascalCase) ? pascalCase : null;
329
329
  }
330
330
  /**
331
- * @private 在指定文件中查找声明 (使用 fileIndex 优化,避免全表扫描)
331
+ * 在指定文件中查找声明 (使用 fileIndex 优化,避免全表扫描)
332
332
  * @param name 符号名 (可以是 "ClassName.methodName" 或 "functionName")
333
333
  * @returns 匹配的 FQN 列表
334
334
  */
@@ -341,7 +341,7 @@ export class CallEdgeResolver {
341
341
  .filter((d) => d.name === name || d.qualifiedName === name)
342
342
  .map((d) => d.fqn);
343
343
  }
344
- /** @private 构建 ResolvedEdge */
344
+ /** 构建 ResolvedEdge */
345
345
  _makeEdge(callerFqn, calleeFqn, resolveMethod, cs, callerFile) {
346
346
  return {
347
347
  caller: callerFqn,
@@ -107,7 +107,7 @@ export declare class CallGraphAnalyzer {
107
107
  */
108
108
  analyzeIncremental(astProjectSummary: AstProjectSummary, changedFiles: string[], options?: AnalyzeOptions): Promise<CallGraphResult>;
109
109
  /**
110
- * @private 实际分析逻辑
110
+ * 实际分析逻辑
111
111
  *
112
112
  * 分级降级策略 (§5.2):
113
113
  * - <100 文件 → 完整分析 (含 CHA)
@@ -120,8 +120,8 @@ export declare class CallGraphAnalyzer {
120
120
  *
121
121
  * @param deadline Date.now() + timeout
122
122
  */
123
- _doAnalyze(astProjectSummary: AstProjectSummary, maxCallSitesPerFile: number, deadline: number): Promise<CallGraphResult>;
124
- /** @private 空结果 */
125
- _emptyResult(durationMs: number): CallGraphResult;
123
+ private _doAnalyze;
124
+ /** 空结果 */
125
+ private _emptyResult;
126
126
  }
127
127
  export default CallGraphAnalyzer;
@@ -144,7 +144,7 @@ export class CallGraphAnalyzer {
144
144
  };
145
145
  }
146
146
  /**
147
- * @private 实际分析逻辑
147
+ * 实际分析逻辑
148
148
  *
149
149
  * 分级降级策略 (§5.2):
150
150
  * - <100 文件 → 完整分析 (含 CHA)
@@ -246,7 +246,7 @@ export class CallGraphAnalyzer {
246
246
  };
247
247
  return { callEdges: allCallEdges, dataFlowEdges, stats };
248
248
  }
249
- /** @private 空结果 */
249
+ /** 空结果 */
250
250
  _emptyResult(durationMs) {
251
251
  return {
252
252
  callEdges: [],
@@ -27,7 +27,6 @@ export declare class ImportPathResolver {
27
27
  constructor(projectRoot: string, allFiles: string[]);
28
28
  /**
29
29
  * 从 tsconfig.json 加载 paths alias 配置
30
- * @private
31
30
  */
32
31
  _loadTsconfigPaths(projectRoot: string): void;
33
32
  /**
@@ -42,7 +41,6 @@ export declare class ImportPathResolver {
42
41
  }, importerFile: string): string | null | undefined;
43
42
  /**
44
43
  * 尝试通过 tsconfig paths alias 解析
45
- * @private
46
44
  */
47
45
  _resolveAlias(importPath: string): string | null;
48
46
  /** 判断是否为外部依赖 */
@@ -25,9 +25,9 @@ export class ImportPathResolver {
25
25
  */
26
26
  constructor(projectRoot, allFiles) {
27
27
  this.projectRoot = projectRoot;
28
- /** @type {Map<string, string>} normalizedPath → actualFilePath */
28
+ /** normalizedPath → actualFilePath */
29
29
  this.fileIndex = new Map();
30
- /** @type {Array<{prefix: string, targets: string[]}>} tsconfig paths 映射 */
30
+ /** >} tsconfig paths 映射 */
31
31
  this.pathAliases = [];
32
32
  // 构建文件索引
33
33
  for (const f of allFiles) {
@@ -58,7 +58,6 @@ export class ImportPathResolver {
58
58
  }
59
59
  /**
60
60
  * 从 tsconfig.json 加载 paths alias 配置
61
- * @private
62
61
  */
63
62
  _loadTsconfigPaths(projectRoot) {
64
63
  const candidates = ['tsconfig.json', 'tsconfig.app.json', 'jsconfig.json'];
@@ -140,7 +139,6 @@ export class ImportPathResolver {
140
139
  }
141
140
  /**
142
141
  * 尝试通过 tsconfig paths alias 解析
143
- * @private
144
142
  */
145
143
  _resolveAlias(importPath) {
146
144
  for (const { prefix, targets } of this.pathAliases) {
@@ -68,19 +68,19 @@ export default class ProjectGraph {
68
68
  #classes = new Map();
69
69
  #protocols = new Map();
70
70
  #categories = new Map();
71
- /** @type {Map<string, string>} 子类 → 父类 */
71
+ /** 子类 → 父类 */
72
72
  #inheritance = new Map();
73
- /** @type {Map<string, Set<string>>} 类 → 遵循的协议集合 */
73
+ /** 类 → 遵循的协议集合 */
74
74
  #conformance = new Map();
75
- /** @type {Map<string, FileSymbols>} 文件路径 → 文件级符号 */
75
+ /** 文件路径 → 文件级符号 */
76
76
  #files = new Map();
77
- /** @type {Map<string, MethodInfo[]>} className → 方法列表 (含 impl 中的方法) */
77
+ /** className → 方法列表 (含 impl 中的方法) */
78
78
  #methodsByClass = new Map();
79
- /** @type {ProjectOverview} 项目统计缓存 */
79
+ /** 项目统计缓存 */
80
80
  #overview = null;
81
- /** @type {string} 项目根目录 */
81
+ /** 项目根目录 */
82
82
  #projectRoot;
83
- /** @type {number} 构建耗时 ms */
83
+ /** 构建耗时 ms */
84
84
  #buildTimeMs = 0;
85
85
  // ── 静态工厂 ──────────────────────────────────────────────────
86
86
  /**
@@ -135,9 +135,9 @@ export class CapabilityProbe {
135
135
  // Case 2: 检查是否是 git 仓库
136
136
  const isGitRepo = this._isGitRepo(this.subRepoPath);
137
137
  if (!isGitRepo) {
138
- // 有目录但不是 git 仓库 → contributor(可本地编辑但不能 push)
139
- this.logger.debug('CapabilityProbe: directory exists but not a git repo');
140
- return 'contributor';
138
+ // 有目录但不是 git 仓库 → 本地个人项目(asd setup 创建),给全权限
139
+ this.logger.debug('CapabilityProbe: directory exists but not a git repo — local project, granting admin');
140
+ return 'admin';
141
141
  }
142
142
  // Case 3: 检查是否有 remote
143
143
  const hasRemote = this._hasRemote(this.subRepoPath);
@@ -158,17 +158,9 @@ export class CapabilityProbe {
158
158
  }
159
159
  }
160
160
  _isGitRepo(repoPath) {
161
- try {
162
- execSync('git rev-parse --git-dir', {
163
- cwd: repoPath,
164
- stdio: 'pipe',
165
- timeout: 5000,
166
- });
167
- return true;
168
- }
169
- catch {
170
- return false;
171
- }
161
+ // 检查是否是独立的 git 仓库(有自己的 .git 目录/文件),
162
+ // 而非仅仅位于父项目 git 仓库内
163
+ return fs.existsSync(`${repoPath}/.git`);
172
164
  }
173
165
  _hasRemote(repoPath) {
174
166
  // 快速路径:config 有 subRepoUrl 即认为有 remote
@@ -46,9 +46,9 @@ function detectMode(candidate) {
46
46
  }
47
47
  // ── UnifiedValidator ────────────────────────────────────────
48
48
  export class UnifiedValidator {
49
- /** @type {Set<string>} 已提交标题 (小写) */
49
+ /** 已提交标题 (小写) */
50
50
  #titles;
51
- /** @type {Set<string>} 已提交代码指纹 */
51
+ /** 已提交代码指纹 */
52
52
  #codeFingerprints;
53
53
  /**
54
54
  * @param [options.existingTitles] 预填充已有标题
@@ -4,13 +4,13 @@ export class Constraints {
4
4
  preconditions;
5
5
  sideEffects;
6
6
  constructor(props = {}) {
7
- /** @type {Array<Guard>} Guard 规则列表 */
7
+ /** Guard 规则列表 */
8
8
  this.guards = (props.guards || []).map(Constraints._normalizeGuard);
9
- /** @type {string[]} 边界约束 */
9
+ /** 边界约束 */
10
10
  this.boundaries = props.boundaries || [];
11
- /** @type {string[]} 前置条件 */
11
+ /** 前置条件 */
12
12
  this.preconditions = props.preconditions || [];
13
- /** @type {string[]} 副作用 */
13
+ /** 副作用 */
14
14
  this.sideEffects = props.sideEffects ?? [];
15
15
  }
16
16
  /** 从任意输入构造 Constraints */
@@ -6,17 +6,17 @@ export class Content {
6
6
  steps;
7
7
  verification;
8
8
  constructor(props = {}) {
9
- /** @type {string} 代码片段 */
9
+ /** 代码片段 */
10
10
  this.pattern = props.pattern ?? '';
11
- /** @type {string} Markdown 全文(与 pattern 二选一) */
11
+ /** Markdown 全文(与 pattern 二选一) */
12
12
  this.markdown = props.markdown ?? '';
13
- /** @type {string} 设计原理 */
13
+ /** 设计原理 */
14
14
  this.rationale = props.rationale ?? '';
15
- /** @type {Array<{title?:string, description?:string, code?:string}>} 实施步骤 */
15
+ /** >} 实施步骤 */
16
16
  this.steps = props.steps ?? [];
17
- /** @type {Array<{file:string, before:string, after:string, explanation:string}>} 代码变更 */
17
+ /** >} 代码变更 */
18
18
  this.codeChanges = props.codeChanges ?? [];
19
- /** @type {?{method?:string, expected_result?:string, test_code?:string}} 验证方式 */
19
+ /** } 验证方式 */
20
20
  this.verification = props.verification ?? null;
21
21
  }
22
22
  /** 从任意输入构造 Content */
@@ -5,15 +5,15 @@ export class Quality {
5
5
  grade;
6
6
  overall;
7
7
  constructor(props = {}) {
8
- /** @type {number} 内容完整度 (0-1) */
8
+ /** 内容完整度 (0-1) */
9
9
  this.completeness = props.completeness ?? 0;
10
- /** @type {number} 项目适配度 (0-1) */
10
+ /** 项目适配度 (0-1) */
11
11
  this.adaptation = props.adaptation ?? 0;
12
- /** @type {number} 文档清晰度 (0-1) */
12
+ /** 文档清晰度 (0-1) */
13
13
  this.documentation = props.documentation ?? 0;
14
- /** @type {number} 综合分 (0-1) */
14
+ /** 综合分 (0-1) */
15
15
  this.overall = props.overall ?? 0;
16
- /** @type {string} 等级 A-F */
16
+ /** 等级 A-F */
17
17
  this.grade = props.grade || Quality.calcGrade(this.overall);
18
18
  }
19
19
  /** 从任意输入构造 Quality */
@@ -5,15 +5,15 @@ export class Reasoning {
5
5
  sources;
6
6
  whyStandard;
7
7
  constructor(props = {}) {
8
- /** @type {string} 为什么遵循标准 */
8
+ /** 为什么遵循标准 */
9
9
  this.whyStandard = props.whyStandard ?? '';
10
- /** @type {string[]} 来源列表 */
10
+ /** 来源列表 */
11
11
  this.sources = props.sources || [];
12
- /** @type {number} 置信度 0-1 */
12
+ /** 置信度 0-1 */
13
13
  this.confidence = props.confidence ?? 0.7;
14
- /** @type {Object.<string, number>} 质量信号 */
14
+ /** 质量信号 */
15
15
  this.qualitySignals = props.qualitySignals ?? {};
16
- /** @type {string[]} 备选方案 */
16
+ /** 备选方案 */
17
17
  this.alternatives = props.alternatives || [];
18
18
  }
19
19
  /** 从任意输入构造 Reasoning */
@@ -24,7 +24,7 @@ export const RELATION_BUCKETS = [
24
24
  export class Relations {
25
25
  _b;
26
26
  constructor(buckets = {}) {
27
- /** @type {Object.<string, Array<{target:string, description:string}>>} */
27
+ /** >>} */
28
28
  this._b = {};
29
29
  for (const k of RELATION_BUCKETS) {
30
30
  const vals = buckets[k] || [];
@@ -6,17 +6,17 @@ export class Stats {
6
6
  searchHits;
7
7
  views;
8
8
  constructor(props = {}) {
9
- /** @type {number} 浏览次数 */
9
+ /** 浏览次数 */
10
10
  this.views = props.views ?? 0;
11
- /** @type {number} 采用次数 */
11
+ /** 采用次数 */
12
12
  this.adoptions = props.adoptions ?? 0;
13
- /** @type {number} 应用次数 */
13
+ /** 应用次数 */
14
14
  this.applications = props.applications ?? 0;
15
- /** @type {number} Guard 命中次数 */
15
+ /** Guard 命中次数 */
16
16
  this.guardHits = props.guardHits ?? 0;
17
- /** @type {number} 搜索命中次数 */
17
+ /** 搜索命中次数 */
18
18
  this.searchHits = props.searchHits ?? 0;
19
- /** @type {number} 权威分 0-5 */
19
+ /** 权威分 0-5 */
20
20
  this.authority = props.authority ?? 0;
21
21
  }
22
22
  /** 从任意输入构造 Stats */
@@ -32,9 +32,9 @@ export declare class TaskIdGenerator {
32
32
  * ★ Drizzle 类型安全 SELECT + UPDATE
33
33
  */
34
34
  generateChild(parentId: string): string;
35
- /** @private ★ Drizzle 类型安全 COUNT */
36
- _getTaskCount(): number;
37
- /** @private ★ Drizzle 类型安全 EXISTS */
38
- _exists(id: string): boolean;
35
+ /** ★ Drizzle 类型安全 COUNT */
36
+ private _getTaskCount;
37
+ /** ★ Drizzle 类型安全 EXISTS */
38
+ private _exists;
39
39
  }
40
40
  export default TaskIdGenerator;
@@ -57,12 +57,12 @@ export class TaskIdGenerator {
57
57
  this.#drizzle.update(tasks).set({ childSeq: nextSeq }).where(eq(tasks.id, parentId)).run();
58
58
  return `${parentId}.${nextSeq}`;
59
59
  }
60
- /** @private ★ Drizzle 类型安全 COUNT */
60
+ /** ★ Drizzle 类型安全 COUNT */
61
61
  _getTaskCount() {
62
62
  const row = this.#drizzle.select({ cnt: sql `COUNT(*)` }).from(tasks).get();
63
63
  return row?.cnt || 0;
64
64
  }
65
- /** @private ★ Drizzle 类型安全 EXISTS */
65
+ /** ★ Drizzle 类型安全 EXISTS */
66
66
  _exists(id) {
67
67
  const row = this.#drizzle
68
68
  .select({ x: sql `1` })
@@ -32,15 +32,15 @@ export class LarkTransport {
32
32
  #getStatusFn;
33
33
  #enqueueIdeFn;
34
34
  #isUserAllowed;
35
- /** @type {ConversationStore|null} 持久化对话存储 */
35
+ /** 持久化对话存储 */
36
36
  #conversationStore = null;
37
- /** @type {Map<string, string>} chatId → conversationId 映射缓存 */
37
+ /** chatId → conversationId 映射缓存 */
38
38
  #chatConversationMap = new Map();
39
- /** @type {Map<string, Array<{role: string, content: string}>>} chatId → 最近对话 (降级用) */
39
+ /** >>} chatId → 最近对话 (降级用) */
40
40
  #conversationHistory = new Map();
41
41
  /** 对话历史最大轮数 */
42
42
  static MAX_HISTORY = 20;
43
- /** @type {Map<string, number>} messageId → timestamp, 消息去重 */
43
+ /** messageId → timestamp, 消息去重 */
44
44
  #recentMsgIds = new Map();
45
45
  /** 去重 TTL (5 分钟) */
46
46
  static DEDUP_TTL = 5 * 60 * 1000;
@@ -18,7 +18,7 @@
18
18
  * Handler 实现 → handlers/*.js
19
19
  * 整合路由 → handlers/consolidated.js
20
20
  */
21
- import { Server } from '@modelcontextprotocol/sdk/server/index.js';
21
+ import { McpServer as SdkMcpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
22
22
  import { CapabilityProbe } from '#core/capability/CapabilityProbe.js';
23
23
  import Logger from '#infra/logging/Logger.js';
24
24
  import type { McpContext, McpServiceContainer } from './handlers/types.js';
@@ -65,7 +65,7 @@ export declare class McpServer {
65
65
  _session: McpSession;
66
66
  _startedAt: number;
67
67
  bootstrap: BootstrapLike | null;
68
- server: Server | null;
68
+ sdkServer: SdkMcpServer | null;
69
69
  constructor(options?: McpServerOptions);
70
70
  /** 共享上下文对象,传给所有 handler */
71
71
  get _ctx(): {
@@ -95,23 +95,19 @@ export declare class McpServer {
95
95
  _injectDecisions(toolName: string, result: unknown): Promise<unknown>;
96
96
  /**
97
97
  * 获取 decisions 摘要(带缓存 + 防并发)
98
- * @private
99
98
  * @returns >>}
100
99
  */
101
- _getDecisionsSummary(): Promise<DecisionEntry[]>;
100
+ private _getDecisionsSummary;
102
101
  /**
103
102
  * 从 DB 查询 decisions 摘要(仅 id + title)
104
- * @private
105
103
  */
106
104
  _fetchDecisionsSummary(): Promise<DecisionEntry[]>;
107
105
  /**
108
106
  * 从 ready 响应结果中刷新缓存(避免额外 DB 查询)
109
- * @private
110
107
  */
111
108
  _refreshCacheFromReady(readyResult: unknown): void;
112
109
  /**
113
110
  * 解析工具名到 handler 函数(V3 整合版)
114
- * @private
115
111
  */
116
112
  _resolveHandler(name: string): ToolHandlerFn | null;
117
113
  /**
@@ -18,7 +18,7 @@
18
18
  * Handler 实现 → handlers/*.js
19
19
  * 整合路由 → handlers/consolidated.js
20
20
  */
21
- import { Server } from '@modelcontextprotocol/sdk/server/index.js';
21
+ import { McpServer as SdkMcpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
22
22
  import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
23
23
  import { CallToolRequestSchema, ListToolsRequestSchema } from '@modelcontextprotocol/sdk/types.js';
24
24
  import { CapabilityProbe } from '#core/capability/CapabilityProbe.js';
@@ -48,12 +48,12 @@ export class McpServer {
48
48
  _session;
49
49
  _startedAt;
50
50
  bootstrap;
51
- server;
51
+ sdkServer;
52
52
  constructor(options = {}) {
53
53
  this.logger = Logger.getInstance();
54
54
  this.container = options.container || null;
55
55
  this.bootstrap = options.bootstrap || null;
56
- this.server = null;
56
+ this.sdkServer = null;
57
57
  this._startedAt = Date.now();
58
58
  this._autoApproveMarked = false;
59
59
  this._capabilityProbe = null;
@@ -115,7 +115,7 @@ export class McpServer {
115
115
  registerGatewayActions(gateway, this.container);
116
116
  }
117
117
  }
118
- this.server = new Server({ name: 'autosnippet-v3', version: '3.0.0' }, { capabilities: { tools: {} } });
118
+ this.sdkServer = new SdkMcpServer({ name: 'autosnippet-v3', version: '3.0.0' }, { capabilities: { tools: {} } });
119
119
  this._registerHandlers();
120
120
  return this;
121
121
  }
@@ -125,14 +125,14 @@ export class McpServer {
125
125
  */
126
126
  _registerHandlers() {
127
127
  // ── ListTools: 按 tier 过滤 ──
128
- this.server.setRequestHandler(ListToolsRequestSchema, async () => {
128
+ this.sdkServer.server.setRequestHandler(ListToolsRequestSchema, async () => {
129
129
  const tierName = process.env.ASD_MCP_TIER || 'agent';
130
130
  const maxTier = TIER_ORDER[tierName] ?? TIER_ORDER.agent;
131
131
  const visible = TOOLS.filter((t) => (TIER_ORDER[t.tier || 'agent'] ?? 0) <= maxTier);
132
132
  return { tools: visible };
133
133
  });
134
134
  // ── CallTool: 路由到 handler ──
135
- this.server.setRequestHandler(CallToolRequestSchema, async (request) => {
135
+ this.sdkServer.server.setRequestHandler(CallToolRequestSchema, async (request) => {
136
136
  const { name, arguments: args } = request.params;
137
137
  const t0 = Date.now();
138
138
  try {
@@ -240,7 +240,6 @@ export class McpServer {
240
240
  }
241
241
  /**
242
242
  * 获取 decisions 摘要(带缓存 + 防并发)
243
- * @private
244
243
  * @returns >>}
245
244
  */
246
245
  async _getDecisionsSummary() {
@@ -271,7 +270,6 @@ export class McpServer {
271
270
  }
272
271
  /**
273
272
  * 从 DB 查询 decisions 摘要(仅 id + title)
274
- * @private
275
273
  */
276
274
  async _fetchDecisionsSummary() {
277
275
  const cache = this._decisionCache;
@@ -297,7 +295,6 @@ export class McpServer {
297
295
  }
298
296
  /**
299
297
  * 从 ready 响应结果中刷新缓存(避免额外 DB 查询)
300
- * @private
301
298
  */
302
299
  _refreshCacheFromReady(readyResult) {
303
300
  try {
@@ -316,7 +313,6 @@ export class McpServer {
316
313
  }
317
314
  /**
318
315
  * 解析工具名到 handler 函数(V3 整合版)
319
- * @private
320
316
  */
321
317
  _resolveHandler(name) {
322
318
  const HANDLER_MAP = {
@@ -444,7 +440,7 @@ export class McpServer {
444
440
  /* non-blocking */
445
441
  }
446
442
  const transport = new StdioServerTransport();
447
- await this.server.connect(transport);
443
+ await this.sdkServer.connect(transport);
448
444
  const tierName = process.env.ASD_MCP_TIER || 'agent';
449
445
  const maxTier = TIER_ORDER[tierName] ?? TIER_ORDER.agent;
450
446
  const visibleCount = TOOLS.filter((t) => (TIER_ORDER[t.tier || 'agent'] ?? 0) <= maxTier).length;
@@ -452,8 +448,8 @@ export class McpServer {
452
448
  process.stderr.write(`AutoSnippet MCP ready — ${visibleCount} tools [tier=${tierName}]\n`);
453
449
  }
454
450
  async shutdown() {
455
- if (this.server) {
456
- await this.server.close();
451
+ if (this.sdkServer) {
452
+ await this.sdkServer.close();
457
453
  }
458
454
  if (this.bootstrap) {
459
455
  await this.bootstrap.shutdown();
@@ -30,15 +30,15 @@ const MAX_SUBMISSIONS_PER_DIM = 20;
30
30
  const MAX_NEGATIVE_SIGNALS = 30;
31
31
  // ── 主类 ────────────────────────────────────────────────────
32
32
  export class ExternalSubmissionTracker {
33
- /** @type {Map<string, SubmissionRecord[]>} dimId → 提交记录列表 */
33
+ /** dimId → 提交记录列表 */
34
34
  #dimensionSubmissions = new Map();
35
- /** @type {Map<string, Set<string>>} filePath → 引用此文件的 dimId 集合 */
35
+ /** filePath → 引用此文件的 dimId 集合 */
36
36
  #fileEvidenceMap = new Map();
37
- /** @type {NegativeSignal[]} 负空间信号 */
37
+ /** 负空间信号 */
38
38
  #negativeSignals = [];
39
- /** @type {Map<string, string[]>} dimId → 被拒绝的提交标题列表 */
39
+ /** dimId → 被拒绝的提交标题列表 */
40
40
  #rejections = new Map();
41
- /** @type {Set<string>} 已使用的唯一 trigger 集合 (跨维度) */
41
+ /** 已使用的唯一 trigger 集合 (跨维度) */
42
42
  #usedTriggers = new Set();
43
43
  // ─── 提交记录 ─────────────────────────────────────────
44
44
  /**