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

fix(embeddings): graceful agentic-flow fallback in downloadEmbeddingModel

Reuven4f2f68d52c79
diff --git a/v3/@claude-flow/embeddings/package.json b/v3/@claude-flow/embeddings/package.json
index b8bf80984e..42b2c00f5b 100644
--- a/v3/@claude-flow/embeddings/package.json
+++ b/v3/@claude-flow/embeddings/package.json
@@ -1,6 +1,6 @@
{
"name": "@claude-flow/embeddings",
- "version": "3.0.0-alpha.12",
+ "version": "3.0.0-alpha.13",
"description": "V3 Embedding Service - OpenAI, Transformers.js, Agentic-Flow (ONNX), Mock providers with hyperbolic embeddings, normalization, and chunking",
"type": "module",
"main": "./dist/index.js",
diff --git a/v3/@claude-flow/embeddings/src/neural-integration.ts b/v3/@claude-flow/embeddings/src/neural-integration.ts
index d7f7a1d125..5b71f5774e 100644
--- a/v3/@claude-flow/embeddings/src/neural-integration.ts
+++ b/v3/@claude-flow/embeddings/src/neural-integration.ts
@@ -283,13 +283,35 @@ export async function listEmbeddingModels(): Promise<Array<{
}
/**
- * Download embedding model
+ * Download embedding model.
+ *
+ * #1700 item 2: previously this propagated `Cannot find package 'agentic-flow'`
+ * when the optional peer wasn't installed, breaking `embeddings init` even
+ * though the rest of the embedding pipeline (Xenova/transformers ONNX) does
+ * not need agentic-flow. Now we try the agentic-flow path first and fall
+ * back to a no-op success when it isn't installed — the model still loads
+ * lazily on first `embeddings_generate` call via @xenova/transformers.
*/
export async function downloadEmbeddingModel(
modelId: string,
targetDir?: string,
onProgress?: (progress: { percent: number; bytesDownloaded: number; totalBytes: number }) => void
): Promise<string> {
- const { downloadModel } = await import('agentic-flow/embeddings');
- return downloadModel(modelId, targetDir ?? '.models', onProgress);
+ try {
+ const { downloadModel } = await import('agentic-flow/embeddings');
+ return await downloadModel(modelId, targetDir ?? '.models', onProgress);
+ } catch (err) {
+ const msg = err instanceof Error ? err.message : String(err);
+ // Distinguish "package missing" from real download errors so callers
+ // can surface the right hint to users.
+ if (/Cannot find package 'agentic-flow'|Cannot find module/.test(msg)) {
+ console.warn('[embeddings] agentic-flow not installed — skipping eager model download. ' +
+ 'Models will be fetched lazily by @xenova/transformers on first generate. ' +
+ 'For pre-downloaded models, run: npm install agentic-flow');
+ // Resolve to the target dir as a no-op completion — generate() will
+ // download via @xenova/transformers when first called.
+ return targetDir ?? '.models';
+ }
+ throw err;
+ }
}