Context
StructuredOutputParser (packages/main/src/structuredOutputParser.ts) extends Node's EventEmitter and emits the reserved error event on JSON parse failures (line 44). Node's EventEmitter has special behavior: emit('error', ...) with zero listeners throws the error as an uncaught exception, crashing the process.
Current state
The sole consumer (cliAgentManager.ts:223-230) always attaches an error listener immediately after construction, before any data flows — so there is no crash risk today.
Recommended fix
Rename the error event to parseError (or add a default no-op listener in the constructor) to prevent future callers from accidentally crashing the main process by forgetting to attach a listener.
Files to update
packages/main/src/structuredOutputParser.ts — rename event in StructuredOutputParserEvents interface and emit() call
packages/main/src/cliAgentManager.ts — update parser.on('error', ...) to parser.on('parseError', ...)
Priority
Low — defensive hardening, not a current bug.
Context
StructuredOutputParser(packages/main/src/structuredOutputParser.ts) extends Node'sEventEmitterand emits the reservederrorevent on JSON parse failures (line 44). Node'sEventEmitterhas special behavior:emit('error', ...)with zero listeners throws the error as an uncaught exception, crashing the process.Current state
The sole consumer (
cliAgentManager.ts:223-230) always attaches anerrorlistener immediately after construction, before any data flows — so there is no crash risk today.Recommended fix
Rename the
errorevent toparseError(or add a default no-op listener in the constructor) to prevent future callers from accidentally crashing the main process by forgetting to attach a listener.Files to update
packages/main/src/structuredOutputParser.ts— rename event inStructuredOutputParserEventsinterface andemit()callpackages/main/src/cliAgentManager.ts— updateparser.on('error', ...)toparser.on('parseError', ...)Priority
Low — defensive hardening, not a current bug.