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
@@ -3,65 +3,18 @@
3
3
  * Handles actual plugin installation, persistence, and lifecycle
4
4
  * Bridges discovery service with file system persistence
5
5
  */
6
- var __assign = (this && this.__assign) || function () {
7
- __assign = Object.assign || function(t) {
8
- for (var s, i = 1, n = arguments.length; i < n; i++) {
9
- s = arguments[i];
10
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
11
- t[p] = s[p];
12
- }
13
- return t;
14
- };
15
- return __assign.apply(this, arguments);
16
- };
17
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
18
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
19
- return new (P || (P = Promise))(function (resolve, reject) {
20
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
21
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
22
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
23
- step((generator = generator.apply(thisArg, _arguments || [])).next());
24
- });
25
- };
26
- var __generator = (this && this.__generator) || function (thisArg, body) {
27
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
28
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
29
- function verb(n) { return function (v) { return step([n, v]); }; }
30
- function step(op) {
31
- if (f) throw new TypeError("Generator is already executing.");
32
- while (_) try {
33
- 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;
34
- if (y = 0, t) op = [op[0] & 2, t.value];
35
- switch (op[0]) {
36
- case 0: case 1: t = op; break;
37
- case 4: _.label++; return { value: op[1], done: false };
38
- case 5: _.label++; y = op[1]; op = [0]; continue;
39
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
40
- default:
41
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
42
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
43
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
44
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
45
- if (t[2]) _.ops.pop();
46
- _.trys.pop(); continue;
47
- }
48
- op = body.call(thisArg, _);
49
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
50
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
51
- }
52
- };
53
6
  import * as fs from 'fs';
54
7
  import * as path from 'path';
55
8
  import { execFile } from 'child_process';
56
9
  import { promisify } from 'util';
57
- var execFileAsync = promisify(execFile);
10
+ const execFileAsync = promisify(execFile);
58
11
  /**
59
12
  * Validate npm package name to prevent shell injection (S-3)
60
13
  */
61
- var VALID_PACKAGE_RE = /^(@[a-z0-9-~][a-z0-9-._~]*\/)?[a-z0-9-~][a-z0-9-._~]*(@[a-z0-9._\-^~>=<]+)?$/;
14
+ const VALID_PACKAGE_RE = /^(@[a-z0-9-~][a-z0-9-._~]*\/)?[a-z0-9-~][a-z0-9-._~]*(@[a-z0-9._\-^~>=<]+)?$/;
62
15
  function validatePackageName(spec) {
63
16
  if (!VALID_PACKAGE_RE.test(spec)) {
64
- throw new Error("Invalid package name: " + spec);
17
+ throw new Error(`Invalid package name: ${spec}`);
65
18
  }
66
19
  }
67
20
  // ============================================================================
@@ -76,14 +29,14 @@ function validatePackageName(spec) {
76
29
  * - Tracks enabled/disabled state
77
30
  * - Loads plugin modules
78
31
  */
79
- var PluginManager = /** @class */ (function () {
80
- function PluginManager(baseDir) {
81
- if (baseDir === void 0) { baseDir = process.cwd(); }
82
- this.manifest = null;
83
- var pluginsDir = path.join(baseDir, '.claude-flow', 'plugins');
32
+ export class PluginManager {
33
+ config;
34
+ manifest = null;
35
+ constructor(baseDir = process.cwd()) {
36
+ const pluginsDir = path.join(baseDir, '.claude-flow', 'plugins');
84
37
  this.config = {
85
- pluginsDir: pluginsDir,
86
- manifestPath: path.join(pluginsDir, 'installed.json')
38
+ pluginsDir,
39
+ manifestPath: path.join(pluginsDir, 'installed.json'),
87
40
  };
88
41
  }
89
42
  // =========================================================================
@@ -92,541 +45,352 @@ var PluginManager = /** @class */ (function () {
92
45
  /**
93
46
  * Initialize the plugin manager, creating directories and loading manifest
94
47
  */
95
- PluginManager.prototype.initialize = function () {
96
- return __awaiter(this, void 0, Promise, function () {
97
- var _a;
98
- return __generator(this, function (_b) {
99
- switch (_b.label) {
100
- case 0:
101
- // Ensure plugins directory exists
102
- return [4 /*yield*/, this.ensureDirectory(this.config.pluginsDir)];
103
- case 1:
104
- // Ensure plugins directory exists
105
- _b.sent();
106
- // Load or create manifest
107
- _a = this;
108
- return [4 /*yield*/, this.loadManifest()];
109
- case 2:
110
- // Load or create manifest
111
- _a.manifest = _b.sent();
112
- return [2 /*return*/];
113
- }
114
- });
115
- });
116
- };
117
- PluginManager.prototype.ensureDirectory = function (dir) {
118
- return __awaiter(this, void 0, Promise, function () {
119
- return __generator(this, function (_a) {
120
- if (!fs.existsSync(dir)) {
121
- fs.mkdirSync(dir, { recursive: true });
122
- }
123
- return [2 /*return*/];
124
- });
125
- });
126
- };
127
- PluginManager.prototype.loadManifest = function () {
128
- return __awaiter(this, void 0, Promise, function () {
129
- var content;
130
- return __generator(this, function (_a) {
131
- try {
132
- if (fs.existsSync(this.config.manifestPath)) {
133
- content = fs.readFileSync(this.config.manifestPath, 'utf-8');
134
- return [2 /*return*/, JSON.parse(content)];
135
- }
136
- }
137
- catch (error) {
138
- console.warn('[PluginManager] Failed to load manifest, creating new one');
139
- }
140
- return [2 /*return*/, {
141
- version: '1.0.0',
142
- lastUpdated: new Date().toISOString(),
143
- plugins: {}
144
- }];
145
- });
146
- });
147
- };
148
- PluginManager.prototype.saveManifest = function () {
149
- return __awaiter(this, void 0, Promise, function () {
150
- return __generator(this, function (_a) {
151
- switch (_a.label) {
152
- case 0:
153
- if (!this.manifest)
154
- return [2 /*return*/];
155
- this.manifest.lastUpdated = new Date().toISOString();
156
- return [4 /*yield*/, this.ensureDirectory(path.dirname(this.config.manifestPath))];
157
- case 1:
158
- _a.sent();
159
- fs.writeFileSync(this.config.manifestPath, JSON.stringify(this.manifest, null, 2), 'utf-8');
160
- return [2 /*return*/];
161
- }
162
- });
163
- });
164
- };
48
+ async initialize() {
49
+ // Ensure plugins directory exists
50
+ await this.ensureDirectory(this.config.pluginsDir);
51
+ // Load or create manifest
52
+ this.manifest = await this.loadManifest();
53
+ }
54
+ async ensureDirectory(dir) {
55
+ if (!fs.existsSync(dir)) {
56
+ fs.mkdirSync(dir, { recursive: true });
57
+ }
58
+ }
59
+ async loadManifest() {
60
+ try {
61
+ if (fs.existsSync(this.config.manifestPath)) {
62
+ const content = fs.readFileSync(this.config.manifestPath, 'utf-8');
63
+ return JSON.parse(content);
64
+ }
65
+ }
66
+ catch (error) {
67
+ console.warn('[PluginManager] Failed to load manifest, creating new one');
68
+ }
69
+ return {
70
+ version: '1.0.0',
71
+ lastUpdated: new Date().toISOString(),
72
+ plugins: {},
73
+ };
74
+ }
75
+ async saveManifest() {
76
+ if (!this.manifest)
77
+ return;
78
+ this.manifest.lastUpdated = new Date().toISOString();
79
+ await this.ensureDirectory(path.dirname(this.config.manifestPath));
80
+ fs.writeFileSync(this.config.manifestPath, JSON.stringify(this.manifest, null, 2), 'utf-8');
81
+ }
165
82
  // =========================================================================
166
83
  // Installation
167
84
  // =========================================================================
168
85
  /**
169
86
  * Install a plugin from npm
170
87
  */
171
- PluginManager.prototype.installFromNpm = function (packageName, version) {
172
- return __awaiter(this, void 0, Promise, function () {
173
- var versionSpec, installDir, packageJsonPath, installedVersion, commands, hooks, pkg, plugin, error_1, errorMsg;
174
- return __generator(this, function (_a) {
175
- switch (_a.label) {
176
- case 0:
177
- if (!!this.manifest) return [3 /*break*/, 2];
178
- return [4 /*yield*/, this.initialize()];
179
- case 1:
180
- _a.sent();
181
- _a.label = 2;
182
- case 2:
183
- versionSpec = version ? packageName + "@" + version : packageName;
184
- _a.label = 3;
185
- case 3:
186
- _a.trys.push([3, 7, , 8]);
187
- // Check if already installed
188
- if (this.manifest.plugins[packageName]) {
189
- return [2 /*return*/, {
190
- success: false,
191
- error: "Plugin " + packageName + " is already installed. Use upgrade to update."
192
- }];
193
- }
194
- installDir = path.join(this.config.pluginsDir, 'node_modules');
195
- return [4 /*yield*/, this.ensureDirectory(installDir)];
196
- case 4:
197
- _a.sent();
198
- // Validate package name to prevent injection (S-3)
199
- validatePackageName(versionSpec);
200
- // Use npm to install (array form prevents shell injection)
201
- console.log("[PluginManager] Installing " + versionSpec + "...");
202
- return [4 /*yield*/, execFileAsync('npm', ['install', '--prefix', this.config.pluginsDir, versionSpec], { timeout: 120000 })];
203
- case 5:
204
- _a.sent();
205
- packageJsonPath = path.join(installDir, packageName, 'package.json');
206
- installedVersion = version || 'latest';
207
- commands = [];
208
- hooks = [];
209
- if (fs.existsSync(packageJsonPath)) {
210
- pkg = JSON.parse(fs.readFileSync(packageJsonPath, 'utf-8'));
211
- installedVersion = pkg.version;
212
- // Check for claude-flow plugin metadata
213
- if (pkg['claude-flow']) {
214
- commands = pkg['claude-flow'].commands || [];
215
- hooks = pkg['claude-flow'].hooks || [];
216
- }
217
- }
218
- plugin = {
219
- name: packageName,
220
- version: installedVersion,
221
- installedAt: new Date().toISOString(),
222
- enabled: true,
223
- source: 'npm',
224
- path: path.join(installDir, packageName),
225
- commands: commands,
226
- hooks: hooks
227
- };
228
- // Save to manifest
229
- this.manifest.plugins[packageName] = plugin;
230
- return [4 /*yield*/, this.saveManifest()];
231
- case 6:
232
- _a.sent();
233
- console.log("[PluginManager] Installed " + packageName + "@" + installedVersion);
234
- return [2 /*return*/, { success: true, plugin: plugin }];
235
- case 7:
236
- error_1 = _a.sent();
237
- errorMsg = error_1 instanceof Error ? error_1.message : String(error_1);
238
- console.error("[PluginManager] Failed to install " + packageName + ":", errorMsg);
239
- return [2 /*return*/, { success: false, error: errorMsg }];
240
- case 8: return [2 /*return*/];
88
+ async installFromNpm(packageName, version) {
89
+ if (!this.manifest) {
90
+ await this.initialize();
91
+ }
92
+ const versionSpec = version ? `${packageName}@${version}` : packageName;
93
+ try {
94
+ // Check if already installed
95
+ if (this.manifest.plugins[packageName]) {
96
+ return {
97
+ success: false,
98
+ error: `Plugin ${packageName} is already installed. Use upgrade to update.`,
99
+ };
100
+ }
101
+ // Install to local plugins directory
102
+ const installDir = path.join(this.config.pluginsDir, 'node_modules');
103
+ await this.ensureDirectory(installDir);
104
+ // Validate package name to prevent injection (S-3)
105
+ validatePackageName(versionSpec);
106
+ // Use npm to install (array form prevents shell injection)
107
+ console.log(`[PluginManager] Installing ${versionSpec}...`);
108
+ await execFileAsync('npm', ['install', '--prefix', this.config.pluginsDir, versionSpec], { timeout: 120000 });
109
+ // Get installed version
110
+ const packageJsonPath = path.join(installDir, packageName, 'package.json');
111
+ let installedVersion = version || 'latest';
112
+ let commands = [];
113
+ let hooks = [];
114
+ if (fs.existsSync(packageJsonPath)) {
115
+ const pkg = JSON.parse(fs.readFileSync(packageJsonPath, 'utf-8'));
116
+ installedVersion = pkg.version;
117
+ // Check for claude-flow plugin metadata
118
+ if (pkg['claude-flow']) {
119
+ commands = pkg['claude-flow'].commands || [];
120
+ hooks = pkg['claude-flow'].hooks || [];
241
121
  }
242
- });
243
- });
244
- };
122
+ }
123
+ // Create plugin entry
124
+ const plugin = {
125
+ name: packageName,
126
+ version: installedVersion,
127
+ installedAt: new Date().toISOString(),
128
+ enabled: true,
129
+ source: 'npm',
130
+ path: path.join(installDir, packageName),
131
+ commands,
132
+ hooks,
133
+ };
134
+ // Save to manifest
135
+ this.manifest.plugins[packageName] = plugin;
136
+ await this.saveManifest();
137
+ console.log(`[PluginManager] Installed ${packageName}@${installedVersion}`);
138
+ return { success: true, plugin };
139
+ }
140
+ catch (error) {
141
+ const errorMsg = error instanceof Error ? error.message : String(error);
142
+ console.error(`[PluginManager] Failed to install ${packageName}:`, errorMsg);
143
+ return { success: false, error: errorMsg };
144
+ }
145
+ }
245
146
  /**
246
147
  * Install a plugin from a local path
247
148
  */
248
- PluginManager.prototype.installFromLocal = function (sourcePath) {
249
- var _a, _b;
250
- return __awaiter(this, void 0, Promise, function () {
251
- var absolutePath, packageJsonPath, pkg, packageName, plugin, error_2, errorMsg;
252
- return __generator(this, function (_c) {
253
- switch (_c.label) {
254
- case 0:
255
- if (!!this.manifest) return [3 /*break*/, 2];
256
- return [4 /*yield*/, this.initialize()];
257
- case 1:
258
- _c.sent();
259
- _c.label = 2;
260
- case 2:
261
- _c.trys.push([2, 4, , 5]);
262
- absolutePath = path.resolve(sourcePath);
263
- if (!fs.existsSync(absolutePath)) {
264
- return [2 /*return*/, { success: false, error: "Path does not exist: " + absolutePath }];
265
- }
266
- packageJsonPath = path.join(absolutePath, 'package.json');
267
- if (!fs.existsSync(packageJsonPath)) {
268
- return [2 /*return*/, { success: false, error: 'No package.json found at path' }];
269
- }
270
- pkg = JSON.parse(fs.readFileSync(packageJsonPath, 'utf-8'));
271
- packageName = pkg.name;
272
- // Check if already installed
273
- if (this.manifest.plugins[packageName]) {
274
- return [2 /*return*/, {
275
- success: false,
276
- error: "Plugin " + packageName + " is already installed"
277
- }];
278
- }
279
- plugin = {
280
- name: packageName,
281
- version: pkg.version,
282
- installedAt: new Date().toISOString(),
283
- enabled: true,
284
- source: 'local',
285
- path: absolutePath,
286
- commands: ((_a = pkg['claude-flow']) === null || _a === void 0 ? void 0 : _a.commands) || [],
287
- hooks: ((_b = pkg['claude-flow']) === null || _b === void 0 ? void 0 : _b.hooks) || []
288
- };
289
- // Save to manifest
290
- this.manifest.plugins[packageName] = plugin;
291
- return [4 /*yield*/, this.saveManifest()];
292
- case 3:
293
- _c.sent();
294
- console.log("[PluginManager] Installed local plugin " + packageName + "@" + pkg.version);
295
- return [2 /*return*/, { success: true, plugin: plugin }];
296
- case 4:
297
- error_2 = _c.sent();
298
- errorMsg = error_2 instanceof Error ? error_2.message : String(error_2);
299
- console.error("[PluginManager] Failed to install from local:", errorMsg);
300
- return [2 /*return*/, { success: false, error: errorMsg }];
301
- case 5: return [2 /*return*/];
302
- }
303
- });
304
- });
305
- };
149
+ async installFromLocal(sourcePath) {
150
+ if (!this.manifest) {
151
+ await this.initialize();
152
+ }
153
+ try {
154
+ const absolutePath = path.resolve(sourcePath);
155
+ if (!fs.existsSync(absolutePath)) {
156
+ return { success: false, error: `Path does not exist: ${absolutePath}` };
157
+ }
158
+ // Read package.json
159
+ const packageJsonPath = path.join(absolutePath, 'package.json');
160
+ if (!fs.existsSync(packageJsonPath)) {
161
+ return { success: false, error: 'No package.json found at path' };
162
+ }
163
+ const pkg = JSON.parse(fs.readFileSync(packageJsonPath, 'utf-8'));
164
+ const packageName = pkg.name;
165
+ // Check if already installed
166
+ if (this.manifest.plugins[packageName]) {
167
+ return {
168
+ success: false,
169
+ error: `Plugin ${packageName} is already installed`,
170
+ };
171
+ }
172
+ // Create plugin entry (link to local path, don't copy)
173
+ const plugin = {
174
+ name: packageName,
175
+ version: pkg.version,
176
+ installedAt: new Date().toISOString(),
177
+ enabled: true,
178
+ source: 'local',
179
+ path: absolutePath,
180
+ commands: pkg['claude-flow']?.commands || [],
181
+ hooks: pkg['claude-flow']?.hooks || [],
182
+ };
183
+ // Save to manifest
184
+ this.manifest.plugins[packageName] = plugin;
185
+ await this.saveManifest();
186
+ console.log(`[PluginManager] Installed local plugin ${packageName}@${pkg.version}`);
187
+ return { success: true, plugin };
188
+ }
189
+ catch (error) {
190
+ const errorMsg = error instanceof Error ? error.message : String(error);
191
+ console.error(`[PluginManager] Failed to install from local:`, errorMsg);
192
+ return { success: false, error: errorMsg };
193
+ }
194
+ }
306
195
  // =========================================================================
307
196
  // Uninstallation
308
197
  // =========================================================================
309
198
  /**
310
199
  * Uninstall a plugin
311
200
  */
312
- PluginManager.prototype.uninstall = function (packageName) {
313
- return __awaiter(this, void 0, Promise, function () {
314
- var plugin, error_3, errorMsg;
315
- return __generator(this, function (_a) {
316
- switch (_a.label) {
317
- case 0:
318
- if (!!this.manifest) return [3 /*break*/, 2];
319
- return [4 /*yield*/, this.initialize()];
320
- case 1:
321
- _a.sent();
322
- _a.label = 2;
323
- case 2:
324
- plugin = this.manifest.plugins[packageName];
325
- if (!plugin) {
326
- return [2 /*return*/, { success: false, error: "Plugin " + packageName + " is not installed" }];
327
- }
328
- _a.label = 3;
329
- case 3:
330
- _a.trys.push([3, 7, , 8]);
331
- if (!(plugin.source === 'npm')) return [3 /*break*/, 5];
332
- validatePackageName(packageName);
333
- return [4 /*yield*/, execFileAsync('npm', ['uninstall', '--prefix', this.config.pluginsDir, packageName], { timeout: 60000 })];
334
- case 4:
335
- _a.sent();
336
- _a.label = 5;
337
- case 5:
338
- // Remove from manifest
339
- delete this.manifest.plugins[packageName];
340
- return [4 /*yield*/, this.saveManifest()];
341
- case 6:
342
- _a.sent();
343
- console.log("[PluginManager] Uninstalled " + packageName);
344
- return [2 /*return*/, { success: true }];
345
- case 7:
346
- error_3 = _a.sent();
347
- errorMsg = error_3 instanceof Error ? error_3.message : String(error_3);
348
- console.error("[PluginManager] Failed to uninstall " + packageName + ":", errorMsg);
349
- return [2 /*return*/, { success: false, error: errorMsg }];
350
- case 8: return [2 /*return*/];
351
- }
352
- });
353
- });
354
- };
201
+ async uninstall(packageName) {
202
+ if (!this.manifest) {
203
+ await this.initialize();
204
+ }
205
+ const plugin = this.manifest.plugins[packageName];
206
+ if (!plugin) {
207
+ return { success: false, error: `Plugin ${packageName} is not installed` };
208
+ }
209
+ try {
210
+ // For npm-installed plugins, remove from node_modules
211
+ if (plugin.source === 'npm') {
212
+ validatePackageName(packageName);
213
+ await execFileAsync('npm', ['uninstall', '--prefix', this.config.pluginsDir, packageName], { timeout: 60000 });
214
+ }
215
+ // Remove from manifest
216
+ delete this.manifest.plugins[packageName];
217
+ await this.saveManifest();
218
+ console.log(`[PluginManager] Uninstalled ${packageName}`);
219
+ return { success: true };
220
+ }
221
+ catch (error) {
222
+ const errorMsg = error instanceof Error ? error.message : String(error);
223
+ console.error(`[PluginManager] Failed to uninstall ${packageName}:`, errorMsg);
224
+ return { success: false, error: errorMsg };
225
+ }
226
+ }
355
227
  // =========================================================================
356
228
  // Enable/Disable
357
229
  // =========================================================================
358
230
  /**
359
231
  * Enable a plugin
360
232
  */
361
- PluginManager.prototype.enable = function (packageName) {
362
- return __awaiter(this, void 0, Promise, function () {
363
- var plugin;
364
- return __generator(this, function (_a) {
365
- switch (_a.label) {
366
- case 0:
367
- if (!!this.manifest) return [3 /*break*/, 2];
368
- return [4 /*yield*/, this.initialize()];
369
- case 1:
370
- _a.sent();
371
- _a.label = 2;
372
- case 2:
373
- plugin = this.manifest.plugins[packageName];
374
- if (!plugin) {
375
- return [2 /*return*/, { success: false, error: "Plugin " + packageName + " is not installed" }];
376
- }
377
- plugin.enabled = true;
378
- return [4 /*yield*/, this.saveManifest()];
379
- case 3:
380
- _a.sent();
381
- return [2 /*return*/, { success: true }];
382
- }
383
- });
384
- });
385
- };
233
+ async enable(packageName) {
234
+ if (!this.manifest) {
235
+ await this.initialize();
236
+ }
237
+ const plugin = this.manifest.plugins[packageName];
238
+ if (!plugin) {
239
+ return { success: false, error: `Plugin ${packageName} is not installed` };
240
+ }
241
+ plugin.enabled = true;
242
+ await this.saveManifest();
243
+ return { success: true };
244
+ }
386
245
  /**
387
246
  * Disable a plugin
388
247
  */
389
- PluginManager.prototype.disable = function (packageName) {
390
- return __awaiter(this, void 0, Promise, function () {
391
- var plugin;
392
- return __generator(this, function (_a) {
393
- switch (_a.label) {
394
- case 0:
395
- if (!!this.manifest) return [3 /*break*/, 2];
396
- return [4 /*yield*/, this.initialize()];
397
- case 1:
398
- _a.sent();
399
- _a.label = 2;
400
- case 2:
401
- plugin = this.manifest.plugins[packageName];
402
- if (!plugin) {
403
- return [2 /*return*/, { success: false, error: "Plugin " + packageName + " is not installed" }];
404
- }
405
- plugin.enabled = false;
406
- return [4 /*yield*/, this.saveManifest()];
407
- case 3:
408
- _a.sent();
409
- return [2 /*return*/, { success: true }];
410
- }
411
- });
412
- });
413
- };
248
+ async disable(packageName) {
249
+ if (!this.manifest) {
250
+ await this.initialize();
251
+ }
252
+ const plugin = this.manifest.plugins[packageName];
253
+ if (!plugin) {
254
+ return { success: false, error: `Plugin ${packageName} is not installed` };
255
+ }
256
+ plugin.enabled = false;
257
+ await this.saveManifest();
258
+ return { success: true };
259
+ }
414
260
  /**
415
261
  * Toggle a plugin's enabled state
416
262
  */
417
- PluginManager.prototype.toggle = function (packageName) {
418
- return __awaiter(this, void 0, Promise, function () {
419
- var plugin;
420
- return __generator(this, function (_a) {
421
- switch (_a.label) {
422
- case 0:
423
- if (!!this.manifest) return [3 /*break*/, 2];
424
- return [4 /*yield*/, this.initialize()];
425
- case 1:
426
- _a.sent();
427
- _a.label = 2;
428
- case 2:
429
- plugin = this.manifest.plugins[packageName];
430
- if (!plugin) {
431
- return [2 /*return*/, { success: false, error: "Plugin " + packageName + " is not installed" }];
432
- }
433
- plugin.enabled = !plugin.enabled;
434
- return [4 /*yield*/, this.saveManifest()];
435
- case 3:
436
- _a.sent();
437
- return [2 /*return*/, { success: true, enabled: plugin.enabled }];
438
- }
439
- });
440
- });
441
- };
263
+ async toggle(packageName) {
264
+ if (!this.manifest) {
265
+ await this.initialize();
266
+ }
267
+ const plugin = this.manifest.plugins[packageName];
268
+ if (!plugin) {
269
+ return { success: false, error: `Plugin ${packageName} is not installed` };
270
+ }
271
+ plugin.enabled = !plugin.enabled;
272
+ await this.saveManifest();
273
+ return { success: true, enabled: plugin.enabled };
274
+ }
442
275
  // =========================================================================
443
276
  // Query
444
277
  // =========================================================================
445
278
  /**
446
279
  * Get all installed plugins
447
280
  */
448
- PluginManager.prototype.getInstalled = function () {
449
- return __awaiter(this, void 0, Promise, function () {
450
- return __generator(this, function (_a) {
451
- switch (_a.label) {
452
- case 0:
453
- if (!!this.manifest) return [3 /*break*/, 2];
454
- return [4 /*yield*/, this.initialize()];
455
- case 1:
456
- _a.sent();
457
- _a.label = 2;
458
- case 2: return [2 /*return*/, Object.values(this.manifest.plugins)];
459
- }
460
- });
461
- });
462
- };
281
+ async getInstalled() {
282
+ if (!this.manifest) {
283
+ await this.initialize();
284
+ }
285
+ return Object.values(this.manifest.plugins);
286
+ }
463
287
  /**
464
288
  * Get enabled plugins
465
289
  */
466
- PluginManager.prototype.getEnabled = function () {
467
- return __awaiter(this, void 0, Promise, function () {
468
- var all;
469
- return __generator(this, function (_a) {
470
- switch (_a.label) {
471
- case 0: return [4 /*yield*/, this.getInstalled()];
472
- case 1:
473
- all = _a.sent();
474
- return [2 /*return*/, all.filter(function (p) { return p.enabled; })];
475
- }
476
- });
477
- });
478
- };
290
+ async getEnabled() {
291
+ const all = await this.getInstalled();
292
+ return all.filter(p => p.enabled);
293
+ }
479
294
  /**
480
295
  * Check if a plugin is installed
481
296
  */
482
- PluginManager.prototype.isInstalled = function (packageName) {
483
- return __awaiter(this, void 0, Promise, function () {
484
- return __generator(this, function (_a) {
485
- switch (_a.label) {
486
- case 0:
487
- if (!!this.manifest) return [3 /*break*/, 2];
488
- return [4 /*yield*/, this.initialize()];
489
- case 1:
490
- _a.sent();
491
- _a.label = 2;
492
- case 2: return [2 /*return*/, packageName in this.manifest.plugins];
493
- }
494
- });
495
- });
496
- };
297
+ async isInstalled(packageName) {
298
+ if (!this.manifest) {
299
+ await this.initialize();
300
+ }
301
+ return packageName in this.manifest.plugins;
302
+ }
497
303
  /**
498
304
  * Get a specific installed plugin
499
305
  */
500
- PluginManager.prototype.getPlugin = function (packageName) {
501
- return __awaiter(this, void 0, Promise, function () {
502
- return __generator(this, function (_a) {
503
- switch (_a.label) {
504
- case 0:
505
- if (!!this.manifest) return [3 /*break*/, 2];
506
- return [4 /*yield*/, this.initialize()];
507
- case 1:
508
- _a.sent();
509
- _a.label = 2;
510
- case 2: return [2 /*return*/, this.manifest.plugins[packageName]];
511
- }
512
- });
513
- });
514
- };
306
+ async getPlugin(packageName) {
307
+ if (!this.manifest) {
308
+ await this.initialize();
309
+ }
310
+ return this.manifest.plugins[packageName];
311
+ }
515
312
  // =========================================================================
516
313
  // Upgrade
517
314
  // =========================================================================
518
315
  /**
519
316
  * Upgrade a plugin to a new version
520
317
  */
521
- PluginManager.prototype.upgrade = function (packageName, version) {
522
- var _a, _b;
523
- return __awaiter(this, void 0, Promise, function () {
524
- var existing, versionSpec, installDir, packageJsonPath, pkg, error_4, errorMsg;
525
- return __generator(this, function (_c) {
526
- switch (_c.label) {
527
- case 0:
528
- if (!!this.manifest) return [3 /*break*/, 2];
529
- return [4 /*yield*/, this.initialize()];
530
- case 1:
531
- _c.sent();
532
- _c.label = 2;
533
- case 2:
534
- existing = this.manifest.plugins[packageName];
535
- if (!existing) {
536
- return [2 /*return*/, { success: false, error: "Plugin " + packageName + " is not installed" }];
537
- }
538
- if (existing.source !== 'npm') {
539
- return [2 /*return*/, { success: false, error: 'Can only upgrade npm-installed plugins' }];
540
- }
541
- _c.label = 3;
542
- case 3:
543
- _c.trys.push([3, 6, , 7]);
544
- versionSpec = version ? packageName + "@" + version : packageName + "@latest";
545
- // Validate package name to prevent injection (S-3)
546
- validatePackageName(versionSpec);
547
- // Reinstall with new version (array form prevents shell injection)
548
- return [4 /*yield*/, execFileAsync('npm', ['install', '--prefix', this.config.pluginsDir, versionSpec], { timeout: 120000 })];
549
- case 4:
550
- // Reinstall with new version (array form prevents shell injection)
551
- _c.sent();
552
- installDir = path.join(this.config.pluginsDir, 'node_modules');
553
- packageJsonPath = path.join(installDir, packageName, 'package.json');
554
- if (fs.existsSync(packageJsonPath)) {
555
- pkg = JSON.parse(fs.readFileSync(packageJsonPath, 'utf-8'));
556
- existing.version = pkg.version;
557
- existing.commands = ((_a = pkg['claude-flow']) === null || _a === void 0 ? void 0 : _a.commands) || existing.commands;
558
- existing.hooks = ((_b = pkg['claude-flow']) === null || _b === void 0 ? void 0 : _b.hooks) || existing.hooks;
559
- }
560
- return [4 /*yield*/, this.saveManifest()];
561
- case 5:
562
- _c.sent();
563
- console.log("[PluginManager] Upgraded " + packageName + " to " + existing.version);
564
- return [2 /*return*/, { success: true, plugin: existing }];
565
- case 6:
566
- error_4 = _c.sent();
567
- errorMsg = error_4 instanceof Error ? error_4.message : String(error_4);
568
- return [2 /*return*/, { success: false, error: errorMsg }];
569
- case 7: return [2 /*return*/];
570
- }
571
- });
572
- });
573
- };
318
+ async upgrade(packageName, version) {
319
+ if (!this.manifest) {
320
+ await this.initialize();
321
+ }
322
+ const existing = this.manifest.plugins[packageName];
323
+ if (!existing) {
324
+ return { success: false, error: `Plugin ${packageName} is not installed` };
325
+ }
326
+ if (existing.source !== 'npm') {
327
+ return { success: false, error: 'Can only upgrade npm-installed plugins' };
328
+ }
329
+ try {
330
+ const versionSpec = version ? `${packageName}@${version}` : `${packageName}@latest`;
331
+ // Validate package name to prevent injection (S-3)
332
+ validatePackageName(versionSpec);
333
+ // Reinstall with new version (array form prevents shell injection)
334
+ await execFileAsync('npm', ['install', '--prefix', this.config.pluginsDir, versionSpec], { timeout: 120000 });
335
+ // Update manifest
336
+ const installDir = path.join(this.config.pluginsDir, 'node_modules');
337
+ const packageJsonPath = path.join(installDir, packageName, 'package.json');
338
+ if (fs.existsSync(packageJsonPath)) {
339
+ const pkg = JSON.parse(fs.readFileSync(packageJsonPath, 'utf-8'));
340
+ existing.version = pkg.version;
341
+ existing.commands = pkg['claude-flow']?.commands || existing.commands;
342
+ existing.hooks = pkg['claude-flow']?.hooks || existing.hooks;
343
+ }
344
+ await this.saveManifest();
345
+ console.log(`[PluginManager] Upgraded ${packageName} to ${existing.version}`);
346
+ return { success: true, plugin: existing };
347
+ }
348
+ catch (error) {
349
+ const errorMsg = error instanceof Error ? error.message : String(error);
350
+ return { success: false, error: errorMsg };
351
+ }
352
+ }
574
353
  // =========================================================================
575
354
  // Config
576
355
  // =========================================================================
577
356
  /**
578
357
  * Update plugin config
579
358
  */
580
- PluginManager.prototype.setConfig = function (packageName, config) {
581
- return __awaiter(this, void 0, Promise, function () {
582
- var plugin;
583
- return __generator(this, function (_a) {
584
- switch (_a.label) {
585
- case 0:
586
- if (!!this.manifest) return [3 /*break*/, 2];
587
- return [4 /*yield*/, this.initialize()];
588
- case 1:
589
- _a.sent();
590
- _a.label = 2;
591
- case 2:
592
- plugin = this.manifest.plugins[packageName];
593
- if (!plugin) {
594
- return [2 /*return*/, { success: false, error: "Plugin " + packageName + " is not installed" }];
595
- }
596
- plugin.config = __assign(__assign({}, plugin.config), config);
597
- return [4 /*yield*/, this.saveManifest()];
598
- case 3:
599
- _a.sent();
600
- return [2 /*return*/, { success: true }];
601
- }
602
- });
603
- });
604
- };
359
+ async setConfig(packageName, config) {
360
+ if (!this.manifest) {
361
+ await this.initialize();
362
+ }
363
+ const plugin = this.manifest.plugins[packageName];
364
+ if (!plugin) {
365
+ return { success: false, error: `Plugin ${packageName} is not installed` };
366
+ }
367
+ plugin.config = { ...plugin.config, ...config };
368
+ await this.saveManifest();
369
+ return { success: true };
370
+ }
605
371
  /**
606
372
  * Get plugins directory path
607
373
  */
608
- PluginManager.prototype.getPluginsDir = function () {
374
+ getPluginsDir() {
609
375
  return this.config.pluginsDir;
610
- };
376
+ }
611
377
  /**
612
378
  * Get manifest path
613
379
  */
614
- PluginManager.prototype.getManifestPath = function () {
380
+ getManifestPath() {
615
381
  return this.config.manifestPath;
616
- };
617
- return PluginManager;
618
- }());
619
- export { PluginManager };
382
+ }
383
+ }
620
384
  // ============================================================================
621
385
  // Singleton Instance
622
386
  // ============================================================================
623
- var defaultManager = null;
387
+ let defaultManager = null;
624
388
  export function getPluginManager(baseDir) {
625
389
  if (!defaultManager) {
626
390
  defaultManager = new PluginManager(baseDir);
627
391
  }
628
392
  else if (baseDir && defaultManager.getPluginsDir() !== path.join(baseDir, '.claude-flow', 'plugins')) {
629
- console.warn("[PluginManager] Warning: getPluginManager called with different baseDir. Using existing instance. Call resetPluginManager() first to change.");
393
+ console.warn(`[PluginManager] Warning: getPluginManager called with different baseDir. Using existing instance. Call resetPluginManager() first to change.`);
630
394
  }
631
395
  return defaultManager;
632
396
  }