erosolar-cli 1.7.243 → 1.7.245
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 +22 -148
- package/dist/core/customCommands.d.ts +1 -0
- package/dist/core/customCommands.d.ts.map +1 -1
- package/dist/core/customCommands.js +3 -0
- package/dist/core/customCommands.js.map +1 -1
- package/dist/core/toolPreconditions.d.ts.map +1 -1
- package/dist/core/toolPreconditions.js +0 -14
- package/dist/core/toolPreconditions.js.map +1 -1
- package/dist/core/toolRuntime.d.ts.map +1 -1
- package/dist/core/toolRuntime.js +0 -5
- package/dist/core/toolRuntime.js.map +1 -1
- package/dist/core/toolValidation.d.ts.map +1 -1
- package/dist/core/toolValidation.js +14 -3
- package/dist/core/toolValidation.js.map +1 -1
- package/dist/mcp/sseClient.d.ts.map +1 -1
- package/dist/mcp/sseClient.js +9 -18
- package/dist/mcp/sseClient.js.map +1 -1
- package/dist/plugins/tools/build/buildPlugin.d.ts +0 -6
- package/dist/plugins/tools/build/buildPlugin.d.ts.map +1 -1
- package/dist/plugins/tools/build/buildPlugin.js +4 -10
- package/dist/plugins/tools/build/buildPlugin.js.map +1 -1
- package/dist/shell/interactiveShell.d.ts +9 -2
- package/dist/shell/interactiveShell.d.ts.map +1 -1
- package/dist/shell/interactiveShell.js +133 -17
- package/dist/shell/interactiveShell.js.map +1 -1
- package/dist/shell/terminalInput.d.ts +46 -117
- package/dist/shell/terminalInput.d.ts.map +1 -1
- package/dist/shell/terminalInput.js +312 -541
- package/dist/shell/terminalInput.js.map +1 -1
- package/dist/shell/terminalInputAdapter.d.ts +12 -15
- package/dist/shell/terminalInputAdapter.d.ts.map +1 -1
- package/dist/shell/terminalInputAdapter.js +8 -22
- package/dist/shell/terminalInputAdapter.js.map +1 -1
- package/dist/ui/display.d.ts +19 -0
- package/dist/ui/display.d.ts.map +1 -1
- package/dist/ui/display.js +108 -0
- package/dist/ui/display.js.map +1 -1
- package/dist/ui/theme.d.ts.map +1 -1
- package/dist/ui/theme.js +6 -8
- package/dist/ui/theme.js.map +1 -1
- package/dist/ui/unified/layout.d.ts +1 -0
- package/dist/ui/unified/layout.d.ts.map +1 -1
- package/dist/ui/unified/layout.js +52 -25
- package/dist/ui/unified/layout.js.map +1 -1
- package/package.json +1 -1
- package/dist/core/aiFlowOptimizer.d.ts +0 -26
- package/dist/core/aiFlowOptimizer.d.ts.map +0 -1
- package/dist/core/aiFlowOptimizer.js +0 -31
- package/dist/core/aiFlowOptimizer.js.map +0 -1
- package/dist/core/aiOptimizationEngine.d.ts +0 -158
- package/dist/core/aiOptimizationEngine.d.ts.map +0 -1
- package/dist/core/aiOptimizationEngine.js +0 -428
- package/dist/core/aiOptimizationEngine.js.map +0 -1
- package/dist/core/aiOptimizationIntegration.d.ts +0 -93
- package/dist/core/aiOptimizationIntegration.d.ts.map +0 -1
- package/dist/core/aiOptimizationIntegration.js +0 -250
- package/dist/core/aiOptimizationIntegration.js.map +0 -1
- package/dist/core/enhancedErrorRecovery.d.ts +0 -100
- package/dist/core/enhancedErrorRecovery.d.ts.map +0 -1
- package/dist/core/enhancedErrorRecovery.js +0 -345
- package/dist/core/enhancedErrorRecovery.js.map +0 -1
- package/dist/shell/claudeCodeStreamHandler.d.ts +0 -145
- package/dist/shell/claudeCodeStreamHandler.d.ts.map +0 -1
- package/dist/shell/claudeCodeStreamHandler.js +0 -322
- package/dist/shell/claudeCodeStreamHandler.js.map +0 -1
- package/dist/shell/inputQueueManager.d.ts +0 -144
- package/dist/shell/inputQueueManager.d.ts.map +0 -1
- package/dist/shell/inputQueueManager.js +0 -290
- package/dist/shell/inputQueueManager.js.map +0 -1
- package/dist/shell/streamingOutputManager.d.ts +0 -115
- package/dist/shell/streamingOutputManager.d.ts.map +0 -1
- package/dist/shell/streamingOutputManager.js +0 -225
- package/dist/shell/streamingOutputManager.js.map +0 -1
- package/dist/ui/persistentPrompt.d.ts +0 -50
- package/dist/ui/persistentPrompt.d.ts.map +0 -1
- package/dist/ui/persistentPrompt.js +0 -92
- package/dist/ui/persistentPrompt.js.map +0 -1
|
@@ -1,345 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Enhanced Error Recovery System
|
|
3
|
-
*
|
|
4
|
-
* Provides intelligent error recovery with:
|
|
5
|
-
* - Multi-strategy error handling
|
|
6
|
-
* - Context-aware recovery actions
|
|
7
|
-
* - Progressive escalation
|
|
8
|
-
* - Learning from past recoveries
|
|
9
|
-
* - Integration with AI optimization engine
|
|
10
|
-
*
|
|
11
|
-
* @license MIT
|
|
12
|
-
* @author Bo Shang
|
|
13
|
-
*/
|
|
14
|
-
import { AIOptimizationEngine } from './aiOptimizationEngine.js';
|
|
15
|
-
export var RecoveryLevel;
|
|
16
|
-
(function (RecoveryLevel) {
|
|
17
|
-
RecoveryLevel["IMMEDIATE"] = "immediate";
|
|
18
|
-
RecoveryLevel["ASSISTED"] = "assisted";
|
|
19
|
-
RecoveryLevel["ESCALATED"] = "escalated";
|
|
20
|
-
RecoveryLevel["MANUAL"] = "manual"; // Full manual intervention required
|
|
21
|
-
})(RecoveryLevel || (RecoveryLevel = {}));
|
|
22
|
-
export class EnhancedErrorRecovery {
|
|
23
|
-
optimizationEngine;
|
|
24
|
-
recoveryHistory = [];
|
|
25
|
-
learnedPatterns = new Map();
|
|
26
|
-
constructor(options = {}) {
|
|
27
|
-
this.optimizationEngine = new AIOptimizationEngine(options);
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Analyze error and generate comprehensive recovery plan
|
|
31
|
-
*/
|
|
32
|
-
analyzeError(context) {
|
|
33
|
-
const errorAnalysis = this.analyzeErrorType(context.error);
|
|
34
|
-
const recoveryLevel = this.determineRecoveryLevel(context, errorAnalysis);
|
|
35
|
-
const primaryAction = this.generatePrimaryRecoveryAction(context, errorAnalysis);
|
|
36
|
-
const alternativeActions = this.generateAlternativeActions(context, errorAnalysis);
|
|
37
|
-
const estimatedTime = this.estimateRecoveryTime(context, errorAnalysis);
|
|
38
|
-
const successProbability = this.calculateSuccessProbability(context, errorAnalysis);
|
|
39
|
-
const rollbackPlan = this.generateRollbackPlan(context);
|
|
40
|
-
const validationSteps = this.generateValidationSteps(context);
|
|
41
|
-
return {
|
|
42
|
-
level: recoveryLevel,
|
|
43
|
-
primaryAction,
|
|
44
|
-
alternativeActions,
|
|
45
|
-
estimatedTime,
|
|
46
|
-
successProbability,
|
|
47
|
-
rollbackPlan,
|
|
48
|
-
validationSteps
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* Execute recovery plan with monitoring and learning
|
|
53
|
-
*/
|
|
54
|
-
async executeRecovery(plan, context) {
|
|
55
|
-
const startTime = Date.now();
|
|
56
|
-
let success = false;
|
|
57
|
-
let output = '';
|
|
58
|
-
let learnedPattern;
|
|
59
|
-
try {
|
|
60
|
-
// Execute primary action
|
|
61
|
-
if (plan.primaryAction.autoExecutable && !plan.primaryAction.requiresConfirmation) {
|
|
62
|
-
const result = await this.executeRecoveryAction(plan.primaryAction);
|
|
63
|
-
output = result.output;
|
|
64
|
-
success = result.success;
|
|
65
|
-
if (success) {
|
|
66
|
-
learnedPattern = this.extractPatternFromSuccess(context, plan.primaryAction);
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
// Record recovery attempt
|
|
70
|
-
const recoveryAttempt = {
|
|
71
|
-
timestamp: new Date(),
|
|
72
|
-
error: context.error,
|
|
73
|
-
recoveryAction: plan.primaryAction.action,
|
|
74
|
-
success,
|
|
75
|
-
durationMs: Date.now() - startTime,
|
|
76
|
-
learnedPattern
|
|
77
|
-
};
|
|
78
|
-
this.recoveryHistory.push(recoveryAttempt);
|
|
79
|
-
if (learnedPattern) {
|
|
80
|
-
this.learnedPatterns.set(context.errorType, learnedPattern);
|
|
81
|
-
}
|
|
82
|
-
return { success, output, learnedPattern };
|
|
83
|
-
}
|
|
84
|
-
catch (error) {
|
|
85
|
-
const recoveryAttempt = {
|
|
86
|
-
timestamp: new Date(),
|
|
87
|
-
error: context.error,
|
|
88
|
-
recoveryAction: plan.primaryAction.action,
|
|
89
|
-
success: false,
|
|
90
|
-
durationMs: Date.now() - startTime,
|
|
91
|
-
learnedPattern: `Failed recovery: ${error}`
|
|
92
|
-
};
|
|
93
|
-
this.recoveryHistory.push(recoveryAttempt);
|
|
94
|
-
return {
|
|
95
|
-
success: false,
|
|
96
|
-
output: `Recovery failed: ${error}`,
|
|
97
|
-
learnedPattern: `Avoid: ${plan.primaryAction.action} for ${context.errorType}`
|
|
98
|
-
};
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
/**
|
|
102
|
-
* Get recovery statistics and insights
|
|
103
|
-
*/
|
|
104
|
-
getRecoveryInsights() {
|
|
105
|
-
const totalRecoveries = this.recoveryHistory.length;
|
|
106
|
-
const successfulRecoveries = this.recoveryHistory.filter(r => r.success).length;
|
|
107
|
-
const successRate = totalRecoveries > 0 ? successfulRecoveries / totalRecoveries : 0;
|
|
108
|
-
const averageRecoveryTime = totalRecoveries > 0
|
|
109
|
-
? this.recoveryHistory.reduce((sum, r) => sum + r.durationMs, 0) / totalRecoveries
|
|
110
|
-
: 0;
|
|
111
|
-
const errorCounts = new Map();
|
|
112
|
-
this.recoveryHistory.forEach(r => {
|
|
113
|
-
errorCounts.set(r.error, (errorCounts.get(r.error) || 0) + 1);
|
|
114
|
-
});
|
|
115
|
-
const mostCommonErrors = Array.from(errorCounts.entries())
|
|
116
|
-
.sort((a, b) => b[1] - a[1])
|
|
117
|
-
.slice(0, 5)
|
|
118
|
-
.map(([error]) => error);
|
|
119
|
-
const learnedPatterns = Array.from(this.learnedPatterns.entries())
|
|
120
|
-
.map(([errorType, pattern]) => `${errorType}: ${pattern}`);
|
|
121
|
-
return {
|
|
122
|
-
totalRecoveries,
|
|
123
|
-
successRate,
|
|
124
|
-
averageRecoveryTime,
|
|
125
|
-
mostCommonErrors,
|
|
126
|
-
learnedPatterns
|
|
127
|
-
};
|
|
128
|
-
}
|
|
129
|
-
// Private implementation methods
|
|
130
|
-
analyzeErrorType(error) {
|
|
131
|
-
const errorLower = error.toLowerCase();
|
|
132
|
-
// Error categorization
|
|
133
|
-
let category = 'unknown';
|
|
134
|
-
let severity = 'medium';
|
|
135
|
-
let autoFixable = false;
|
|
136
|
-
const patterns = [];
|
|
137
|
-
// TypeScript/compilation errors
|
|
138
|
-
if (errorLower.includes('ts') && errorLower.includes('error')) {
|
|
139
|
-
category = 'compilation';
|
|
140
|
-
severity = 'high';
|
|
141
|
-
autoFixable = true;
|
|
142
|
-
patterns.push('typescript_error');
|
|
143
|
-
}
|
|
144
|
-
// Test failures
|
|
145
|
-
if (errorLower.includes('fail') && errorLower.includes('test')) {
|
|
146
|
-
category = 'test';
|
|
147
|
-
severity = 'medium';
|
|
148
|
-
autoFixable = false;
|
|
149
|
-
patterns.push('test_failure');
|
|
150
|
-
}
|
|
151
|
-
// File not found
|
|
152
|
-
if (errorLower.includes('file not found') || errorLower.includes('enoent')) {
|
|
153
|
-
category = 'file';
|
|
154
|
-
severity = 'medium';
|
|
155
|
-
autoFixable = true;
|
|
156
|
-
patterns.push('file_not_found');
|
|
157
|
-
}
|
|
158
|
-
// Permission errors
|
|
159
|
-
if (errorLower.includes('permission') || errorLower.includes('eacces')) {
|
|
160
|
-
category = 'permission';
|
|
161
|
-
severity = 'high';
|
|
162
|
-
autoFixable = false;
|
|
163
|
-
patterns.push('permission_error');
|
|
164
|
-
}
|
|
165
|
-
// Network errors
|
|
166
|
-
if (errorLower.includes('network') || errorLower.includes('connection')) {
|
|
167
|
-
category = 'network';
|
|
168
|
-
severity = 'medium';
|
|
169
|
-
autoFixable = false;
|
|
170
|
-
patterns.push('network_error');
|
|
171
|
-
}
|
|
172
|
-
return { category, severity, autoFixable, patterns };
|
|
173
|
-
}
|
|
174
|
-
determineRecoveryLevel(context, errorAnalysis) {
|
|
175
|
-
// Check if we have learned patterns for this error
|
|
176
|
-
if (this.learnedPatterns.has(context.errorType) && errorAnalysis.autoFixable) {
|
|
177
|
-
return RecoveryLevel.IMMEDIATE;
|
|
178
|
-
}
|
|
179
|
-
// Check severity and auto-fixability
|
|
180
|
-
if (errorAnalysis.severity === 'low' && errorAnalysis.autoFixable) {
|
|
181
|
-
return RecoveryLevel.IMMEDIATE;
|
|
182
|
-
}
|
|
183
|
-
if (errorAnalysis.severity === 'medium' && errorAnalysis.autoFixable) {
|
|
184
|
-
return RecoveryLevel.ASSISTED;
|
|
185
|
-
}
|
|
186
|
-
if (errorAnalysis.severity === 'high' || errorAnalysis.severity === 'critical') {
|
|
187
|
-
return RecoveryLevel.ESCALATED;
|
|
188
|
-
}
|
|
189
|
-
// Check recovery history for similar errors
|
|
190
|
-
const similarRecoveries = this.recoveryHistory.filter(r => r.error.includes(context.errorType) && r.success);
|
|
191
|
-
if (similarRecoveries.length > 0) {
|
|
192
|
-
return RecoveryLevel.ASSISTED;
|
|
193
|
-
}
|
|
194
|
-
return RecoveryLevel.MANUAL;
|
|
195
|
-
}
|
|
196
|
-
generatePrimaryRecoveryAction(context, errorAnalysis) {
|
|
197
|
-
// Use learned patterns if available
|
|
198
|
-
const learnedPattern = this.learnedPatterns.get(context.errorType);
|
|
199
|
-
if (learnedPattern) {
|
|
200
|
-
return this.parseLearnedPattern(learnedPattern, context);
|
|
201
|
-
}
|
|
202
|
-
// Generate based on error category
|
|
203
|
-
switch (errorAnalysis.category) {
|
|
204
|
-
case 'compilation':
|
|
205
|
-
return {
|
|
206
|
-
action: 'Run TypeScript validation to get detailed errors',
|
|
207
|
-
tool: 'validate_typescript',
|
|
208
|
-
parameters: {},
|
|
209
|
-
description: 'Get comprehensive TypeScript error details',
|
|
210
|
-
confidence: 0.9,
|
|
211
|
-
autoExecutable: true,
|
|
212
|
-
requiresConfirmation: false
|
|
213
|
-
};
|
|
214
|
-
case 'test':
|
|
215
|
-
return {
|
|
216
|
-
action: 'Run tests with detailed output',
|
|
217
|
-
tool: 'run_tests',
|
|
218
|
-
parameters: {},
|
|
219
|
-
description: 'Get detailed test failure information',
|
|
220
|
-
confidence: 0.8,
|
|
221
|
-
autoExecutable: true,
|
|
222
|
-
requiresConfirmation: false
|
|
223
|
-
};
|
|
224
|
-
case 'file':
|
|
225
|
-
return {
|
|
226
|
-
action: 'Search for similar files',
|
|
227
|
-
tool: 'search_files',
|
|
228
|
-
parameters: { pattern: '**/*' },
|
|
229
|
-
description: 'Find available files to understand project structure',
|
|
230
|
-
confidence: 0.7,
|
|
231
|
-
autoExecutable: true,
|
|
232
|
-
requiresConfirmation: false
|
|
233
|
-
};
|
|
234
|
-
case 'permission':
|
|
235
|
-
return {
|
|
236
|
-
action: 'Check file permissions',
|
|
237
|
-
tool: 'execute_bash',
|
|
238
|
-
parameters: { command: 'ls -la' },
|
|
239
|
-
description: 'Check file permissions and ownership',
|
|
240
|
-
confidence: 0.6,
|
|
241
|
-
autoExecutable: true,
|
|
242
|
-
requiresConfirmation: true
|
|
243
|
-
};
|
|
244
|
-
default:
|
|
245
|
-
return {
|
|
246
|
-
action: 'Analyze current state',
|
|
247
|
-
tool: 'execute_bash',
|
|
248
|
-
parameters: { command: 'git status && npm run type-check' },
|
|
249
|
-
description: 'Get comprehensive system state information',
|
|
250
|
-
confidence: 0.5,
|
|
251
|
-
autoExecutable: true,
|
|
252
|
-
requiresConfirmation: false
|
|
253
|
-
};
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
generateAlternativeActions(context, errorAnalysis) {
|
|
257
|
-
const alternatives = [];
|
|
258
|
-
// Add rollback alternative for destructive operations
|
|
259
|
-
if (context.currentState.filesModified.length > 0) {
|
|
260
|
-
alternatives.push({
|
|
261
|
-
action: 'Rollback all changes',
|
|
262
|
-
tool: 'execute_bash',
|
|
263
|
-
parameters: { command: 'git reset --hard HEAD' },
|
|
264
|
-
description: 'Revert all changes to last known good state',
|
|
265
|
-
confidence: 1.0,
|
|
266
|
-
autoExecutable: true,
|
|
267
|
-
requiresConfirmation: true
|
|
268
|
-
});
|
|
269
|
-
}
|
|
270
|
-
// Add validation alternative
|
|
271
|
-
alternatives.push({
|
|
272
|
-
action: 'Run comprehensive validation',
|
|
273
|
-
tool: 'validate_all_changes',
|
|
274
|
-
parameters: {},
|
|
275
|
-
description: 'Run full validation suite to identify all issues',
|
|
276
|
-
confidence: 0.8,
|
|
277
|
-
autoExecutable: true,
|
|
278
|
-
requiresConfirmation: false
|
|
279
|
-
});
|
|
280
|
-
return alternatives.slice(0, 3); // Return top 3 alternatives
|
|
281
|
-
}
|
|
282
|
-
estimateRecoveryTime(context, errorAnalysis) {
|
|
283
|
-
const baseTimes = {
|
|
284
|
-
compilation: 30,
|
|
285
|
-
test: 60,
|
|
286
|
-
file: 15,
|
|
287
|
-
permission: 45,
|
|
288
|
-
network: 120,
|
|
289
|
-
unknown: 30
|
|
290
|
-
};
|
|
291
|
-
return baseTimes[errorAnalysis.category];
|
|
292
|
-
}
|
|
293
|
-
calculateSuccessProbability(context, errorAnalysis) {
|
|
294
|
-
let probability = 0.5;
|
|
295
|
-
// Adjust based on error category
|
|
296
|
-
const categoryProbabilities = {
|
|
297
|
-
compilation: 0.8,
|
|
298
|
-
test: 0.6,
|
|
299
|
-
file: 0.9,
|
|
300
|
-
permission: 0.4,
|
|
301
|
-
network: 0.3,
|
|
302
|
-
unknown: 0.5
|
|
303
|
-
};
|
|
304
|
-
probability = categoryProbabilities[errorAnalysis.category];
|
|
305
|
-
// Adjust based on recovery history
|
|
306
|
-
const similarSuccesses = this.recoveryHistory.filter(r => r.error.includes(context.errorType) && r.success).length;
|
|
307
|
-
const similarFailures = this.recoveryHistory.filter(r => r.error.includes(context.errorType) && !r.success).length;
|
|
308
|
-
const totalSimilar = similarSuccesses + similarFailures;
|
|
309
|
-
if (totalSimilar > 0) {
|
|
310
|
-
const historicalProbability = similarSuccesses / totalSimilar;
|
|
311
|
-
probability = (probability + historicalProbability) / 2;
|
|
312
|
-
}
|
|
313
|
-
return probability;
|
|
314
|
-
}
|
|
315
|
-
generateRollbackPlan(context) {
|
|
316
|
-
const rollbackSteps = [];
|
|
317
|
-
if (context.currentState.filesModified.length > 0) {
|
|
318
|
-
rollbackSteps.push('git reset --hard HEAD');
|
|
319
|
-
rollbackSteps.push('Remove any untracked files if necessary');
|
|
320
|
-
}
|
|
321
|
-
return rollbackSteps;
|
|
322
|
-
}
|
|
323
|
-
generateValidationSteps(context) {
|
|
324
|
-
return [
|
|
325
|
-
'Verify error is resolved',
|
|
326
|
-
'Run TypeScript type checking',
|
|
327
|
-
'Run build process',
|
|
328
|
-
'Execute relevant tests',
|
|
329
|
-
'Confirm system is in stable state'
|
|
330
|
-
];
|
|
331
|
-
}
|
|
332
|
-
async executeRecoveryAction(action) {
|
|
333
|
-
// This would integrate with the actual tool execution system
|
|
334
|
-
// For now, return a mock implementation
|
|
335
|
-
return {
|
|
336
|
-
success: true,
|
|
337
|
-
output: `Executed: ${action.action}`
|
|
338
|
-
};
|
|
339
|
-
}
|
|
340
|
-
extractPatternFromSuccess(context, action) {
|
|
341
|
-
return `${context.errorType} -> ${action.action} (${action.tool})`;
|
|
342
|
-
}
|
|
343
|
-
parseLearnedPattern(pattern, context) { n; }
|
|
344
|
-
} // Simple pattern parsing - in practice this would be more sophisticated\n const parts = pattern.split(' -> ');\n if (parts.length === 2) {\n const [errorType, recovery] = parts;\n const [action, tool] = recovery.split(' (');\n \n return {\n action: action.trim(),\n tool: tool ? tool.replace(')', '') : undefined,\n parameters: {},\n description: `Learned recovery pattern for ${errorType}`,\n confidence: 0.9,\n autoExecutable: true,\n requiresConfirmation: false\n };\n }\n\n // Fallback to generic recovery\n return {\n action: 'Use learned recovery pattern',\n description: `Apply previously successful recovery for ${context.errorType}`,\n confidence: 0.8,\n autoExecutable: true,\n requiresConfirmation: false\n };\n }\n}
|
|
345
|
-
//# sourceMappingURL=enhancedErrorRecovery.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"enhancedErrorRecovery.js","sourceRoot":"","sources":["../../src/core/enhancedErrorRecovery.ts"],"names":[],"mappings":"AAAA;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AC,CAAC;QAChE,CAAC;QAED,OAAO,aAAa,CAAC;IACvB,CAAC;IAEO,uBAAuB,CAAC,OAAwB;QACtD,OAAO;YACL,0BAA0B;YAC1B,8BAA8B;YAC9B,mBAAmB;YACnB,wBAAwB;YACxB,mCAAmC;SACpC,CAAC;IACJ,CAAC;IAEO,KAAK,CAAC,qBAAqB,CAAC,MAAsB;QACxD,6DAA6D;QAC7D,wCAAwC;QACxC,OAAO;YACL,OAAO,EAAE,IAAI;YACb,MAAM,EAAE,aAAa,MAAM,CAAC,MAAM,EAAE;SACrC,CAAC;IACJ,CAAC;IAEO,yBAAyB,CAC/B,OAAwB,EACxB,MAAsB;QAEtB,OAAO,GAAG,OAAO,CAAC,SAAS,OAAO,MAAM,CAAC,MAAM,KAAK,MAAM,CAAC,IAAI,GAAG,CAAC;IACrE,CAAC;IAEO,mBAAmB,CAAC,OAAe,EAAE,OAAwB,IAAoB,CAAC,CAAA,CAAk1B,CAAC,AAAn1B;CAAA,CAAI,80BAA80B"}
|
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* ClaudeCodeStreamHandler - Complete streaming I/O handler following Claude Code's approach
|
|
3
|
-
*
|
|
4
|
-
* This module combines StreamingOutputManager and InputQueueManager to provide
|
|
5
|
-
* the complete Claude Code streaming experience:
|
|
6
|
-
*
|
|
7
|
-
* 1. Natural Output Flow
|
|
8
|
-
* - Streaming output just writes to stdout normally
|
|
9
|
-
* - Cursor stays where it is after each write
|
|
10
|
-
* - Lines scroll up naturally as new content appears
|
|
11
|
-
* - NO scroll regions, NO save/restore cursor during streaming
|
|
12
|
-
*
|
|
13
|
-
* 2. Readline Handles Input
|
|
14
|
-
* - Uses Node.js readline module
|
|
15
|
-
* - Input prompt naturally moves up as output streams above it
|
|
16
|
-
* - User can type while streaming - input is queued in memory, not rendered
|
|
17
|
-
*
|
|
18
|
-
* 3. Queue-Based Approach
|
|
19
|
-
* User types during streaming → Input stored in queue → Processed after streaming ends
|
|
20
|
-
*
|
|
21
|
-
* 4. The Key Insight
|
|
22
|
-
* The cursor is NEVER moved during streaming. Output just appends at current position.
|
|
23
|
-
* The "input at bottom" effect comes from:
|
|
24
|
-
* - New output pushes older content (including the prompt) upward
|
|
25
|
-
* - After streaming ends, a new prompt is shown at the bottom
|
|
26
|
-
*/
|
|
27
|
-
import * as readline from 'node:readline';
|
|
28
|
-
import { EventEmitter } from 'node:events';
|
|
29
|
-
import { type QueuedInput } from './inputQueueManager.js';
|
|
30
|
-
export interface ClaudeCodeStreamState {
|
|
31
|
-
isStreaming: boolean;
|
|
32
|
-
queuedCount: number;
|
|
33
|
-
charsWritten: number;
|
|
34
|
-
linesWritten: number;
|
|
35
|
-
elapsedMs: number;
|
|
36
|
-
}
|
|
37
|
-
export interface ClaudeCodeStreamEvents {
|
|
38
|
-
'streaming-start': () => void;
|
|
39
|
-
'streaming-end': (stats: {
|
|
40
|
-
duration: number;
|
|
41
|
-
chars: number;
|
|
42
|
-
lines: number;
|
|
43
|
-
}) => void;
|
|
44
|
-
'input-queued': (input: QueuedInput) => void;
|
|
45
|
-
'queue-processed': (input: QueuedInput) => void;
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* Coordinates streaming output and queued input for Claude Code style UX.
|
|
49
|
-
*/
|
|
50
|
-
export declare class ClaudeCodeStreamHandler extends EventEmitter {
|
|
51
|
-
private readonly outputManager;
|
|
52
|
-
private readonly inputManager;
|
|
53
|
-
private readonly writeStream;
|
|
54
|
-
private readonly readStream;
|
|
55
|
-
private rl;
|
|
56
|
-
private keypressHandler;
|
|
57
|
-
private originalStdoutWrite;
|
|
58
|
-
private isOutputSuppressed;
|
|
59
|
-
constructor(writeStream?: NodeJS.WriteStream, readStream?: NodeJS.ReadStream);
|
|
60
|
-
/**
|
|
61
|
-
* Attach to an existing readline interface
|
|
62
|
-
* Call this after creating your readline.Interface
|
|
63
|
-
*/
|
|
64
|
-
attachToReadline(rl: readline.Interface): void;
|
|
65
|
-
/**
|
|
66
|
-
* Set up keypress capturing for queued input during streaming
|
|
67
|
-
*/
|
|
68
|
-
private setupKeypressCapture;
|
|
69
|
-
/**
|
|
70
|
-
* Begin streaming mode
|
|
71
|
-
*
|
|
72
|
-
* Claude Code approach:
|
|
73
|
-
* - Start capturing input to queue
|
|
74
|
-
* - Suppress readline echo (characters typed go to queue, not screen)
|
|
75
|
-
* - Output flows naturally to stdout
|
|
76
|
-
*/
|
|
77
|
-
startStreaming(): void;
|
|
78
|
-
/**
|
|
79
|
-
* End streaming mode
|
|
80
|
-
*
|
|
81
|
-
* Claude Code approach:
|
|
82
|
-
* - Stop capturing (any remaining buffer is preserved)
|
|
83
|
-
* - Restore readline echo
|
|
84
|
-
* - Return streaming statistics
|
|
85
|
-
*/
|
|
86
|
-
endStreaming(): {
|
|
87
|
-
duration: number;
|
|
88
|
-
chars: number;
|
|
89
|
-
lines: number;
|
|
90
|
-
queuedInputs: number;
|
|
91
|
-
};
|
|
92
|
-
/**
|
|
93
|
-
* Write content during streaming
|
|
94
|
-
* Just writes naturally to stdout - no cursor manipulation
|
|
95
|
-
*/
|
|
96
|
-
write(content: string): void;
|
|
97
|
-
/**
|
|
98
|
-
* Write a complete line during streaming
|
|
99
|
-
*/
|
|
100
|
-
writeLine(line?: string): void;
|
|
101
|
-
/**
|
|
102
|
-
* Check if currently streaming
|
|
103
|
-
*/
|
|
104
|
-
isStreaming(): boolean;
|
|
105
|
-
/**
|
|
106
|
-
* Get current state
|
|
107
|
-
*/
|
|
108
|
-
getState(): ClaudeCodeStreamState;
|
|
109
|
-
/**
|
|
110
|
-
* Check if there are queued inputs to process
|
|
111
|
-
*/
|
|
112
|
-
hasQueuedInput(): boolean;
|
|
113
|
-
/**
|
|
114
|
-
* Get the next queued input
|
|
115
|
-
*/
|
|
116
|
-
getNextQueuedInput(): QueuedInput | undefined;
|
|
117
|
-
/**
|
|
118
|
-
* Get all queued inputs
|
|
119
|
-
*/
|
|
120
|
-
getAllQueuedInputs(): QueuedInput[];
|
|
121
|
-
/**
|
|
122
|
-
* Clear all queued inputs
|
|
123
|
-
*/
|
|
124
|
-
clearQueue(): void;
|
|
125
|
-
/**
|
|
126
|
-
* Get queue summary for display
|
|
127
|
-
*/
|
|
128
|
-
getQueueSummary(): string;
|
|
129
|
-
/**
|
|
130
|
-
* Suppress readline's output during streaming
|
|
131
|
-
* Characters typed will be captured but not displayed
|
|
132
|
-
*/
|
|
133
|
-
private suppressReadlineOutput;
|
|
134
|
-
/**
|
|
135
|
-
* Restore readline's normal output
|
|
136
|
-
*/
|
|
137
|
-
private restoreReadlineOutput;
|
|
138
|
-
/**
|
|
139
|
-
* Cleanup when done
|
|
140
|
-
*/
|
|
141
|
-
dispose(): void;
|
|
142
|
-
}
|
|
143
|
-
export declare function getClaudeCodeStreamHandler(): ClaudeCodeStreamHandler;
|
|
144
|
-
export declare function resetClaudeCodeStreamHandler(): void;
|
|
145
|
-
//# sourceMappingURL=claudeCodeStreamHandler.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"claudeCodeStreamHandler.d.ts","sourceRoot":"","sources":["../../src/shell/claudeCodeStreamHandler.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,OAAO,EAA2C,KAAK,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAGnG,MAAM,WAAW,qBAAqB;IACpC,WAAW,EAAE,OAAO,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,sBAAsB;IACrC,iBAAiB,EAAE,MAAM,IAAI,CAAC;IAC9B,eAAe,EAAE,CAAC,KAAK,EAAE;QAAE,QAAQ,EAAE,MAAM,C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