claude-flow 3.5.6 → 3.5.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.
|
@@ -38,14 +38,23 @@ const intelligence = safeRequire(path.join(helpersDir, 'intelligence.cjs'));
|
|
|
38
38
|
const [,, command, ...args] = process.argv;
|
|
39
39
|
|
|
40
40
|
// Read stdin — Claude Code sends hook data as JSON via stdin
|
|
41
|
+
// Uses a timeout to prevent hanging when stdin is in an ambiguous state
|
|
42
|
+
// (not TTY, not a proper pipe) which happens with Claude Code hook invocations.
|
|
41
43
|
async function readStdin() {
|
|
42
44
|
if (process.stdin.isTTY) return '';
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
45
|
+
return new Promise((resolve) => {
|
|
46
|
+
let data = '';
|
|
47
|
+
const timer = setTimeout(() => {
|
|
48
|
+
process.stdin.removeAllListeners();
|
|
49
|
+
process.stdin.pause();
|
|
50
|
+
resolve(data);
|
|
51
|
+
}, 500);
|
|
52
|
+
process.stdin.setEncoding('utf8');
|
|
53
|
+
process.stdin.on('data', (chunk) => { data += chunk; });
|
|
54
|
+
process.stdin.on('end', () => { clearTimeout(timer); resolve(data); });
|
|
55
|
+
process.stdin.on('error', () => { clearTimeout(timer); resolve(data); });
|
|
56
|
+
process.stdin.resume();
|
|
57
|
+
});
|
|
49
58
|
}
|
|
50
59
|
|
|
51
60
|
async function main() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "claude-flow",
|
|
3
|
-
"version": "3.5.
|
|
3
|
+
"version": "3.5.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",
|
|
@@ -397,7 +397,35 @@ export function generateHookHandler() {
|
|
|
397
397
|
"const intelligence = safeRequire(path.join(helpersDir, 'intelligence.cjs'));",
|
|
398
398
|
'',
|
|
399
399
|
'const [,, command, ...args] = process.argv;',
|
|
400
|
-
|
|
400
|
+
'',
|
|
401
|
+
'// Read stdin with timeout — Claude Code sends hook data as JSON via stdin.',
|
|
402
|
+
'// Timeout prevents hanging when stdin is in an ambiguous state (not TTY, not pipe).',
|
|
403
|
+
'async function readStdin() {',
|
|
404
|
+
' if (process.stdin.isTTY) return "";',
|
|
405
|
+
' return new Promise((resolve) => {',
|
|
406
|
+
' let data = "";',
|
|
407
|
+
' const timer = setTimeout(() => {',
|
|
408
|
+
' process.stdin.removeAllListeners();',
|
|
409
|
+
' process.stdin.pause();',
|
|
410
|
+
' resolve(data);',
|
|
411
|
+
' }, 500);',
|
|
412
|
+
' process.stdin.setEncoding("utf8");',
|
|
413
|
+
' process.stdin.on("data", (chunk) => { data += chunk; });',
|
|
414
|
+
' process.stdin.on("end", () => { clearTimeout(timer); resolve(data); });',
|
|
415
|
+
' process.stdin.on("error", () => { clearTimeout(timer); resolve(data); });',
|
|
416
|
+
' process.stdin.resume();',
|
|
417
|
+
' });',
|
|
418
|
+
'}',
|
|
419
|
+
'',
|
|
420
|
+
'async function main() {',
|
|
421
|
+
' let stdinData = "";',
|
|
422
|
+
' try { stdinData = await readStdin(); } catch (e) { /* ignore */ }',
|
|
423
|
+
' let hookInput = {};',
|
|
424
|
+
' if (stdinData.trim()) {',
|
|
425
|
+
' try { hookInput = JSON.parse(stdinData); } catch (e) { /* ignore */ }',
|
|
426
|
+
' }',
|
|
427
|
+
' // Prefer stdin fields, then env, then argv',
|
|
428
|
+
" var prompt = hookInput.prompt || hookInput.command || hookInput.toolInput || process.env.PROMPT || process.env.TOOL_INPUT_command || args.join(' ') || '';",
|
|
401
429
|
'',
|
|
402
430
|
'const handlers = {',
|
|
403
431
|
" 'route': () => {",
|
|
@@ -550,6 +578,9 @@ export function generateHookHandler() {
|
|
|
550
578
|
'} else {',
|
|
551
579
|
" console.log('Usage: hook-handler.cjs <route|pre-bash|post-edit|session-restore|session-end|pre-task|post-task|compact-manual|compact-auto|status|stats>');",
|
|
552
580
|
'}',
|
|
581
|
+
'} // end main',
|
|
582
|
+
'',
|
|
583
|
+
'main().catch(() => {});',
|
|
553
584
|
];
|
|
554
585
|
return lines.join('\n') + '\n';
|
|
555
586
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@claude-flow/cli",
|
|
3
|
-
"version": "3.5.
|
|
3
|
+
"version": "3.5.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",
|