@claude-flow/cli 3.10.31 → 3.10.32
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/.claude/helpers/router.js +70 -31
- package/bin/cli.js +65 -12
- package/dist/src/init/helpers-generator.d.ts.map +1 -1
- package/dist/src/init/helpers-generator.js +51 -28
- package/dist/src/init/helpers-generator.js.map +1 -1
- package/dist/src/log-filters.d.ts +25 -14
- package/dist/src/log-filters.d.ts.map +1 -1
- package/dist/src/log-filters.js +48 -14
- package/dist/src/log-filters.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -1,7 +1,16 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/**
|
|
3
3
|
* Claude Flow Agent Router
|
|
4
|
-
*
|
|
4
|
+
*
|
|
5
|
+
* Static keyword router that suggests an agent for a task description.
|
|
6
|
+
* NOTE: This is *not* a learned model. It is a heuristic table; "confidence"
|
|
7
|
+
* is reported as a heuristic prior, not a calibrated probability.
|
|
8
|
+
*
|
|
9
|
+
* #2257 fix: patterns are now word-boundary-anchored so short tokens like
|
|
10
|
+
* `cd`, `ci`, `ui`, `add`, `structure` no longer match inside unrelated
|
|
11
|
+
* words (`decision`, `infrastructure`, `address`, `addendum`). Default
|
|
12
|
+
* confidence dropped from 0.8 to 0.6 to better reflect that this is a
|
|
13
|
+
* static heuristic, not a learned classifier.
|
|
5
14
|
*/
|
|
6
15
|
|
|
7
16
|
const AGENT_CAPABILITIES = {
|
|
@@ -15,52 +24,82 @@ const AGENT_CAPABILITIES = {
|
|
|
15
24
|
devops: ['ci-cd', 'docker', 'deployment', 'infrastructure'],
|
|
16
25
|
};
|
|
17
26
|
|
|
18
|
-
|
|
27
|
+
// Each entry is an array of tokens. Tokens are alternation-friendly:
|
|
28
|
+
// - multi-word phrases ("unit test") match as phrases
|
|
29
|
+
// - single tokens are wrapped with \b … \b word boundaries at match time
|
|
30
|
+
const TASK_PATTERNS = [
|
|
19
31
|
// Code patterns
|
|
20
|
-
'implement
|
|
21
|
-
'test
|
|
22
|
-
'review
|
|
23
|
-
'research
|
|
24
|
-
'design
|
|
32
|
+
{ tokens: ['implement', 'create', 'build', 'add', 'write code', 'refactor', 'debug'], agent: 'coder' },
|
|
33
|
+
{ tokens: ['test', 'tests', 'spec', 'coverage', 'unit test', 'integration test'], agent: 'tester' },
|
|
34
|
+
{ tokens: ['review', 'audit', 'check', 'validate', 'security'], agent: 'reviewer' },
|
|
35
|
+
{ tokens: ['research', 'find', 'search', 'documentation', 'explore'], agent: 'researcher' },
|
|
36
|
+
{ tokens: ['design', 'architect', 'architecture', 'structure', 'plan'], agent: 'architect' },
|
|
25
37
|
|
|
26
38
|
// Domain patterns
|
|
27
|
-
'api
|
|
28
|
-
'ui
|
|
29
|
-
'
|
|
30
|
-
|
|
39
|
+
{ tokens: ['api', 'endpoint', 'server', 'backend', 'database'], agent: 'backend-dev' },
|
|
40
|
+
{ tokens: ['ui', 'frontend', 'component', 'react', 'css', 'style'], agent: 'frontend-dev' },
|
|
41
|
+
// 'cd' / 'ci' are kept but require word boundaries via \b — they will not
|
|
42
|
+
// match inside "decision" or "specific". 'cd' as a literal command in a
|
|
43
|
+
// task description ("set up cd pipeline") still matches.
|
|
44
|
+
{ tokens: ['deploy', 'docker', 'ci', 'cd', 'ci/cd', 'pipeline', 'infrastructure', 'devops'], agent: 'devops' },
|
|
45
|
+
];
|
|
46
|
+
|
|
47
|
+
function escapeRegex(s) {
|
|
48
|
+
return s.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// Build an anchored alternation regex from a token list.
|
|
52
|
+
// - multi-word phrases (containing whitespace or '/') match literally
|
|
53
|
+
// - single tokens are wrapped with \b boundaries so 'cd' won't match "decide"
|
|
54
|
+
function buildPattern(tokens) {
|
|
55
|
+
const alternatives = tokens.map((tok) => {
|
|
56
|
+
const escaped = escapeRegex(tok.toLowerCase());
|
|
57
|
+
if (/\s|\//.test(tok)) {
|
|
58
|
+
// Phrase: whitespace/'/' on each side acts as a natural boundary
|
|
59
|
+
return escaped;
|
|
60
|
+
}
|
|
61
|
+
return `\\b${escaped}\\b`;
|
|
62
|
+
});
|
|
63
|
+
return new RegExp(`(?:${alternatives.join('|')})`, 'i');
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const COMPILED_PATTERNS = TASK_PATTERNS.map((entry) => ({
|
|
67
|
+
agent: entry.agent,
|
|
68
|
+
tokens: entry.tokens,
|
|
69
|
+
regex: buildPattern(entry.tokens),
|
|
70
|
+
}));
|
|
31
71
|
|
|
32
72
|
function routeTask(task) {
|
|
33
|
-
const taskLower = task.toLowerCase();
|
|
73
|
+
const taskLower = String(task ?? '').toLowerCase();
|
|
34
74
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
const regex = new RegExp(pattern, 'i');
|
|
38
|
-
if (regex.test(taskLower)) {
|
|
75
|
+
for (const entry of COMPILED_PATTERNS) {
|
|
76
|
+
if (entry.regex.test(taskLower)) {
|
|
39
77
|
return {
|
|
40
|
-
agent,
|
|
41
|
-
|
|
42
|
-
|
|
78
|
+
agent: entry.agent,
|
|
79
|
+
// Heuristic prior, not a learned probability — see file header.
|
|
80
|
+
confidence: 0.6,
|
|
81
|
+
reason: `Matched keyword(s) from: ${entry.tokens.join('|')}`,
|
|
43
82
|
};
|
|
44
83
|
}
|
|
45
84
|
}
|
|
46
85
|
|
|
47
|
-
// Default to coder for unknown tasks
|
|
48
86
|
return {
|
|
49
87
|
agent: 'coder',
|
|
50
|
-
confidence: 0.
|
|
51
|
-
reason: 'Default routing - no specific
|
|
88
|
+
confidence: 0.3,
|
|
89
|
+
reason: 'Default routing - no specific keyword matched',
|
|
52
90
|
};
|
|
53
91
|
}
|
|
54
92
|
|
|
55
93
|
// CLI
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
if (task) {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
} else {
|
|
62
|
-
|
|
63
|
-
|
|
94
|
+
if (require.main === module) {
|
|
95
|
+
const task = process.argv.slice(2).join(' ');
|
|
96
|
+
if (task) {
|
|
97
|
+
const result = routeTask(task);
|
|
98
|
+
console.log(JSON.stringify(result, null, 2));
|
|
99
|
+
} else {
|
|
100
|
+
console.log('Usage: router.js <task description>');
|
|
101
|
+
console.log('\nAvailable agents:', Object.keys(AGENT_CAPABILITIES).join(', '));
|
|
102
|
+
}
|
|
64
103
|
}
|
|
65
104
|
|
|
66
|
-
module.exports = { routeTask, AGENT_CAPABILITIES, TASK_PATTERNS };
|
|
105
|
+
module.exports = { routeTask, AGENT_CAPABILITIES, TASK_PATTERNS, buildPattern };
|
package/bin/cli.js
CHANGED
|
@@ -9,32 +9,85 @@
|
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
import { randomUUID } from 'crypto';
|
|
12
|
+
import { readFileSync } from 'fs';
|
|
13
|
+
import { fileURLToPath } from 'url';
|
|
14
|
+
import { dirname, join } from 'path';
|
|
12
15
|
|
|
13
|
-
//
|
|
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.
|
|
16
|
+
// #2253 / #2256: Console filter installed BEFORE any other import. Two jobs:
|
|
19
17
|
//
|
|
20
|
-
//
|
|
21
|
-
//
|
|
22
|
-
//
|
|
23
|
-
//
|
|
24
|
-
//
|
|
18
|
+
// 1. Suppress the cosmetic "[AgentDB Patch] Controller index not found"
|
|
19
|
+
// warning from agentic-flow (it expects agentdb v1.x but we use v3).
|
|
20
|
+
// Tight match — must include BOTH the prefix AND the specific text;
|
|
21
|
+
// other [AgentDB Patch] messages flow through. Audit log
|
|
22
|
+
// audit_1776483149979 flagged a broader filter as too aggressive.
|
|
23
|
+
//
|
|
24
|
+
// 2. Redirect noisy stdout writes from upstream embedder libraries
|
|
25
|
+
// (ruvector ONNX loader, ruvector-onnx-embeddings-wasm parallel
|
|
26
|
+
// embedder) to stderr. Those libraries use console.log for progress
|
|
27
|
+
// messages — "Loading model:", " Downloading: …", "🚀 Initializing N
|
|
28
|
+
// workers" — which corrupts MCP JSON-RPC stdio (#2253) and is noise
|
|
29
|
+
// on stdout. stderr is the right channel for progress to a TTY user,
|
|
30
|
+
// and the MCP stdio framer reads stdout only.
|
|
31
|
+
//
|
|
32
|
+
// This MUST be installed before `import('../dist/src/index.js')` so the
|
|
33
|
+
// patch is in place before agentic-flow / ruvector load transitively.
|
|
25
34
|
const _origWarn = console.warn;
|
|
26
35
|
const _origLog = console.log;
|
|
36
|
+
const _origError = console.error;
|
|
27
37
|
const _isCosmeticAgentdbPatchNoise = (msg) =>
|
|
28
38
|
msg.includes('[AgentDB Patch]') && msg.includes('Controller index not found');
|
|
39
|
+
const _STDERR_REDIRECT_PREFIXES = [
|
|
40
|
+
'Loading model: ',
|
|
41
|
+
' Downloading: ',
|
|
42
|
+
' Cache hit: ',
|
|
43
|
+
' Disk cache hit: ',
|
|
44
|
+
'Model cache cleared',
|
|
45
|
+
'🚀 Initializing ',
|
|
46
|
+
'✅ ',
|
|
47
|
+
];
|
|
48
|
+
const _shouldRedirectToStderr = (msg) => {
|
|
49
|
+
for (const prefix of _STDERR_REDIRECT_PREFIXES) {
|
|
50
|
+
if (msg.startsWith(prefix)) return true;
|
|
51
|
+
}
|
|
52
|
+
return false;
|
|
53
|
+
};
|
|
29
54
|
console.warn = (...args) => {
|
|
30
55
|
if (_isCosmeticAgentdbPatchNoise(String(args[0] ?? ''))) return;
|
|
31
56
|
_origWarn.apply(console, args);
|
|
32
57
|
};
|
|
33
58
|
console.log = (...args) => {
|
|
34
|
-
|
|
59
|
+
const head = String(args[0] ?? '');
|
|
60
|
+
if (_isCosmeticAgentdbPatchNoise(head)) return;
|
|
61
|
+
if (_shouldRedirectToStderr(head)) {
|
|
62
|
+
_origError.apply(console, args);
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
35
65
|
_origLog.apply(console, args);
|
|
36
66
|
};
|
|
37
67
|
|
|
68
|
+
// #2256 fast path: --version / -V / --help / -h must NOT trigger heavy
|
|
69
|
+
// imports (agentic-flow, ruvector ONNX, etc.) — those eagerly download a
|
|
70
|
+
// 23 MB ONNX model on cold cache, blocking 60+ s and causing SIGTERM
|
|
71
|
+
// under common timeout windows (npx default, MCP stdio 30 s). Resolve
|
|
72
|
+
// version directly from package.json and exit before any heavy import.
|
|
73
|
+
{
|
|
74
|
+
const _argv = process.argv.slice(2);
|
|
75
|
+
if (_argv.length === 1 && (_argv[0] === '--version' || _argv[0] === '-V')) {
|
|
76
|
+
try {
|
|
77
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
78
|
+
const pkg = JSON.parse(readFileSync(join(__dirname, '..', 'package.json'), 'utf-8'));
|
|
79
|
+
process.stdout.write(`ruflo v${pkg.version || '0.0.0'}\n`);
|
|
80
|
+
} catch {
|
|
81
|
+
process.stdout.write('ruflo v0.0.0\n');
|
|
82
|
+
}
|
|
83
|
+
process.exit(0);
|
|
84
|
+
}
|
|
85
|
+
// --help / -h with no other args also stays lightweight — fall through
|
|
86
|
+
// to the existing fast help path inside index.ts; we don't short-circuit
|
|
87
|
+
// here because some users pass `<command> --help` which needs lazy command
|
|
88
|
+
// loading. The version short-circuit is the only one safe to inline.
|
|
89
|
+
}
|
|
90
|
+
|
|
38
91
|
// Check if we should run in MCP server mode
|
|
39
92
|
// Conditions:
|
|
40
93
|
// 1. stdin is being piped AND no CLI arguments provided (auto-detect)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers-generator.d.ts","sourceRoot":"","sources":["../../../src/init/helpers-generator.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAQ9C,eAAO,MAAM,kBAAkB,yEAC+B,CAAC;AAE/D;;GAEG;AACH,wBAAgB,qBAAqB,IAAI,MAAM,CA4B9C;AAED;;GAEG;AACH,wBAAgB,sBAAsB,IAAI,MAAM,CAkB/C;AAED;;GAEG;AACH,wBAAgB,sBAAsB,IAAI,MAAM,CAiI/C;AAED;;GAEG;AACH,wBAAgB,mBAAmB,IAAI,MAAM,
|
|
1
|
+
{"version":3,"file":"helpers-generator.d.ts","sourceRoot":"","sources":["../../../src/init/helpers-generator.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAQ9C,eAAO,MAAM,kBAAkB,yEAC+B,CAAC;AAE/D;;GAEG;AACH,wBAAgB,qBAAqB,IAAI,MAAM,CA4B9C;AAED;;GAEG;AACH,wBAAgB,sBAAsB,IAAI,MAAM,CAkB/C;AAED;;GAEG;AACH,wBAAgB,sBAAsB,IAAI,MAAM,CAiI/C;AAED;;GAEG;AACH,wBAAgB,mBAAmB,IAAI,MAAM,CA2F5C;AAED;;GAEG;AACH,wBAAgB,oBAAoB,IAAI,MAAM,CAqF7C;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,IAAI,MAAM,CAwO5C;AAED;;;;GAIG;AACH,wBAAgB,wBAAwB,IAAI,MAAM,CAmNjD;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,IAAI,MAAM,CA+G/C;AAED;;GAEG;AACH,wBAAgB,4BAA4B,IAAI,MAAM,CAqGrD;AAED;;GAEG;AACH,wBAAgB,2BAA2B,IAAI,MAAM,CAOpD;AAED;;GAEG;AACH,wBAAgB,mCAAmC,IAAI,MAAM,CAoH5D;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,WAAW,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAgC5E;AAED;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,IAAI,MAAM,CA6D7C"}
|
|
@@ -203,7 +203,16 @@ export function generateAgentRouter() {
|
|
|
203
203
|
return `#!/usr/bin/env node
|
|
204
204
|
/**
|
|
205
205
|
* Ruflo Agent Router
|
|
206
|
-
*
|
|
206
|
+
*
|
|
207
|
+
* Static keyword router that suggests an agent for a task description.
|
|
208
|
+
* NOTE: This is *not* a learned model. It is a heuristic table; "confidence"
|
|
209
|
+
* is reported as a heuristic prior, not a calibrated probability.
|
|
210
|
+
*
|
|
211
|
+
* #2257 fix: patterns are now word-boundary-anchored so short tokens like
|
|
212
|
+
* \`cd\`, \`ci\`, \`ui\`, \`add\`, \`structure\` no longer match inside unrelated
|
|
213
|
+
* words (\`decision\`, \`infrastructure\`, \`address\`, \`addendum\`). Default
|
|
214
|
+
* matched-confidence dropped from 0.8 to 0.6, and fall-through from 0.5 to
|
|
215
|
+
* 0.3, to reflect that this is a static heuristic, not a learned classifier.
|
|
207
216
|
*/
|
|
208
217
|
|
|
209
218
|
const AGENT_CAPABILITIES = {
|
|
@@ -217,40 +226,54 @@ const AGENT_CAPABILITIES = {
|
|
|
217
226
|
devops: ['ci-cd', 'docker', 'deployment', 'infrastructure'],
|
|
218
227
|
};
|
|
219
228
|
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
'
|
|
225
|
-
'
|
|
226
|
-
'
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
'api
|
|
230
|
-
'ui
|
|
231
|
-
'deploy
|
|
232
|
-
|
|
229
|
+
// Each entry has a token list. Single tokens get \\b…\\b boundaries so 'cd'
|
|
230
|
+
// won't match inside 'decide'. Phrases (whitespace or '/') match literally —
|
|
231
|
+
// the whitespace acts as a natural boundary.
|
|
232
|
+
const TASK_PATTERNS = [
|
|
233
|
+
{ tokens: ['implement', 'create', 'build', 'add', 'write code', 'refactor', 'debug'], agent: 'coder' },
|
|
234
|
+
{ tokens: ['test', 'tests', 'spec', 'coverage', 'unit test', 'integration test'], agent: 'tester' },
|
|
235
|
+
{ tokens: ['review', 'audit', 'check', 'validate', 'security'], agent: 'reviewer' },
|
|
236
|
+
{ tokens: ['research', 'find', 'search', 'documentation', 'explore'], agent: 'researcher' },
|
|
237
|
+
{ tokens: ['design', 'architect', 'architecture', 'structure', 'plan'], agent: 'architect' },
|
|
238
|
+
{ tokens: ['api', 'endpoint', 'server', 'backend', 'database'], agent: 'backend-dev' },
|
|
239
|
+
{ tokens: ['ui', 'frontend', 'component', 'react', 'css', 'style'], agent: 'frontend-dev' },
|
|
240
|
+
{ tokens: ['deploy', 'docker', 'ci', 'cd', 'ci/cd', 'pipeline', 'infrastructure', 'devops'], agent: 'devops' },
|
|
241
|
+
];
|
|
242
|
+
|
|
243
|
+
function escapeRegex(s) {
|
|
244
|
+
return s.replace(/[.*+?^\${}()|[\\]\\\\]/g, '\\\\$&');
|
|
245
|
+
}
|
|
233
246
|
|
|
234
|
-
function
|
|
235
|
-
const
|
|
247
|
+
function buildPattern(tokens) {
|
|
248
|
+
const alternatives = tokens.map((tok) => {
|
|
249
|
+
const escaped = escapeRegex(tok.toLowerCase());
|
|
250
|
+
if (/\\s|\\//.test(tok)) return escaped;
|
|
251
|
+
return \`\\\\b\${escaped}\\\\b\`;
|
|
252
|
+
});
|
|
253
|
+
return new RegExp(\`(?:\${alternatives.join('|')})\`, 'i');
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
const COMPILED_PATTERNS = TASK_PATTERNS.map((entry) => ({
|
|
257
|
+
agent: entry.agent,
|
|
258
|
+
tokens: entry.tokens,
|
|
259
|
+
regex: buildPattern(entry.tokens),
|
|
260
|
+
}));
|
|
236
261
|
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
if (regex.test(taskLower)) {
|
|
262
|
+
function routeTask(task) {
|
|
263
|
+
const taskLower = String(task == null ? '' : task).toLowerCase();
|
|
264
|
+
for (const entry of COMPILED_PATTERNS) {
|
|
265
|
+
if (entry.regex.test(taskLower)) {
|
|
241
266
|
return {
|
|
242
|
-
agent,
|
|
243
|
-
confidence: 0.
|
|
244
|
-
reason: \`Matched
|
|
267
|
+
agent: entry.agent,
|
|
268
|
+
confidence: 0.6,
|
|
269
|
+
reason: \`Matched keyword(s) from: \${entry.tokens.join('|')}\`,
|
|
245
270
|
};
|
|
246
271
|
}
|
|
247
272
|
}
|
|
248
|
-
|
|
249
|
-
// Default to coder for unknown tasks
|
|
250
273
|
return {
|
|
251
274
|
agent: 'coder',
|
|
252
|
-
confidence: 0.
|
|
253
|
-
reason: 'Default routing - no specific
|
|
275
|
+
confidence: 0.3,
|
|
276
|
+
reason: 'Default routing - no specific keyword matched',
|
|
254
277
|
};
|
|
255
278
|
}
|
|
256
279
|
|
|
@@ -265,7 +288,7 @@ if (task) {
|
|
|
265
288
|
console.log('\\nAvailable agents:', Object.keys(AGENT_CAPABILITIES).join(', '));
|
|
266
289
|
}
|
|
267
290
|
|
|
268
|
-
module.exports = { routeTask, AGENT_CAPABILITIES, TASK_PATTERNS };
|
|
291
|
+
module.exports = { routeTask, AGENT_CAPABILITIES, TASK_PATTERNS, buildPattern };
|
|
269
292
|
`;
|
|
270
293
|
}
|
|
271
294
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers-generator.js","sourceRoot":"","sources":["../../../src/init/helpers-generator.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,wBAAwB,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AAE7F,2DAA2D;AAC3D,qEAAqE;AACrE,wEAAwE;AACxE,wEAAwE;AACxE,gEAAgE;AAChE,MAAM,CAAC,MAAM,kBAAkB,GAC7B,4DAA4D,CAAC;AAE/D;;GAEG;AACH,MAAM,UAAU,qBAAqB;IACnC,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;CA0BR,CAAC;AACF,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,sBAAsB;IACpC,OAAO;;;;;;;;;;;;;;;;CAgBR,CAAC;AACF,CAAC;AAED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AC,WAAW,CAAC,GAAG,mBAAmB,EAAE,CAAC;QAC7C,OAAO,CAAC,WAAW,CAAC,GAAG,oBAAoB,EAAE,CAAC;QAE9C,2BAA2B;QAC3B,OAAO,CAAC,oBAAoB,CAAC,GAAG,4BAA4B,EAAE,CAAC;QAC/D,OAAO,CAAC,oBAAoB,CAAC,GAAG,2BAA2B,EAAE,CAAC;QAE9D,wEAAwE;QACxE,wEAAwE;QACxE,8EAA8E;QAC9E,yEAAyE;QACzE,IAAI,OAAO,CAAC,WAAW,KAAK,IAAI,EAAE,CAAC;YACjC,OAAO,CAAC,aAAa,CAAC,GAAG,kBAAkB,GAAG,IAAI,CAAC;QACrD,CAAC;IACH,CAAC;IAED,IAAI,OAAO,CAAC,UAAU,CAAC,UAAU,EAAE,CAAC;QAClC,OAAO,CAAC,gBAAgB,CAAC,GAAG,wBAAwB,CAAC,OAAO,CAAC,CAAC,CAAE,mCAAmC;QACnG,OAAO,CAAC,oBAAoB,CAAC,GAAG,sBAAsB,CAAC,OAAO,CAAC,CAAC;IAClE,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,oBAAoB;IAClC,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2DR,CAAC;AACF,CAAC"}
|
|
@@ -1,22 +1,33 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Console filter
|
|
3
|
-
* warning emitted by agentic-flow's runtime patch (it expects agentdb v1.x
|
|
4
|
-
* layout but we use v3). This file MUST be imported as the first side-effect
|
|
5
|
-
* import in any entry point so the patch is in place before agentic-flow
|
|
6
|
-
* (and anything that transitively imports it) loads.
|
|
2
|
+
* Console filter installed at the top of every entry point. Two jobs:
|
|
7
3
|
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
4
|
+
* 1. Suppress the cosmetic "[AgentDB Patch] Controller index not found"
|
|
5
|
+
* warning emitted by agentic-flow's runtime patch (it expects agentdb
|
|
6
|
+
* v1.x layout but we use v3). Tight match: requires BOTH the prefix
|
|
7
|
+
* AND the specific message. Other [AgentDB Patch] messages flow through.
|
|
8
|
+
* Audit log audit_1776483149979 flagged the previous broad filter as
|
|
9
|
+
* too aggressive — this one is tight enough to be safe.
|
|
13
10
|
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
11
|
+
* 2. (#2253, #2256) Redirect noisy stdout writes from upstream embedder
|
|
12
|
+
* libraries (ruvector ONNX loader, ruvector-onnx-embeddings-wasm
|
|
13
|
+
* parallel embedder) to stderr. The libraries use `console.log` for
|
|
14
|
+
* progress messages like "Loading model:" and " Downloading: ...",
|
|
15
|
+
* which corrupts MCP JSON-RPC stdio (#2253) and is generally noise on
|
|
16
|
+
* stdout. We never want these on stdout — stderr is the right channel
|
|
17
|
+
* for progress to a TTY user, and the MCP stdio framer reads stdout
|
|
18
|
+
* only, so this keeps the protocol clean without dropping useful
|
|
19
|
+
* diagnostics.
|
|
20
|
+
*
|
|
21
|
+
* This file MUST be imported as the first side-effect import in any entry
|
|
22
|
+
* point so the patch is in place before agentic-flow / ruvector (and
|
|
23
|
+
* anything that transitively imports them) loads. ES module imports are
|
|
24
|
+
* evaluated before the file's own top-level code, so putting this in
|
|
25
|
+
* src/index.ts directly would race with transitive eager imports.
|
|
18
26
|
*/
|
|
19
27
|
declare const isCosmeticAgentdbPatchNoise: (msg: unknown) => boolean;
|
|
28
|
+
declare const STDERR_REDIRECT_PREFIXES: string[];
|
|
29
|
+
declare const shouldRedirectToStderr: (msg: unknown) => boolean;
|
|
20
30
|
declare const origWarn: (message?: any, ...optionalParams: any[]) => void;
|
|
21
31
|
declare const origLog: (message?: any, ...optionalParams: any[]) => void;
|
|
32
|
+
declare const origError: (message?: any, ...optionalParams: any[]) => void;
|
|
22
33
|
//# sourceMappingURL=log-filters.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"log-filters.d.ts","sourceRoot":"","sources":["../../src/log-filters.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"log-filters.d.ts","sourceRoot":"","sources":["../../src/log-filters.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,QAAA,MAAM,2BAA2B,GAAI,KAAK,OAAO,KAAG,OAGnD,CAAC;AAMF,QAAA,MAAM,wBAAwB,UAQ7B,CAAC;AAEF,QAAA,MAAM,sBAAsB,GAAI,KAAK,OAAO,KAAG,OAM9C,CAAC;AAEF,QAAA,MAAM,QAAQ,mDAA6B,CAAC;AAC5C,QAAA,MAAM,OAAO,mDAA4B,CAAC;AAC1C,QAAA,MAAM,SAAS,mDAA8B,CAAC"}
|
package/dist/src/log-filters.js
CHANGED
|
@@ -1,28 +1,58 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/**
|
|
3
|
-
* Console filter
|
|
4
|
-
* warning emitted by agentic-flow's runtime patch (it expects agentdb v1.x
|
|
5
|
-
* layout but we use v3). This file MUST be imported as the first side-effect
|
|
6
|
-
* import in any entry point so the patch is in place before agentic-flow
|
|
7
|
-
* (and anything that transitively imports it) loads.
|
|
3
|
+
* Console filter installed at the top of every entry point. Two jobs:
|
|
8
4
|
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
5
|
+
* 1. Suppress the cosmetic "[AgentDB Patch] Controller index not found"
|
|
6
|
+
* warning emitted by agentic-flow's runtime patch (it expects agentdb
|
|
7
|
+
* v1.x layout but we use v3). Tight match: requires BOTH the prefix
|
|
8
|
+
* AND the specific message. Other [AgentDB Patch] messages flow through.
|
|
9
|
+
* Audit log audit_1776483149979 flagged the previous broad filter as
|
|
10
|
+
* too aggressive — this one is tight enough to be safe.
|
|
14
11
|
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
12
|
+
* 2. (#2253, #2256) Redirect noisy stdout writes from upstream embedder
|
|
13
|
+
* libraries (ruvector ONNX loader, ruvector-onnx-embeddings-wasm
|
|
14
|
+
* parallel embedder) to stderr. The libraries use `console.log` for
|
|
15
|
+
* progress messages like "Loading model:" and " Downloading: ...",
|
|
16
|
+
* which corrupts MCP JSON-RPC stdio (#2253) and is generally noise on
|
|
17
|
+
* stdout. We never want these on stdout — stderr is the right channel
|
|
18
|
+
* for progress to a TTY user, and the MCP stdio framer reads stdout
|
|
19
|
+
* only, so this keeps the protocol clean without dropping useful
|
|
20
|
+
* diagnostics.
|
|
21
|
+
*
|
|
22
|
+
* This file MUST be imported as the first side-effect import in any entry
|
|
23
|
+
* point so the patch is in place before agentic-flow / ruvector (and
|
|
24
|
+
* anything that transitively imports them) loads. ES module imports are
|
|
25
|
+
* evaluated before the file's own top-level code, so putting this in
|
|
26
|
+
* src/index.ts directly would race with transitive eager imports.
|
|
19
27
|
*/
|
|
20
28
|
const isCosmeticAgentdbPatchNoise = (msg) => {
|
|
21
29
|
const s = String(msg ?? '');
|
|
22
30
|
return s.includes('[AgentDB Patch]') && s.includes('Controller index not found');
|
|
23
31
|
};
|
|
32
|
+
// #2253 / #2256: prefixes from third-party embedder libs that come out on
|
|
33
|
+
// stdout via console.log and corrupt MCP JSON-RPC. We redirect to stderr.
|
|
34
|
+
// Match is anchored to known prefixes only — anything else (e.g. legitimate
|
|
35
|
+
// user-facing CLI output) is unaffected.
|
|
36
|
+
const STDERR_REDIRECT_PREFIXES = [
|
|
37
|
+
'Loading model: ', // ruvector + ruvector-onnx-embeddings-wasm loader.js
|
|
38
|
+
' Downloading: ', // ruvector + ruvector-onnx-embeddings-wasm loader.js
|
|
39
|
+
' Cache hit: ', // ruvector + ruvector-onnx-embeddings-wasm loader.js
|
|
40
|
+
'Model cache cleared', // ruvector + ruvector-onnx-embeddings-wasm loader.js
|
|
41
|
+
'🚀 Initializing ', // ruvector-onnx-embeddings-wasm parallel-embedder.mjs
|
|
42
|
+
'✅ ', // ruvector-onnx-embeddings-wasm parallel-embedder.mjs (workers ready)
|
|
43
|
+
' Disk cache hit: ', // ruvector-onnx-embeddings-wasm parallel-embedder.mjs
|
|
44
|
+
];
|
|
45
|
+
const shouldRedirectToStderr = (msg) => {
|
|
46
|
+
const s = String(msg ?? '');
|
|
47
|
+
for (const prefix of STDERR_REDIRECT_PREFIXES) {
|
|
48
|
+
if (s.startsWith(prefix))
|
|
49
|
+
return true;
|
|
50
|
+
}
|
|
51
|
+
return false;
|
|
52
|
+
};
|
|
24
53
|
const origWarn = console.warn.bind(console);
|
|
25
54
|
const origLog = console.log.bind(console);
|
|
55
|
+
const origError = console.error.bind(console);
|
|
26
56
|
console.warn = (...args) => {
|
|
27
57
|
if (isCosmeticAgentdbPatchNoise(args[0]))
|
|
28
58
|
return;
|
|
@@ -31,6 +61,10 @@ console.warn = (...args) => {
|
|
|
31
61
|
console.log = (...args) => {
|
|
32
62
|
if (isCosmeticAgentdbPatchNoise(args[0]))
|
|
33
63
|
return;
|
|
64
|
+
if (shouldRedirectToStderr(args[0])) {
|
|
65
|
+
origError(...args);
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
34
68
|
origLog(...args);
|
|
35
69
|
};
|
|
36
70
|
//# sourceMappingURL=log-filters.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"log-filters.js","sourceRoot":"","sources":["../../src/log-filters.ts"],"names":[],"mappings":";AAAA
|
|
1
|
+
{"version":3,"file":"log-filters.js","sourceRoot":"","sources":["../../src/log-filters.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,MAAM,2BAA2B,GAAG,CAAC,GAAY,EAAW,EAAE;IAC5D,MAAM,CAAC,GAAG,MAAM,CAAC,GAAG,IAAI,EAAE,CAAC,CAAC;IAC5B,OAAO,CAAC,CAAC,QAAQ,CAAC,iBAAiB,CAAC,IAAI,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