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
@@ -16,88 +16,26 @@
16
16
  * - Result caching with TTL
17
17
  * - Worker heartbeat monitoring
18
18
  */
19
- var __extends = (this && this.__extends) || (function () {
20
- var extendStatics = function (d, b) {
21
- extendStatics = Object.setPrototypeOf ||
22
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
23
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
24
- return extendStatics(d, b);
25
- };
26
- return function (d, b) {
27
- if (typeof b !== "function" && b !== null)
28
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
29
- extendStatics(d, b);
30
- function __() { this.constructor = d; }
31
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
32
- };
33
- })();
34
- var __assign = (this && this.__assign) || function () {
35
- __assign = Object.assign || function(t) {
36
- for (var s, i = 1, n = arguments.length; i < n; i++) {
37
- s = arguments[i];
38
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
39
- t[p] = s[p];
40
- }
41
- return t;
42
- };
43
- return __assign.apply(this, arguments);
44
- };
45
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
46
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
47
- return new (P || (P = Promise))(function (resolve, reject) {
48
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
49
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
50
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
51
- step((generator = generator.apply(thisArg, _arguments || [])).next());
52
- });
53
- };
54
- var __generator = (this && this.__generator) || function (thisArg, body) {
55
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
56
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
57
- function verb(n) { return function (v) { return step([n, v]); }; }
58
- function step(op) {
59
- if (f) throw new TypeError("Generator is already executing.");
60
- while (_) try {
61
- 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;
62
- if (y = 0, t) op = [op[0] & 2, t.value];
63
- switch (op[0]) {
64
- case 0: case 1: t = op; break;
65
- case 4: _.label++; return { value: op[1], done: false };
66
- case 5: _.label++; y = op[1]; op = [0]; continue;
67
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
68
- default:
69
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
70
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
71
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
72
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
73
- if (t[2]) _.ops.pop();
74
- _.trys.pop(); continue;
75
- }
76
- op = body.call(thisArg, _);
77
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
78
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
79
- }
80
- };
81
19
  import { EventEmitter } from 'events';
82
20
  import { randomUUID } from 'crypto';
83
21
  // ============================================
84
22
  // Constants
85
23
  // ============================================
86
- var DEFAULT_CONFIG = {
24
+ const DEFAULT_CONFIG = {
87
25
  redisUrl: 'redis://localhost:6379',
88
26
  queuePrefix: 'claude-flow:queue',
89
- defaultTimeoutMs: 300000,
27
+ defaultTimeoutMs: 300000, // 5 minutes
90
28
  maxRetries: 3,
91
- resultTtlSeconds: 86400,
92
- heartbeatIntervalMs: 30000,
29
+ resultTtlSeconds: 86400, // 24 hours
30
+ heartbeatIntervalMs: 30000, // 30 seconds
93
31
  deadLetterEnabled: true,
94
- visibilityTimeoutMs: 60000
32
+ visibilityTimeoutMs: 60000, // 1 minute
95
33
  };
96
- var PRIORITY_SCORES = {
34
+ const PRIORITY_SCORES = {
97
35
  critical: 4,
98
36
  high: 3,
99
37
  normal: 2,
100
- low: 1
38
+ low: 1,
101
39
  };
102
40
  // ============================================
103
41
  // In-Memory Redis Simulation (for non-Redis environments)
@@ -106,49 +44,47 @@ var PRIORITY_SCORES = {
106
44
  * Simple in-memory queue implementation for environments without Redis
107
45
  * Production should use actual Redis connection
108
46
  */
109
- var InMemoryStore = /** @class */ (function () {
110
- function InMemoryStore() {
111
- this.tasks = new Map();
112
- this.queues = new Map();
113
- this.workers = new Map();
114
- this.results = new Map();
115
- }
47
+ class InMemoryStore {
48
+ tasks = new Map();
49
+ queues = new Map();
50
+ workers = new Map();
51
+ results = new Map();
52
+ cleanupTimer;
116
53
  /**
117
54
  * Start cleanup timer (called after initialization)
118
55
  */
119
- InMemoryStore.prototype.startCleanup = function () {
120
- var _this = this;
56
+ startCleanup() {
121
57
  if (this.cleanupTimer)
122
58
  return;
123
- this.cleanupTimer = setInterval(function () { return _this.cleanupExpired(); }, 60000);
59
+ this.cleanupTimer = setInterval(() => this.cleanupExpired(), 60000);
124
60
  this.cleanupTimer.unref();
125
- };
61
+ }
126
62
  /**
127
63
  * Stop cleanup timer
128
64
  */
129
- InMemoryStore.prototype.stopCleanup = function () {
65
+ stopCleanup() {
130
66
  if (this.cleanupTimer) {
131
67
  clearInterval(this.cleanupTimer);
132
68
  this.cleanupTimer = undefined;
133
69
  }
134
- };
70
+ }
135
71
  // Task operations
136
- InMemoryStore.prototype.setTask = function (id, task) {
72
+ setTask(id, task) {
137
73
  this.tasks.set(id, task);
138
- };
139
- InMemoryStore.prototype.getTask = function (id) {
74
+ }
75
+ getTask(id) {
140
76
  return this.tasks.get(id);
141
- };
142
- InMemoryStore.prototype.deleteTask = function (id) {
143
- this.tasks["delete"](id);
144
- };
77
+ }
78
+ deleteTask(id) {
79
+ this.tasks.delete(id);
80
+ }
145
81
  // Queue operations
146
- InMemoryStore.prototype.pushToQueue = function (queue, taskId, priority) {
147
- var queueTasks = this.queues.get(queue) || [];
82
+ pushToQueue(queue, taskId, priority) {
83
+ const queueTasks = this.queues.get(queue) || [];
148
84
  // Insert based on priority (higher priority = earlier in queue)
149
- var insertIndex = queueTasks.length;
150
- for (var i = 0; i < queueTasks.length; i++) {
151
- var task = this.tasks.get(queueTasks[i]);
85
+ let insertIndex = queueTasks.length;
86
+ for (let i = 0; i < queueTasks.length; i++) {
87
+ const task = this.tasks.get(queueTasks[i]);
152
88
  if (task && PRIORITY_SCORES[task.priority] < priority) {
153
89
  insertIndex = i;
154
90
  break;
@@ -156,575 +92,422 @@ var InMemoryStore = /** @class */ (function () {
156
92
  }
157
93
  queueTasks.splice(insertIndex, 0, taskId);
158
94
  this.queues.set(queue, queueTasks);
159
- };
160
- InMemoryStore.prototype.popFromQueue = function (queue) {
161
- var queueTasks = this.queues.get(queue) || [];
95
+ }
96
+ popFromQueue(queue) {
97
+ const queueTasks = this.queues.get(queue) || [];
162
98
  if (queueTasks.length === 0)
163
99
  return null;
164
100
  return queueTasks.shift() || null;
165
- };
166
- InMemoryStore.prototype.getQueueLength = function (queue) {
101
+ }
102
+ getQueueLength(queue) {
167
103
  return (this.queues.get(queue) || []).length;
168
- };
104
+ }
169
105
  // Worker operations
170
- InMemoryStore.prototype.setWorker = function (workerId, registration) {
106
+ setWorker(workerId, registration) {
171
107
  this.workers.set(workerId, registration);
172
- };
173
- InMemoryStore.prototype.getWorker = function (workerId) {
108
+ }
109
+ getWorker(workerId) {
174
110
  return this.workers.get(workerId);
175
- };
176
- InMemoryStore.prototype.deleteWorker = function (workerId) {
177
- this.workers["delete"](workerId);
178
- };
179
- InMemoryStore.prototype.getAllWorkers = function () {
111
+ }
112
+ deleteWorker(workerId) {
113
+ this.workers.delete(workerId);
114
+ }
115
+ getAllWorkers() {
180
116
  return Array.from(this.workers.values());
181
- };
117
+ }
182
118
  // Result operations
183
- InMemoryStore.prototype.setResult = function (taskId, result, ttlSeconds) {
119
+ setResult(taskId, result, ttlSeconds) {
184
120
  this.results.set(taskId, {
185
- result: result,
186
- expiresAt: Date.now() + ttlSeconds * 1000
121
+ result,
122
+ expiresAt: Date.now() + ttlSeconds * 1000,
187
123
  });
188
- };
189
- InMemoryStore.prototype.getResult = function (taskId) {
190
- var entry = this.results.get(taskId);
124
+ }
125
+ getResult(taskId) {
126
+ const entry = this.results.get(taskId);
191
127
  if (!entry)
192
128
  return undefined;
193
129
  if (Date.now() > entry.expiresAt) {
194
- this.results["delete"](taskId);
130
+ this.results.delete(taskId);
195
131
  return undefined;
196
132
  }
197
133
  return entry.result;
198
- };
134
+ }
199
135
  // Stats
200
- InMemoryStore.prototype.getStats = function () {
136
+ getStats() {
201
137
  return {
202
138
  tasks: this.tasks.size,
203
139
  workers: this.workers.size,
204
- results: this.results.size
140
+ results: this.results.size,
205
141
  };
206
- };
142
+ }
207
143
  // Cleanup
208
- InMemoryStore.prototype.cleanupExpired = function () {
209
- var now = Date.now();
210
- for (var _i = 0, _a = this.results; _i < _a.length; _i++) {
211
- var _b = _a[_i], id = _b[0], entry = _b[1];
144
+ cleanupExpired() {
145
+ const now = Date.now();
146
+ for (const [id, entry] of this.results) {
212
147
  if (now > entry.expiresAt) {
213
- this.results["delete"](id);
148
+ this.results.delete(id);
214
149
  }
215
150
  }
216
- };
217
- return InMemoryStore;
218
- }());
151
+ }
152
+ }
219
153
  // ============================================
220
154
  // WorkerQueue Class
221
155
  // ============================================
222
156
  /**
223
157
  * WorkerQueue - Redis-based task queue for distributed worker execution
224
158
  */
225
- var WorkerQueue = /** @class */ (function (_super) {
226
- __extends(WorkerQueue, _super);
227
- function WorkerQueue(config) {
228
- var _this = _super.call(this) || this;
229
- _this.processingTasks = new Set();
230
- _this.isShuttingDown = false;
231
- _this.maxConcurrent = 1;
232
- _this.initialized = false;
233
- _this.config = __assign(__assign({}, DEFAULT_CONFIG), config);
234
- _this.store = new InMemoryStore();
235
- _this.workerId = "worker-" + randomUUID().slice(0, 8);
236
- return _this;
159
+ export class WorkerQueue extends EventEmitter {
160
+ config;
161
+ store;
162
+ workerId;
163
+ heartbeatTimer;
164
+ processingTasks = new Set();
165
+ isShuttingDown = false;
166
+ maxConcurrent = 1;
167
+ initialized = false;
168
+ constructor(config) {
169
+ super();
170
+ this.config = { ...DEFAULT_CONFIG, ...config };
171
+ this.store = new InMemoryStore();
172
+ this.workerId = `worker-${randomUUID().slice(0, 8)}`;
237
173
  }
238
174
  /**
239
175
  * Initialize the queue (starts cleanup timers)
240
176
  */
241
- WorkerQueue.prototype.initialize = function () {
242
- return __awaiter(this, void 0, Promise, function () {
243
- return __generator(this, function (_a) {
244
- if (this.initialized)
245
- return [2 /*return*/];
246
- this.store.startCleanup();
247
- this.initialized = true;
248
- this.emit('initialized', { workerId: this.workerId });
249
- return [2 /*return*/];
250
- });
251
- });
252
- };
177
+ async initialize() {
178
+ if (this.initialized)
179
+ return;
180
+ this.store.startCleanup();
181
+ this.initialized = true;
182
+ this.emit('initialized', { workerId: this.workerId });
183
+ }
253
184
  // ============================================
254
185
  // Public API - Task Management
255
186
  // ============================================
256
187
  /**
257
188
  * Enqueue a new task
258
189
  */
259
- WorkerQueue.prototype.enqueue = function (workerType, payload, options) {
260
- var _a;
261
- if (payload === void 0) { payload = {}; }
262
- return __awaiter(this, void 0, Promise, function () {
263
- var priority, taskId, task, queueName;
264
- return __generator(this, function (_b) {
265
- switch (_b.label) {
266
- case 0:
267
- if (!!this.initialized) return [3 /*break*/, 2];
268
- return [4 /*yield*/, this.initialize()];
269
- case 1:
270
- _b.sent();
271
- _b.label = 2;
272
- case 2:
273
- // Validate worker type
274
- if (!workerType || typeof workerType !== 'string') {
275
- throw new Error('Invalid worker type');
276
- }
277
- priority = (options === null || options === void 0 ? void 0 : options.priority) || 'normal';
278
- if (!['critical', 'high', 'normal', 'low'].includes(priority)) {
279
- throw new Error("Invalid priority: " + priority);
280
- }
281
- taskId = "task-" + Date.now() + "-" + randomUUID().slice(0, 8);
282
- task = {
283
- id: taskId,
284
- workerType: workerType,
285
- priority: priority,
286
- payload: __assign(__assign({}, payload), { timeoutMs: (options === null || options === void 0 ? void 0 : options.timeoutMs) || this.config.defaultTimeoutMs }),
287
- status: 'pending',
288
- createdAt: new Date(),
289
- retryCount: 0,
290
- maxRetries: (_a = options === null || options === void 0 ? void 0 : options.maxRetries) !== null && _a !== void 0 ? _a : this.config.maxRetries
291
- };
292
- // Store task
293
- this.store.setTask(taskId, task);
294
- queueName = this.getQueueName(workerType);
295
- this.store.pushToQueue(queueName, taskId, PRIORITY_SCORES[priority]);
296
- this.emit('taskEnqueued', { taskId: taskId, workerType: workerType, priority: priority });
297
- return [2 /*return*/, taskId];
298
- }
299
- });
300
- });
301
- };
190
+ async enqueue(workerType, payload = {}, options) {
191
+ // Initialize if needed
192
+ if (!this.initialized) {
193
+ await this.initialize();
194
+ }
195
+ // Validate worker type
196
+ if (!workerType || typeof workerType !== 'string') {
197
+ throw new Error('Invalid worker type');
198
+ }
199
+ // Validate priority
200
+ const priority = options?.priority || 'normal';
201
+ if (!['critical', 'high', 'normal', 'low'].includes(priority)) {
202
+ throw new Error(`Invalid priority: ${priority}`);
203
+ }
204
+ const taskId = `task-${Date.now()}-${randomUUID().slice(0, 8)}`;
205
+ const task = {
206
+ id: taskId,
207
+ workerType,
208
+ priority,
209
+ payload: {
210
+ ...payload,
211
+ timeoutMs: options?.timeoutMs || this.config.defaultTimeoutMs,
212
+ },
213
+ status: 'pending',
214
+ createdAt: new Date(),
215
+ retryCount: 0,
216
+ maxRetries: options?.maxRetries ?? this.config.maxRetries,
217
+ };
218
+ // Store task
219
+ this.store.setTask(taskId, task);
220
+ // Add to priority queue
221
+ const queueName = this.getQueueName(workerType);
222
+ this.store.pushToQueue(queueName, taskId, PRIORITY_SCORES[priority]);
223
+ this.emit('taskEnqueued', { taskId, workerType, priority });
224
+ return taskId;
225
+ }
302
226
  /**
303
227
  * Dequeue a task for processing
304
228
  */
305
- WorkerQueue.prototype.dequeue = function (workerTypes) {
306
- return __awaiter(this, void 0, Promise, function () {
307
- var _i, workerTypes_1, workerType, queueName, taskId, task;
308
- return __generator(this, function (_a) {
309
- if (this.isShuttingDown)
310
- return [2 /*return*/, null];
311
- // Check queues in priority order
312
- for (_i = 0, workerTypes_1 = workerTypes; _i < workerTypes_1.length; _i++) {
313
- workerType = workerTypes_1[_i];
314
- queueName = this.getQueueName(workerType);
315
- taskId = this.store.popFromQueue(queueName);
316
- if (taskId) {
317
- task = this.store.getTask(taskId);
318
- if (task && task.status === 'pending') {
319
- task.status = 'processing';
320
- task.startedAt = new Date();
321
- task.workerId = this.workerId;
322
- this.store.setTask(taskId, task);
323
- this.processingTasks.add(taskId);
324
- this.emit('taskDequeued', { taskId: taskId, workerType: workerType });
325
- return [2 /*return*/, task];
326
- }
327
- }
229
+ async dequeue(workerTypes) {
230
+ if (this.isShuttingDown)
231
+ return null;
232
+ // Check queues in priority order
233
+ for (const workerType of workerTypes) {
234
+ const queueName = this.getQueueName(workerType);
235
+ const taskId = this.store.popFromQueue(queueName);
236
+ if (taskId) {
237
+ const task = this.store.getTask(taskId);
238
+ if (task && task.status === 'pending') {
239
+ task.status = 'processing';
240
+ task.startedAt = new Date();
241
+ task.workerId = this.workerId;
242
+ this.store.setTask(taskId, task);
243
+ this.processingTasks.add(taskId);
244
+ this.emit('taskDequeued', { taskId, workerType });
245
+ return task;
328
246
  }
329
- return [2 /*return*/, null];
330
- });
331
- });
332
- };
247
+ }
248
+ }
249
+ return null;
250
+ }
333
251
  /**
334
252
  * Complete a task with result
335
253
  */
336
- WorkerQueue.prototype.complete = function (taskId, result) {
337
- var _a;
338
- return __awaiter(this, void 0, Promise, function () {
339
- var task;
340
- return __generator(this, function (_b) {
341
- task = this.store.getTask(taskId);
342
- if (!task) {
343
- this.emit('warning', { message: "Task " + taskId + " not found for completion" });
344
- return [2 /*return*/];
345
- }
346
- task.status = 'completed';
347
- task.completedAt = new Date();
348
- task.result = result;
349
- this.store.setTask(taskId, task);
350
- // Store result with TTL
351
- this.store.setResult(taskId, result, this.config.resultTtlSeconds);
352
- this.processingTasks["delete"](taskId);
353
- this.emit('taskCompleted', { taskId: taskId, result: result, duration: task.completedAt.getTime() - (((_a = task.startedAt) === null || _a === void 0 ? void 0 : _a.getTime()) || 0) });
354
- return [2 /*return*/];
355
- });
356
- });
357
- };
254
+ async complete(taskId, result) {
255
+ const task = this.store.getTask(taskId);
256
+ if (!task) {
257
+ this.emit('warning', { message: `Task ${taskId} not found for completion` });
258
+ return;
259
+ }
260
+ task.status = 'completed';
261
+ task.completedAt = new Date();
262
+ task.result = result;
263
+ this.store.setTask(taskId, task);
264
+ // Store result with TTL
265
+ this.store.setResult(taskId, result, this.config.resultTtlSeconds);
266
+ this.processingTasks.delete(taskId);
267
+ this.emit('taskCompleted', { taskId, result, duration: task.completedAt.getTime() - (task.startedAt?.getTime() || 0) });
268
+ }
358
269
  /**
359
270
  * Fail a task with error
360
271
  */
361
- WorkerQueue.prototype.fail = function (taskId, error, retryable) {
362
- if (retryable === void 0) { retryable = true; }
363
- return __awaiter(this, void 0, Promise, function () {
364
- var task, delay, dlqName;
365
- var _this = this;
366
- return __generator(this, function (_a) {
367
- task = this.store.getTask(taskId);
368
- if (!task) {
369
- this.emit('warning', { message: "Task " + taskId + " not found for failure" });
370
- return [2 /*return*/];
371
- }
372
- this.processingTasks["delete"](taskId);
373
- // Check if we should retry
374
- if (retryable && task.retryCount < task.maxRetries) {
375
- task.retryCount++;
376
- task.status = 'pending';
377
- task.startedAt = undefined;
378
- task.workerId = undefined;
379
- task.error = error;
380
- this.store.setTask(taskId, task);
381
- delay = Math.min(30000, 1000 * Math.pow(2, task.retryCount));
382
- setTimeout(function () {
383
- var queueName = _this.getQueueName(task.workerType);
384
- _this.store.pushToQueue(queueName, taskId, PRIORITY_SCORES[task.priority]);
385
- }, delay);
386
- this.emit('taskRetrying', { taskId: taskId, retryCount: task.retryCount, delay: delay });
387
- }
388
- else {
389
- // Move to failed/dead letter
390
- task.status = 'failed';
391
- task.completedAt = new Date();
392
- task.error = error;
393
- this.store.setTask(taskId, task);
394
- if (this.config.deadLetterEnabled) {
395
- dlqName = this.config.queuePrefix + ":dlq";
396
- this.store.pushToQueue(dlqName, taskId, 0);
397
- }
398
- this.emit('taskFailed', { taskId: taskId, error: error, retryCount: task.retryCount });
399
- }
400
- return [2 /*return*/];
401
- });
402
- });
403
- };
272
+ async fail(taskId, error, retryable = true) {
273
+ const task = this.store.getTask(taskId);
274
+ if (!task) {
275
+ this.emit('warning', { message: `Task ${taskId} not found for failure` });
276
+ return;
277
+ }
278
+ this.processingTasks.delete(taskId);
279
+ // Check if we should retry
280
+ if (retryable && task.retryCount < task.maxRetries) {
281
+ task.retryCount++;
282
+ task.status = 'pending';
283
+ task.startedAt = undefined;
284
+ task.workerId = undefined;
285
+ task.error = error;
286
+ this.store.setTask(taskId, task);
287
+ // Re-queue with delay (exponential backoff)
288
+ const delay = Math.min(30000, 1000 * Math.pow(2, task.retryCount));
289
+ setTimeout(() => {
290
+ const queueName = this.getQueueName(task.workerType);
291
+ this.store.pushToQueue(queueName, taskId, PRIORITY_SCORES[task.priority]);
292
+ }, delay);
293
+ this.emit('taskRetrying', { taskId, retryCount: task.retryCount, delay });
294
+ }
295
+ else {
296
+ // Move to failed/dead letter
297
+ task.status = 'failed';
298
+ task.completedAt = new Date();
299
+ task.error = error;
300
+ this.store.setTask(taskId, task);
301
+ if (this.config.deadLetterEnabled) {
302
+ const dlqName = `${this.config.queuePrefix}:dlq`;
303
+ this.store.pushToQueue(dlqName, taskId, 0);
304
+ }
305
+ this.emit('taskFailed', { taskId, error, retryCount: task.retryCount });
306
+ }
307
+ }
404
308
  /**
405
309
  * Get task status
406
310
  */
407
- WorkerQueue.prototype.getTask = function (taskId) {
408
- return __awaiter(this, void 0, Promise, function () {
409
- return __generator(this, function (_a) {
410
- return [2 /*return*/, this.store.getTask(taskId) || null];
411
- });
412
- });
413
- };
311
+ async getTask(taskId) {
312
+ return this.store.getTask(taskId) || null;
313
+ }
414
314
  /**
415
315
  * Get task result
416
316
  */
417
- WorkerQueue.prototype.getResult = function (taskId) {
418
- return __awaiter(this, void 0, Promise, function () {
419
- return __generator(this, function (_a) {
420
- return [2 /*return*/, this.store.getResult(taskId) || null];
421
- });
422
- });
423
- };
317
+ async getResult(taskId) {
318
+ return this.store.getResult(taskId) || null;
319
+ }
424
320
  /**
425
321
  * Cancel a pending task
426
322
  */
427
- WorkerQueue.prototype.cancel = function (taskId) {
428
- return __awaiter(this, void 0, Promise, function () {
429
- var task;
430
- return __generator(this, function (_a) {
431
- task = this.store.getTask(taskId);
432
- if (!task || task.status !== 'pending') {
433
- return [2 /*return*/, false];
434
- }
435
- task.status = 'cancelled';
436
- task.completedAt = new Date();
437
- this.store.setTask(taskId, task);
438
- this.emit('taskCancelled', { taskId: taskId });
439
- return [2 /*return*/, true];
440
- });
441
- });
442
- };
323
+ async cancel(taskId) {
324
+ const task = this.store.getTask(taskId);
325
+ if (!task || task.status !== 'pending') {
326
+ return false;
327
+ }
328
+ task.status = 'cancelled';
329
+ task.completedAt = new Date();
330
+ this.store.setTask(taskId, task);
331
+ this.emit('taskCancelled', { taskId });
332
+ return true;
333
+ }
443
334
  // ============================================
444
335
  // Public API - Worker Management
445
336
  // ============================================
446
337
  /**
447
338
  * Register this instance as a worker
448
339
  */
449
- WorkerQueue.prototype.registerWorker = function (workerTypes, options) {
450
- return __awaiter(this, void 0, Promise, function () {
451
- var registration;
452
- return __generator(this, function (_a) {
453
- switch (_a.label) {
454
- case 0:
455
- if (!!this.initialized) return [3 /*break*/, 2];
456
- return [4 /*yield*/, this.initialize()];
457
- case 1:
458
- _a.sent();
459
- _a.label = 2;
460
- case 2:
461
- // Validate worker types
462
- if (!Array.isArray(workerTypes) || workerTypes.length === 0) {
463
- throw new Error('Worker types must be a non-empty array');
464
- }
465
- this.maxConcurrent = (options === null || options === void 0 ? void 0 : options.maxConcurrent) || 1;
466
- registration = {
467
- workerId: this.workerId,
468
- workerTypes: workerTypes,
469
- maxConcurrent: this.maxConcurrent,
470
- currentTasks: 0,
471
- lastHeartbeat: new Date(),
472
- registeredAt: new Date(),
473
- hostname: options === null || options === void 0 ? void 0 : options.hostname,
474
- containerId: options === null || options === void 0 ? void 0 : options.containerId
475
- };
476
- this.store.setWorker(this.workerId, registration);
477
- // Start heartbeat
478
- this.startHeartbeat();
479
- this.emit('workerRegistered', { workerId: this.workerId, workerTypes: workerTypes });
480
- return [2 /*return*/, this.workerId];
481
- }
482
- });
483
- });
484
- };
340
+ async registerWorker(workerTypes, options) {
341
+ // Initialize if needed
342
+ if (!this.initialized) {
343
+ await this.initialize();
344
+ }
345
+ // Validate worker types
346
+ if (!Array.isArray(workerTypes) || workerTypes.length === 0) {
347
+ throw new Error('Worker types must be a non-empty array');
348
+ }
349
+ this.maxConcurrent = options?.maxConcurrent || 1;
350
+ const registration = {
351
+ workerId: this.workerId,
352
+ workerTypes,
353
+ maxConcurrent: this.maxConcurrent,
354
+ currentTasks: 0,
355
+ lastHeartbeat: new Date(),
356
+ registeredAt: new Date(),
357
+ hostname: options?.hostname,
358
+ containerId: options?.containerId,
359
+ };
360
+ this.store.setWorker(this.workerId, registration);
361
+ // Start heartbeat
362
+ this.startHeartbeat();
363
+ this.emit('workerRegistered', { workerId: this.workerId, workerTypes });
364
+ return this.workerId;
365
+ }
485
366
  /**
486
367
  * Unregister this worker
487
368
  */
488
- WorkerQueue.prototype.unregisterWorker = function () {
489
- return __awaiter(this, void 0, Promise, function () {
490
- return __generator(this, function (_a) {
491
- this.stopHeartbeat();
492
- this.store.deleteWorker(this.workerId);
493
- this.emit('workerUnregistered', { workerId: this.workerId });
494
- return [2 /*return*/];
495
- });
496
- });
497
- };
369
+ async unregisterWorker() {
370
+ this.stopHeartbeat();
371
+ this.store.deleteWorker(this.workerId);
372
+ this.emit('workerUnregistered', { workerId: this.workerId });
373
+ }
498
374
  /**
499
375
  * Get all registered workers
500
376
  */
501
- WorkerQueue.prototype.getWorkers = function () {
502
- return __awaiter(this, void 0, Promise, function () {
503
- return __generator(this, function (_a) {
504
- return [2 /*return*/, this.store.getAllWorkers()];
505
- });
506
- });
507
- };
377
+ async getWorkers() {
378
+ return this.store.getAllWorkers();
379
+ }
508
380
  // ============================================
509
381
  // Public API - Statistics
510
382
  // ============================================
511
383
  /**
512
384
  * Get queue statistics
513
385
  */
514
- WorkerQueue.prototype.getStats = function () {
515
- return __awaiter(this, void 0, Promise, function () {
516
- var storeStats, stats;
517
- return __generator(this, function (_a) {
518
- storeStats = this.store.getStats();
519
- stats = {
520
- pending: 0,
521
- processing: this.processingTasks.size,
522
- completed: 0,
523
- failed: 0,
524
- deadLetter: 0,
525
- byPriority: { critical: 0, high: 0, normal: 0, low: 0 },
526
- byWorkerType: {},
527
- averageWaitTimeMs: 0,
528
- averageProcessingTimeMs: 0
529
- };
530
- return [2 /*return*/, stats];
531
- });
532
- });
533
- };
386
+ async getStats() {
387
+ const storeStats = this.store.getStats();
388
+ // This is a simplified implementation
389
+ // Full implementation would aggregate across all queues
390
+ const stats = {
391
+ pending: 0,
392
+ processing: this.processingTasks.size,
393
+ completed: 0,
394
+ failed: 0,
395
+ deadLetter: 0,
396
+ byPriority: { critical: 0, high: 0, normal: 0, low: 0 },
397
+ byWorkerType: {},
398
+ averageWaitTimeMs: 0,
399
+ averageProcessingTimeMs: 0,
400
+ };
401
+ return stats;
402
+ }
534
403
  // ============================================
535
404
  // Public API - Lifecycle
536
405
  // ============================================
537
406
  /**
538
407
  * Start processing tasks
539
408
  */
540
- WorkerQueue.prototype.start = function (workerTypes, handler, options) {
541
- return __awaiter(this, void 0, Promise, function () {
542
- var processLoop;
543
- var _this = this;
544
- return __generator(this, function (_a) {
545
- switch (_a.label) {
546
- case 0: return [4 /*yield*/, this.registerWorker(workerTypes, { maxConcurrent: options === null || options === void 0 ? void 0 : options.maxConcurrent })];
547
- case 1:
548
- _a.sent();
549
- processLoop = function () { return __awaiter(_this, void 0, void 0, function () {
550
- var _loop_1, this_1;
551
- var _this = this;
552
- return __generator(this, function (_a) {
553
- switch (_a.label) {
554
- case 0:
555
- _loop_1 = function () {
556
- var task_1, error_1;
557
- return __generator(this, function (_b) {
558
- switch (_b.label) {
559
- case 0:
560
- _b.trys.push([0, 7, , 9]);
561
- if (!(this_1.processingTasks.size >= this_1.maxConcurrent)) return [3 /*break*/, 2];
562
- return [4 /*yield*/, new Promise(function (resolve) { return setTimeout(resolve, 100); })];
563
- case 1:
564
- _b.sent();
565
- return [2 /*return*/, "continue"];
566
- case 2: return [4 /*yield*/, this_1.dequeue(workerTypes)];
567
- case 3:
568
- task_1 = _b.sent();
569
- if (!task_1) return [3 /*break*/, 4];
570
- // Process task without blocking the loop (allows concurrency)
571
- this_1.processTask(task_1, handler)["catch"](function (error) {
572
- _this.emit('error', { taskId: task_1.id, error: String(error) });
573
- });
574
- return [3 /*break*/, 6];
575
- case 4:
576
- // No task available, wait before polling again
577
- return [4 /*yield*/, new Promise(function (resolve) { return setTimeout(resolve, 1000); })];
578
- case 5:
579
- // No task available, wait before polling again
580
- _b.sent();
581
- _b.label = 6;
582
- case 6: return [3 /*break*/, 9];
583
- case 7:
584
- error_1 = _b.sent();
585
- this_1.emit('error', { error: error_1 instanceof Error ? error_1.message : String(error_1) });
586
- // Wait before retrying to avoid tight error loop
587
- return [4 /*yield*/, new Promise(function (resolve) { return setTimeout(resolve, 5000); })];
588
- case 8:
589
- // Wait before retrying to avoid tight error loop
590
- _b.sent();
591
- return [3 /*break*/, 9];
592
- case 9: return [2 /*return*/];
593
- }
594
- });
595
- };
596
- this_1 = this;
597
- _a.label = 1;
598
- case 1:
599
- if (!!this.isShuttingDown) return [3 /*break*/, 3];
600
- return [5 /*yield**/, _loop_1()];
601
- case 2:
602
- _a.sent();
603
- return [3 /*break*/, 1];
604
- case 3: return [2 /*return*/];
605
- }
606
- });
607
- }); };
608
- // Start processing
609
- processLoop()["catch"](function (error) {
610
- _this.emit('error', { error: error instanceof Error ? error.message : String(error) });
409
+ async start(workerTypes, handler, options) {
410
+ await this.registerWorker(workerTypes, { maxConcurrent: options?.maxConcurrent });
411
+ const processLoop = async () => {
412
+ while (!this.isShuttingDown) {
413
+ try {
414
+ // Respect concurrency limit
415
+ if (this.processingTasks.size >= this.maxConcurrent) {
416
+ await new Promise(resolve => setTimeout(resolve, 100));
417
+ continue;
418
+ }
419
+ const task = await this.dequeue(workerTypes);
420
+ if (task) {
421
+ // Process task without blocking the loop (allows concurrency)
422
+ this.processTask(task, handler).catch(error => {
423
+ this.emit('error', { taskId: task.id, error: String(error) });
611
424
  });
612
- return [2 /*return*/];
425
+ }
426
+ else {
427
+ // No task available, wait before polling again
428
+ await new Promise(resolve => setTimeout(resolve, 1000));
429
+ }
613
430
  }
614
- });
431
+ catch (error) {
432
+ this.emit('error', { error: error instanceof Error ? error.message : String(error) });
433
+ // Wait before retrying to avoid tight error loop
434
+ await new Promise(resolve => setTimeout(resolve, 5000));
435
+ }
436
+ }
437
+ };
438
+ // Start processing
439
+ processLoop().catch(error => {
440
+ this.emit('error', { error: error instanceof Error ? error.message : String(error) });
615
441
  });
616
- };
442
+ }
617
443
  /**
618
444
  * Process a single task
619
445
  */
620
- WorkerQueue.prototype.processTask = function (task, handler) {
621
- return __awaiter(this, void 0, Promise, function () {
622
- var result, error_2;
623
- return __generator(this, function (_a) {
624
- switch (_a.label) {
625
- case 0:
626
- _a.trys.push([0, 3, , 5]);
627
- return [4 /*yield*/, handler(task)];
628
- case 1:
629
- result = _a.sent();
630
- return [4 /*yield*/, this.complete(task.id, result)];
631
- case 2:
632
- _a.sent();
633
- return [3 /*break*/, 5];
634
- case 3:
635
- error_2 = _a.sent();
636
- return [4 /*yield*/, this.fail(task.id, error_2 instanceof Error ? error_2.message : String(error_2))];
637
- case 4:
638
- _a.sent();
639
- return [3 /*break*/, 5];
640
- case 5: return [2 /*return*/];
641
- }
642
- });
643
- });
644
- };
446
+ async processTask(task, handler) {
447
+ try {
448
+ const result = await handler(task);
449
+ await this.complete(task.id, result);
450
+ }
451
+ catch (error) {
452
+ await this.fail(task.id, error instanceof Error ? error.message : String(error));
453
+ }
454
+ }
645
455
  /**
646
456
  * Shutdown the queue gracefully
647
457
  */
648
- WorkerQueue.prototype.shutdown = function () {
649
- return __awaiter(this, void 0, Promise, function () {
650
- var timeout, start, _i, _a, taskId;
651
- return __generator(this, function (_b) {
652
- switch (_b.label) {
653
- case 0:
654
- if (this.isShuttingDown)
655
- return [2 /*return*/];
656
- this.isShuttingDown = true;
657
- timeout = 30000;
658
- start = Date.now();
659
- _b.label = 1;
660
- case 1:
661
- if (!(this.processingTasks.size > 0 && Date.now() - start < timeout)) return [3 /*break*/, 3];
662
- return [4 /*yield*/, new Promise(function (resolve) { return setTimeout(resolve, 1000); })];
663
- case 2:
664
- _b.sent();
665
- return [3 /*break*/, 1];
666
- case 3:
667
- _i = 0, _a = this.processingTasks;
668
- _b.label = 4;
669
- case 4:
670
- if (!(_i < _a.length)) return [3 /*break*/, 7];
671
- taskId = _a[_i];
672
- return [4 /*yield*/, this.fail(taskId, 'Worker shutdown', false)];
673
- case 5:
674
- _b.sent();
675
- _b.label = 6;
676
- case 6:
677
- _i++;
678
- return [3 /*break*/, 4];
679
- case 7:
680
- // Stop store cleanup
681
- this.store.stopCleanup();
682
- return [4 /*yield*/, this.unregisterWorker()];
683
- case 8:
684
- _b.sent();
685
- this.initialized = false;
686
- this.emit('shutdown', {});
687
- return [2 /*return*/];
688
- }
689
- });
690
- });
691
- };
458
+ async shutdown() {
459
+ if (this.isShuttingDown)
460
+ return;
461
+ this.isShuttingDown = true;
462
+ // Wait for processing tasks to complete (with timeout)
463
+ const timeout = 30000;
464
+ const start = Date.now();
465
+ while (this.processingTasks.size > 0 && Date.now() - start < timeout) {
466
+ await new Promise(resolve => setTimeout(resolve, 1000));
467
+ }
468
+ // Force fail remaining tasks
469
+ for (const taskId of this.processingTasks) {
470
+ await this.fail(taskId, 'Worker shutdown', false);
471
+ }
472
+ // Stop store cleanup
473
+ this.store.stopCleanup();
474
+ await this.unregisterWorker();
475
+ this.initialized = false;
476
+ this.emit('shutdown', {});
477
+ }
692
478
  // ============================================
693
479
  // Private Methods
694
480
  // ============================================
695
481
  /**
696
482
  * Get queue name for worker type
697
483
  */
698
- WorkerQueue.prototype.getQueueName = function (workerType) {
699
- return this.config.queuePrefix + ":" + workerType;
700
- };
484
+ getQueueName(workerType) {
485
+ return `${this.config.queuePrefix}:${workerType}`;
486
+ }
701
487
  /**
702
488
  * Start heartbeat timer
703
489
  */
704
- WorkerQueue.prototype.startHeartbeat = function () {
705
- var _this = this;
706
- this.heartbeatTimer = setInterval(function () {
707
- var registration = _this.store.getWorker(_this.workerId);
490
+ startHeartbeat() {
491
+ this.heartbeatTimer = setInterval(() => {
492
+ const registration = this.store.getWorker(this.workerId);
708
493
  if (registration) {
709
494
  registration.lastHeartbeat = new Date();
710
- registration.currentTasks = _this.processingTasks.size;
711
- _this.store.setWorker(_this.workerId, registration);
495
+ registration.currentTasks = this.processingTasks.size;
496
+ this.store.setWorker(this.workerId, registration);
712
497
  }
713
498
  }, this.config.heartbeatIntervalMs);
714
499
  this.heartbeatTimer.unref();
715
- };
500
+ }
716
501
  /**
717
502
  * Stop heartbeat timer
718
503
  */
719
- WorkerQueue.prototype.stopHeartbeat = function () {
504
+ stopHeartbeat() {
720
505
  if (this.heartbeatTimer) {
721
506
  clearInterval(this.heartbeatTimer);
722
507
  this.heartbeatTimer = undefined;
723
508
  }
724
- };
725
- return WorkerQueue;
726
- }(EventEmitter));
727
- export { WorkerQueue };
509
+ }
510
+ }
728
511
  // Export default
729
512
  export default WorkerQueue;
730
513
  //# sourceMappingURL=worker-queue.js.map