@link-assistant/hive-mind 1.9.2 → 1.10.1
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/CHANGELOG.md +28 -0
- package/package.json +1 -1
- package/src/agent.lib.mjs +21 -1
- package/src/claude.lib.mjs +4 -1
- package/src/config.lib.mjs +20 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,33 @@
|
|
|
1
1
|
# @link-assistant/hive-mind
|
|
2
2
|
|
|
3
|
+
## 1.10.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 24e70f8: Fix agent --verbose output by properly handling stderr stream
|
|
8
|
+
- Agent CLI sends ALL output (including verbose logs and structured events) to stderr, not stdout
|
|
9
|
+
- Previous code only processed stdout with JSON parsing, treating stderr as plain error text
|
|
10
|
+
- Now stderr is processed the same way as stdout: NDJSON line-by-line parsing with JSON formatting
|
|
11
|
+
- Session IDs are now correctly extracted from stderr messages
|
|
12
|
+
- stderr output is now collected for error detection
|
|
13
|
+
|
|
14
|
+
Fixes #1151
|
|
15
|
+
|
|
16
|
+
## 1.10.0
|
|
17
|
+
|
|
18
|
+
### Minor Changes
|
|
19
|
+
|
|
20
|
+
- 9b56b26: feat(solve): configure MCP_TIMEOUT and MCP_TOOL_TIMEOUT for claude tool calls
|
|
21
|
+
|
|
22
|
+
Added MCP timeout configuration to prevent tool calls from hanging indefinitely:
|
|
23
|
+
- Added `mcpTimeout` config (default: 900000ms / 15 minutes) for MCP server startup
|
|
24
|
+
- Added `mcpToolTimeout` config (default: 900000ms / 15 minutes) for MCP tool execution
|
|
25
|
+
- Support for override via `MCP_TIMEOUT`/`HIVE_MIND_MCP_TIMEOUT` and `MCP_TOOL_TIMEOUT`/`HIVE_MIND_MCP_TOOL_TIMEOUT` environment variables
|
|
26
|
+
- Updated `getClaudeEnv()` to pass both timeout values to Claude CLI
|
|
27
|
+
- Added verbose logging for MCP timeout values
|
|
28
|
+
|
|
29
|
+
Fixes #1066
|
|
30
|
+
|
|
3
31
|
## 1.9.2
|
|
4
32
|
|
|
5
33
|
### Patch Changes
|
package/package.json
CHANGED
package/src/agent.lib.mjs
CHANGED
|
@@ -440,7 +440,27 @@ export const executeAgentCommand = async params => {
|
|
|
440
440
|
if (chunk.type === 'stderr') {
|
|
441
441
|
const errorOutput = chunk.data.toString();
|
|
442
442
|
if (errorOutput) {
|
|
443
|
-
|
|
443
|
+
// Agent sends all output (including verbose logs and structured events) to stderr
|
|
444
|
+
// Process each line as NDJSON, same as stdout handling
|
|
445
|
+
const stderrLines = errorOutput.split('\n');
|
|
446
|
+
for (const stderrLine of stderrLines) {
|
|
447
|
+
if (!stderrLine.trim()) continue;
|
|
448
|
+
try {
|
|
449
|
+
const stderrData = JSON.parse(stderrLine);
|
|
450
|
+
// Output formatted JSON (same formatting as stdout)
|
|
451
|
+
await log(JSON.stringify(stderrData, null, 2));
|
|
452
|
+
// Capture session ID from stderr too (agent sends it via stderr)
|
|
453
|
+
if (!sessionId && stderrData.sessionID) {
|
|
454
|
+
sessionId = stderrData.sessionID;
|
|
455
|
+
await log(`📌 Session ID: ${sessionId}`);
|
|
456
|
+
}
|
|
457
|
+
} catch {
|
|
458
|
+
// Not JSON - log as plain text
|
|
459
|
+
await log(stderrLine);
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
// Also collect stderr for error detection
|
|
463
|
+
fullOutput += errorOutput;
|
|
444
464
|
}
|
|
445
465
|
} else if (chunk.type === 'exit') {
|
|
446
466
|
exitCode = chunk.code;
|
package/src/claude.lib.mjs
CHANGED
|
@@ -881,9 +881,12 @@ export const executeClaudeCommand = async params => {
|
|
|
881
881
|
// See issue #1146 for details on thinking budget translation
|
|
882
882
|
const { thinkingBudget: resolvedThinkingBudget, thinkLevel, isNewVersion } = await resolveThinkingSettings(argv, log);
|
|
883
883
|
|
|
884
|
-
// Set CLAUDE_CODE_MAX_OUTPUT_TOKENS (see issue #1076)
|
|
884
|
+
// Set CLAUDE_CODE_MAX_OUTPUT_TOKENS (see issue #1076), MAX_THINKING_TOKENS (see issue #1146),
|
|
885
|
+
// and MCP timeout configurations (see issue #1066)
|
|
885
886
|
const claudeEnv = getClaudeEnv({ thinkingBudget: resolvedThinkingBudget });
|
|
886
887
|
if (argv.verbose) await log(`📊 CLAUDE_CODE_MAX_OUTPUT_TOKENS: ${claudeCode.maxOutputTokens}`, { verbose: true });
|
|
888
|
+
if (argv.verbose) await log(`📊 MCP_TIMEOUT: ${claudeCode.mcpTimeout}ms (server startup)`, { verbose: true });
|
|
889
|
+
if (argv.verbose) await log(`📊 MCP_TOOL_TIMEOUT: ${claudeCode.mcpToolTimeout}ms (tool execution)`, { verbose: true });
|
|
887
890
|
if (resolvedThinkingBudget !== undefined) {
|
|
888
891
|
await log(`📊 MAX_THINKING_TOKENS: ${resolvedThinkingBudget}`, { verbose: true });
|
|
889
892
|
}
|
package/src/config.lib.mjs
CHANGED
|
@@ -90,6 +90,15 @@ export const claudeCode = {
|
|
|
90
90
|
// Default: 64000 (matches Claude Sonnet/Opus/Haiku 4.5 model capabilities)
|
|
91
91
|
// Set via CLAUDE_CODE_MAX_OUTPUT_TOKENS or HIVE_MIND_CLAUDE_CODE_MAX_OUTPUT_TOKENS
|
|
92
92
|
maxOutputTokens: parseIntWithDefault('CLAUDE_CODE_MAX_OUTPUT_TOKENS', parseIntWithDefault('HIVE_MIND_CLAUDE_CODE_MAX_OUTPUT_TOKENS', 64000)),
|
|
93
|
+
// MCP (Model Context Protocol) timeout configurations
|
|
94
|
+
// See: https://github.com/link-assistant/hive-mind/issues/1066
|
|
95
|
+
// See: https://code.claude.com/docs/en/settings#environment-variables
|
|
96
|
+
// MCP_TIMEOUT: Timeout in milliseconds for MCP server startup
|
|
97
|
+
// MCP_TOOL_TIMEOUT: Timeout in milliseconds for MCP tool execution
|
|
98
|
+
// Default: 900000ms (15 minutes) to accommodate long-running Playwright operations
|
|
99
|
+
// Set via MCP_TIMEOUT/MCP_TOOL_TIMEOUT or HIVE_MIND_MCP_TIMEOUT/HIVE_MIND_MCP_TOOL_TIMEOUT
|
|
100
|
+
mcpTimeout: parseIntWithDefault('MCP_TIMEOUT', parseIntWithDefault('HIVE_MIND_MCP_TIMEOUT', 900000)),
|
|
101
|
+
mcpToolTimeout: parseIntWithDefault('MCP_TOOL_TIMEOUT', parseIntWithDefault('HIVE_MIND_MCP_TOOL_TIMEOUT', 900000)),
|
|
93
102
|
};
|
|
94
103
|
|
|
95
104
|
// Default max thinking budget for Claude Code (see issue #1146)
|
|
@@ -156,8 +165,18 @@ export const supportsThinkingBudget = (version, minVersion = '2.1.12') => {
|
|
|
156
165
|
|
|
157
166
|
// Helper function to get Claude CLI environment with CLAUDE_CODE_MAX_OUTPUT_TOKENS set
|
|
158
167
|
// Optionally sets MAX_THINKING_TOKENS when thinkingBudget is provided (see issue #1146)
|
|
168
|
+
// Also sets MCP_TIMEOUT and MCP_TOOL_TIMEOUT for MCP tool execution (see issue #1066)
|
|
159
169
|
export const getClaudeEnv = (options = {}) => {
|
|
160
|
-
const env = {
|
|
170
|
+
const env = {
|
|
171
|
+
...process.env,
|
|
172
|
+
CLAUDE_CODE_MAX_OUTPUT_TOKENS: String(claudeCode.maxOutputTokens),
|
|
173
|
+
// MCP timeout configurations to prevent tool calls from hanging indefinitely
|
|
174
|
+
// See: https://github.com/link-assistant/hive-mind/issues/1066
|
|
175
|
+
// MCP_TIMEOUT: Timeout for MCP server startup
|
|
176
|
+
// MCP_TOOL_TIMEOUT: Timeout for MCP tool execution (the one that prevents stuck tools)
|
|
177
|
+
MCP_TIMEOUT: String(claudeCode.mcpTimeout),
|
|
178
|
+
MCP_TOOL_TIMEOUT: String(claudeCode.mcpToolTimeout),
|
|
179
|
+
};
|
|
161
180
|
// Set MAX_THINKING_TOKENS if thinkingBudget is provided
|
|
162
181
|
// This controls Claude Code's extended thinking feature (Claude Code >= 2.1.12)
|
|
163
182
|
// Default is 31999, set to 0 to disable thinking, max is 63999 for 64K output models
|