erosolar-cli 1.7.109 → 1.7.110
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/bin/erosolar.js +1 -0
- package/dist/bin/erosolar.js.map +1 -1
- package/dist/shell/enhancedInteractiveShell.d.ts +42 -0
- package/dist/shell/enhancedInteractiveShell.d.ts.map +1 -0
- package/dist/shell/enhancedInteractiveShell.js +139 -0
- package/dist/shell/enhancedInteractiveShell.js.map +1 -0
- package/dist/shell/enhancedShellApp.d.ts +22 -0
- package/dist/shell/enhancedShellApp.d.ts.map +1 -0
- package/dist/shell/enhancedShellApp.js +148 -0
- package/dist/shell/enhancedShellApp.js.map +1 -0
- package/dist/tools/diffUtils.d.ts +6 -0
- package/dist/tools/diffUtils.d.ts.map +1 -1
- package/dist/tools/diffUtils.js +110 -0
- package/dist/tools/diffUtils.js.map +1 -1
- package/dist/tools/editTools.d.ts.map +1 -1
- package/dist/tools/editTools.js +29 -12
- package/dist/tools/editTools.js.map +1 -1
- package/dist/ui/enhancedPinnedChatBox.d.ts +93 -0
- package/dist/ui/enhancedPinnedChatBox.d.ts.map +1 -0
- package/dist/ui/enhancedPinnedChatBox.js +372 -0
- package/dist/ui/enhancedPinnedChatBox.js.map +1 -0
- package/dist/ui/persistentPrompt.d.ts +5 -4
- package/dist/ui/persistentPrompt.d.ts.map +1 -1
- package/dist/ui/persistentPrompt.js +34 -13
- package/dist/ui/persistentPrompt.js.map +1 -1
- package/package.json +1 -1
package/dist/tools/editTools.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { readFile, writeFile, stat } from 'node:fs/promises';
|
|
2
2
|
import { join, relative } from 'node:path';
|
|
3
3
|
import { buildError } from '../core/errors.js';
|
|
4
|
-
import {
|
|
4
|
+
import { buildDiffSegmentsFast, formatDiffLines } from './diffUtils.js';
|
|
5
5
|
/**
|
|
6
6
|
* Creates the Edit tool for surgical file modifications using exact string replacement.
|
|
7
7
|
*
|
|
@@ -65,12 +65,15 @@ export function createEditTools(workingDir) {
|
|
|
65
65
|
}
|
|
66
66
|
try {
|
|
67
67
|
const filePath = resolveFilePath(workingDir, pathArg);
|
|
68
|
-
// Check file exists
|
|
69
|
-
|
|
68
|
+
// Check file exists (async for speed)
|
|
69
|
+
try {
|
|
70
|
+
await stat(filePath);
|
|
71
|
+
}
|
|
72
|
+
catch {
|
|
70
73
|
return `Error: File not found: ${filePath}`;
|
|
71
74
|
}
|
|
72
|
-
// Read current content
|
|
73
|
-
const currentContent =
|
|
75
|
+
// Read current content (async for speed)
|
|
76
|
+
const currentContent = await readFile(filePath, 'utf-8');
|
|
74
77
|
// Check if old_string exists in file
|
|
75
78
|
if (!currentContent.includes(oldString)) {
|
|
76
79
|
// Provide helpful debugging info when match fails
|
|
@@ -99,10 +102,10 @@ export function createEditTools(workingDir) {
|
|
|
99
102
|
const newContent = replaceAll
|
|
100
103
|
? currentContent.split(oldString).join(newString)
|
|
101
104
|
: currentContent.replace(oldString, newString);
|
|
102
|
-
// Generate diff
|
|
103
|
-
const diffSegments =
|
|
104
|
-
// Write file
|
|
105
|
-
|
|
105
|
+
// Generate diff (fast in-memory algorithm, no git spawning)
|
|
106
|
+
const diffSegments = buildDiffSegmentsFast(currentContent, newContent);
|
|
107
|
+
// Write file (async for speed)
|
|
108
|
+
await writeFile(filePath, newContent, 'utf-8');
|
|
106
109
|
// Build summary
|
|
107
110
|
const relativePath = relative(workingDir, filePath);
|
|
108
111
|
const displayPath = relativePath && !relativePath.startsWith('..') ? relativePath : filePath;
|
|
@@ -149,7 +152,7 @@ function countOccurrences(text, search) {
|
|
|
149
152
|
}
|
|
150
153
|
/**
|
|
151
154
|
* Find lines in the file that are similar to the search text.
|
|
152
|
-
*
|
|
155
|
+
* Enhanced with whitespace detection and auto-correction suggestions.
|
|
153
156
|
*/
|
|
154
157
|
function findSimilarLines(content, searchFirstLine, _filePath) {
|
|
155
158
|
if (!searchFirstLine.trim()) {
|
|
@@ -163,6 +166,14 @@ function findSimilarLines(content, searchFirstLine, _filePath) {
|
|
|
163
166
|
for (let i = 0; i < lines.length; i++) {
|
|
164
167
|
const line = lines[i] || '';
|
|
165
168
|
const lineNormalized = line.trim().toLowerCase();
|
|
169
|
+
// Check for exact match with different whitespace
|
|
170
|
+
if (lineNormalized === searchNormalized && line !== searchFirstLine) {
|
|
171
|
+
const hasTabs = line.includes('\t') !== searchFirstLine.includes('\t');
|
|
172
|
+
const leadingDiff = line.match(/^\s*/)?.[0]?.length !== searchFirstLine.match(/^\s*/)?.[0]?.length;
|
|
173
|
+
const issue = hasTabs ? 'tabs vs spaces' : leadingDiff ? 'different indentation' : 'whitespace difference';
|
|
174
|
+
matches.push({ lineNum: i + 1, line, similarity: 0.99, issue });
|
|
175
|
+
continue;
|
|
176
|
+
}
|
|
166
177
|
// Check for partial match (contains significant portion of the search)
|
|
167
178
|
if (lineNormalized.includes(searchNormalized.substring(0, 20))) {
|
|
168
179
|
matches.push({ lineNum: i + 1, line, similarity: 1.0 });
|
|
@@ -185,8 +196,14 @@ function findSimilarLines(content, searchFirstLine, _filePath) {
|
|
|
185
196
|
const topMatches = matches.slice(0, 3);
|
|
186
197
|
const suggestions = topMatches.map(m => {
|
|
187
198
|
const truncated = m.line.length > 80 ? m.line.substring(0, 77) + '...' : m.line;
|
|
188
|
-
|
|
199
|
+
const issueNote = m.issue ? ` (${m.issue})` : '';
|
|
200
|
+
return ` Line ${m.lineNum}${issueNote}: ${JSON.stringify(truncated)}`;
|
|
189
201
|
});
|
|
202
|
+
// Add auto-correction hint for whitespace issues
|
|
203
|
+
const whitespaceMatch = topMatches.find(m => m.issue);
|
|
204
|
+
if (whitespaceMatch) {
|
|
205
|
+
return `Similar lines found (possible whitespace mismatch):\n${suggestions.join('\n')}\n\nTip: Copy the exact text from Read output including indentation.`;
|
|
206
|
+
}
|
|
190
207
|
return `Similar lines found:\n${suggestions.join('\n')}`;
|
|
191
208
|
}
|
|
192
209
|
//# sourceMappingURL=editTools.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"editTools.js","sourceRoot":"","sources":["../../src/tools/editTools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"editTools.js","sourceRoot":"","sources":["../../src/tools/editTools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAE3C,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,qBAAqB,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAExE;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,eAAe,CAAC,UAAkB;IAChD,OAAO;QACL;YACE,IAAI,EAAE,MAAM;YACZ,WAAW,EAAE,yLAAyL;YACtM,UAAU,EAAE;gBACV,IAAI,EAAE,QAAQ;gBACd,UAAU,EAAE;oBACV,SAAS,EAAE;wBACT,IAAI,EAAE,QAAQ;wBACd,WAAW,EAAE,yCAAyC;qBACvD;oBACD,UAAU,EAAE;wBACV,IAAI,EAAE,QAAQ;wBACd,WAAW,EAAE,uFAAuF;qBACrG;oBACD,UAAU,EAAE;wBACV,IAAI,EAAE,QAAQ;wBACd,WAAW,EAAE,iEAAiE;qBAC/E;oBACD,WAAW,EAAE;wBACX,IAAI,EAAE,SAAS;wBACf,WAAW,EAAE,yHAAyH;qBACvI;iBACF;gBACD,QAAQ,EAAE,CAAC,WAAW,EAAE,YAAY,EAAE,YAAY,CAAC;gBACnD,oBAAoB,EAAE,KAAK;aAC5B;YACD,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE;gBACtB,MAAM,OAAO,GAAG,IAAI,CAAC,WAAW,CAAC,CAAC;gBAClC,MAAM,SAAS,GAAG,IAAI,CAAC,YAAY,CAAC,CAAC;g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AwD,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,sEAAsE,CAAC;IAC9J,CAAC;IAED,OAAO,yBAAyB,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;AAC3D,CAAC"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* EnhancedPinnedChatBox - Modified version of PinnedChatBox with persistent visibility during streaming
|
|
3
|
+
* and enhanced paste handling
|
|
4
|
+
*/
|
|
5
|
+
export interface QueuedCommand {
|
|
6
|
+
id: string;
|
|
7
|
+
text: string;
|
|
8
|
+
type: 'request' | 'continuous' | 'slash';
|
|
9
|
+
timestamp: number;
|
|
10
|
+
preview: string;
|
|
11
|
+
}
|
|
12
|
+
export interface PinnedChatBoxState {
|
|
13
|
+
isProcessing: boolean;
|
|
14
|
+
queuedCommands: QueuedCommand[];
|
|
15
|
+
currentInput: string;
|
|
16
|
+
contextUsage: number;
|
|
17
|
+
statusMessage: string | null;
|
|
18
|
+
isVisible: boolean;
|
|
19
|
+
}
|
|
20
|
+
export declare class EnhancedPinnedChatBox {
|
|
21
|
+
private writeStream;
|
|
22
|
+
private state;
|
|
23
|
+
private reservedLines;
|
|
24
|
+
private _lastRenderedHeight;
|
|
25
|
+
private inputBuffer;
|
|
26
|
+
private cursorPosition;
|
|
27
|
+
private commandIdCounter;
|
|
28
|
+
private onCommandQueued?;
|
|
29
|
+
private onInputSubmit?;
|
|
30
|
+
private renderScheduled;
|
|
31
|
+
private isEnabled;
|
|
32
|
+
private isDisposed;
|
|
33
|
+
private lastRenderTime;
|
|
34
|
+
private renderThrottleMs;
|
|
35
|
+
private maxInputLength;
|
|
36
|
+
private maxQueueSize;
|
|
37
|
+
private readonly ansiPattern;
|
|
38
|
+
private readonly oscPattern;
|
|
39
|
+
private readonly maxStatusMessageLength;
|
|
40
|
+
private scrollRegionActive;
|
|
41
|
+
private inputHistory;
|
|
42
|
+
private historyIndex;
|
|
43
|
+
private tempCurrentInput;
|
|
44
|
+
private readonly maxHistorySize;
|
|
45
|
+
private isPastedBlock;
|
|
46
|
+
private pastedFullContent;
|
|
47
|
+
private pasteStartTime;
|
|
48
|
+
private pasteLineCount;
|
|
49
|
+
private readonly maxPasteLines;
|
|
50
|
+
private outputInterceptorCleanup?;
|
|
51
|
+
constructor(writeStream: NodeJS.WriteStream, _promptText?: string, options?: {
|
|
52
|
+
onCommandQueued?: (cmd: QueuedCommand) => void;
|
|
53
|
+
onInputSubmit?: (input: string) => void;
|
|
54
|
+
maxInputLength?: number;
|
|
55
|
+
maxQueueSize?: number;
|
|
56
|
+
});
|
|
57
|
+
/**
|
|
58
|
+
* Enhanced paste detection with summarization
|
|
59
|
+
*/
|
|
60
|
+
handlePaste(content: string): void;
|
|
61
|
+
/**
|
|
62
|
+
* Clear paste state
|
|
63
|
+
*/
|
|
64
|
+
private clearPastedBlock;
|
|
65
|
+
/**
|
|
66
|
+
* Handle character input with paste detection
|
|
67
|
+
*/
|
|
68
|
+
handleCharacter(char: string): void;
|
|
69
|
+
/**
|
|
70
|
+
* Handle Enter key - only submit when explicitly pressed
|
|
71
|
+
*/
|
|
72
|
+
handleEnter(): string | null;
|
|
73
|
+
/**
|
|
74
|
+
* Enhanced render that always shows during processing
|
|
75
|
+
*/
|
|
76
|
+
render(): void;
|
|
77
|
+
/**
|
|
78
|
+
* Render persistent input during processing
|
|
79
|
+
*/
|
|
80
|
+
renderPersistentInput(): void;
|
|
81
|
+
private supportsRendering;
|
|
82
|
+
private safeWrite;
|
|
83
|
+
private sanitizeCommandText;
|
|
84
|
+
private sanitizeStatusMessage;
|
|
85
|
+
private addToHistory;
|
|
86
|
+
setEnabled(enabled: boolean): void;
|
|
87
|
+
setProcessing(isProcessing: boolean): void;
|
|
88
|
+
setContextUsage(percentage: number): void;
|
|
89
|
+
setStatusMessage(message: string | null): void;
|
|
90
|
+
queueCommand(text: string, type?: 'request' | 'continuous' | 'slash'): QueuedCommand | null;
|
|
91
|
+
clearQueue(): void;
|
|
92
|
+
}
|
|
93
|
+
//# sourceMappingURL=enhancedPinnedChatBox.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"enhancedPinnedChatBox.d.ts","sourceRoot":"","sources":["../../src/ui/enhancedPinnedChatBox.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,SAAS,GAAG,YAAY,GAAG,OAAO,CAAC;IACzC,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,kBAAkB;IACjC,YAAY,EAAE,OAAO,CAAC;IACtB,cAAc,EAAE,aAAa,EAAE,CAAC;IAChC,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,SAAS,EAAE,OAAO,CAAC;CACpB;AAED,qBAAa,qBAAqB;IAChC,OAAO,CAAC,WAAW,CAAqB;IACxC,OAAO,CAAC,KAAK,CAAqB;IAClC,OAAO,CAAC,aAAa,CAAa;IAClC,OAAO,CAAC,mBAAmB,CAAa;IACxC,OAAO,CAAC,WAAW,CAAc;IACjC,OAAO,CAAC,cAAc,CAAa;IACnC,OAAO,CAAC,gBAAgB,CAAa;IACrC,OAAO,CAAC,eAAe,CAAC,CAA+B;IACvD,OAAO,CAAC,aAAa,CAAC,CAA0B;IAChD,OAAO,CAAC,eAAe,CAAkB;IACzC,OAAO,CAAC,SAAS,CAAiB;IAClC,OAAO,CAAC,UAAU,CAAkB;IACpC,OAAO,CAAC,cAAc,CAAa;IACnC,OAAO,CAAC,gBAAgB,CAAc;IACtC,OAAO,CAAC,cAAc,CAAiB;IACvC,OAAO,CAAC,YAAY,CAAe;IACnC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAmF;IAC/G,OAAO,CAAC,QAAQ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CAAC,YAAY,EAAE,OAAO,GAAG,IAAI;IAM1C,eAAe,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI;IAMzC,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI;IAM9C,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,GAAE,SAAS,GAAG,YAAY,GAAG,OAAmB,GAAG,aAAa,GAAG,IAAI;IAqCtG,UAAU,IAAI,IAAI;CAEF"}
|
|
@@ -0,0 +1,372 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* EnhancedPinnedChatBox - Modified version of PinnedChatBox with persistent visibility during streaming
|
|
3
|
+
* and enhanced paste handling
|
|
4
|
+
*/
|
|
5
|
+
import { theme } from './theme.js';
|
|
6
|
+
import { ANSI } from './ansi.js';
|
|
7
|
+
export class EnhancedPinnedChatBox {
|
|
8
|
+
writeStream;
|
|
9
|
+
state;
|
|
10
|
+
reservedLines = 2;
|
|
11
|
+
_lastRenderedHeight = 0;
|
|
12
|
+
inputBuffer = '';
|
|
13
|
+
cursorPosition = 0;
|
|
14
|
+
commandIdCounter = 0;
|
|
15
|
+
onCommandQueued;
|
|
16
|
+
onInputSubmit;
|
|
17
|
+
renderScheduled = false;
|
|
18
|
+
isEnabled = true;
|
|
19
|
+
isDisposed = false;
|
|
20
|
+
lastRenderTime = 0;
|
|
21
|
+
renderThrottleMs = 16;
|
|
22
|
+
maxInputLength = 10000;
|
|
23
|
+
maxQueueSize = 100;
|
|
24
|
+
ansiPattern = /[\u001B\u009B][[\]()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g;
|
|
25
|
+
oscPattern = /\u001b\][^\u0007]*(?:\u0007|\u001b\\)/g;
|
|
26
|
+
maxStatusMessageLength = 200;
|
|
27
|
+
// Scroll region management
|
|
28
|
+
scrollRegionActive = false;
|
|
29
|
+
// Input history
|
|
30
|
+
inputHistory = [];
|
|
31
|
+
historyIndex = -1;
|
|
32
|
+
tempCurrentInput = '';
|
|
33
|
+
maxHistorySize = 100;
|
|
34
|
+
// Enhanced paste tracking
|
|
35
|
+
isPastedBlock = false;
|
|
36
|
+
pastedFullContent = '';
|
|
37
|
+
pasteStartTime = 0;
|
|
38
|
+
pasteLineCount = 0;
|
|
39
|
+
maxPasteLines = 50;
|
|
40
|
+
outputInterceptorCleanup;
|
|
41
|
+
constructor(writeStream, _promptText = '> ', options = {}) {
|
|
42
|
+
this.writeStream = writeStream;
|
|
43
|
+
this.onCommandQueued = options.onCommandQueued;
|
|
44
|
+
this.onInputSubmit = options.onInputSubmit;
|
|
45
|
+
this.maxInputLength = options.maxInputLength ?? this.maxInputLength;
|
|
46
|
+
this.maxQueueSize = options.maxQueueSize ?? this.maxQueueSize;
|
|
47
|
+
this.state = {
|
|
48
|
+
isProcessing: false,
|
|
49
|
+
queuedCommands: [],
|
|
50
|
+
currentInput: '',
|
|
51
|
+
contextUsage: 0,
|
|
52
|
+
statusMessage: null,
|
|
53
|
+
isVisible: true,
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Enhanced paste detection with summarization
|
|
58
|
+
*/
|
|
59
|
+
handlePaste(content) {
|
|
60
|
+
if (this.isDisposed)
|
|
61
|
+
return;
|
|
62
|
+
const lines = content.split('\n');
|
|
63
|
+
const lineCount = lines.length;
|
|
64
|
+
const charCount = content.length;
|
|
65
|
+
this.pasteStartTime = Date.now();
|
|
66
|
+
this.pasteLineCount = lineCount;
|
|
67
|
+
// For large pastes, show summary instead of full content
|
|
68
|
+
if (lineCount > this.maxPasteLines || charCount > 2000) {
|
|
69
|
+
this.isPastedBlock = true;
|
|
70
|
+
this.pastedFullContent = content;
|
|
71
|
+
const summaryLines = lines.slice(0, 5);
|
|
72
|
+
const remainingLines = lineCount - 5;
|
|
73
|
+
const summary = summaryLines.join('\n') +
|
|
74
|
+
(remainingLines > 0 ? `\n... (${remainingLines} more lines)` : '');
|
|
75
|
+
this.inputBuffer = summary;
|
|
76
|
+
this.cursorPosition = summary.length;
|
|
77
|
+
this.state.currentInput = summary;
|
|
78
|
+
this.setStatusMessage(`📋 Pasted ${lineCount} lines, ${charCount} chars - hit Enter to submit`);
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
this.isPastedBlock = false;
|
|
82
|
+
this.pastedFullContent = '';
|
|
83
|
+
this.inputBuffer = content;
|
|
84
|
+
this.cursorPosition = content.length;
|
|
85
|
+
this.state.currentInput = content;
|
|
86
|
+
}
|
|
87
|
+
this.scheduleRender();
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Clear paste state
|
|
91
|
+
*/
|
|
92
|
+
clearPastedBlock() {
|
|
93
|
+
this.isPastedBlock = false;
|
|
94
|
+
this.pastedFullContent = '';
|
|
95
|
+
this.pasteStartTime = 0;
|
|
96
|
+
this.pasteLineCount = 0;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Handle character input with paste detection
|
|
100
|
+
*/
|
|
101
|
+
handleCharacter(char) {
|
|
102
|
+
if (this.isDisposed)
|
|
103
|
+
return;
|
|
104
|
+
const now = Date.now();
|
|
105
|
+
if (this.pasteStartTime > 0 && now - this.pasteStartTime < 100) {
|
|
106
|
+
// Rapid input detected - treat as paste continuation
|
|
107
|
+
this.inputBuffer = this.inputBuffer.slice(0, this.cursorPosition) +
|
|
108
|
+
char +
|
|
109
|
+
this.inputBuffer.slice(this.cursorPosition);
|
|
110
|
+
this.cursorPosition += char.length;
|
|
111
|
+
this.state.currentInput = this.inputBuffer;
|
|
112
|
+
this.scheduleRender();
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
// Normal character input
|
|
116
|
+
this.inputBuffer = this.inputBuffer.slice(0, this.cursorPosition) +
|
|
117
|
+
char +
|
|
118
|
+
this.inputBuffer.slice(this.cursorPosition);
|
|
119
|
+
this.cursorPosition += char.length;
|
|
120
|
+
this.state.currentInput = this.inputBuffer;
|
|
121
|
+
this.clearPastedBlock();
|
|
122
|
+
this.scheduleRender();
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Handle Enter key - only submit when explicitly pressed
|
|
126
|
+
*/
|
|
127
|
+
handleEnter() {
|
|
128
|
+
if (this.isDisposed)
|
|
129
|
+
return null;
|
|
130
|
+
let input;
|
|
131
|
+
// If we have a pasted block, use the full content
|
|
132
|
+
if (this.isPastedBlock && this.pastedFullContent) {
|
|
133
|
+
input = this.sanitizeCommandText(this.pastedFullContent);
|
|
134
|
+
}
|
|
135
|
+
else {
|
|
136
|
+
input = this.sanitizeCommandText(this.inputBuffer);
|
|
137
|
+
}
|
|
138
|
+
if (!input)
|
|
139
|
+
return null;
|
|
140
|
+
// Add to history before processing
|
|
141
|
+
const historyEntry = this.isPastedBlock
|
|
142
|
+
? `[Pasted ${this.pasteLineCount} lines] ${input.slice(0, 100)}...`
|
|
143
|
+
: input;
|
|
144
|
+
this.addToHistory(historyEntry);
|
|
145
|
+
// If processing, queue the command instead of submitting
|
|
146
|
+
if (this.state.isProcessing) {
|
|
147
|
+
const type = input.startsWith('/') ? 'slash' : 'request';
|
|
148
|
+
const queued = this.queueCommand(input, type);
|
|
149
|
+
if (!queued) {
|
|
150
|
+
this.setStatusMessage(`Queue is full (${this.maxQueueSize}). Submit after current task or clear queued items.`);
|
|
151
|
+
return null;
|
|
152
|
+
}
|
|
153
|
+
this.clearInput();
|
|
154
|
+
return null;
|
|
155
|
+
}
|
|
156
|
+
// Clear input and paste state, then notify
|
|
157
|
+
this.clearInput();
|
|
158
|
+
if (this.onInputSubmit) {
|
|
159
|
+
this.onInputSubmit(input);
|
|
160
|
+
}
|
|
161
|
+
return input;
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Enhanced render that always shows during processing
|
|
165
|
+
*/
|
|
166
|
+
render() {
|
|
167
|
+
if (!this.state.isVisible || !this.supportsRendering())
|
|
168
|
+
return;
|
|
169
|
+
// ALWAYS render during processing - use persistent input mode
|
|
170
|
+
if (this.state.isProcessing) {
|
|
171
|
+
this.renderPersistentInput();
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
// Not processing - render the standard status box
|
|
175
|
+
this.lastRenderTime = Date.now();
|
|
176
|
+
try {
|
|
177
|
+
const cols = Math.max(this.writeStream.columns || 80, 40);
|
|
178
|
+
const separatorWidth = Math.min(cols - 2, 72);
|
|
179
|
+
// Build status message
|
|
180
|
+
const statusParts = [];
|
|
181
|
+
// Processing status
|
|
182
|
+
if (this.state.statusMessage) {
|
|
183
|
+
const maxLen = Math.max(20, cols - 30);
|
|
184
|
+
const msg = this.state.statusMessage.length > maxLen
|
|
185
|
+
? `${this.state.statusMessage.slice(0, maxLen - 3)}...`
|
|
186
|
+
: this.state.statusMessage;
|
|
187
|
+
statusParts.push(theme.ui.muted(msg));
|
|
188
|
+
}
|
|
189
|
+
if (statusParts.length === 0) {
|
|
190
|
+
// Not processing and no status - nothing to show
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
193
|
+
const statusLine = statusParts.join(' │ ');
|
|
194
|
+
const separator = theme.ui.border('─'.repeat(separatorWidth));
|
|
195
|
+
// Write the 3-line pinned box
|
|
196
|
+
this.safeWrite(`\r${ANSI.CLEAR_LINE}${separator}\n`);
|
|
197
|
+
this.safeWrite(`${ANSI.CLEAR_LINE}${statusLine}\n`);
|
|
198
|
+
this.safeWrite(`${ANSI.CLEAR_LINE}${theme.ui.muted('>')} `);
|
|
199
|
+
this._lastRenderedHeight = 3;
|
|
200
|
+
}
|
|
201
|
+
catch {
|
|
202
|
+
// Silently handle render errors
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* Render persistent input during processing
|
|
207
|
+
*/
|
|
208
|
+
renderPersistentInput() {
|
|
209
|
+
if (!this.supportsRendering())
|
|
210
|
+
return;
|
|
211
|
+
const rows = this.writeStream.rows || 24;
|
|
212
|
+
const cols = Math.max(this.writeStream.columns || 80, 40);
|
|
213
|
+
// Save cursor position
|
|
214
|
+
this.safeWrite(ANSI.SAVE_CURSOR);
|
|
215
|
+
// Move to the reserved bottom area (outside scroll region)
|
|
216
|
+
this.safeWrite(ANSI.CURSOR_TO_BOTTOM(rows - 1));
|
|
217
|
+
// Build status line
|
|
218
|
+
const queueCount = this.state.queuedCommands.length;
|
|
219
|
+
let statusText = '';
|
|
220
|
+
if (this.state.isProcessing) {
|
|
221
|
+
const queuePart = queueCount > 0 ? ` (${queueCount} queued)` : '';
|
|
222
|
+
statusText = `🔄 AI is streaming...${queuePart} [Enter: queue additional prompts]`;
|
|
223
|
+
}
|
|
224
|
+
else if (this.state.statusMessage) {
|
|
225
|
+
statusText = this.state.statusMessage;
|
|
226
|
+
}
|
|
227
|
+
else if (queueCount > 0) {
|
|
228
|
+
statusText = `${queueCount} follow-up${queueCount === 1 ? '' : 's'} queued`;
|
|
229
|
+
}
|
|
230
|
+
// Render separator and status on bottom lines
|
|
231
|
+
const separatorWidth = Math.min(cols - 2, 72);
|
|
232
|
+
const separator = theme.ui.border('─'.repeat(separatorWidth));
|
|
233
|
+
// Line rows-1: separator
|
|
234
|
+
this.safeWrite(ANSI.CLEAR_LINE);
|
|
235
|
+
this.safeWrite(separator);
|
|
236
|
+
// Line rows: input line with prompt or status
|
|
237
|
+
this.safeWrite(`\n${ANSI.CLEAR_LINE}`);
|
|
238
|
+
// Show actual input line during processing so user can see what they're typing
|
|
239
|
+
const promptPrefix = theme.ui.muted('> ');
|
|
240
|
+
const currentInput = this.inputBuffer;
|
|
241
|
+
const maxInputDisplay = cols - 4;
|
|
242
|
+
// Truncate input if too long, showing end of input
|
|
243
|
+
let displayInput = currentInput;
|
|
244
|
+
if (displayInput.length > maxInputDisplay) {
|
|
245
|
+
displayInput = '…' + displayInput.slice(-(maxInputDisplay - 1));
|
|
246
|
+
}
|
|
247
|
+
// Render prompt + input
|
|
248
|
+
this.safeWrite(promptPrefix);
|
|
249
|
+
this.safeWrite(displayInput);
|
|
250
|
+
// Show status hint on the right if there's room
|
|
251
|
+
if (statusText && currentInput.length < maxInputDisplay - statusText.length - 5) {
|
|
252
|
+
const padding = cols - 3 - currentInput.length - statusText.length - 3;
|
|
253
|
+
if (padding > 3) {
|
|
254
|
+
this.safeWrite(' '.repeat(padding));
|
|
255
|
+
this.safeWrite(theme.ui.muted(statusText.slice(0, cols - currentInput.length - 6)));
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
// Restore cursor to scroll region
|
|
259
|
+
this.safeWrite(ANSI.RESTORE_CURSOR);
|
|
260
|
+
}
|
|
261
|
+
// ... (other methods remain largely the same as PinnedChatBox)
|
|
262
|
+
supportsRendering() {
|
|
263
|
+
return this.isEnabled &&
|
|
264
|
+
!this.isDisposed &&
|
|
265
|
+
this.writeStream.writable &&
|
|
266
|
+
this.writeStream.isTTY;
|
|
267
|
+
}
|
|
268
|
+
safeWrite(content) {
|
|
269
|
+
try {
|
|
270
|
+
if (this.writeStream.writable) {
|
|
271
|
+
this.writeStream.write(content);
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
catch {
|
|
275
|
+
// Swallow write errors
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
sanitizeCommandText(text) {
|
|
279
|
+
return text
|
|
280
|
+
.replace(this.ansiPattern, '')
|
|
281
|
+
.replace(this.oscPattern, '')
|
|
282
|
+
.trim();
|
|
283
|
+
}
|
|
284
|
+
sanitizeStatusMessage(message) {
|
|
285
|
+
if (!message)
|
|
286
|
+
return null;
|
|
287
|
+
return message
|
|
288
|
+
.replace(this.ansiPattern, '')
|
|
289
|
+
.replace(this.oscPattern, '')
|
|
290
|
+
.slice(0, this.maxStatusMessageLength);
|
|
291
|
+
}
|
|
292
|
+
addToHistory(entry) {
|
|
293
|
+
if (!entry.trim())
|
|
294
|
+
return;
|
|
295
|
+
const existingIndex = this.inputHistory.indexOf(entry);
|
|
296
|
+
if (existingIndex >= 0) {
|
|
297
|
+
this.inputHistory.splice(existingIndex, 1);
|
|
298
|
+
}
|
|
299
|
+
this.inputHistory.push(entry);
|
|
300
|
+
if (this.inputHistory.length > this.maxHistorySize) {
|
|
301
|
+
this.inputHistory = this.inputHistory.slice(-this.maxHistorySize);
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
setEnabled(enabled) {
|
|
305
|
+
if (this.isDisposed)
|
|
306
|
+
return;
|
|
307
|
+
if (!enabled && this.isEnabled) {
|
|
308
|
+
this.clear();
|
|
309
|
+
}
|
|
310
|
+
this.isEnabled = enabled;
|
|
311
|
+
if (enabled) {
|
|
312
|
+
this.scheduleRender();
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
setProcessing(isProcessing) {
|
|
316
|
+
if (this.isDisposed)
|
|
317
|
+
return;
|
|
318
|
+
this.state.isProcessing = isProcessing;
|
|
319
|
+
this.scheduleRender();
|
|
320
|
+
}
|
|
321
|
+
setContextUsage(percentage) {
|
|
322
|
+
if (this.isDisposed)
|
|
323
|
+
return;
|
|
324
|
+
const value = Number.isFinite(percentage) ? percentage : 0;
|
|
325
|
+
this.state.contextUsage = Math.max(0, Math.min(100, value));
|
|
326
|
+
}
|
|
327
|
+
setStatusMessage(message) {
|
|
328
|
+
if (this.isDisposed)
|
|
329
|
+
return;
|
|
330
|
+
this.state.statusMessage = this.sanitizeStatusMessage(message);
|
|
331
|
+
this.scheduleRender();
|
|
332
|
+
}
|
|
333
|
+
queueCommand(text, type = 'request') {
|
|
334
|
+
if (this.isDisposed)
|
|
335
|
+
return null;
|
|
336
|
+
if (typeof text !== 'string')
|
|
337
|
+
return null;
|
|
338
|
+
const sanitizedText = this.sanitizeCommandText(text);
|
|
339
|
+
if (!sanitizedText)
|
|
340
|
+
return null;
|
|
341
|
+
if (this.state.queuedCommands.length >= this.maxQueueSize) {
|
|
342
|
+
const idx = this.state.queuedCommands.findIndex(c => c.type !== 'slash');
|
|
343
|
+
if (idx >= 0) {
|
|
344
|
+
this.state.queuedCommands.splice(idx, 1);
|
|
345
|
+
}
|
|
346
|
+
else {
|
|
347
|
+
return null;
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
const truncated = sanitizedText.slice(0, this.maxInputLength);
|
|
351
|
+
const preview = truncated.length > 60 ? `${truncated.slice(0, 57)}...` : truncated;
|
|
352
|
+
const cmd = {
|
|
353
|
+
id: `cmd-${++this.commandIdCounter}`,
|
|
354
|
+
text: truncated,
|
|
355
|
+
type,
|
|
356
|
+
timestamp: Date.now(),
|
|
357
|
+
preview,
|
|
358
|
+
};
|
|
359
|
+
this.state.queuedCommands.push(cmd);
|
|
360
|
+
this.scheduleRender();
|
|
361
|
+
if (this.onCommandQueued) {
|
|
362
|
+
this.onCommandQueued(cmd);
|
|
363
|
+
}
|
|
364
|
+
return cmd;
|
|
365
|
+
}
|
|
366
|
+
clearQueue() {
|
|
367
|
+
if (this.isDisposed)
|
|
368
|
+
return;
|
|
369
|
+
this.state.que;
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
//# sourceMappingURL=enhancedPinnedChatBox.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"enhancedPinnedChatBox.js","sourceRoot":"","sources":["../../src/ui/enhancedPinnedChatBox.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAmBjC,MAAM,OAAO,qBAAqB;IACxB,WAAW,CAAqB;IAChC,KAAK,CAAqB;IAC1B,aAAa,GAAW,CAAC,CAAC;IAC1B,mBAAmB,GAAW,CAAC,CAAC;IAChC,WAAW,GAAW,EAAE,CAAC;IACzB,cAAc,GAAW,CAAC,CAAC;IAC3B,gBAAgB,GAAW,CAAC,CAAC;IAC7B,eAAe,CAAgC;IAC/C,aAAa,CAA2B;IACxC,eAAe,GAAY,KAAK,CAAC;IACjC,SAAS,GAAY,IAAI,CAAC;IAC1B,UAAU,GAAY,KAAK,CAAC;IAC5B,cAAc,GAAW,CAAC,CAAC;I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,8 +182,8 @@ export declare class PinnedChatBox {
|
|
|
182
182
|
private pendingAfterWriteRender;
|
|
183
183
|
/**
|
|
184
184
|
* Register with the display's output interceptor system.
|
|
185
|
-
*
|
|
186
|
-
*
|
|
185
|
+
* With scroll regions, output flows in the scrollable area while
|
|
186
|
+
* the input stays pinned at the bottom.
|
|
187
187
|
*/
|
|
188
188
|
registerOutputInterceptor(display: {
|
|
189
189
|
registerOutputInterceptor: (i: {
|
|
@@ -241,6 +241,7 @@ export declare class PinnedChatBox {
|
|
|
241
241
|
setEnabled(enabled: boolean): void;
|
|
242
242
|
/**
|
|
243
243
|
* Set processing state
|
|
244
|
+
* Enables scroll region during processing to keep input visible while streaming
|
|
244
245
|
*/
|
|
245
246
|
setProcessing(isProcessing: boolean): void;
|
|
246
247
|
/**
|
|
@@ -388,8 +389,8 @@ export declare class PinnedChatBox {
|
|
|
388
389
|
* Line 2: Status (⏳ Processing... or context info)
|
|
389
390
|
* Line 3: Muted prompt (> ) for queued input
|
|
390
391
|
*
|
|
391
|
-
*
|
|
392
|
-
*
|
|
392
|
+
* During processing with scroll region active, uses renderPersistentInput()
|
|
393
|
+
* to keep the input visible at the bottom while streaming continues above.
|
|
393
394
|
*/
|
|
394
395
|
render(): void;
|
|
395
396
|
/**
|