feat(cli): add agent_message type for precise --final output filtering

Introduce dedicated agent_message IR type to distinguish final AI responses
from generic stdout. This enables --final flag to show only agent messages,
filtering out all intermediate content (JSONL events, reasoning, tool calls).

Changes:
- Add agent_message type to CliOutputUnitType
- Update JsonLinesParser to map final responses from all tools (codex,
  gemini, claude, opencode) to agent_message type
- Add final_output field to database schema with migration
- Update getCachedOutput and getConversation to return finalOutput
- Prefer finalOutput in outputAction for --final flag

Fixes issue where --final showed raw JSONL instead of filtered content.
This commit is contained in:
catlog22
2026-01-18 19:49:33 +08:00
parent 40b003be68
commit 16c96229f9
5 changed files with 69 additions and 25 deletions

View File

@@ -85,6 +85,7 @@ export interface ExecutionRecord {
truncated: boolean;
};
parsedOutput?: string; // Extracted clean text from structured output units
finalOutput?: string; // Agent message only (for --final flag)
}
interface HistoryIndex {
@@ -109,6 +110,7 @@ export interface ExecutionOutput {
stdout: string;
stderr: string;
parsedOutput?: string; // Extracted text from stream JSON response
finalOutput?: string; // Agent message only (for --final flag)
}
/**