claude-flow 3.18.0 → 3.18.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-flow",
3
- "version": "3.18.0",
3
+ "version": "3.18.1",
4
4
  "description": "Ruflo - Enterprise AI agent orchestration for Claude Code. Deploy 60+ specialized agents in coordinated swarms with self-learning, fault-tolerant consensus, vector memory, and MCP integration",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
@@ -451,17 +451,27 @@ const statusCommand = {
451
451
  },
452
452
  {
453
453
  component: 'Contrastive Trainer',
454
- status: stats._contrastiveTrainer && stats._contrastiveTrainer !== 'unavailable' ? output.success('Active') : output.dim('Unavailable'),
455
- details: stats._contrastiveTrainer && stats._contrastiveTrainer !== 'unavailable'
454
+ // #2549 three states: live session (object with counts),
455
+ // 'available' (module resolves, no in-process session — the
456
+ // normal case for a read-only status process), 'unavailable'
457
+ // (module genuinely does not resolve).
458
+ status: typeof stats._contrastiveTrainer === 'object'
459
+ ? output.success('Active')
460
+ : stats._contrastiveTrainer === 'available'
461
+ ? output.success('Available')
462
+ : output.dim('Unavailable'),
463
+ details: typeof stats._contrastiveTrainer === 'object'
456
464
  ? `${stats._contrastiveTrainer.triplets ?? 0} triplets, ${stats._contrastiveTrainer.agents ?? 0} agents`
457
- : 'Install @ruvector/ruvllm',
465
+ : stats._contrastiveTrainer === 'available'
466
+ ? 'ready — trains in-process on demand'
467
+ : 'Install @ruvector/ruvllm',
458
468
  },
459
469
  {
460
470
  component: 'Training Pipeline',
461
- status: stats._trainingBackend === 'ruvllm' ? output.success('Active') : output.dim(stats._trainingBackend || 'Unavailable'),
471
+ status: stats._trainingBackend === 'ruvllm' ? output.success('Available') : output.dim(stats._trainingBackend || 'Unavailable'),
462
472
  details: stats._trainingBackend === 'ruvllm'
463
- ? 'ruvllm checkpoints enabled'
464
- : 'JS fallback (no checkpoints)',
473
+ ? 'native @ruvector/ruvllm pipeline'
474
+ : 'JS fallback',
465
475
  },
466
476
  await (async () => {
467
477
  try {
@@ -14,6 +14,7 @@ import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
14
14
  import { homedir } from 'node:os';
15
15
  import { createRequire } from 'node:module';
16
16
  import { join } from 'node:path';
17
+ import { resolveTrainingBackend } from '../ruvector/lora-adapter.js';
17
18
  // ============================================================================
18
19
  // Persistence Configuration
19
20
  // ============================================================================
@@ -1006,15 +1007,29 @@ export function getIntelligenceStats() {
1006
1007
  loadRuvllmCoordinatorSync();
1007
1008
  }
1008
1009
  const ruvllmStats = ruvllmCoordinator?.stats?.() || null;
1009
- // Fetch cross-module stats for unified reporting
1010
+ // Fetch cross-module stats for unified reporting.
1011
+ //
1012
+ // #2549 — two prior defects here: `trainingBackend` was declared and
1013
+ // returned but never assigned (always 'unavailable'), and contrastive
1014
+ // availability was read ONLY from an in-process global that a fresh
1015
+ // read-only `neural status` process never populates. Both made the
1016
+ // native @ruvector/ruvllm path invisible even when installed. Backend
1017
+ // now comes from the lora-adapter's capability probe; the global still
1018
+ // wins when present because it carries live in-process session counts.
1010
1019
  let contrastiveTrainer = 'unavailable';
1011
1020
  let trainingBackend = 'unavailable';
1012
1021
  try {
1013
- // Synchronous check — contrastiveTrainer is module-level in sona-optimizer
1014
- // We read it via the SONAOptimizer singleton if available
1022
+ trainingBackend = resolveTrainingBackend();
1023
+ }
1024
+ catch { /* module absent — stay 'unavailable' */ }
1025
+ try {
1015
1026
  const sonaModule = globalThis.__claudeFlowSonaStats;
1016
- if (sonaModule) {
1017
- contrastiveTrainer = sonaModule._contrastiveTrainer || 'unavailable';
1027
+ if (sonaModule?._contrastiveTrainer) {
1028
+ contrastiveTrainer = sonaModule._contrastiveTrainer;
1029
+ }
1030
+ else if (trainingBackend === 'ruvllm') {
1031
+ // Module resolves but no in-process session — available, idle.
1032
+ contrastiveTrainer = 'available';
1018
1033
  }
1019
1034
  }
1020
1035
  catch { /* not available */ }
@@ -97,6 +97,15 @@ export interface LoRAStats {
97
97
  /** Training backend in use ('ruvllm' | 'js-fallback') */
98
98
  _trainingBackend?: string;
99
99
  }
100
+ /**
101
+ * Which training backend a train call would use — WITHOUT loading the
102
+ * pipeline (#2549). Before this existed, status surfaces read module state
103
+ * that only a prior in-process train populates, so a fresh read-only
104
+ * process always reported 'js-fallback'/'unavailable' even with
105
+ * @ruvector/ruvllm installed. The pipeline stays lazy: this only probes
106
+ * module resolution.
107
+ */
108
+ export declare function resolveTrainingBackend(): 'ruvllm' | 'js-fallback';
100
109
  /**
101
110
  * Low-Rank Adaptation module for efficient embedding fine-tuning
102
111
  */
@@ -19,6 +19,7 @@
19
19
  */
20
20
  import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'fs';
21
21
  import { dirname, join } from 'path';
22
+ import { createRequire } from 'module';
22
23
  // ============================================================================
23
24
  // Types & Constants
24
25
  // ============================================================================
@@ -57,6 +58,25 @@ const DEFAULT_CONFIG = {
57
58
  // ============================================================================
58
59
  let ruvllmPipeline = null;
59
60
  let pipelineLoaded = false;
61
+ /**
62
+ * Which training backend a train call would use — WITHOUT loading the
63
+ * pipeline (#2549). Before this existed, status surfaces read module state
64
+ * that only a prior in-process train populates, so a fresh read-only
65
+ * process always reported 'js-fallback'/'unavailable' even with
66
+ * @ruvector/ruvllm installed. The pipeline stays lazy: this only probes
67
+ * module resolution.
68
+ */
69
+ export function resolveTrainingBackend() {
70
+ if (pipelineLoaded)
71
+ return ruvllmPipeline ? 'ruvllm' : 'js-fallback';
72
+ try {
73
+ createRequire(import.meta.url).resolve('@ruvector/ruvllm');
74
+ return 'ruvllm';
75
+ }
76
+ catch {
77
+ return 'js-fallback';
78
+ }
79
+ }
60
80
  async function loadTrainingPipeline(adapter) {
61
81
  if (pipelineLoaded)
62
82
  return ruvllmPipeline;
@@ -295,9 +315,7 @@ export class LoRAAdapter {
295
315
  ? this.adaptationNormSum / this.totalAdaptations
296
316
  : 0,
297
317
  lastUpdate: this.lastUpdate,
298
- _trainingBackend: pipelineLoaded
299
- ? (ruvllmPipeline ? 'ruvllm' : 'js-fallback')
300
- : 'js-fallback',
318
+ _trainingBackend: resolveTrainingBackend(),
301
319
  };
302
320
  }
303
321
  /**
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@claude-flow/cli",
3
- "version": "3.18.0",
3
+ "version": "3.18.1",
4
4
  "type": "module",
5
5
  "description": "Ruflo CLI - Enterprise AI agent orchestration with 60+ specialized agents, swarm coordination, MCP server, self-learning hooks, and vector memory for Claude Code",
6
6
  "main": "dist/src/index.js",