erosolar-cli 1.7.64 → 1.7.66

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 (31) hide show
  1. package/dist/bin/erosolar.js +0 -2
  2. package/dist/bin/erosolar.js.map +1 -1
  3. package/dist/core/types.d.ts +6 -0
  4. package/dist/core/types.d.ts.map +1 -1
  5. package/dist/providers/anthropicProvider.d.ts.map +1 -1
  6. package/dist/providers/anthropicProvider.js +25 -0
  7. package/dist/providers/anthropicProvider.js.map +1 -1
  8. package/dist/providers/openaiChatCompletionsProvider.d.ts.map +1 -1
  9. package/dist/providers/openaiChatCompletionsProvider.js +25 -4
  10. package/dist/providers/openaiChatCompletionsProvider.js.map +1 -1
  11. package/dist/security/persistence-research.d.ts +0 -2
  12. package/dist/security/persistence-research.d.ts.map +1 -1
  13. package/dist/security/persistence-research.js +0 -2
  14. package/dist/security/persistence-research.js.map +1 -1
  15. package/dist/security/security-testing-framework.d.ts +0 -2
  16. package/dist/security/security-testing-framework.d.ts.map +1 -1
  17. package/dist/security/security-testing-framework.js +0 -2
  18. package/dist/security/security-testing-framework.js.map +1 -1
  19. package/dist/shell/interactiveShell.d.ts +6 -0
  20. package/dist/shell/interactiveShell.d.ts.map +1 -1
  21. package/dist/shell/interactiveShell.js +47 -18
  22. package/dist/shell/interactiveShell.js.map +1 -1
  23. package/dist/tools/cloudTools.d.ts +0 -2
  24. package/dist/tools/cloudTools.d.ts.map +1 -1
  25. package/dist/tools/cloudTools.js +0 -2
  26. package/dist/tools/cloudTools.js.map +1 -1
  27. package/package.json +7 -7
  28. package/dist/shell/pasteHandler.d.ts +0 -5
  29. package/dist/shell/pasteHandler.d.ts.map +0 -1
  30. package/dist/shell/pasteHandler.js +0 -25
  31. package/dist/shell/pasteHandler.js.map +0 -1
@@ -472,9 +472,9 @@ export class InteractiveShell {
472
472
  inputStream.off('keypress', this.keypressHandler);
473
473
  this.keypressHandler = null;
474
474
  }
475
- // Remove raw data handler
476
- if (inputStream && this.rawDataHandler) {
477
- inputStream.off('data', this.rawDataHandler);
475
+ // Restore original stdin emit (cleanup from paste interception)
476
+ if (this.rawDataHandler) {
477
+ this.rawDataHandler(); // This restores the original emit function
478
478
  this.rawDataHandler = null;
479
479
  }
480
480
  // Clear any pending cleanup to prevent hanging
@@ -525,21 +525,31 @@ export class InteractiveShell {
525
525
  // All pastes (single or multi-line) are captured for confirmation before submit
526
526
  this.capturePaste(content, lineCount);
527
527
  });
528
- // Set up raw data interception to catch bracketed paste before readline processes it
529
- // We prepend our listener so it runs before readline's listener
530
- this.rawDataHandler = (data) => {
531
- const str = data.toString();
532
- const result = this.bracketedPaste.processRawData(str);
533
- if (result.consumed) {
534
- // Don't show preview here - readline will still echo lines to the terminal,
535
- // and our preview would get clobbered. Instead, we show the preview in the
536
- // line handler after clearing readline's echoed output.
537
- // The processRawData() sets flags that the line handler will check.
528
+ // Set up raw data interception to catch bracketed paste before readline processes it.
529
+ // We need to actually PREVENT readline from seeing the paste content to avoid echo.
530
+ // Strategy: Replace stdin's 'data' event emission during paste capture.
531
+ const originalEmit = inputStream.emit.bind(inputStream);
532
+ inputStream.emit = (event, ...args) => {
533
+ if (event === 'data' && args[0]) {
534
+ const data = args[0];
535
+ const str = typeof data === 'string' ? data : data.toString();
536
+ const result = this.bracketedPaste.processRawData(str);
537
+ if (result.consumed) {
538
+ // Data was consumed by paste handler - don't pass to readline
539
+ // If there's passThrough data, emit that instead
540
+ if (result.passThrough) {
541
+ return originalEmit('data', Buffer.from(result.passThrough));
542
+ }
543
+ return true; // Event "handled" but not passed to other listeners
544
+ }
538
545
  }
546
+ // Pass through all other events and non-paste data normally
547
+ return originalEmit(event, ...args);
548
+ };
549
+ // Store reference for cleanup
550
+ this.rawDataHandler = () => {
551
+ inputStream.emit = originalEmit;
539
552
  };
540
- // Use prependListener to ensure our handler runs before readline's handlers
541
- // This gives us first look at the raw data including bracketed paste markers
542
- inputStream.prependListener('data', this.rawDataHandler);
543
553
  }
544
554
  setupSlashCommandPreviewHandler() {
545
555
  const inputStream = input;
@@ -1309,6 +1319,7 @@ export class InteractiveShell {
1309
1319
  this.baseSystemPrompt = buildInteractiveSystemPrompt(profileConfig.systemPrompt, profileConfig.label, tools);
1310
1320
  if (this.rebuildAgent()) {
1311
1321
  display.showInfo(`Workspace snapshot refreshed (${this.describeWorkspaceOptions()}).`);
1322
+ this.resetChatBoxAfterModelSwap();
1312
1323
  }
1313
1324
  else {
1314
1325
  display.showWarning('Workspace snapshot refreshed, but the agent failed to rebuild. Run /doctor for details.');
@@ -1486,7 +1497,9 @@ export class InteractiveShell {
1486
1497
  }
1487
1498
  this.thinkingMode = value;
1488
1499
  saveSessionPreferences({ thinkingMode: this.thinkingMode });
1489
- this.rebuildAgent();
1500
+ if (this.rebuildAgent()) {
1501
+ this.resetChatBoxAfterModelSwap();
1502
+ }
1490
1503
  const descriptions = {
1491
1504
  concise: 'Hides internal reasoning and responds directly.',
1492
1505
  balanced: 'Shows short thoughts only when helpful.',
@@ -2181,6 +2194,7 @@ export class InteractiveShell {
2181
2194
  display.showInfo(`Switched to ${preset.label}.`);
2182
2195
  this.refreshBannerSessionInfo();
2183
2196
  this.persistSessionPreference();
2197
+ this.resetChatBoxAfterModelSwap();
2184
2198
  }
2185
2199
  }
2186
2200
  async handleSecretSelection(input) {
@@ -2241,7 +2255,9 @@ export class InteractiveShell {
2241
2255
  const deferred = this.pendingSecretRetry;
2242
2256
  this.pendingSecretRetry = null;
2243
2257
  if (pending.secret.providers.includes(this.sessionState.provider)) {
2244
- this.rebuildAgent();
2258
+ if (this.rebuildAgent()) {
2259
+ this.resetChatBoxAfterModelSwap();
2260
+ }
2245
2261
  }
2246
2262
  if (deferred) {
2247
2263
  await deferred();
@@ -2837,6 +2853,18 @@ What's the next action?`;
2837
2853
  return false;
2838
2854
  }
2839
2855
  }
2856
+ /**
2857
+ * Reset the pinned chat box to a fresh state after model/provider swap.
2858
+ * Ensures the input box is properly visible and ready for input,
2859
+ * just like on fresh startup.
2860
+ */
2861
+ resetChatBoxAfterModelSwap() {
2862
+ this.pinnedChatBox.setStatusMessage(null);
2863
+ this.pinnedChatBox.setProcessing(false);
2864
+ this.pinnedChatBox.show();
2865
+ this.pinnedChatBox.forceRender();
2866
+ this.ensureReadlineReady();
2867
+ }
2840
2868
  buildSystemPrompt() {
2841
2869
  const providerLabel = this.providerLabel(this.sessionState.provider);
2842
2870
  const lines = [
@@ -3295,6 +3323,7 @@ What's the next action?`;
3295
3323
  this.persistSessionPreference();
3296
3324
  this.refreshBannerSessionInfo();
3297
3325
  display.showInfo(`Switched from ${this.providerLabel(oldProvider)}/${oldModel} to ${match.label}/${defaultModel.id}`);
3326
+ this.resetChatBoxAfterModelSwap();
3298
3327
  }
3299
3328
  else {
3300
3329
  // Revert on failure