Skip to content

armgit / ruflo

Public Imported from GitHub
0

🌊 The original agent harness. Deploy intelligent multi-player swarms, coordinate autonomous workflows, and build conversational AI systems. Features adaptive memory, self-learning intelligence, federation, vector RAG integration, and native Claude Code / Codex / Hermes and many more Integrated

Checkpoint: File edits

rUv74f0eeb5e1be
diff --git a/v3/@claude-flow/cli/src/mcp-tools/embeddings-tools.ts b/v3/@claude-flow/cli/src/mcp-tools/embeddings-tools.ts
index 4a1df4bad9..0c7717f1e6 100644
--- a/v3/@claude-flow/cli/src/mcp-tools/embeddings-tools.ts
+++ b/v3/@claude-flow/cli/src/mcp-tools/embeddings-tools.ts
@@ -74,10 +74,36 @@ function saveConfig(config: EmbeddingsConfig): void {
writeFileSync(getConfigPath(), JSON.stringify(config, null, 2), 'utf-8');
}
-// Simple mock embedding generation (in production, would use ONNX runtime)
-function generateMockEmbedding(text: string, dimension: number): number[] {
- // Simple hash-based embedding for demonstration
- // In production, this would use the ONNX model
+// Real ONNX embedding generation via memory-initializer
+let realEmbeddingFn: ((text: string) => Promise<{ embedding: number[]; dimensions: number; model: string }>) | null = null;
+
+async function getRealEmbeddingFunction() {
+ if (!realEmbeddingFn) {
+ try {
+ const { generateEmbedding } = await import('../memory/memory-initializer.js');
+ realEmbeddingFn = generateEmbedding;
+ } catch {
+ realEmbeddingFn = null;
+ }
+ }
+ return realEmbeddingFn;
+}
+
+// Generate real ONNX embedding (falls back to deterministic hash if ONNX unavailable)
+async function generateRealEmbedding(text: string, dimension: number): Promise<number[]> {
+ const realFn = await getRealEmbeddingFunction();
+
+ if (realFn) {
+ try {
+ const result = await realFn(text);
+ return result.embedding;
+ } catch {
+ // Fall through to fallback
+ }
+ }
+
+ // Fallback: deterministic hash-based (only if ONNX truly unavailable)
+ console.warn('[MCP] ONNX unavailable, using fallback embedding');
const embedding: number[] = [];
let hash = 0;
for (let i = 0; i < text.length; i++) {