feat: support structured tool results and preserve terminal state context

Establishes core data contracts and state management for enhanced tool outputs.
- Introduces GrepResult, ListDirectoryResult, and ReadManyFilesResult types.
- Updates tools to return structured data instead of flat strings.
- Preserves confirmation details and diff stats in terminal tool states.
- Ensures backward compatibility in standard CLI views via safe type guards.
This commit is contained in:
Jarrod Whelan
2026-02-10 20:23:18 -08:00
parent 204d62980f
commit 2db8fb20fa
11 changed files with 133 additions and 9 deletions
+8 -1
View File
@@ -286,7 +286,14 @@ class GrepToolInvocation extends BaseToolInvocation<
return {
llmContent: llmContent.trim(),
returnDisplay: `Found ${matchCount} ${matchTerm}${wasTruncated ? ' (limited)' : ''}`,
returnDisplay: {
summary: `Found ${matchCount} ${matchTerm}${wasTruncated ? ' (limited)' : ''}`,
matches: allMatches.map((m) => ({
filePath: m.filePath,
lineNumber: m.lineNumber,
line: m.line,
})),
},
};
} catch (error) {
debugLogger.warn(`Error during GrepLogic execution: ${error}`);