autosnippet 3.2.17 → 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.
Files changed (184) hide show
  1. package/README.md +73 -104
  2. package/dashboard/dist/assets/{index-CKMy5LY6.js → index-DdvZE4Yd.js} +1 -1
  3. package/dashboard/dist/index.html +1 -1
  4. package/dist/bin/cli.js +88 -49
  5. package/dist/lib/agent/AgentEventBus.js +3 -3
  6. package/dist/lib/agent/AgentFactory.d.ts +3 -3
  7. package/dist/lib/agent/AgentFactory.js +4 -4
  8. package/dist/lib/agent/AgentMessage.d.ts +8 -8
  9. package/dist/lib/agent/AgentMessage.js +8 -8
  10. package/dist/lib/agent/AgentRuntime.js +2 -2
  11. package/dist/lib/agent/AgentState.js +4 -4
  12. package/dist/lib/agent/ConversationStore.d.ts +1 -1
  13. package/dist/lib/agent/ConversationStore.js +1 -1
  14. package/dist/lib/agent/PipelineStrategy.js +1 -1
  15. package/dist/lib/agent/context/ContextWindow.d.ts +2 -2
  16. package/dist/lib/agent/context/ContextWindow.js +7 -7
  17. package/dist/lib/agent/context/ExplorationTracker.js +9 -9
  18. package/dist/lib/agent/context/exploration/PlanTracker.js +2 -2
  19. package/dist/lib/agent/context/exploration/SignalDetector.d.ts +1 -1
  20. package/dist/lib/agent/context/exploration/SignalDetector.js +1 -1
  21. package/dist/lib/agent/core/LoopContext.d.ts +21 -21
  22. package/dist/lib/agent/core/LoopContext.js +21 -21
  23. package/dist/lib/agent/core/SystemPromptBuilder.js +4 -4
  24. package/dist/lib/agent/domain/EvidenceCollector.js +5 -5
  25. package/dist/lib/agent/memory/ActiveContext.js +1 -1
  26. package/dist/lib/agent/memory/MemoryRetriever.js +1 -1
  27. package/dist/lib/agent/memory/MemoryStore.js +2 -2
  28. package/dist/lib/agent/memory/SessionStore.js +3 -3
  29. package/dist/lib/agent/policies.d.ts +1 -1
  30. package/dist/lib/agent/policies.js +1 -1
  31. package/dist/lib/agent/strategies.d.ts +1 -1
  32. package/dist/lib/agent/strategies.js +4 -4
  33. package/dist/lib/agent/tools/_shared.d.ts +1 -1
  34. package/dist/lib/agent/tools/_shared.js +1 -1
  35. package/dist/lib/agent/tools/infrastructure.js +2 -2
  36. package/dist/lib/cli/SetupService.d.ts +25 -25
  37. package/dist/lib/cli/SetupService.js +28 -15
  38. package/dist/lib/cli/deploy/FileDeployer.d.ts +9 -2
  39. package/dist/lib/cli/deploy/FileDeployer.js +139 -46
  40. package/dist/lib/cli/deploy/FileManifest.d.ts +23 -39
  41. package/dist/lib/cli/deploy/FileManifest.js +22 -27
  42. package/dist/lib/core/AstAnalyzer.d.ts +2 -2
  43. package/dist/lib/core/AstAnalyzer.js +2 -2
  44. package/dist/lib/core/analysis/CallEdgeResolver.d.ts +7 -7
  45. package/dist/lib/core/analysis/CallEdgeResolver.js +9 -9
  46. package/dist/lib/core/analysis/CallGraphAnalyzer.d.ts +4 -4
  47. package/dist/lib/core/analysis/CallGraphAnalyzer.js +2 -2
  48. package/dist/lib/core/analysis/ImportPathResolver.d.ts +0 -2
  49. package/dist/lib/core/analysis/ImportPathResolver.js +2 -4
  50. package/dist/lib/core/ast/ProjectGraph.js +7 -7
  51. package/dist/lib/core/capability/CapabilityProbe.js +6 -14
  52. package/dist/lib/domain/knowledge/UnifiedValidator.js +2 -2
  53. package/dist/lib/domain/knowledge/values/Constraints.js +4 -4
  54. package/dist/lib/domain/knowledge/values/Content.js +6 -6
  55. package/dist/lib/domain/knowledge/values/Quality.js +5 -5
  56. package/dist/lib/domain/knowledge/values/Reasoning.js +5 -5
  57. package/dist/lib/domain/knowledge/values/Relations.js +1 -1
  58. package/dist/lib/domain/knowledge/values/Stats.js +6 -6
  59. package/dist/lib/domain/task/TaskIdGenerator.d.ts +4 -4
  60. package/dist/lib/domain/task/TaskIdGenerator.js +2 -2
  61. package/dist/lib/external/lark/LarkTransport.js +4 -4
  62. package/dist/lib/external/mcp/McpServer.d.ts +3 -7
  63. package/dist/lib/external/mcp/McpServer.js +9 -13
  64. package/dist/lib/external/mcp/handlers/bootstrap/ExternalSubmissionTracker.js +5 -5
  65. package/dist/lib/external/mcp/handlers/bootstrap/MissionBriefingBuilder.js +4 -3
  66. package/dist/lib/external/mcp/handlers/bootstrap/pipeline/BootstrapSnapshot.d.ts +3 -3
  67. package/dist/lib/external/mcp/handlers/bootstrap/pipeline/BootstrapSnapshot.js +3 -3
  68. package/dist/lib/external/mcp/handlers/bootstrap/pipeline/IncrementalBootstrap.d.ts +1 -1
  69. package/dist/lib/external/mcp/handlers/bootstrap/pipeline/IncrementalBootstrap.js +1 -1
  70. package/dist/lib/external/mcp/handlers/bootstrap/pipeline/dimension-context.js +3 -3
  71. package/dist/lib/external/mcp/handlers/bootstrap/shared/dimension-sop.js +27 -14
  72. package/dist/lib/external/mcp/handlers/bootstrap-external.js +6 -0
  73. package/dist/lib/external/mcp/handlers/dimension-complete-external.js +55 -1
  74. package/dist/lib/external/mcp/handlers/skill.js +9 -31
  75. package/dist/lib/external/mcp/handlers/system.js +2 -2
  76. package/dist/lib/external/mcp/handlers/task.js +16 -1
  77. package/dist/lib/external/mcp/tools.d.ts +12 -10
  78. package/dist/lib/external/mcp/tools.js +97 -69
  79. package/dist/lib/http/HttpServer.js +15 -2
  80. package/dist/lib/http/utils/routeHelpers.d.ts +1 -1
  81. package/dist/lib/http/utils/routeHelpers.js +1 -1
  82. package/dist/lib/http/utils/sse-sessions.d.ts +1 -1
  83. package/dist/lib/http/utils/sse-sessions.js +1 -1
  84. package/dist/lib/infrastructure/cache/CacheService.js +1 -1
  85. package/dist/lib/infrastructure/vector/AsyncPersistence.js +8 -8
  86. package/dist/lib/infrastructure/vector/BatchEmbedder.d.ts +1 -1
  87. package/dist/lib/infrastructure/vector/BatchEmbedder.js +2 -2
  88. package/dist/lib/infrastructure/vector/HnswIndex.d.ts +4 -4
  89. package/dist/lib/infrastructure/vector/HnswIndex.js +5 -5
  90. package/dist/lib/infrastructure/vector/HnswVectorAdapter.js +8 -8
  91. package/dist/lib/infrastructure/vector/ScalarQuantizer.d.ts +1 -1
  92. package/dist/lib/infrastructure/vector/ScalarQuantizer.js +4 -4
  93. package/dist/lib/infrastructure/vector/VectorStore.d.ts +1 -1
  94. package/dist/lib/infrastructure/vector/VectorStore.js +1 -1
  95. package/dist/lib/injection/ServiceContainer.d.ts +1 -1
  96. package/dist/lib/injection/ServiceContainer.js +1 -1
  97. package/dist/lib/platform/NativeUi.d.ts +1 -1
  98. package/dist/lib/platform/NativeUi.js +1 -1
  99. package/dist/lib/platform/ios/spm/DependencyGraph.d.ts +1 -1
  100. package/dist/lib/platform/ios/spm/DependencyGraph.js +1 -1
  101. package/dist/lib/platform/ios/spm/PolicyEngine.d.ts +1 -1
  102. package/dist/lib/platform/ios/spm/PolicyEngine.js +1 -1
  103. package/dist/lib/platform/ios/spm/SpmDiscoverer.js +1 -1
  104. package/dist/lib/platform/ios/spm/SpmHelper.js +3 -3
  105. package/dist/lib/platform/ios/xcode/SaveEventFilter.js +2 -2
  106. package/dist/lib/platform/ios/xcode/XcodeIntegration.js +1 -1
  107. package/dist/lib/repository/base/BaseRepository.js +1 -1
  108. package/dist/lib/repository/task/TaskRepository.impl.d.ts +2 -2
  109. package/dist/lib/repository/task/TaskRepository.impl.js +1 -1
  110. package/dist/lib/repository/token/TokenUsageStore.js +1 -1
  111. package/dist/lib/service/automation/ActionPipeline.d.ts +1 -1
  112. package/dist/lib/service/automation/ActionPipeline.js +1 -1
  113. package/dist/lib/service/bootstrap/BootstrapEventEmitter.js +2 -2
  114. package/dist/lib/service/bootstrap/BootstrapTaskManager.d.ts +1 -1
  115. package/dist/lib/service/bootstrap/BootstrapTaskManager.js +2 -2
  116. package/dist/lib/service/bootstrap/DimensionCopyRegistry.d.ts +2 -2
  117. package/dist/lib/service/bootstrap/DimensionCopyRegistry.js +2 -2
  118. package/dist/lib/service/delivery/AgentInstructionsGenerator.d.ts +6 -15
  119. package/dist/lib/service/delivery/AgentInstructionsGenerator.js +53 -189
  120. package/dist/lib/service/delivery/CursorDeliveryPipeline.d.ts +6 -16
  121. package/dist/lib/service/delivery/CursorDeliveryPipeline.js +14 -19
  122. package/dist/lib/service/delivery/KnowledgeCompressor.d.ts +1 -1
  123. package/dist/lib/service/delivery/KnowledgeCompressor.js +1 -1
  124. package/dist/lib/service/delivery/RulesGenerator.d.ts +10 -3
  125. package/dist/lib/service/delivery/RulesGenerator.js +43 -3
  126. package/dist/lib/service/delivery/SkillsSyncer.d.ts +21 -7
  127. package/dist/lib/service/delivery/SkillsSyncer.js +46 -10
  128. package/dist/lib/service/delivery/TopicClassifier.d.ts +3 -6
  129. package/dist/lib/service/delivery/TopicClassifier.js +0 -3
  130. package/dist/lib/service/guard/ExclusionManager.d.ts +1 -1
  131. package/dist/lib/service/guard/ExclusionManager.js +1 -1
  132. package/dist/lib/service/guard/GuardCheckEngine.d.ts +3 -3
  133. package/dist/lib/service/guard/GuardCheckEngine.js +5 -5
  134. package/dist/lib/service/guard/GuardCrossFileChecks.d.ts +1 -1
  135. package/dist/lib/service/guard/GuardFeedbackLoop.d.ts +3 -3
  136. package/dist/lib/service/guard/GuardFeedbackLoop.js +3 -3
  137. package/dist/lib/service/guard/GuardPatternUtils.js +1 -1
  138. package/dist/lib/service/guard/GuardService.d.ts +1 -15
  139. package/dist/lib/service/guard/GuardService.js +0 -1
  140. package/dist/lib/service/guard/RuleLearner.d.ts +1 -1
  141. package/dist/lib/service/guard/RuleLearner.js +1 -1
  142. package/dist/lib/service/knowledge/CodeEntityGraph.d.ts +3 -3
  143. package/dist/lib/service/knowledge/CodeEntityGraph.js +3 -3
  144. package/dist/lib/service/knowledge/KnowledgeService.d.ts +0 -1
  145. package/dist/lib/service/knowledge/KnowledgeService.js +0 -1
  146. package/dist/lib/service/module/ModuleService.d.ts +1 -1
  147. package/dist/lib/service/module/ModuleService.js +2 -2
  148. package/dist/lib/service/search/HybridRetriever.d.ts +2 -2
  149. package/dist/lib/service/search/HybridRetriever.js +2 -2
  150. package/dist/lib/service/search/SearchEngine.d.ts +1 -3
  151. package/dist/lib/service/search/SearchEngine.js +1 -3
  152. package/dist/lib/service/search/contextBoost.d.ts +1 -1
  153. package/dist/lib/service/skills/EventAggregator.js +2 -2
  154. package/dist/lib/service/skills/SignalCollector.js +1 -1
  155. package/dist/lib/service/snippet/codecs/VSCodeCodec.js +1 -1
  156. package/dist/lib/service/task/TaskGraphService.d.ts +0 -3
  157. package/dist/lib/service/task/TaskGraphService.js +0 -3
  158. package/dist/lib/service/task/TaskKnowledgeBridge.d.ts +8 -27
  159. package/dist/lib/service/task/TaskKnowledgeBridge.js +0 -8
  160. package/dist/lib/service/task/TaskReadyEngine.d.ts +1 -2
  161. package/dist/lib/service/task/TaskReadyEngine.js +0 -1
  162. package/dist/lib/service/wiki/WikiRenderers.js +0 -1
  163. package/dist/lib/service/wiki/WikiUtils.js +2 -7
  164. package/dist/lib/shared/PathGuard.js +6 -6
  165. package/dist/lib/shared/schemas/mcp-tools.js +84 -43
  166. package/dist/scripts/install-vscode-copilot.js +14 -4
  167. package/package.json +1 -1
  168. package/skills/autosnippet-create/SKILL.md +131 -131
  169. package/skills/autosnippet-devdocs/SKILL.md +1 -2
  170. package/skills/autosnippet-guard/SKILL.md +20 -89
  171. package/skills/autosnippet-recipes/SKILL.md +35 -117
  172. package/skills/autosnippet-structure/SKILL.md +23 -55
  173. package/templates/cursor-rules/autosnippet-skills.mdc +17 -33
  174. package/templates/instructions/agent-static.md +24 -0
  175. package/templates/instructions/conventions.md +42 -0
  176. package/skills/autosnippet-analysis/SKILL.md +0 -169
  177. package/skills/autosnippet-candidates/SKILL.md +0 -367
  178. package/skills/autosnippet-coldstart/SKILL.md +0 -988
  179. package/skills/autosnippet-concepts/SKILL.md +0 -630
  180. package/skills/autosnippet-intent/SKILL.md +0 -55
  181. package/skills/autosnippet-lifecycle/SKILL.md +0 -100
  182. package/templates/copilot-instructions.md +0 -66
  183. package/templates/cursor-rules/autosnippet-conventions.mdc +0 -172
  184. package/templates/cursor-rules/autosnippet-workflow.mdc +0 -76
@@ -23,21 +23,21 @@ export const Channel = Object.freeze({
23
23
  INTERNAL: 'internal', // Agent 间通信
24
24
  });
25
25
  export class AgentMessage {
26
- /** @type {string} 消息唯一 ID */
26
+ /** 消息唯一 ID */
27
27
  id;
28
- /** @type {string} 用户输入内容 */
28
+ /** 用户输入内容 */
29
29
  content;
30
- /** @type {string} 通信渠道 */
30
+ /** 通信渠道 */
31
31
  channel;
32
- /** @type {Session} 会话信息 */
32
+ /** 会话信息 */
33
33
  session;
34
- /** @type {Sender} 发送者 */
34
+ /** 发送者 */
35
35
  sender;
36
- /** @type {Record<string, any>} 渠道特定元数据 */
36
+ /** 渠道特定元数据 */
37
37
  metadata;
38
- /** @type {Function|null} 回复函数 (text: string) => Promise<void> */
38
+ /** 回复函数 (text: string) => Promise<void> */
39
39
  replyFn;
40
- /** @type {number} 时间戳 */
40
+ /** 时间戳 */
41
41
  timestamp;
42
42
  /**
43
43
  * @param opts.content 用户输入
@@ -60,9 +60,9 @@ export class AgentRuntime {
60
60
  lang;
61
61
  logger;
62
62
  #projectRoot;
63
- /** @type {Array|null} 文件缓存 (bootstrap 场景注入) */
63
+ /** 文件缓存 (bootstrap 场景注入) */
64
64
  #fileCache = null;
65
- /** @type {string[]} 额外工具白名单 (调用方按需注入,不经 Capability) */
65
+ /** 额外工具白名单 (调用方按需注入,不经 Capability) */
66
66
  #additionalTools = [];
67
67
  #toolPipeline;
68
68
  #promptBuilder;
@@ -45,14 +45,14 @@ const DEFAULT_TRANSITIONS = [
45
45
  { from: '*', to: AgentPhase.FAILED, event: 'error' },
46
46
  ];
47
47
  export class AgentState extends EventEmitter {
48
- /** @type {string} 当前阶段 */
48
+ /** 当前阶段 */
49
49
  #phase;
50
- /** @type {Object} 用户自定义状态数据 */
50
+ /** 用户自定义状态数据 */
51
51
  #data;
52
52
  #transitions;
53
- /** @type {Array<{phase: string, data: Object, timestamp: number}>} */
53
+ /** >} */
54
54
  #history;
55
- /** @type {boolean} 是否保留历史 */
55
+ /** 是否保留历史 */
56
56
  #keepHistory;
57
57
  /**
58
58
  * @param [opts.initialData={}] 初始状态数据
@@ -45,7 +45,7 @@ export declare class ConversationStore {
45
45
  }): `${string}-${string}-${string}-${string}-${string}`;
46
46
  /**
47
47
  * 追加消息到对话
48
- * @param {{ role: string, content: string }} message
48
+ * @param message
49
49
  */
50
50
  append(conversationId: string, message: ConversationMessage): void;
51
51
  /**
@@ -73,7 +73,7 @@ export class ConversationStore {
73
73
  }
74
74
  /**
75
75
  * 追加消息到对话
76
- * @param {{ role: string, content: string }} message
76
+ * @param message
77
77
  */
78
78
  append(conversationId, message) {
79
79
  try {
@@ -23,7 +23,7 @@ import { Strategy, StrategyRegistry } from './strategies.js';
23
23
  const _pipelineLogger = Logger.getInstance();
24
24
  export class PipelineStrategy extends Strategy {
25
25
  #stages;
26
- /** @type {number} 最大重试次数 (Gate 失败时全局兜底) */
26
+ /** 最大重试次数 (Gate 失败时全局兜底) */
27
27
  #maxRetries;
28
28
  constructor({ stages = [], maxRetries = 1, } = {}) {
29
29
  super();
@@ -62,7 +62,7 @@ export declare class ContextWindow {
62
62
  * - 微窗口 (<16k): 预算 = 窗口 × 0.7(留 30% 给 prompt/tool schema)
63
63
  *
64
64
  * @param modelName 模型名称,如 'gemini-3-flash-preview', 'gpt-4o-mini'
65
- * @param {{ isSystem?: boolean }} [opts] - isSystem 为 true 时给予更高预算
65
+ * @param [opts] - isSystem 为 true 时给予更高预算
66
66
  * @returns 建议的 token 预算
67
67
  */
68
68
  static resolveTokenBudget(modelName: string, opts?: {
@@ -147,7 +147,7 @@ export declare class ContextWindow {
147
147
  *
148
148
  * @param toolName 工具名
149
149
  * @param result 工具原始返回
150
- * @param {{ maxChars: number, maxMatches: number }} quota 动态配额
150
+ * @param quota 动态配额
151
151
  * @returns 压缩后的结果字符串
152
152
  */
153
153
  export declare function limitToolResult(toolName: string, result: unknown, quota: ToolResultQuota): string;
@@ -28,15 +28,15 @@ import { estimateTokensFast } from '#shared/token-utils.js';
28
28
  * - 或单独的 user/assistant 文本消息
29
29
  */
30
30
  export class ContextWindow {
31
- /** @type {Array<ContextMessage>} 统一格式消息 */
31
+ /** 统一格式消息 */
32
32
  #messages = [];
33
- /** @type {number} token 预算(默认 24000,约对应 Gemini 的安全阈值) */
33
+ /** token 预算(默认 24000,约对应 Gemini 的安全阈值) */
34
34
  #tokenBudget;
35
- /** @type {Array<string>} 被压缩掉的轮次摘要(用于 digest 生成) */
35
+ /** 被压缩掉的轮次摘要(用于 digest 生成) */
36
36
  #compactionLog = [];
37
- /** @type {Set<string>} 被压缩前提取的已提交候选标题 */
37
+ /** 被压缩前提取的已提交候选标题 */
38
38
  #compactedSubmits = new Set();
39
- /** @type {Object} 日志器 */
39
+ /** 日志器 */
40
40
  #logger;
41
41
  /**
42
42
  * 模型名 → 上下文窗口大小映射(token 数)。
@@ -87,7 +87,7 @@ export class ContextWindow {
87
87
  * - 微窗口 (<16k): 预算 = 窗口 × 0.7(留 30% 给 prompt/tool schema)
88
88
  *
89
89
  * @param modelName 模型名称,如 'gemini-3-flash-preview', 'gpt-4o-mini'
90
- * @param {{ isSystem?: boolean }} [opts] - isSystem 为 true 时给予更高预算
90
+ * @param [opts] - isSystem 为 true 时给予更高预算
91
91
  * @returns 建议的 token 预算
92
92
  */
93
93
  static resolveTokenBudget(modelName, opts = {}) {
@@ -420,7 +420,7 @@ export class ContextWindow {
420
420
  *
421
421
  * @param toolName 工具名
422
422
  * @param result 工具原始返回
423
- * @param {{ maxChars: number, maxMatches: number }} quota 动态配额
423
+ * @param quota 动态配额
424
424
  * @returns 压缩后的结果字符串
425
425
  */
426
426
  export function limitToolResult(toolName, result, quota) {
@@ -28,13 +28,13 @@ import { PlanTracker } from './exploration/PlanTracker.js';
28
28
  import { SEARCH_TOOLS, SignalDetector } from './exploration/SignalDetector.js';
29
29
  // ─── ExplorationTracker 主类 ─────────────────────────────
30
30
  export class ExplorationTracker {
31
- /** @type {object} 策略配置 */
31
+ /** 策略配置 */
32
32
  #strategy;
33
- /** @type {object} 预算配置 */
33
+ /** 预算配置 */
34
34
  #budget;
35
- /** @type {string} 当前阶段 */
35
+ /** 当前阶段 */
36
36
  #phase;
37
- /** @type {object} 日志器 */
37
+ /** 日志器 */
38
38
  #logger;
39
39
  // ── 子模块 ──
40
40
  #signalDetector;
@@ -54,16 +54,16 @@ export class ExplorationTracker {
54
54
  phaseRounds: 0,
55
55
  };
56
56
  // ── 阶段控制 ──
57
- /** @type {boolean} 是否刚完成阶段转换(用于 pending nudge) */
57
+ /** 是否刚完成阶段转换(用于 pending nudge) */
58
58
  #justTransitioned = false;
59
- /** @type {string|null} 转换前的旧阶段 */
59
+ /** 转换前的旧阶段 */
60
60
  #transitionFromPhase = null;
61
61
  // ── Graceful exit 控制 ──
62
- /** @type {number|null} 进入 graceful exit 的轮次 */
62
+ /** 进入 graceful exit 的轮次 */
63
63
  #gracefulExitRound = null;
64
- /** @type {boolean} tick 是否已调用(用于 rollback) */
64
+ /** tick 是否已调用(用于 rollback) */
65
65
  #ticked = false;
66
- /** @type {string} 提交工具名(用于 nudge 文本生成) */
66
+ /** 提交工具名(用于 nudge 文本生成) */
67
67
  #submitToolName = 'submit_knowledge';
68
68
  /** 管线类型标识 — 统一场景判别(替代 submitToolName / strategy.name 字符串比较) */
69
69
  #pipelineType;
@@ -13,9 +13,9 @@ const DEFAULT_DEVIATION_THRESHOLD = 0.6;
13
13
  /** 最少经过 N 轮后才允许再次触发 replan(防止 replan 风暴) */
14
14
  const MIN_REPLAN_GAP = 3;
15
15
  export class PlanTracker {
16
- /** @type {boolean} 等待 AI 输出 replan */
16
+ /** 等待 AI 输出 replan */
17
17
  #pendingReplan = false;
18
- /** @type {object} 计划进度 */
18
+ /** 计划进度 */
19
19
  #planProgress = {
20
20
  coveredSteps: 0,
21
21
  totalSteps: 0,
@@ -21,7 +21,7 @@ interface SignalMetrics {
21
21
  export declare class SignalDetector {
22
22
  #private;
23
23
  /**
24
- * @param {{ uniqueFiles: Set<string>, uniquePatterns: Set<string>, uniqueQueries: Set<string> }} metrics
24
+ * @param metrics
25
25
  */
26
26
  constructor(metrics: SignalMetrics);
27
27
  /**
@@ -30,7 +30,7 @@ export class SignalDetector {
30
30
  /** 共享引用 — 指向 ExplorationTracker 的 metrics 中的三个 Set */
31
31
  #metrics;
32
32
  /**
33
- * @param {{ uniqueFiles: Set<string>, uniquePatterns: Set<string>, uniqueQueries: Set<string> }} metrics
33
+ * @param metrics
34
34
  */
35
35
  constructor(metrics) {
36
36
  this.#metrics = metrics;
@@ -63,51 +63,51 @@ interface LoopContextConfig {
63
63
  toolChoiceOverride?: string | null;
64
64
  }
65
65
  export declare class LoopContext {
66
- /** @type {import('./MessageAdapter.js').MessageAdapter} 统一消息适配器 */
66
+ /** 统一消息适配器 */
67
67
  messages: MessageAdapter;
68
- /** @type {Object|null} ExplorationTracker 实例 */
68
+ /** ExplorationTracker 实例 */
69
69
  tracker: ExplorationTracker | null;
70
- /** @type {Object|null} ActiveContext 实例 */
70
+ /** ActiveContext 实例 */
71
71
  trace: ActiveContext | null;
72
- /** @type {Object|null} MemoryCoordinator 实例 */
72
+ /** MemoryCoordinator 实例 */
73
73
  memoryCoordinator: MemoryCoordinator | null;
74
- /** @type {Object|null} 共享状态 */
74
+ /** 共享状态 */
75
75
  sharedState: SharedState | null;
76
- /** @type {number} 当前迭代次数 */
76
+ /** 当前迭代次数 */
77
77
  iteration: number;
78
- /** @type {string} 最终回复文本 */
78
+ /** 最终回复文本 */
79
79
  lastReply: string;
80
- /** @type {Array} 本轮工具调用记录 */
80
+ /** 本轮工具调用记录 */
81
81
  toolCalls: any[];
82
- /** @type {{input: number, output: number}} 本轮 token 用量 */
82
+ /** } 本轮 token 用量 */
83
83
  tokenUsage: {
84
84
  input: number;
85
85
  output: number;
86
86
  };
87
- /** @type {number} 循环开始时间戳 */
87
+ /** 循环开始时间戳 */
88
88
  loopStartTime: number;
89
- /** @type {number} 连续 AI 错误计数 (2-strike 策略) */
89
+ /** 连续 AI 错误计数 (2-strike 策略) */
90
90
  consecutiveAiErrors: number;
91
- /** @type {number} 连续空响应计数 */
91
+ /** 连续空响应计数 */
92
92
  consecutiveEmptyResponses: number;
93
- /** @type {string} 来源 'user' | 'system' */
93
+ /** 来源 'user' | 'system' */
94
94
  source: string;
95
- /** @type {Object} 预算配置 */
95
+ /** 预算配置 */
96
96
  budget: BudgetConfig;
97
97
  capabilities: Capability[];
98
- /** @type {string} 基础系统提示词 */
98
+ /** 基础系统提示词 */
99
99
  baseSystemPrompt: string;
100
- /** @type {Array} 工具 schemas */
100
+ /** 工具 schemas */
101
101
  toolSchemas: Array<Record<string, unknown>>;
102
- /** @type {string} 原始用户提示 */
102
+ /** 原始用户提示 */
103
103
  prompt: string;
104
- /** @type {Function|null} 工具调用钩子 */
104
+ /** 工具调用钩子 */
105
105
  onToolCall: ToolCallHook | null;
106
- /** @type {Object} 额外上下文 */
106
+ /** 额外上下文 */
107
107
  context: Record<string, unknown>;
108
- /** @type {import('../context/ContextWindow.js').ContextWindow|null} 原始 ContextWindow 引用 */
108
+ /** 原始 ContextWindow 引用 */
109
109
  contextWindow: ContextWindow | null;
110
- /** @type {string|null} 首轮 toolChoice 覆盖 ('required'/'auto'/'none') */
110
+ /** 首轮 toolChoice 覆盖 ('required'/'auto'/'none') */
111
111
  toolChoiceOverride: string | null;
112
112
  constructor(config: LoopContextConfig);
113
113
  /** 是否为 system 场景 */
@@ -13,52 +13,52 @@
13
13
  */
14
14
  export class LoopContext {
15
15
  // ─── 注入依赖 ───
16
- /** @type {import('./MessageAdapter.js').MessageAdapter} 统一消息适配器 */
16
+ /** 统一消息适配器 */
17
17
  messages;
18
- /** @type {Object|null} ExplorationTracker 实例 */
18
+ /** ExplorationTracker 实例 */
19
19
  tracker;
20
- /** @type {Object|null} ActiveContext 实例 */
20
+ /** ActiveContext 实例 */
21
21
  trace;
22
- /** @type {Object|null} MemoryCoordinator 实例 */
22
+ /** MemoryCoordinator 实例 */
23
23
  memoryCoordinator;
24
- /** @type {Object|null} 共享状态 */
24
+ /** 共享状态 */
25
25
  sharedState;
26
26
  // ─── 循环状态 ───
27
- /** @type {number} 当前迭代次数 */
27
+ /** 当前迭代次数 */
28
28
  iteration = 0;
29
- /** @type {string} 最终回复文本 */
29
+ /** 最终回复文本 */
30
30
  lastReply = '';
31
- /** @type {Array} 本轮工具调用记录 */
31
+ /** 本轮工具调用记录 */
32
32
  // eslint-disable-next-line @typescript-eslint/no-explicit-any -- tool call entries have varying shapes (ToolCallEntry, ToolCallRecord, etc.) across callers; no common structural type satisfies all consumers
33
33
  toolCalls = [];
34
- /** @type {{input: number, output: number}} 本轮 token 用量 */
34
+ /** } 本轮 token 用量 */
35
35
  tokenUsage = { input: 0, output: 0 };
36
- /** @type {number} 循环开始时间戳 */
36
+ /** 循环开始时间戳 */
37
37
  loopStartTime = 0;
38
38
  // ─── 错误恢复 ───
39
- /** @type {number} 连续 AI 错误计数 (2-strike 策略) */
39
+ /** 连续 AI 错误计数 (2-strike 策略) */
40
40
  consecutiveAiErrors = 0;
41
- /** @type {number} 连续空响应计数 */
41
+ /** 连续空响应计数 */
42
42
  consecutiveEmptyResponses = 0;
43
43
  // ─── 配置 (只读) ───
44
- /** @type {string} 来源 'user' | 'system' */
44
+ /** 来源 'user' | 'system' */
45
45
  source;
46
- /** @type {Object} 预算配置 */
46
+ /** 预算配置 */
47
47
  budget;
48
48
  capabilities;
49
- /** @type {string} 基础系统提示词 */
49
+ /** 基础系统提示词 */
50
50
  baseSystemPrompt;
51
- /** @type {Array} 工具 schemas */
51
+ /** 工具 schemas */
52
52
  toolSchemas;
53
- /** @type {string} 原始用户提示 */
53
+ /** 原始用户提示 */
54
54
  prompt;
55
- /** @type {Function|null} 工具调用钩子 */
55
+ /** 工具调用钩子 */
56
56
  onToolCall;
57
- /** @type {Object} 额外上下文 */
57
+ /** 额外上下文 */
58
58
  context;
59
- /** @type {import('../context/ContextWindow.js').ContextWindow|null} 原始 ContextWindow 引用 */
59
+ /** 原始 ContextWindow 引用 */
60
60
  contextWindow;
61
- /** @type {string|null} 首轮 toolChoice 覆盖 ('required'/'auto'/'none') */
61
+ /** 首轮 toolChoice 覆盖 ('required'/'auto'/'none') */
62
62
  toolChoiceOverride;
63
63
  constructor(config) {
64
64
  this.messages = config.messages;
@@ -12,13 +12,13 @@
12
12
  * @module SystemPromptBuilder
13
13
  */
14
14
  export class SystemPromptBuilder {
15
- /** @type {Persona|null} persona 配置 */
15
+ /** persona 配置 */
16
16
  #persona;
17
- /** @type {FileCacheEntry[]|null} 文件缓存 */
17
+ /** 文件缓存 */
18
18
  #fileCache;
19
- /** @type {string|null} 语言偏好 */
19
+ /** 语言偏好 */
20
20
  #lang;
21
- /** @type {MemoryConfig|null} 记忆配置 */
21
+ /** 记忆配置 */
22
22
  #memoryConfig;
23
23
  constructor({ persona, fileCache, lang, memoryConfig } = {}) {
24
24
  this.#persona = persona || null;
@@ -25,15 +25,15 @@ const MAX_SEARCH_MATCHES = 5;
25
25
  const DEFAULT_SNIPPET_BUDGET = 32_000;
26
26
  // ── 主类 ──────────────────────────────────────────────────────────
27
27
  export class EvidenceCollector {
28
- /** @type {Map<string, EvidenceEntry>} 文件 → 证据条目 */
28
+ /** 文件 → 证据条目 */
29
29
  #evidenceMap = new Map();
30
- /** @type {ExplorationEntry[]} 探索日志 */
30
+ /** 探索日志 */
31
31
  #explorationLog = [];
32
- /** @type {NegativeSignal[]} 负空间信号 */
32
+ /** 负空间信号 */
33
33
  #negativeSignals = [];
34
- /** @type {number} 代码片段总字符预算 */
34
+ /** 代码片段总字符预算 */
35
35
  #snippetBudget;
36
- /** @type {number} 当前已使用的片段字符数 */
36
+ /** 当前已使用的片段字符数 */
37
37
  #snippetCharsUsed = 0;
38
38
  /** @param [options.snippetBudget=32000] 代码片段总字符预算 */
39
39
  constructor(options = {}) {
@@ -669,7 +669,7 @@ export class ActiveContext {
669
669
  // ═══════════════════════════════════════════════════════
670
670
  /**
671
671
  * 工具结果压缩 — 使用特化策略 (从 WorkingMemory 迁入)
672
- * @param {{toolName: string, result: unknown, round: number}} observation
672
+ * @param observation
673
673
  * @returns }
674
674
  */
675
675
  #compressObservation(observation) {
@@ -23,7 +23,7 @@ const RECENCY_HALF_LIFE_DAYS = 7;
23
23
  const SIMILARITY_UPDATE = 0.85;
24
24
  export class MemoryRetriever {
25
25
  #store;
26
- /** @type {EmbeddingFn|null} 向量嵌入函数 */
26
+ /** 向量嵌入函数 */
27
27
  #embeddingFn;
28
28
  /** @param [opts.embeddingFn] 向量嵌入函数 (异步) */
29
29
  constructor(store, opts = {}) {
@@ -29,9 +29,9 @@ const ARCHIVE_DAYS = 30;
29
29
  const FORGET_DAYS = 90;
30
30
  export class MemoryStore {
31
31
  #db;
32
- /** @type {object} 预编译 SQL Statements */
32
+ /** 预编译 SQL Statements */
33
33
  #stmts = null;
34
- /** @type {Map<string, SqliteStatement>} 动态 update SQL 缓存 */
34
+ /** 动态 update SQL 缓存 */
35
35
  #updateStmtCache = new Map();
36
36
  /** @param db better-sqlite3 实例 (raw) */
37
37
  constructor(db) {
@@ -43,17 +43,17 @@ const DEFAULT_TTL_MS = CACHE.DEFAULT_TTL_MS;
43
43
  export class SessionStore {
44
44
  // ── 子系统 1: DimensionReports (from EpisodicMemory) ──
45
45
  #dimensionReports = new Map();
46
- /** @type {Map<string, Finding[]>} filePath → Evidence[] */
46
+ /** filePath → Evidence[] */
47
47
  #evidenceStore = new Map();
48
48
  #crossReferences = [];
49
49
  #tierReflections = [];
50
- /** @type {Map<string, CandidateSummary[]>} dimId → candidates */
50
+ /** dimId → candidates */
51
51
  #submittedCandidates = new Map();
52
52
  #projectContext;
53
53
  // ── 子系统 2: ReadOnlyCache (from ToolResultCache) ──
54
54
  #searchCache = new Map();
55
55
  #fileCache = new Map();
56
- /** @type {{hits: number, misses: number, evictions: number}} */
56
+ /** } */
57
57
  #cacheStats = { hits: 0, misses: 0, evictions: 0 };
58
58
  #ttlMs;
59
59
  #cleanupTimer = null;
@@ -55,7 +55,7 @@ export interface QualityGatePolicyOptions {
55
55
  }
56
56
  /** Policy 基类 — 所有约束的抽象接口 */
57
57
  export declare class Policy {
58
- /** @type {string} 策略名称 */
58
+ /** 策略名称 */
59
59
  get name(): string;
60
60
  /** 执行前校验 — 拒绝不满足条件的请求 */
61
61
  validateBefore(_context: PolicyContext): {
@@ -19,7 +19,7 @@ import _path from 'node:path';
19
19
  // ─── Base Policy ──────────────────────────────
20
20
  /** Policy 基类 — 所有约束的抽象接口 */
21
21
  export class Policy {
22
- /** @type {string} 策略名称 */
22
+ /** 策略名称 */
23
23
  get name() {
24
24
  throw new Error('Subclass must implement name');
25
25
  }
@@ -140,7 +140,7 @@ export declare class FanOutStrategy extends Strategy {
140
140
  constructor({ itemStrategy, tiers, merge }?: FanOutOpts);
141
141
  get name(): string;
142
142
  /**
143
- * @param {Array<{id: string, label: string, tier?: number, prompt?: string, guide?: string}>} opts.items 子任务列表
143
+ * @param opts.items 子任务列表
144
144
  */
145
145
  execute(runtime: StrategyRuntime, message: AgentMessage, opts?: FanOutExecuteOpts): Promise<StrategyResult>;
146
146
  }
@@ -86,11 +86,11 @@ export class SingleStrategy extends Strategy {
86
86
  * })
87
87
  */
88
88
  export class FanOutStrategy extends Strategy {
89
- /** @type {Strategy} 每个子任务的执行策略 */
89
+ /** 每个子任务的执行策略 */
90
90
  #itemStrategy;
91
- /** @type {Record<string, { concurrency: number }>} 分层并发配置 */
91
+ /** >} 分层并发配置 */
92
92
  #tiers;
93
- /** @type {(results: ItemResult[]) => StrategyResult} 结果合并函数 */
93
+ /** 结果合并函数 */
94
94
  #merge;
95
95
  /**
96
96
  * @param opts.itemStrategy 每个子任务使用的策略
@@ -107,7 +107,7 @@ export class FanOutStrategy extends Strategy {
107
107
  return 'fan_out';
108
108
  }
109
109
  /**
110
- * @param {Array<{id: string, label: string, tier?: number, prompt?: string, guide?: string}>} opts.items 子任务列表
110
+ * @param opts.items 子任务列表
111
111
  */
112
112
  async execute(runtime, message, opts = {}) {
113
113
  const { items = [] } = opts;
@@ -18,7 +18,7 @@ export declare const DIMENSION_DISPLAY_GROUP: {
18
18
  };
19
19
  /**
20
20
  * 基于维度元数据 (dimensionMeta) 检查提交是否合法
21
- * @param {{ id: string, outputType: 'candidate'|'skill'|'dual', allowedKnowledgeTypes: string[] }} dimensionMeta
21
+ * @param dimensionMeta
22
22
  * @param params submit_knowledge 的参数
23
23
  * @returns | null} 不合法返回 rejected,合法返回 null
24
24
  */
@@ -20,7 +20,7 @@ export const DIMENSION_DISPLAY_GROUP = {
20
20
  };
21
21
  /**
22
22
  * 基于维度元数据 (dimensionMeta) 检查提交是否合法
23
- * @param {{ id: string, outputType: 'candidate'|'skill'|'dual', allowedKnowledgeTypes: string[] }} dimensionMeta
23
+ * @param dimensionMeta
24
24
  * @param params submit_knowledge 的参数
25
25
  * @returns | null} 不合法返回 rejected,合法返回 null
26
26
  */
@@ -85,13 +85,13 @@ export const queryAuditLog = {
85
85
  // ────────────────────────────────────────────────────────────
86
86
  export const loadSkill = {
87
87
  name: 'load_skill',
88
- description: '加载指定的 Agent Skill 文档,获取领域操作指南和最佳实践参考。可用于冷启动指南 (autosnippet-coldstart)、候选管理 (autosnippet-candidates)、规范审计 (autosnippet-guard) 等。',
88
+ description: '加载指定的 Agent Skill 文档,获取领域操作指南和最佳实践参考。如知识提交 (autosnippet-create)、规范审计 (autosnippet-guard)、项目标准 (autosnippet-recipes) 等。',
89
89
  parameters: {
90
90
  type: 'object',
91
91
  properties: {
92
92
  skillName: {
93
93
  type: 'string',
94
- description: 'Skill 目录名(如 autosnippet-coldstart, autosnippet-candidates, autosnippet-guard 等)',
94
+ description: 'Skill 目录名(如 autosnippet-create, autosnippet-guard, autosnippet-recipes 等)',
95
95
  },
96
96
  },
97
97
  required: ['skillName'],