claude-flow 3.6.15 → 3.6.17

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.6.15",
3
+ "version": "3.6.17",
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",
@@ -10,14 +10,30 @@
10
10
 
11
11
  import { randomUUID } from 'crypto';
12
12
 
13
- // Suppress noisy [AgentDB Patch] warnings from agentic-flow's runtime patch
14
- // These are cosmetic the patch tries to fix agentdb v1.x imports but we use v3
13
+ // Suppress the SPECIFIC cosmetic "[AgentDB Patch] Controller index not found"
14
+ // warning from agentic-flow's runtime patch these are emitted because the
15
+ // patch was written for agentdb v1.x and we use v3, where the controllers
16
+ // dist directory is laid out differently. The warning surfaces on every
17
+ // command and the audit (audit_1776483149979) flagged a too-broad suppression
18
+ // as a security risk because it could hide legitimate [AgentDB Patch] warnings.
19
+ //
20
+ // Tight match: must include both the prefix AND the specific "Controller
21
+ // index not found" text. Anything else (including future [AgentDB Patch]
22
+ // warnings about real issues) flows through unchanged. Also patch
23
+ // console.log because the underlying code uses it (the previous filter
24
+ // only caught console.warn and was therefore a no-op).
15
25
  const _origWarn = console.warn;
26
+ const _origLog = console.log;
27
+ const _isCosmeticAgentdbPatchNoise = (msg) =>
28
+ msg.includes('[AgentDB Patch]') && msg.includes('Controller index not found');
16
29
  console.warn = (...args) => {
17
- const msg = String(args[0] ?? '');
18
- if (msg.includes('[AgentDB Patch]')) return;
30
+ if (_isCosmeticAgentdbPatchNoise(String(args[0] ?? ''))) return;
19
31
  _origWarn.apply(console, args);
20
32
  };
33
+ console.log = (...args) => {
34
+ if (_isCosmeticAgentdbPatchNoise(String(args[0] ?? ''))) return;
35
+ _origLog.apply(console, args);
36
+ };
21
37
 
22
38
  // Check if we should run in MCP server mode
23
39
  // Conditions:
@@ -9,12 +9,23 @@
9
9
 
10
10
  import { randomUUID } from 'crypto';
11
11
 
12
- // Suppress [AgentDB Patch] warnings (cosmetic, from agentic-flow v1.x compat patch)
12
+ // Suppress the SPECIFIC cosmetic "[AgentDB Patch] Controller index not found"
13
+ // noise. Tight match (both prefix AND "Controller index not found") so other
14
+ // [AgentDB Patch] warnings about real issues still flow through. Also patch
15
+ // console.log because the underlying call site uses it. See bin/cli.js for
16
+ // the same rationale.
13
17
  const _origWarn = console.warn;
18
+ const _origLog = console.log;
19
+ const _isCosmeticAgentdbPatchNoise = (msg) =>
20
+ msg.includes('[AgentDB Patch]') && msg.includes('Controller index not found');
14
21
  console.warn = (...args) => {
15
- if (String(args[0] ?? '').includes('[AgentDB Patch]')) return;
22
+ if (_isCosmeticAgentdbPatchNoise(String(args[0] ?? ''))) return;
16
23
  _origWarn.apply(console, args);
17
24
  };
25
+ console.log = (...args) => {
26
+ if (_isCosmeticAgentdbPatchNoise(String(args[0] ?? ''))) return;
27
+ _origLog.apply(console, args);
28
+ };
18
29
 
19
30
  import { listMCPTools, callMCPTool, hasTool } from '../dist/src/mcp-client.js';
20
31
 
@@ -93,84 +93,103 @@ async function getRegistry(dbPath) {
93
93
  finally {
94
94
  console.log = origLog;
95
95
  }
96
- // Wire intelligence module as the learning backend
97
- // AgentDB's ReasoningBank/LearningSystem need a better-sqlite3 db handle
98
- // which ControllerRegistry doesn't expose. Instead, use the local intelligence
99
- // module (SONA + LocalReasoningBank + file persistence) for learning.
96
+ // Wire intelligence module as the learning backend.
97
+ // AgentDB's ReasoningBank/LearningSystem need a better-sqlite3 db
98
+ // handle which ControllerRegistry doesn't expose. Instead, use the
99
+ // local intelligence module (SONA + LocalReasoningBank + file
100
+ // persistence) for learning.
101
+ //
102
+ // PERF: parallelize the two independent post-init paths
103
+ // (intelligence module load + agentdb import). Previously these
104
+ // ran serially, adding ~50-150ms to cold start. Both can resolve
105
+ // concurrently because they touch disjoint controller slots.
100
106
  try {
101
- const intelligence = await import('./intelligence.js');
102
- const initResult = await intelligence.initializeIntelligence();
103
107
  const reg = registry;
104
- if (initResult.reasoningBankEnabled) {
105
- const rb = intelligence.getReasoningBank();
106
- if (rb && !reg.get('reasoningBank')) {
107
- if (typeof reg.set === 'function')
108
- reg.set('reasoningBank', rb);
109
- else
110
- reg._controllers = { ...(reg._controllers || {}), reasoningBank: rb };
108
+ const intelligencePromise = (async () => {
109
+ try {
110
+ const intelligence = await import('./intelligence.js');
111
+ const initResult = await intelligence.initializeIntelligence();
112
+ if (initResult.reasoningBankEnabled) {
113
+ const rb = intelligence.getReasoningBank();
114
+ if (rb && !reg.get('reasoningBank')) {
115
+ if (typeof reg.set === 'function')
116
+ reg.set('reasoningBank', rb);
117
+ else
118
+ reg._controllers = { ...(reg._controllers || {}), reasoningBank: rb };
119
+ }
120
+ }
121
+ if (initResult.sonaEnabled) {
122
+ const sona = intelligence.getSonaCoordinator();
123
+ if (sona && !reg.get('learningSystem')) {
124
+ if (typeof reg.set === 'function')
125
+ reg.set('learningSystem', sona);
126
+ else
127
+ reg._controllers = { ...(reg._controllers || {}), learningSystem: sona };
128
+ }
129
+ }
111
130
  }
112
- }
113
- if (initResult.sonaEnabled) {
114
- const sona = intelligence.getSonaCoordinator();
115
- if (sona && !reg.get('learningSystem')) {
116
- if (typeof reg.set === 'function')
117
- reg.set('learningSystem', sona);
118
- else
119
- reg._controllers = { ...(reg._controllers || {}), learningSystem: sona };
131
+ catch { /* intelligence module not available — learning stays unwired */ }
132
+ })();
133
+ const agentdbPromise = (async () => {
134
+ // Single import shared across SkillLibrary + SemanticRouter probe.
135
+ let agentdb = null;
136
+ try {
137
+ agentdb = (await import('agentdb'));
120
138
  }
121
- }
122
- // SkillLibrary from AgentDB (no db required)
123
- try {
124
- const agentdb = await import('agentdb');
125
- if (agentdb.SkillLibrary && !reg.get('skills')) {
126
- const sk = new agentdb.SkillLibrary();
127
- if (typeof reg.set === 'function')
128
- reg.set('skills', sk);
129
- else
130
- reg._controllers = { ...(reg._controllers || {}), skills: sk };
139
+ catch {
140
+ return; /* AgentDB not available */
131
141
  }
132
- }
133
- catch { /* AgentDB not available */ }
134
- // ADR-093 F9: post-init injection of low-risk disabled controllers.
135
- // Try multiple constructor names because the agentdb API renamed
136
- // SemanticRouter across alpha versions (alpha.10 had SemanticRouter,
137
- // alpha.11+ removed it in favor of @ruvector/router separately;
138
- // future versions may reintroduce). If the cwd's agentdb has a
139
- // viable router-shaped controller, wire it; otherwise leave it
140
- // unbound and let bridgeSemanticRoute return its actionable error.
141
- try {
142
- const agentdb = await import('agentdb');
143
- const candidates = ['SemanticRouter', 'IntentRouter', 'TaskRouter'];
144
- let routerInstance = null;
145
- for (const name of candidates) {
146
- const Ctor = agentdb[name];
147
- if (typeof Ctor === 'function') {
148
- try {
149
- // Try with dimension config first (newer router classes), then no-args
150
- const inst = (() => {
151
- try {
152
- return new Ctor({ dimension: 384 });
153
- }
154
- catch {
155
- return new Ctor();
142
+ // SkillLibrary (no db required)
143
+ try {
144
+ const SkillCtor = agentdb.SkillLibrary;
145
+ if (SkillCtor && !reg.get('skills')) {
146
+ const sk = new SkillCtor();
147
+ if (typeof reg.set === 'function')
148
+ reg.set('skills', sk);
149
+ else
150
+ reg._controllers = { ...(reg._controllers || {}), skills: sk };
151
+ }
152
+ }
153
+ catch { /* SkillLibrary optional */ }
154
+ // ADR-093 F9: probe multiple router class names across agentdb
155
+ // alpha versions (alpha.10 had SemanticRouter; alpha.11+ removed
156
+ // it in favor of @ruvector/router; future versions may
157
+ // reintroduce). Wire only if .route() is callable.
158
+ try {
159
+ const candidates = ['SemanticRouter', 'IntentRouter', 'TaskRouter'];
160
+ let routerInstance = null;
161
+ for (const name of candidates) {
162
+ const Ctor = agentdb[name];
163
+ if (typeof Ctor === 'function') {
164
+ try {
165
+ const inst = (() => {
166
+ try {
167
+ return new Ctor({ dimension: 384 });
168
+ }
169
+ catch {
170
+ return new Ctor();
171
+ }
172
+ })();
173
+ if (inst && typeof inst.route === 'function') {
174
+ routerInstance = inst;
175
+ break;
156
176
  }
157
- })();
158
- if (inst && typeof inst.route === 'function') {
159
- routerInstance = inst;
160
- break;
161
177
  }
178
+ catch { /* try next candidate */ }
162
179
  }
163
- catch { /* try next candidate */ }
180
+ }
181
+ if (routerInstance && !reg.get('semanticRouter')) {
182
+ if (typeof reg.set === 'function')
183
+ reg.set('semanticRouter', routerInstance);
184
+ else
185
+ reg._controllers = { ...(reg._controllers || {}), semanticRouter: routerInstance };
164
186
  }
165
187
  }
166
- if (routerInstance && !reg.get('semanticRouter')) {
167
- if (typeof reg.set === 'function')
168
- reg.set('semanticRouter', routerInstance);
169
- else
170
- reg._controllers = { ...(reg._controllers || {}), semanticRouter: routerInstance };
171
- }
172
- }
173
- catch { /* SemanticRouter optional — bridgeSemanticRoute will surface "not available" */ }
188
+ catch { /* router optional */ }
189
+ })();
190
+ // Run both in parallel; settle either way so a single failing
191
+ // path doesn't tear down the rest of the post-init wiring.
192
+ await Promise.allSettled([intelligencePromise, agentdbPromise]);
174
193
  // Other disabled controllers remain disabled and tracked in
175
194
  // ADR-093 F9 for future enablement:
176
195
  // - mutationGuard (write protection — needs config)
@@ -183,7 +202,7 @@ async function getRegistry(dbPath) {
183
202
  // - graphAdapter (graph DB adapter — needs graph DB)
184
203
  }
185
204
  catch {
186
- // Intelligence module not available learning stays unwired
205
+ // Top-level catchregistry stays usable even if post-init wiring fails wholesale.
187
206
  }
188
207
  registryInstance = registry;
189
208
  bridgeAvailable = true;
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@claude-flow/cli",
3
- "version": "3.6.15",
3
+ "version": "3.6.17",
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",
@@ -84,7 +84,7 @@
84
84
  "test": "vitest run",
85
85
  "test:plugin-store": "npx tsx src/plugins/tests/standalone-test.ts",
86
86
  "test:pattern-store": "npx tsx src/transfer/store/tests/standalone-test.ts",
87
- "postinstall": "node -e \"const{existsSync,cpSync,readdirSync}=require('fs');const{join,dirname}=require('path');try{const r=require.resolve('agentdb');const base=r.includes('dist/src')?join(dirname(r),'..','..'):(r.includes('dist')?join(dirname(r),'..'):dirname(r));const s=join(base,'dist','src','controllers');const t=join(base,'dist','controllers');if(existsSync(s)&&!existsSync(t)){cpSync(s,t,{recursive:true});}}catch{}\"",
87
+ "postinstall": "node -e \"const{existsSync,cpSync,readdirSync,statSync}=require('fs');const{join,dirname}=require('path');try{const r=require.resolve('agentdb');const base=r.includes('dist/src')?join(dirname(r),'..','..'):(r.includes('dist')?join(dirname(r),'..'):dirname(r));const srcDist=join(base,'dist','src');if(!existsSync(srcDist))process.exit(0);for(const e of readdirSync(srcDist)){const s=join(srcDist,e);const t=join(base,'dist',e);try{if(statSync(s).isDirectory()&&!existsSync(t)){cpSync(s,t,{recursive:true});}}catch{}}}catch{}\"",
88
88
  "prepublishOnly": "cp ../../../README.md ./README.md",
89
89
  "release": "npm version prerelease --preid=alpha && npm run publish:all",
90
90
  "publish:all": "./scripts/publish.sh"