moflo 4.6.3 → 4.6.5

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.
@@ -282,7 +282,9 @@ function getEntriesNeedingEmbeddings(db, namespace = null, forceAll = false) {
282
282
  const params = [];
283
283
 
284
284
  if (!forceAll) {
285
- sql += ` AND (embedding IS NULL OR embedding = '')`;
285
+ // Include entries with no embedding OR entries with hash/fallback embeddings
286
+ // that should be upgraded to Xenova when available
287
+ sql += ` AND (embedding IS NULL OR embedding = '' OR embedding_model IN ('domain-aware-hash-v1', 'hash-fallback', 'local'))`;
286
288
  }
287
289
 
288
290
  if (namespace) {
@@ -408,7 +410,22 @@ async function main() {
408
410
  const stats = getEmbeddingStats(db);
409
411
 
410
412
  // Write changes back to disk (sql.js operates in-memory)
411
- if (embedded > 0) saveDb(db);
413
+ if (embedded > 0) {
414
+ saveDb(db);
415
+
416
+ // Delete stale HNSW index so the CLI rebuilds from fresh vectors
417
+ const hnswPaths = [
418
+ resolve(projectRoot, '.swarm/hnsw.index'),
419
+ resolve(projectRoot, '.swarm/hnsw.metadata.json'),
420
+ ];
421
+ for (const p of hnswPaths) {
422
+ if (existsSync(p)) {
423
+ const { unlinkSync } = await import('fs');
424
+ unlinkSync(p);
425
+ log(`Deleted stale HNSW index: ${p}`);
426
+ }
427
+ }
428
+ }
412
429
  db.close();
413
430
 
414
431
  console.log('');
@@ -665,20 +665,26 @@ async function main() {
665
665
  const elapsed = ((Date.now() - startTime) / 1000).toFixed(1);
666
666
  log(`Done in ${elapsed}s — ${allChunks.length} chunks written to code-map namespace`);
667
667
 
668
- // 7. Trigger embedding generation in background
668
+ // 7. Generate embeddings inline (not detached — ensures Xenova runs reliably)
669
669
  if (!skipEmbeddings) {
670
- // Look for build-embeddings script in project's .claude/scripts/
671
- const embedScript = resolve(projectRoot, '.claude/scripts/build-embeddings.mjs');
672
- if (existsSync(embedScript)) {
673
- log('Starting background embedding generation...');
674
- const proc = spawn('node', [embedScript, '--namespace', 'code-map'], {
675
- cwd: projectRoot,
676
- stdio: 'ignore',
677
- detached: true,
678
- shell: false,
679
- windowsHide: true,
680
- });
681
- proc.unref();
670
+ // Prefer moflo's own bin script, fall back to project's .claude/scripts/
671
+ const embedCandidates = [
672
+ resolve(dirname(fileURLToPath(import.meta.url)), 'build-embeddings.mjs'),
673
+ resolve(projectRoot, '.claude/scripts/build-embeddings.mjs'),
674
+ ];
675
+ const embedScript = embedCandidates.find(p => existsSync(p));
676
+ if (embedScript) {
677
+ log('Generating embeddings for code-map...');
678
+ try {
679
+ execSync(`node "${embedScript}" --namespace code-map`, {
680
+ cwd: projectRoot,
681
+ stdio: 'inherit',
682
+ timeout: 120000,
683
+ windowsHide: true,
684
+ });
685
+ } catch (err) {
686
+ log(`Warning: embedding generation failed: ${err.message?.split('\n')[0]}`);
687
+ }
682
688
  }
683
689
  }
684
690
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "moflo",
3
- "version": "4.6.3",
3
+ "version": "4.6.5",
4
4
  "description": "MoFlo — AI agent orchestration for Claude Code. Forked from ruflo/claude-flow with patches applied to source, plus feature-level orchestration.",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
@@ -131,30 +131,6 @@ async function checkMemoryDatabase() {
131
131
  }
132
132
  return { name: 'Memory Database', status: 'warn', message: 'Not initialized', fix: 'claude-flow memory configure --backend hybrid' };
133
133
  }
134
- // Check API keys
135
- async function checkApiKeys() {
136
- const keys = ['ANTHROPIC_API_KEY', 'CLAUDE_API_KEY', 'OPENAI_API_KEY'];
137
- const found = [];
138
- for (const key of keys) {
139
- if (process.env[key]) {
140
- found.push(key);
141
- }
142
- }
143
- // Detect Claude Code environment — API keys are managed internally
144
- const inClaudeCode = !!(process.env.CLAUDE_CODE || process.env.CLAUDE_PROJECT_DIR || process.env.MCP_SESSION_ID);
145
- if (found.includes('ANTHROPIC_API_KEY') || found.includes('CLAUDE_API_KEY')) {
146
- return { name: 'API Keys', status: 'pass', message: `Found: ${found.join(', ')}` };
147
- }
148
- else if (inClaudeCode) {
149
- return { name: 'API Keys', status: 'pass', message: 'Claude Code (managed internally)' };
150
- }
151
- else if (found.length > 0) {
152
- return { name: 'API Keys', status: 'warn', message: `Found: ${found.join(', ')} (no Claude key)`, fix: 'export ANTHROPIC_API_KEY=your_key' };
153
- }
154
- else {
155
- return { name: 'API Keys', status: 'warn', message: 'No API keys found', fix: 'export ANTHROPIC_API_KEY=your_key' };
156
- }
157
- }
158
134
  // Check git (async with proper env inheritance)
159
135
  async function checkGit() {
160
136
  try {
@@ -491,7 +467,6 @@ export const doctorCommand = {
491
467
  checkConfigFile,
492
468
  checkDaemonStatus,
493
469
  checkMemoryDatabase,
494
- checkApiKeys,
495
470
  checkMcpServers,
496
471
  checkDiskSpace,
497
472
  checkBuildTools,
@@ -506,7 +481,6 @@ export const doctorCommand = {
506
481
  'config': checkConfigFile,
507
482
  'daemon': checkDaemonStatus,
508
483
  'memory': checkMemoryDatabase,
509
- 'api': checkApiKeys,
510
484
  'git': checkGit,
511
485
  'mcp': checkMcpServers,
512
486
  'disk': checkDiskSpace,
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moflo/cli",
3
- "version": "4.6.3",
3
+ "version": "4.6.5",
4
4
  "type": "module",
5
5
  "description": "MoFlo CLI — AI agent orchestration with specialized agents, swarm coordination, MCP server, self-learning hooks, and vector memory for Claude Code",
6
6
  "main": "dist/src/index.js",