kynjal-cli 4.0.0 → 4.0.1

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 (502) hide show
  1. package/dist/src/appliance/gguf-engine.d.ts +91 -0
  2. package/dist/src/appliance/gguf-engine.d.ts.map +1 -0
  3. package/dist/src/appliance/gguf-engine.js +286 -525
  4. package/dist/src/appliance/gguf-engine.js.map +1 -1
  5. package/dist/src/appliance/ruvllm-bridge.d.ts +102 -0
  6. package/dist/src/appliance/ruvllm-bridge.d.ts.map +1 -0
  7. package/dist/src/appliance/ruvllm-bridge.js +203 -403
  8. package/dist/src/appliance/ruvllm-bridge.js.map +1 -1
  9. package/dist/src/appliance/rvfa-builder.d.ts +44 -0
  10. package/dist/src/appliance/rvfa-builder.d.ts.map +1 -0
  11. package/dist/src/appliance/rvfa-builder.js +154 -208
  12. package/dist/src/appliance/rvfa-builder.js.map +1 -1
  13. package/dist/src/appliance/rvfa-distribution.d.ts +97 -0
  14. package/dist/src/appliance/rvfa-distribution.d.ts.map +1 -0
  15. package/dist/src/appliance/rvfa-distribution.js +260 -423
  16. package/dist/src/appliance/rvfa-distribution.js.map +1 -1
  17. package/dist/src/appliance/rvfa-format.d.ts +111 -0
  18. package/dist/src/appliance/rvfa-format.d.ts.map +1 -0
  19. package/dist/src/appliance/rvfa-format.js +128 -200
  20. package/dist/src/appliance/rvfa-format.js.map +1 -1
  21. package/dist/src/appliance/rvfa-runner.d.ts +69 -0
  22. package/dist/src/appliance/rvfa-runner.d.ts.map +1 -0
  23. package/dist/src/appliance/rvfa-runner.js +168 -304
  24. package/dist/src/appliance/rvfa-runner.js.map +1 -1
  25. package/dist/src/appliance/rvfa-signing.d.ts +123 -0
  26. package/dist/src/appliance/rvfa-signing.d.ts.map +1 -0
  27. package/dist/src/appliance/rvfa-signing.js +173 -295
  28. package/dist/src/appliance/rvfa-signing.js.map +1 -1
  29. package/dist/src/benchmarks/pretrain/index.d.ts +58 -0
  30. package/dist/src/benchmarks/pretrain/index.d.ts.map +1 -0
  31. package/dist/src/benchmarks/pretrain/index.js +331 -542
  32. package/dist/src/benchmarks/pretrain/index.js.map +1 -1
  33. package/dist/src/commands/agent.js +574 -697
  34. package/dist/src/commands/agent.js.map +1 -1
  35. package/dist/src/commands/analyze.js +1218 -1548
  36. package/dist/src/commands/analyze.js.map +1 -1
  37. package/dist/src/commands/appliance-advanced.js +158 -267
  38. package/dist/src/commands/appliance-advanced.js.map +1 -1
  39. package/dist/src/commands/appliance.js +318 -493
  40. package/dist/src/commands/appliance.js.map +1 -1
  41. package/dist/src/commands/benchmark.js +372 -523
  42. package/dist/src/commands/benchmark.js.map +1 -1
  43. package/dist/src/commands/claims.js +274 -364
  44. package/dist/src/commands/claims.js.map +1 -1
  45. package/dist/src/commands/cleanup.js +113 -157
  46. package/dist/src/commands/cleanup.js.map +1 -1
  47. package/dist/src/commands/completions.js +477 -118
  48. package/dist/src/commands/completions.js.map +1 -1
  49. package/dist/src/commands/config.js +237 -303
  50. package/dist/src/commands/config.js.map +1 -1
  51. package/dist/src/commands/daemon.js +487 -596
  52. package/dist/src/commands/daemon.js.map +1 -1
  53. package/dist/src/commands/deployment.js +194 -275
  54. package/dist/src/commands/deployment.js.map +1 -1
  55. package/dist/src/commands/doctor.js +504 -686
  56. package/dist/src/commands/doctor.js.map +1 -1
  57. package/dist/src/commands/embeddings.js +1293 -1543
  58. package/dist/src/commands/embeddings.js.map +1 -1
  59. package/dist/src/commands/guidance.js +449 -596
  60. package/dist/src/commands/guidance.js.map +1 -1
  61. package/dist/src/commands/hive-mind.js +854 -938
  62. package/dist/src/commands/hive-mind.js.map +1 -1
  63. package/dist/src/commands/hooks.js +3112 -3519
  64. package/dist/src/commands/hooks.js.map +1 -1
  65. package/dist/src/commands/index.d.ts +115 -0
  66. package/dist/src/commands/index.d.ts.map +1 -0
  67. package/dist/src/commands/index.js +126 -308
  68. package/dist/src/commands/index.js.map +1 -1
  69. package/dist/src/commands/init.js +788 -940
  70. package/dist/src/commands/init.js.map +1 -1
  71. package/dist/src/commands/issues.js +383 -558
  72. package/dist/src/commands/issues.js.map +1 -1
  73. package/dist/src/commands/mcp.js +493 -605
  74. package/dist/src/commands/mcp.js.map +1 -1
  75. package/dist/src/commands/memory.js +833 -1026
  76. package/dist/src/commands/memory.js.map +1 -1
  77. package/dist/src/commands/migrate.js +282 -347
  78. package/dist/src/commands/migrate.js.map +1 -1
  79. package/dist/src/commands/neural.js +1289 -1563
  80. package/dist/src/commands/neural.js.map +1 -1
  81. package/dist/src/commands/performance.js +497 -643
  82. package/dist/src/commands/performance.js.map +1 -1
  83. package/dist/src/commands/plugins.js +668 -841
  84. package/dist/src/commands/plugins.js.map +1 -1
  85. package/dist/src/commands/process.js +392 -447
  86. package/dist/src/commands/process.js.map +1 -1
  87. package/dist/src/commands/progress.js +162 -256
  88. package/dist/src/commands/progress.js.map +1 -1
  89. package/dist/src/commands/providers.js +150 -220
  90. package/dist/src/commands/providers.js.map +1 -1
  91. package/dist/src/commands/route.js +520 -665
  92. package/dist/src/commands/route.js.map +1 -1
  93. package/dist/src/commands/ruvector/backup.js +505 -651
  94. package/dist/src/commands/ruvector/backup.js.map +1 -1
  95. package/dist/src/commands/ruvector/benchmark.js +349 -401
  96. package/dist/src/commands/ruvector/benchmark.js.map +1 -1
  97. package/dist/src/commands/ruvector/import.js +224 -266
  98. package/dist/src/commands/ruvector/import.js.map +1 -1
  99. package/dist/src/commands/ruvector/index.js +37 -75
  100. package/dist/src/commands/ruvector/index.js.map +1 -1
  101. package/dist/src/commands/ruvector/init.js +336 -359
  102. package/dist/src/commands/ruvector/init.js.map +1 -1
  103. package/dist/src/commands/ruvector/migrate.js +335 -322
  104. package/dist/src/commands/ruvector/migrate.js.map +1 -1
  105. package/dist/src/commands/ruvector/optimize.js +375 -431
  106. package/dist/src/commands/ruvector/optimize.js.map +1 -1
  107. package/dist/src/commands/ruvector/setup.js +703 -117
  108. package/dist/src/commands/ruvector/setup.js.map +1 -1
  109. package/dist/src/commands/ruvector/status.js +364 -419
  110. package/dist/src/commands/ruvector/status.js.map +1 -1
  111. package/dist/src/commands/security.js +485 -608
  112. package/dist/src/commands/security.js.map +1 -1
  113. package/dist/src/commands/session.js +504 -626
  114. package/dist/src/commands/session.js.map +1 -1
  115. package/dist/src/commands/start.js +267 -364
  116. package/dist/src/commands/start.js.map +1 -1
  117. package/dist/src/commands/status.js +380 -486
  118. package/dist/src/commands/status.js.map +1 -1
  119. package/dist/src/commands/swarm.js +408 -488
  120. package/dist/src/commands/swarm.js.map +1 -1
  121. package/dist/src/commands/task.js +423 -538
  122. package/dist/src/commands/task.js.map +1 -1
  123. package/dist/src/commands/transfer-store.js +322 -412
  124. package/dist/src/commands/transfer-store.js.map +1 -1
  125. package/dist/src/commands/update.js +196 -291
  126. package/dist/src/commands/update.js.map +1 -1
  127. package/dist/src/commands/workflow.js +386 -486
  128. package/dist/src/commands/workflow.js.map +1 -1
  129. package/dist/src/config-adapter.d.ts +15 -0
  130. package/dist/src/config-adapter.d.ts.map +1 -0
  131. package/dist/src/config-adapter.js +38 -39
  132. package/dist/src/config-adapter.js.map +1 -1
  133. package/dist/src/index.d.ts +77 -0
  134. package/dist/src/index.d.ts.map +1 -0
  135. package/dist/src/index.js +309 -411
  136. package/dist/src/index.js.map +1 -1
  137. package/dist/src/infrastructure/in-memory-repositories.d.ts +68 -0
  138. package/dist/src/infrastructure/in-memory-repositories.d.ts.map +1 -0
  139. package/dist/src/infrastructure/in-memory-repositories.js +246 -507
  140. package/dist/src/infrastructure/in-memory-repositories.js.map +1 -1
  141. package/dist/src/init/claudemd-generator.d.ts +25 -0
  142. package/dist/src/init/claudemd-generator.d.ts.map +1 -0
  143. package/dist/src/init/claudemd-generator.js +368 -78
  144. package/dist/src/init/claudemd-generator.js.map +1 -1
  145. package/dist/src/init/executor.d.ts +41 -0
  146. package/dist/src/init/executor.d.ts.map +1 -0
  147. package/dist/src/init/executor.js +1307 -996
  148. package/dist/src/init/executor.js.map +1 -1
  149. package/dist/src/init/helpers-generator.d.ts +60 -0
  150. package/dist/src/init/helpers-generator.d.ts.map +1 -0
  151. package/dist/src/init/helpers-generator.js +657 -12
  152. package/dist/src/init/helpers-generator.js.map +1 -1
  153. package/dist/src/init/index.d.ts +1 -1
  154. package/dist/src/init/index.d.ts.map +1 -1
  155. package/dist/src/init/index.js +1 -1
  156. package/dist/src/init/index.js.map +1 -1
  157. package/dist/src/init/mcp-generator.js +33 -37
  158. package/dist/src/init/mcp-generator.js.map +1 -1
  159. package/dist/src/init/settings-generator.js +76 -77
  160. package/dist/src/init/settings-generator.js.map +1 -1
  161. package/dist/src/init/statusline-generator.js +801 -3
  162. package/dist/src/init/statusline-generator.js.map +1 -1
  163. package/dist/src/init/types.d.ts +1 -1
  164. package/dist/src/init/types.d.ts.map +1 -1
  165. package/dist/src/init/types.js +76 -59
  166. package/dist/src/init/types.js.map +1 -1
  167. package/dist/src/mcp-client.d.ts +92 -0
  168. package/dist/src/mcp-client.d.ts.map +1 -0
  169. package/dist/src/mcp-client.js +81 -125
  170. package/dist/src/mcp-client.js.map +1 -1
  171. package/dist/src/mcp-server.d.ts +161 -0
  172. package/dist/src/mcp-server.d.ts.map +1 -0
  173. package/dist/src/mcp-server.js +470 -757
  174. package/dist/src/mcp-server.js.map +1 -1
  175. package/dist/src/mcp-tools/agent-tools.js +391 -492
  176. package/dist/src/mcp-tools/agent-tools.js.map +1 -1
  177. package/dist/src/mcp-tools/agentdb-tools.js +332 -533
  178. package/dist/src/mcp-tools/agentdb-tools.js.map +1 -1
  179. package/dist/src/mcp-tools/analyze-tools.js +172 -236
  180. package/dist/src/mcp-tools/analyze-tools.js.map +1 -1
  181. package/dist/src/mcp-tools/auto-install.d.ts +83 -0
  182. package/dist/src/mcp-tools/auto-install.d.ts.map +1 -0
  183. package/dist/src/mcp-tools/auto-install.js +80 -142
  184. package/dist/src/mcp-tools/auto-install.js.map +1 -1
  185. package/dist/src/mcp-tools/browser-tools.js +252 -375
  186. package/dist/src/mcp-tools/browser-tools.js.map +1 -1
  187. package/dist/src/mcp-tools/claims-tools.js +473 -565
  188. package/dist/src/mcp-tools/claims-tools.js.map +1 -1
  189. package/dist/src/mcp-tools/config-tools.js +197 -272
  190. package/dist/src/mcp-tools/config-tools.js.map +1 -1
  191. package/dist/src/mcp-tools/coordination-tools.js +500 -572
  192. package/dist/src/mcp-tools/coordination-tools.js.map +1 -1
  193. package/dist/src/mcp-tools/daa-tools.js +286 -364
  194. package/dist/src/mcp-tools/daa-tools.js.map +1 -1
  195. package/dist/src/mcp-tools/embeddings-tools.js +582 -693
  196. package/dist/src/mcp-tools/embeddings-tools.js.map +1 -1
  197. package/dist/src/mcp-tools/github-tools.js +260 -311
  198. package/dist/src/mcp-tools/github-tools.js.map +1 -1
  199. package/dist/src/mcp-tools/hive-mind-tools.js +573 -640
  200. package/dist/src/mcp-tools/hive-mind-tools.js.map +1 -1
  201. package/dist/src/mcp-tools/hooks-tools.js +2215 -2648
  202. package/dist/src/mcp-tools/hooks-tools.js.map +1 -1
  203. package/dist/src/mcp-tools/memory-tools.js +350 -505
  204. package/dist/src/mcp-tools/memory-tools.js.map +1 -1
  205. package/dist/src/mcp-tools/neural-tools.js +315 -412
  206. package/dist/src/mcp-tools/neural-tools.js.map +1 -1
  207. package/dist/src/mcp-tools/performance-tools.js +420 -480
  208. package/dist/src/mcp-tools/performance-tools.js.map +1 -1
  209. package/dist/src/mcp-tools/progress-tools.js +204 -278
  210. package/dist/src/mcp-tools/progress-tools.js.map +1 -1
  211. package/dist/src/mcp-tools/ruvllm-tools.js +163 -279
  212. package/dist/src/mcp-tools/ruvllm-tools.js.map +1 -1
  213. package/dist/src/mcp-tools/security-tools.js +297 -429
  214. package/dist/src/mcp-tools/security-tools.js.map +1 -1
  215. package/dist/src/mcp-tools/session-tools.js +185 -234
  216. package/dist/src/mcp-tools/session-tools.js.map +1 -1
  217. package/dist/src/mcp-tools/swarm-tools.js +207 -260
  218. package/dist/src/mcp-tools/swarm-tools.js.map +1 -1
  219. package/dist/src/mcp-tools/system-tools.js +276 -325
  220. package/dist/src/mcp-tools/system-tools.js.map +1 -1
  221. package/dist/src/mcp-tools/task-tools.js +270 -336
  222. package/dist/src/mcp-tools/task-tools.js.map +1 -1
  223. package/dist/src/mcp-tools/terminal-tools.js +148 -196
  224. package/dist/src/mcp-tools/terminal-tools.js.map +1 -1
  225. package/dist/src/mcp-tools/transfer-tools.js +186 -333
  226. package/dist/src/mcp-tools/transfer-tools.js.map +1 -1
  227. package/dist/src/mcp-tools/types.d.ts +31 -0
  228. package/dist/src/mcp-tools/types.d.ts.map +1 -0
  229. package/dist/src/mcp-tools/wasm-agent-tools.js +133 -280
  230. package/dist/src/mcp-tools/wasm-agent-tools.js.map +1 -1
  231. package/dist/src/mcp-tools/workflow-tools.js +405 -450
  232. package/dist/src/mcp-tools/workflow-tools.js.map +1 -1
  233. package/dist/src/memory/ewc-consolidation.d.ts +295 -0
  234. package/dist/src/memory/ewc-consolidation.d.ts.map +1 -0
  235. package/dist/src/memory/ewc-consolidation.js +190 -303
  236. package/dist/src/memory/ewc-consolidation.js.map +1 -1
  237. package/dist/src/memory/intelligence.d.ts +338 -0
  238. package/dist/src/memory/intelligence.d.ts.map +1 -0
  239. package/dist/src/memory/intelligence.js +569 -794
  240. package/dist/src/memory/intelligence.js.map +1 -1
  241. package/dist/src/memory/memory-bridge.d.ts +407 -0
  242. package/dist/src/memory/memory-bridge.d.ts.map +1 -0
  243. package/dist/src/memory/memory-bridge.js +1170 -1640
  244. package/dist/src/memory/memory-bridge.js.map +1 -1
  245. package/dist/src/memory/memory-initializer.d.ts +412 -0
  246. package/dist/src/memory/memory-initializer.d.ts.map +1 -0
  247. package/dist/src/memory/memory-initializer.js +1836 -1851
  248. package/dist/src/memory/memory-initializer.js.map +1 -1
  249. package/dist/src/memory/sona-optimizer.d.ts +227 -0
  250. package/dist/src/memory/sona-optimizer.d.ts.map +1 -0
  251. package/dist/src/memory/sona-optimizer.js +199 -329
  252. package/dist/src/memory/sona-optimizer.js.map +1 -1
  253. package/dist/src/output.d.ts +2 -2
  254. package/dist/src/output.d.ts.map +1 -1
  255. package/dist/src/output.js +242 -272
  256. package/dist/src/output.js.map +1 -1
  257. package/dist/src/parser.d.ts +51 -0
  258. package/dist/src/parser.d.ts.map +1 -0
  259. package/dist/src/parser.js +140 -187
  260. package/dist/src/parser.js.map +1 -1
  261. package/dist/src/plugins/manager.d.ts +133 -0
  262. package/dist/src/plugins/manager.d.ts.map +1 -0
  263. package/dist/src/plugins/manager.js +285 -521
  264. package/dist/src/plugins/manager.js.map +1 -1
  265. package/dist/src/plugins/store/discovery.d.ts +88 -0
  266. package/dist/src/plugins/store/discovery.d.ts.map +1 -0
  267. package/dist/src/plugins/store/discovery.js +271 -358
  268. package/dist/src/plugins/store/discovery.js.map +1 -1
  269. package/dist/src/plugins/store/index.d.ts +76 -0
  270. package/dist/src/plugins/store/index.d.ts.map +1 -0
  271. package/dist/src/plugins/store/index.js +48 -105
  272. package/dist/src/plugins/store/index.js.map +1 -1
  273. package/dist/src/plugins/store/search.d.ts +46 -0
  274. package/dist/src/plugins/store/search.d.ts.map +1 -0
  275. package/dist/src/plugins/store/search.js +69 -107
  276. package/dist/src/plugins/store/search.js.map +1 -1
  277. package/dist/src/plugins/store/types.d.ts +274 -0
  278. package/dist/src/plugins/store/types.d.ts.map +1 -0
  279. package/dist/src/plugins/tests/demo-plugin-store.js +113 -160
  280. package/dist/src/plugins/tests/demo-plugin-store.js.map +1 -1
  281. package/dist/src/plugins/tests/standalone-test.js +172 -223
  282. package/dist/src/plugins/tests/standalone-test.js.map +1 -1
  283. package/dist/src/plugins/tests/test-plugin-store.js +190 -228
  284. package/dist/src/plugins/tests/test-plugin-store.js.map +1 -1
  285. package/dist/src/production/circuit-breaker.d.ts +101 -0
  286. package/dist/src/production/circuit-breaker.d.ts.map +1 -0
  287. package/dist/src/production/circuit-breaker.js +62 -126
  288. package/dist/src/production/circuit-breaker.js.map +1 -1
  289. package/dist/src/production/error-handler.d.ts +92 -0
  290. package/dist/src/production/error-handler.d.ts.map +1 -0
  291. package/dist/src/production/error-handler.js +86 -156
  292. package/dist/src/production/error-handler.js.map +1 -1
  293. package/dist/src/production/monitoring.d.ts +161 -0
  294. package/dist/src/production/monitoring.d.ts.map +1 -0
  295. package/dist/src/production/monitoring.js +139 -220
  296. package/dist/src/production/monitoring.js.map +1 -1
  297. package/dist/src/production/rate-limiter.d.ts +80 -0
  298. package/dist/src/production/rate-limiter.d.ts.map +1 -0
  299. package/dist/src/production/rate-limiter.js +74 -93
  300. package/dist/src/production/rate-limiter.js.map +1 -1
  301. package/dist/src/production/retry.d.ts +48 -0
  302. package/dist/src/production/retry.d.ts.map +1 -0
  303. package/dist/src/production/retry.js +75 -167
  304. package/dist/src/production/retry.js.map +1 -1
  305. package/dist/src/prompt.d.ts +44 -0
  306. package/dist/src/prompt.d.ts.map +1 -0
  307. package/dist/src/prompt.js +436 -560
  308. package/dist/src/prompt.js.map +1 -1
  309. package/dist/src/runtime/headless.d.ts +60 -0
  310. package/dist/src/runtime/headless.d.ts.map +1 -0
  311. package/dist/src/runtime/headless.js +197 -286
  312. package/dist/src/runtime/headless.js.map +1 -1
  313. package/dist/src/ruvector/agent-wasm.d.ts +182 -0
  314. package/dist/src/ruvector/agent-wasm.d.ts.map +1 -0
  315. package/dist/src/ruvector/agent-wasm.js +156 -351
  316. package/dist/src/ruvector/agent-wasm.js.map +1 -1
  317. package/dist/src/ruvector/ast-analyzer.d.ts +67 -0
  318. package/dist/src/ruvector/ast-analyzer.d.ts.map +1 -0
  319. package/dist/src/ruvector/ast-analyzer.js +145 -232
  320. package/dist/src/ruvector/ast-analyzer.js.map +1 -1
  321. package/dist/src/ruvector/coverage-router.d.ts +160 -0
  322. package/dist/src/ruvector/coverage-router.d.ts.map +1 -0
  323. package/dist/src/ruvector/coverage-router.js +287 -419
  324. package/dist/src/ruvector/coverage-router.js.map +1 -1
  325. package/dist/src/ruvector/coverage-tools.js +56 -101
  326. package/dist/src/ruvector/coverage-tools.js.map +1 -1
  327. package/dist/src/ruvector/diff-classifier.d.ts +175 -0
  328. package/dist/src/ruvector/diff-classifier.d.ts.map +1 -0
  329. package/dist/src/ruvector/diff-classifier.js +324 -451
  330. package/dist/src/ruvector/diff-classifier.js.map +1 -1
  331. package/dist/src/ruvector/enhanced-model-router.d.ts +146 -0
  332. package/dist/src/ruvector/enhanced-model-router.d.ts.map +1 -0
  333. package/dist/src/ruvector/enhanced-model-router.js +260 -336
  334. package/dist/src/ruvector/enhanced-model-router.js.map +1 -1
  335. package/dist/src/ruvector/flash-attention.d.ts +195 -0
  336. package/dist/src/ruvector/flash-attention.d.ts.map +1 -0
  337. package/dist/src/ruvector/flash-attention.js +223 -254
  338. package/dist/src/ruvector/flash-attention.js.map +1 -1
  339. package/dist/src/ruvector/graph-analyzer.d.ts +187 -0
  340. package/dist/src/ruvector/graph-analyzer.d.ts.map +1 -0
  341. package/dist/src/ruvector/graph-analyzer.js +486 -680
  342. package/dist/src/ruvector/graph-analyzer.js.map +1 -1
  343. package/dist/src/ruvector/index.d.ts +40 -0
  344. package/dist/src/ruvector/index.d.ts.map +1 -0
  345. package/dist/src/ruvector/index.js +36 -106
  346. package/dist/src/ruvector/index.js.map +1 -1
  347. package/dist/src/ruvector/lora-adapter.d.ts +218 -0
  348. package/dist/src/ruvector/lora-adapter.d.ts.map +1 -0
  349. package/dist/src/ruvector/lora-adapter.js +155 -248
  350. package/dist/src/ruvector/lora-adapter.js.map +1 -1
  351. package/dist/src/ruvector/model-router.d.ts +220 -0
  352. package/dist/src/ruvector/model-router.d.ts.map +1 -0
  353. package/dist/src/ruvector/model-router.js +175 -248
  354. package/dist/src/ruvector/model-router.js.map +1 -1
  355. package/dist/src/ruvector/moe-router.d.ts +206 -0
  356. package/dist/src/ruvector/moe-router.d.ts.map +1 -0
  357. package/dist/src/ruvector/moe-router.js +228 -286
  358. package/dist/src/ruvector/moe-router.js.map +1 -1
  359. package/dist/src/ruvector/q-learning-router.d.ts +211 -0
  360. package/dist/src/ruvector/q-learning-router.d.ts.map +1 -0
  361. package/dist/src/ruvector/q-learning-router.js +257 -338
  362. package/dist/src/ruvector/q-learning-router.js.map +1 -1
  363. package/dist/src/ruvector/ruvllm-wasm.d.ts +179 -0
  364. package/dist/src/ruvector/ruvllm-wasm.d.ts.map +1 -0
  365. package/dist/src/ruvector/ruvllm-wasm.js +270 -434
  366. package/dist/src/ruvector/ruvllm-wasm.js.map +1 -1
  367. package/dist/src/ruvector/semantic-router.d.ts +77 -0
  368. package/dist/src/ruvector/semantic-router.d.ts.map +1 -0
  369. package/dist/src/ruvector/semantic-router.js +60 -67
  370. package/dist/src/ruvector/semantic-router.js.map +1 -1
  371. package/dist/src/ruvector/vector-db.d.ts +69 -0
  372. package/dist/src/ruvector/vector-db.d.ts.map +1 -0
  373. package/dist/src/ruvector/vector-db.js +119 -205
  374. package/dist/src/ruvector/vector-db.js.map +1 -1
  375. package/dist/src/services/agentic-flow-bridge.d.ts +50 -0
  376. package/dist/src/services/agentic-flow-bridge.d.ts.map +1 -0
  377. package/dist/src/services/agentic-flow-bridge.js +32 -105
  378. package/dist/src/services/agentic-flow-bridge.js.map +1 -1
  379. package/dist/src/services/claim-service.d.ts +204 -0
  380. package/dist/src/services/claim-service.d.ts.map +1 -0
  381. package/dist/src/services/claim-service.js +615 -940
  382. package/dist/src/services/claim-service.js.map +1 -1
  383. package/dist/src/services/container-worker-pool.d.ts +197 -0
  384. package/dist/src/services/container-worker-pool.d.ts.map +1 -0
  385. package/dist/src/services/container-worker-pool.js +398 -666
  386. package/dist/src/services/container-worker-pool.js.map +1 -1
  387. package/dist/src/services/headless-worker-executor.d.ts +304 -0
  388. package/dist/src/services/headless-worker-executor.d.ts.map +1 -0
  389. package/dist/src/services/headless-worker-executor.js +441 -467
  390. package/dist/src/services/headless-worker-executor.js.map +1 -1
  391. package/dist/src/services/index.d.ts +4 -4
  392. package/dist/src/services/index.d.ts.map +1 -1
  393. package/dist/src/services/index.js +4 -4
  394. package/dist/src/services/index.js.map +1 -1
  395. package/dist/src/services/registry-api.d.ts +58 -0
  396. package/dist/src/services/registry-api.d.ts.map +1 -0
  397. package/dist/src/services/registry-api.js +92 -200
  398. package/dist/src/services/registry-api.js.map +1 -1
  399. package/dist/src/services/ruvector-training.d.ts +222 -0
  400. package/dist/src/services/ruvector-training.d.ts.map +1 -0
  401. package/dist/src/services/ruvector-training.js +257 -337
  402. package/dist/src/services/ruvector-training.js.map +1 -1
  403. package/dist/src/services/worker-daemon.d.ts +228 -0
  404. package/dist/src/services/worker-daemon.d.ts.map +1 -0
  405. package/dist/src/services/worker-daemon.js +591 -849
  406. package/dist/src/services/worker-daemon.js.map +1 -1
  407. package/dist/src/services/worker-queue.d.ts +194 -0
  408. package/dist/src/services/worker-queue.d.ts.map +1 -0
  409. package/dist/src/services/worker-queue.js +331 -548
  410. package/dist/src/services/worker-queue.js.map +1 -1
  411. package/dist/src/suggest.d.ts +53 -0
  412. package/dist/src/suggest.d.ts.map +1 -0
  413. package/dist/src/suggest.js +45 -55
  414. package/dist/src/suggest.js.map +1 -1
  415. package/dist/src/transfer/anonymization/index.js +29 -37
  416. package/dist/src/transfer/anonymization/index.js.map +1 -1
  417. package/dist/src/transfer/deploy-seraphine.js +128 -155
  418. package/dist/src/transfer/deploy-seraphine.js.map +1 -1
  419. package/dist/src/transfer/export.d.ts +25 -0
  420. package/dist/src/transfer/export.d.ts.map +1 -0
  421. package/dist/src/transfer/export.js +84 -142
  422. package/dist/src/transfer/export.js.map +1 -1
  423. package/dist/src/transfer/index.d.ts +1 -1
  424. package/dist/src/transfer/index.d.ts.map +1 -1
  425. package/dist/src/transfer/index.js +0 -2
  426. package/dist/src/transfer/index.js.map +1 -1
  427. package/dist/src/transfer/ipfs/client.d.ts +109 -0
  428. package/dist/src/transfer/ipfs/client.d.ts.map +1 -0
  429. package/dist/src/transfer/ipfs/client.js +187 -337
  430. package/dist/src/transfer/ipfs/client.js.map +1 -1
  431. package/dist/src/transfer/ipfs/upload.d.ts +95 -0
  432. package/dist/src/transfer/ipfs/upload.d.ts.map +1 -0
  433. package/dist/src/transfer/ipfs/upload.js +288 -434
  434. package/dist/src/transfer/ipfs/upload.js.map +1 -1
  435. package/dist/src/transfer/models/seraphine.d.ts +72 -0
  436. package/dist/src/transfer/models/seraphine.d.ts.map +1 -0
  437. package/dist/src/transfer/models/seraphine.js +55 -55
  438. package/dist/src/transfer/models/seraphine.js.map +1 -1
  439. package/dist/src/transfer/serialization/cfp.d.ts +49 -0
  440. package/dist/src/transfer/serialization/cfp.d.ts.map +1 -0
  441. package/dist/src/transfer/serialization/cfp.js +30 -31
  442. package/dist/src/transfer/serialization/cfp.js.map +1 -1
  443. package/dist/src/transfer/storage/gcs.d.ts +82 -0
  444. package/dist/src/transfer/storage/gcs.d.ts.map +1 -0
  445. package/dist/src/transfer/storage/gcs.js +165 -232
  446. package/dist/src/transfer/storage/gcs.js.map +1 -1
  447. package/dist/src/transfer/store/discovery.d.ts +84 -0
  448. package/dist/src/transfer/store/discovery.d.ts.map +1 -0
  449. package/dist/src/transfer/store/discovery.js +239 -349
  450. package/dist/src/transfer/store/discovery.js.map +1 -1
  451. package/dist/src/transfer/store/download.d.ts +70 -0
  452. package/dist/src/transfer/store/download.d.ts.map +1 -0
  453. package/dist/src/transfer/store/download.js +243 -365
  454. package/dist/src/transfer/store/download.js.map +1 -1
  455. package/dist/src/transfer/store/index.d.ts +84 -0
  456. package/dist/src/transfer/store/index.d.ts.map +1 -0
  457. package/dist/src/transfer/store/index.js +63 -130
  458. package/dist/src/transfer/store/index.js.map +1 -1
  459. package/dist/src/transfer/store/publish.d.ts +76 -0
  460. package/dist/src/transfer/store/publish.d.ts.map +1 -0
  461. package/dist/src/transfer/store/publish.js +184 -258
  462. package/dist/src/transfer/store/publish.js.map +1 -1
  463. package/dist/src/transfer/store/registry.js +50 -72
  464. package/dist/src/transfer/store/registry.js.map +1 -1
  465. package/dist/src/transfer/store/search.d.ts +54 -0
  466. package/dist/src/transfer/store/search.d.ts.map +1 -0
  467. package/dist/src/transfer/store/search.js +64 -96
  468. package/dist/src/transfer/store/search.js.map +1 -1
  469. package/dist/src/transfer/store/tests/standalone-test.js +174 -231
  470. package/dist/src/transfer/store/tests/standalone-test.js.map +1 -1
  471. package/dist/src/transfer/test-seraphine.js +95 -130
  472. package/dist/src/transfer/test-seraphine.js.map +1 -1
  473. package/dist/src/transfer/tests/test-store.js +194 -239
  474. package/dist/src/transfer/tests/test-store.js.map +1 -1
  475. package/dist/src/transfer/types.d.ts +245 -0
  476. package/dist/src/transfer/types.d.ts.map +1 -0
  477. package/dist/src/types.d.ts +198 -0
  478. package/dist/src/types.d.ts.map +1 -0
  479. package/dist/src/types.js +26 -55
  480. package/dist/src/types.js.map +1 -1
  481. package/dist/src/update/checker.d.ts +34 -0
  482. package/dist/src/update/checker.d.ts.map +1 -0
  483. package/dist/src/update/checker.js +106 -183
  484. package/dist/src/update/checker.js.map +1 -1
  485. package/dist/src/update/executor.d.ts +32 -0
  486. package/dist/src/update/executor.d.ts.map +1 -0
  487. package/dist/src/update/executor.js +135 -198
  488. package/dist/src/update/executor.js.map +1 -1
  489. package/dist/src/update/index.d.ts +33 -0
  490. package/dist/src/update/index.d.ts.map +1 -0
  491. package/dist/src/update/index.js +38 -85
  492. package/dist/src/update/index.js.map +1 -1
  493. package/dist/src/update/rate-limiter.d.ts +20 -0
  494. package/dist/src/update/rate-limiter.d.ts.map +1 -0
  495. package/dist/src/update/rate-limiter.js +19 -31
  496. package/dist/src/update/rate-limiter.js.map +1 -1
  497. package/dist/src/update/validator.d.ts +17 -0
  498. package/dist/src/update/validator.d.ts.map +1 -0
  499. package/dist/src/update/validator.js +38 -64
  500. package/dist/src/update/validator.js.map +1 -1
  501. package/dist/tsconfig.tsbuildinfo +1 -1
  502. package/package.json +1 -1
@@ -8,53 +8,6 @@
8
8
  *
9
9
  * @module enhanced-model-router
10
10
  */
11
- var __assign = (this && this.__assign) || function () {
12
- __assign = Object.assign || function(t) {
13
- for (var s, i = 1, n = arguments.length; i < n; i++) {
14
- s = arguments[i];
15
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
16
- t[p] = s[p];
17
- }
18
- return t;
19
- };
20
- return __assign.apply(this, arguments);
21
- };
22
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
23
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
24
- return new (P || (P = Promise))(function (resolve, reject) {
25
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
26
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
27
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
28
- step((generator = generator.apply(thisArg, _arguments || [])).next());
29
- });
30
- };
31
- var __generator = (this && this.__generator) || function (thisArg, body) {
32
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
33
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
34
- function verb(n) { return function (v) { return step([n, v]); }; }
35
- function step(op) {
36
- if (f) throw new TypeError("Generator is already executing.");
37
- while (_) try {
38
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
39
- if (y = 0, t) op = [op[0] & 2, t.value];
40
- switch (op[0]) {
41
- case 0: case 1: t = op; break;
42
- case 4: _.label++; return { value: op[1], done: false };
43
- case 5: _.label++; y = op[1]; op = [0]; continue;
44
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
45
- default:
46
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
47
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
48
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
49
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
50
- if (t[2]) _.ops.pop();
51
- _.trys.pop(); continue;
52
- }
53
- op = body.call(thisArg, _);
54
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
55
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
56
- }
57
- };
58
11
  import { existsSync, readFileSync } from 'fs';
59
12
  import { extname } from 'path';
60
13
  import { getModelRouter } from './model-router.js';
@@ -64,7 +17,7 @@ import { getModelRouter } from './model-router.js';
64
17
  /**
65
18
  * Pattern definitions for Agent Booster intent detection
66
19
  */
67
- var INTENT_PATTERNS = {
20
+ const INTENT_PATTERNS = {
68
21
  'var-to-const': {
69
22
  patterns: [
70
23
  /convert\s+var\s+to\s+const/i,
@@ -75,7 +28,7 @@ var INTENT_PATTERNS = {
75
28
  /use\s+const\s+instead\s+of\s+var/i,
76
29
  ],
77
30
  weight: 1.0,
78
- description: 'Convert var declarations to const/let'
31
+ description: 'Convert var declarations to const/let',
79
32
  },
80
33
  'add-types': {
81
34
  patterns: [
@@ -86,7 +39,7 @@ var INTENT_PATTERNS = {
86
39
  /annotate\s+with\s+types?/i,
87
40
  ],
88
41
  weight: 0.9,
89
- description: 'Add TypeScript type annotations'
42
+ description: 'Add TypeScript type annotations',
90
43
  },
91
44
  'add-error-handling': {
92
45
  patterns: [
@@ -96,8 +49,8 @@ var INTENT_PATTERNS = {
96
49
  /handle\s+errors?/i,
97
50
  /add\s+exception\s+handling/i,
98
51
  ],
99
- weight: 0.7,
100
- description: 'Wrap code in try/catch blocks'
52
+ weight: 0.7, // Lower weight - often needs more context
53
+ description: 'Wrap code in try/catch blocks',
101
54
  },
102
55
  'async-await': {
103
56
  patterns: [
@@ -111,7 +64,7 @@ var INTENT_PATTERNS = {
111
64
  /callbacks?\s+to\s+async/i,
112
65
  ],
113
66
  weight: 0.8,
114
- description: 'Convert callbacks/promises to async/await'
67
+ description: 'Convert callbacks/promises to async/await',
115
68
  },
116
69
  'add-logging': {
117
70
  patterns: [
@@ -122,7 +75,7 @@ var INTENT_PATTERNS = {
122
75
  /add\s+trace\s+logging/i,
123
76
  ],
124
77
  weight: 0.85,
125
- description: 'Add console.log or logging statements'
78
+ description: 'Add console.log or logging statements',
126
79
  },
127
80
  'remove-console': {
128
81
  patterns: [
@@ -136,13 +89,13 @@ var INTENT_PATTERNS = {
136
89
  /delete\s+(?:all\s+)?console\.log/i,
137
90
  ],
138
91
  weight: 0.95,
139
- description: 'Remove console.* calls'
140
- }
92
+ description: 'Remove console.* calls',
93
+ },
141
94
  };
142
95
  /**
143
96
  * File path extraction patterns
144
97
  */
145
- var FILE_PATH_PATTERNS = [
98
+ const FILE_PATH_PATTERNS = [
146
99
  /(?:in|from|to|file|path)\s+[`"']?([a-zA-Z0-9_./\\-]+\.[a-zA-Z]+)[`"']?/i,
147
100
  /[`"']([a-zA-Z0-9_./\\-]+\.[a-zA-Z]+)[`"']/,
148
101
  /(\S+\.[tj]sx?)\b/i,
@@ -155,7 +108,7 @@ var FILE_PATH_PATTERNS = [
155
108
  * High-complexity keywords that indicate Tier 3 (Opus) routing
156
109
  * These tasks require deep reasoning and architectural understanding
157
110
  */
158
- var TIER3_KEYWORDS = [
111
+ const TIER3_KEYWORDS = [
159
112
  // Architecture & Design
160
113
  /\b(microservices?|architecture|system\s+design|distributed)\b/i,
161
114
  /\b(design|architect|plan)\s+(a|an|the|complex)\b/i,
@@ -181,7 +134,7 @@ var TIER3_KEYWORDS = [
181
134
  /\b(performance\s+critical|low\s+latency|high\s+throughput)\b/i,
182
135
  /\b(memory\s+optimi|cache\s+strateg|concurrent)\b/i,
183
136
  ];
184
- var LANGUAGE_MAP = {
137
+ const LANGUAGE_MAP = {
185
138
  '.js': 'javascript',
186
139
  '.jsx': 'javascript',
187
140
  '.ts': 'typescript',
@@ -195,7 +148,7 @@ var LANGUAGE_MAP = {
195
148
  '.swift': 'swift',
196
149
  '.c': 'c',
197
150
  '.cpp': 'cpp',
198
- '.h': 'c'
151
+ '.h': 'c',
199
152
  };
200
153
  // ============================================================================
201
154
  // Enhanced Model Router Implementation
@@ -208,44 +161,52 @@ var LANGUAGE_MAP = {
208
161
  * - Tier 2: Haiku for low complexity tasks
209
162
  * - Tier 3: Sonnet/Opus for complex reasoning tasks
210
163
  */
211
- var EnhancedModelRouter = /** @class */ (function () {
212
- function EnhancedModelRouter(config) {
213
- this.config = __assign({ agentBoosterEnabled: true, agentBoosterConfidenceThreshold: 0.7, enabledIntents: [
164
+ export class EnhancedModelRouter {
165
+ config;
166
+ tinyDancerRouter;
167
+ constructor(config) {
168
+ this.config = {
169
+ agentBoosterEnabled: true,
170
+ agentBoosterConfidenceThreshold: 0.7,
171
+ enabledIntents: [
214
172
  'var-to-const',
215
173
  'add-types',
216
174
  'add-error-handling',
217
175
  'async-await',
218
176
  'add-logging',
219
177
  'remove-console',
220
- ], complexityThresholds: {
178
+ ],
179
+ complexityThresholds: {
221
180
  haiku: 0.3,
222
181
  sonnet: 0.6,
223
- opus: 1.0
224
- }, preferCost: false, preferQuality: false }, config);
182
+ opus: 1.0,
183
+ },
184
+ preferCost: false,
185
+ preferQuality: false,
186
+ ...config,
187
+ };
225
188
  this.tinyDancerRouter = getModelRouter();
226
189
  }
227
190
  /**
228
191
  * Detect code editing intent from task description
229
192
  */
230
- EnhancedModelRouter.prototype.detectIntent = function (task) {
231
- var taskLower = task.toLowerCase();
232
- var bestIntent = null;
233
- var bestScore = 0;
234
- for (var _i = 0, _a = Object.entries(INTENT_PATTERNS); _i < _a.length; _i++) {
235
- var _b = _a[_i], intentType = _b[0], config = _b[1];
193
+ detectIntent(task) {
194
+ const taskLower = task.toLowerCase();
195
+ let bestIntent = null;
196
+ let bestScore = 0;
197
+ for (const [intentType, config] of Object.entries(INTENT_PATTERNS)) {
236
198
  if (!this.config.enabledIntents.includes(intentType)) {
237
199
  continue;
238
200
  }
239
- for (var _c = 0, _d = config.patterns; _c < _d.length; _c++) {
240
- var pattern = _d[_c];
201
+ for (const pattern of config.patterns) {
241
202
  if (pattern.test(taskLower)) {
242
- var score = config.weight;
203
+ const score = config.weight;
243
204
  if (score > bestScore) {
244
205
  bestScore = score;
245
206
  bestIntent = {
246
207
  type: intentType,
247
208
  confidence: score,
248
- description: config.description
209
+ description: config.description,
249
210
  };
250
211
  }
251
212
  }
@@ -253,7 +214,7 @@ var EnhancedModelRouter = /** @class */ (function () {
253
214
  }
254
215
  // Extract file path if intent found
255
216
  if (bestIntent) {
256
- var filePath = this.extractFilePath(task);
217
+ const filePath = this.extractFilePath(task);
257
218
  if (filePath) {
258
219
  bestIntent.filePath = filePath;
259
220
  bestIntent.language = this.detectLanguage(filePath);
@@ -264,297 +225,265 @@ var EnhancedModelRouter = /** @class */ (function () {
264
225
  }
265
226
  }
266
227
  return bestIntent;
267
- };
228
+ }
268
229
  /**
269
230
  * Extract file path from task description
270
231
  */
271
- EnhancedModelRouter.prototype.extractFilePath = function (task) {
272
- for (var _i = 0, FILE_PATH_PATTERNS_1 = FILE_PATH_PATTERNS; _i < FILE_PATH_PATTERNS_1.length; _i++) {
273
- var pattern = FILE_PATH_PATTERNS_1[_i];
274
- var match = task.match(pattern);
232
+ extractFilePath(task) {
233
+ for (const pattern of FILE_PATH_PATTERNS) {
234
+ const match = task.match(pattern);
275
235
  if (match && match[1]) {
276
236
  return match[1];
277
237
  }
278
238
  }
279
239
  return null;
280
- };
240
+ }
281
241
  /**
282
242
  * Detect language from file extension
283
243
  */
284
- EnhancedModelRouter.prototype.detectLanguage = function (filePath) {
285
- var ext = extname(filePath).toLowerCase();
244
+ detectLanguage(filePath) {
245
+ const ext = extname(filePath).toLowerCase();
286
246
  return LANGUAGE_MAP[ext] || 'javascript';
287
- };
247
+ }
288
248
  /**
289
249
  * Check if task contains Tier 3 (Opus) keywords
290
250
  */
291
- EnhancedModelRouter.prototype.containsTier3Keywords = function (task) {
292
- var count = 0;
293
- for (var _i = 0, TIER3_KEYWORDS_1 = TIER3_KEYWORDS; _i < TIER3_KEYWORDS_1.length; _i++) {
294
- var pattern = TIER3_KEYWORDS_1[_i];
251
+ containsTier3Keywords(task) {
252
+ let count = 0;
253
+ for (const pattern of TIER3_KEYWORDS) {
295
254
  if (pattern.test(task)) {
296
255
  count++;
297
256
  }
298
257
  }
299
- return { matches: count > 0, count: count };
300
- };
258
+ return { matches: count > 0, count };
259
+ }
301
260
  /**
302
261
  * Route a task to the optimal tier and handler
303
262
  */
304
- EnhancedModelRouter.prototype.route = function (task, context) {
305
- return __awaiter(this, void 0, Promise, function () {
306
- var intent, tier3Check, astComplexity, targetFile, _a, tinyDancerResult, finalComplexity, _b, haiku, sonnet;
307
- return __generator(this, function (_c) {
308
- switch (_c.label) {
309
- case 0:
310
- // Step 1: Try Agent Booster intent detection
311
- if (this.config.agentBoosterEnabled) {
312
- intent = this.detectIntent(task);
313
- if (intent && intent.confidence >= this.config.agentBoosterConfidenceThreshold) {
314
- return [2 /*return*/, {
315
- tier: 1,
316
- handler: 'agent-booster',
317
- confidence: intent.confidence,
318
- reasoning: "Agent Booster can handle \"" + intent.type + "\" with " + (intent.confidence * 100).toFixed(0) + "% confidence",
319
- agentBoosterIntent: intent,
320
- canSkipLLM: true,
321
- estimatedLatencyMs: 1,
322
- estimatedCost: 0
323
- }];
324
- }
325
- }
326
- tier3Check = this.containsTier3Keywords(task);
327
- if (tier3Check.matches && tier3Check.count >= 2) {
328
- // Strong signal for Opus - multiple complex keywords
329
- return [2 /*return*/, {
330
- tier: 3,
331
- handler: 'opus',
332
- model: 'opus',
333
- confidence: Math.min(0.95, 0.7 + tier3Check.count * 0.1),
334
- complexity: 0.8 + tier3Check.count * 0.05,
335
- reasoning: "High complexity task (" + tier3Check.count + " architectural keywords) - using opus",
336
- canSkipLLM: false,
337
- estimatedLatencyMs: 5000,
338
- estimatedCost: 0.015
339
- }];
340
- }
341
- targetFile = (context === null || context === void 0 ? void 0 : context.filePath) || this.extractFilePath(task);
342
- if (!(targetFile && existsSync(targetFile))) return [3 /*break*/, 4];
343
- _c.label = 1;
344
- case 1:
345
- _c.trys.push([1, 3, , 4]);
346
- return [4 /*yield*/, this.analyzeASTComplexity(targetFile)];
347
- case 2:
348
- astComplexity = _c.sent();
349
- return [3 /*break*/, 4];
350
- case 3:
351
- _a = _c.sent();
352
- return [3 /*break*/, 4];
353
- case 4: return [4 /*yield*/, this.tinyDancerRouter.route(task)];
354
- case 5:
355
- tinyDancerResult = _c.sent();
356
- finalComplexity = astComplexity !== undefined
357
- ? (astComplexity + tinyDancerResult.complexity) / 2
358
- : tinyDancerResult.complexity;
359
- // Boost complexity if tier3 keywords found (even just one)
360
- if (tier3Check.matches) {
361
- finalComplexity = Math.min(1.0, finalComplexity + 0.25);
362
- }
363
- _b = this.config.complexityThresholds, haiku = _b.haiku, sonnet = _b.sonnet;
364
- if (finalComplexity < haiku) {
365
- return [2 /*return*/, {
366
- tier: 2,
367
- handler: 'haiku',
368
- model: 'haiku',
369
- confidence: tinyDancerResult.confidence,
370
- complexity: finalComplexity,
371
- reasoning: "Low complexity (" + (finalComplexity * 100).toFixed(0) + "%) - using haiku",
372
- canSkipLLM: false,
373
- estimatedLatencyMs: 500,
374
- estimatedCost: 0.0002
375
- }];
376
- }
377
- if (finalComplexity < sonnet) {
378
- return [2 /*return*/, {
379
- tier: 2,
380
- handler: 'sonnet',
381
- model: 'sonnet',
382
- confidence: tinyDancerResult.confidence,
383
- complexity: finalComplexity,
384
- reasoning: "Medium complexity (" + (finalComplexity * 100).toFixed(0) + "%) - using sonnet",
385
- canSkipLLM: false,
386
- estimatedLatencyMs: 2000,
387
- estimatedCost: 0.003
388
- }];
389
- }
390
- return [2 /*return*/, {
391
- tier: 3,
392
- handler: 'opus',
393
- model: 'opus',
394
- confidence: tinyDancerResult.confidence,
395
- complexity: finalComplexity,
396
- reasoning: "High complexity (" + (finalComplexity * 100).toFixed(0) + "%) - using opus",
397
- canSkipLLM: false,
398
- estimatedLatencyMs: 5000,
399
- estimatedCost: 0.015
400
- }];
401
- }
402
- });
403
- });
404
- };
263
+ async route(task, context) {
264
+ // Step 1: Try Agent Booster intent detection
265
+ if (this.config.agentBoosterEnabled) {
266
+ const intent = this.detectIntent(task);
267
+ if (intent && intent.confidence >= this.config.agentBoosterConfidenceThreshold) {
268
+ return {
269
+ tier: 1,
270
+ handler: 'agent-booster',
271
+ confidence: intent.confidence,
272
+ reasoning: `Agent Booster can handle "${intent.type}" with ${(intent.confidence * 100).toFixed(0)}% confidence`,
273
+ agentBoosterIntent: intent,
274
+ canSkipLLM: true,
275
+ estimatedLatencyMs: 1,
276
+ estimatedCost: 0,
277
+ };
278
+ }
279
+ }
280
+ // Step 2: Check for Tier 3 keywords (architecture, security, distributed)
281
+ const tier3Check = this.containsTier3Keywords(task);
282
+ if (tier3Check.matches && tier3Check.count >= 2) {
283
+ // Strong signal for Opus - multiple complex keywords
284
+ return {
285
+ tier: 3,
286
+ handler: 'opus',
287
+ model: 'opus',
288
+ confidence: Math.min(0.95, 0.7 + tier3Check.count * 0.1),
289
+ complexity: 0.8 + tier3Check.count * 0.05,
290
+ reasoning: `High complexity task (${tier3Check.count} architectural keywords) - using opus`,
291
+ canSkipLLM: false,
292
+ estimatedLatencyMs: 5000,
293
+ estimatedCost: 0.015,
294
+ };
295
+ }
296
+ // Step 3: AST complexity analysis (if file path provided)
297
+ let astComplexity;
298
+ const targetFile = context?.filePath || this.extractFilePath(task);
299
+ if (targetFile && existsSync(targetFile)) {
300
+ try {
301
+ astComplexity = await this.analyzeASTComplexity(targetFile);
302
+ }
303
+ catch {
304
+ // AST analysis not available, continue with text-based routing
305
+ }
306
+ }
307
+ // Step 4: Text-based complexity + tiny-dancer routing
308
+ const tinyDancerResult = await this.tinyDancerRouter.route(task);
309
+ // Step 5: Combine AST complexity with tiny-dancer result
310
+ // Also boost if single tier3 keyword found
311
+ let finalComplexity = astComplexity !== undefined
312
+ ? (astComplexity + tinyDancerResult.complexity) / 2
313
+ : tinyDancerResult.complexity;
314
+ // Boost complexity if tier3 keywords found (even just one)
315
+ if (tier3Check.matches) {
316
+ finalComplexity = Math.min(1.0, finalComplexity + 0.25);
317
+ }
318
+ // Step 6: Determine tier based on complexity
319
+ const { haiku, sonnet } = this.config.complexityThresholds;
320
+ if (finalComplexity < haiku) {
321
+ return {
322
+ tier: 2,
323
+ handler: 'haiku',
324
+ model: 'haiku',
325
+ confidence: tinyDancerResult.confidence,
326
+ complexity: finalComplexity,
327
+ reasoning: `Low complexity (${(finalComplexity * 100).toFixed(0)}%) - using haiku`,
328
+ canSkipLLM: false,
329
+ estimatedLatencyMs: 500,
330
+ estimatedCost: 0.0002,
331
+ };
332
+ }
333
+ if (finalComplexity < sonnet) {
334
+ return {
335
+ tier: 2,
336
+ handler: 'sonnet',
337
+ model: 'sonnet',
338
+ confidence: tinyDancerResult.confidence,
339
+ complexity: finalComplexity,
340
+ reasoning: `Medium complexity (${(finalComplexity * 100).toFixed(0)}%) - using sonnet`,
341
+ canSkipLLM: false,
342
+ estimatedLatencyMs: 2000,
343
+ estimatedCost: 0.003,
344
+ };
345
+ }
346
+ return {
347
+ tier: 3,
348
+ handler: 'opus',
349
+ model: 'opus',
350
+ confidence: tinyDancerResult.confidence,
351
+ complexity: finalComplexity,
352
+ reasoning: `High complexity (${(finalComplexity * 100).toFixed(0)}%) - using opus`,
353
+ canSkipLLM: false,
354
+ estimatedLatencyMs: 5000,
355
+ estimatedCost: 0.015,
356
+ };
357
+ }
405
358
  /**
406
359
  * Analyze AST complexity of a file
407
360
  * Returns normalized complexity score (0-1)
408
361
  */
409
- EnhancedModelRouter.prototype.analyzeASTComplexity = function (filePath) {
410
- return __awaiter(this, void 0, Promise, function () {
411
- var content, lines, complexity, avgIndent, controlFlowCount, functionCount;
412
- return __generator(this, function (_a) {
413
- try {
414
- content = readFileSync(filePath, 'utf-8');
415
- lines = content.split('\n');
416
- complexity = 0;
417
- // Line count contribution
418
- complexity += Math.min(0.3, lines.length / 1000);
419
- avgIndent = lines
420
- .filter(function (l) { return l.trim().length > 0; })
421
- .map(function (l) { var _a; return ((_a = l.match(/^(\s*)/)) === null || _a === void 0 ? void 0 : _a[1].length) || 0; })
422
- .reduce(function (sum, indent) { return sum + indent; }, 0) / Math.max(1, lines.length);
423
- complexity += Math.min(0.2, avgIndent / 20);
424
- controlFlowCount = (content.match(/\b(if|else|for|while|switch|case|try|catch|async|await)\b/g) || []).length;
425
- complexity += Math.min(0.3, controlFlowCount / 100);
426
- functionCount = (content.match(/\b(function|class|=>)\b/g) || []).length;
427
- complexity += Math.min(0.2, functionCount / 50);
428
- return [2 /*return*/, Math.min(1, complexity)];
429
- }
430
- catch (_b) {
431
- return [2 /*return*/, 0.5]; // Default to medium complexity on error
432
- }
433
- return [2 /*return*/];
434
- });
435
- });
436
- };
362
+ async analyzeASTComplexity(filePath) {
363
+ try {
364
+ const content = readFileSync(filePath, 'utf-8');
365
+ const lines = content.split('\n');
366
+ // Simple heuristics for complexity
367
+ let complexity = 0;
368
+ // Line count contribution
369
+ complexity += Math.min(0.3, lines.length / 1000);
370
+ // Nesting depth estimation (count indentation)
371
+ const avgIndent = lines
372
+ .filter((l) => l.trim().length > 0)
373
+ .map((l) => l.match(/^(\s*)/)?.[1].length || 0)
374
+ .reduce((sum, indent) => sum + indent, 0) / Math.max(1, lines.length);
375
+ complexity += Math.min(0.2, avgIndent / 20);
376
+ // Control flow complexity (count keywords)
377
+ const controlFlowCount = (content.match(/\b(if|else|for|while|switch|case|try|catch|async|await)\b/g) || []).length;
378
+ complexity += Math.min(0.3, controlFlowCount / 100);
379
+ // Function/class count
380
+ const functionCount = (content.match(/\b(function|class|=>)\b/g) || []).length;
381
+ complexity += Math.min(0.2, functionCount / 50);
382
+ return Math.min(1, complexity);
383
+ }
384
+ catch {
385
+ return 0.5; // Default to medium complexity on error
386
+ }
387
+ }
437
388
  /**
438
389
  * Execute task using the appropriate tier
439
390
  * Returns the result and routing information
440
391
  */
441
- EnhancedModelRouter.prototype.execute = function (task, context) {
442
- return __awaiter(this, void 0, Promise, function () {
443
- var routeResult, abResult;
444
- return __generator(this, function (_a) {
445
- switch (_a.label) {
446
- case 0: return [4 /*yield*/, this.route(task, context)];
447
- case 1:
448
- routeResult = _a.sent();
449
- if (!(routeResult.tier === 1 && routeResult.agentBoosterIntent)) return [3 /*break*/, 3];
450
- return [4 /*yield*/, this.tryAgentBooster(routeResult.agentBoosterIntent, context)];
451
- case 2:
452
- abResult = _a.sent();
453
- if (abResult.success) {
454
- return [2 /*return*/, {
455
- result: { applied: true, confidence: abResult.confidence },
456
- routeResult: routeResult
457
- }];
458
- }
459
- // Agent Booster failed, fall back to LLM
460
- routeResult.tier = 2;
461
- routeResult.handler = 'sonnet';
462
- routeResult.model = 'sonnet';
463
- routeResult.canSkipLLM = false;
464
- routeResult.reasoning += ' (Agent Booster fallback to LLM)';
465
- _a.label = 3;
466
- case 3:
467
- // Return routing result - caller handles LLM invocation
468
- return [2 /*return*/, { result: routeResult.reasoning, routeResult: routeResult }];
469
- }
470
- });
471
- });
472
- };
392
+ async execute(task, context) {
393
+ const routeResult = await this.route(task, context);
394
+ if (routeResult.tier === 1 && routeResult.agentBoosterIntent) {
395
+ // Try to execute with Agent Booster
396
+ const abResult = await this.tryAgentBooster(routeResult.agentBoosterIntent, context);
397
+ if (abResult.success) {
398
+ return {
399
+ result: { applied: true, confidence: abResult.confidence },
400
+ routeResult,
401
+ };
402
+ }
403
+ // Agent Booster failed, fall back to LLM
404
+ routeResult.tier = 2;
405
+ routeResult.handler = 'sonnet';
406
+ routeResult.model = 'sonnet';
407
+ routeResult.canSkipLLM = false;
408
+ routeResult.reasoning += ' (Agent Booster fallback to LLM)';
409
+ }
410
+ // Return routing result - caller handles LLM invocation
411
+ return { result: routeResult.reasoning, routeResult };
412
+ }
473
413
  /**
474
414
  * Try to apply edit using Agent Booster
475
415
  */
476
- EnhancedModelRouter.prototype.tryAgentBooster = function (intent, context) {
477
- var _a, _b;
478
- return __awaiter(this, void 0, Promise, function () {
479
- var filePath, originalCode, intentToInstruction, instruction, language, boosterModule, result_1, SAFE_LANGUAGES, safeLang, execSync, cmd, result, parsed, _c;
480
- return __generator(this, function (_d) {
481
- switch (_d.label) {
482
- case 0:
483
- _d.trys.push([0, 5, , 6]);
484
- filePath = intent.filePath || (context === null || context === void 0 ? void 0 : context.filePath);
485
- if (!filePath || !existsSync(filePath)) {
486
- return [2 /*return*/, { success: false, confidence: 0 }];
487
- }
488
- originalCode = (context === null || context === void 0 ? void 0 : context.originalCode) || readFileSync(filePath, 'utf-8');
489
- intentToInstruction = {
490
- 'var-to-const': 'Convert all var declarations to const',
491
- 'add-types': 'Add TypeScript type annotations',
492
- 'add-error-handling': 'Wrap in try/catch blocks',
493
- 'async-await': 'Convert to async/await',
494
- 'add-logging': 'Add console.log statements',
495
- 'remove-console': 'Remove all console.* statements'
496
- };
497
- instruction = intentToInstruction[intent.type];
498
- language = intent.language || 'javascript';
499
- return [4 /*yield*/, import('agentic-flow/agent-booster')["catch"](function () { return import(/* @vite-ignore */ 'agentic-flow/intelligence/agent-booster-enhanced'); })["catch"](function () { return null; })];
500
- case 1:
501
- boosterModule = _d.sent();
502
- if (!(boosterModule === null || boosterModule === void 0 ? void 0 : boosterModule.enhancedApply)) return [3 /*break*/, 3];
503
- return [4 /*yield*/, boosterModule.enhancedApply({
504
- code: originalCode,
505
- edit: instruction,
506
- language: language
507
- })];
508
- case 2:
509
- result_1 = _d.sent();
510
- if (result_1 && result_1.confidence >= this.config.agentBoosterConfidenceThreshold) {
511
- return [2 /*return*/, { success: true, confidence: result_1.confidence, output: result_1.output }];
512
- }
513
- return [2 /*return*/, { success: false, confidence: (_a = result_1 === null || result_1 === void 0 ? void 0 : result_1.confidence) !== null && _a !== void 0 ? _a : 0 }];
514
- case 3:
515
- SAFE_LANGUAGES = ['javascript', 'typescript', 'python', 'rust', 'go', 'java', 'c', 'cpp', 'ruby', 'swift', 'kotlin'];
516
- safeLang = SAFE_LANGUAGES.includes(language) ? language : 'javascript';
517
- return [4 /*yield*/, import('child_process')];
518
- case 4:
519
- execSync = (_d.sent()).execSync;
520
- cmd = "npx --yes agent-booster@0.2.2 apply --language " + safeLang;
521
- result = execSync(cmd, {
522
- encoding: 'utf-8',
523
- input: JSON.stringify({ code: originalCode, edit: instruction }),
524
- maxBuffer: 10 * 1024 * 1024,
525
- timeout: 5000,
526
- stdio: ['pipe', 'pipe', 'pipe']
527
- });
528
- parsed = JSON.parse(result);
529
- if (parsed.confidence >= this.config.agentBoosterConfidenceThreshold) {
530
- return [2 /*return*/, { success: true, confidence: parsed.confidence, output: parsed.output }];
531
- }
532
- return [2 /*return*/, { success: false, confidence: (_b = parsed.confidence) !== null && _b !== void 0 ? _b : 0 }];
533
- case 5:
534
- _c = _d.sent();
535
- // Agent Booster not available or failed
536
- return [2 /*return*/, { success: false, confidence: 0 }];
537
- case 6: return [2 /*return*/];
416
+ async tryAgentBooster(intent, context) {
417
+ try {
418
+ const filePath = intent.filePath || context?.filePath;
419
+ if (!filePath || !existsSync(filePath)) {
420
+ return { success: false, confidence: 0 };
421
+ }
422
+ const originalCode = context?.originalCode || readFileSync(filePath, 'utf-8');
423
+ const intentToInstruction = {
424
+ 'var-to-const': 'Convert all var declarations to const',
425
+ 'add-types': 'Add TypeScript type annotations',
426
+ 'add-error-handling': 'Wrap in try/catch blocks',
427
+ 'async-await': 'Convert to async/await',
428
+ 'add-logging': 'Add console.log statements',
429
+ 'remove-console': 'Remove all console.* statements',
430
+ };
431
+ const instruction = intentToInstruction[intent.type];
432
+ const language = intent.language || 'javascript';
433
+ // Try local agentic-flow agent-booster (v3 — no npx needed)
434
+ // Note: agent-booster export declared but dist missing in alpha.1; use intelligence path as fallback
435
+ const boosterModule = await import('agentic-flow/agent-booster')
436
+ .catch(() => import(/* @vite-ignore */ 'agentic-flow/intelligence/agent-booster-enhanced'))
437
+ .catch(() => null);
438
+ if (boosterModule?.enhancedApply) {
439
+ const result = await boosterModule.enhancedApply({
440
+ code: originalCode,
441
+ edit: instruction,
442
+ language,
443
+ });
444
+ if (result && result.confidence >= this.config.agentBoosterConfidenceThreshold) {
445
+ return { success: true, confidence: result.confidence, output: result.output };
538
446
  }
447
+ return { success: false, confidence: result?.confidence ?? 0 };
448
+ }
449
+ // Fallback: shell out to npx agent-booster
450
+ // Sanitize language to prevent command injection (whitelist only)
451
+ const SAFE_LANGUAGES = ['javascript', 'typescript', 'python', 'rust', 'go', 'java', 'c', 'cpp', 'ruby', 'swift', 'kotlin'];
452
+ const safeLang = SAFE_LANGUAGES.includes(language) ? language : 'javascript';
453
+ const { execSync } = await import('child_process');
454
+ const cmd = `npx --yes agent-booster@0.2.2 apply --language ${safeLang}`;
455
+ const result = execSync(cmd, {
456
+ encoding: 'utf-8',
457
+ input: JSON.stringify({ code: originalCode, edit: instruction }),
458
+ maxBuffer: 10 * 1024 * 1024,
459
+ timeout: 5000,
460
+ stdio: ['pipe', 'pipe', 'pipe'],
539
461
  });
540
- });
541
- };
462
+ const parsed = JSON.parse(result);
463
+ if (parsed.confidence >= this.config.agentBoosterConfidenceThreshold) {
464
+ return { success: true, confidence: parsed.confidence, output: parsed.output };
465
+ }
466
+ return { success: false, confidence: parsed.confidence ?? 0 };
467
+ }
468
+ catch {
469
+ // Agent Booster not available or failed
470
+ return { success: false, confidence: 0 };
471
+ }
472
+ }
542
473
  /**
543
474
  * Get router statistics
544
475
  */
545
- EnhancedModelRouter.prototype.getStats = function () {
476
+ getStats() {
546
477
  return {
547
- config: __assign({}, this.config),
548
- tinyDancerStats: this.tinyDancerRouter.getStats()
478
+ config: { ...this.config },
479
+ tinyDancerStats: this.tinyDancerRouter.getStats(),
549
480
  };
550
- };
551
- return EnhancedModelRouter;
552
- }());
553
- export { EnhancedModelRouter };
481
+ }
482
+ }
554
483
  // ============================================================================
555
484
  // Singleton & Factory Functions
556
485
  // ============================================================================
557
- var enhancedRouterInstance = null;
486
+ let enhancedRouterInstance = null;
558
487
  /**
559
488
  * Get or create the singleton EnhancedModelRouter instance
560
489
  */
@@ -582,23 +511,18 @@ export function createEnhancedModelRouter(config) {
582
511
  /**
583
512
  * Quick route function with enhanced routing
584
513
  */
585
- export function enhancedRouteToModel(task, context) {
586
- return __awaiter(this, void 0, Promise, function () {
587
- var router;
588
- return __generator(this, function (_a) {
589
- router = getEnhancedModelRouter();
590
- return [2 /*return*/, router.route(task, context)];
591
- });
592
- });
514
+ export async function enhancedRouteToModel(task, context) {
515
+ const router = getEnhancedModelRouter();
516
+ return router.route(task, context);
593
517
  }
594
518
  /**
595
519
  * Detect if a task can be handled by Agent Booster
596
520
  */
597
521
  export function canUseAgentBooster(task) {
598
- var router = getEnhancedModelRouter();
599
- var intent = router.detectIntent(task);
522
+ const router = getEnhancedModelRouter();
523
+ const intent = router.detectIntent(task);
600
524
  if (intent && intent.confidence >= 0.7) {
601
- return { canUse: true, intent: intent };
525
+ return { canUse: true, intent };
602
526
  }
603
527
  return { canUse: false };
604
528
  }