codeep 1.0.58 → 1.0.60
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.
|
@@ -2,7 +2,7 @@ import { jsxs as _jsxs, jsx as _jsx, Fragment as _Fragment } from "react/jsx-run
|
|
|
2
2
|
/**
|
|
3
3
|
* Agent progress display component
|
|
4
4
|
*/
|
|
5
|
-
import { useState, useEffect
|
|
5
|
+
import { useState, useEffect } from 'react';
|
|
6
6
|
import { Box, Text } from 'ink';
|
|
7
7
|
// Spinner frames for animation (no emojis)
|
|
8
8
|
const SPINNER_FRAMES = ['/', '-', '\\', '|'];
|
|
@@ -140,67 +140,8 @@ const isSectionBreak = (line, prevLine) => {
|
|
|
140
140
|
return false;
|
|
141
141
|
};
|
|
142
142
|
export const LiveCodeStream = ({ actions, isRunning }) => {
|
|
143
|
-
// Use ref for tracking to avoid re-render loops
|
|
144
|
-
const lastActionIdRef = useRef(null);
|
|
145
|
-
const timerRef = useRef(null);
|
|
146
|
-
const totalLinesRef = useRef(0);
|
|
147
|
-
// State for visible lines - only update when batch is ready
|
|
148
|
-
const [displayState, setDisplayState] = useState({
|
|
149
|
-
endLine: 0,
|
|
150
|
-
actionId: null,
|
|
151
|
-
});
|
|
152
143
|
// Find the current write/edit action with code content
|
|
153
144
|
const currentAction = actions.length > 0 ? actions[actions.length - 1] : null;
|
|
154
|
-
// Only show for write/edit actions
|
|
155
|
-
const isWriteOrEdit = currentAction && (currentAction.type === 'write' || currentAction.type === 'edit');
|
|
156
|
-
// Create a unique ID for the current action
|
|
157
|
-
const actionId = currentAction ? `${currentAction.target}-${currentAction.timestamp}` : null;
|
|
158
|
-
// Get total lines for current action and store in ref
|
|
159
|
-
const totalLines = currentAction?.details ? currentAction.details.split('\n').length : 0;
|
|
160
|
-
totalLinesRef.current = totalLines;
|
|
161
|
-
// Stream lines progressively using interval instead of recursive setTimeout
|
|
162
|
-
useEffect(() => {
|
|
163
|
-
// Clear any existing timer
|
|
164
|
-
if (timerRef.current) {
|
|
165
|
-
clearInterval(timerRef.current);
|
|
166
|
-
timerRef.current = null;
|
|
167
|
-
}
|
|
168
|
-
// Only stream for write/edit actions with content
|
|
169
|
-
if (!currentAction || !currentAction.details || !isRunning || !isWriteOrEdit) {
|
|
170
|
-
if (displayState.endLine !== 0 || displayState.actionId !== null) {
|
|
171
|
-
setDisplayState({ endLine: 0, actionId: null });
|
|
172
|
-
}
|
|
173
|
-
return;
|
|
174
|
-
}
|
|
175
|
-
// If this is a new action, reset and start streaming
|
|
176
|
-
if (actionId !== lastActionIdRef.current) {
|
|
177
|
-
lastActionIdRef.current = actionId;
|
|
178
|
-
const initialLines = Math.min(10, totalLinesRef.current);
|
|
179
|
-
setDisplayState({ endLine: initialLines, actionId });
|
|
180
|
-
// Only start interval if there are more lines to show
|
|
181
|
-
if (totalLinesRef.current > 10) {
|
|
182
|
-
timerRef.current = setInterval(() => {
|
|
183
|
-
setDisplayState(prev => {
|
|
184
|
-
// Use ref to get current totalLines value
|
|
185
|
-
const currentTotal = totalLinesRef.current;
|
|
186
|
-
const newEndLine = Math.min(prev.endLine + 10, currentTotal);
|
|
187
|
-
// Stop interval when we've shown all lines
|
|
188
|
-
if (newEndLine >= currentTotal && timerRef.current) {
|
|
189
|
-
clearInterval(timerRef.current);
|
|
190
|
-
timerRef.current = null;
|
|
191
|
-
}
|
|
192
|
-
return { ...prev, endLine: newEndLine };
|
|
193
|
-
});
|
|
194
|
-
}, 150);
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
return () => {
|
|
198
|
-
if (timerRef.current) {
|
|
199
|
-
clearInterval(timerRef.current);
|
|
200
|
-
timerRef.current = null;
|
|
201
|
-
}
|
|
202
|
-
};
|
|
203
|
-
}, [actionId, isRunning, isWriteOrEdit]);
|
|
204
145
|
// Only show for write/edit actions with content while running
|
|
205
146
|
if (!isRunning || !currentAction)
|
|
206
147
|
return null;
|
|
@@ -214,21 +155,15 @@ export const LiveCodeStream = ({ actions, isRunning }) => {
|
|
|
214
155
|
const ext = getFileExtension(filename);
|
|
215
156
|
const langLabel = getLanguageLabel(ext);
|
|
216
157
|
const allLines = code.split('\n');
|
|
158
|
+
const totalLines = allLines.length;
|
|
217
159
|
const actionLabel = currentAction.type === 'write' ? '✨ Creating' : '✏️ Editing';
|
|
218
160
|
const actionColor = currentAction.type === 'write' ? 'green' : 'yellow';
|
|
219
|
-
//
|
|
220
|
-
const visibleEndLine = displayState.endLine;
|
|
221
|
-
// Sliding window: show only last 10 lines of what's been "written" so far
|
|
161
|
+
// Show last 10 lines (most recent code being written)
|
|
222
162
|
const WINDOW_SIZE = 10;
|
|
223
|
-
const startLine = Math.max(0,
|
|
224
|
-
const linesToShow = allLines.slice(startLine,
|
|
225
|
-
const remainingLines = totalLines - visibleEndLine;
|
|
163
|
+
const startLine = Math.max(0, totalLines - WINDOW_SIZE);
|
|
164
|
+
const linesToShow = allLines.slice(startLine, totalLines);
|
|
226
165
|
const linesAbove = startLine;
|
|
227
|
-
return (_jsxs(Box, { flexDirection: "column", children: [_jsxs(Box, {
|
|
228
|
-
const lineNum = startLine + i + 1;
|
|
229
|
-
const lineColor = getCodeColor(line, ext);
|
|
230
|
-
return (_jsxs(Text, { children: [_jsx(Text, { color: "gray", dimColor: true, children: String(lineNum).padStart(4, ' ') }), _jsx(Text, { color: "gray", dimColor: true, children: " \u2502 " }), _jsx(Text, { color: lineColor, children: line.slice(0, 72) }), line.length > 72 && _jsx(Text, { color: "gray", children: "\u2026" })] }, i));
|
|
231
|
-
}) }), remainingLines > 0 && (_jsxs(Text, { color: "yellow", children: [" \u22EE ", remainingLines, " more lines..."] })), _jsx(Text, { color: actionColor, children: '─'.repeat(80) })] }));
|
|
166
|
+
return (_jsxs(Box, { flexDirection: "column", children: [_jsxs(Box, { children: [_jsxs(Text, { color: actionColor, bold: true, children: [actionLabel, " "] }), _jsx(Text, { color: "white", bold: true, children: filename }), _jsxs(Text, { color: "gray", children: [" \u2022 ", langLabel, " \u2022 "] }), _jsx(Text, { color: "cyan", children: totalLines }), _jsx(Text, { color: "gray", children: " lines" })] }), _jsx(Text, { color: actionColor, children: '─'.repeat(76) }), linesAbove > 0 && (_jsxs(Text, { color: "gray", dimColor: true, children: [" \u22EE ", linesAbove, " lines above"] })), linesToShow.map((line, i) => (_jsxs(Text, { children: [_jsxs(Text, { color: "gray", dimColor: true, children: [String(startLine + i + 1).padStart(4, ' '), " \u2502", ' '] }), _jsx(Text, { color: getCodeColor(line, ext), children: line.slice(0, 68) }), line.length > 68 && _jsx(Text, { color: "gray", children: "\u2026" })] }, `line-${startLine + i}`))), _jsx(Text, { color: actionColor, children: '─'.repeat(76) })] }));
|
|
232
167
|
};
|
|
233
168
|
// Helper functions for action display
|
|
234
169
|
const getActionColor = (type) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "codeep",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.60",
|
|
4
4
|
"description": "AI-powered coding assistant built for the terminal. Multiple LLM providers, project-aware context, and a seamless development workflow.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|