claude-flow 3.7.0-alpha.5 → 3.7.0-alpha.6

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.7.0-alpha.5",
3
+ "version": "3.7.0-alpha.6",
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",
@@ -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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@claude-flow/cli",
3
- "version": "3.7.0-alpha.5",
3
+ "version": "3.7.0-alpha.6",
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.7",
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",