erosolar-cli 1.7.118 → 1.7.119

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.
Files changed (36) hide show
  1. package/dist/core/agent.js +4 -4
  2. package/dist/core/agent.js.map +1 -1
  3. package/dist/shell/systemPrompt.d.ts.map +1 -1
  4. package/dist/shell/systemPrompt.js +3 -4
  5. package/dist/shell/systemPrompt.js.map +1 -1
  6. package/dist/tools/editTools.d.ts.map +1 -1
  7. package/dist/tools/editTools.js +29 -6
  8. package/dist/tools/editTools.js.map +1 -1
  9. package/dist/tools/fileTools.d.ts.map +1 -1
  10. package/dist/tools/fileTools.js +2 -126
  11. package/dist/tools/fileTools.js.map +1 -1
  12. package/dist/ui/EnhancedPinnedChatBox.d.ts +2 -0
  13. package/dist/ui/EnhancedPinnedChatBox.d.ts.map +1 -0
  14. package/dist/ui/EnhancedPinnedChatBox.js +3 -0
  15. package/dist/ui/EnhancedPinnedChatBox.js.map +1 -0
  16. package/dist/ui/persistentPrompt.d.ts +27 -2
  17. package/dist/ui/persistentPrompt.d.ts.map +1 -1
  18. package/dist/ui/persistentPrompt.js +189 -70
  19. package/dist/ui/persistentPrompt.js.map +1 -1
  20. package/package.json +1 -1
  21. package/dist/shell/enhancedInteractiveShell.d.ts +0 -56
  22. package/dist/shell/enhancedInteractiveShell.d.ts.map +0 -1
  23. package/dist/shell/enhancedInteractiveShell.js +0 -110
  24. package/dist/shell/enhancedInteractiveShell.js.map +0 -1
  25. package/dist/shell/enhancedShellApp.d.ts +0 -25
  26. package/dist/shell/enhancedShellApp.d.ts.map +0 -1
  27. package/dist/shell/enhancedShellApp.js +0 -161
  28. package/dist/shell/enhancedShellApp.js.map +0 -1
  29. package/dist/ui/enhancedPinnedChatBox.d.ts +0 -171
  30. package/dist/ui/enhancedPinnedChatBox.d.ts.map +0 -1
  31. package/dist/ui/enhancedPinnedChatBox.js +0 -370
  32. package/dist/ui/enhancedPinnedChatBox.js.map +0 -1
  33. package/dist/ui/persistentChatBox.d.ts +0 -137
  34. package/dist/ui/persistentChatBox.d.ts.map +0 -1
  35. package/dist/ui/persistentChatBox.js +0 -298
  36. package/dist/ui/persistentChatBox.js.map +0 -1
@@ -1,370 +0,0 @@
1
- /**
2
- * Enhanced Pinned Chat Box - Persistent chat input during AI streaming
3
- *
4
- * Enhanced features:
5
- * - Always visible at bottom during AI streaming
6
- * - Supports typing while AI is streaming responses
7
- * - Gracefully handles long pastes without errors
8
- * - Only submits to AI when user hits enter key
9
- * - Integrates with existing multiline paste handler
10
- * - Shows paste summaries for large content
11
- * - Input history navigation with up/down arrows
12
- * - Visual feedback during streaming
13
- */
14
- import { theme } from './theme.js';
15
- import { processPaste, isMultilinePaste } from '../core/multilinePasteHandler.js';
16
- export class EnhancedPinnedChatBox {
17
- writeStream;
18
- config;
19
- state;
20
- onSubmit;
21
- onCancel;
22
- isActive = false;
23
- inputBuffer = '';
24
- cursorPosition = 0;
25
- history = [];
26
- historyIndex = -1;
27
- tempCurrentInput = '';
28
- isPasteMode = false;
29
- pasteBuffer = '';
30
- renderScheduled = false;
31
- lastRenderTime = 0;
32
- renderThrottleMs = 16; // ~60fps max
33
- constructor(writeStream, onSubmit, onCancel, config = {}) {
34
- this.writeStream = writeStream;
35
- this.onSubmit = onSubmit;
36
- this.onCancel = onCancel;
37
- this.config = {
38
- enabled: true,
39
- position: 1,
40
- maxLines: 3,
41
- showPasteSummaries: true,
42
- autoScroll: true,
43
- maxInputLength: 10000,
44
- maxHistorySize: 100,
45
- ...config,
46
- };
47
- this.state = {
48
- input: '',
49
- isStreaming: false,
50
- isTyping: false,
51
- isPasteMode: false,
52
- cursorPosition: 0,
53
- history: [],
54
- historyIndex: -1,
55
- statusMessage: null,
56
- isProcessing: false,
57
- };
58
- }
59
- /**
60
- * Handle character input
61
- */
62
- handleInput(char) {
63
- if (!this.isActive)
64
- return;
65
- // Detect paste by checking for multiple lines or large content
66
- if (char.includes('\n') && char.length > 100) {
67
- this.handlePaste(char);
68
- return;
69
- }
70
- // Normal character input
71
- this.handleNormalInput(char);
72
- }
73
- /**
74
- * Handle normal character input
75
- */
76
- handleNormalInput(char) {
77
- // Respect max input length
78
- const availableSpace = this.config.maxInputLength - this.inputBuffer.length;
79
- if (availableSpace <= 0)
80
- return;
81
- const chunk = char.slice(0, availableSpace);
82
- if (!chunk)
83
- return;
84
- // Insert character at cursor position
85
- this.inputBuffer =
86
- this.inputBuffer.slice(0, this.cursorPosition) +
87
- chunk +
88
- this.inputBuffer.slice(this.cursorPosition);
89
- this.cursorPosition = Math.min(this.cursorPosition + chunk.length, this.inputBuffer.length);
90
- this.updateState();
91
- this.scheduleRender();
92
- }
93
- /**
94
- * Handle paste input
95
- */
96
- handlePaste(content) {
97
- this.isPasteMode = true;
98
- this.pasteBuffer = content;
99
- if (this.config.showPasteSummaries && isMultilinePaste(content)) {
100
- const processed = processPaste(content);
101
- this.setStatusMessage(processed.displaySummary);
102
- }
103
- else {
104
- this.setStatusMessage('📋 Paste detected - Press Enter to submit');
105
- }
106
- this.updateState();
107
- this.scheduleRender();
108
- }
109
- /**
110
- * Submit current input
111
- */
112
- submit() {
113
- if (!this.isActive)
114
- return;
115
- let inputToSubmit;
116
- if (this.isPasteMode) {
117
- // Submit paste content
118
- inputToSubmit = this.pasteBuffer;
119
- this.clearPasteMode();
120
- }
121
- else {
122
- // Submit normal input
123
- inputToSubmit = this.inputBuffer.trim();
124
- if (!inputToSubmit)
125
- return;
126
- // Add to history
127
- this.addToHistory(inputToSubmit);
128
- }
129
- // Clear input
130
- this.clearInput();
131
- // Submit to AI
132
- this.onSubmit(inputToSubmit);
133
- }
134
- /**
135
- * Cancel current input or paste
136
- */
137
- cancel() {
138
- if (this.isPasteMode) {
139
- // Cancel paste mode
140
- this.clearPasteMode();
141
- this.setStatusMessage('Paste cancelled');
142
- }
143
- else {
144
- // Call cancel callback
145
- this.onCancel();
146
- }
147
- }
148
- /**
149
- * Handle history navigation - up
150
- */
151
- navigateHistoryUp() {
152
- if (this.history.length === 0)
153
- return;
154
- if (this.historyIndex === -1) {
155
- // Start navigating history, save current input
156
- this.tempCurrentInput = this.inputBuffer;
157
- this.historyIndex = 0;
158
- }
159
- else if (this.historyIndex < this.history.length - 1) {
160
- this.historyIndex++;
161
- }
162
- const historyItem = this.history[this.historyIndex];
163
- this.setInput(historyItem);
164
- }
165
- /**
166
- * Handle history navigation - down
167
- */
168
- navigateHistoryDown() {
169
- if (this.historyIndex === -1)
170
- return;
171
- if (this.historyIndex > 0) {
172
- this.historyIndex--;
173
- const historyItem = this.history[this.historyIndex];
174
- this.setInput(historyItem);
175
- }
176
- else if (this.historyIndex === 0) {
177
- // Back to original input
178
- this.historyIndex = -1;
179
- this.setInput(this.tempCurrentInput);
180
- this.tempCurrentInput = '';
181
- }
182
- }
183
- /**
184
- * Set input text
185
- */
186
- setInput(text, cursorPos) {
187
- this.inputBuffer = text.slice(0, this.config.maxInputLength);
188
- this.cursorPosition = typeof cursorPos === 'number'
189
- ? Math.max(0, Math.min(cursorPos, this.inputBuffer.length))
190
- : this.inputBuffer.length;
191
- this.updateState();
192
- this.scheduleRender();
193
- }
194
- /**
195
- * Clear input
196
- */
197
- clearInput() {
198
- this.inputBuffer = '';
199
- this.cursorPosition = 0;
200
- this.historyIndex = -1;
201
- this.tempCurrentInput = '';
202
- this.updateState();
203
- this.scheduleRender();
204
- }
205
- /**
206
- * Clear paste mode
207
- */
208
- clearPasteMode() {
209
- this.isPasteMode = false;
210
- this.pasteBuffer = '';
211
- this.clearStatusMessage();
212
- }
213
- /**
214
- * Add input to history
215
- */
216
- addToHistory(input) {
217
- if (input.trim() && this.history[0] !== input.trim()) {
218
- this.history.unshift(input.trim());
219
- if (this.history.length > this.config.maxHistorySize) {
220
- this.history.pop();
221
- }
222
- }
223
- }
224
- /**
225
- * Set status message
226
- */
227
- setStatusMessage(message) {
228
- this.state.statusMessage = message;
229
- this.updateState();
230
- this.scheduleRender();
231
- }
232
- /**
233
- * Clear status message
234
- */
235
- clearStatusMessage() {
236
- this.state.statusMessage = null;
237
- this.updateState();
238
- this.scheduleRender();
239
- }
240
- /**
241
- * Update internal state
242
- */
243
- updateState() {
244
- this.state.input = this.inputBuffer;
245
- this.state.cursorPosition = this.cursorPosition;
246
- this.state.isPasteMode = this.isPasteMode;
247
- this.state.historyIndex = this.historyIndex;
248
- }
249
- /**
250
- * Set streaming state
251
- */
252
- setStreaming(isStreaming) {
253
- this.state.isStreaming = isStreaming;
254
- this.scheduleRender();
255
- }
256
- /**
257
- * Set processing state
258
- */
259
- setProcessing(isProcessing) {
260
- this.state.isProcessing = isProcessing;
261
- this.scheduleRender();
262
- }
263
- /**
264
- * Activate the chat box
265
- */
266
- activate() {
267
- if (this.isActive)
268
- return;
269
- this.isActive = true;
270
- this.clearInput();
271
- this.setStatusMessage('Type while AI streams - Press Enter to send');
272
- // Initial render
273
- this.forceRender();
274
- }
275
- /**
276
- * Deactivate the chat box
277
- */
278
- deactivate() {
279
- this.isActive = false;
280
- this.clearStatusMessage();
281
- }
282
- /**
283
- * Schedule render (throttled)
284
- */
285
- scheduleRender() {
286
- if (this.renderScheduled)
287
- return;
288
- this.renderScheduled = true;
289
- setTimeout(() => {
290
- this.renderScheduled = false;
291
- this.render();
292
- }, this.renderThrottleMs);
293
- }
294
- /**
295
- * Force immediate render
296
- */
297
- forceRender() {
298
- this.render();
299
- }
300
- /**
301
- * Render the chat box
302
- */
303
- render() {
304
- if (!this.isActive)
305
- return;
306
- const now = Date.now();
307
- if (now - this.lastRenderTime < this.renderThrottleMs) {
308
- return;
309
- }
310
- this.lastRenderTime = now;
311
- // Clear the status area
312
- this.writeStream.write('\x1B[s'); // Save cursor position
313
- // Move to bottom position
314
- this.writeStream.write(`\x1B[${this.config.position}B`);
315
- this.writeStream.write('\x1B[2K\r'); // Clear line
316
- // Render status message if present
317
- if (this.state.statusMessage) {
318
- this.writeStream.write(`${theme.info(this.state.statusMessage)}\n`);
319
- this.writeStream.write('\x1B[2K\r'); // Clear next line
320
- }
321
- // Render input prompt
322
- let prompt;
323
- if (this.state.isStreaming) {
324
- prompt = `${theme.info('◉')} ${theme.ui.muted('Type while AI streams (Enter to send)')}: `;
325
- }
326
- else if (this.state.isProcessing) {
327
- prompt = `${theme.warning('◐')} ${theme.ui.muted('Processing...')}: `;
328
- }
329
- else {
330
- prompt = `${theme.success('>')} `;
331
- }
332
- // Render input with cursor
333
- const displayInput = this.isPasteMode
334
- ? `${theme.accent(this.inputBuffer)}`
335
- : this.inputBuffer;
336
- this.writeStream.write(`${prompt}${displayInput}`);
337
- // Position cursor
338
- const cursorOffset = prompt.length + this.cursorPosition;
339
- this.writeStream.write(`\x1B[${cursorOffset}G`);
340
- // Restore cursor position
341
- this.writeStream.write('\x1B[u');
342
- }
343
- /**
344
- * Get current state
345
- */
346
- getState() {
347
- return { ...this.state };
348
- }
349
- /**
350
- * Get config
351
- */
352
- getConfig() {
353
- return { ...this.config };
354
- }
355
- /**
356
- * Update config
357
- */
358
- updateConfig(config) {
359
- this.config = { ...this.config, ...config };
360
- }
361
- /**
362
- * Dispose of resources
363
- */
364
- dispose() {
365
- this.deactivate();
366
- this.clearInput();
367
- this.clearStatusMessage();
368
- }
369
- }
370
- //# sourceMappingURL=EnhancedPinnedChatBox.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"EnhancedPinnedChatBox.js","sourceRoot":"","sources":["../../src/ui/EnhancedPinnedChatBox.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAgC,YAAY,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AA4ChH,MAAM,OAAO,qBAAqB;IACxB,WAAW,CAAqB;IAChC,MAAM,CAAwB;IAC9B,KAAK,CAAuB;IAC5B,QAAQ,CAAgC;IACxC,QAAQ,CAAgC;IACxC,QAAQ,GAAY,KAAK,CAAC;IAC1B,WAAW,GAAW,EAAE,CAAC;IACzB,cAA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ACF"}
@@ -1,137 +0,0 @@
1
- /**
2
- * Persistent Chat Box - Stays at bottom during AI streaming
3
- *
4
- * Features:
5
- * - Always visible at bottom of terminal
6
- * - Supports typing while AI is streaming
7
- * - Gracefully handles long pastes without errors
8
- * - Only submits to AI when user hits enter key
9
- * - Integrates with existing multiline paste handler
10
- */
11
- export interface PersistentChatBoxConfig {
12
- /** Whether chat box is enabled */
13
- enabled: boolean;
14
- /** Position from bottom (lines) */
15
- position: number;
16
- /** Maximum lines for chat box display */
17
- maxLines: number;
18
- /** Whether to show paste summaries */
19
- showPasteSummaries: boolean;
20
- /** Whether to auto-scroll during streaming */
21
- autoScroll: boolean;
22
- }
23
- export interface ChatBoxState {
24
- /** Current input text */
25
- input: string;
26
- /** Whether AI is currently streaming */
27
- isStreaming: boolean;
28
- /** Whether user is currently typing */
29
- isTyping: boolean;
30
- /** Whether paste mode is active */
31
- isPasteMode: boolean;
32
- /** Cursor position */
33
- cursorPosition: number;
34
- /** History of inputs */
35
- history: string[];
36
- /** Current history index */
37
- historyIndex: number;
38
- }
39
- export type ChatBoxSubmitCallback = (input: string) => void;
40
- export type ChatBoxCancelCallback = () => void;
41
- export declare class PersistentChatBox {
42
- private rl;
43
- private config;
44
- private state;
45
- private onSubmit;
46
- private onCancel;
47
- private isActive;
48
- private originalPrompt;
49
- private pasteBuffer;
50
- private pasteMode;
51
- constructor(onSubmit: ChatBoxSubmitCallback, onCancel: ChatBoxCancelCallback, config?: Partial<PersistentChatBoxConfig>);
52
- /**
53
- * Setup readline event handlers
54
- */
55
- private setupEventHandlers;
56
- /**
57
- * Handle line input (when user presses enter)
58
- */
59
- private handleLineInput;
60
- /**
61
- * Handle normal text input
62
- */
63
- private handleNormalInput;
64
- /**
65
- * Handle paste completion
66
- */
67
- private handlePasteComplete;
68
- /**
69
- * Handle raw data input for paste detection
70
- */
71
- private handleDataInput;
72
- /**
73
- * Handle cancel (Ctrl+C)
74
- */
75
- private handleCancel;
76
- /**
77
- * Handle close
78
- */
79
- private handleClose;
80
- /**
81
- * Handle history navigation - up
82
- */
83
- private handleHistoryUp;
84
- /**
85
- * Handle history navigation - down
86
- */
87
- private handleHistoryDown;
88
- /**
89
- * Update the readline prompt
90
- */
91
- private updatePrompt;
92
- /**
93
- * Set input text
94
- */
95
- private setInput;
96
- /**
97
- * Clear input
98
- */
99
- private clearInput;
100
- /**
101
- * Get default prompt based on streaming state
102
- */
103
- private getDefaultPrompt;
104
- /**
105
- * Activate the chat box
106
- */
107
- activate(): void;
108
- /**
109
- * Deactivate the chat box
110
- */
111
- deactivate(): void;
112
- /**
113
- * Set streaming state
114
- */
115
- setStreaming(isStreaming: boolean): void;
116
- /**
117
- * Add message to history
118
- */
119
- addToHistory(message: string): void;
120
- /**
121
- * Get current state
122
- */
123
- getState(): ChatBoxState;
124
- /**
125
- * Get config
126
- */
127
- getConfig(): PersistentChatBoxConfig;
128
- /**
129
- * Update config
130
- */
131
- updateConfig(config: Partial<PersistentChatBoxConfig>): void;
132
- /**
133
- * Dispose of resources
134
- */
135
- dispose(): void;
136
- }
137
- //# sourceMappingURL=PersistentChatBox.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"PersistentChatBox.d.ts","sourceRoot":"","sources":["../../src/ui/PersistentChatBox.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAQH,MAAM,WAAW,uBAAuB;IACtC,kCAAkC;IAClC,OAAO,EAAE,OAAO,CAAC;IACjB,mCAAmC;IACnC,QAAQ,EAAE,MAAM,CAAC;IACjB,yCAAyC;IACzC,QAAQ,EAAE,MAAM,CAAC;IACjB,sCAAsC;IACtC,kBAAkB,EAAE,OAAO,CAAC;IAC5B,8CAA8C;IAC9C,UAAU,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,WAAW,YAAY;IAC3B,yBAAyB;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,wCAAwC;IACxC,WAAW,EAAE,OAAO,CAAC;IACrB,uCAAuC;IACvC,QAAQ,EAAE,OAAO,CAA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