erosolar-cli 1.7.161 → 1.7.162
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/security/tool-security-wrapper.js +3 -3
- package/dist/security/tool-security-wrapper.js.map +1 -1
- package/dist/shell/claudeCodeStreamHandler.d.ts +145 -0
- package/dist/shell/claudeCodeStreamHandler.d.ts.map +1 -0
- package/dist/shell/claudeCodeStreamHandler.js +312 -0
- package/dist/shell/claudeCodeStreamHandler.js.map +1 -0
- package/dist/shell/inputQueueManager.d.ts +144 -0
- package/dist/shell/inputQueueManager.d.ts.map +1 -0
- package/dist/shell/inputQueueManager.js +290 -0
- package/dist/shell/inputQueueManager.js.map +1 -0
- package/dist/shell/interactiveShell.d.ts +12 -0
- package/dist/shell/interactiveShell.d.ts.map +1 -1
- package/dist/shell/interactiveShell.js +75 -18
- package/dist/shell/interactiveShell.js.map +1 -1
- package/dist/shell/streamingOutputManager.d.ts +88 -0
- package/dist/shell/streamingOutputManager.d.ts.map +1 -0
- package/dist/shell/streamingOutputManager.js +155 -0
- package/dist/shell/streamingOutputManager.js.map +1 -0
- package/dist/shell/systemPrompt.js +2 -2
- package/dist/shell/systemPrompt.js.map +1 -1
- package/dist/shell/taskCompletionDetector.d.ts.map +1 -1
- package/dist/shell/taskCompletionDetector.js +1 -3
- package/dist/shell/taskCompletionDetector.js.map +1 -1
- package/dist/tools/editTools.d.ts.map +1 -1
- package/dist/tools/editTools.js +32 -8
- package/dist/tools/editTools.js.map +1 -1
- package/dist/tools/fileTools.d.ts.map +1 -1
- package/dist/tools/fileTools.js +2 -126
- package/dist/tools/fileTools.js.map +1 -1
- package/dist/ui/toolDisplay.d.ts.map +1 -1
- package/dist/ui/toolDisplay.js +1 -3
- package/dist/ui/toolDisplay.js.map +1 -1
- package/dist/ui/toolDisplayAdapter.d.ts.map +1 -1
- package/dist/ui/toolDisplayAdapter.js +0 -3
- package/dist/ui/toolDisplayAdapter.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,290 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* InputQueueManager - Queue-based input handling for Claude Code style streaming
|
|
3
|
+
*
|
|
4
|
+
* Key principles from Claude Code:
|
|
5
|
+
* 1. Readline handles input - Uses Node.js readline module
|
|
6
|
+
* 2. User can type while streaming - Input is queued in memory, not rendered
|
|
7
|
+
* 3. Queue-based approach: User types → stored in queue → processed after streaming ends
|
|
8
|
+
*
|
|
9
|
+
* The key insight is that the cursor is never moved during streaming.
|
|
10
|
+
* Input is captured "invisibly" while streaming, then processed when streaming ends.
|
|
11
|
+
*/
|
|
12
|
+
import { EventEmitter } from 'node:events';
|
|
13
|
+
/**
|
|
14
|
+
* Manages input queuing during streaming output.
|
|
15
|
+
*
|
|
16
|
+
* When streaming is active:
|
|
17
|
+
* - Captures keystrokes into a buffer
|
|
18
|
+
* - On Enter, queues the input for later processing
|
|
19
|
+
* - Provides methods to process queue after streaming ends
|
|
20
|
+
*/
|
|
21
|
+
export class InputQueueManager extends EventEmitter {
|
|
22
|
+
state = {
|
|
23
|
+
isCapturing: false,
|
|
24
|
+
buffer: '',
|
|
25
|
+
cursorPosition: 0,
|
|
26
|
+
queue: [],
|
|
27
|
+
};
|
|
28
|
+
inputIdCounter = 0;
|
|
29
|
+
maxQueueSize;
|
|
30
|
+
maxBufferLength;
|
|
31
|
+
constructor(options = {}) {
|
|
32
|
+
super();
|
|
33
|
+
this.maxQueueSize = options.maxQueueSize ?? 100;
|
|
34
|
+
this.maxBufferLength = options.maxBufferLength ?? 10000;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Start capturing input (during streaming)
|
|
38
|
+
* Input will be buffered and queued, not immediately processed
|
|
39
|
+
*/
|
|
40
|
+
startCapturing() {
|
|
41
|
+
if (this.state.isCapturing) {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
this.state.isCapturing = true;
|
|
45
|
+
this.state.buffer = '';
|
|
46
|
+
this.state.cursorPosition = 0;
|
|
47
|
+
this.emit('capture-start');
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Stop capturing input (after streaming ends)
|
|
51
|
+
* Returns any remaining buffer content
|
|
52
|
+
*/
|
|
53
|
+
stopCapturing() {
|
|
54
|
+
const remaining = this.state.buffer;
|
|
55
|
+
this.state.isCapturing = false;
|
|
56
|
+
this.state.buffer = '';
|
|
57
|
+
this.state.cursorPosition = 0;
|
|
58
|
+
this.emit('capture-end');
|
|
59
|
+
return remaining;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Check if currently capturing input
|
|
63
|
+
*/
|
|
64
|
+
isCapturing() {
|
|
65
|
+
return this.state.isCapturing;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Handle a character input
|
|
69
|
+
* During capturing, adds to buffer; otherwise ignored
|
|
70
|
+
*/
|
|
71
|
+
handleChar(char) {
|
|
72
|
+
if (!this.state.isCapturing) {
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
// Respect buffer length limit
|
|
76
|
+
if (this.state.buffer.length >= this.maxBufferLength) {
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
// Insert at cursor position
|
|
80
|
+
this.state.buffer =
|
|
81
|
+
this.state.buffer.slice(0, this.state.cursorPosition) +
|
|
82
|
+
char +
|
|
83
|
+
this.state.buffer.slice(this.state.cursorPosition);
|
|
84
|
+
this.state.cursorPosition += char.length;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Handle backspace
|
|
88
|
+
*/
|
|
89
|
+
handleBackspace() {
|
|
90
|
+
if (!this.state.isCapturing || this.state.cursorPosition === 0) {
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
this.state.buffer =
|
|
94
|
+
this.state.buffer.slice(0, this.state.cursorPosition - 1) +
|
|
95
|
+
this.state.buffer.slice(this.state.cursorPosition);
|
|
96
|
+
this.state.cursorPosition = Math.max(0, this.state.cursorPosition - 1);
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Handle delete key
|
|
100
|
+
*/
|
|
101
|
+
handleDelete() {
|
|
102
|
+
if (!this.state.isCapturing || this.state.cursorPosition >= this.state.buffer.length) {
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
this.state.buffer =
|
|
106
|
+
this.state.buffer.slice(0, this.state.cursorPosition) +
|
|
107
|
+
this.state.buffer.slice(this.state.cursorPosition + 1);
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Handle cursor left
|
|
111
|
+
*/
|
|
112
|
+
handleCursorLeft() {
|
|
113
|
+
if (!this.state.isCapturing)
|
|
114
|
+
return;
|
|
115
|
+
this.state.cursorPosition = Math.max(0, this.state.cursorPosition - 1);
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Handle cursor right
|
|
119
|
+
*/
|
|
120
|
+
handleCursorRight() {
|
|
121
|
+
if (!this.state.isCapturing)
|
|
122
|
+
return;
|
|
123
|
+
this.state.cursorPosition = Math.min(this.state.buffer.length, this.state.cursorPosition + 1);
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Handle Enter - queue the current buffer
|
|
127
|
+
* Returns the queued input or null if buffer was empty
|
|
128
|
+
*/
|
|
129
|
+
handleSubmit() {
|
|
130
|
+
if (!this.state.isCapturing) {
|
|
131
|
+
return null;
|
|
132
|
+
}
|
|
133
|
+
const text = this.state.buffer.trim();
|
|
134
|
+
if (!text) {
|
|
135
|
+
return null;
|
|
136
|
+
}
|
|
137
|
+
// Check queue size limit
|
|
138
|
+
if (this.state.queue.length >= this.maxQueueSize) {
|
|
139
|
+
// Remove oldest non-command input to make room
|
|
140
|
+
const idx = this.state.queue.findIndex(q => q.type !== 'command');
|
|
141
|
+
if (idx >= 0) {
|
|
142
|
+
this.state.queue.splice(idx, 1);
|
|
143
|
+
}
|
|
144
|
+
else {
|
|
145
|
+
return null; // Queue is full of commands
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
const input = {
|
|
149
|
+
id: `input-${++this.inputIdCounter}`,
|
|
150
|
+
text,
|
|
151
|
+
timestamp: Date.now(),
|
|
152
|
+
type: text.startsWith('/') ? 'command' : 'message',
|
|
153
|
+
};
|
|
154
|
+
this.state.queue.push(input);
|
|
155
|
+
this.state.buffer = '';
|
|
156
|
+
this.state.cursorPosition = 0;
|
|
157
|
+
this.emit('input-queued', input);
|
|
158
|
+
return input;
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Handle Ctrl+C during capture - queue an interrupt
|
|
162
|
+
*/
|
|
163
|
+
handleInterrupt() {
|
|
164
|
+
const input = {
|
|
165
|
+
id: `input-${++this.inputIdCounter}`,
|
|
166
|
+
text: '',
|
|
167
|
+
timestamp: Date.now(),
|
|
168
|
+
type: 'interrupt',
|
|
169
|
+
};
|
|
170
|
+
// Interrupt goes to front of queue
|
|
171
|
+
this.state.queue.unshift(input);
|
|
172
|
+
this.state.buffer = '';
|
|
173
|
+
this.state.cursorPosition = 0;
|
|
174
|
+
this.emit('input-queued', input);
|
|
175
|
+
return input;
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Get current buffer contents (for display purposes)
|
|
179
|
+
*/
|
|
180
|
+
getBuffer() {
|
|
181
|
+
return this.state.buffer;
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* Get current cursor position
|
|
185
|
+
*/
|
|
186
|
+
getCursorPosition() {
|
|
187
|
+
return this.state.cursorPosition;
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Get the number of queued inputs
|
|
191
|
+
*/
|
|
192
|
+
getQueueLength() {
|
|
193
|
+
return this.state.queue.length;
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* Check if there are queued inputs
|
|
197
|
+
*/
|
|
198
|
+
hasQueuedInput() {
|
|
199
|
+
return this.state.queue.length > 0;
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Get the next queued input without removing it
|
|
203
|
+
*/
|
|
204
|
+
peekQueue() {
|
|
205
|
+
return this.state.queue[0];
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* Get and remove the next queued input
|
|
209
|
+
*/
|
|
210
|
+
dequeue() {
|
|
211
|
+
const input = this.state.queue.shift();
|
|
212
|
+
if (input) {
|
|
213
|
+
this.emit('input-processed', input);
|
|
214
|
+
}
|
|
215
|
+
return input;
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* Get all queued inputs (copy)
|
|
219
|
+
*/
|
|
220
|
+
getQueue() {
|
|
221
|
+
return [...this.state.queue];
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* Clear all queued inputs
|
|
225
|
+
*/
|
|
226
|
+
clearQueue() {
|
|
227
|
+
const hadItems = this.state.queue.length > 0;
|
|
228
|
+
this.state.queue = [];
|
|
229
|
+
if (hadItems) {
|
|
230
|
+
this.emit('queue-cleared');
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* Clear the current buffer
|
|
235
|
+
*/
|
|
236
|
+
clearBuffer() {
|
|
237
|
+
this.state.buffer = '';
|
|
238
|
+
this.state.cursorPosition = 0;
|
|
239
|
+
}
|
|
240
|
+
/**
|
|
241
|
+
* Set the buffer content directly (for paste handling)
|
|
242
|
+
*/
|
|
243
|
+
setBuffer(content, cursorPos) {
|
|
244
|
+
this.state.buffer = content.slice(0, this.maxBufferLength);
|
|
245
|
+
this.state.cursorPosition = cursorPos ?? this.state.buffer.length;
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* Get queue summary for display
|
|
249
|
+
*/
|
|
250
|
+
getQueueSummary() {
|
|
251
|
+
const count = this.state.queue.length;
|
|
252
|
+
if (count === 0) {
|
|
253
|
+
return '';
|
|
254
|
+
}
|
|
255
|
+
const commands = this.state.queue.filter(q => q.type === 'command').length;
|
|
256
|
+
const messages = this.state.queue.filter(q => q.type === 'message').length;
|
|
257
|
+
const interrupts = this.state.queue.filter(q => q.type === 'interrupt').length;
|
|
258
|
+
const parts = [];
|
|
259
|
+
if (interrupts > 0) {
|
|
260
|
+
parts.push(`${interrupts} interrupt${interrupts === 1 ? '' : 's'}`);
|
|
261
|
+
}
|
|
262
|
+
if (commands > 0) {
|
|
263
|
+
parts.push(`${commands} command${commands === 1 ? '' : 's'}`);
|
|
264
|
+
}
|
|
265
|
+
if (messages > 0) {
|
|
266
|
+
parts.push(`${messages} message${messages === 1 ? '' : 's'}`);
|
|
267
|
+
}
|
|
268
|
+
return parts.join(', ') + ' queued';
|
|
269
|
+
}
|
|
270
|
+
/**
|
|
271
|
+
* Get full state (for debugging)
|
|
272
|
+
*/
|
|
273
|
+
getState() {
|
|
274
|
+
return { ...this.state, queue: [...this.state.queue] };
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
/**
|
|
278
|
+
* Singleton instance for global use
|
|
279
|
+
*/
|
|
280
|
+
let globalInstance = null;
|
|
281
|
+
export function getInputQueueManager() {
|
|
282
|
+
if (!globalInstance) {
|
|
283
|
+
globalInstance = new InputQueueManager();
|
|
284
|
+
}
|
|
285
|
+
return globalInstance;
|
|
286
|
+
}
|
|
287
|
+
export function resetInputQueueManager() {
|
|
288
|
+
globalInstance = null;
|
|
289
|
+
}
|
|
290
|
+
//# sourceMappingURL=inputQueueManager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inputQueueManager.js","sourceRoot":"","sources":["../../src/shell/inputQueueManager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAwB3C;;;;;;;GAOG;AACH,MAAM,OAAO,iBAAkB,SAAQ,YAAY;IACzC,KAAK,GAAoB;QAC/B,WAAW,EAAE,KAAK;QAClB,MAAM,EAAE,EAAE;QACV,cAAc,EAAE,CAAC;QACjB,KAAK,EAAE,EAAE;KACV,CAAC;IAEM,cAAc,GAAG,CAAC,CAAC;IACV,Y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I,CAAC,GAAG,QAAQ,WAAW,QAAQ,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC;QAChE,CAAC;QAED,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,SAAS,CAAC;IACtC,CAAC;IAED;;OAEG;IACH,QAAQ;QACN,OAAO,EAAE,GAAG,IAAI,CAAC,KAAK,EAAE,KAAK,EAAE,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC;IACzD,CAAC;CACF;AAED;;GAEG;AACH,IAAI,cAAc,GAA6B,IAAI,CAAC;AAEpD,MAAM,UAAU,oBAAoB;IAClC,IAAI,CAAC,cAAc,EAAE,CAAC;QACpB,cAAc,GAAG,IAAI,iBAAiB,EAAE,CAAC;IAC3C,CAAC;IACD,OAAO,cAAc,CAAC;AACxB,CAAC;AAED,MAAM,UAAU,sBAAsB;IACpC,cAAc,GAAG,IAAI,CAAC;AACxB,CAAC"}
|
|
@@ -79,6 +79,7 @@ export declare class InteractiveShell {
|
|
|
79
79
|
private readonly pinnedChatBox;
|
|
80
80
|
private readlineOutputSuppressed;
|
|
81
81
|
private originalStdoutWrite;
|
|
82
|
+
private readonly streamHandler;
|
|
82
83
|
constructor(config: ShellConfig);
|
|
83
84
|
private initializeSessionHistory;
|
|
84
85
|
private showSessionResumeNotice;
|
|
@@ -116,10 +117,15 @@ export declare class InteractiveShell {
|
|
|
116
117
|
* Suppress readline's character echo during streaming.
|
|
117
118
|
* Characters typed will be captured but not echoed to the main output.
|
|
118
119
|
* Instead, they appear only in the persistent input box at the bottom.
|
|
120
|
+
*
|
|
121
|
+
* @deprecated Use streamHandler.startStreaming() instead - kept for backwards compatibility
|
|
122
|
+
* @internal Kept for legacy code paths that may still reference this method
|
|
119
123
|
*/
|
|
120
124
|
private suppressReadlineOutput;
|
|
121
125
|
/**
|
|
122
126
|
* Restore normal readline output after streaming completes.
|
|
127
|
+
*
|
|
128
|
+
* @deprecated Use streamHandler.endStreaming() instead
|
|
123
129
|
*/
|
|
124
130
|
private restoreReadlineOutput;
|
|
125
131
|
private enqueueUserInput;
|
|
@@ -156,6 +162,12 @@ export declare class InteractiveShell {
|
|
|
156
162
|
private refreshQueueIndicators;
|
|
157
163
|
private enqueueFollowUpAction;
|
|
158
164
|
private scheduleQueueProcessing;
|
|
165
|
+
/**
|
|
166
|
+
* Process any inputs that were queued during streaming.
|
|
167
|
+
* Claude Code style: User can type while streaming, input is stored in queue,
|
|
168
|
+
* processed after streaming ends.
|
|
169
|
+
*/
|
|
170
|
+
private processQueuedInputs;
|
|
159
171
|
private processQueuedActions;
|
|
160
172
|
private processInputBlock;
|
|
161
173
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interactiveShell.d.ts","sourceRoot":"","sources":["../../src/shell/interactiveShell.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAiCtE,OAAO,EAAE,YAAY,EAAE,KAAK,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAI/E,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAyB,KAAK,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAQtF,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"interactiveShell.d.ts","sourceRoot":"","sources":["../../src/shell/interactiveShell.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAiCtE,OAAO,EAAE,YAAY,EAAE,KAAK,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAI/E,OAAO,EAAE,iBAAiB,EAAE,MAAM,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A4B;IAUpC,OAAO,CAAC,wBAAwB;IAmBhC,OAAO,CAAC,aAAa;IAIrB,OAAO,CAAC,cAAc;IAQtB,OAAO,CAAC,iCAAiC;IAUzC,OAAO,CAAC,qBAAqB;IAyB7B,OAAO,CAAC,qBAAqB;IAuB7B,OAAO,CAAC,wBAAwB;IAUhC;;OAEG;YACW,qBAAqB;IA6DnC;;OAEG;YACW,qBAAqB;IAyCnC;;OAEG;IACH,OAAO,CAAC,uBAAuB;IA0B/B;;OAEG;YACW,kBAAkB;IAyBhC;;OAEG;YACW,kBAAkB;IA6EhC;;OAEG;IACH,OAAO,CAAC,aAAa;IAsBrB,OAAO,CAAC,wBAAwB;IAehC,OAAO,CAAC,yBAAyB;CAYlC"}
|
|
@@ -23,6 +23,7 @@ import { PersistentPrompt, PinnedChatBox } from '../ui/persistentPrompt.js';
|
|
|
23
23
|
import { formatShortcutsHelp } from '../ui/shortcutsHelp.js';
|
|
24
24
|
import { MetricsTracker } from '../alpha-zero/index.js';
|
|
25
25
|
import { listAvailablePlugins } from '../plugins/index.js';
|
|
26
|
+
import { getClaudeCodeStreamHandler } from './claudeCodeStreamHandler.js';
|
|
26
27
|
const DROPDOWN_COLORS = [
|
|
27
28
|
theme.primary,
|
|
28
29
|
theme.info,
|
|
@@ -114,6 +115,7 @@ export class InteractiveShell {
|
|
|
114
115
|
pinnedChatBox;
|
|
115
116
|
readlineOutputSuppressed = false;
|
|
116
117
|
originalStdoutWrite = null;
|
|
118
|
+
streamHandler;
|
|
117
119
|
constructor(config) {
|
|
118
120
|
this.profile = config.profile;
|
|
119
121
|
this.profileLabel = config.profileLabel;
|
|
@@ -226,6 +228,10 @@ export class InteractiveShell {
|
|
|
226
228
|
// This ensures the pinned area is cleared before output and re-rendered after,
|
|
227
229
|
// preventing ghost lines when the terminal scrolls
|
|
228
230
|
this.pinnedChatBox.registerOutputInterceptor(display);
|
|
231
|
+
// Initialize Claude Code style stream handler for natural output flow
|
|
232
|
+
// Key insight: No cursor manipulation during streaming - output just appends
|
|
233
|
+
this.streamHandler = getClaudeCodeStreamHandler();
|
|
234
|
+
this.streamHandler.attachToReadline(this.rl);
|
|
229
235
|
// Initialize Alpha Zero 2 metrics tracking
|
|
230
236
|
this.alphaZeroMetrics = new MetricsTracker(`${this.profile}-${Date.now()}`);
|
|
231
237
|
this.setupStatusTracking();
|
|
@@ -482,6 +488,8 @@ export class InteractiveShell {
|
|
|
482
488
|
this.pendingCleanup = null;
|
|
483
489
|
// Dispose persistent prompt
|
|
484
490
|
this.persistentPrompt.dispose();
|
|
491
|
+
// Dispose Claude Code stream handler
|
|
492
|
+
this.streamHandler.dispose();
|
|
485
493
|
// Dispose unified UI adapter
|
|
486
494
|
this.uiAdapter.dispose();
|
|
487
495
|
display.newLine();
|
|
@@ -786,14 +794,25 @@ export class InteractiveShell {
|
|
|
786
794
|
}
|
|
787
795
|
}
|
|
788
796
|
// Restore readline output if it was suppressed
|
|
789
|
-
this
|
|
797
|
+
// Note: Stream handler manages its own state, this is for legacy compatibility
|
|
798
|
+
if (!this.streamHandler.isStreaming()) {
|
|
799
|
+
this.restoreReadlineOutput();
|
|
800
|
+
}
|
|
790
801
|
}
|
|
791
802
|
/**
|
|
792
803
|
* Suppress readline's character echo during streaming.
|
|
793
804
|
* Characters typed will be captured but not echoed to the main output.
|
|
794
805
|
* Instead, they appear only in the persistent input box at the bottom.
|
|
806
|
+
*
|
|
807
|
+
* @deprecated Use streamHandler.startStreaming() instead - kept for backwards compatibility
|
|
808
|
+
* @internal Kept for legacy code paths that may still reference this method
|
|
795
809
|
*/
|
|
810
|
+
// @ts-expect-error - Legacy method kept for backwards compatibility, unused in favor of streamHandler
|
|
796
811
|
suppressReadlineOutput() {
|
|
812
|
+
// Delegate to stream handler if it's not already streaming
|
|
813
|
+
if (this.streamHandler.isStreaming()) {
|
|
814
|
+
return;
|
|
815
|
+
}
|
|
797
816
|
if (this.readlineOutputSuppressed || !output.isTTY) {
|
|
798
817
|
return;
|
|
799
818
|
}
|
|
@@ -850,6 +869,8 @@ export class InteractiveShell {
|
|
|
850
869
|
}
|
|
851
870
|
/**
|
|
852
871
|
* Restore normal readline output after streaming completes.
|
|
872
|
+
*
|
|
873
|
+
* @deprecated Use streamHandler.endStreaming() instead
|
|
853
874
|
*/
|
|
854
875
|
restoreReadlineOutput() {
|
|
855
876
|
if (!this.readlineOutputSuppressed || !this.originalStdoutWrite) {
|
|
@@ -1080,6 +1101,39 @@ export class InteractiveShell {
|
|
|
1080
1101
|
void this.processQueuedActions();
|
|
1081
1102
|
});
|
|
1082
1103
|
}
|
|
1104
|
+
/**
|
|
1105
|
+
* Process any inputs that were queued during streaming.
|
|
1106
|
+
* Claude Code style: User can type while streaming, input is stored in queue,
|
|
1107
|
+
* processed after streaming ends.
|
|
1108
|
+
*/
|
|
1109
|
+
processQueuedInputs() {
|
|
1110
|
+
if (!this.streamHandler.hasQueuedInput()) {
|
|
1111
|
+
return;
|
|
1112
|
+
}
|
|
1113
|
+
// Transfer queued inputs from stream handler to follow-up queue
|
|
1114
|
+
while (this.streamHandler.hasQueuedInput()) {
|
|
1115
|
+
const input = this.streamHandler.getNextQueuedInput();
|
|
1116
|
+
if (!input) {
|
|
1117
|
+
break;
|
|
1118
|
+
}
|
|
1119
|
+
// Handle interrupts specially
|
|
1120
|
+
if (input.type === 'interrupt') {
|
|
1121
|
+
// Interrupt was already processed during capture
|
|
1122
|
+
continue;
|
|
1123
|
+
}
|
|
1124
|
+
// Add to follow-up queue for processing
|
|
1125
|
+
const actionType = input.type === 'command' ? 'request' : 'request';
|
|
1126
|
+
this.followUpQueue.push({
|
|
1127
|
+
type: actionType,
|
|
1128
|
+
text: input.text,
|
|
1129
|
+
});
|
|
1130
|
+
}
|
|
1131
|
+
// Show queue summary if there are items
|
|
1132
|
+
const summary = this.streamHandler.getQueueSummary();
|
|
1133
|
+
if (summary) {
|
|
1134
|
+
display.showInfo(`📝 ${summary}`);
|
|
1135
|
+
}
|
|
1136
|
+
}
|
|
1083
1137
|
async processQueuedActions() {
|
|
1084
1138
|
if (this.isDrainingQueue || this.isProcessing || !this.followUpQueue.length) {
|
|
1085
1139
|
return;
|
|
@@ -2430,10 +2484,11 @@ export class InteractiveShell {
|
|
|
2430
2484
|
// Add visual separator between user prompt and AI response
|
|
2431
2485
|
display.newLine();
|
|
2432
2486
|
display.newLine();
|
|
2433
|
-
//
|
|
2434
|
-
|
|
2435
|
-
//
|
|
2436
|
-
|
|
2487
|
+
// Claude Code style: Start streaming mode
|
|
2488
|
+
// - Output flows naturally to stdout (no cursor manipulation)
|
|
2489
|
+
// - User input is queued in memory, not rendered
|
|
2490
|
+
// - After streaming ends, new prompt is shown at bottom
|
|
2491
|
+
this.streamHandler.startStreaming();
|
|
2437
2492
|
// Enable streaming for real-time text output (Claude Code style)
|
|
2438
2493
|
await agent.send(request, true);
|
|
2439
2494
|
await this.awaitPendingCleanup();
|
|
@@ -2451,10 +2506,11 @@ export class InteractiveShell {
|
|
|
2451
2506
|
}
|
|
2452
2507
|
}
|
|
2453
2508
|
finally {
|
|
2454
|
-
//
|
|
2455
|
-
|
|
2456
|
-
|
|
2457
|
-
|
|
2509
|
+
// Claude Code style: End streaming mode
|
|
2510
|
+
// This restores readline output and processes any queued input
|
|
2511
|
+
this.streamHandler.endStreaming();
|
|
2512
|
+
// Process any queued inputs that came in during streaming
|
|
2513
|
+
this.processQueuedInputs();
|
|
2458
2514
|
display.stopThinking(false);
|
|
2459
2515
|
this.isProcessing = false;
|
|
2460
2516
|
this.uiAdapter.endProcessing('Ready for prompts');
|
|
@@ -2517,10 +2573,10 @@ export class InteractiveShell {
|
|
|
2517
2573
|
display.showSystemMessage(`📊 Using intelligent task completion detection with AI verification.`);
|
|
2518
2574
|
this.uiAdapter.startProcessing('Continuous execution mode');
|
|
2519
2575
|
this.setProcessingStatus();
|
|
2520
|
-
//
|
|
2521
|
-
|
|
2522
|
-
//
|
|
2523
|
-
this.
|
|
2576
|
+
// Claude Code style: Start streaming mode
|
|
2577
|
+
// - Output flows naturally to stdout (no cursor manipulation)
|
|
2578
|
+
// - User input is queued in memory, not rendered
|
|
2579
|
+
this.streamHandler.startStreaming();
|
|
2524
2580
|
let iteration = 0;
|
|
2525
2581
|
let lastResponse = '';
|
|
2526
2582
|
let consecutiveNoProgress = 0;
|
|
@@ -2682,13 +2738,14 @@ What's the next action?`;
|
|
|
2682
2738
|
display.showSystemMessage(`\n🏁 Continuous execution completed: ${iteration} iterations, ${minutes}m ${seconds}s total`);
|
|
2683
2739
|
// Reset completion detector for next task
|
|
2684
2740
|
resetTaskCompletionDetector();
|
|
2685
|
-
//
|
|
2686
|
-
|
|
2741
|
+
// Claude Code style: End streaming mode
|
|
2742
|
+
// This restores readline output and processes any queued input
|
|
2743
|
+
this.streamHandler.endStreaming();
|
|
2744
|
+
// Process any queued inputs that came in during streaming
|
|
2745
|
+
this.processQueuedInputs();
|
|
2687
2746
|
this.isProcessing = false;
|
|
2688
2747
|
this.uiAdapter.endProcessing('Ready for prompts');
|
|
2689
2748
|
this.setIdleStatus();
|
|
2690
|
-
// Disable scroll region before output to restore normal terminal behavior
|
|
2691
|
-
this.pinnedChatBox.disableScrollRegion();
|
|
2692
2749
|
display.newLine();
|
|
2693
2750
|
// Clear the processing status and ensure persistent prompt is visible
|
|
2694
2751
|
this.persistentPrompt.updateStatusBar({ message: undefined });
|
|
@@ -2805,7 +2862,7 @@ What's the next action?`;
|
|
|
2805
2862
|
/(?:running|executing|called?|using)\s+(?:the\s+)?(\w+(?:_\w+)*)\s+tool/gi,
|
|
2806
2863
|
/tool[:\s]+(\w+(?:_\w+)*)/gi,
|
|
2807
2864
|
/⎿\s*(\w+)/g, // Tool result prefix pattern
|
|
2808
|
-
/(?:read_file|
|
|
2865
|
+
/(?:read_file|edit_file|Edit|bash|grep|glob|search)/gi,
|
|
2809
2866
|
];
|
|
2810
2867
|
for (const pattern of toolPatterns) {
|
|
2811
2868
|
let match;
|