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
@@ -1,18 +1,20 @@
1
1
  /**
2
2
  * MCP 工具定义 — V3 整合版 (18 agent + 4 admin = 22 工具)
3
3
  *
4
- * 39 22 工具(参数路由合并同类工具 + 外部 Agent 冷启动新架构 + TaskGraph 统一入口)。
5
- * TaskGraph: autosnippet_task (统一入口,含 prime/decision/task CRUD)
6
- * 每个工具声明增加 tier 字段(agent / admin)。
4
+ * 每个工具声明包含 name、tier(agent/admin)、description inputSchema。
5
+ * description Agent 选择工具的关键 — 使用 bullet list 列出所有 operation 及其用途。
6
+ * inputSchema Zod Schema 自动生成(zodToMcpSchema),参数的 .describe() 会转为 JSON Schema description。
7
7
  *
8
- * inputSchema Zod Schema 自动生成(zodToMcpSchema),消除手写 JSON Schema 双重维护。
9
- * Zod Schema → 运行时校验(wrapHandler)+ JSON Schema 声明(ListTools)。
8
+ * Agent 工具 (18):
9
+ * 1-7: 查询工具 (health/search/knowledge/structure/graph/call_context/guard)
10
+ * 8-10: 写入工具 (submit_knowledge/submit_knowledge_batch/save_document)
11
+ * 11: Skill 管理 (skill)
12
+ * 12-15: 冷启动 (bootstrap/dimension_complete/wiki_plan/wiki_finalize)
13
+ * 16: 自发现 (capabilities)
14
+ * 17: 任务管理 (task)
10
15
  *
11
- * 外部 Agent 冷启动新工具 (v3.1):
12
- * - autosnippet_bootstrap: 参数化 → 无参数化 Mission Briefing
13
- * - autosnippet_dimension_complete: 维度分析完成通知
14
- * - autosnippet_wiki_plan: Wiki 主题规划
15
- * - autosnippet_wiki_finalize: Wiki 元数据 + 去重
16
+ * Admin 工具 (4):
17
+ * 18-21: enrich_candidates/knowledge_lifecycle/validate_candidate/check_duplicate
16
18
  */
17
19
  import { BootstrapInput, CallContextInput, CapabilitiesInput, CheckDuplicateInput, DimensionCompleteInput, EnrichCandidatesInput, GraphInput, GuardInput, HealthInput, KnowledgeInput, KnowledgeLifecycleInput, SaveDocumentInput, SearchInput, SkillInput, StructureInput, SubmitKnowledgeBatchInput, SubmitKnowledgeInput, TaskInput, ValidateCandidateInput, WikiFinalizeInput, WikiPlanInput, } from '#shared/schemas/mcp-tools.js';
18
20
  import { zodToMcpSchema } from './zodToMcpSchema.js';
@@ -73,168 +75,194 @@ export const TOOLS = [
73
75
  {
74
76
  name: 'autosnippet_health',
75
77
  tier: 'agent',
76
- description: '检查服务健康状态与知识库统计。total=0 时表示需要冷启动。',
78
+ description: '检查服务状态与知识库统计。返回 total(知识总数)和各 kind/lifecycle 分布。total=0 时需要冷启动(调用 autosnippet_bootstrap)。',
77
79
  inputSchema: zodToMcpSchema(HealthInput),
78
80
  },
79
- // 2. 统合搜索(4 → 1)
81
+ // 2. 统合搜索
80
82
  {
81
83
  name: 'autosnippet_search',
82
84
  tier: 'agent',
83
- description: '统合搜索入口。支持 4 种模式(mode 参数),返回 byKind 分组结果。',
85
+ description: '搜索知识库。5 种模式:\n' +
86
+ '• auto(默认)— 自动选最优策略\n' +
87
+ '• keyword — 精确关键词匹配,适合 trigger/title 查找\n' +
88
+ '• bm25 — 全文检索,适合自然语言描述\n' +
89
+ '• semantic — 向量语义搜索,适合模糊概念匹配\n' +
90
+ '• context — 综合搜索 + 上下文关联,适合编码辅助\n' +
91
+ '返回按 kind(rule/pattern/fact)分组的结果。',
84
92
  inputSchema: zodToMcpSchema(SearchInput),
85
93
  },
86
- // 3. 知识浏览(7 → 1)
94
+ // 3. 知识浏览
87
95
  {
88
96
  name: 'autosnippet_knowledge',
89
97
  tier: 'agent',
90
- description: '知识浏览与使用确认。list=列表过滤 | get=单条详情 | insights=质量洞察 | confirm_usage=记录采纳。',
98
+ description: '知识条目管理。\n' +
99
+ '• list — 按 kind/category/status 过滤列表\n' +
100
+ '• get — 获取单条完整内容(需 id)\n' +
101
+ '• insights — 条目质量分析与改进建议(需 id)\n' +
102
+ '• confirm_usage — 记录知识被实际采纳(需 id)',
91
103
  inputSchema: zodToMcpSchema(KnowledgeInput),
92
104
  },
93
- // 4. 项目结构(3 → 1)
105
+ // 4. 项目结构
94
106
  {
95
107
  name: 'autosnippet_structure',
96
108
  tier: 'agent',
97
- description: '项目结构探查。targets=目标列表 | files=文件列表 | metadata=元数据与依赖。',
109
+ description: '探查项目结构。\n' +
110
+ '• targets — 构建目标列表(模块/Target/Package)\n' +
111
+ '• files — 指定 Target 的文件列表\n' +
112
+ '• metadata — 项目元数据(语言、依赖、配置)',
98
113
  inputSchema: zodToMcpSchema(StructureInput),
99
114
  },
100
- // 5. 知识图谱(4 → 1)
115
+ // 5. 知识图谱
101
116
  {
102
117
  name: 'autosnippet_graph',
103
118
  tier: 'agent',
104
- description: '知识图谱查询。query=节点关系 | impact=影响分析 | path=路径查找 | stats=全局统计。',
119
+ description: '知识关系图谱查询。\n' +
120
+ '• query — 查询节点的关联关系\n' +
121
+ '• impact — 修改某知识的影响范围分析\n' +
122
+ '• path — 两个知识节点间的关联路径\n' +
123
+ '• stats — 图谱全局统计(节点/边/密度)',
105
124
  inputSchema: zodToMcpSchema(GraphInput),
106
125
  },
107
- // 6. 调用链上下文 (Phase 5)
126
+ // 6. 调用链上下文
108
127
  {
109
128
  name: 'autosnippet_call_context',
110
129
  tier: 'agent',
111
- description: '查询方法的调用链上下文。\n' +
112
- '• callers: 谁调用了这个方法?(调用者链)\n' +
113
- '• callees: 这个方法调用了谁?(依赖链)\n' +
114
- '• impact: 修改此方法的影响半径分析\n' +
115
- '• both: 同时获取调用者和被调用者',
130
+ description: '查询函数/方法的调用链。\n' +
131
+ '• callers — 谁调用了它(上游调用链)\n' +
132
+ '• callees — 它调用了谁(下游依赖链)\n' +
133
+ '• impact — 修改它的影响半径(上+下游+受影响文件数)\n' +
134
+ '• both — 同时获取 callers + callees',
116
135
  inputSchema: zodToMcpSchema(CallContextInput),
117
136
  },
118
- // 7. Guard 检查(统一入口)
137
+ // 7. Guard 代码检查
119
138
  {
120
139
  name: 'autosnippet_guard',
121
140
  tier: 'agent',
122
- description: '代码规范检查 & 质量门禁。\n' +
123
- '• 无参数 → 自动从 git diff 检测增量文件并检查(编码后推荐用法)\n' +
124
- '• files: ["path/to/file.m", ...] 检查指定文件\n' +
125
- '• code: "..." 单文件内联检查\n' +
126
- '每个 violation 内联 recipe 修复指南(doClause + coreCode),直接按指示修复后再次调用。',
141
+ description: '代码规范检查。\n' +
142
+ '• 无参数 → 自动检查 git diff 增量文件(编码后首选用法)\n' +
143
+ '• files → 检查指定文件列表\n' +
144
+ '• code → 内联检查代码片段\n' +
145
+ '每个 violation 附带修复指南(doClause + coreCode),按指示修复后可再次检查。',
127
146
  inputSchema: zodToMcpSchema(GuardInput),
128
147
  },
129
- // 7. 提交知识(严格前置校验 + 去重检测)
148
+ // 8. 提交单条知识
130
149
  {
131
150
  name: 'autosnippet_submit_knowledge',
132
151
  tier: 'agent',
133
- description: '提交单条知识到知识库(V3 统一实体)。严格前置校验,缺少必要字段将被直接拒绝(不入库)。\n' +
134
- '所有必填字段必须在单次调用中一次性提供,不要分步提交。\n' +
135
- '⚠️ content 必须是对象: { "pattern": "代码片段", "markdown": "## 标题\\n正文...", "rationale": "设计原理" }(pattern/markdown 至少一个 + rationale 必填)\n' +
136
- '⚠️ reasoning 必须是对象: { "whyStandard": "原因", "sources": ["file.ts"], "confidence": 0.85 }\n' +
137
- '必填: title, language, content, kind, doClause, dontClause, whenClause, coreCode, category, trigger, description, headers, usageGuide, knowledgeType, reasoning',
152
+ description: '提交单条知识。所有字段须一次性提供。提交后进入 pending 状态,用户在 Dashboard 审核。\n' +
153
+ '校验未通过的条目仍会入库,返回 recipeReadyHints 提示缺失字段。\n' +
154
+ 'content reasoning 必须是对象(非字符串)。详见各参数 description。',
138
155
  inputSchema: zodToMcpSchema(SubmitKnowledgeInput),
139
156
  },
140
- // 8. 批量知识提交
157
+ // 9. 批量知识提交
141
158
  {
142
159
  name: 'autosnippet_submit_knowledge_batch',
143
160
  tier: 'agent',
144
- description: '批量提交知识条目(V3 统一实体)。每条字段要求同 submit_knowledge。支持去重。\n' +
145
- '⚠️ items 数组中每条的 content 和 reasoning 都必须是 JSON 对象(不是字符串)。\n' +
146
- 'content 格式: { "pattern": "代码...", "markdown": "正文...", "rationale": "原理..." }\n' +
147
- 'reasoning 格式: { "whyStandard": "原因", "sources": ["file.ts"], "confidence": 0.85 }',
161
+ description: '批量提交知识条目。每条字段要求同 submit_knowledge,支持自动去重。\n' +
162
+ '校验更严格:不通过的条目会被拒绝(不入库),返回 rejectedSummary。\n' +
163
+ '适用于冷启动维度分析、模块批量扫描等场景。',
148
164
  inputSchema: zodToMcpSchema(SubmitKnowledgeBatchInput),
149
165
  },
150
- // 9. 保存开发文档
166
+ // 10. 保存开发文档
151
167
  {
152
168
  name: 'autosnippet_save_document',
153
169
  tier: 'agent',
154
- description: '保存开发文档(设计文档、排查报告、ADR 等)。仅需 title + markdown,自动以 dev-document 存储。',
170
+ description: '保存开发文档(设计文档、排查报告、ADR 等)到知识库。仅需 title + markdown,无需完整 V3 字段。',
155
171
  inputSchema: zodToMcpSchema(SaveDocumentInput),
156
172
  },
157
- // 10. Skill 管理(6 → 1)
173
+ // 11. Skill 管理
158
174
  {
159
175
  name: 'autosnippet_skill',
160
176
  tier: 'agent',
161
- description: 'Skill 管理。list=列表 | load=加载 | create=创建 | update=更新 | delete=删除 | suggest=AI推荐。',
177
+ description: 'Skill 管理。\n' +
178
+ '• list — 列出所有可用 Skill(内置 + 项目级)\n' +
179
+ '• load — 加载 Skill 完整内容,获取详细指引(需 name)\n' +
180
+ '• create — 创建项目级 Skill(需 name + description + content)\n' +
181
+ '• update — 更新项目级 Skill 内容\n' +
182
+ '• delete — 删除项目级 Skill(内置不可删)\n' +
183
+ '• suggest — 基于项目分析推荐应创建的 Skill',
162
184
  inputSchema: zodToMcpSchema(SkillInput),
163
185
  },
164
- // 11. 冷启动 Mission Briefing(无参数,返回项目分析 + 执行计划)
186
+ // 12. 冷启动
165
187
  {
166
188
  name: 'autosnippet_bootstrap',
167
189
  tier: 'agent',
168
- description: '冷启动 Mission Briefing 自动分析项目结构、AST、依赖图和 Guard 审计,返回完整的执行计划和维度任务清单。无需任何参数,直接调用即可。不依赖数据库,DB 不可用时也能正常工作。\n' +
169
- '💡 建议先加载 Skill 获取详细冷启动指引: autosnippet_skill({ operation: "load", name: "autosnippet-coldstart" })\n' +
170
- '返回的 submissionSchema.example 包含完整的提交 JSON 示例,请严格按其格式提交知识。',
190
+ description: '冷启动 — 无需参数,自动分析项目(AST、依赖图、Guard 审计),返回 Mission Briefing:\n' +
191
+ ' 项目元数据与语言统计\n' +
192
+ ' 维度任务清单(8 维度 × 3 Tier)\n' +
193
+ '• 执行计划与提交示例\n' +
194
+ '收到 Briefing 后按 executionPlan 完成所有维度分析。',
171
195
  inputSchema: zodToMcpSchema(BootstrapInput),
172
196
  },
173
- // 11b. 维度完成通知
197
+ // 13. 维度完成通知
174
198
  {
175
199
  name: 'autosnippet_dimension_complete',
176
200
  tier: 'agent',
177
- description: '维度分析完成通知 — Agent 完成一个维度的分析后调用。负责 Recipe 关联、Skill 生成、Checkpoint 保存、进度推送、跨维度 Hints 分发。',
201
+ description: '维度分析完成通知。负责:Recipe 关联、Skill 生成(从已提交候选自动合成)、Checkpoint 保存、跨维度 Hints 分发。\n' +
202
+ 'analysisText 可简写,系统会自动从已提交的候选知识中合成详细内容用于 Skill 生成。',
178
203
  inputSchema: zodToMcpSchema(DimensionCompleteInput),
179
204
  },
180
- // 11c. Wiki 主题规划
205
+ // 14. Wiki 规划
181
206
  {
182
207
  name: 'autosnippet_wiki_plan',
183
208
  tier: 'agent',
184
- description: '规划 Wiki 文档生成 — 扫描项目结构、分析 AST 和依赖、整合知识库,返回发现的文档主题及每个主题的数据包。Agent 根据规划自行撰写文章后写入 wiki 目录。',
209
+ description: '规划 Wiki 文档生成 — 整合项目结构与知识库,返回文档主题列表及每个主题的数据包。Agent 根据规划自行撰写文章。',
185
210
  inputSchema: zodToMcpSchema(WikiPlanInput),
186
211
  },
187
- // 11d. Wiki 完成(meta.json + 去重)
212
+ // 15. Wiki 完成
188
213
  {
189
214
  name: 'autosnippet_wiki_finalize',
190
215
  tier: 'agent',
191
- description: '完成 Wiki 生成 — 写入 meta.json、执行去重检查、验证文件完整性。在所有 Wiki 文章写入完成后调用。',
216
+ description: '完成 Wiki 生成 — 写入 meta.json、去重检查、验证完整性。所有文章写入后调用。',
192
217
  inputSchema: zodToMcpSchema(WikiFinalizeInput),
193
218
  },
194
- // 12. 能力声明(Agent 自发现)
219
+ // 16. 能力自发现
195
220
  {
196
221
  name: 'autosnippet_capabilities',
197
222
  tier: 'agent',
198
- description: '列出所有可用 MCP 工具的概览,供 Agent 自发现服务能力。',
223
+ description: '列出所有可用 MCP 工具及其用途概览。适合 Agent 初次接触时了解服务能力。',
199
224
  inputSchema: zodToMcpSchema(CapabilitiesInput),
200
225
  },
201
- // 13. autosnippet_task — 统一任务管理(含 prime/decision/CRUD)
226
+ // 17. 任务与决策管理
202
227
  {
203
228
  name: 'autosnippet_task',
204
229
  tier: 'agent',
205
- description: 'Unified task & decision management. Includes session context (prime), task CRUD, and decision persistence.\n' +
206
- 'Call prime FIRST at every conversation start to load decisions + tasks + knowledge context.',
230
+ description: '任务与决策管理。每次对话开始时先调用 prime 加载上下文。\n' +
231
+ '会话: prime(加载决策+任务+知识上下文)| ready(就绪确认)\n' +
232
+ '任务: create | claim | close | fail | defer | progress | show | list | stats | blocked\n' +
233
+ '分解: decompose(拆子任务)| dep_add(添加依赖)| dep_tree(依赖树)\n' +
234
+ '决策: record_decision | revise_decision | unpin_decision | list_decisions',
207
235
  inputSchema: zodToMcpSchema(TaskInput),
208
236
  },
209
237
  // ══════════════════════════════════════════════════════
210
238
  // Tier: admin — 管理员/CI 工具 (额外 +4)
211
239
  // ══════════════════════════════════════════════════════
212
- // 13. 候选字段诊断
240
+ // 18. 候选字段诊断
213
241
  {
214
242
  name: 'autosnippet_enrich_candidates',
215
243
  tier: 'admin',
216
- description: '候选字段完整性诊断(不使用 AI)。返回 missingFields 列表,Agent 自行补全。',
244
+ description: '诊断候选条目的字段完整性(无 AI)。返回每条候选的 missingFields 列表,Agent 据此补全后重新提交。',
217
245
  inputSchema: zodToMcpSchema(EnrichCandidatesInput),
218
246
  },
219
- // 14. 知识条目生命周期
247
+ // 19. 知识生命周期
220
248
  {
221
249
  name: 'autosnippet_knowledge_lifecycle',
222
250
  tier: 'admin',
223
- description: '知识条目生命周期操作:submit/approve/reject/publish/deprecate/reactivate/fast_track。',
251
+ description: '知识条目生命周期操作。approve/fast_track → 发布知识;reject → 拒绝;deprecate → 废弃;reactivate → 恢复。',
224
252
  inputSchema: zodToMcpSchema(KnowledgeLifecycleInput),
225
253
  },
226
- // 15. 独立候选校验(调试)
254
+ // 20. 候选预校验(调试)
227
255
  {
228
256
  name: 'autosnippet_validate_candidate',
229
257
  tier: 'admin',
230
- description: '对候选做结构化预校验(5层),调试用(Agent 层的 submit_knowledge 已内置校验)。',
258
+ description: '独立候选校验(5 层结构化检查)。调试用,submit_knowledge 已内置校验。',
231
259
  inputSchema: zodToMcpSchema(ValidateCandidateInput),
232
260
  },
233
- // 16. 独立去重检测(调试)
261
+ // 21. 去重检测(调试)
234
262
  {
235
263
  name: 'autosnippet_check_duplicate',
236
264
  tier: 'admin',
237
- description: '相似度检测(调试用,Agent 层的 submit_knowledge 已内置去重)。',
265
+ description: '独立相似度检测。调试用,submit_knowledge 已内置去重。',
238
266
  inputSchema: zodToMcpSchema(CheckDuplicateInput),
239
267
  },
240
268
  ];
@@ -31,7 +31,7 @@ export declare function safeInt(value: unknown, defaultValue: number, min?: numb
31
31
  export declare function sanitizeForAPI(entryOrJson: KnowledgeEntry | Record<string, unknown>): any;
32
32
  /**
33
33
  * 将分页结果中的 data 数组批量过滤系统标签
34
- * @param {{ data: Array, pagination: Object }} result
34
+ * @param result
35
35
  * @returns }
36
36
  */
37
37
  export declare function sanitizePaginatedForAPI(result: {
@@ -44,7 +44,7 @@ export function sanitizeForAPI(entryOrJson) {
44
44
  }
45
45
  /**
46
46
  * 将分页结果中的 data 数组批量过滤系统标签
47
- * @param {{ data: Array, pagination: Object }} result
47
+ * @param result
48
48
  * @returns }
49
49
  */
50
50
  export function sanitizePaginatedForAPI(result) {
@@ -21,7 +21,7 @@ import { EventEmitter } from 'node:events';
21
21
  export declare function createStreamSession(scene: string): {
22
22
  sessionId: string;
23
23
  scene: string;
24
- /** @type {Array<object>} 事件缓冲区(供 EventSource 连接后回放) */
24
+ /** 事件缓冲区(供 EventSource 连接后回放) */
25
25
  buffer: Record<string, unknown>[];
26
26
  /** 会话是否已结束 */
27
27
  completed: boolean;
@@ -30,7 +30,7 @@ export function createStreamSession(scene) {
30
30
  const session = {
31
31
  sessionId,
32
32
  scene,
33
- /** @type {Array<object>} 事件缓冲区(供 EventSource 连接后回放) */
33
+ /** 事件缓冲区(供 EventSource 连接后回放) */
34
34
  buffer: [],
35
35
  /** 会话是否已结束 */
36
36
  completed: false,
@@ -9,7 +9,7 @@ export class CacheService {
9
9
  cache;
10
10
  cleanupInterval;
11
11
  constructor() {
12
- /** @type {Map<string, { value: unknown, expiresAt: number }>} */
12
+ /** >} */
13
13
  this.cache = new Map();
14
14
  this.cleanupInterval = null;
15
15
  // 每 60 秒清理一次过期缓存(unref 避免阻止进程退出)
@@ -98,7 +98,7 @@ export class Logger {
98
98
  static instance = null;
99
99
  static getInstance(config = {}) {
100
100
  if (!this.instance) {
101
- const logsDir = config.file?.path || './logs';
101
+ const logsDir = config.file?.path || './.autosnippet/logs';
102
102
  // 确保日志目录存在
103
103
  if (!fs.existsSync(logsDir)) {
104
104
  fs.mkdirSync(logsDir, { recursive: true });
@@ -14,7 +14,7 @@ export class ErrorTracker {
14
14
  reportInterval;
15
15
  constructor(options = {}) {
16
16
  this.config = {
17
- logDirectory: options.logDirectory || path.join(process.cwd(), 'logs', 'errors'),
17
+ logDirectory: options.logDirectory || path.join(process.cwd(), '.autosnippet', 'logs', 'errors'),
18
18
  maxErrorsInMemory: options.maxErrorsInMemory || 500,
19
19
  enableFileLogging: options.enableFileLogging !== false,
20
20
  enableConsoleLogging: options.enableConsoleLogging !== false,
@@ -50,23 +50,23 @@ function crc32(str) {
50
50
  return ((crc ^ 0xffffffff) >>> 0).toString(16).padStart(8, '0');
51
51
  }
52
52
  export class AsyncPersistence {
53
- /** @type {string} 主索引文件路径 (.asvec) */
53
+ /** 主索引文件路径 (.asvec) */
54
54
  #indexPath;
55
- /** @type {string} WAL 文件路径 (.wal) */
55
+ /** WAL 文件路径 (.wal) */
56
56
  #walPath;
57
- /** @type {Array<object>} 待刷盘操作队列 */
57
+ /** 待刷盘操作队列 */
58
58
  #pendingOps = [];
59
59
  #flushTimer = null;
60
60
  #flushing = false;
61
- /** @type {number} flush 间隔 (ms) */
61
+ /** flush 间隔 (ms) */
62
62
  #flushIntervalMs;
63
- /** @type {number} 触发立即 flush 的操作数 */
63
+ /** 触发立即 flush 的操作数 */
64
64
  #flushBatchSize;
65
- /** @type {function} 外部提供的 persist 回调: () => Promise<void> */
65
+ /** 外部提供的 persist 回调: () => Promise<void> */
66
66
  #onPersist;
67
- /** @type {function} 外部提供的 replay 回调: (op) => void */
67
+ /** 外部提供的 replay 回调: (op) => void */
68
68
  #onReplay;
69
- /** @type {boolean} WAL 是否启用 */
69
+ /** WAL 是否启用 */
70
70
  #enabled;
71
71
  /**
72
72
  * @param options.indexPath 主索引文件路径 (.asvec)
@@ -25,7 +25,7 @@ export declare class BatchEmbedder {
25
25
  /**
26
26
  * 批量 embed 文本
27
27
  *
28
- * @param {Array<{ id: string, content: string }>} items
28
+ * @param items
29
29
  * @param [onProgress] (embedded, total) => void
30
30
  * @returns id → vector
31
31
  */
@@ -27,7 +27,7 @@ export class BatchEmbedder {
27
27
  /**
28
28
  * 批量 embed 文本
29
29
  *
30
- * @param {Array<{ id: string, content: string }>} items
30
+ * @param items
31
31
  * @param [onProgress] (embedded, total) => void
32
32
  * @returns id → vector
33
33
  */
@@ -51,7 +51,7 @@ export class BatchEmbedder {
51
51
  }
52
52
  /**
53
53
  * embed 单个批次
54
- * @param {Array<{ id: string, content: string }>} items
54
+ * @param items
55
55
  */
56
56
  async #embedBatch(items) {
57
57
  const result = new Map();
@@ -54,18 +54,18 @@ export declare class HnswIndex {
54
54
  efConstruct: number;
55
55
  efSearch: number;
56
56
  mL: number;
57
- /** @type {Array<{ id: string, vector: Float32Array|number[], level: number }>} */
57
+ /** >} */
58
58
  nodes: Array<{
59
59
  id: string;
60
60
  vector: Float32Array | number[];
61
61
  level: number;
62
62
  qvector?: Uint8Array | null;
63
63
  } | null>;
64
- /** @type {Array<Map<number, Set<number>>>} graphs — per-level adjacency: graphs[level].get(nodeIdx) → Set<neighborIdx> */
64
+ /** graphs — per-level adjacency: graphs[level].get(nodeIdx) → Set<neighborIdx> */
65
65
  graphs: Map<number, Set<number>>[];
66
66
  entryPoint: number;
67
67
  maxLevel: number;
68
- /** @type {Map<string, number>} id → nodeIdx */
68
+ /** id → nodeIdx */
69
69
  idToIndex: Map<any, any>;
70
70
  /** @param [options.distanceFn] 自定义距离函数 (a, b) => number */
71
71
  constructor(options?: {
@@ -154,7 +154,7 @@ export declare class HnswIndex {
154
154
  }): HnswIndex;
155
155
  /**
156
156
  * 批量插入 (比逐个 addPoint 更高效的初始构建)
157
- * @param {Array<{ id: string, vector: Float32Array|number[] }>} items
157
+ * @param items
158
158
  */
159
159
  addPoints(items: Array<{
160
160
  id: string;
@@ -141,13 +141,13 @@ export class HnswIndex {
141
141
  efSearch; // 查询时搜索宽度
142
142
  mL; // 层级采样因子 = 1 / ln(M)
143
143
  // ── 存储 ──
144
- /** @type {Array<{ id: string, vector: Float32Array|number[], level: number }>} */
144
+ /** >} */
145
145
  nodes = [];
146
- /** @type {Array<Map<number, Set<number>>>} graphs — per-level adjacency: graphs[level].get(nodeIdx) → Set<neighborIdx> */
146
+ /** graphs — per-level adjacency: graphs[level].get(nodeIdx) → Set<neighborIdx> */
147
147
  graphs = [];
148
148
  entryPoint = -1; // 入口节点索引
149
149
  maxLevel = -1; // 当前最大层级
150
- /** @type {Map<string, number>} id → nodeIdx */
150
+ /** id → nodeIdx */
151
151
  idToIndex = new Map();
152
152
  // ── 可选的自定义距离函数 (用于量化空间) ──
153
153
  #distanceFn = null;
@@ -449,7 +449,7 @@ export class HnswIndex {
449
449
  }
450
450
  /**
451
451
  * 简单邻居选择 — 取距离最近的 maxNeighbors 个
452
- * @param {Array<{ nodeIdx: number, dist: number }>} candidates
452
+ * @param candidates
453
453
  * @returns >}
454
454
  */
455
455
  #selectNeighborsSimple(candidates, maxNeighbors) {
@@ -548,7 +548,7 @@ export class HnswIndex {
548
548
  }
549
549
  /**
550
550
  * 批量插入 (比逐个 addPoint 更高效的初始构建)
551
- * @param {Array<{ id: string, vector: Float32Array|number[] }>} items
551
+ * @param items
552
552
  */
553
553
  addPoints(items) {
554
554
  for (const item of items) {
@@ -24,22 +24,22 @@ import { ScalarQuantizer } from './ScalarQuantizer.js';
24
24
  import { VectorStore } from './VectorStore.js';
25
25
  export class HnswVectorAdapter extends VectorStore {
26
26
  #index;
27
- /** @type {Map<string, object>} id → metadata */
27
+ /** id → metadata */
28
28
  #metadata;
29
- /** @type {Map<string, string>} id → content */
29
+ /** id → content */
30
30
  #contents;
31
31
  #quantizer;
32
- /** @type {number} 向量维度 (首次 upsert 自动检测) */
32
+ /** 向量维度 (首次 upsert 自动检测) */
33
33
  #dimension = 0;
34
- /** @type {boolean} 数据是否已修改 */
34
+ /** 数据是否已修改 */
35
35
  #dirty = false;
36
- /** @type {ReturnType<typeof setTimeout>|null} flush 定时器 */
36
+ /** flush 定时器 */
37
37
  #flushTimer = null;
38
- /** @type {number} 待刷盘操作计数 */
38
+ /** 待刷盘操作计数 */
39
39
  #pendingOps = 0;
40
- /** @type {boolean} 是否正在刷盘 */
40
+ /** 是否正在刷盘 */
41
41
  #flushing = false;
42
- /** @type {AsyncPersistence|null} WAL 持久化管理 */
42
+ /** WAL 持久化管理 */
43
43
  #wal = null;
44
44
  // ── 配置 ──
45
45
  #config;
@@ -56,7 +56,7 @@ export declare class ScalarQuantizer {
56
56
  };
57
57
  /**
58
58
  * 从序列化数据恢复量化器
59
- * @param {{ dimension: number, mins: number[], maxs: number[] }} data
59
+ * @param data
60
60
  */
61
61
  static deserialize(data: {
62
62
  dimension: number;
@@ -13,11 +13,11 @@
13
13
  */
14
14
  export class ScalarQuantizer {
15
15
  #dimension;
16
- /** @type {Float32Array} 每维最小值 */
16
+ /** 每维最小值 */
17
17
  #mins;
18
- /** @type {Float32Array} 每维最大值 */
18
+ /** 每维最大值 */
19
19
  #maxs;
20
- /** @type {Float32Array} 每维范围 (max - min), 预计算避免重复减法 */
20
+ /** 每维范围 (max - min), 预计算避免重复减法 */
21
21
  #ranges;
22
22
  #trained = false;
23
23
  /** @param dimension 向量维度 */
@@ -157,7 +157,7 @@ export class ScalarQuantizer {
157
157
  }
158
158
  /**
159
159
  * 从序列化数据恢复量化器
160
- * @param {{ dimension: number, mins: number[], maxs: number[] }} data
160
+ * @param data
161
161
  */
162
162
  static deserialize(data) {
163
163
  const q = new ScalarQuantizer(data.dimension);
@@ -7,7 +7,7 @@ export declare class VectorStore {
7
7
  init(): Promise<void>;
8
8
  /**
9
9
  * 插入或更新文档
10
- * @param {{ id: string, content: string, vector: number[], metadata: object }} item
10
+ * @param item
11
11
  */
12
12
  upsert(item: {
13
13
  id: string;
@@ -10,7 +10,7 @@ export class VectorStore {
10
10
  }
11
11
  /**
12
12
  * 插入或更新文档
13
- * @param {{ id: string, content: string, vector: number[], metadata: object }} item
13
+ * @param item
14
14
  */
15
15
  async upsert(item) {
16
16
  throw new Error('Not implemented: upsert()');
@@ -16,7 +16,7 @@ export declare class ServiceContainer {
16
16
  *
17
17
  * @param name 服务名称
18
18
  * @param factory 工厂函数(首次 get 时执行)
19
- * @param {{ aiDependent?: boolean }} [options] 选项
19
+ * @param [options] 选项
20
20
  * - aiDependent: 标记为 AI Provider 依赖项,热重载时自动清除缓存
21
21
  */
22
22
  singleton(name: string, factory: (container: ServiceContainer) => unknown, options?: {
@@ -36,7 +36,7 @@ export class ServiceContainer {
36
36
  *
37
37
  * @param name 服务名称
38
38
  * @param factory 工厂函数(首次 get 时执行)
39
- * @param {{ aiDependent?: boolean }} [options] 选项
39
+ * @param [options] 选项
40
40
  * - aiDependent: 标记为 AI Provider 依赖项,热重载时自动清除缓存
41
41
  */
42
42
  singleton(name, factory, options = {}) {
@@ -18,7 +18,6 @@ import { CodeEntityGraph } from '../../service/knowledge/CodeEntityGraph.js';
18
18
  import { ConfidenceRouter } from '../../service/knowledge/ConfidenceRouter.js';
19
19
  import { KnowledgeGraphService } from '../../service/knowledge/KnowledgeGraphService.js';
20
20
  import { KnowledgeService } from '../../service/knowledge/KnowledgeService.js';
21
- import { CrossEncoderReranker } from '../../service/search/CrossEncoderReranker.js';
22
21
  import { HybridRetriever } from '../../service/search/HybridRetriever.js';
23
22
  import { SearchEngine } from '../../service/search/SearchEngine.js';
24
23
  import { LanguageService } from '../../shared/LanguageService.js';
@@ -47,10 +46,10 @@ export function register(c) {
47
46
  vectorStore: ct.get('vectorStore'),
48
47
  vectorService,
49
48
  hybridRetriever: ct.get('hybridRetriever'),
50
- crossEncoderReranker: new CrossEncoderReranker({
51
- aiProvider: embedProvider,
52
- logger: ct.singletons.logger || console,
53
- }),
49
+ // CrossEncoderReranker disabled — BM25+vector dual-recall + CoarseRanker + MultiSignalRanker
50
+ // is sufficient for knowledge-base scale (hundreds~thousands of entries).
51
+ // Re-enable when document scale grows to 10k+ or external noisy sources are integrated.
52
+ crossEncoderReranker: null,
54
53
  });
55
54
  }, { aiDependent: true });
56
55
  c.singleton('vectorStore', (ct) => {
@@ -13,7 +13,7 @@ export declare function isNativeUiAvailable(): boolean;
13
13
  /**
14
14
  * 用组合窗口展示搜索结果(列表 + 预览)
15
15
  *
16
- * @param {Array<{title: string, code: string, explanation?: string, groupSize?: number}>} items
16
+ * @param items
17
17
  * @param keyword 搜索关键词
18
18
  * @returns 选中的索引(0-based),-1 表示取消
19
19
  */