codeep 1.0.57 → 1.0.58

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.
@@ -143,6 +143,7 @@ export const LiveCodeStream = ({ actions, isRunning }) => {
143
143
  // Use ref for tracking to avoid re-render loops
144
144
  const lastActionIdRef = useRef(null);
145
145
  const timerRef = useRef(null);
146
+ const totalLinesRef = useRef(0);
146
147
  // State for visible lines - only update when batch is ready
147
148
  const [displayState, setDisplayState] = useState({
148
149
  endLine: 0,
@@ -150,10 +151,13 @@ export const LiveCodeStream = ({ actions, isRunning }) => {
150
151
  });
151
152
  // Find the current write/edit action with code content
152
153
  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');
153
156
  // Create a unique ID for the current action
154
157
  const actionId = currentAction ? `${currentAction.target}-${currentAction.timestamp}` : null;
155
- // Get total lines for current action
158
+ // Get total lines for current action and store in ref
156
159
  const totalLines = currentAction?.details ? currentAction.details.split('\n').length : 0;
160
+ totalLinesRef.current = totalLines;
157
161
  // Stream lines progressively using interval instead of recursive setTimeout
158
162
  useEffect(() => {
159
163
  // Clear any existing timer
@@ -161,7 +165,8 @@ export const LiveCodeStream = ({ actions, isRunning }) => {
161
165
  clearInterval(timerRef.current);
162
166
  timerRef.current = null;
163
167
  }
164
- if (!currentAction || !currentAction.details || !isRunning) {
168
+ // Only stream for write/edit actions with content
169
+ if (!currentAction || !currentAction.details || !isRunning || !isWriteOrEdit) {
165
170
  if (displayState.endLine !== 0 || displayState.actionId !== null) {
166
171
  setDisplayState({ endLine: 0, actionId: null });
167
172
  }
@@ -170,19 +175,24 @@ export const LiveCodeStream = ({ actions, isRunning }) => {
170
175
  // If this is a new action, reset and start streaming
171
176
  if (actionId !== lastActionIdRef.current) {
172
177
  lastActionIdRef.current = actionId;
173
- setDisplayState({ endLine: 10, actionId });
174
- // Start interval to stream more lines
175
- timerRef.current = setInterval(() => {
176
- setDisplayState(prev => {
177
- const newEndLine = Math.min(prev.endLine + 10, totalLines);
178
- // Stop interval when we've shown all lines
179
- if (newEndLine >= totalLines && timerRef.current) {
180
- clearInterval(timerRef.current);
181
- timerRef.current = null;
182
- }
183
- return { ...prev, endLine: newEndLine };
184
- });
185
- }, 150); // Slightly slower for smoother experience
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
+ }
186
196
  }
187
197
  return () => {
188
198
  if (timerRef.current) {
@@ -190,7 +200,7 @@ export const LiveCodeStream = ({ actions, isRunning }) => {
190
200
  timerRef.current = null;
191
201
  }
192
202
  };
193
- }, [actionId, isRunning, totalLines]);
203
+ }, [actionId, isRunning, isWriteOrEdit]);
194
204
  // Only show for write/edit actions with content while running
195
205
  if (!isRunning || !currentAction)
196
206
  return null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codeep",
3
- "version": "1.0.57",
3
+ "version": "1.0.58",
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",