Compare commits

...

3 Commits

5 changed files with 51 additions and 8 deletions
@@ -35,16 +35,17 @@ export const AnsiOutputText: React.FC<AnsiOutputProps> = ({
? Math.min(availableHeightLimit, maxLines)
: (availableHeightLimit ?? maxLines ?? DEFAULT_HEIGHT);
const MAXIMUM_ANSI_LINES_RENDERED = 1000;
const lastLines = Array.isArray(data)
? disableTruncation
? data
? data.slice(-MAXIMUM_ANSI_LINES_RENDERED)
: numLinesRetained === 0
? []
: data.slice(-numLinesRetained)
: [];
return (
<Box flexDirection="column" width={width} flexShrink={0} overflow="hidden">
{(lastLines as AnsiLine[]).map((line: AnsiLine, lineIndex: number) => (
{lastLines.map((line: AnsiLine, lineIndex: number) => (
<Box key={lineIndex} height={1} overflow="hidden">
<AnsiLineText line={line} />
</Box>
@@ -86,8 +86,9 @@ export const SubagentProgressDisplay: React.FC<
</Box>
)}
<Box flexDirection="column" marginLeft={0} gap={0}>
{(historyOverrides ?? progress.recentActivity).map(
(item: SubagentActivityItem) => {
{(historyOverrides ?? progress.recentActivity)
.slice(-100)
.map((item: SubagentActivityItem) => {
if (item.type === 'thought') {
const isCancellation = item.content === 'Request cancelled.';
const icon = isCancellation ? ' ' : '💭';
@@ -155,8 +156,7 @@ export const SubagentProgressDisplay: React.FC<
);
}
return null;
},
)}
})}
</Box>
{progress.result && (
@@ -2779,7 +2779,41 @@ export function textBufferReducer(
action: TextBufferAction,
options: TextBufferOptions = {},
): TextBufferState {
const newState = textBufferReducerLogic(state, action, options);
let newState = textBufferReducerLogic(state, action, options);
const MAX_TEXT_BUFFER_LINES = 10000;
if (newState.lines.length > MAX_TEXT_BUFFER_LINES) {
const excess = newState.lines.length - MAX_TEXT_BUFFER_LINES;
const newLines = newState.lines.slice(excess);
const newCursorRow = Math.max(0, newState.cursorRow - excess);
let newExpandedPaste = newState.expandedPaste;
if (newExpandedPaste) {
const newStartLine = newExpandedPaste.startLine - excess;
if (newStartLine < 0) {
newExpandedPaste = null;
} else {
newExpandedPaste = { ...newExpandedPaste, startLine: newStartLine };
}
}
let newSelectionAnchor = newState.selectionAnchor;
if (newSelectionAnchor) {
const newAnchorRow = newSelectionAnchor[0] - excess;
if (newAnchorRow < 0) {
newSelectionAnchor = null;
} else {
newSelectionAnchor = [newAnchorRow, newSelectionAnchor[1]];
}
}
newState = {
...newState,
lines: newLines,
cursorRow: newCursorRow,
expandedPaste: newExpandedPaste,
selectionAnchor: newSelectionAnchor,
undoStack: [],
redoStack: [],
};
}
const newTransformedLines =
newState.lines !== state.lines
@@ -262,6 +262,13 @@ export class LocalSubagentInvocation extends BaseToolInvocation<
}
if (updated) {
const MAX_RECENT_ACTIVITY = 100;
if (recentActivity.length > MAX_RECENT_ACTIVITY) {
recentActivity.splice(
0,
recentActivity.length - MAX_RECENT_ACTIVITY,
);
}
const progress: SubagentProgress = {
isSubagentProgress: true,
agentName: this.definition.name,
+2 -1
View File
@@ -7,7 +7,8 @@
"type": "module",
"scripts": {
"build": "node ../../scripts/build_package.js",
"typecheck": "tsc --noEmit"
"typecheck": "tsc --noEmit",
"test:ci": "echo 'no tests'"
},
"dependencies": {
"@google/gemini-cli-core": "file:../core",