erosolar-cli 1.7.155 → 1.7.157
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/README.md +7 -17
- package/agents/erosolar-code.rules.json +1 -111
- package/agents/general.rules.json +0 -6
- package/dist/bin/erosolar.js +0 -22
- package/dist/bin/erosolar.js.map +1 -1
- package/dist/bin/selfTest.js +2 -190
- package/dist/bin/selfTest.js.map +1 -1
- package/dist/core/agent.d.ts +0 -12
- package/dist/core/agent.d.ts.map +1 -1
- package/dist/core/agent.js +12 -75
- package/dist/core/agent.js.map +1 -1
- package/dist/core/contextManager.d.ts +1 -2
- package/dist/core/contextManager.d.ts.map +1 -1
- package/dist/core/contextManager.js +2 -11
- package/dist/core/contextManager.js.map +1 -1
- package/dist/core/multilinePasteHandler.d.ts +4 -8
- package/dist/core/multilinePasteHandler.d.ts.map +1 -1
- package/dist/core/multilinePasteHandler.js +17 -67
- package/dist/core/multilinePasteHandler.js.map +1 -1
- package/dist/core/preferences.js +2 -8
- package/dist/core/preferences.js.map +1 -1
- package/dist/core/resultVerification.d.ts +1 -1
- package/dist/core/resultVerification.d.ts.map +1 -1
- package/dist/core/resultVerification.js +10 -11
- package/dist/core/resultVerification.js.map +1 -1
- package/dist/core/schemaValidator.d.ts.map +1 -1
- package/dist/core/schemaValidator.js +1 -36
- package/dist/core/schemaValidator.js.map +1 -1
- package/dist/core/toolRuntime.d.ts +0 -61
- package/dist/core/toolRuntime.d.ts.map +1 -1
- package/dist/core/toolRuntime.js +1 -303
- package/dist/core/toolRuntime.js.map +1 -1
- package/dist/core/unified/schema.d.ts.map +1 -1
- package/dist/core/unified/schema.js +1 -34
- package/dist/core/unified/schema.js.map +1 -1
- package/dist/headless/headlessApp.d.ts.map +1 -1
- package/dist/headless/headlessApp.js +0 -3
- package/dist/headless/headlessApp.js.map +1 -1
- package/dist/providers/anthropicProvider.d.ts.map +1 -1
- package/dist/providers/anthropicProvider.js +1 -4
- package/dist/providers/anthropicProvider.js.map +1 -1
- package/dist/shell/bracketedPasteManager.d.ts.map +1 -1
- package/dist/shell/bracketedPasteManager.js +3 -5
- package/dist/shell/bracketedPasteManager.js.map +1 -1
- package/dist/shell/composableMessage.js +2 -2
- package/dist/shell/composableMessage.js.map +1 -1
- package/dist/shell/interactiveShell.d.ts +1 -6
- package/dist/shell/interactiveShell.d.ts.map +1 -1
- package/dist/shell/interactiveShell.js +95 -421
- package/dist/shell/interactiveShell.js.map +1 -1
- package/dist/shell/shellApp.d.ts.map +1 -1
- package/dist/shell/shellApp.js +0 -7
- package/dist/shell/shellApp.js.map +1 -1
- package/dist/shell/systemPrompt.js +5 -5
- package/dist/shell/systemPrompt.js.map +1 -1
- package/dist/tools/bashTools.d.ts +0 -8
- package/dist/tools/bashTools.d.ts.map +1 -1
- package/dist/tools/bashTools.js +5 -80
- package/dist/tools/bashTools.js.map +1 -1
- package/dist/tools/diffUtils.d.ts.map +1 -1
- package/dist/tools/diffUtils.js +8 -12
- package/dist/tools/diffUtils.js.map +1 -1
- package/dist/tools/editTools.d.ts.map +1 -1
- package/dist/tools/editTools.js +36 -386
- package/dist/tools/editTools.js.map +1 -1
- package/dist/tools/fileTools.d.ts.map +1 -1
- package/dist/tools/fileTools.js +130 -25
- package/dist/tools/fileTools.js.map +1 -1
- package/dist/ui/ShellUIAdapter.d.ts +0 -5
- package/dist/ui/ShellUIAdapter.d.ts.map +1 -1
- package/dist/ui/ShellUIAdapter.js +0 -21
- package/dist/ui/ShellUIAdapter.js.map +1 -1
- package/dist/ui/persistentPrompt.d.ts +10 -83
- package/dist/ui/persistentPrompt.d.ts.map +1 -1
- package/dist/ui/persistentPrompt.js +119 -521
- package/dist/ui/persistentPrompt.js.map +1 -1
- package/dist/ui/richText.js +4 -4
- package/dist/ui/richText.js.map +1 -1
- package/dist/ui/shortcutsHelp.d.ts.map +1 -1
- package/dist/ui/shortcutsHelp.js +13 -31
- package/dist/ui/shortcutsHelp.js.map +1 -1
- package/package.json +1 -4
- package/dist/ui/EnhancedPinnedChatBox.d.ts +0 -93
- package/dist/ui/EnhancedPinnedChatBox.d.ts.map +0 -1
- package/dist/ui/EnhancedPinnedChatBox.js +0 -309
- package/dist/ui/EnhancedPinnedChatBox.js.map +0 -1
- package/dist/ui/PinnedChatBoxEnhancer.d.ts +0 -88
- package/dist/ui/PinnedChatBoxEnhancer.d.ts.map +0 -1
- package/dist/ui/PinnedChatBoxEnhancer.js +0 -205
- package/dist/ui/PinnedChatBoxEnhancer.js.map +0 -1
|
@@ -1,309 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* EnhancedPinnedChatBox - Persistent chat box with streaming-aware input handling
|
|
3
|
-
*
|
|
4
|
-
* Features:
|
|
5
|
-
* - Supports typing while AI is streaming responses
|
|
6
|
-
* - Gracefully handles long pastes without submission errors
|
|
7
|
-
* - Only submits to AI when user hits Enter key
|
|
8
|
-
* - Maintains compatibility with existing Erosolar-cli interface
|
|
9
|
-
*/
|
|
10
|
-
import { PinnedChatBox } from './persistentPrompt.js';
|
|
11
|
-
export class EnhancedPinnedChatBox extends PinnedChatBox {
|
|
12
|
-
config;
|
|
13
|
-
isStreaming = false;
|
|
14
|
-
pasteBuffer = '';
|
|
15
|
-
pasteStartTime = 0;
|
|
16
|
-
pasteTimeoutId;
|
|
17
|
-
constructor(writeStream, config = {}) {
|
|
18
|
-
super(writeStream);
|
|
19
|
-
this.config = {
|
|
20
|
-
maxPasteLength: 5000,
|
|
21
|
-
enablePasteSummarization: true,
|
|
22
|
-
allowInputDuringStreaming: true,
|
|
23
|
-
promptText: '> ',
|
|
24
|
-
...config
|
|
25
|
-
};
|
|
26
|
-
// Override the default prompt text
|
|
27
|
-
this.updatePromptText(this.config.promptText);
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Set streaming state - allows/disallows input during streaming
|
|
31
|
-
*/
|
|
32
|
-
setStreamingState(isStreaming) {
|
|
33
|
-
this.isStreaming = isStreaming;
|
|
34
|
-
if (isStreaming && this.config.allowInputDuringStreaming) {
|
|
35
|
-
// Show a subtle indicator that AI is streaming
|
|
36
|
-
this.updateStatusBar({
|
|
37
|
-
message: 'AI is responding... (you can still type)'
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
else if (!isStreaming) {
|
|
41
|
-
// Clear streaming indicator
|
|
42
|
-
this.updateStatusBar({
|
|
43
|
-
message: undefined
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* Enhanced input handler that supports long pastes
|
|
49
|
-
*/
|
|
50
|
-
handleInput(input) {
|
|
51
|
-
// Check if this looks like a paste operation (multiple lines or rapid input)
|
|
52
|
-
const isPaste = this.detectPasteOperation(input);
|
|
53
|
-
if (isPaste && this.config.enablePasteSummarization) {
|
|
54
|
-
this.handlePasteInput(input);
|
|
55
|
-
}
|
|
56
|
-
else {
|
|
57
|
-
// Normal input handling
|
|
58
|
-
this.handleNormalInput(input);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* Detect if input is likely a paste operation
|
|
63
|
-
*/
|
|
64
|
-
detectPasteOperation(input) {
|
|
65
|
-
const now = Date.now();
|
|
66
|
-
const timeSinceLastInput = now - this.pasteStartTime;
|
|
67
|
-
// Multiple lines suggest paste
|
|
68
|
-
if (input.includes('\n')) {
|
|
69
|
-
return true;
|
|
70
|
-
}
|
|
71
|
-
// Rapid input suggests paste
|
|
72
|
-
if (timeSinceLastInput < 100 && input.length > 10) {
|
|
73
|
-
return true;
|
|
74
|
-
}
|
|
75
|
-
// Very long single line suggests paste
|
|
76
|
-
if (input.length > 100) {
|
|
77
|
-
return true;
|
|
78
|
-
}
|
|
79
|
-
this.pasteStartTime = now;
|
|
80
|
-
return false;
|
|
81
|
-
}
|
|
82
|
-
/**
|
|
83
|
-
* Handle paste operations with summarization
|
|
84
|
-
*/
|
|
85
|
-
handlePasteInput(input) {
|
|
86
|
-
// Add to paste buffer
|
|
87
|
-
this.pasteBuffer += input;
|
|
88
|
-
// Clear any existing timeout
|
|
89
|
-
if (this.pasteTimeoutId) {
|
|
90
|
-
clearTimeout(this.pasteTimeoutId);
|
|
91
|
-
}
|
|
92
|
-
// Set timeout to process paste after user stops pasting
|
|
93
|
-
this.pasteTimeoutId = setTimeout(() => {
|
|
94
|
-
this.processPasteBuffer();
|
|
95
|
-
}, 500); // Wait 500ms after last paste input
|
|
96
|
-
// Show paste progress indicator
|
|
97
|
-
const pasteLength = this.pasteBuffer.length;
|
|
98
|
-
const lines = this.pasteBuffer.split('\n').length;
|
|
99
|
-
this.updateStatusBar({
|
|
100
|
-
message: `Pasting... (${pasteLength} chars, ${lines} lines)`
|
|
101
|
-
});
|
|
102
|
-
}
|
|
103
|
-
/**
|
|
104
|
-
* Process the accumulated paste buffer
|
|
105
|
-
*/
|
|
106
|
-
processPasteBuffer() {
|
|
107
|
-
if (!this.pasteBuffer)
|
|
108
|
-
return;
|
|
109
|
-
const pasteLength = this.pasteBuffer.length;
|
|
110
|
-
const lines = this.pasteBuffer.split('\n').length;
|
|
111
|
-
// Check if paste needs summarization
|
|
112
|
-
if (pasteLength > this.config.maxPasteLength && this.config.enablePasteSummarization) {
|
|
113
|
-
this.summarizeAndQueuePaste(this.pasteBuffer);
|
|
114
|
-
}
|
|
115
|
-
else {
|
|
116
|
-
// Queue the paste as-is
|
|
117
|
-
this.queueCommand({
|
|
118
|
-
command: this.pasteBuffer,
|
|
119
|
-
timestamp: Date.now(),
|
|
120
|
-
source: 'paste'
|
|
121
|
-
});
|
|
122
|
-
}
|
|
123
|
-
// Clear paste buffer and indicators
|
|
124
|
-
this.pasteBuffer = '';
|
|
125
|
-
this.updateStatusBar({
|
|
126
|
-
message: `Pasted ${pasteLength} chars, ${lines} lines (ready for Enter)`
|
|
127
|
-
});
|
|
128
|
-
// Clear the message after a delay
|
|
129
|
-
setTimeout(() => {
|
|
130
|
-
this.updateStatusBar({
|
|
131
|
-
message: undefined
|
|
132
|
-
});
|
|
133
|
-
}, 3000);
|
|
134
|
-
}
|
|
135
|
-
/**
|
|
136
|
-
* Summarize long pastes to avoid context overflow
|
|
137
|
-
*/
|
|
138
|
-
summarizeAndQueuePaste(content) {
|
|
139
|
-
const lines = content.split('\n');
|
|
140
|
-
const totalLines = lines.length;
|
|
141
|
-
const totalChars = content.length;
|
|
142
|
-
// Create a summary that preserves key information
|
|
143
|
-
const summary = this.createPasteSummary(content, lines);
|
|
144
|
-
// Queue the summarized version
|
|
145
|
-
this.queueCommand({
|
|
146
|
-
command: summary,
|
|
147
|
-
timestamp: Date.now(),
|
|
148
|
-
source: 'paste-summary',
|
|
149
|
-
metadata: {
|
|
150
|
-
originalLength: totalChars,
|
|
151
|
-
originalLines: totalLines,
|
|
152
|
-
summarizedLength: summary.length
|
|
153
|
-
}
|
|
154
|
-
});
|
|
155
|
-
// Show summary notification
|
|
156
|
-
this.updateStatusBar({
|
|
157
|
-
message: `Long paste summarized: ${totalChars} chars → ${summary.length} chars`
|
|
158
|
-
});
|
|
159
|
-
}
|
|
160
|
-
/**
|
|
161
|
-
* Create a smart summary of long paste content
|
|
162
|
-
*/
|
|
163
|
-
createPasteSummary(content, lines) {
|
|
164
|
-
const totalLines = lines.length;
|
|
165
|
-
const totalChars = content.length;
|
|
166
|
-
// For very long content, create a structured summary
|
|
167
|
-
if (totalChars > 10000) {
|
|
168
|
-
return this.createStructuredSummary(content, lines);
|
|
169
|
-
}
|
|
170
|
-
// For moderately long content, take first and last parts
|
|
171
|
-
const maxLines = Math.min(50, Math.floor(totalLines * 0.3));
|
|
172
|
-
const firstLines = lines.slice(0, maxLines).join('\n');
|
|
173
|
-
const lastLines = lines.slice(-maxLines).join('\n');
|
|
174
|
-
return `[PASTE SUMMARY - ${totalChars} chars, ${totalLines} lines]
|
|
175
|
-
${firstLines}
|
|
176
|
-
|
|
177
|
-
[... ${totalLines - (maxLines * 2)} lines omitted ...]
|
|
178
|
-
|
|
179
|
-
${lastLines}
|
|
180
|
-
|
|
181
|
-
[End of paste - ${totalChars} total characters]`;
|
|
182
|
-
}
|
|
183
|
-
/**
|
|
184
|
-
* Create structured summary for very long pastes
|
|
185
|
-
*/
|
|
186
|
-
createStructuredSummary(content, lines) {
|
|
187
|
-
const totalLines = lines.length;
|
|
188
|
-
const totalChars = content.length;
|
|
189
|
-
// Analyze content type
|
|
190
|
-
const isCode = this.detectCodeContent(content);
|
|
191
|
-
const isLog = this.detectLogContent(content);
|
|
192
|
-
let summary = `[LONG PASTE SUMMARY - ${totalChars} chars, ${totalLines} lines]\n`;
|
|
193
|
-
if (isCode) {
|
|
194
|
-
summary += `Content type: Code\n`;
|
|
195
|
-
// Include file headers and key functions
|
|
196
|
-
const fileHeaders = lines.filter(line => line.includes('import ') ||
|
|
197
|
-
line.includes('export ') ||
|
|
198
|
-
line.includes('function ') ||
|
|
199
|
-
line.includes('class ')).slice(0, 10);
|
|
200
|
-
if (fileHeaders.length > 0) {
|
|
201
|
-
summary += `Key elements:\n${fileHeaders.join('\n')}\n`;
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
else if (isLog) {
|
|
205
|
-
summary += `Content type: Log file\n`;
|
|
206
|
-
// Include first and last log entries
|
|
207
|
-
const firstLogs = lines.slice(0, 5).join('\n');
|
|
208
|
-
const lastLogs = lines.slice(-5).join('\n');
|
|
209
|
-
summary += `First entries:\n${firstLogs}\n\nLast entries:\n${lastLogs}\n`;
|
|
210
|
-
}
|
|
211
|
-
else {
|
|
212
|
-
// Text content - include first and last paragraphs
|
|
213
|
-
const firstPart = lines.slice(0, 10).join('\n');
|
|
214
|
-
const lastPart = lines.slice(-10).join('\n');
|
|
215
|
-
summary += `First part:\n${firstPart}\n\nLast part:\n${lastPart}\n`;
|
|
216
|
-
}
|
|
217
|
-
summary += `\n[Use '/full' command to see complete content if needed]`;
|
|
218
|
-
return summary;
|
|
219
|
-
}
|
|
220
|
-
/**
|
|
221
|
-
* Detect if content is code
|
|
222
|
-
*/
|
|
223
|
-
detectCodeContent(content) {
|
|
224
|
-
const codeIndicators = [
|
|
225
|
-
'function ', 'class ', 'import ', 'export ', 'const ', 'let ', 'var ',
|
|
226
|
-
'if (', 'for (', 'while (', 'return ', '=>', '{', '}', ';'
|
|
227
|
-
];
|
|
228
|
-
return codeIndicators.some(indicator => content.includes(indicator));
|
|
229
|
-
}
|
|
230
|
-
/**
|
|
231
|
-
* Detect if content is log data
|
|
232
|
-
*/
|
|
233
|
-
detectLogContent(content) {
|
|
234
|
-
const logIndicators = [
|
|
235
|
-
'ERROR', 'WARN', 'INFO', 'DEBUG',
|
|
236
|
-
'\t', ' ', ' ', // Common log indentation
|
|
237
|
-
'at ', 'Exception:', 'Error:'
|
|
238
|
-
];
|
|
239
|
-
return logIndicators.some(indicator => content.includes(indicator));
|
|
240
|
-
}
|
|
241
|
-
/**
|
|
242
|
-
* Handle normal (non-paste) input
|
|
243
|
-
*/
|
|
244
|
-
handleNormalInput(input) {
|
|
245
|
-
// Clear any pending paste operations
|
|
246
|
-
if (this.pasteTimeoutId) {
|
|
247
|
-
clearTimeout(this.pasteTimeoutId);
|
|
248
|
-
this.pasteTimeoutId = undefined;
|
|
249
|
-
}
|
|
250
|
-
this.pasteBuffer = '';
|
|
251
|
-
// Handle Enter key submission
|
|
252
|
-
if (input === '\n' || input === '\r') {
|
|
253
|
-
this.handleEnterKey();
|
|
254
|
-
}
|
|
255
|
-
else {
|
|
256
|
-
// Update input display
|
|
257
|
-
this.updateInput(input, input.length);
|
|
258
|
-
}
|
|
259
|
-
}
|
|
260
|
-
/**
|
|
261
|
-
* Handle Enter key - only submit when user explicitly presses Enter
|
|
262
|
-
*/
|
|
263
|
-
handleEnterKey() {
|
|
264
|
-
const currentInput = this.getCurrentInput();
|
|
265
|
-
if (currentInput.trim()) {
|
|
266
|
-
// Queue the command for processing
|
|
267
|
-
this.queueCommand({
|
|
268
|
-
command: currentInput,
|
|
269
|
-
timestamp: Date.now(),
|
|
270
|
-
source: 'manual'
|
|
271
|
-
});
|
|
272
|
-
// Clear input after queuing
|
|
273
|
-
this.updateInput('', 0);
|
|
274
|
-
}
|
|
275
|
-
}
|
|
276
|
-
/**
|
|
277
|
-
* Get current input text
|
|
278
|
-
*/
|
|
279
|
-
getCurrentInput() {
|
|
280
|
-
// Access the protected/private input buffer
|
|
281
|
-
// This might need adjustment based on the actual PinnedChatBox implementation
|
|
282
|
-
return this.inputBuffer || '';
|
|
283
|
-
}
|
|
284
|
-
/**
|
|
285
|
-
* Enhanced dispose method
|
|
286
|
-
*/
|
|
287
|
-
dispose() {
|
|
288
|
-
// Clear any pending timeouts
|
|
289
|
-
if (this.pasteTimeoutId) {
|
|
290
|
-
clearTimeout(this.pasteTimeoutId);
|
|
291
|
-
this.pasteTimeoutId = undefined;
|
|
292
|
-
}
|
|
293
|
-
// Call parent dispose
|
|
294
|
-
super.dispose();
|
|
295
|
-
}
|
|
296
|
-
/**
|
|
297
|
-
* Check if input is allowed (respects streaming state)
|
|
298
|
-
*/
|
|
299
|
-
isInputAllowed() {
|
|
300
|
-
return this.config.allowInputDuringStreaming || !this.isStreaming;
|
|
301
|
-
}
|
|
302
|
-
/**
|
|
303
|
-
* Get current streaming state
|
|
304
|
-
*/
|
|
305
|
-
getStreamingState() {
|
|
306
|
-
return this.isStreaming;
|
|
307
|
-
}
|
|
308
|
-
} // Test file
|
|
309
|
-
//# sourceMappingURL=EnhancedPinnedChatBox.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"EnhancedPinnedChatBox.js","sourceRoot":"","sources":["../../src/ui/EnhancedPinnedChatBox.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,aAAa,EAA+C,MAAM,uBAAuB,CAAC;AAcnG,MAAM,OAAO,qBAAsB,SAAQ,aAAa;IAC9C,MAAM,CAAwC;IAC9C,WAAW,GAAY,KAAK,CAAC;IAC7B,WAAW,GAAW,EAAE,CAAC;IACzB,cAAc,GAAW,CAAC,CAAC;IAC3B,cAAc,CAAkB;I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
|
-
*
|
|
4
|
-
* This enhancer can be used to upgrade existing PinnedChatBox instances
|
|
5
|
-
* without requiring major code changes to the interactive shell.
|
|
6
|
-
*/
|
|
7
|
-
import { PinnedChatBox } from './persistentPrompt.js';
|
|
8
|
-
import { EnhancedPinnedChatBox, type EnhancedPinnedChatBoxConfig } from './EnhancedPinnedChatBox.js';
|
|
9
|
-
export interface PatchOptions {
|
|
10
|
-
/** Replace the original chat box completely */
|
|
11
|
-
replaceOriginal?: boolean;
|
|
12
|
-
/** Enhanced configuration */
|
|
13
|
-
config?: EnhancedPinnedChatBoxConfig;
|
|
14
|
-
/** Callback when streaming state changes */
|
|
15
|
-
onStreamingStateChange?: (isStreaming: boolean) => void;
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Enhanced PinnedChatBox with patched methods
|
|
19
|
-
*/
|
|
20
|
-
export declare class PatchedPinnedChatBox extends PinnedChatBox {
|
|
21
|
-
private enhancedChatBox;
|
|
22
|
-
private enhancedMethods;
|
|
23
|
-
private originalMethods;
|
|
24
|
-
private isEnhanced;
|
|
25
|
-
constructor(original: PinnedChatBox, enhancedChatBox: EnhancedPinnedChatBox);
|
|
26
|
-
/**
|
|
27
|
-
* Patch methods to use enhanced functionality
|
|
28
|
-
*/
|
|
29
|
-
private patchMethods;
|
|
30
|
-
/**
|
|
31
|
-
* Patch a specific method
|
|
32
|
-
*/
|
|
33
|
-
private patchMethod;
|
|
34
|
-
/**
|
|
35
|
-
* Get the underlying enhanced chat box
|
|
36
|
-
*/
|
|
37
|
-
getEnhancedChatBox(): EnhancedPinnedChatBox;
|
|
38
|
-
/**
|
|
39
|
-
* Check if patching was successful
|
|
40
|
-
*/
|
|
41
|
-
isPatched(): boolean;
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* Main enhancer class that handles patching
|
|
45
|
-
*/
|
|
46
|
-
export declare class PinnedChatBoxEnhancer {
|
|
47
|
-
private originalChatBox?;
|
|
48
|
-
private enhancedChatBox?;
|
|
49
|
-
private patchedChatBox?;
|
|
50
|
-
private isPatched;
|
|
51
|
-
/**
|
|
52
|
-
* Patch an existing PinnedChatBox instance
|
|
53
|
-
*/
|
|
54
|
-
patch(originalChatBox: PinnedChatBox, options?: PatchOptions): PinnedChatBox;
|
|
55
|
-
/**
|
|
56
|
-
* Create a new enhanced chat box (alternative to patching)
|
|
57
|
-
*/
|
|
58
|
-
createEnhanced(config?: EnhancedPinnedChatBoxConfig): EnhancedPinnedChatBox;
|
|
59
|
-
/**
|
|
60
|
-
* Set streaming state on the enhanced chat box
|
|
61
|
-
*/
|
|
62
|
-
setStreamingState(isStreaming: boolean): void;
|
|
63
|
-
/**
|
|
64
|
-
* Get the enhanced chat box instance
|
|
65
|
-
*/
|
|
66
|
-
getEnhancedChatBox(): EnhancedPinnedChatBox | undefined;
|
|
67
|
-
/**
|
|
68
|
-
* Get the patched chat box instance
|
|
69
|
-
*/
|
|
70
|
-
getPatchedChatBox(): PatchedPinnedChatBox | undefined;
|
|
71
|
-
/**
|
|
72
|
-
* Check if patching was successful
|
|
73
|
-
*/
|
|
74
|
-
isPatched(): boolean;
|
|
75
|
-
/**
|
|
76
|
-
* Revert to original chat box
|
|
77
|
-
*/
|
|
78
|
-
revert(): PinnedChatBox | undefined;
|
|
79
|
-
/**
|
|
80
|
-
* Dispose of all resources
|
|
81
|
-
*/
|
|
82
|
-
dispose(): void;
|
|
83
|
-
}
|
|
84
|
-
export declare function getGlobalEnhancer(): PinnedChatBoxEnhancer;
|
|
85
|
-
export declare function patchPinnedChatBox(originalChatBox: PinnedChatBox, options?: PatchOptions): PinnedChatBox;
|
|
86
|
-
export declare function setStreamingState(isStreaming: boolean): void;
|
|
87
|
-
export declare function disposeEnhancer(): void;
|
|
88
|
-
//# sourceMappingURL=PinnedChatBoxEnhancer.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PinnedChatBoxEnhancer.d.ts","sourceRoot":"","sources":["../../src/ui/PinnedChatBoxEn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;;OAEG;IACH,iBAAiB,IAAI,oBAAoB,GAAG,SAAS;IAIrD;;OAEG;IACH,SAAS,IAAI,OAAO;IAIpB;;OAEG;IACH,MAAM,IAAI,aAAa,GAAG,SAAS;IAiBnC;;OAEG;IACH,OAAO,IAAI,IAAI;CAUhB;AAOD,wBAAgB,iBAAiB,IAAI,qBAAqB,CAKzD;AAED,wBAAgB,kBAAkB,CAChC,eAAe,EAAE,aAAa,EAC9B,OAAO,GAAE,YAAiB,GACzB,aAAa,CAGf;AAED,wBAAgB,iBAAiB,CAAC,WAAW,EAAE,OAAO,GAAG,IAAI,CAG5D;AAED,wBAAgB,eAAe,IAAI,IAAI,CAKtC"}
|
|
@@ -1,205 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* PinnedChatBoxEnhancer - Patches existing PinnedChatBox to add enhanced features
|
|
3
|
-
*
|
|
4
|
-
* This enhancer can be used to upgrade existing PinnedChatBox instances
|
|
5
|
-
* without requiring major code changes to the interactive shell.
|
|
6
|
-
*/
|
|
7
|
-
import { PinnedChatBox } from './persistentPrompt.js';
|
|
8
|
-
import { EnhancedPinnedChatBox } from './EnhancedPinnedChatBox.js';
|
|
9
|
-
/**
|
|
10
|
-
* Enhanced PinnedChatBox with patched methods
|
|
11
|
-
*/
|
|
12
|
-
export class PatchedPinnedChatBox extends PinnedChatBox {
|
|
13
|
-
enhancedChatBox;
|
|
14
|
-
enhancedMethods = new Map();
|
|
15
|
-
originalMethods = new Map();
|
|
16
|
-
isEnhanced = false;
|
|
17
|
-
constructor(original, enhancedChatBox) {
|
|
18
|
-
// We need to work around the constructor limitation
|
|
19
|
-
// by patching methods on the existing instance
|
|
20
|
-
super(process.stdout); // This will be overridden
|
|
21
|
-
this.enhancedChatBox = enhancedChatBox;
|
|
22
|
-
// Copy all properties from original
|
|
23
|
-
Object.getOwnPropertyNames(original).forEach(prop => {
|
|
24
|
-
if (prop in this)
|
|
25
|
-
return; // Skip existing properties
|
|
26
|
-
const descriptor = Object.getOwnPropertyDescriptor(original, prop);
|
|
27
|
-
if (descriptor) {
|
|
28
|
-
Object.defineProperty(this, prop, descriptor);
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
|
-
this.patchMethods();
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Patch methods to use enhanced functionality
|
|
35
|
-
*/
|
|
36
|
-
patchMethods() {
|
|
37
|
-
// Patch handleInput to use enhanced input handling
|
|
38
|
-
this.patchMethod('handleInput', (input) => {
|
|
39
|
-
this.enhancedChatBox.handleInput(input);
|
|
40
|
-
});
|
|
41
|
-
// Patch dispose to clean up enhanced chat box
|
|
42
|
-
this.patchMethod('dispose', () => {
|
|
43
|
-
this.enhancedChatBox.dispose();
|
|
44
|
-
// Call original dispose if it exists
|
|
45
|
-
const originalDispose = this.originalMethods.get('dispose');
|
|
46
|
-
if (originalDispose) {
|
|
47
|
-
originalDispose.call(this);
|
|
48
|
-
}
|
|
49
|
-
});
|
|
50
|
-
// Patch queueCommand to route through enhanced chat box
|
|
51
|
-
this.patchMethod('queueCommand', (command) => {
|
|
52
|
-
this.enhancedChatBox.queueCommand(command);
|
|
53
|
-
});
|
|
54
|
-
// Patch updateInput to sync with enhanced chat box
|
|
55
|
-
this.patchMethod('updateInput', (input, cursorPos) => {
|
|
56
|
-
this.enhancedChatBox.updateInput(input, cursorPos);
|
|
57
|
-
});
|
|
58
|
-
// Patch updateStatusBar to sync with enhanced chat box
|
|
59
|
-
this.patchMethod('updateStatusBar', (state) => {
|
|
60
|
-
this.enhancedChatBox.updateStatusBar(state);
|
|
61
|
-
});
|
|
62
|
-
// Patch show/hide methods
|
|
63
|
-
this.patchMethod('show', () => {
|
|
64
|
-
this.enhancedChatBox.show();
|
|
65
|
-
});
|
|
66
|
-
this.patchMethod('hide', () => {
|
|
67
|
-
this.enhancedChatBox.hide();
|
|
68
|
-
});
|
|
69
|
-
this.isEnhanced = true;
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* Patch a specific method
|
|
73
|
-
*/
|
|
74
|
-
patchMethod(methodName, enhancedImpl) {
|
|
75
|
-
const originalMethod = this[methodName];
|
|
76
|
-
if (originalMethod && typeof originalMethod === 'function') {
|
|
77
|
-
this.originalMethods.set(methodName, originalMethod);
|
|
78
|
-
}
|
|
79
|
-
this[methodName] = enhancedImpl;
|
|
80
|
-
this.enhancedMethods.set(methodName, enhancedImpl);
|
|
81
|
-
}
|
|
82
|
-
/**
|
|
83
|
-
* Get the underlying enhanced chat box
|
|
84
|
-
*/
|
|
85
|
-
getEnhancedChatBox() {
|
|
86
|
-
return this.enhancedChatBox;
|
|
87
|
-
}
|
|
88
|
-
/**
|
|
89
|
-
* Check if patching was successful
|
|
90
|
-
*/
|
|
91
|
-
isPatched() {
|
|
92
|
-
return this.isEnhanced;
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
/**
|
|
96
|
-
* Main enhancer class that handles patching
|
|
97
|
-
*/
|
|
98
|
-
export class PinnedChatBoxEnhancer {
|
|
99
|
-
originalChatBox;
|
|
100
|
-
enhancedChatBox;
|
|
101
|
-
patchedChatBox;
|
|
102
|
-
isPatched = false;
|
|
103
|
-
/**
|
|
104
|
-
* Patch an existing PinnedChatBox instance
|
|
105
|
-
*/
|
|
106
|
-
patch(originalChatBox, options = {}) {
|
|
107
|
-
this.originalChatBox = originalChatBox;
|
|
108
|
-
// Create enhanced chat box
|
|
109
|
-
this.enhancedChatBox = new EnhancedPinnedChatBox(process.stdout, options.config);
|
|
110
|
-
// Create patched version
|
|
111
|
-
this.patchedChatBox = new PatchedPinnedChatBox(originalChatBox, this.enhancedChatBox);
|
|
112
|
-
this.isPatched = true;
|
|
113
|
-
// Set up streaming state callback
|
|
114
|
-
if (options.onStreamingStateChange) {
|
|
115
|
-
// We'll handle this through the enhanced chat box methods
|
|
116
|
-
}
|
|
117
|
-
return this.patchedChatBox;
|
|
118
|
-
}
|
|
119
|
-
/**
|
|
120
|
-
* Create a new enhanced chat box (alternative to patching)
|
|
121
|
-
*/
|
|
122
|
-
createEnhanced(config) {
|
|
123
|
-
this.enhancedChatBox = new EnhancedPinnedChatBox(process.stdout, config);
|
|
124
|
-
return this.enhancedChatBox;
|
|
125
|
-
}
|
|
126
|
-
/**
|
|
127
|
-
* Set streaming state on the enhanced chat box
|
|
128
|
-
*/
|
|
129
|
-
setStreamingState(isStreaming) {
|
|
130
|
-
if (this.enhancedChatBox) {
|
|
131
|
-
this.enhancedChatBox.setStreamingState(isStreaming);
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
/**
|
|
135
|
-
* Get the enhanced chat box instance
|
|
136
|
-
*/
|
|
137
|
-
getEnhancedChatBox() {
|
|
138
|
-
return this.enhancedChatBox;
|
|
139
|
-
}
|
|
140
|
-
/**
|
|
141
|
-
* Get the patched chat box instance
|
|
142
|
-
*/
|
|
143
|
-
getPatchedChatBox() {
|
|
144
|
-
return this.patchedChatBox;
|
|
145
|
-
}
|
|
146
|
-
/**
|
|
147
|
-
* Check if patching was successful
|
|
148
|
-
*/
|
|
149
|
-
isPatched() {
|
|
150
|
-
return this.isPatched;
|
|
151
|
-
}
|
|
152
|
-
/**
|
|
153
|
-
* Revert to original chat box
|
|
154
|
-
*/
|
|
155
|
-
revert() {
|
|
156
|
-
if (!this.originalChatBox) {
|
|
157
|
-
return undefined;
|
|
158
|
-
}
|
|
159
|
-
// Dispose enhanced chat box
|
|
160
|
-
if (this.enhancedChatBox) {
|
|
161
|
-
this.enhancedChatBox.dispose();
|
|
162
|
-
this.enhancedChatBox = undefined;
|
|
163
|
-
}
|
|
164
|
-
this.patchedChatBox = undefined;
|
|
165
|
-
this.isPatched = false;
|
|
166
|
-
return this.originalChatBox;
|
|
167
|
-
}
|
|
168
|
-
/**
|
|
169
|
-
* Dispose of all resources
|
|
170
|
-
*/
|
|
171
|
-
dispose() {
|
|
172
|
-
if (this.enhancedChatBox) {
|
|
173
|
-
this.enhancedChatBox.dispose();
|
|
174
|
-
this.enhancedChatBox = undefined;
|
|
175
|
-
}
|
|
176
|
-
this.originalChatBox = undefined;
|
|
177
|
-
this.patchedChatBox = undefined;
|
|
178
|
-
this.isPatched = false;
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
/**
|
|
182
|
-
* Global enhancer instance for easy access
|
|
183
|
-
*/
|
|
184
|
-
let globalEnhancer;
|
|
185
|
-
export function getGlobalEnhancer() {
|
|
186
|
-
if (!globalEnhancer) {
|
|
187
|
-
globalEnhancer = new PinnedChatBoxEnhancer();
|
|
188
|
-
}
|
|
189
|
-
return globalEnhancer;
|
|
190
|
-
}
|
|
191
|
-
export function patchPinnedChatBox(originalChatBox, options = {}) {
|
|
192
|
-
const enhancer = getGlobalEnhancer();
|
|
193
|
-
return enhancer.patch(originalChatBox, options);
|
|
194
|
-
}
|
|
195
|
-
export function setStreamingState(isStreaming) {
|
|
196
|
-
const enhancer = getGlobalEnhancer();
|
|
197
|
-
enhancer.setStreamingState(isStreaming);
|
|
198
|
-
}
|
|
199
|
-
export function disposeEnhancer() {
|
|
200
|
-
if (globalEnhancer) {
|
|
201
|
-
globalEnhancer.dispose();
|
|
202
|
-
globalEnhancer = undefined;
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
//# sourceMappingURL=PinnedChatBoxEnhancer.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PinnedChatBoxEnhancer.js","sourceRoot":"","sources":["../../src/ui/PinnedChatBoxEnhancer.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,aAAa,EAA+C,MAAM,uBAAuB,CAAC;AACnG,OAAO,EAAE,qBAAqB,EAAoC,MAAM,4BAA4B,CAAC;AAWrG;;GAEG;AACH,MAAM,OAAO,oBAAqB,SAAQ,aAAa;IAO3C;IANF,eAAe,GAA0B,IAAI,GAAG,EAAE,CAAC;IACnD,eAAe,GAA0B,IAAI,GAAG,EAAE,CAAC;IACnD,UAAU,GAAY,KAAK,CAAC;IAEpC,YACE,QAAuB,EACf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