codeep 1.0.59 → 1.0.61

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.
package/dist/app.js CHANGED
@@ -273,14 +273,34 @@ export const App = () => {
273
273
  setAgentIteration(iteration);
274
274
  },
275
275
  onToolCall: (tool) => {
276
- // Create a placeholder action - will be updated by onToolResult
277
- const placeholderResult = {
278
- success: true,
279
- output: '',
280
- tool: tool.tool,
281
- parameters: tool.parameters,
276
+ // Create action log with content for live code preview
277
+ // For write/edit actions, include content immediately so it shows while agent works
278
+ const toolName = tool.tool.toLowerCase().replace(/-/g, '_');
279
+ let details;
280
+ if (toolName === 'write_file' && tool.parameters.content) {
281
+ details = tool.parameters.content;
282
+ }
283
+ else if (toolName === 'edit_file' && tool.parameters.new_text) {
284
+ details = tool.parameters.new_text;
285
+ }
286
+ const actionLog = {
287
+ type: toolName === 'write_file' ? 'write' :
288
+ toolName === 'edit_file' ? 'edit' :
289
+ toolName === 'read_file' ? 'read' :
290
+ toolName === 'delete_file' ? 'delete' :
291
+ toolName === 'execute_command' ? 'command' :
292
+ toolName === 'search_code' ? 'search' :
293
+ toolName === 'list_files' ? 'list' :
294
+ toolName === 'create_directory' ? 'mkdir' :
295
+ toolName === 'fetch_url' ? 'fetch' : 'command',
296
+ target: tool.parameters.path ||
297
+ tool.parameters.command ||
298
+ tool.parameters.pattern ||
299
+ tool.parameters.url || 'unknown',
300
+ result: 'success', // Will be updated by onToolResult
301
+ details,
302
+ timestamp: Date.now(),
282
303
  };
283
- const actionLog = createActionLog(tool, placeholderResult);
284
304
  setAgentActions(prev => [...prev, actionLog]);
285
305
  },
286
306
  onToolResult: (result, toolCall) => {
@@ -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, useRef } from 'react';
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,65 +140,8 @@ const isSectionBreak = (line, prevLine) => {
140
140
  return false;
141
141
  };
142
142
  export const LiveCodeStream = ({ actions, isRunning }) => {
143
- // Use refs for mutable state to minimize re-renders
144
- const lastActionIdRef = useRef(null);
145
- const timerRef = useRef(null);
146
- const visibleEndLineRef = useRef(0);
147
- // Single state for forcing re-render - increment only when needed
148
- const [, forceRender] = useState(0);
149
143
  // Find the current write/edit action with code content
150
144
  const currentAction = actions.length > 0 ? actions[actions.length - 1] : null;
151
- // Only show for write/edit actions
152
- const isWriteOrEdit = currentAction && (currentAction.type === 'write' || currentAction.type === 'edit');
153
- // Create a unique ID for the current action
154
- const actionId = currentAction ? `${currentAction.target}-${currentAction.timestamp}` : null;
155
- // Get total lines for current action
156
- const totalLines = currentAction?.details ? currentAction.details.split('\n').length : 0;
157
- // Stream lines progressively - minimize state updates
158
- useEffect(() => {
159
- // Clear any existing timer
160
- if (timerRef.current) {
161
- clearInterval(timerRef.current);
162
- timerRef.current = null;
163
- }
164
- // Only stream for write/edit actions with content
165
- if (!currentAction || !currentAction.details || !isRunning || !isWriteOrEdit) {
166
- if (visibleEndLineRef.current !== 0) {
167
- visibleEndLineRef.current = 0;
168
- lastActionIdRef.current = null;
169
- }
170
- return;
171
- }
172
- // If this is a new action, reset and start streaming
173
- if (actionId !== lastActionIdRef.current) {
174
- lastActionIdRef.current = actionId;
175
- const lines = currentAction.details.split('\n').length;
176
- visibleEndLineRef.current = Math.min(10, lines);
177
- forceRender(n => n + 1);
178
- // Only start interval if there are more lines to show
179
- if (lines > 10) {
180
- timerRef.current = setInterval(() => {
181
- const currentLines = currentAction.details?.split('\n').length || 0;
182
- const newEndLine = Math.min(visibleEndLineRef.current + 10, currentLines);
183
- if (newEndLine !== visibleEndLineRef.current) {
184
- visibleEndLineRef.current = newEndLine;
185
- forceRender(n => n + 1);
186
- }
187
- // Stop interval when we've shown all lines
188
- if (newEndLine >= currentLines && timerRef.current) {
189
- clearInterval(timerRef.current);
190
- timerRef.current = null;
191
- }
192
- }, 200); // Slower interval to reduce flickering
193
- }
194
- }
195
- return () => {
196
- if (timerRef.current) {
197
- clearInterval(timerRef.current);
198
- timerRef.current = null;
199
- }
200
- };
201
- }, [actionId, isRunning, isWriteOrEdit, currentAction]);
202
145
  // Only show for write/edit actions with content while running
203
146
  if (!isRunning || !currentAction)
204
147
  return null;
@@ -212,22 +155,15 @@ export const LiveCodeStream = ({ actions, isRunning }) => {
212
155
  const ext = getFileExtension(filename);
213
156
  const langLabel = getLanguageLabel(ext);
214
157
  const allLines = code.split('\n');
158
+ const totalLines = allLines.length;
215
159
  const actionLabel = currentAction.type === 'write' ? '✨ Creating' : '✏️ Editing';
216
160
  const actionColor = currentAction.type === 'write' ? 'green' : 'yellow';
217
- // Use ref value for rendering
218
- const visibleEndLine = visibleEndLineRef.current || Math.min(10, totalLines);
219
- // Sliding window: show only last 10 lines
161
+ // Show last 10 lines (most recent code being written)
220
162
  const WINDOW_SIZE = 10;
221
- const startLine = Math.max(0, visibleEndLine - WINDOW_SIZE);
222
- const linesToShow = allLines.slice(startLine, visibleEndLine);
223
- const remainingLines = totalLines - visibleEndLine;
163
+ const startLine = Math.max(0, totalLines - WINDOW_SIZE);
164
+ const linesToShow = allLines.slice(startLine, totalLines);
224
165
  const linesAbove = startLine;
225
- // Pad lines to fixed height to prevent layout shifts
226
- const paddedLines = [...linesToShow];
227
- while (paddedLines.length < WINDOW_SIZE) {
228
- paddedLines.push('');
229
- }
230
- 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: visibleEndLine }), _jsxs(Text, { color: "gray", children: ["/", totalLines] }), remainingLines > 0 && _jsx(Text, { color: "yellow", children: " \u25BC" })] }), _jsx(Text, { color: actionColor, children: '─'.repeat(76) }), _jsx(Text, { color: "gray", dimColor: true, children: linesAbove > 0 ? ` ⋮ ${linesAbove} lines above` : ' ' }), paddedLines.map((line, i) => (_jsxs(Text, { children: [_jsxs(Text, { color: "gray", dimColor: true, children: [line ? String(startLine + i + 1).padStart(4, ' ') : ' ', " \u2502", ' '] }), _jsx(Text, { color: line ? getCodeColor(line, ext) : 'gray', children: line.slice(0, 68) }), line.length > 68 && _jsx(Text, { color: "gray", children: "\u2026" })] }, `line-${startLine + i}`))), _jsx(Text, { color: "yellow", children: remainingLines > 0 ? ` ⋮ ${remainingLines} more lines...` : ' ' }), _jsx(Text, { color: actionColor, children: '─'.repeat(76) })] }));
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) })] }));
231
167
  };
232
168
  // Helper functions for action display
233
169
  const getActionColor = (type) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codeep",
3
- "version": "1.0.59",
3
+ "version": "1.0.61",
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",