codeep 1.1.33 → 1.1.35
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/renderer/App.d.ts +10 -0
- package/dist/renderer/App.js +87 -1
- package/dist/renderer/main.js +31 -0
- package/package.json +1 -1
package/dist/renderer/App.d.ts
CHANGED
|
@@ -43,6 +43,7 @@ export declare class App {
|
|
|
43
43
|
private agentIteration;
|
|
44
44
|
private agentActions;
|
|
45
45
|
private agentThinking;
|
|
46
|
+
private agentCodePreview;
|
|
46
47
|
private pasteInfo;
|
|
47
48
|
private pasteInfoOpen;
|
|
48
49
|
private helpOpen;
|
|
@@ -175,6 +176,15 @@ export declare class App {
|
|
|
175
176
|
* Set agent thinking text
|
|
176
177
|
*/
|
|
177
178
|
setAgentThinking(text: string): void;
|
|
179
|
+
/**
|
|
180
|
+
* Set code preview for agent progress panel
|
|
181
|
+
*/
|
|
182
|
+
setAgentCodePreview(preview: {
|
|
183
|
+
path: string;
|
|
184
|
+
actionType: 'write' | 'edit';
|
|
185
|
+
content: string;
|
|
186
|
+
oldContent?: string;
|
|
187
|
+
} | null): void;
|
|
178
188
|
/**
|
|
179
189
|
* Paste from system clipboard (Ctrl+V)
|
|
180
190
|
*/
|
package/dist/renderer/App.js
CHANGED
|
@@ -241,6 +241,7 @@ export class App {
|
|
|
241
241
|
agentIteration = 0;
|
|
242
242
|
agentActions = [];
|
|
243
243
|
agentThinking = '';
|
|
244
|
+
agentCodePreview = null;
|
|
244
245
|
// Paste detection state
|
|
245
246
|
pasteInfo = null;
|
|
246
247
|
pasteInfoOpen = false;
|
|
@@ -491,10 +492,12 @@ export class App {
|
|
|
491
492
|
this.agentIteration = 0;
|
|
492
493
|
this.agentActions = [];
|
|
493
494
|
this.agentThinking = '';
|
|
495
|
+
this.agentCodePreview = null;
|
|
494
496
|
this.isLoading = false; // Clear loading state when agent takes over
|
|
495
497
|
this.startSpinner();
|
|
496
498
|
}
|
|
497
499
|
else {
|
|
500
|
+
this.agentCodePreview = null;
|
|
498
501
|
this.isLoading = false; // Ensure loading is cleared when agent finishes
|
|
499
502
|
this.stopSpinner();
|
|
500
503
|
}
|
|
@@ -515,6 +518,36 @@ export class App {
|
|
|
515
518
|
*/
|
|
516
519
|
setAgentThinking(text) {
|
|
517
520
|
this.agentThinking = text;
|
|
521
|
+
// Clear code preview when agent moves to a non-write/edit action
|
|
522
|
+
if (text && !text.startsWith('write:') && !text.startsWith('edit:')) {
|
|
523
|
+
this.agentCodePreview = null;
|
|
524
|
+
}
|
|
525
|
+
this.render();
|
|
526
|
+
}
|
|
527
|
+
/**
|
|
528
|
+
* Set code preview for agent progress panel
|
|
529
|
+
*/
|
|
530
|
+
setAgentCodePreview(preview) {
|
|
531
|
+
if (preview && preview.content) {
|
|
532
|
+
const ext = preview.path.split('.').pop()?.toLowerCase() || '';
|
|
533
|
+
const lang = LANG_ALIASES[ext] || ext;
|
|
534
|
+
const lines = preview.content.split('\n');
|
|
535
|
+
const MAX_STORED_LINES = 50;
|
|
536
|
+
const trimmedContent = lines.length > MAX_STORED_LINES
|
|
537
|
+
? lines.slice(-MAX_STORED_LINES).join('\n')
|
|
538
|
+
: preview.content;
|
|
539
|
+
this.agentCodePreview = {
|
|
540
|
+
path: preview.path,
|
|
541
|
+
actionType: preview.actionType,
|
|
542
|
+
content: trimmedContent,
|
|
543
|
+
oldContent: preview.oldContent,
|
|
544
|
+
lang,
|
|
545
|
+
totalLines: lines.length,
|
|
546
|
+
};
|
|
547
|
+
}
|
|
548
|
+
else {
|
|
549
|
+
this.agentCodePreview = null;
|
|
550
|
+
}
|
|
518
551
|
this.render();
|
|
519
552
|
}
|
|
520
553
|
/**
|
|
@@ -1592,7 +1625,20 @@ export class App {
|
|
|
1592
1625
|
bottomPanelHeight = previewLines + 6; // title + preview + extra line indicator + options
|
|
1593
1626
|
}
|
|
1594
1627
|
else if (this.isAgentRunning) {
|
|
1595
|
-
|
|
1628
|
+
if (this.agentCodePreview) {
|
|
1629
|
+
const MAX_PREVIEW_LINES = 12;
|
|
1630
|
+
const storedLines = this.agentCodePreview.content.split('\n').length;
|
|
1631
|
+
const visibleCodeLines = Math.min(storedLines, MAX_PREVIEW_LINES);
|
|
1632
|
+
const startIdx = Math.max(0, storedLines - MAX_PREVIEW_LINES);
|
|
1633
|
+
const startLineNum = this.agentCodePreview.totalLines - storedLines + startIdx;
|
|
1634
|
+
const hasOverflow = startLineNum > 0 ? 1 : 0;
|
|
1635
|
+
// top border + action + code separator + code lines + overflow + stats + bottom border + margin
|
|
1636
|
+
bottomPanelHeight = 1 + 1 + 1 + visibleCodeLines + hasOverflow + 1 + 1 + 1;
|
|
1637
|
+
bottomPanelHeight = Math.min(bottomPanelHeight, Math.floor(height * 0.6));
|
|
1638
|
+
}
|
|
1639
|
+
else {
|
|
1640
|
+
bottomPanelHeight = 5; // Agent progress box (4 lines + 1 margin)
|
|
1641
|
+
}
|
|
1596
1642
|
}
|
|
1597
1643
|
else if (this.permissionOpen) {
|
|
1598
1644
|
bottomPanelHeight = 10; // Permission dialog
|
|
@@ -2248,6 +2294,46 @@ export class App {
|
|
|
2248
2294
|
this.screen.write(1, y, 'Starting...', fg.gray);
|
|
2249
2295
|
}
|
|
2250
2296
|
y++;
|
|
2297
|
+
// Code preview section (for write/edit operations)
|
|
2298
|
+
if (this.agentCodePreview) {
|
|
2299
|
+
const MAX_PREVIEW_LINES = 12;
|
|
2300
|
+
// Code separator with language label
|
|
2301
|
+
const langLabel = this.agentCodePreview.lang ? ` ${this.agentCodePreview.lang} ` : '';
|
|
2302
|
+
const sepPadLeft = 2;
|
|
2303
|
+
const sepPadRight = width - sepPadLeft - langLabel.length - 1;
|
|
2304
|
+
this.screen.write(0, y, '─'.repeat(sepPadLeft), SYNTAX.codeFrame);
|
|
2305
|
+
this.screen.write(sepPadLeft, y, langLabel, SYNTAX.codeLang);
|
|
2306
|
+
this.screen.write(sepPadLeft + langLabel.length, y, '─'.repeat(Math.max(0, sepPadRight)), SYNTAX.codeFrame);
|
|
2307
|
+
y++;
|
|
2308
|
+
// Determine visible code lines (show tail for long content)
|
|
2309
|
+
const codeLines = this.agentCodePreview.content.split('\n');
|
|
2310
|
+
const totalLines = this.agentCodePreview.totalLines;
|
|
2311
|
+
const displayCount = Math.min(codeLines.length, MAX_PREVIEW_LINES);
|
|
2312
|
+
const startIdx = Math.max(0, codeLines.length - MAX_PREVIEW_LINES);
|
|
2313
|
+
const startLineNum = totalLines - codeLines.length + startIdx;
|
|
2314
|
+
// Overflow indicator if truncated from top
|
|
2315
|
+
if (startLineNum > 0) {
|
|
2316
|
+
this.screen.write(1, y, `... (${startLineNum} lines above)`, fg.gray);
|
|
2317
|
+
y++;
|
|
2318
|
+
}
|
|
2319
|
+
// Render highlighted code lines with line numbers
|
|
2320
|
+
const lineNumWidth = String(totalLines).length;
|
|
2321
|
+
const codeAreaWidth = width - lineNumWidth - 4;
|
|
2322
|
+
for (let i = 0; i < displayCount; i++) {
|
|
2323
|
+
const lineNum = startLineNum + i + 1;
|
|
2324
|
+
const lineNumStr = String(lineNum).padStart(lineNumWidth, ' ');
|
|
2325
|
+
// Truncate wide lines
|
|
2326
|
+
let codeLine = codeLines[startIdx + i];
|
|
2327
|
+
if (codeLine.length > codeAreaWidth) {
|
|
2328
|
+
codeLine = codeLine.slice(0, codeAreaWidth - 1) + '\u2026';
|
|
2329
|
+
}
|
|
2330
|
+
const highlighted = highlightCode(codeLine, this.agentCodePreview.lang);
|
|
2331
|
+
// Use writeRaw with line number embedded as ANSI since writeRaw clears the full line
|
|
2332
|
+
const lineNumAnsi = SYNTAX.comment + lineNumStr + '\x1b[0m' + ' ';
|
|
2333
|
+
this.screen.writeRaw(y, ' ' + lineNumAnsi + highlighted);
|
|
2334
|
+
y++;
|
|
2335
|
+
}
|
|
2336
|
+
}
|
|
2251
2337
|
// Stats line: Files and step info
|
|
2252
2338
|
let x = 1;
|
|
2253
2339
|
// File changes
|
package/dist/renderer/main.js
CHANGED
|
@@ -312,6 +312,37 @@ async function executeAgentTask(task, dryRun = false) {
|
|
|
312
312
|
// Update agent thinking
|
|
313
313
|
const shortTarget = target.length > 50 ? '...' + target.slice(-47) : target;
|
|
314
314
|
app.setAgentThinking(`${actionType}: ${shortTarget}`);
|
|
315
|
+
// Set code preview and add chat message for write/edit operations
|
|
316
|
+
if (actionType === 'write' && tool.parameters.content) {
|
|
317
|
+
const filePath = tool.parameters.path;
|
|
318
|
+
const ext = filePath.split('.').pop() || '';
|
|
319
|
+
app.addMessage({
|
|
320
|
+
role: 'system',
|
|
321
|
+
content: `**Write** \`${filePath}\`\n\n\`\`\`${ext}\n${tool.parameters.content}\n\`\`\``,
|
|
322
|
+
});
|
|
323
|
+
app.setAgentCodePreview({
|
|
324
|
+
path: filePath,
|
|
325
|
+
actionType: 'write',
|
|
326
|
+
content: tool.parameters.content,
|
|
327
|
+
});
|
|
328
|
+
}
|
|
329
|
+
else if (actionType === 'edit' && tool.parameters.new_text) {
|
|
330
|
+
const filePath = tool.parameters.path;
|
|
331
|
+
const ext = filePath.split('.').pop() || '';
|
|
332
|
+
app.addMessage({
|
|
333
|
+
role: 'system',
|
|
334
|
+
content: `**Edit** \`${filePath}\`\n\n\`\`\`${ext}\n${tool.parameters.new_text}\n\`\`\``,
|
|
335
|
+
});
|
|
336
|
+
app.setAgentCodePreview({
|
|
337
|
+
path: filePath,
|
|
338
|
+
actionType: 'edit',
|
|
339
|
+
content: tool.parameters.new_text,
|
|
340
|
+
oldContent: tool.parameters.old_text,
|
|
341
|
+
});
|
|
342
|
+
}
|
|
343
|
+
else {
|
|
344
|
+
app.setAgentCodePreview(null);
|
|
345
|
+
}
|
|
315
346
|
},
|
|
316
347
|
onToolResult: (result, toolCall) => {
|
|
317
348
|
const toolName = toolCall.tool.toLowerCase();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "codeep",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.35",
|
|
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",
|