erosolar-cli 1.7.160 → 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.
Files changed (52) hide show
  1. package/dist/capabilities/performanceMonitoringCapability.d.ts +108 -0
  2. package/dist/capabilities/performanceMonitoringCapability.d.ts.map +1 -0
  3. package/dist/capabilities/performanceMonitoringCapability.js +176 -0
  4. package/dist/capabilities/performanceMonitoringCapability.js.map +1 -0
  5. package/dist/core/performanceMonitor.d.ts +93 -0
  6. package/dist/core/performanceMonitor.d.ts.map +1 -0
  7. package/dist/core/performanceMonitor.js +195 -0
  8. package/dist/core/performanceMonitor.js.map +1 -0
  9. package/dist/core/toolRuntime.d.ts +5 -1
  10. package/dist/core/toolRuntime.d.ts.map +1 -1
  11. package/dist/core/toolRuntime.js +11 -1
  12. package/dist/core/toolRuntime.js.map +1 -1
  13. package/dist/security/tool-security-wrapper.js +3 -3
  14. package/dist/security/tool-security-wrapper.js.map +1 -1
  15. package/dist/shell/claudeCodeStreamHandler.d.ts +145 -0
  16. package/dist/shell/claudeCodeStreamHandler.d.ts.map +1 -0
  17. package/dist/shell/claudeCodeStreamHandler.js +312 -0
  18. package/dist/shell/claudeCodeStreamHandler.js.map +1 -0
  19. package/dist/shell/inputQueueManager.d.ts +144 -0
  20. package/dist/shell/inputQueueManager.d.ts.map +1 -0
  21. package/dist/shell/inputQueueManager.js +290 -0
  22. package/dist/shell/inputQueueManager.js.map +1 -0
  23. package/dist/shell/interactiveShell.d.ts +12 -0
  24. package/dist/shell/interactiveShell.d.ts.map +1 -1
  25. package/dist/shell/interactiveShell.js +75 -18
  26. package/dist/shell/interactiveShell.js.map +1 -1
  27. package/dist/shell/streamingOutputManager.d.ts +88 -0
  28. package/dist/shell/streamingOutputManager.d.ts.map +1 -0
  29. package/dist/shell/streamingOutputManager.js +155 -0
  30. package/dist/shell/streamingOutputManager.js.map +1 -0
  31. package/dist/shell/systemPrompt.js +2 -2
  32. package/dist/shell/systemPrompt.js.map +1 -1
  33. package/dist/shell/taskCompletionDetector.d.ts.map +1 -1
  34. package/dist/shell/taskCompletionDetector.js +1 -3
  35. package/dist/shell/taskCompletionDetector.js.map +1 -1
  36. package/dist/tools/editTools.d.ts.map +1 -1
  37. package/dist/tools/editTools.js +32 -8
  38. package/dist/tools/editTools.js.map +1 -1
  39. package/dist/tools/fileTools.d.ts.map +1 -1
  40. package/dist/tools/fileTools.js +2 -126
  41. package/dist/tools/fileTools.js.map +1 -1
  42. package/dist/ui/persistentPrompt.d.ts +3 -5
  43. package/dist/ui/persistentPrompt.d.ts.map +1 -1
  44. package/dist/ui/persistentPrompt.js +5 -11
  45. package/dist/ui/persistentPrompt.js.map +1 -1
  46. package/dist/ui/toolDisplay.d.ts.map +1 -1
  47. package/dist/ui/toolDisplay.js +1 -3
  48. package/dist/ui/toolDisplay.js.map +1 -1
  49. package/dist/ui/toolDisplayAdapter.d.ts.map +1 -1
  50. package/dist/ui/toolDisplayAdapter.js +0 -3
  51. package/dist/ui/toolDisplayAdapter.js.map +1 -1
  52. package/package.json +1 -1
@@ -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.restoreReadlineOutput();
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
- // Enable scroll region so streaming output scrolls while input stays at bottom
2434
- this.pinnedChatBox.enableScrollRegion();
2435
- // Suppress readline echo so typed characters only appear in persistent input box
2436
- this.suppressReadlineOutput();
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
- // Restore readline echo before other cleanup
2455
- this.restoreReadlineOutput();
2456
- // Disable scroll region before any other output to restore normal terminal behavior
2457
- this.pinnedChatBox.disableScrollRegion();
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
- // Enable scroll region so streaming output scrolls while input stays at bottom
2521
- this.pinnedChatBox.enableScrollRegion();
2522
- // Suppress readline echo so typed characters only appear in persistent input box
2523
- this.suppressReadlineOutput();
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
- // Restore readline echo before other cleanup
2686
- this.restoreReadlineOutput();
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|write_file|edit_file|bash|grep|glob|search)/gi,
2865
+ /(?:read_file|edit_file|Edit|bash|grep|glob|search)/gi,
2809
2866
  ];
2810
2867
  for (const pattern of toolPatterns) {
2811
2868
  let match;