claude-flow 3.7.0-alpha.45 → 3.7.0-alpha.46

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 (405) hide show
  1. package/.claude/scheduled_tasks.lock +1 -0
  2. package/.claude/worktrees/adr-120-impl/tests/.tmp-ctx-test/dedup-json.json +35 -0
  3. package/.claude/worktrees/adr-120-impl/tests/.tmp-ctx-test/empty.json +1 -0
  4. package/.claude/worktrees/adr-120-impl/tests/.tmp-ctx-test/json-hash.json +10 -0
  5. package/.claude/worktrees/adr-120-impl/tests/.tmp-ctx-test/json-session.json +29 -0
  6. package/.claude/worktrees/adr-120-impl/tests/.tmp-ctx-test/json-store.json +14 -0
  7. package/.claude/worktrees/adr-120-impl/tests/.tmp-ctx-test/test-transcript.jsonl +3 -0
  8. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/appliance/gguf-engine.d.ts +91 -0
  9. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/appliance/gguf-engine.js +425 -0
  10. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/appliance/ruvllm-bridge.d.ts +102 -0
  11. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/appliance/ruvllm-bridge.js +292 -0
  12. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/appliance/rvfa-builder.d.ts +44 -0
  13. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/appliance/rvfa-builder.js +329 -0
  14. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/appliance/rvfa-distribution.d.ts +97 -0
  15. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/appliance/rvfa-distribution.js +370 -0
  16. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/appliance/rvfa-format.d.ts +111 -0
  17. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/appliance/rvfa-format.js +393 -0
  18. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/appliance/rvfa-runner.d.ts +69 -0
  19. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/appliance/rvfa-runner.js +237 -0
  20. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/appliance/rvfa-signing.d.ts +123 -0
  21. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/appliance/rvfa-signing.js +347 -0
  22. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/autopilot-state.d.ts +77 -0
  23. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/autopilot-state.js +271 -0
  24. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/benchmarks/pretrain/index.d.ts +58 -0
  25. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/benchmarks/pretrain/index.js +404 -0
  26. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/commands/agent-wasm.d.ts +14 -0
  27. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/commands/agent-wasm.js +333 -0
  28. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/commands/agent.d.ts +8 -0
  29. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/commands/agent.js +927 -0
  30. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/commands/analyze.d.ts +19 -0
  31. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/commands/analyze.js +2048 -0
  32. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/commands/appliance-advanced.d.ts +9 -0
  33. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/commands/appliance-advanced.js +215 -0
  34. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/commands/appliance.d.ts +8 -0
  35. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/commands/appliance.js +404 -0
  36. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/commands/autopilot.d.ts +15 -0
  37. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/commands/autopilot.js +362 -0
  38. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/commands/benchmark.d.ts +10 -0
  39. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/commands/benchmark.js +460 -0
  40. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/commands/claims.d.ts +10 -0
  41. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/commands/claims.js +620 -0
  42. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/commands/cleanup.d.ts +13 -0
  43. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/commands/cleanup.js +250 -0
  44. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/commands/completions.d.ts +10 -0
  45. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/commands/completions.js +539 -0
  46. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/commands/config.d.ts +8 -0
  47. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/commands/config.js +428 -0
  48. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/commands/daemon.d.ts +28 -0
  49. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/commands/daemon.js +1093 -0
  50. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/commands/deployment.d.ts +10 -0
  51. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/commands/deployment.js +672 -0
  52. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/commands/doctor.d.ts +10 -0
  53. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/commands/doctor.js +885 -0
  54. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/commands/embeddings.d.ts +18 -0
  55. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/commands/embeddings.js +1623 -0
  56. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/commands/guidance.d.ts +8 -0
  57. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/commands/guidance.js +556 -0
  58. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/commands/hive-mind.d.ts +11 -0
  59. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/commands/hive-mind.js +1297 -0
  60. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/commands/hooks.d.ts +8 -0
  61. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/commands/hooks.js +4499 -0
  62. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/commands/index.d.ts +118 -0
  63. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/commands/index.js +344 -0
  64. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/commands/init.d.ts +8 -0
  65. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/commands/init.js +997 -0
  66. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/commands/issues.d.ts +21 -0
  67. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/commands/issues.js +567 -0
  68. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/commands/mcp.d.ts +11 -0
  69. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/commands/mcp.js +718 -0
  70. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/commands/memory.d.ts +8 -0
  71. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/commands/memory.js +1456 -0
  72. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/commands/migrate.d.ts +8 -0
  73. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/commands/migrate.js +742 -0
  74. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/commands/neural.d.ts +10 -0
  75. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/commands/neural.js +1531 -0
  76. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/commands/performance.d.ts +10 -0
  77. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/commands/performance.js +583 -0
  78. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/commands/plugins.d.ts +11 -0
  79. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/commands/plugins.js +826 -0
  80. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/commands/process.d.ts +10 -0
  81. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/commands/process.js +694 -0
  82. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/commands/progress.d.ts +11 -0
  83. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/commands/progress.js +259 -0
  84. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/commands/providers.d.ts +10 -0
  85. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/commands/providers.js +502 -0
  86. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/commands/route.d.ts +16 -0
  87. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/commands/route.js +813 -0
  88. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/commands/ruvector/backup.d.ts +11 -0
  89. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/commands/ruvector/backup.js +747 -0
  90. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/commands/ruvector/benchmark.d.ts +11 -0
  91. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/commands/ruvector/benchmark.js +490 -0
  92. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/commands/ruvector/import.d.ts +18 -0
  93. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/commands/ruvector/import.js +373 -0
  94. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/commands/ruvector/index.d.ts +29 -0
  95. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/commands/ruvector/index.js +129 -0
  96. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/commands/ruvector/init.d.ts +11 -0
  97. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/commands/ruvector/init.js +467 -0
  98. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/commands/ruvector/migrate.d.ts +11 -0
  99. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/commands/ruvector/migrate.js +498 -0
  100. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/commands/ruvector/optimize.d.ts +11 -0
  101. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/commands/ruvector/optimize.js +505 -0
  102. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/commands/ruvector/pg-utils.d.ts +14 -0
  103. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/commands/ruvector/pg-utils.js +41 -0
  104. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/commands/ruvector/setup.d.ts +18 -0
  105. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/commands/ruvector/setup.js +765 -0
  106. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/commands/ruvector/status.d.ts +11 -0
  107. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/commands/ruvector/status.js +479 -0
  108. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/commands/security.d.ts +10 -0
  109. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/commands/security.js +920 -0
  110. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/commands/session.d.ts +8 -0
  111. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/commands/session.js +757 -0
  112. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/commands/start.d.ts +8 -0
  113. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/commands/start.js +418 -0
  114. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/commands/status.d.ts +8 -0
  115. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/commands/status.js +591 -0
  116. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/commands/swarm.d.ts +8 -0
  117. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/commands/swarm.js +887 -0
  118. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/commands/task.d.ts +8 -0
  119. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/commands/task.js +675 -0
  120. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/commands/transfer-store.d.ts +13 -0
  121. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/commands/transfer-store.js +428 -0
  122. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/commands/update.d.ts +8 -0
  123. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/commands/update.js +276 -0
  124. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/commands/verify.d.ts +19 -0
  125. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/commands/verify.js +261 -0
  126. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/commands/workflow.d.ts +8 -0
  127. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/commands/workflow.js +617 -0
  128. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/config-adapter.d.ts +15 -0
  129. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/config-adapter.js +186 -0
  130. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/encryption/vault.d.ts +94 -0
  131. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/encryption/vault.js +172 -0
  132. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/fs-secure.d.ts +67 -0
  133. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/fs-secure.js +74 -0
  134. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/index.d.ts +81 -0
  135. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/index.js +538 -0
  136. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/infrastructure/in-memory-repositories.d.ts +68 -0
  137. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/infrastructure/in-memory-repositories.js +264 -0
  138. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/init/claudemd-generator.d.ts +16 -0
  139. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/init/claudemd-generator.js +363 -0
  140. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/init/executor.d.ts +41 -0
  141. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/init/executor.js +1904 -0
  142. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/init/helpers-generator.d.ts +60 -0
  143. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/init/helpers-generator.js +1185 -0
  144. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/init/index.d.ts +13 -0
  145. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/init/index.js +15 -0
  146. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/init/mcp-generator.d.ts +26 -0
  147. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/init/mcp-generator.js +116 -0
  148. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/init/settings-generator.d.ts +14 -0
  149. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/init/settings-generator.js +456 -0
  150. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/init/statusline-generator.d.ts +28 -0
  151. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/init/statusline-generator.js +937 -0
  152. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/init/types.d.ts +308 -0
  153. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/init/types.js +263 -0
  154. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/log-filters.d.ts +22 -0
  155. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/log-filters.js +36 -0
  156. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/mcp-client.d.ts +92 -0
  157. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/mcp-client.js +287 -0
  158. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/mcp-server.d.ts +163 -0
  159. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/mcp-server.js +732 -0
  160. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/mcp-tools/agent-execute-core.d.ts +92 -0
  161. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/mcp-tools/agent-execute-core.js +328 -0
  162. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/mcp-tools/agent-tools.d.ts +9 -0
  163. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/mcp-tools/agent-tools.js +716 -0
  164. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/mcp-tools/agentdb-tools.d.ts +33 -0
  165. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/mcp-tools/agentdb-tools.js +867 -0
  166. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/mcp-tools/analyze-tools.d.ts +38 -0
  167. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/mcp-tools/analyze-tools.js +346 -0
  168. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/mcp-tools/auto-install.d.ts +83 -0
  169. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/mcp-tools/auto-install.js +131 -0
  170. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/mcp-tools/autopilot-tools.d.ts +12 -0
  171. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/mcp-tools/autopilot-tools.js +231 -0
  172. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/mcp-tools/browser-session-tools.d.ts +23 -0
  173. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/mcp-tools/browser-session-tools.js +313 -0
  174. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/mcp-tools/browser-tools.d.ts +13 -0
  175. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/mcp-tools/browser-tools.js +757 -0
  176. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/mcp-tools/claims-tools.d.ts +12 -0
  177. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/mcp-tools/claims-tools.js +863 -0
  178. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/mcp-tools/config-tools.d.ts +8 -0
  179. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/mcp-tools/config-tools.js +411 -0
  180. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/mcp-tools/coordination-tools.d.ts +13 -0
  181. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/mcp-tools/coordination-tools.js +729 -0
  182. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/mcp-tools/daa-tools.d.ts +13 -0
  183. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/mcp-tools/daa-tools.js +534 -0
  184. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/mcp-tools/embeddings-tools.d.ts +9 -0
  185. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/mcp-tools/embeddings-tools.js +904 -0
  186. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/mcp-tools/github-tools.d.ts +9 -0
  187. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/mcp-tools/github-tools.js +659 -0
  188. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/mcp-tools/guidance-tools.d.ts +15 -0
  189. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/mcp-tools/guidance-tools.js +639 -0
  190. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/mcp-tools/hive-mind-tools.d.ts +8 -0
  191. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/mcp-tools/hive-mind-tools.js +953 -0
  192. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/mcp-tools/hooks-tools.d.ts +46 -0
  193. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/mcp-tools/hooks-tools.js +3939 -0
  194. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/mcp-tools/index.d.ts +27 -0
  195. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/mcp-tools/index.js +26 -0
  196. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/mcp-tools/managed-agent-tools.d.ts +22 -0
  197. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/mcp-tools/managed-agent-tools.js +357 -0
  198. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/mcp-tools/memory-tools.d.ts +14 -0
  199. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/mcp-tools/memory-tools.js +1240 -0
  200. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/mcp-tools/neural-tools.d.ts +16 -0
  201. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/mcp-tools/neural-tools.js +793 -0
  202. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/mcp-tools/performance-tools.d.ts +16 -0
  203. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/mcp-tools/performance-tools.js +675 -0
  204. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/mcp-tools/progress-tools.d.ts +14 -0
  205. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/mcp-tools/progress-tools.js +348 -0
  206. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/mcp-tools/request-tracker.d.ts +17 -0
  207. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/mcp-tools/request-tracker.js +27 -0
  208. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/mcp-tools/ruvllm-tools.d.ts +9 -0
  209. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/mcp-tools/ruvllm-tools.js +339 -0
  210. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/mcp-tools/security-tools.d.ts +18 -0
  211. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/mcp-tools/security-tools.js +556 -0
  212. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/mcp-tools/session-tools.d.ts +8 -0
  213. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/mcp-tools/session-tools.js +517 -0
  214. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/mcp-tools/swarm-tools.d.ts +9 -0
  215. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/mcp-tools/swarm-tools.js +388 -0
  216. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/mcp-tools/system-tools.d.ts +13 -0
  217. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/mcp-tools/system-tools.js +674 -0
  218. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/mcp-tools/task-tools.d.ts +8 -0
  219. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/mcp-tools/task-tools.js +487 -0
  220. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/mcp-tools/terminal-tools.d.ts +8 -0
  221. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/mcp-tools/terminal-tools.js +306 -0
  222. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/mcp-tools/transfer-tools.d.ts +14 -0
  223. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/mcp-tools/transfer-tools.js +447 -0
  224. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/mcp-tools/types.d.ts +8 -0
  225. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/mcp-tools/types.js +8 -0
  226. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/mcp-tools/validate-input.d.ts +9 -0
  227. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/mcp-tools/validate-input.js +9 -0
  228. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/mcp-tools/wasm-agent-tools.d.ts +9 -0
  229. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/mcp-tools/wasm-agent-tools.js +291 -0
  230. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/mcp-tools/workflow-tools.d.ts +8 -0
  231. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/mcp-tools/workflow-tools.js +884 -0
  232. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/memory/ewc-consolidation.d.ts +295 -0
  233. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/memory/ewc-consolidation.js +601 -0
  234. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/memory/intelligence.d.ts +357 -0
  235. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/memory/intelligence.js +1200 -0
  236. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/memory/memory-bridge.d.ts +492 -0
  237. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/memory/memory-bridge.js +2101 -0
  238. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/memory/memory-initializer.d.ts +420 -0
  239. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/memory/memory-initializer.js +2376 -0
  240. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/memory/neural-package-bridge.d.ts +48 -0
  241. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/memory/neural-package-bridge.js +87 -0
  242. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/memory/rabitq-index.d.ts +60 -0
  243. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/memory/rabitq-index.js +242 -0
  244. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/memory/sona-optimizer.d.ts +267 -0
  245. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/memory/sona-optimizer.js +779 -0
  246. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/output.d.ts +9 -0
  247. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/output.js +9 -0
  248. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/parser.d.ts +69 -0
  249. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/parser.js +470 -0
  250. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/plugins/manager.d.ts +133 -0
  251. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/plugins/manager.js +402 -0
  252. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/plugins/store/discovery.d.ts +91 -0
  253. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/plugins/store/discovery.js +1202 -0
  254. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/plugins/store/index.d.ts +76 -0
  255. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/plugins/store/index.js +141 -0
  256. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/plugins/store/search.d.ts +46 -0
  257. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/plugins/store/search.js +230 -0
  258. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/plugins/store/types.d.ts +274 -0
  259. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/plugins/store/types.js +7 -0
  260. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/plugins/tests/demo-plugin-store.d.ts +7 -0
  261. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/plugins/tests/demo-plugin-store.js +126 -0
  262. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/plugins/tests/standalone-test.d.ts +12 -0
  263. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/plugins/tests/standalone-test.js +188 -0
  264. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/plugins/tests/test-plugin-store.d.ts +7 -0
  265. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/plugins/tests/test-plugin-store.js +206 -0
  266. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/production/circuit-breaker.d.ts +101 -0
  267. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/production/circuit-breaker.js +241 -0
  268. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/production/error-handler.d.ts +92 -0
  269. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/production/error-handler.js +299 -0
  270. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/production/index.d.ts +23 -0
  271. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/production/index.js +18 -0
  272. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/production/monitoring.d.ts +161 -0
  273. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/production/monitoring.js +356 -0
  274. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/production/rate-limiter.d.ts +80 -0
  275. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/production/rate-limiter.js +201 -0
  276. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/production/retry.d.ts +48 -0
  277. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/production/retry.js +179 -0
  278. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/prompt.d.ts +44 -0
  279. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/prompt.js +501 -0
  280. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/runtime/headless.d.ts +60 -0
  281. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/runtime/headless.js +284 -0
  282. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/ruvector/agent-wasm.d.ts +193 -0
  283. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/ruvector/agent-wasm.js +354 -0
  284. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/ruvector/ast-analyzer.d.ts +67 -0
  285. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/ruvector/ast-analyzer.js +277 -0
  286. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/ruvector/coverage-router.d.ts +160 -0
  287. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/ruvector/coverage-router.js +531 -0
  288. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/ruvector/coverage-tools.d.ts +33 -0
  289. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/ruvector/coverage-tools.js +157 -0
  290. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/ruvector/diff-classifier.d.ts +175 -0
  291. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/ruvector/diff-classifier.js +699 -0
  292. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/ruvector/diskann-backend.d.ts +78 -0
  293. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/ruvector/diskann-backend.js +310 -0
  294. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/ruvector/enhanced-model-router.d.ts +146 -0
  295. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/ruvector/enhanced-model-router.js +529 -0
  296. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/ruvector/graph-analyzer.d.ts +187 -0
  297. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/ruvector/graph-analyzer.js +929 -0
  298. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/ruvector/graph-backend.d.ts +79 -0
  299. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/ruvector/graph-backend.js +220 -0
  300. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/ruvector/index.d.ts +38 -0
  301. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/ruvector/index.js +82 -0
  302. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/ruvector/lora-adapter.d.ts +240 -0
  303. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/ruvector/lora-adapter.js +550 -0
  304. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/ruvector/model-router.d.ts +241 -0
  305. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/ruvector/model-router.js +608 -0
  306. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/ruvector/q-learning-router.d.ts +211 -0
  307. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/ruvector/q-learning-router.js +681 -0
  308. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/ruvector/ruvllm-wasm.d.ts +179 -0
  309. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/ruvector/ruvllm-wasm.js +367 -0
  310. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/ruvector/semantic-router.d.ts +77 -0
  311. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/ruvector/semantic-router.js +178 -0
  312. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/ruvector/vector-db.d.ts +73 -0
  313. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/ruvector/vector-db.js +264 -0
  314. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/services/agentic-flow-bridge.d.ts +50 -0
  315. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/services/agentic-flow-bridge.js +95 -0
  316. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/services/claim-service.d.ts +204 -0
  317. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/services/claim-service.js +818 -0
  318. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/services/config-file-manager.d.ts +37 -0
  319. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/services/config-file-manager.js +224 -0
  320. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/services/container-worker-pool.d.ts +197 -0
  321. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/services/container-worker-pool.js +583 -0
  322. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/services/headless-worker-executor.d.ts +310 -0
  323. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/services/headless-worker-executor.js +1058 -0
  324. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/services/index.d.ts +13 -0
  325. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/services/index.js +11 -0
  326. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/services/registry-api.d.ts +58 -0
  327. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/services/registry-api.js +146 -0
  328. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/services/ruvector-training.d.ts +222 -0
  329. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/services/ruvector-training.js +688 -0
  330. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/services/worker-daemon.d.ts +323 -0
  331. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/services/worker-daemon.js +1323 -0
  332. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/services/worker-queue.d.ts +194 -0
  333. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/services/worker-queue.js +513 -0
  334. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/suggest.d.ts +53 -0
  335. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/suggest.js +200 -0
  336. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/transfer/anonymization/index.d.ts +25 -0
  337. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/transfer/anonymization/index.js +175 -0
  338. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/transfer/deploy-seraphine.d.ts +13 -0
  339. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/transfer/deploy-seraphine.js +205 -0
  340. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/transfer/export.d.ts +25 -0
  341. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/transfer/export.js +113 -0
  342. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/transfer/index.d.ts +12 -0
  343. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/transfer/index.js +31 -0
  344. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/transfer/ipfs/client.d.ts +109 -0
  345. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/transfer/ipfs/client.js +307 -0
  346. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/transfer/ipfs/upload.d.ts +95 -0
  347. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/transfer/ipfs/upload.js +413 -0
  348. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/transfer/models/seraphine.d.ts +72 -0
  349. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/transfer/models/seraphine.js +373 -0
  350. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/transfer/serialization/cfp.d.ts +49 -0
  351. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/transfer/serialization/cfp.js +183 -0
  352. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/transfer/storage/gcs.d.ts +82 -0
  353. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/transfer/storage/gcs.js +272 -0
  354. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/transfer/storage/index.d.ts +6 -0
  355. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/transfer/storage/index.js +6 -0
  356. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/transfer/store/discovery.d.ts +84 -0
  357. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/transfer/store/discovery.js +382 -0
  358. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/transfer/store/download.d.ts +70 -0
  359. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/transfer/store/download.js +334 -0
  360. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/transfer/store/index.d.ts +84 -0
  361. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/transfer/store/index.js +153 -0
  362. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/transfer/store/publish.d.ts +76 -0
  363. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/transfer/store/publish.js +294 -0
  364. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/transfer/store/registry.d.ts +58 -0
  365. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/transfer/store/registry.js +285 -0
  366. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/transfer/store/search.d.ts +54 -0
  367. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/transfer/store/search.js +232 -0
  368. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/transfer/store/tests/standalone-test.d.ts +12 -0
  369. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/transfer/store/tests/standalone-test.js +190 -0
  370. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/transfer/store/types.d.ts +193 -0
  371. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/transfer/store/types.js +6 -0
  372. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/transfer/test-seraphine.d.ts +6 -0
  373. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/transfer/test-seraphine.js +105 -0
  374. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/transfer/tests/test-store.d.ts +7 -0
  375. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/transfer/tests/test-store.js +214 -0
  376. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/transfer/types.d.ts +245 -0
  377. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/transfer/types.js +6 -0
  378. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/types.d.ts +13 -0
  379. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/types.js +13 -0
  380. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/update/checker.d.ts +34 -0
  381. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/update/checker.js +191 -0
  382. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/update/executor.d.ts +33 -0
  383. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/update/executor.js +217 -0
  384. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/update/index.d.ts +33 -0
  385. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/update/index.js +64 -0
  386. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/update/rate-limiter.d.ts +20 -0
  387. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/update/rate-limiter.js +96 -0
  388. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/update/validator.d.ts +17 -0
  389. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/src/update/validator.js +123 -0
  390. package/.claude/worktrees/adr-120-impl/v3/@claude-flow/cli/dist/tsconfig.tsbuildinfo +1 -0
  391. package/README.md +9 -0
  392. package/package.json +1 -1
  393. package/v3/@claude-flow/cli/README.md +9 -0
  394. package/v3/@claude-flow/cli/dist/src/mcp-tools/embeddings-tools.js +40 -0
  395. package/v3/@claude-flow/cli/package.json +3 -3
  396. package/v3/@claude-flow/cli/dist/src/ruvector/flash-attention.d.ts +0 -195
  397. package/v3/@claude-flow/cli/dist/src/ruvector/flash-attention.js +0 -643
  398. package/v3/@claude-flow/cli/dist/src/ruvector/moe-router.d.ts +0 -206
  399. package/v3/@claude-flow/cli/dist/src/ruvector/moe-router.js +0 -626
  400. package/v3/@claude-flow/cli/dist/src/services/event-stream.d.ts +0 -25
  401. package/v3/@claude-flow/cli/dist/src/services/event-stream.js +0 -27
  402. package/v3/@claude-flow/cli/dist/src/services/loop-worker-runner.d.ts +0 -16
  403. package/v3/@claude-flow/cli/dist/src/services/loop-worker-runner.js +0 -34
  404. package/v3/@claude-flow/cli/dist/src/services/runtime-capabilities.d.ts +0 -22
  405. package/v3/@claude-flow/cli/dist/src/services/runtime-capabilities.js +0 -45
@@ -0,0 +1 @@
1
+ {"sessionId":"1fc1a1cc-9310-4991-8a7d-832dbca9ebad","pid":8051,"procStart":"Sun May 17 12:50:14 2026","acquiredAt":1779051467717}
@@ -0,0 +1,35 @@
1
+ [
2
+ {
3
+ "id": "ctx-1779039343401-4-l469kx",
4
+ "key": "transcript:sess1:0:2026-05-17T17:35:43.400Z",
5
+ "content": "User: hello\n\nAssistant: hi",
6
+ "type": "episodic",
7
+ "namespace": "transcript-archive",
8
+ "tags": [
9
+ "transcript",
10
+ "compaction",
11
+ "sess1"
12
+ ],
13
+ "metadata": {
14
+ "sessionId": "sess1",
15
+ "chunkIndex": 0,
16
+ "trigger": "auto",
17
+ "timestamp": "2026-05-17T17:35:43.400Z",
18
+ "toolNames": [],
19
+ "filePaths": [],
20
+ "summary": "hello | hi",
21
+ "contentHash": "2b150e8757e3d9a83714468b255ce00f9f361abd323d2c589eee3243908c8707",
22
+ "turnRange": [
23
+ 0,
24
+ 0
25
+ ]
26
+ },
27
+ "accessLevel": "private",
28
+ "createdAt": 1779039343401,
29
+ "updatedAt": 1779039343401,
30
+ "version": 1,
31
+ "references": [],
32
+ "accessCount": 0,
33
+ "lastAccessedAt": 1779039343401
34
+ }
35
+ ]
@@ -0,0 +1,10 @@
1
+ [
2
+ {
3
+ "id": "jh1",
4
+ "namespace": "transcript-archive",
5
+ "content": "x",
6
+ "metadata": {
7
+ "contentHash": "hash-abc"
8
+ }
9
+ }
10
+ ]
@@ -0,0 +1,29 @@
1
+ [
2
+ {
3
+ "id": "js1",
4
+ "namespace": "transcript-archive",
5
+ "content": "a",
6
+ "metadata": {
7
+ "sessionId": "s1",
8
+ "chunkIndex": 0
9
+ }
10
+ },
11
+ {
12
+ "id": "js2",
13
+ "namespace": "transcript-archive",
14
+ "content": "b",
15
+ "metadata": {
16
+ "sessionId": "s1",
17
+ "chunkIndex": 1
18
+ }
19
+ },
20
+ {
21
+ "id": "js3",
22
+ "namespace": "transcript-archive",
23
+ "content": "c",
24
+ "metadata": {
25
+ "sessionId": "s2",
26
+ "chunkIndex": 0
27
+ }
28
+ }
29
+ ]
@@ -0,0 +1,14 @@
1
+ [
2
+ {
3
+ "id": "1",
4
+ "namespace": "ns1",
5
+ "content": "hello",
6
+ "metadata": {}
7
+ },
8
+ {
9
+ "id": "2",
10
+ "namespace": "ns2",
11
+ "content": "world",
12
+ "metadata": {}
13
+ }
14
+ ]
@@ -0,0 +1,3 @@
1
+ {"role":"user"}
2
+ not json
3
+ {"role":"assistant"}
@@ -0,0 +1,91 @@
1
+ /**
2
+ * ruvLLM GGUF Inference Engine -- Pure Node.js GGUF Model Interface
3
+ *
4
+ * Provides:
5
+ * 1. GGUF binary header parsing (metadata without loading weights)
6
+ * 2. Model loading abstraction (node-llama-cpp when available, metadata-only fallback)
7
+ * 3. Token generation interface with async iterator streaming
8
+ * 4. KV-cache persistence to RVF-compatible binary format
9
+ *
10
+ * Zero external dependencies. node-llama-cpp is an optional peer.
11
+ *
12
+ * @module @claude-flow/cli/appliance/gguf-engine
13
+ */
14
+ export interface GgufMetadata {
15
+ magic: string;
16
+ version: number;
17
+ tensorCount: number;
18
+ kvCount: number;
19
+ architecture?: string;
20
+ name?: string;
21
+ contextLength?: number;
22
+ embeddingLength?: number;
23
+ blockCount?: number;
24
+ vocabSize?: number;
25
+ quantization?: string;
26
+ fileSize: number;
27
+ metadata: Record<string, unknown>;
28
+ }
29
+ export interface GgufEngineConfig {
30
+ contextSize?: number;
31
+ maxTokens?: number;
32
+ temperature?: number;
33
+ kvCachePath?: string;
34
+ verbose?: boolean;
35
+ }
36
+ export interface GenerateRequest {
37
+ prompt: string;
38
+ model?: string;
39
+ maxTokens?: number;
40
+ temperature?: number;
41
+ stream?: boolean;
42
+ stopSequences?: string[];
43
+ }
44
+ export interface GenerateResponse {
45
+ text: string;
46
+ model: string;
47
+ tokensUsed: number;
48
+ latencyMs: number;
49
+ metadataOnly: boolean;
50
+ }
51
+ /**
52
+ * Parse the header and metadata from a GGUF file without loading tensors.
53
+ * Reads only the first 256 KB of the file.
54
+ */
55
+ export declare function parseGgufHeader(path: string): Promise<GgufMetadata>;
56
+ export declare class GgufEngine {
57
+ private config;
58
+ private llamaCpp;
59
+ private llamaModel;
60
+ private llamaContext;
61
+ private loadedModels;
62
+ private activeModelPath;
63
+ private kvCache;
64
+ constructor(config: GgufEngineConfig);
65
+ /** Probe for node-llama-cpp availability. */
66
+ initialize(): Promise<void>;
67
+ /** Parse GGUF header and optionally load the model for inference. */
68
+ loadModel(path: string): Promise<GgufMetadata>;
69
+ /** Generate text. Delegates to node-llama-cpp or returns a metadata-only stub. */
70
+ generate(request: GenerateRequest): Promise<GenerateResponse>;
71
+ /** Stream tokens via async iterator. Falls back to yielding full response. */
72
+ stream(request: GenerateRequest): AsyncGenerator<string>;
73
+ /**
74
+ * Persist the KV cache to an RVF-compatible binary file.
75
+ * Format: RVKV magic | version u32 | model SHA-256 (32B) | entry count u32
76
+ * entries: [key_len u32, key, val_len u32, val] | footer SHA-256 (32B)
77
+ */
78
+ persistKvCache(outputPath: string): Promise<void>;
79
+ /** Restore KV cache from an RVF-compatible binary file. */
80
+ loadKvCache(inputPath: string): Promise<void>;
81
+ /** Return metadata for all loaded models. */
82
+ getLoadedModels(): GgufMetadata[];
83
+ /** Store a key-value pair in the in-memory KV cache. */
84
+ setKvEntry(key: string, value: Buffer): void;
85
+ /** Retrieve a key-value pair from the in-memory KV cache. */
86
+ getKvEntry(key: string): Buffer | undefined;
87
+ /** Release resources, unload models, and optionally persist the KV cache. */
88
+ shutdown(): Promise<void>;
89
+ private tryLoadLlamaCpp;
90
+ }
91
+ //# sourceMappingURL=gguf-engine.d.ts.map
@@ -0,0 +1,425 @@
1
+ /**
2
+ * ruvLLM GGUF Inference Engine -- Pure Node.js GGUF Model Interface
3
+ *
4
+ * Provides:
5
+ * 1. GGUF binary header parsing (metadata without loading weights)
6
+ * 2. Model loading abstraction (node-llama-cpp when available, metadata-only fallback)
7
+ * 3. Token generation interface with async iterator streaming
8
+ * 4. KV-cache persistence to RVF-compatible binary format
9
+ *
10
+ * Zero external dependencies. node-llama-cpp is an optional peer.
11
+ *
12
+ * @module @claude-flow/cli/appliance/gguf-engine
13
+ */
14
+ import { open, readFile, writeFile, stat as fsStat } from 'node:fs/promises';
15
+ import { createHash } from 'node:crypto';
16
+ import { basename } from 'node:path';
17
+ // ── GGUF Metadata Value Types ───────────────────────────────
18
+ var GgufValueType;
19
+ (function (GgufValueType) {
20
+ GgufValueType[GgufValueType["UINT8"] = 0] = "UINT8";
21
+ GgufValueType[GgufValueType["INT8"] = 1] = "INT8";
22
+ GgufValueType[GgufValueType["UINT16"] = 2] = "UINT16";
23
+ GgufValueType[GgufValueType["INT16"] = 3] = "INT16";
24
+ GgufValueType[GgufValueType["UINT32"] = 4] = "UINT32";
25
+ GgufValueType[GgufValueType["INT32"] = 5] = "INT32";
26
+ GgufValueType[GgufValueType["FLOAT32"] = 6] = "FLOAT32";
27
+ GgufValueType[GgufValueType["BOOL"] = 7] = "BOOL";
28
+ GgufValueType[GgufValueType["STRING"] = 8] = "STRING";
29
+ GgufValueType[GgufValueType["ARRAY"] = 9] = "ARRAY";
30
+ GgufValueType[GgufValueType["UINT64"] = 10] = "UINT64";
31
+ GgufValueType[GgufValueType["INT64"] = 11] = "INT64";
32
+ GgufValueType[GgufValueType["FLOAT64"] = 12] = "FLOAT64";
33
+ })(GgufValueType || (GgufValueType = {}));
34
+ const GGUF_MAGIC = 0x46554747; // "GGUF" in little-endian
35
+ const RVKV_MAGIC = 0x564B5652; // "RVKV" in little-endian
36
+ const RVKV_VERSION = 1;
37
+ // ── Internal Buffer Reader ──────────────────────────────────
38
+ /** Stateful cursor over a Buffer for sequential binary reads. */
39
+ class BufferReader {
40
+ buf;
41
+ offset = 0;
42
+ constructor(buf) {
43
+ this.buf = buf;
44
+ }
45
+ get remaining() { return this.buf.length - this.offset; }
46
+ readU8() { const v = this.buf.readUInt8(this.offset); this.offset += 1; return v; }
47
+ readI8() { const v = this.buf.readInt8(this.offset); this.offset += 1; return v; }
48
+ readU16() { const v = this.buf.readUInt16LE(this.offset); this.offset += 2; return v; }
49
+ readI16() { const v = this.buf.readInt16LE(this.offset); this.offset += 2; return v; }
50
+ readU32() { const v = this.buf.readUInt32LE(this.offset); this.offset += 4; return v; }
51
+ readI32() { const v = this.buf.readInt32LE(this.offset); this.offset += 4; return v; }
52
+ readF32() { const v = this.buf.readFloatLE(this.offset); this.offset += 4; return v; }
53
+ readF64() { const v = this.buf.readDoubleLE(this.offset); this.offset += 8; return v; }
54
+ readU64() { const v = this.buf.readBigUInt64LE(this.offset); this.offset += 8; return v; }
55
+ readI64() { const v = this.buf.readBigInt64LE(this.offset); this.offset += 8; return v; }
56
+ /** Safe for values up to 2^53. Real GGUF files never exceed this for tensor/kv counts. */
57
+ readU64AsNumber() { return Number(this.readU64()); }
58
+ readBool() { return this.readU8() !== 0; }
59
+ /** GGUF string: [length u64 LE][utf-8 bytes]. */
60
+ readString() {
61
+ const len = this.readU64AsNumber();
62
+ if (len === 0)
63
+ return '';
64
+ if (len > this.remaining)
65
+ throw new Error(`String length ${len} exceeds remaining buffer`);
66
+ const s = this.buf.toString('utf-8', this.offset, this.offset + len);
67
+ this.offset += len;
68
+ return s;
69
+ }
70
+ }
71
+ // ── GGUF Value Reading ──────────────────────────────────────
72
+ /** Read a typed scalar from the buffer (shared by value and array-element readers). */
73
+ function readScalar(reader, t) {
74
+ switch (t) {
75
+ case GgufValueType.UINT8: return reader.readU8();
76
+ case GgufValueType.INT8: return reader.readI8();
77
+ case GgufValueType.UINT16: return reader.readU16();
78
+ case GgufValueType.INT16: return reader.readI16();
79
+ case GgufValueType.UINT32: return reader.readU32();
80
+ case GgufValueType.INT32: return reader.readI32();
81
+ case GgufValueType.FLOAT32: return reader.readF32();
82
+ case GgufValueType.BOOL: return reader.readBool();
83
+ case GgufValueType.STRING: return reader.readString();
84
+ case GgufValueType.UINT64: return Number(reader.readU64());
85
+ case GgufValueType.INT64: return Number(reader.readI64());
86
+ case GgufValueType.FLOAT64: return reader.readF64();
87
+ default: return undefined;
88
+ }
89
+ }
90
+ /** Read a single GGUF typed value (scalar or array) from the buffer. */
91
+ function readGgufValue(reader) {
92
+ const valueType = reader.readU32();
93
+ if (valueType === GgufValueType.ARRAY) {
94
+ const elemType = reader.readU32();
95
+ const len = reader.readU64AsNumber();
96
+ const arr = [];
97
+ for (let i = 0; i < len; i++) {
98
+ const v = readScalar(reader, elemType);
99
+ if (v === undefined)
100
+ throw new Error(`Unknown GGUF array element type: ${elemType}`);
101
+ arr.push(v);
102
+ }
103
+ return arr;
104
+ }
105
+ const v = readScalar(reader, valueType);
106
+ if (v === undefined)
107
+ throw new Error(`Unknown GGUF value type: ${valueType}`);
108
+ return v;
109
+ }
110
+ // ── GGUF Header Parsing ─────────────────────────────────────
111
+ /**
112
+ * Parse the header and metadata from a GGUF file without loading tensors.
113
+ * Reads only the first 256 KB of the file.
114
+ */
115
+ export async function parseGgufHeader(path) {
116
+ const fileInfo = await fsStat(path);
117
+ const readSize = Math.min(fileInfo.size, 256 * 1024);
118
+ const fh = await open(path, 'r');
119
+ try {
120
+ const buf = Buffer.alloc(readSize);
121
+ await fh.read(buf, 0, readSize, 0);
122
+ return parseGgufBuffer(buf, fileInfo.size, path);
123
+ }
124
+ finally {
125
+ await fh.close();
126
+ }
127
+ }
128
+ function parseGgufBuffer(buf, fileSize, filePath) {
129
+ const reader = new BufferReader(buf);
130
+ const magic = reader.readU32();
131
+ if (magic !== GGUF_MAGIC) {
132
+ throw new Error(`Invalid GGUF magic: 0x${magic.toString(16)} (expected 0x${GGUF_MAGIC.toString(16)})`);
133
+ }
134
+ const version = reader.readU32();
135
+ if (version < 2 || version > 3) {
136
+ throw new Error(`Unsupported GGUF version: ${version} (expected 2 or 3)`);
137
+ }
138
+ const tensorCount = reader.readU64AsNumber();
139
+ const kvCount = reader.readU64AsNumber();
140
+ const metadata = {};
141
+ for (let i = 0; i < kvCount; i++) {
142
+ if (reader.remaining < 12)
143
+ break;
144
+ try {
145
+ const key = reader.readString();
146
+ metadata[key] = readGgufValue(reader);
147
+ }
148
+ catch {
149
+ break; // reached end of read window
150
+ }
151
+ }
152
+ const arch = asString(metadata['general.architecture']);
153
+ const pfx = arch || 'llama'; // fallback prefix for well-known keys
154
+ return {
155
+ magic: 'GGUF', version, tensorCount, kvCount,
156
+ architecture: arch,
157
+ name: asString(metadata['general.name']),
158
+ contextLength: asNumber(metadata[`${pfx}.context_length`]),
159
+ embeddingLength: asNumber(metadata[`${pfx}.embedding_length`]),
160
+ blockCount: asNumber(metadata[`${pfx}.block_count`]),
161
+ vocabSize: inferVocabSize(metadata),
162
+ quantization: inferQuantFromMetadata(metadata, filePath),
163
+ fileSize, metadata,
164
+ };
165
+ }
166
+ // ── Metadata Helpers ────────────────────────────────────────
167
+ function asString(v) { return typeof v === 'string' ? v : undefined; }
168
+ function asNumber(v) { return typeof v === 'number' ? v : undefined; }
169
+ const QUANT_RE = [
170
+ [/q2_k/i, 'Q2_K'], [/q3_k_s/i, 'Q3_K_S'], [/q3_k_m/i, 'Q3_K_M'], [/q3_k_l/i, 'Q3_K_L'],
171
+ [/q4_k_s/i, 'Q4_K_S'], [/q4_k_m/i, 'Q4_K_M'], [/q4_0/i, 'Q4_0'], [/q4_1/i, 'Q4_1'],
172
+ [/q5_k_s/i, 'Q5_K_S'], [/q5_k_m/i, 'Q5_K_M'], [/q5_0/i, 'Q5_0'], [/q5_1/i, 'Q5_1'],
173
+ [/q6_k/i, 'Q6_K'], [/q8_0/i, 'Q8_0'], [/f16/i, 'F16'], [/f32/i, 'F32'],
174
+ ];
175
+ function inferQuantFromMetadata(meta, filePath) {
176
+ const ft = meta['general.file_type'];
177
+ if (typeof ft === 'number')
178
+ return `file_type_${ft}`;
179
+ const name = basename(filePath);
180
+ for (const [re, label] of QUANT_RE)
181
+ if (re.test(name))
182
+ return label;
183
+ return 'unknown';
184
+ }
185
+ function inferVocabSize(meta) {
186
+ const tokens = meta['tokenizer.ggml.tokens'];
187
+ if (Array.isArray(tokens))
188
+ return tokens.length;
189
+ return asNumber(meta['tokenizer.ggml.vocab_size']);
190
+ }
191
+ // ── GGUF Engine ─────────────────────────────────────────────
192
+ export class GgufEngine {
193
+ config;
194
+ llamaCpp = null;
195
+ llamaModel = null;
196
+ llamaContext = null;
197
+ loadedModels = new Map();
198
+ activeModelPath = null;
199
+ kvCache = new Map();
200
+ constructor(config) {
201
+ this.config = {
202
+ contextSize: config.contextSize ?? 4096,
203
+ maxTokens: config.maxTokens ?? 512,
204
+ temperature: config.temperature ?? 0.7,
205
+ kvCachePath: config.kvCachePath ?? '',
206
+ verbose: config.verbose ?? false,
207
+ };
208
+ }
209
+ /** Probe for node-llama-cpp availability. */
210
+ async initialize() {
211
+ this.llamaCpp = await this.tryLoadLlamaCpp();
212
+ if (this.config.verbose) {
213
+ console.log(`[gguf-engine] node-llama-cpp: ${this.llamaCpp ? 'available' : 'not found (metadata-only mode)'}`);
214
+ }
215
+ }
216
+ /** Parse GGUF header and optionally load the model for inference. */
217
+ async loadModel(path) {
218
+ const meta = await parseGgufHeader(path);
219
+ this.loadedModels.set(path, meta);
220
+ this.activeModelPath = path;
221
+ if (this.llamaCpp) {
222
+ try {
223
+ const { getLlama } = this.llamaCpp;
224
+ const llama = await getLlama();
225
+ this.llamaModel = await llama.loadModel({ modelPath: path });
226
+ this.llamaContext = await this.llamaModel.createContext({ contextSize: this.config.contextSize });
227
+ if (this.config.verbose)
228
+ console.log(`[gguf-engine] Model loaded: ${basename(path)}`);
229
+ }
230
+ catch (err) {
231
+ if (this.config.verbose)
232
+ console.warn('[gguf-engine] node-llama-cpp load failed:', err);
233
+ this.llamaModel = null;
234
+ this.llamaContext = null;
235
+ }
236
+ }
237
+ return meta;
238
+ }
239
+ /** Generate text. Delegates to node-llama-cpp or returns a metadata-only stub. */
240
+ async generate(request) {
241
+ const start = performance.now();
242
+ const modelPath = request.model ?? this.activeModelPath;
243
+ const modelName = modelPath ? basename(modelPath) : 'none';
244
+ if (this.llamaContext && this.llamaModel) {
245
+ try {
246
+ const session = new this.llamaCpp.LlamaChatSession({
247
+ contextSequence: this.llamaContext.getSequence(),
248
+ });
249
+ const text = await session.prompt(request.prompt, {
250
+ maxTokens: request.maxTokens ?? this.config.maxTokens,
251
+ temperature: request.temperature ?? this.config.temperature,
252
+ stopGenerationTrigger: request.stopSequences
253
+ ? request.stopSequences.map((s) => new this.llamaCpp.LlamaText([s]))
254
+ : undefined,
255
+ });
256
+ // Use llama.cpp tokenizer for accurate count when available, else estimate
257
+ let tokensUsed;
258
+ try {
259
+ const seq = this.llamaContext.getSequence();
260
+ tokensUsed = seq.tokenCount ?? Math.ceil(text.length / 4);
261
+ }
262
+ catch {
263
+ tokensUsed = Math.ceil(text.length / 4); // ~4 chars per token heuristic
264
+ }
265
+ return {
266
+ text, model: modelName, tokensUsed,
267
+ latencyMs: performance.now() - start, metadataOnly: false,
268
+ };
269
+ }
270
+ catch (err) {
271
+ if (this.config.verbose)
272
+ console.warn('[gguf-engine] Generation failed:', err);
273
+ }
274
+ }
275
+ // Metadata-only fallback
276
+ const meta = modelPath ? this.loadedModels.get(modelPath) : undefined;
277
+ return {
278
+ text: meta
279
+ ? `[metadata-only] Model: ${meta.name ?? modelName}, arch: ${meta.architecture ?? 'unknown'}, ctx: ${meta.contextLength ?? 'unknown'}`
280
+ : '[metadata-only] No model loaded',
281
+ model: modelName, tokensUsed: 0,
282
+ latencyMs: performance.now() - start, metadataOnly: true,
283
+ };
284
+ }
285
+ /** Stream tokens via async iterator. Falls back to yielding full response. */
286
+ async *stream(request) {
287
+ if (this.llamaContext && this.llamaModel) {
288
+ try {
289
+ const session = new this.llamaCpp.LlamaChatSession({
290
+ contextSequence: this.llamaContext.getSequence(),
291
+ });
292
+ const it = session.promptWithMeta(request.prompt, {
293
+ maxTokens: request.maxTokens ?? this.config.maxTokens,
294
+ temperature: request.temperature ?? this.config.temperature,
295
+ });
296
+ if (it && typeof it[Symbol.asyncIterator] === 'function') {
297
+ for await (const chunk of it) {
298
+ if (typeof chunk === 'string')
299
+ yield chunk;
300
+ else if (chunk?.text)
301
+ yield chunk.text;
302
+ }
303
+ return;
304
+ }
305
+ }
306
+ catch { /* fall through to single-chunk fallback */ }
307
+ }
308
+ const response = await this.generate(request);
309
+ yield response.text;
310
+ }
311
+ /**
312
+ * Persist the KV cache to an RVF-compatible binary file.
313
+ * Format: RVKV magic | version u32 | model SHA-256 (32B) | entry count u32
314
+ * entries: [key_len u32, key, val_len u32, val] | footer SHA-256 (32B)
315
+ */
316
+ async persistKvCache(outputPath) {
317
+ const path = outputPath || this.config.kvCachePath;
318
+ if (!path)
319
+ throw new Error('No KV cache output path specified');
320
+ const modelHash = createHash('sha256').update(this.activeModelPath ?? 'no-model').digest();
321
+ const entryBufs = [];
322
+ for (const [key, value] of this.kvCache) {
323
+ const keyBuf = Buffer.from(key, 'utf-8');
324
+ const hdr = Buffer.alloc(8);
325
+ hdr.writeUInt32LE(keyBuf.length, 0);
326
+ hdr.writeUInt32LE(value.length, 4);
327
+ entryBufs.push(hdr, keyBuf, value);
328
+ }
329
+ const entryData = Buffer.concat(entryBufs);
330
+ const footer = createHash('sha256').update(entryData).digest();
331
+ const header = Buffer.alloc(44);
332
+ header.writeUInt32LE(RVKV_MAGIC, 0);
333
+ header.writeUInt32LE(RVKV_VERSION, 4);
334
+ modelHash.copy(header, 8);
335
+ header.writeUInt32LE(this.kvCache.size, 40);
336
+ await writeFile(path, Buffer.concat([header, entryData, footer]));
337
+ if (this.config.verbose)
338
+ console.log(`[gguf-engine] KV cache persisted: ${this.kvCache.size} entries`);
339
+ }
340
+ /** Restore KV cache from an RVF-compatible binary file. */
341
+ async loadKvCache(inputPath) {
342
+ const data = await readFile(inputPath);
343
+ if (data.length < 44)
344
+ throw new Error('KV cache file too small');
345
+ const magic = data.readUInt32LE(0);
346
+ if (magic !== RVKV_MAGIC)
347
+ throw new Error(`Invalid KV cache magic: 0x${magic.toString(16)}`);
348
+ const version = data.readUInt32LE(4);
349
+ if (version !== RVKV_VERSION)
350
+ throw new Error(`Unsupported KV cache version: ${version}`);
351
+ const entryCount = data.readUInt32LE(40);
352
+ let offset = 44;
353
+ const entries = new Map();
354
+ for (let i = 0; i < entryCount; i++) {
355
+ if (offset + 8 > data.length)
356
+ throw new Error('KV cache file truncated');
357
+ const keyLen = data.readUInt32LE(offset);
358
+ const valLen = data.readUInt32LE(offset + 4);
359
+ offset += 8;
360
+ if (offset + keyLen + valLen > data.length)
361
+ throw new Error('KV cache file truncated');
362
+ entries.set(data.toString('utf-8', offset, offset + keyLen), Buffer.from(data.subarray(offset + keyLen, offset + keyLen + valLen)));
363
+ offset += keyLen + valLen;
364
+ }
365
+ // Verify footer hash (mandatory)
366
+ if (offset + 32 > data.length) {
367
+ throw new Error('KV cache file missing SHA256 footer');
368
+ }
369
+ const stored = data.subarray(offset, offset + 32);
370
+ const computed = createHash('sha256').update(data.subarray(44, offset)).digest();
371
+ if (!stored.equals(computed))
372
+ throw new Error('KV cache integrity check failed: hash mismatch');
373
+ this.kvCache = entries;
374
+ if (this.config.verbose)
375
+ console.log(`[gguf-engine] KV cache loaded: ${entries.size} entries`);
376
+ }
377
+ /** Return metadata for all loaded models. */
378
+ getLoadedModels() { return Array.from(this.loadedModels.values()); }
379
+ /** Store a key-value pair in the in-memory KV cache. */
380
+ setKvEntry(key, value) { this.kvCache.set(key, value); }
381
+ /** Retrieve a key-value pair from the in-memory KV cache. */
382
+ getKvEntry(key) { return this.kvCache.get(key); }
383
+ /** Release resources, unload models, and optionally persist the KV cache. */
384
+ async shutdown() {
385
+ if (this.config.kvCachePath && this.kvCache.size > 0) {
386
+ try {
387
+ await this.persistKvCache(this.config.kvCachePath);
388
+ }
389
+ catch (err) {
390
+ if (this.config.verbose)
391
+ console.warn('[gguf-engine] KV persist failed:', err);
392
+ }
393
+ }
394
+ if (this.llamaContext?.dispose) {
395
+ try {
396
+ await this.llamaContext.dispose();
397
+ }
398
+ catch { /* ignore */ }
399
+ }
400
+ if (this.llamaModel?.dispose) {
401
+ try {
402
+ await this.llamaModel.dispose();
403
+ }
404
+ catch { /* ignore */ }
405
+ }
406
+ this.llamaContext = null;
407
+ this.llamaModel = null;
408
+ this.activeModelPath = null;
409
+ this.loadedModels.clear();
410
+ this.kvCache.clear();
411
+ if (this.config.verbose)
412
+ console.log('[gguf-engine] Shutdown complete');
413
+ }
414
+ // ── Private ───────────────────────────────────────────────
415
+ async tryLoadLlamaCpp() {
416
+ // @ts-ignore -- optional peer dependency, may not be installed
417
+ try {
418
+ return await import('node-llama-cpp');
419
+ }
420
+ catch {
421
+ return null;
422
+ }
423
+ }
424
+ }
425
+ //# sourceMappingURL=gguf-engine.js.map