@link-assistant/hive-mind 2.0.14 → 2.0.15
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 +6 -0
- package/package.json +1 -1
- package/src/agent.lib.mjs +8 -0
- package/src/claude.lib.mjs +4 -4
- package/src/codex.lib.mjs +13 -0
- package/src/opencode.lib.mjs +5 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @link-assistant/hive-mind
|
|
2
2
|
|
|
3
|
+
## 2.0.15
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 0d2f2bb: Fix "Cannot read properties of null (reading 'type')" crash that aborted Codex (and other agent) runs when the tool echoed a stream line that parsed to a bare `null` or non-object JSON primitive. All NDJSON stream parsers (Codex, Claude, Agent, OpenCode) now ignore non-object lines instead of dereferencing them.
|
|
8
|
+
|
|
3
9
|
## 2.0.14
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
package/package.json
CHANGED
package/src/agent.lib.mjs
CHANGED
|
@@ -542,6 +542,9 @@ export const executeAgentCommand = async params => {
|
|
|
542
542
|
if (!line.trim()) continue;
|
|
543
543
|
try {
|
|
544
544
|
const data = sanitizeObjectStrings(JSON.parse(line));
|
|
545
|
+
// Issue #1968: a bare `null`/primitive NDJSON line must not abort
|
|
546
|
+
// event processing (any data.X access would throw on null).
|
|
547
|
+
if (data === null || typeof data !== 'object') continue;
|
|
545
548
|
// Output formatted JSON
|
|
546
549
|
await log(JSON.stringify(data, null, 2));
|
|
547
550
|
// Capture session ID from the first message
|
|
@@ -616,6 +619,8 @@ export const executeAgentCommand = async params => {
|
|
|
616
619
|
if (!stderrLine.trim()) continue;
|
|
617
620
|
try {
|
|
618
621
|
const stderrData = sanitizeObjectStrings(JSON.parse(stderrLine));
|
|
622
|
+
// Issue #1968: skip bare `null`/primitive lines (see stdout handler above).
|
|
623
|
+
if (stderrData === null || typeof stderrData !== 'object') continue;
|
|
619
624
|
// Output formatted JSON (same formatting as stdout)
|
|
620
625
|
await log(JSON.stringify(stderrData, null, 2));
|
|
621
626
|
// Capture session ID from stderr too (agent sends it via stderr)
|
|
@@ -695,6 +700,9 @@ export const executeAgentCommand = async params => {
|
|
|
695
700
|
try {
|
|
696
701
|
const msg = sanitizeObjectStrings(JSON.parse(line));
|
|
697
702
|
|
|
703
|
+
// Issue #1968: ignore bare `null`/primitive lines (msg.type would throw on null).
|
|
704
|
+
if (msg === null || typeof msg !== 'object') continue;
|
|
705
|
+
|
|
698
706
|
// Check for explicit error message types from agent
|
|
699
707
|
if (msg.type === 'error' || msg.type === 'step_error') {
|
|
700
708
|
return { detected: true, type: 'AgentError', match: msg.message || msg.error || line.substring(0, 100) };
|
package/src/claude.lib.mjs
CHANGED
|
@@ -872,6 +872,7 @@ export const executeClaudeCommand = async params => {
|
|
|
872
872
|
if (!line.trim()) continue;
|
|
873
873
|
try {
|
|
874
874
|
const data = sanitizeObjectStrings(JSON.parse(line));
|
|
875
|
+
if (data === null || typeof data !== 'object') continue; // Issue #1968: skip bare null/primitive NDJSON lines
|
|
875
876
|
// Issue #1510: Track last event time for all modes (not just interactive)
|
|
876
877
|
// so activity timeout can report accurate idle duration
|
|
877
878
|
lastEventTime = Date.now();
|
|
@@ -1110,11 +1111,10 @@ export const executeClaudeCommand = async params => {
|
|
|
1110
1111
|
try {
|
|
1111
1112
|
const data = sanitizeObjectStrings(JSON.parse(stdoutLineBuffer));
|
|
1112
1113
|
await log(JSON.stringify(data, null, 2));
|
|
1113
|
-
if (data
|
|
1114
|
+
if (data?.type === 'result' && data.subtype === 'success' && data.total_cost_usd != null) {
|
|
1114
1115
|
anthropicTotalCostUSD = data.total_cost_usd;
|
|
1115
|
-
} else if (data
|
|
1116
|
-
// Issue #1886: keep a non-success terminal result's cost as a fallback
|
|
1117
|
-
// for accumulation (see the streaming branch above).
|
|
1116
|
+
} else if (data?.type === 'result' && data.total_cost_usd != null) {
|
|
1117
|
+
// Issue #1886: keep a non-success terminal result's cost as a fallback (see streaming branch above).
|
|
1118
1118
|
anthropicCostFromAnyResult = data.total_cost_usd;
|
|
1119
1119
|
}
|
|
1120
1120
|
// Issue #1472: Forward remaining buffer event to interactive handler (was previously missed)
|
package/src/codex.lib.mjs
CHANGED
|
@@ -470,6 +470,16 @@ export const parseCodexExecJsonOutput = (output, state = {}, requestedModelId =
|
|
|
470
470
|
continue;
|
|
471
471
|
}
|
|
472
472
|
|
|
473
|
+
// Issue #1968: a stream line that parses to a bare `null` (or any non-object
|
|
474
|
+
// JSON primitive such as a number/string/boolean) must not crash the parser.
|
|
475
|
+
// Codex echoes the stdout of every command it runs back into its own NDJSON
|
|
476
|
+
// stream (see issue #1955), so a target repo that prints a standalone `null`
|
|
477
|
+
// line surfaces here as `JSON.parse('null') === null`. Accessing `data.type`
|
|
478
|
+
// on that null threw "Cannot read properties of null (reading 'type')" and
|
|
479
|
+
// aborted the entire solve. Real Codex events are always JSON objects, so any
|
|
480
|
+
// non-object line is safely ignored.
|
|
481
|
+
if (data === null || typeof data !== 'object') continue;
|
|
482
|
+
|
|
473
483
|
const eventType = typeof data.type === 'string' ? data.type : 'unknown';
|
|
474
484
|
nextState.eventCounts[eventType] = (nextState.eventCounts[eventType] || 0) + 1;
|
|
475
485
|
|
|
@@ -1044,6 +1054,9 @@ export const executeCodexCommand = async params => {
|
|
|
1044
1054
|
if (!line) continue;
|
|
1045
1055
|
try {
|
|
1046
1056
|
const data = sanitizeObjectStrings(JSON.parse(line));
|
|
1057
|
+
// Issue #1968: skip bare `null`/primitive lines so the handlers
|
|
1058
|
+
// below never receive a non-object event (see parseCodexExecJsonOutput).
|
|
1059
|
+
if (data === null || typeof data !== 'object') continue;
|
|
1047
1060
|
if (interactiveHandler) await interactiveHandler.processEvent(data);
|
|
1048
1061
|
if (progressMonitor) await progressMonitor.processStreamEvent(data);
|
|
1049
1062
|
} catch {
|
package/src/opencode.lib.mjs
CHANGED
|
@@ -342,6 +342,9 @@ export const executeOpenCodeCommand = async params => {
|
|
|
342
342
|
for (const line of lines) {
|
|
343
343
|
if (!line.trim()) continue;
|
|
344
344
|
const data = sanitizeObjectStrings(JSON.parse(line));
|
|
345
|
+
// Issue #1968: a bare `null`/primitive NDJSON line must not abort the
|
|
346
|
+
// rest of the chunk (data.type access would throw on null).
|
|
347
|
+
if (data === null || typeof data !== 'object') continue;
|
|
345
348
|
accumulateAgentStepFinishUsage(streamingTokenUsage, data);
|
|
346
349
|
// Track text content for result summary
|
|
347
350
|
// OpenCode outputs text via 'text', 'assistant', 'message', or 'result' type events
|
|
@@ -385,6 +388,8 @@ export const executeOpenCodeCommand = async params => {
|
|
|
385
388
|
for (const line of lines) {
|
|
386
389
|
if (!line.trim()) continue;
|
|
387
390
|
const data = sanitizeObjectStrings(JSON.parse(line));
|
|
391
|
+
// Issue #1968: skip bare `null`/primitive lines (see stdout handler above).
|
|
392
|
+
if (data === null || typeof data !== 'object') continue;
|
|
388
393
|
accumulateAgentStepFinishUsage(streamingTokenUsage, data);
|
|
389
394
|
if (data.type === 'text' && data.text) {
|
|
390
395
|
lastTextContent = data.text;
|