agentic-qe 2.3.5 → 2.5.0

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 (326) hide show
  1. package/.claude/agents/qe-a11y-ally.md +751 -0
  2. package/.claude/agents/qx-partner.md +120 -4
  3. package/.claude/skills/testability-scoring/SKILL.md +107 -6
  4. package/CHANGELOG.md +133 -0
  5. package/README.md +7 -6
  6. package/dist/agents/AccessibilityAllyAgent.d.ts +168 -0
  7. package/dist/agents/AccessibilityAllyAgent.d.ts.map +1 -0
  8. package/dist/agents/AccessibilityAllyAgent.js +462 -0
  9. package/dist/agents/AccessibilityAllyAgent.js.map +1 -0
  10. package/dist/agents/BaseAgent.d.ts +56 -49
  11. package/dist/agents/BaseAgent.d.ts.map +1 -1
  12. package/dist/agents/BaseAgent.js +208 -604
  13. package/dist/agents/BaseAgent.js.map +1 -1
  14. package/dist/agents/FlakyTestHunterAgent.d.ts +2 -2
  15. package/dist/agents/FlakyTestHunterAgent.d.ts.map +1 -1
  16. package/dist/agents/FlakyTestHunterAgent.js +8 -104
  17. package/dist/agents/FlakyTestHunterAgent.js.map +1 -1
  18. package/dist/agents/SONAIntegration.d.ts +109 -0
  19. package/dist/agents/SONAIntegration.d.ts.map +1 -0
  20. package/dist/agents/SONAIntegration.js +167 -0
  21. package/dist/agents/SONAIntegration.js.map +1 -0
  22. package/dist/agents/TestExecutorAgent.d.ts +1 -1
  23. package/dist/agents/TestExecutorAgent.d.ts.map +1 -1
  24. package/dist/agents/TestExecutorAgent.js +4 -46
  25. package/dist/agents/TestExecutorAgent.js.map +1 -1
  26. package/dist/agents/TestGeneratorAgent.d.ts.map +1 -1
  27. package/dist/agents/TestGeneratorAgent.js +15 -35
  28. package/dist/agents/TestGeneratorAgent.js.map +1 -1
  29. package/dist/agents/adapters/CoordinatorAdapter.d.ts +47 -0
  30. package/dist/agents/adapters/CoordinatorAdapter.d.ts.map +1 -0
  31. package/dist/agents/adapters/CoordinatorAdapter.js +266 -0
  32. package/dist/agents/adapters/CoordinatorAdapter.js.map +1 -0
  33. package/dist/agents/adapters/LearningEngineAdapter.d.ts +45 -0
  34. package/dist/agents/adapters/LearningEngineAdapter.d.ts.map +1 -0
  35. package/dist/agents/adapters/LearningEngineAdapter.js +279 -0
  36. package/dist/agents/adapters/LearningEngineAdapter.js.map +1 -0
  37. package/dist/agents/adapters/LifecycleManagerAdapter.d.ts +45 -0
  38. package/dist/agents/adapters/LifecycleManagerAdapter.d.ts.map +1 -0
  39. package/dist/agents/adapters/LifecycleManagerAdapter.js +128 -0
  40. package/dist/agents/adapters/LifecycleManagerAdapter.js.map +1 -0
  41. package/dist/agents/adapters/MemoryServiceAdapter.d.ts +96 -0
  42. package/dist/agents/adapters/MemoryServiceAdapter.d.ts.map +1 -0
  43. package/dist/agents/adapters/MemoryServiceAdapter.js +266 -0
  44. package/dist/agents/adapters/MemoryServiceAdapter.js.map +1 -0
  45. package/dist/agents/adapters/index.d.ts +14 -0
  46. package/dist/agents/adapters/index.d.ts.map +1 -0
  47. package/dist/agents/adapters/index.js +25 -0
  48. package/dist/agents/adapters/index.js.map +1 -0
  49. package/dist/agents/index.d.ts +3 -0
  50. package/dist/agents/index.d.ts.map +1 -1
  51. package/dist/agents/index.js +93 -2
  52. package/dist/agents/index.js.map +1 -1
  53. package/dist/agents/lifecycle/AgentLifecycleManager.d.ts.map +1 -1
  54. package/dist/agents/lifecycle/AgentLifecycleManager.js +12 -6
  55. package/dist/agents/lifecycle/AgentLifecycleManager.js.map +1 -1
  56. package/dist/cli/init/agents.js +1 -1
  57. package/dist/cli/init/claude-config.js +2 -2
  58. package/dist/cli/init/database-init.js +1 -1
  59. package/dist/core/cache/BinaryCacheBuilder.d.ts +84 -0
  60. package/dist/core/cache/BinaryCacheBuilder.d.ts.map +1 -0
  61. package/dist/core/cache/BinaryCacheBuilder.js +225 -0
  62. package/dist/core/cache/BinaryCacheBuilder.js.map +1 -0
  63. package/dist/core/cache/BinaryCacheImpl.d.ts +161 -0
  64. package/dist/core/cache/BinaryCacheImpl.d.ts.map +1 -0
  65. package/dist/core/cache/BinaryCacheImpl.js +685 -0
  66. package/dist/core/cache/BinaryCacheImpl.js.map +1 -0
  67. package/dist/core/cache/BinaryCacheManager.d.ts +142 -0
  68. package/dist/core/cache/BinaryCacheManager.d.ts.map +1 -0
  69. package/dist/core/cache/BinaryCacheManager.js +354 -0
  70. package/dist/core/cache/BinaryCacheManager.js.map +1 -0
  71. package/dist/core/cache/BinaryCacheReader.d.ts +129 -0
  72. package/dist/core/cache/BinaryCacheReader.d.ts.map +1 -0
  73. package/dist/core/cache/BinaryCacheReader.js +243 -0
  74. package/dist/core/cache/BinaryCacheReader.js.map +1 -0
  75. package/dist/core/cache/BinaryMetadataCache.d.ts +777 -0
  76. package/dist/core/cache/BinaryMetadataCache.d.ts.map +1 -0
  77. package/dist/core/cache/BinaryMetadataCache.js +204 -0
  78. package/dist/core/cache/BinaryMetadataCache.js.map +1 -0
  79. package/dist/core/cache/CacheInvalidator.d.ts +103 -0
  80. package/dist/core/cache/CacheInvalidator.d.ts.map +1 -0
  81. package/dist/core/cache/CacheInvalidator.js +152 -0
  82. package/dist/core/cache/CacheInvalidator.js.map +1 -0
  83. package/dist/core/cache/CacheValidator.d.ts +69 -0
  84. package/dist/core/cache/CacheValidator.d.ts.map +1 -0
  85. package/dist/core/cache/CacheValidator.js +189 -0
  86. package/dist/core/cache/CacheValidator.js.map +1 -0
  87. package/dist/core/cache/MessagePackSerializer.d.ts +163 -0
  88. package/dist/core/cache/MessagePackSerializer.d.ts.map +1 -0
  89. package/dist/core/cache/MessagePackSerializer.js +274 -0
  90. package/dist/core/cache/MessagePackSerializer.js.map +1 -0
  91. package/dist/core/cache/index.d.ts +59 -0
  92. package/dist/core/cache/index.d.ts.map +1 -0
  93. package/dist/core/cache/index.js +111 -0
  94. package/dist/core/cache/index.js.map +1 -0
  95. package/dist/core/index.d.ts +2 -0
  96. package/dist/core/index.d.ts.map +1 -1
  97. package/dist/core/index.js +18 -0
  98. package/dist/core/index.js.map +1 -1
  99. package/dist/core/memory/AgentDBService.d.ts +30 -4
  100. package/dist/core/memory/AgentDBService.d.ts.map +1 -1
  101. package/dist/core/memory/AgentDBService.js +122 -12
  102. package/dist/core/memory/AgentDBService.js.map +1 -1
  103. package/dist/core/memory/CachedHNSWVectorMemory.d.ts +153 -0
  104. package/dist/core/memory/CachedHNSWVectorMemory.d.ts.map +1 -0
  105. package/dist/core/memory/CachedHNSWVectorMemory.js +329 -0
  106. package/dist/core/memory/CachedHNSWVectorMemory.js.map +1 -0
  107. package/dist/core/memory/HNSWVectorMemory.js +1 -1
  108. package/dist/core/memory/PatternStoreFactory.d.ts +28 -0
  109. package/dist/core/memory/PatternStoreFactory.d.ts.map +1 -1
  110. package/dist/core/memory/PatternStoreFactory.js +68 -3
  111. package/dist/core/memory/PatternStoreFactory.js.map +1 -1
  112. package/dist/core/memory/RuVectorPatternStore.d.ts.map +1 -1
  113. package/dist/core/memory/RuVectorPatternStore.js +8 -2
  114. package/dist/core/memory/RuVectorPatternStore.js.map +1 -1
  115. package/dist/core/memory/UnifiedMemoryCoordinator.d.ts +50 -0
  116. package/dist/core/memory/UnifiedMemoryCoordinator.d.ts.map +1 -1
  117. package/dist/core/memory/UnifiedMemoryCoordinator.js +206 -0
  118. package/dist/core/memory/UnifiedMemoryCoordinator.js.map +1 -1
  119. package/dist/core/memory/index.d.ts +2 -0
  120. package/dist/core/memory/index.d.ts.map +1 -1
  121. package/dist/core/memory/index.js +8 -1
  122. package/dist/core/memory/index.js.map +1 -1
  123. package/dist/core/optimization/RecursiveOptimizer.d.ts +233 -0
  124. package/dist/core/optimization/RecursiveOptimizer.d.ts.map +1 -0
  125. package/dist/core/optimization/RecursiveOptimizer.js +509 -0
  126. package/dist/core/optimization/RecursiveOptimizer.js.map +1 -0
  127. package/dist/core/platform/FileOperations.d.ts +124 -0
  128. package/dist/core/platform/FileOperations.d.ts.map +1 -0
  129. package/dist/core/platform/FileOperations.js +371 -0
  130. package/dist/core/platform/FileOperations.js.map +1 -0
  131. package/dist/core/platform/PlatformDetector.d.ts +53 -0
  132. package/dist/core/platform/PlatformDetector.d.ts.map +1 -0
  133. package/dist/core/platform/PlatformDetector.js +251 -0
  134. package/dist/core/platform/PlatformDetector.js.map +1 -0
  135. package/dist/core/platform/index.d.ts +12 -0
  136. package/dist/core/platform/index.d.ts.map +1 -0
  137. package/dist/core/platform/index.js +28 -0
  138. package/dist/core/platform/index.js.map +1 -0
  139. package/dist/core/strategies/AcceleratedLearningStrategy.d.ts +74 -0
  140. package/dist/core/strategies/AcceleratedLearningStrategy.d.ts.map +1 -0
  141. package/dist/core/strategies/AcceleratedLearningStrategy.js +200 -0
  142. package/dist/core/strategies/AcceleratedLearningStrategy.js.map +1 -0
  143. package/dist/core/strategies/AgentCoordinationStrategy.d.ts +157 -0
  144. package/dist/core/strategies/AgentCoordinationStrategy.d.ts.map +1 -0
  145. package/dist/core/strategies/AgentCoordinationStrategy.js +12 -0
  146. package/dist/core/strategies/AgentCoordinationStrategy.js.map +1 -0
  147. package/dist/core/strategies/AgentLearningStrategy.d.ts +200 -0
  148. package/dist/core/strategies/AgentLearningStrategy.d.ts.map +1 -0
  149. package/dist/core/strategies/AgentLearningStrategy.js +13 -0
  150. package/dist/core/strategies/AgentLearningStrategy.js.map +1 -0
  151. package/dist/core/strategies/AgentLifecycleStrategy.d.ts +116 -0
  152. package/dist/core/strategies/AgentLifecycleStrategy.d.ts.map +1 -0
  153. package/dist/core/strategies/AgentLifecycleStrategy.js +12 -0
  154. package/dist/core/strategies/AgentLifecycleStrategy.js.map +1 -0
  155. package/dist/core/strategies/AgentMemoryStrategy.d.ts +154 -0
  156. package/dist/core/strategies/AgentMemoryStrategy.d.ts.map +1 -0
  157. package/dist/core/strategies/AgentMemoryStrategy.js +13 -0
  158. package/dist/core/strategies/AgentMemoryStrategy.js.map +1 -0
  159. package/dist/core/strategies/DefaultCoordinationStrategy.d.ts +105 -0
  160. package/dist/core/strategies/DefaultCoordinationStrategy.d.ts.map +1 -0
  161. package/dist/core/strategies/DefaultCoordinationStrategy.js +332 -0
  162. package/dist/core/strategies/DefaultCoordinationStrategy.js.map +1 -0
  163. package/dist/core/strategies/DefaultLearningStrategy.d.ts +120 -0
  164. package/dist/core/strategies/DefaultLearningStrategy.d.ts.map +1 -0
  165. package/dist/core/strategies/DefaultLearningStrategy.js +365 -0
  166. package/dist/core/strategies/DefaultLearningStrategy.js.map +1 -0
  167. package/dist/core/strategies/DefaultLifecycleStrategy.d.ts +129 -0
  168. package/dist/core/strategies/DefaultLifecycleStrategy.d.ts.map +1 -0
  169. package/dist/core/strategies/DefaultLifecycleStrategy.js +297 -0
  170. package/dist/core/strategies/DefaultLifecycleStrategy.js.map +1 -0
  171. package/dist/core/strategies/DefaultMemoryStrategy.d.ts +91 -0
  172. package/dist/core/strategies/DefaultMemoryStrategy.d.ts.map +1 -0
  173. package/dist/core/strategies/DefaultMemoryStrategy.js +257 -0
  174. package/dist/core/strategies/DefaultMemoryStrategy.js.map +1 -0
  175. package/dist/core/strategies/DistributedMemoryStrategy.d.ts +85 -0
  176. package/dist/core/strategies/DistributedMemoryStrategy.d.ts.map +1 -0
  177. package/dist/core/strategies/DistributedMemoryStrategy.js +126 -0
  178. package/dist/core/strategies/DistributedMemoryStrategy.js.map +1 -0
  179. package/dist/core/strategies/SONALearningStrategy.d.ts +115 -0
  180. package/dist/core/strategies/SONALearningStrategy.d.ts.map +1 -0
  181. package/dist/core/strategies/SONALearningStrategy.js +656 -0
  182. package/dist/core/strategies/SONALearningStrategy.js.map +1 -0
  183. package/dist/core/strategies/TRMLearningStrategy.d.ts +162 -0
  184. package/dist/core/strategies/TRMLearningStrategy.d.ts.map +1 -0
  185. package/dist/core/strategies/TRMLearningStrategy.js +670 -0
  186. package/dist/core/strategies/TRMLearningStrategy.js.map +1 -0
  187. package/dist/core/strategies/index.d.ts +104 -0
  188. package/dist/core/strategies/index.d.ts.map +1 -0
  189. package/dist/core/strategies/index.js +68 -0
  190. package/dist/core/strategies/index.js.map +1 -0
  191. package/dist/learning/PerformanceOptimizer.js +2 -2
  192. package/dist/learning/PerformanceOptimizer.js.map +1 -1
  193. package/dist/learning/SONAFeedbackLoop.d.ts +168 -0
  194. package/dist/learning/SONAFeedbackLoop.d.ts.map +1 -0
  195. package/dist/learning/SONAFeedbackLoop.js +344 -0
  196. package/dist/learning/SONAFeedbackLoop.js.map +1 -0
  197. package/dist/learning/baselines/BaselineCollector.d.ts +1 -1
  198. package/dist/learning/baselines/BaselineCollector.js +1 -1
  199. package/dist/learning/baselines/StandardTaskSuite.d.ts +1 -1
  200. package/dist/learning/baselines/StandardTaskSuite.js +1 -1
  201. package/dist/learning/index.d.ts +2 -0
  202. package/dist/learning/index.d.ts.map +1 -1
  203. package/dist/learning/index.js +6 -1
  204. package/dist/learning/index.js.map +1 -1
  205. package/dist/mcp/handlers/base-handler.d.ts +28 -1
  206. package/dist/mcp/handlers/base-handler.d.ts.map +1 -1
  207. package/dist/mcp/handlers/base-handler.js +41 -0
  208. package/dist/mcp/handlers/base-handler.js.map +1 -1
  209. package/dist/mcp/server-instructions.d.ts +1 -1
  210. package/dist/mcp/server-instructions.js +1 -1
  211. package/dist/mcp/server.d.ts.map +1 -1
  212. package/dist/mcp/server.js +23 -16
  213. package/dist/mcp/server.js.map +1 -1
  214. package/dist/mcp/services/AgentRegistry.d.ts.map +1 -1
  215. package/dist/mcp/services/AgentRegistry.js +6 -1
  216. package/dist/mcp/services/AgentRegistry.js.map +1 -1
  217. package/dist/mcp/tools/qe/accessibility/accname-computation.d.ts +114 -0
  218. package/dist/mcp/tools/qe/accessibility/accname-computation.d.ts.map +1 -0
  219. package/dist/mcp/tools/qe/accessibility/accname-computation.js +566 -0
  220. package/dist/mcp/tools/qe/accessibility/accname-computation.js.map +1 -0
  221. package/dist/mcp/tools/qe/accessibility/apg-patterns.d.ts +103 -0
  222. package/dist/mcp/tools/qe/accessibility/apg-patterns.d.ts.map +1 -0
  223. package/dist/mcp/tools/qe/accessibility/apg-patterns.js +1028 -0
  224. package/dist/mcp/tools/qe/accessibility/apg-patterns.js.map +1 -0
  225. package/dist/mcp/tools/qe/accessibility/en-301-549-mapping.d.ts +48 -0
  226. package/dist/mcp/tools/qe/accessibility/en-301-549-mapping.d.ts.map +1 -0
  227. package/dist/mcp/tools/qe/accessibility/en-301-549-mapping.js +565 -0
  228. package/dist/mcp/tools/qe/accessibility/en-301-549-mapping.js.map +1 -0
  229. package/dist/mcp/tools/qe/accessibility/eu-accessibility-act.d.ts +117 -0
  230. package/dist/mcp/tools/qe/accessibility/eu-accessibility-act.d.ts.map +1 -0
  231. package/dist/mcp/tools/qe/accessibility/eu-accessibility-act.js +571 -0
  232. package/dist/mcp/tools/qe/accessibility/eu-accessibility-act.js.map +1 -0
  233. package/dist/mcp/tools/qe/accessibility/html-report-generator.d.ts +23 -0
  234. package/dist/mcp/tools/qe/accessibility/html-report-generator.d.ts.map +1 -0
  235. package/dist/mcp/tools/qe/accessibility/html-report-generator.js +1152 -0
  236. package/dist/mcp/tools/qe/accessibility/html-report-generator.js.map +1 -0
  237. package/dist/mcp/tools/qe/accessibility/index.d.ts +22 -0
  238. package/dist/mcp/tools/qe/accessibility/index.d.ts.map +1 -0
  239. package/dist/mcp/tools/qe/accessibility/index.js +38 -0
  240. package/dist/mcp/tools/qe/accessibility/index.js.map +1 -0
  241. package/dist/mcp/tools/qe/accessibility/markdown-report-generator.d.ts +18 -0
  242. package/dist/mcp/tools/qe/accessibility/markdown-report-generator.d.ts.map +1 -0
  243. package/dist/mcp/tools/qe/accessibility/markdown-report-generator.js +549 -0
  244. package/dist/mcp/tools/qe/accessibility/markdown-report-generator.js.map +1 -0
  245. package/dist/mcp/tools/qe/accessibility/remediation-code-generator.d.ts +139 -0
  246. package/dist/mcp/tools/qe/accessibility/remediation-code-generator.d.ts.map +1 -0
  247. package/dist/mcp/tools/qe/accessibility/remediation-code-generator.js +1300 -0
  248. package/dist/mcp/tools/qe/accessibility/remediation-code-generator.js.map +1 -0
  249. package/dist/mcp/tools/qe/accessibility/scan-comprehensive.d.ts +138 -0
  250. package/dist/mcp/tools/qe/accessibility/scan-comprehensive.d.ts.map +1 -0
  251. package/dist/mcp/tools/qe/accessibility/scan-comprehensive.js +1326 -0
  252. package/dist/mcp/tools/qe/accessibility/scan-comprehensive.js.map +1 -0
  253. package/dist/mcp/tools/qe/accessibility/video-vision-analyzer.d.ts +50 -0
  254. package/dist/mcp/tools/qe/accessibility/video-vision-analyzer.d.ts.map +1 -0
  255. package/dist/mcp/tools/qe/accessibility/video-vision-analyzer.js +469 -0
  256. package/dist/mcp/tools/qe/accessibility/video-vision-analyzer.js.map +1 -0
  257. package/dist/mcp/tools/qe/accessibility/webvtt-generator.d.ts +193 -0
  258. package/dist/mcp/tools/qe/accessibility/webvtt-generator.d.ts.map +1 -0
  259. package/dist/mcp/tools/qe/accessibility/webvtt-generator.js +511 -0
  260. package/dist/mcp/tools/qe/accessibility/webvtt-generator.js.map +1 -0
  261. package/dist/mcp/tools.d.ts +1 -0
  262. package/dist/mcp/tools.d.ts.map +1 -1
  263. package/dist/mcp/tools.js +61 -0
  264. package/dist/mcp/tools.js.map +1 -1
  265. package/dist/output/AIActionSuggester.d.ts +98 -0
  266. package/dist/output/AIActionSuggester.d.ts.map +1 -0
  267. package/dist/output/AIActionSuggester.js +499 -0
  268. package/dist/output/AIActionSuggester.js.map +1 -0
  269. package/dist/output/CLIOutputHelper.d.ts +169 -0
  270. package/dist/output/CLIOutputHelper.d.ts.map +1 -0
  271. package/dist/output/CLIOutputHelper.js +320 -0
  272. package/dist/output/CLIOutputHelper.js.map +1 -0
  273. package/dist/output/OutputFormatter.d.ts +764 -0
  274. package/dist/output/OutputFormatter.d.ts.map +1 -0
  275. package/dist/output/OutputFormatter.js +125 -0
  276. package/dist/output/OutputFormatter.js.map +1 -0
  277. package/dist/output/OutputFormatterImpl.d.ts +131 -0
  278. package/dist/output/OutputFormatterImpl.d.ts.map +1 -0
  279. package/dist/output/OutputFormatterImpl.js +556 -0
  280. package/dist/output/OutputFormatterImpl.js.map +1 -0
  281. package/dist/output/examples.d.ts +38 -0
  282. package/dist/output/examples.d.ts.map +1 -0
  283. package/dist/output/examples.js +503 -0
  284. package/dist/output/examples.js.map +1 -0
  285. package/dist/output/index.d.ts +16 -0
  286. package/dist/output/index.d.ts.map +1 -0
  287. package/dist/output/index.js +58 -0
  288. package/dist/output/index.js.map +1 -0
  289. package/dist/providers/HybridRouter.d.ts +34 -3
  290. package/dist/providers/HybridRouter.d.ts.map +1 -1
  291. package/dist/providers/HybridRouter.js +69 -4
  292. package/dist/providers/HybridRouter.js.map +1 -1
  293. package/dist/providers/LLMProviderFactory.d.ts +68 -1
  294. package/dist/providers/LLMProviderFactory.d.ts.map +1 -1
  295. package/dist/providers/LLMProviderFactory.js +173 -6
  296. package/dist/providers/LLMProviderFactory.js.map +1 -1
  297. package/dist/providers/OpenRouterProvider.d.ts +150 -0
  298. package/dist/providers/OpenRouterProvider.d.ts.map +1 -0
  299. package/dist/providers/OpenRouterProvider.js +545 -0
  300. package/dist/providers/OpenRouterProvider.js.map +1 -0
  301. package/dist/providers/RuvllmProvider.d.ts +130 -16
  302. package/dist/providers/RuvllmProvider.d.ts.map +1 -1
  303. package/dist/providers/RuvllmProvider.js +399 -83
  304. package/dist/providers/RuvllmProvider.js.map +1 -1
  305. package/dist/providers/index.d.ts +33 -4
  306. package/dist/providers/index.d.ts.map +1 -1
  307. package/dist/providers/index.js +72 -21
  308. package/dist/providers/index.js.map +1 -1
  309. package/dist/telemetry/instrumentation/agent.d.ts +1 -1
  310. package/dist/telemetry/instrumentation/agent.js +1 -1
  311. package/dist/telemetry/instrumentation/index.d.ts +1 -1
  312. package/dist/telemetry/instrumentation/index.js +1 -1
  313. package/dist/types/index.d.ts +2 -1
  314. package/dist/types/index.d.ts.map +1 -1
  315. package/dist/types/index.js +2 -0
  316. package/dist/types/index.js.map +1 -1
  317. package/dist/types/ruvllm.d.ts +97 -0
  318. package/dist/types/ruvllm.d.ts.map +1 -0
  319. package/dist/types/ruvllm.js +46 -0
  320. package/dist/types/ruvllm.js.map +1 -0
  321. package/dist/utils/ruvllm-loader.d.ts +94 -0
  322. package/dist/utils/ruvllm-loader.d.ts.map +1 -0
  323. package/dist/utils/ruvllm-loader.js +87 -0
  324. package/dist/utils/ruvllm-loader.js.map +1 -0
  325. package/docs/reference/agents.md +36 -1
  326. package/package.json +7 -2
@@ -0,0 +1,777 @@
1
+ /**
2
+ * Binary Metadata Cache - TypeScript Interface Definitions
3
+ *
4
+ * High-performance binary caching system for pattern metadata using FlatBuffers.
5
+ * Achieves 10x faster test discovery (500ms → 50ms) by reducing pattern load
6
+ * time from 32ms (SQLite baseline) to <5ms (binary cache target).
7
+ *
8
+ * Architecture:
9
+ * - Format: FlatBuffers (zero-copy deserialization)
10
+ * - Versioning: Semantic versioning (major.minor.patch)
11
+ * - Validation: SHA-256 checksum
12
+ * - Fallback: Graceful degradation to SQLite on corruption
13
+ * - Invalidation: Event-based + TTL-based expiration
14
+ *
15
+ * Performance Targets:
16
+ * - Pattern load time: <5ms (1000 patterns)
17
+ * - Embedding access: <0.15ms (768-dim Float32Array)
18
+ * - Cache hit rate: >95%
19
+ * - Test discovery: <50ms (end-to-end)
20
+ *
21
+ * @module core/cache/BinaryMetadataCache
22
+ * @version 1.0.0
23
+ */
24
+ import type { TestPattern } from '../memory/IPatternStore';
25
+ /**
26
+ * Binary cache format version
27
+ */
28
+ export interface CacheVersion {
29
+ /** Major version (breaking schema changes) */
30
+ major: number;
31
+ /** Minor version (backward-compatible additions) */
32
+ minor: number;
33
+ /** Patch version (non-breaking optimizations) */
34
+ patch: number;
35
+ }
36
+ /**
37
+ * Root binary cache container
38
+ *
39
+ * Represents the entire cached state of pattern metadata, agent configurations,
40
+ * and pre-built search indexes. Serialized to disk using FlatBuffers for
41
+ * zero-copy access and fast deserialization.
42
+ */
43
+ export interface BinaryCache {
44
+ /** Cache format version (encoded as uint32: major << 16 | minor << 8 | patch) */
45
+ version: number;
46
+ /** Cache generation timestamp (Unix milliseconds) */
47
+ timestamp: number;
48
+ /** SHA-256 checksum for integrity validation (hex string) */
49
+ checksum: string;
50
+ /** Pattern metadata entries */
51
+ patterns: PatternEntry[];
52
+ /** Agent configuration cache */
53
+ agentConfigs: AgentConfigEntry[];
54
+ /** Pre-built search indexes for fast lookup */
55
+ indexes: CacheIndexData;
56
+ }
57
+ /**
58
+ * Pattern metadata entry in binary cache
59
+ *
60
+ * Optimized layout for fast deserialization:
61
+ * - Embedding stored as Float32Array (zero-copy access)
62
+ * - Strings interned for memory efficiency
63
+ * - Metadata stored inline for cache locality
64
+ */
65
+ export interface PatternEntry {
66
+ /** Pattern unique ID */
67
+ id: string;
68
+ /** Pattern type (e.g., "unit-test", "integration-test") */
69
+ type: string;
70
+ /** Domain/category (e.g., "api", "ui") */
71
+ domain: string;
72
+ /** Test framework (e.g., "jest", "vitest") */
73
+ framework: string;
74
+ /** Vector embedding (768-dim, zero-copy access) */
75
+ embedding: Float32Array;
76
+ /** Pattern content/template */
77
+ content: string;
78
+ /** Extended metadata */
79
+ metadata: PatternMetadata;
80
+ }
81
+ /**
82
+ * Pattern metadata (inline in PatternEntry)
83
+ */
84
+ export interface PatternMetadata {
85
+ /** Code coverage score (0.0-1.0) */
86
+ coverage: number;
87
+ /** Flakiness probability (0.0-1.0) */
88
+ flakinessScore: number;
89
+ /** Test verdict */
90
+ verdict: 'success' | 'failure' | 'flaky' | 'unknown';
91
+ /** Creation timestamp (Unix milliseconds) */
92
+ createdAt: number;
93
+ /** Last usage timestamp (Unix milliseconds) */
94
+ lastUsed: number;
95
+ /** Usage counter */
96
+ usageCount: number;
97
+ /** Success counter */
98
+ successCount: number;
99
+ }
100
+ /**
101
+ * Agent configuration entry in cache
102
+ */
103
+ export interface AgentConfigEntry {
104
+ /** Agent unique ID */
105
+ agentId: string;
106
+ /** Agent type (e.g., "test-generator", "coverage-analyzer") */
107
+ type: string;
108
+ /** JSON-serialized configuration */
109
+ configJson: string;
110
+ /** Configuration version */
111
+ version: string;
112
+ /** Last update timestamp (Unix milliseconds) */
113
+ updatedAt: number;
114
+ }
115
+ /**
116
+ * Pre-built search indexes for O(1) lookup
117
+ *
118
+ * Indexes are computed at cache generation time to avoid runtime overhead.
119
+ * Supports filtering by domain, type, and framework.
120
+ */
121
+ export interface CacheIndexData {
122
+ /** Domain → pattern IDs mapping */
123
+ domainIndex: Map<string, string[]>;
124
+ /** Type → pattern IDs mapping */
125
+ typeIndex: Map<string, string[]>;
126
+ /** Framework → pattern IDs mapping */
127
+ frameworkIndex: Map<string, string[]>;
128
+ }
129
+ /**
130
+ * Cache serializer interface
131
+ *
132
+ * Handles encoding/decoding of cache data to/from binary format using FlatBuffers.
133
+ * Supports atomic writes and checksum computation.
134
+ */
135
+ export interface CacheSerializer {
136
+ /**
137
+ * Encode cache data to binary buffer
138
+ *
139
+ * @param cache - Cache data to serialize
140
+ * @returns Binary buffer (Uint8Array) ready for disk write
141
+ * @throws {SerializationError} If encoding fails
142
+ */
143
+ encode(cache: BinaryCache): Uint8Array;
144
+ /**
145
+ * Decode binary buffer to cache data
146
+ *
147
+ * @param buffer - Binary buffer from disk read
148
+ * @returns Decoded cache data with zero-copy embeddings
149
+ * @throws {DeserializationError} If decoding fails
150
+ */
151
+ decode(buffer: Uint8Array): BinaryCache;
152
+ /**
153
+ * Compute SHA-256 checksum of cache data
154
+ *
155
+ * @param buffer - Binary buffer to checksum
156
+ * @returns SHA-256 hash as hex string
157
+ */
158
+ computeChecksum(buffer: Uint8Array): Promise<string>;
159
+ /**
160
+ * Encode cache version to uint32
161
+ *
162
+ * Format: (major << 16) | (minor << 8) | patch
163
+ * Example: v1.2.3 → 0x00010203 (66051)
164
+ *
165
+ * @param version - Semantic version
166
+ * @returns Encoded version as uint32
167
+ */
168
+ encodeVersion(version: CacheVersion): number;
169
+ /**
170
+ * Decode uint32 to cache version
171
+ *
172
+ * @param encoded - Encoded version uint32
173
+ * @returns Semantic version
174
+ */
175
+ decodeVersion(encoded: number): CacheVersion;
176
+ }
177
+ /**
178
+ * Cache validator interface
179
+ *
180
+ * Validates cache integrity and version compatibility.
181
+ * Ensures data consistency and prevents use of corrupted caches.
182
+ */
183
+ export interface CacheValidator {
184
+ /**
185
+ * Validate cache integrity
186
+ *
187
+ * Performs checksum validation and version compatibility check.
188
+ *
189
+ * @param buffer - Binary cache buffer
190
+ * @param expectedChecksum - Expected SHA-256 checksum
191
+ * @returns Validation result with error details
192
+ */
193
+ validate(buffer: Uint8Array, expectedChecksum: string): Promise<ValidationResult>;
194
+ /**
195
+ * Check version compatibility
196
+ *
197
+ * @param cacheVersion - Version from cache header
198
+ * @param codeVersion - Current code version
199
+ * @returns Compatibility result
200
+ */
201
+ isVersionCompatible(cacheVersion: CacheVersion, codeVersion: CacheVersion): boolean;
202
+ /**
203
+ * Validate pattern entry
204
+ *
205
+ * Checks for required fields and data integrity.
206
+ *
207
+ * @param entry - Pattern entry to validate
208
+ * @returns True if valid, false otherwise
209
+ */
210
+ isValidPatternEntry(entry: PatternEntry): boolean;
211
+ }
212
+ /**
213
+ * Validation result
214
+ */
215
+ export interface ValidationResult {
216
+ /** Overall validation success */
217
+ valid: boolean;
218
+ /** Checksum validation passed */
219
+ checksumValid: boolean;
220
+ /** Version compatibility check passed */
221
+ versionCompatible: boolean;
222
+ /** Error message (if validation failed) */
223
+ error?: string;
224
+ /** Computed checksum (for debugging) */
225
+ computedChecksum?: string;
226
+ /** Cache version (for debugging) */
227
+ cacheVersion?: CacheVersion;
228
+ }
229
+ /**
230
+ * Cache invalidation event
231
+ */
232
+ export interface CacheInvalidation {
233
+ /** Invalidation trigger type */
234
+ trigger: 'pattern_stored' | 'pattern_deleted' | 'config_updated' | 'schema_migration' | 'manual' | 'ttl_expired';
235
+ /** Event timestamp (Unix milliseconds) */
236
+ timestamp: number;
237
+ /** Whether immediate cache rebuild is required */
238
+ requiresRebuild: boolean;
239
+ /** Additional metadata */
240
+ metadata?: Record<string, any>;
241
+ }
242
+ /**
243
+ * Cache invalidator interface
244
+ *
245
+ * Manages cache lifecycle and invalidation logic.
246
+ * Supports event-based and TTL-based invalidation.
247
+ */
248
+ export interface CacheInvalidator {
249
+ /**
250
+ * Mark cache as stale
251
+ *
252
+ * @param event - Invalidation event
253
+ */
254
+ markStale(event: CacheInvalidation): void;
255
+ /**
256
+ * Check if cache is valid
257
+ *
258
+ * @param cacheTimestamp - Cache generation timestamp
259
+ * @returns True if cache is valid and not stale
260
+ */
261
+ isCacheValid(cacheTimestamp: number): boolean;
262
+ /**
263
+ * Check if cache is fresh (within TTL)
264
+ *
265
+ * @param cacheTimestamp - Cache generation timestamp
266
+ * @param ttl - Time-to-live in milliseconds
267
+ * @returns True if cache age < TTL
268
+ */
269
+ isCacheFresh(cacheTimestamp: number, ttl: number): boolean;
270
+ /**
271
+ * Check if background rebuild should be triggered
272
+ *
273
+ * Typically triggers when cache age exceeds 80% of TTL.
274
+ *
275
+ * @param cacheTimestamp - Cache generation timestamp
276
+ * @param ttl - Time-to-live in milliseconds
277
+ * @returns True if background rebuild recommended
278
+ */
279
+ shouldBackgroundRebuild(cacheTimestamp: number, ttl: number): boolean;
280
+ /**
281
+ * Schedule cache rebuild
282
+ *
283
+ * @param background - Whether to rebuild in background
284
+ */
285
+ scheduleCacheRebuild(background: boolean): void;
286
+ }
287
+ /**
288
+ * Cache configuration
289
+ */
290
+ export interface BinaryCacheConfig {
291
+ /** Enable binary cache (feature flag) */
292
+ enabled: boolean;
293
+ /** Cache file path (default: .aqe/cache/patterns.bin) */
294
+ cachePath: string;
295
+ /** Maximum cache age in milliseconds (default: 3600000 = 1 hour) */
296
+ maxAge: number;
297
+ /** Cache validation check interval (default: 300000 = 5 min) */
298
+ checkInterval: number;
299
+ /** Enable background cache rebuild (default: true) */
300
+ backgroundRebuild: boolean;
301
+ /** Graceful fallback to SQLite on errors (default: true) */
302
+ fallbackToSQLite: boolean;
303
+ /** Current cache format version */
304
+ version: CacheVersion;
305
+ /** Enable performance metrics collection (default: true) */
306
+ enableMetrics: boolean;
307
+ }
308
+ /**
309
+ * Cache metrics for monitoring
310
+ */
311
+ export interface CacheMetrics {
312
+ /** Total cache hits */
313
+ cacheHits: number;
314
+ /** Total cache misses */
315
+ cacheMisses: number;
316
+ /** Cache hit rate (0.0-1.0) */
317
+ cacheHitRate: number;
318
+ /** Average cache load time (milliseconds) */
319
+ avgCacheLoadTime: number;
320
+ /** Average SQLite fallback time (milliseconds) */
321
+ avgSQLiteFallbackTime: number;
322
+ /** Cache corruption count */
323
+ cacheCorruptionCount: number;
324
+ /** Cache rebuild count */
325
+ cacheRebuildCount: number;
326
+ /** Last cache generation timestamp */
327
+ lastCacheGenerationTime: number;
328
+ /** Cache file size (bytes) */
329
+ cacheFileSize: number;
330
+ /** Number of patterns in cache */
331
+ patternCount: number;
332
+ }
333
+ /**
334
+ * Binary cache reader interface (zero-copy access)
335
+ *
336
+ * Provides read-only access to cached pattern metadata with minimal overhead.
337
+ * Uses memory-mapped files and FlatBuffers for zero-copy deserialization.
338
+ */
339
+ export interface BinaryCacheReader {
340
+ /**
341
+ * Initialize cache reader
342
+ *
343
+ * Loads cache file, validates checksum, and prepares for zero-copy access.
344
+ *
345
+ * @param cachePath - Path to binary cache file
346
+ * @param config - Cache configuration
347
+ * @returns Initialization success status
348
+ * @throws {CacheLoadError} If cache loading fails
349
+ */
350
+ initialize(cachePath: string, config: BinaryCacheConfig): Promise<boolean>;
351
+ /**
352
+ * Get pattern by ID (zero-copy)
353
+ *
354
+ * @param id - Pattern unique ID
355
+ * @returns Pattern entry or null if not found
356
+ */
357
+ getPattern(id: string): PatternEntry | null;
358
+ /**
359
+ * Get patterns by domain (O(1) lookup)
360
+ *
361
+ * @param domain - Domain filter
362
+ * @returns Array of pattern entries
363
+ */
364
+ getPatternsByDomain(domain: string): PatternEntry[];
365
+ /**
366
+ * Get patterns by type (O(1) lookup)
367
+ *
368
+ * @param type - Type filter
369
+ * @returns Array of pattern entries
370
+ */
371
+ getPatternsByType(type: string): PatternEntry[];
372
+ /**
373
+ * Get patterns by framework (O(1) lookup)
374
+ *
375
+ * @param framework - Framework filter
376
+ * @returns Array of pattern entries
377
+ */
378
+ getPatternsByFramework(framework: string): PatternEntry[];
379
+ /**
380
+ * Get all patterns (zero-copy)
381
+ *
382
+ * @returns Array of all pattern entries
383
+ */
384
+ getAllPatterns(): PatternEntry[];
385
+ /**
386
+ * Get agent configuration by ID
387
+ *
388
+ * @param agentId - Agent unique ID
389
+ * @returns Agent config entry or null if not found
390
+ */
391
+ getAgentConfig(agentId: string): AgentConfigEntry | null;
392
+ /**
393
+ * Get cache metadata
394
+ *
395
+ * @returns Cache version, timestamp, and statistics
396
+ */
397
+ getCacheMetadata(): {
398
+ version: CacheVersion;
399
+ timestamp: number;
400
+ patternCount: number;
401
+ agentConfigCount: number;
402
+ fileSize: number;
403
+ };
404
+ /**
405
+ * Check if cache is valid and fresh
406
+ *
407
+ * @returns True if cache is usable
408
+ */
409
+ isValid(): boolean;
410
+ /**
411
+ * Close cache reader and release resources
412
+ */
413
+ close(): void;
414
+ }
415
+ /**
416
+ * Binary cache builder interface
417
+ *
418
+ * Builds binary cache from SQLite data source.
419
+ * Handles serialization, index generation, and atomic writes.
420
+ */
421
+ export interface BinaryCacheBuilder {
422
+ /**
423
+ * Build cache from SQLite patterns
424
+ *
425
+ * @param patterns - Array of test patterns from SQLite
426
+ * @param agentConfigs - Array of agent configurations
427
+ * @param outputPath - Cache file output path
428
+ * @returns Build success status and metrics
429
+ */
430
+ buildCache(patterns: TestPattern[], agentConfigs: AgentConfigEntry[], outputPath: string): Promise<CacheBuildResult>;
431
+ /**
432
+ * Build cache indexes
433
+ *
434
+ * Pre-computes domain, type, and framework indexes for O(1) lookup.
435
+ *
436
+ * @param patterns - Array of pattern entries
437
+ * @returns Index data structure
438
+ */
439
+ buildIndexes(patterns: PatternEntry[]): CacheIndexData;
440
+ /**
441
+ * Write cache to disk atomically
442
+ *
443
+ * Uses atomic write pattern (write to temp, validate, rename) to prevent
444
+ * partial writes and corruption.
445
+ *
446
+ * @param buffer - Binary cache buffer
447
+ * @param outputPath - Target file path
448
+ * @returns Write success status
449
+ */
450
+ writeAtomic(buffer: Uint8Array, outputPath: string): Promise<boolean>;
451
+ }
452
+ /**
453
+ * Cache build result
454
+ */
455
+ export interface CacheBuildResult {
456
+ /** Build success status */
457
+ success: boolean;
458
+ /** Build duration (milliseconds) */
459
+ duration: number;
460
+ /** Number of patterns cached */
461
+ patternCount: number;
462
+ /** Number of agent configs cached */
463
+ agentConfigCount: number;
464
+ /** Cache file size (bytes) */
465
+ cacheFileSize: number;
466
+ /** Cache version */
467
+ version: CacheVersion;
468
+ /** SHA-256 checksum */
469
+ checksum: string;
470
+ /** Error message (if build failed) */
471
+ error?: string;
472
+ }
473
+ /**
474
+ * Cache load error types
475
+ */
476
+ export type CacheLoadErrorType = 'file_not_found' | 'permission_denied' | 'checksum_mismatch' | 'version_incompatible' | 'corrupted_data' | 'io_error';
477
+ /**
478
+ * Cache load error
479
+ */
480
+ export declare class CacheLoadError extends Error {
481
+ type: CacheLoadErrorType;
482
+ metadata?: Record<string, any> | undefined;
483
+ constructor(type: CacheLoadErrorType, message: string, metadata?: Record<string, any> | undefined);
484
+ }
485
+ /**
486
+ * Serialization error
487
+ */
488
+ export declare class SerializationError extends Error {
489
+ cause?: Error | undefined;
490
+ constructor(message: string, cause?: Error | undefined);
491
+ }
492
+ /**
493
+ * Deserialization error
494
+ */
495
+ export declare class DeserializationError extends Error {
496
+ cause?: Error | undefined;
497
+ constructor(message: string, cause?: Error | undefined);
498
+ }
499
+ /**
500
+ * Default cache configuration
501
+ */
502
+ export declare const DEFAULT_CACHE_CONFIG: BinaryCacheConfig;
503
+ /**
504
+ * Cache file magic number (0x41514543 = "AQEC" = Agentic QE Cache)
505
+ */
506
+ export declare const CACHE_MAGIC_NUMBER = 1095845187;
507
+ /**
508
+ * Cache file header size (bytes)
509
+ */
510
+ export declare const CACHE_HEADER_SIZE = 64;
511
+ /**
512
+ * Current cache format version
513
+ */
514
+ export declare const CACHE_VERSION: CacheVersion;
515
+ /**
516
+ * Helper: Convert TestPattern to PatternEntry
517
+ *
518
+ * Maps from IPatternStore.TestPattern to cache-optimized PatternEntry format.
519
+ *
520
+ * @param pattern - Test pattern from SQLite
521
+ * @returns Pattern entry for cache
522
+ */
523
+ export declare function testPatternToEntry(pattern: TestPattern): PatternEntry;
524
+ /**
525
+ * Helper: Convert PatternEntry to TestPattern
526
+ *
527
+ * Maps from cache-optimized PatternEntry to IPatternStore.TestPattern format.
528
+ *
529
+ * @param entry - Pattern entry from cache
530
+ * @returns Test pattern for application use
531
+ */
532
+ export declare function entryToTestPattern(entry: PatternEntry): TestPattern;
533
+ /**
534
+ * TRM Pattern type classification
535
+ */
536
+ export type TRMPatternType = 'reasoning' | 'refinement' | 'convergence' | 'quality' | 'trajectory';
537
+ /**
538
+ * TRM Pattern entry in binary cache
539
+ *
540
+ * Optimized layout for caching TRM reasoning patterns:
541
+ * - Input/output embeddings for similarity search
542
+ * - Quality metrics for pattern selection
543
+ * - Trajectory data for learning
544
+ */
545
+ export interface TRMPatternEntry {
546
+ /** Pattern unique ID */
547
+ id: string;
548
+ /** TRM pattern type */
549
+ type: TRMPatternType;
550
+ /** Input embedding (768-dim, zero-copy access) */
551
+ inputEmbedding: Float32Array;
552
+ /** Output embedding (768-dim, zero-copy access) */
553
+ outputEmbedding: Float32Array;
554
+ /** Input text (query/prompt) */
555
+ inputText: string;
556
+ /** Output text (response) */
557
+ outputText: string;
558
+ /** TRM-specific metadata */
559
+ metadata: TRMPatternMetadata;
560
+ }
561
+ /**
562
+ * TRM Pattern metadata
563
+ */
564
+ export interface TRMPatternMetadata {
565
+ /** Final quality score (0.0-1.0) */
566
+ quality: number;
567
+ /** Quality metric used */
568
+ qualityMetric: 'coherence' | 'coverage' | 'diversity';
569
+ /** Number of TRM iterations */
570
+ iterations: number;
571
+ /** Convergence achieved */
572
+ converged: boolean;
573
+ /** Confidence score (0.0-1.0) */
574
+ confidence: number;
575
+ /** Creation timestamp (Unix milliseconds) */
576
+ createdAt: number;
577
+ /** Last usage timestamp (Unix milliseconds) */
578
+ lastUsed: number;
579
+ /** Usage counter */
580
+ usageCount: number;
581
+ /** Average latency per iteration (ms) */
582
+ avgIterationLatency: number;
583
+ /** LoRA adapter ID used (if any) */
584
+ loraAdapterId?: string;
585
+ }
586
+ /**
587
+ * TRM cache index data for O(1) lookup
588
+ */
589
+ export interface TRMCacheIndexData {
590
+ /** Type → pattern IDs mapping */
591
+ typeIndex: Map<TRMPatternType, string[]>;
592
+ /** Quality metric → pattern IDs mapping */
593
+ metricIndex: Map<string, string[]>;
594
+ /** Converged → pattern IDs mapping */
595
+ convergedIndex: Map<boolean, string[]>;
596
+ /** Quality bucket (0.0-0.25, 0.25-0.5, 0.5-0.75, 0.75-1.0) → pattern IDs */
597
+ qualityBucketIndex: Map<string, string[]>;
598
+ }
599
+ /**
600
+ * TRM Binary Cache extension
601
+ *
602
+ * Extends the base BinaryCache with TRM-specific pattern storage.
603
+ */
604
+ export interface TRMBinaryCache extends BinaryCache {
605
+ /** TRM pattern entries */
606
+ trmPatterns: TRMPatternEntry[];
607
+ /** TRM pattern indexes */
608
+ trmIndexes: TRMCacheIndexData;
609
+ /** LoRA adapter configurations */
610
+ loraAdapters: LoRAAdapterEntry[];
611
+ }
612
+ /**
613
+ * LoRA adapter entry in cache
614
+ */
615
+ export interface LoRAAdapterEntry {
616
+ /** Adapter unique ID */
617
+ id: string;
618
+ /** Adapter name/description */
619
+ name: string;
620
+ /** LoRA rank */
621
+ rank: number;
622
+ /** LoRA alpha scaling factor */
623
+ alpha: number;
624
+ /** Target modules */
625
+ targetModules: string[];
626
+ /** Creation timestamp */
627
+ createdAt: number;
628
+ /** Training iterations */
629
+ trainingIterations: number;
630
+ /** Final loss value */
631
+ finalLoss: number;
632
+ }
633
+ /**
634
+ * TRM cache reader interface
635
+ *
636
+ * Extends BinaryCacheReader with TRM pattern access.
637
+ */
638
+ export interface TRMBinaryCacheReader extends BinaryCacheReader {
639
+ /**
640
+ * Get TRM pattern by ID
641
+ *
642
+ * @param id - Pattern unique ID
643
+ * @returns TRM pattern entry or null if not found
644
+ */
645
+ getTRMPattern(id: string): TRMPatternEntry | null;
646
+ /**
647
+ * Get TRM patterns by type
648
+ *
649
+ * @param type - TRM pattern type filter
650
+ * @returns Array of TRM pattern entries
651
+ */
652
+ getTRMPatternsByType(type: TRMPatternType): TRMPatternEntry[];
653
+ /**
654
+ * Get converged TRM patterns
655
+ *
656
+ * @returns Array of TRM patterns that achieved convergence
657
+ */
658
+ getConvergedPatterns(): TRMPatternEntry[];
659
+ /**
660
+ * Get high-quality TRM patterns (quality >= 0.75)
661
+ *
662
+ * @returns Array of high-quality TRM pattern entries
663
+ */
664
+ getHighQualityPatterns(): TRMPatternEntry[];
665
+ /**
666
+ * Search TRM patterns by input similarity
667
+ *
668
+ * @param embedding - Query embedding (768-dim)
669
+ * @param k - Number of results to return
670
+ * @returns Array of similar TRM patterns with scores
671
+ */
672
+ searchByInputSimilarity(embedding: Float32Array, k: number): Array<{
673
+ pattern: TRMPatternEntry;
674
+ score: number;
675
+ }>;
676
+ /**
677
+ * Get all TRM patterns
678
+ *
679
+ * @returns Array of all TRM pattern entries
680
+ */
681
+ getAllTRMPatterns(): TRMPatternEntry[];
682
+ /**
683
+ * Get LoRA adapter by ID
684
+ *
685
+ * @param id - Adapter unique ID
686
+ * @returns LoRA adapter entry or null if not found
687
+ */
688
+ getLoRAAdapter(id: string): LoRAAdapterEntry | null;
689
+ /**
690
+ * Get TRM cache statistics
691
+ *
692
+ * @returns TRM-specific cache statistics
693
+ */
694
+ getTRMCacheStats(): TRMCacheStats;
695
+ }
696
+ /**
697
+ * TRM cache statistics
698
+ */
699
+ export interface TRMCacheStats {
700
+ /** Total TRM patterns */
701
+ totalPatterns: number;
702
+ /** Converged patterns count */
703
+ convergedCount: number;
704
+ /** High-quality patterns count (quality >= 0.75) */
705
+ highQualityCount: number;
706
+ /** Average quality score */
707
+ avgQuality: number;
708
+ /** Average iterations per pattern */
709
+ avgIterations: number;
710
+ /** LoRA adapters count */
711
+ loraAdaptersCount: number;
712
+ /** Cache age (milliseconds) */
713
+ cacheAge: number;
714
+ }
715
+ /**
716
+ * TRM cache builder interface
717
+ *
718
+ * Extends BinaryCacheBuilder with TRM pattern support.
719
+ */
720
+ export interface TRMBinaryCacheBuilder extends BinaryCacheBuilder {
721
+ /**
722
+ * Build TRM cache from patterns
723
+ *
724
+ * @param trmPatterns - Array of TRM patterns
725
+ * @param loraAdapters - Array of LoRA adapter configs
726
+ * @param outputPath - Cache file output path
727
+ * @returns Build success status and metrics
728
+ */
729
+ buildTRMCache(trmPatterns: TRMPatternEntry[], loraAdapters: LoRAAdapterEntry[], outputPath: string): Promise<TRMCacheBuildResult>;
730
+ /**
731
+ * Build TRM cache indexes
732
+ *
733
+ * @param patterns - Array of TRM pattern entries
734
+ * @returns TRM index data structure
735
+ */
736
+ buildTRMIndexes(patterns: TRMPatternEntry[]): TRMCacheIndexData;
737
+ }
738
+ /**
739
+ * TRM cache build result
740
+ */
741
+ export interface TRMCacheBuildResult extends CacheBuildResult {
742
+ /** Number of TRM patterns cached */
743
+ trmPatternCount: number;
744
+ /** Number of LoRA adapters cached */
745
+ loraAdapterCount: number;
746
+ /** Converged patterns count */
747
+ convergedPatternCount: number;
748
+ /** Average quality of cached patterns */
749
+ avgQuality: number;
750
+ }
751
+ /**
752
+ * Default TRM cache configuration
753
+ */
754
+ export declare const DEFAULT_TRM_CACHE_CONFIG: BinaryCacheConfig;
755
+ /**
756
+ * TRM cache file magic number (0x54524D43 = "TRMC" = TRM Cache)
757
+ */
758
+ export declare const TRM_CACHE_MAGIC_NUMBER = 1414679875;
759
+ /**
760
+ * Helper: Compute quality bucket for indexing
761
+ *
762
+ * @param quality - Quality score (0.0-1.0)
763
+ * @returns Quality bucket string
764
+ */
765
+ export declare function getQualityBucket(quality: number): string;
766
+ /**
767
+ * Helper: Create TRM pattern entry
768
+ *
769
+ * @param input - Input text
770
+ * @param output - Output text
771
+ * @param inputEmb - Input embedding
772
+ * @param outputEmb - Output embedding
773
+ * @param metadata - TRM metadata
774
+ * @returns TRM pattern entry
775
+ */
776
+ export declare function createTRMPatternEntry(input: string, output: string, inputEmb: number[], outputEmb: number[], metadata: Partial<TRMPatternMetadata>): TRMPatternEntry;
777
+ //# sourceMappingURL=BinaryMetadataCache.d.ts.map