claude-flow 3.7.0-alpha.5 → 3.7.0-alpha.7
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 +1 -1
- package/v3/@claude-flow/cli/dist/src/mcp-tools/hooks-tools.js +4 -2
- package/v3/@claude-flow/cli/dist/src/mcp-tools/neural-tools.js +2 -1
- package/v3/@claude-flow/cli/dist/src/memory/neural-package-bridge.d.ts +48 -0
- package/v3/@claude-flow/cli/dist/src/memory/neural-package-bridge.js +87 -0
- package/v3/@claude-flow/cli/dist/src/ruvector/index.d.ts +0 -2
- package/v3/@claude-flow/cli/dist/src/ruvector/index.js +8 -2
- package/v3/@claude-flow/cli/package.json +2 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "claude-flow",
|
|
3
|
-
"version": "3.7.0-alpha.
|
|
3
|
+
"version": "3.7.0-alpha.7",
|
|
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",
|
|
@@ -66,11 +66,12 @@ async function getEWCConsolidator() {
|
|
|
66
66
|
return ewcConsolidator;
|
|
67
67
|
}
|
|
68
68
|
// MoE Router - lazy loaded
|
|
69
|
+
// #1773 item 4 — moe-router migrated to @claude-flow/neural
|
|
69
70
|
let moeRouter = null;
|
|
70
71
|
async function getMoERouter() {
|
|
71
72
|
if (!moeRouter) {
|
|
72
73
|
try {
|
|
73
|
-
const { getMoERouter: getMoE } = await import('
|
|
74
|
+
const { getMoERouter: getMoE } = await import('@claude-flow/neural');
|
|
74
75
|
moeRouter = await getMoE();
|
|
75
76
|
}
|
|
76
77
|
catch {
|
|
@@ -336,11 +337,12 @@ function getRouterBackendInfo() {
|
|
|
336
337
|
}
|
|
337
338
|
}
|
|
338
339
|
// Flash Attention - lazy loaded
|
|
340
|
+
// #1773 item 4 — flash-attention migrated to @claude-flow/neural
|
|
339
341
|
let flashAttention = null;
|
|
340
342
|
async function getFlashAttention() {
|
|
341
343
|
if (!flashAttention) {
|
|
342
344
|
try {
|
|
343
|
-
const { getFlashAttention: getFlash } = await import('
|
|
345
|
+
const { getFlashAttention: getFlash } = await import('@claude-flow/neural');
|
|
344
346
|
flashAttention = await getFlash();
|
|
345
347
|
}
|
|
346
348
|
catch {
|
|
@@ -668,7 +668,8 @@ export const neuralTools = [
|
|
|
668
668
|
// The two surfaces now agree on a single source of truth.
|
|
669
669
|
flashAttention: await (async () => {
|
|
670
670
|
try {
|
|
671
|
-
|
|
671
|
+
// #1773 item 4 — flash-attention now lives in @claude-flow/neural
|
|
672
|
+
const { getFlashAttention } = await import('@claude-flow/neural');
|
|
672
673
|
return getFlashAttention() !== null;
|
|
673
674
|
}
|
|
674
675
|
catch {
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bridge to @claude-flow/neural — Phase 1 convergence (#1773).
|
|
3
|
+
*
|
|
4
|
+
* The cli has historically reimplemented SONA / ReasoningBank / PatternLearner
|
|
5
|
+
* locally in `intelligence.ts`. The dedicated `@claude-flow/neural` package
|
|
6
|
+
* (3.0.0-alpha.7+) ships the canonical implementations plus 7 RL algorithms
|
|
7
|
+
* (PPO/DQN/A2C/Decision Transformer/Q-Learning/SARSA/Curiosity), 5 SONA
|
|
8
|
+
* modes (RealTime/Balanced/Research/Edge/Batch), and an event listener
|
|
9
|
+
* system that the cli's local impl doesn't have.
|
|
10
|
+
*
|
|
11
|
+
* This bridge lazy-loads `NeuralLearningSystem` from the package and exposes
|
|
12
|
+
* a stable accessor for cli code that wants to use the richer surface. The
|
|
13
|
+
* existing local LocalSonaCoordinator + LocalReasoningBank in intelligence.ts
|
|
14
|
+
* stay intact for now — Phase 1 just proves the wiring works without
|
|
15
|
+
* breaking the 769 cli tests. Phase 2+ migrates functions one at a time.
|
|
16
|
+
*
|
|
17
|
+
* Why lazy: instantiating NeuralLearningSystem pulls in @ruvector/sona and
|
|
18
|
+
* a few transitive WASM modules — not free at process startup. The bridge
|
|
19
|
+
* defers until something actually asks for it.
|
|
20
|
+
*/
|
|
21
|
+
import type { NeuralLearningSystem, SONAMode } from '@claude-flow/neural';
|
|
22
|
+
/**
|
|
23
|
+
* Lazy-load + initialize the @claude-flow/neural NeuralLearningSystem. Returns
|
|
24
|
+
* null if the package isn't resolvable (defensive — the package is in cli's
|
|
25
|
+
* regular dependencies, but environments with --ignore-scripts or pnpm prune
|
|
26
|
+
* can leave it unavailable). Idempotent across calls.
|
|
27
|
+
*/
|
|
28
|
+
export declare function getNeuralPackage(mode?: SONAMode): Promise<NeuralLearningSystem | null>;
|
|
29
|
+
/**
|
|
30
|
+
* Quick "is the package available?" probe without forcing initialization.
|
|
31
|
+
* Returns true if a previous getNeuralPackage() call succeeded; null if
|
|
32
|
+
* never tried or failed. Useful for dashboards that want to surface package
|
|
33
|
+
* status without triggering load.
|
|
34
|
+
*/
|
|
35
|
+
export declare function isNeuralPackageLoaded(): boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Get aggregated stats from the neural package alongside cli's local stats.
|
|
38
|
+
* Returns null if the package isn't loaded — caller should fall back to
|
|
39
|
+
* local-only stats. The return shape mirrors the package's NeuralLearningSystem
|
|
40
|
+
* .getStats() output: { sona, reasoningBank, patternLearner }.
|
|
41
|
+
*/
|
|
42
|
+
export declare function getNeuralPackageStats(): Promise<ReturnType<NeuralLearningSystem['getStats']> | null>;
|
|
43
|
+
/**
|
|
44
|
+
* Reset the bridge (mainly for tests). Drops the cached instance and
|
|
45
|
+
* forgets any prior init failure so the next getNeuralPackage() retries.
|
|
46
|
+
*/
|
|
47
|
+
export declare function resetNeuralPackageBridge(): void;
|
|
48
|
+
//# sourceMappingURL=neural-package-bridge.d.ts.map
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bridge to @claude-flow/neural — Phase 1 convergence (#1773).
|
|
3
|
+
*
|
|
4
|
+
* The cli has historically reimplemented SONA / ReasoningBank / PatternLearner
|
|
5
|
+
* locally in `intelligence.ts`. The dedicated `@claude-flow/neural` package
|
|
6
|
+
* (3.0.0-alpha.7+) ships the canonical implementations plus 7 RL algorithms
|
|
7
|
+
* (PPO/DQN/A2C/Decision Transformer/Q-Learning/SARSA/Curiosity), 5 SONA
|
|
8
|
+
* modes (RealTime/Balanced/Research/Edge/Batch), and an event listener
|
|
9
|
+
* system that the cli's local impl doesn't have.
|
|
10
|
+
*
|
|
11
|
+
* This bridge lazy-loads `NeuralLearningSystem` from the package and exposes
|
|
12
|
+
* a stable accessor for cli code that wants to use the richer surface. The
|
|
13
|
+
* existing local LocalSonaCoordinator + LocalReasoningBank in intelligence.ts
|
|
14
|
+
* stay intact for now — Phase 1 just proves the wiring works without
|
|
15
|
+
* breaking the 769 cli tests. Phase 2+ migrates functions one at a time.
|
|
16
|
+
*
|
|
17
|
+
* Why lazy: instantiating NeuralLearningSystem pulls in @ruvector/sona and
|
|
18
|
+
* a few transitive WASM modules — not free at process startup. The bridge
|
|
19
|
+
* defers until something actually asks for it.
|
|
20
|
+
*/
|
|
21
|
+
let pkgInstance = null;
|
|
22
|
+
let pkgInitPromise = null;
|
|
23
|
+
let pkgInitFailed = false;
|
|
24
|
+
/**
|
|
25
|
+
* Lazy-load + initialize the @claude-flow/neural NeuralLearningSystem. Returns
|
|
26
|
+
* null if the package isn't resolvable (defensive — the package is in cli's
|
|
27
|
+
* regular dependencies, but environments with --ignore-scripts or pnpm prune
|
|
28
|
+
* can leave it unavailable). Idempotent across calls.
|
|
29
|
+
*/
|
|
30
|
+
export async function getNeuralPackage(mode = 'balanced') {
|
|
31
|
+
if (pkgInstance)
|
|
32
|
+
return pkgInstance;
|
|
33
|
+
if (pkgInitFailed)
|
|
34
|
+
return null;
|
|
35
|
+
if (pkgInitPromise)
|
|
36
|
+
return pkgInitPromise;
|
|
37
|
+
pkgInitPromise = (async () => {
|
|
38
|
+
try {
|
|
39
|
+
const m = await import('@claude-flow/neural');
|
|
40
|
+
const sys = m.createNeuralLearningSystem(mode);
|
|
41
|
+
await sys.initialize();
|
|
42
|
+
pkgInstance = sys;
|
|
43
|
+
return sys;
|
|
44
|
+
}
|
|
45
|
+
catch (err) {
|
|
46
|
+
// CLAUDE_FLOW_DEBUG-gated log so future regressions of this shape
|
|
47
|
+
// don't disappear silently — same convention as the ruvllm coordinator
|
|
48
|
+
// bridge (#1770).
|
|
49
|
+
if (process.env.CLAUDE_FLOW_DEBUG) {
|
|
50
|
+
// eslint-disable-next-line no-console
|
|
51
|
+
console.error('[neural-package] @claude-flow/neural load failed:', err.message);
|
|
52
|
+
}
|
|
53
|
+
pkgInitFailed = true;
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
})();
|
|
57
|
+
return pkgInitPromise;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Quick "is the package available?" probe without forcing initialization.
|
|
61
|
+
* Returns true if a previous getNeuralPackage() call succeeded; null if
|
|
62
|
+
* never tried or failed. Useful for dashboards that want to surface package
|
|
63
|
+
* status without triggering load.
|
|
64
|
+
*/
|
|
65
|
+
export function isNeuralPackageLoaded() {
|
|
66
|
+
return pkgInstance !== null;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Get aggregated stats from the neural package alongside cli's local stats.
|
|
70
|
+
* Returns null if the package isn't loaded — caller should fall back to
|
|
71
|
+
* local-only stats. The return shape mirrors the package's NeuralLearningSystem
|
|
72
|
+
* .getStats() output: { sona, reasoningBank, patternLearner }.
|
|
73
|
+
*/
|
|
74
|
+
export async function getNeuralPackageStats() {
|
|
75
|
+
const sys = await getNeuralPackage();
|
|
76
|
+
return sys ? sys.getStats() : null;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Reset the bridge (mainly for tests). Drops the cached instance and
|
|
80
|
+
* forgets any prior init failure so the next getNeuralPackage() retries.
|
|
81
|
+
*/
|
|
82
|
+
export function resetNeuralPackageBridge() {
|
|
83
|
+
pkgInstance = null;
|
|
84
|
+
pkgInitPromise = null;
|
|
85
|
+
pkgInitFailed = false;
|
|
86
|
+
}
|
|
87
|
+
//# sourceMappingURL=neural-package-bridge.js.map
|
|
@@ -13,13 +13,11 @@
|
|
|
13
13
|
* @module @claude-flow/cli/ruvector
|
|
14
14
|
*/
|
|
15
15
|
export { QLearningRouter, createQLearningRouter, type QLearningRouterConfig, type RouteDecision } from './q-learning-router.js';
|
|
16
|
-
export { MoERouter, getMoERouter, resetMoERouter, createMoERouter, EXPERT_NAMES, NUM_EXPERTS, INPUT_DIM, HIDDEN_DIM, type ExpertType, type MoERouterConfig, type RoutingResult, type LoadBalanceStats, } from './moe-router.js';
|
|
17
16
|
export { ASTAnalyzer, createASTAnalyzer, type ASTAnalysis, type ASTNode, type ASTAnalyzerConfig } from './ast-analyzer.js';
|
|
18
17
|
export { DiffClassifier, createDiffClassifier, analyzeDiff, analyzeDiffSync, assessFileRisk, assessOverallRisk, classifyDiff, suggestReviewers, getGitDiffNumstat, getGitDiffNumstatAsync, clearDiffCache, clearAllDiffCaches, type DiffClassification, type DiffHunk, type DiffChange, type FileDiff, type DiffAnalysis, type DiffClassifierConfig, type DiffFile, type RiskLevel, type FileRisk, type OverallRisk, type DiffAnalysisResult, } from './diff-classifier.js';
|
|
19
18
|
export { CoverageRouter, createCoverageRouter, coverageRoute, coverageSuggest, coverageGaps, clearCoverageCache, getCoverageCacheStats, type CoverageRouterConfig, type FileCoverage, type CoverageReport, type CoverageRouteResult, type CoverageSuggestResult, type CoverageGapsResult, type CoverageRouteOptions, type CoverageSuggestOptions, type CoverageGapsOptions, } from './coverage-router.js';
|
|
20
19
|
export { coverageRouterTools, hooksCoverageRoute, hooksCoverageSuggest, hooksCoverageGaps } from './coverage-tools.js';
|
|
21
20
|
export { buildDependencyGraph, analyzeGraph, analyzeMinCutBoundaries, analyzeModuleCommunities, detectCircularDependencies, exportToDot, loadRuVector, fallbackMinCut, fallbackLouvain, clearGraphCaches, getGraphCacheStats, type GraphNode, type GraphEdge, type DependencyGraph, type MinCutBoundary, type ModuleCommunity, type CircularDependency, type GraphAnalysisResult, } from './graph-analyzer.js';
|
|
22
|
-
export { FlashAttention, getFlashAttention, resetFlashAttention, computeAttention, benchmarkFlashAttention, getFlashAttentionSpeedup, type FlashAttentionConfig, type AttentionResult, type BenchmarkResult, } from './flash-attention.js';
|
|
23
21
|
export { LoRAAdapter, getLoRAAdapter, resetLoRAAdapter, createLoRAAdapter, adaptEmbedding, trainLoRA, getLoRAStats, DEFAULT_RANK, DEFAULT_ALPHA, INPUT_DIM as LORA_INPUT_DIM, OUTPUT_DIM as LORA_OUTPUT_DIM, type LoRAConfig, type LoRAWeights, type AdaptationResult, type LoRAStats, } from './lora-adapter.js';
|
|
24
22
|
export { ModelRouter, getModelRouter, resetModelRouter, createModelRouter, routeToModel, routeToModelFull, analyzeTaskComplexity, getModelRouterStats, recordModelOutcome, MODEL_CAPABILITIES, COMPLEXITY_INDICATORS, type ClaudeModel, type ModelRouterConfig, type ModelRoutingResult, type ComplexityAnalysis, } from './model-router.js';
|
|
25
23
|
export { SemanticRouter, createSemanticRouter, type Intent, type RouteResult, type RouterConfig, } from './semantic-router.js';
|
|
@@ -13,7 +13,10 @@
|
|
|
13
13
|
* @module @claude-flow/cli/ruvector
|
|
14
14
|
*/
|
|
15
15
|
export { QLearningRouter, createQLearningRouter } from './q-learning-router.js';
|
|
16
|
-
|
|
16
|
+
// #1773 item 4 — moe-router migrated to @claude-flow/neural. Direct
|
|
17
|
+
// consumers (hooks-tools.ts) import from '@claude-flow/neural' explicitly;
|
|
18
|
+
// re-exporting through this barrel would force vitest to resolve the
|
|
19
|
+
// neural pkg's transitive @ruvector/sona dep eagerly. Keep imports direct.
|
|
17
20
|
export { ASTAnalyzer, createASTAnalyzer } from './ast-analyzer.js';
|
|
18
21
|
export { DiffClassifier, createDiffClassifier,
|
|
19
22
|
// MCP tool exports
|
|
@@ -29,7 +32,10 @@ export { coverageRouterTools, hooksCoverageRoute, hooksCoverageSuggest, hooksCov
|
|
|
29
32
|
export { buildDependencyGraph, analyzeGraph, analyzeMinCutBoundaries, analyzeModuleCommunities, detectCircularDependencies, exportToDot, loadRuVector, fallbackMinCut, fallbackLouvain,
|
|
30
33
|
// Cache utilities (NEW)
|
|
31
34
|
clearGraphCaches, getGraphCacheStats, } from './graph-analyzer.js';
|
|
32
|
-
|
|
35
|
+
// #1773 item 4 — flash-attention migrated to @claude-flow/neural. Direct
|
|
36
|
+
// consumers (hooks-tools.ts, neural-tools.ts) import from '@claude-flow/neural'
|
|
37
|
+
// explicitly; re-exporting through this barrel pulls the package's
|
|
38
|
+
// transitive @ruvector/sona dep into vitest's eager resolution.
|
|
33
39
|
export { LoRAAdapter, getLoRAAdapter, resetLoRAAdapter, createLoRAAdapter, adaptEmbedding, trainLoRA, getLoRAStats, DEFAULT_RANK, DEFAULT_ALPHA, INPUT_DIM as LORA_INPUT_DIM, OUTPUT_DIM as LORA_OUTPUT_DIM, } from './lora-adapter.js';
|
|
34
40
|
export { ModelRouter, getModelRouter, resetModelRouter, createModelRouter, routeToModel, routeToModelFull, analyzeTaskComplexity, getModelRouterStats, recordModelOutcome, MODEL_CAPABILITIES, COMPLEXITY_INDICATORS, } from './model-router.js';
|
|
35
41
|
export { SemanticRouter, createSemanticRouter, } from './semantic-router.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@claude-flow/cli",
|
|
3
|
-
"version": "3.7.0-alpha.
|
|
3
|
+
"version": "3.7.0-alpha.7",
|
|
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",
|
|
@@ -97,6 +97,7 @@
|
|
|
97
97
|
"dependencies": {
|
|
98
98
|
"@claude-flow/cli-core": "^3.7.0-alpha.5",
|
|
99
99
|
"@claude-flow/mcp": "^3.0.0-alpha.8",
|
|
100
|
+
"@claude-flow/neural": "^3.0.0-alpha.8",
|
|
100
101
|
"@claude-flow/shared": "^3.0.0-alpha.7",
|
|
101
102
|
"@noble/ed25519": "^2.1.0",
|
|
102
103
|
"@ruvector/rabitq-wasm": "^0.1.0",
|