erosolar-cli 1.7.395 → 1.7.396

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.
@@ -95,6 +95,13 @@ export declare class InteractiveShell {
95
95
  private lastUserQuery;
96
96
  private lastFailure;
97
97
  private lastAutoTestRun;
98
+ private runIdCounter;
99
+ private lastRunLog;
100
+ private lastReflectedRunId;
101
+ private skipNextAutoReflection;
102
+ private alphaZeroAutoImproveActive;
103
+ private alphaZeroAutoImproveIterations;
104
+ private readonly alphaZeroAutoImproveMaxIterations;
98
105
  private autoBuildInFlight;
99
106
  private lastAutoBuildRun;
100
107
  private offsecRunId;
@@ -109,6 +116,7 @@ export declare class InteractiveShell {
109
116
  private launchPaletteShown;
110
117
  private readonly version;
111
118
  private readonly alternateScreenEnabled;
119
+ private inputInitialized;
112
120
  constructor(config: ShellConfig);
113
121
  private parallelAgentDisplayLines;
114
122
  private setupParallelAgentTracking;
@@ -116,6 +124,10 @@ export declare class InteractiveShell {
116
124
  private initializeSessionHistory;
117
125
  private showSessionResumeNotice;
118
126
  start(initialPrompt?: string): Promise<void>;
127
+ private runStartupUpdatePrompt;
128
+ private ensureInputInitialized;
129
+ private promptForCliUpdate;
130
+ private showStartupSecretGuidance;
119
131
  private showLaunchCommandPalette;
120
132
  /**
121
133
  * TerminalInputAdapter submit handler
@@ -276,6 +288,11 @@ export declare class InteractiveShell {
276
288
  private isSelfImprovementRequest;
277
289
  private isDifficultProblem;
278
290
  private buildAlphaZeroPrompt;
291
+ private buildRunLogExcerpt;
292
+ private buildRunLogEntry;
293
+ private buildAlphaZeroReflectionPrompt;
294
+ private maybeQueueAlphaZeroSelfReflection;
295
+ private shouldStopAlphaZeroAutoImprove;
279
296
  private handlePendingInteraction;
280
297
  private processSlashCommand;
281
298
  private tryCustomSlashCommand;
@@ -436,6 +453,7 @@ export declare class InteractiveShell {
436
453
  private buildSystemPrompt;
437
454
  private buildThinkingDirective;
438
455
  private buildDisplayMetadata;
456
+ private presentThoughtProcess;
439
457
  private handleContextTelemetry;
440
458
  private totalTokens;
441
459
  private runContextCleanup;
@@ -1 +1 @@
1
- {"version":3,"file":"interactiveShell.d.ts","sourceRoot":"","sources":["../../src/shell/interactiveShell.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AA8CtE,OAAO,EAAE,YAAY,EAAE,KAAK,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAE/E,OAAO,EAAE,iBAAiB,EAAwB,MAAM,iBAAiB,CAAC;AAC1E,OAAO,EAAyB,KAAK,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AA6GtF,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAWxD,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,WAAW,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,YAAY,CAAC;IACtB,gBAAgB,EAAE,MAAM,CAAC;IACzB,YAAY,EAAE,cAAc,CAAC;IAC7B,cAAc,CAAC,EAAE,oBAAoB,CAAC;IACtC,aAAa,EAAE,iBAAiB,CAAC;IACjC,EAAE,EAAE,cAAc,CAAC;IACnB,gBAAgB,EAAE,uBAAuB,CAAC;IAC1C,cAAc,CAAC,EAAE,oBAAoB,CAAC;IACtC,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,MAAM,GAAG,UAAU,GAAG,YAAY,CAAC;IACzC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,UAAU,oBAAoB;IAC5B,cAAc,EAAE,WAAW,CAAC;IAC5B,gBAAgB,EAAE,WAAW,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AkB;IAkB1B,OAAO,CAAC,mBAAmB;IAyB3B,OAAO,CAAC,qBAAqB;IAmB7B,OAAO,CAAC,uBAAuB;IAU/B,OAAO,CAAC,mBAAmB;IAc3B,OAAO,CAAC,iBAAiB;IAqCzB,OAAO,CAAC,kBAAkB;IAa1B,OAAO,CAAC,oBAAoB;IAQ5B,OAAO,CAAC,eAAe;IAIvB,OAAO,CAAC,4BAA4B;IAUpC;;OAEG;IACH,OAAO,CAAC,WAAW;IAkCnB;;OAEG;IACH,OAAO,CAAC,qBAAqB;IA6B7B;;OAEG;IACH,OAAO,CAAC,mBAAmB;IAkC3B;;OAEG;IACH,OAAO,CAAC,mBAAmB;IAiB3B,OAAO,CAAC,wBAAwB;IAoBhC,OAAO,CAAC,aAAa;IAIrB,OAAO,CAAC,cAAc;IAQtB,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;;;OAGG;IACH,iBAAiB,CAAC,SAAS,EAAE,KAAK,CAAC;QACjC,QAAQ,EAAE,MAAM,CAAC;QACjB,SAAS,EAAE,OAAO,CAAC;QACnB,WAAW,EAAE,MAAM,CAAC;QACpB,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB,CAAC,GAAG,IAAI;IAIT;;;OAGG;IACH,OAAO,CAAC,oBAAoB;CAG7B"}
@@ -1,10 +1,11 @@
1
1
  import { stdin as input, stdout as output, exit } from 'node:process';
2
2
  import { exec } from 'node:child_process';
3
3
  import { promisify } from 'node:util';
4
+ import { createInterface } from 'node:readline/promises';
4
5
  import { display } from '../ui/display.js';
5
6
  import { theme } from '../ui/theme.js';
6
7
  import { getContextWindowTokens } from '../core/contextWindow.js';
7
- import { ensureSecretForProvider, getSecretDefinitionForProvider, getSecretValue, listSecretDefinitions, maskSecret, setSecretValue, } from '../core/secretStore.js';
8
+ import { ensureSecretForProvider, getSecretDefinitionForProvider, getSecretValue, listSecretDefinitions, MissingSecretError, maskSecret, setSecretValue, } from '../core/secretStore.js';
8
9
  import { saveActiveProfilePreference, saveModelPreference, loadToolSettings, saveToolSettings, clearToolSettings, clearActiveProfilePreference, loadSessionPreferences, saveSessionPreferences, loadFeatureFlags, saveFeatureFlags, toggleFeatureFlag, FEATURE_FLAG_INFO, } from '../core/preferences.js';
9
10
  import { getLearningSummary, getRecentLearning, commitLearning, exportAllLearning, getLearningDir, } from '../core/learningPersistence.js';
10
11
  import { buildEnabledToolSet, evaluateToolPermissions, getToolToggleOptions, } from '../capabilities/toolRegistry.js';
@@ -151,6 +152,13 @@ export class InteractiveShell {
151
152
  lastUserQuery = '';
152
153
  lastFailure = null;
153
154
  lastAutoTestRun = null;
155
+ runIdCounter = 0;
156
+ lastRunLog = null;
157
+ lastReflectedRunId = null;
158
+ skipNextAutoReflection = false;
159
+ alphaZeroAutoImproveActive = false;
160
+ alphaZeroAutoImproveIterations = 0;
161
+ alphaZeroAutoImproveMaxIterations = 6;
154
162
  // Auto-build tracking
155
163
  autoBuildInFlight = false;
156
164
  lastAutoBuildRun = null;
@@ -168,6 +176,7 @@ export class InteractiveShell {
168
176
  launchPaletteShown = false;
169
177
  version;
170
178
  alternateScreenEnabled;
179
+ inputInitialized = false;
171
180
  constructor(config) {
172
181
  this.profile = config.profile;
173
182
  this.profileLabel = config.profileLabel;
@@ -282,8 +291,6 @@ export class InteractiveShell {
282
291
  this.alphaZeroMetrics = new MetricsTracker(`${this.profile}-${Date.now()}`);
283
292
  this.setupStatusTracking();
284
293
  this.refreshContextGauge();
285
- // Start terminal input (sets up handlers)
286
- this.terminalInput.start();
287
294
  // Allow planning tools (e.g., ProposePlan) to open the interactive approval UI just like Codex CLI
288
295
  this.registerPlanApprovalBridge();
289
296
  // Capture display output into the scrollback/chat log so system messages
@@ -301,9 +308,6 @@ export class InteractiveShell {
301
308
  // Stream banner first - this sets up scroll region dynamically
302
309
  const banner = this.buildBanner();
303
310
  this.terminalInput.streamContent(banner + '\n\n');
304
- // Render chat box after banner is streamed
305
- this.refreshControlBar();
306
- this.renderPromptArea(true);
307
311
  this.rebuildAgent();
308
312
  this.setupHandlers();
309
313
  this.refreshBannerSessionInfo();
@@ -395,10 +399,8 @@ export class InteractiveShell {
395
399
  this.sessionResumeNotice = null;
396
400
  }
397
401
  async start(initialPrompt) {
398
- // Check for updates in background (non-blocking)
399
- if (this.version) {
400
- void maybeOfferCliUpdate(this.version);
401
- }
402
+ await this.runStartupUpdatePrompt();
403
+ this.ensureInputInitialized();
402
404
  if (initialPrompt) {
403
405
  await this.processInputBlock(initialPrompt);
404
406
  return;
@@ -407,6 +409,79 @@ export class InteractiveShell {
407
409
  // Ensure the terminal input is visible
408
410
  this.renderPromptArea();
409
411
  }
412
+ async runStartupUpdatePrompt() {
413
+ if (this.version) {
414
+ try {
415
+ await maybeOfferCliUpdate(this.version, {
416
+ prompt: (context) => this.promptForCliUpdate(context),
417
+ });
418
+ }
419
+ catch {
420
+ // Ignore update check failures at startup
421
+ }
422
+ }
423
+ this.showStartupSecretGuidance();
424
+ }
425
+ ensureInputInitialized() {
426
+ if (this.inputInitialized) {
427
+ return;
428
+ }
429
+ this.terminalInput.start();
430
+ this.refreshControlBar();
431
+ this.renderPromptArea(true);
432
+ this.inputInitialized = true;
433
+ }
434
+ async promptForCliUpdate(context) {
435
+ if (!input.isTTY || !output.isTTY) {
436
+ return true;
437
+ }
438
+ const lines = [
439
+ theme.gradient.primary('ā¬†ļø Update available'),
440
+ `${theme.ui.muted('Current')}: ${theme.info(context.currentVersion)}`,
441
+ `${theme.ui.muted('Latest')}: ${theme.success(context.latestVersion)}`,
442
+ '',
443
+ `${theme.primary('>')} Update now (recommended)`,
444
+ `${theme.ui.muted(' Skip for now')}`,
445
+ '',
446
+ 'Press Enter to accept the highlighted option, or type Y/n (1/2).',
447
+ ];
448
+ display.showSystemMessage(lines.join('\n'));
449
+ const prompt = createInterface({ input, output });
450
+ try {
451
+ const raw = (await prompt.question('> ')).trim().toLowerCase();
452
+ if (!raw || raw === 'y' || raw === 'yes' || raw === '1' || raw === 'update') {
453
+ return true;
454
+ }
455
+ if (raw === 'n' || raw === 'no' || raw === '2' || raw === 'skip') {
456
+ return false;
457
+ }
458
+ return false;
459
+ }
460
+ finally {
461
+ prompt.close();
462
+ }
463
+ }
464
+ showStartupSecretGuidance() {
465
+ const definitions = listSecretDefinitions();
466
+ const providerSecret = definitions.find((definition) => definition.providers.includes(this.sessionState.provider));
467
+ const missingProviderKey = providerSecret ? !getSecretValue(providerSecret.id) : false;
468
+ const hasSearchKey = Boolean(getSecretValue('TAVILY_API_KEY')) ||
469
+ Boolean(getSecretValue('BRAVE_SEARCH_API_KEY')) ||
470
+ Boolean(getSecretValue('SERPAPI_API_KEY'));
471
+ if (!missingProviderKey && hasSearchKey) {
472
+ return;
473
+ }
474
+ const lines = [];
475
+ lines.push(theme.gradient.primary('Quick setup needed:'));
476
+ if (missingProviderKey && providerSecret) {
477
+ lines.push(`${theme.primary('•')} Set ${providerSecret.label} to use ${this.providerLabel(this.sessionState.provider)}.`);
478
+ }
479
+ if (!hasSearchKey) {
480
+ lines.push(`${theme.primary('•')} Add a web search API key (Tavily recommended) for web tools.`);
481
+ }
482
+ lines.push(theme.ui.muted('Run /secrets to configure keys now. Stored values override env vars.'));
483
+ display.showSystemMessage(lines.join('\n'));
484
+ }
410
485
  showLaunchCommandPalette() {
411
486
  // Disabled: Quick commands palette takes up too much space
412
487
  // Users can type /help to see available commands
@@ -1094,12 +1169,13 @@ export class InteractiveShell {
1094
1169
  setupHandlers() {
1095
1170
  // Handle terminal resize
1096
1171
  output.on('resize', () => {
1172
+ if (!this.inputInitialized) {
1173
+ return;
1174
+ }
1097
1175
  this.terminalInput.resetContentPosition();
1098
1176
  this.terminalInput.handleResize();
1099
1177
  this.terminalInput.forceRender();
1100
1178
  });
1101
- // Show initial input UI
1102
- this.renderPromptArea();
1103
1179
  }
1104
1180
  /**
1105
1181
  * Set up command autocomplete with all available slash commands.
@@ -1509,7 +1585,14 @@ export class InteractiveShell {
1509
1585
  this.refreshQueueIndicators();
1510
1586
  return;
1511
1587
  }
1588
+ if (this.apiKeyGateActive) {
1589
+ this.refreshQueueIndicators();
1590
+ return;
1591
+ }
1512
1592
  queueMicrotask(() => {
1593
+ if (this.apiKeyGateActive) {
1594
+ return;
1595
+ }
1513
1596
  void this.processQueuedActions();
1514
1597
  });
1515
1598
  }
@@ -1517,12 +1600,12 @@ export class InteractiveShell {
1517
1600
  * Process queued follow-up actions.
1518
1601
  */
1519
1602
  async processQueuedActions() {
1520
- if (this.isDrainingQueue || this.isProcessing || !this.followUpQueue.length) {
1603
+ if (this.apiKeyGateActive || this.isDrainingQueue || this.isProcessing || !this.followUpQueue.length) {
1521
1604
  return;
1522
1605
  }
1523
1606
  this.isDrainingQueue = true;
1524
1607
  try {
1525
- while (!this.isProcessing && this.followUpQueue.length) {
1608
+ while (!this.isProcessing && !this.apiKeyGateActive && this.followUpQueue.length) {
1526
1609
  const next = this.followUpQueue.shift();
1527
1610
  const remaining = this.followUpQueue.length;
1528
1611
  const label = next.type === 'continuous' ? 'continuous command' : 'follow-up';
@@ -1669,6 +1752,99 @@ export class InteractiveShell {
1669
1752
  ];
1670
1753
  return `${playbook.join('\n')}\n\nPrimary user request:\n${request.trim()}`;
1671
1754
  }
1755
+ buildRunLogExcerpt(startIndex) {
1756
+ const buffer = this.terminalInput.getScrollbackBuffer();
1757
+ const sinceStart = buffer.slice(Math.max(0, startIndex));
1758
+ const excerpt = sinceStart.slice(-200); // Cap prompt size
1759
+ return excerpt.join('\n').trim();
1760
+ }
1761
+ buildRunLogEntry(request, response, scrollbackStartIndex, meta) {
1762
+ return {
1763
+ id: ++this.runIdCounter,
1764
+ request,
1765
+ response,
1766
+ timestamp: new Date().toISOString(),
1767
+ alphaZero: meta.alphaZeroEngaged,
1768
+ difficult: meta.alphaZeroDifficult,
1769
+ failureType: meta.failureType,
1770
+ outputExcerpt: this.buildRunLogExcerpt(scrollbackStartIndex),
1771
+ };
1772
+ }
1773
+ buildAlphaZeroReflectionPrompt(runLog, options) {
1774
+ const lines = [];
1775
+ lines.push('AlphaZero Post-Run Self-Reflection (erosolar-cli)');
1776
+ lines.push(`Timestamp: ${runLog.timestamp}`);
1777
+ lines.push(`AlphaZero: ${runLog.alphaZero ? 'on' : 'off'}${runLog.difficult ? ' | difficult' : ''}${runLog.failureType ? ` | signal: ${runLog.failureType}` : ''}`);
1778
+ lines.push('');
1779
+ lines.push('User request:');
1780
+ lines.push(runLog.request);
1781
+ lines.push('');
1782
+ lines.push('Previous run log excerpt:');
1783
+ lines.push(runLog.outputExcerpt || '[empty]');
1784
+ lines.push('');
1785
+ lines.push('Instructions:');
1786
+ lines.push('- Reflect on the log to spot erosolar-cli bugs, UX issues, or reliability gaps.');
1787
+ lines.push('- Propose and apply targeted fixes in this repository only (no user workspace edits).');
1788
+ lines.push('- Prefer small, test-backed changes; run any relevant checks you invoke.');
1789
+ lines.push('- Keep notes concise and finish with applied changes plus follow-ups.');
1790
+ if (options.autoChain) {
1791
+ lines.push('- Continue iterating automatically while meaningful improvements remain.');
1792
+ lines.push('- When no further improvements are possible, reply with NO_MORE_IMPROVEMENTS on its own line.');
1793
+ }
1794
+ return lines.join('\n');
1795
+ }
1796
+ maybeQueueAlphaZeroSelfReflection(runLog, alphaZeroEngaged, allowAutoChain) {
1797
+ if (!alphaZeroEngaged) {
1798
+ return;
1799
+ }
1800
+ if (!isErosolarRepo(this.workingDir)) {
1801
+ return;
1802
+ }
1803
+ if (!runLog.outputExcerpt) {
1804
+ return;
1805
+ }
1806
+ if (this.lastReflectedRunId === runLog.id) {
1807
+ return;
1808
+ }
1809
+ if (allowAutoChain) {
1810
+ if (!this.autoContinueEnabled) {
1811
+ return;
1812
+ }
1813
+ if (this.alphaZeroAutoImproveIterations >= this.alphaZeroAutoImproveMaxIterations) {
1814
+ display.showInfo('AlphaZero auto-improvement limit reached; stopping.');
1815
+ this.alphaZeroAutoImproveActive = false;
1816
+ this.alphaZeroAutoImproveIterations = 0;
1817
+ return;
1818
+ }
1819
+ if (!this.alphaZeroAutoImproveActive) {
1820
+ this.alphaZeroAutoImproveIterations = 0;
1821
+ }
1822
+ this.alphaZeroAutoImproveActive = true;
1823
+ this.alphaZeroAutoImproveIterations++;
1824
+ }
1825
+ const prompt = this.buildAlphaZeroReflectionPrompt(runLog, { autoChain: allowAutoChain });
1826
+ this.lastReflectedRunId = runLog.id;
1827
+ this.skipNextAutoReflection = !allowAutoChain; // Prevent reflection-on-reflection unless auto-chaining
1828
+ this.enqueueFollowUpAction({ type: 'request', text: prompt });
1829
+ display.showInfo(allowAutoChain
1830
+ ? 'Auto AlphaZero self-improvement queued (auto-continue enabled).'
1831
+ : 'Queued AlphaZero self-reflection to improve erosolar-cli from the latest run log.');
1832
+ }
1833
+ shouldStopAlphaZeroAutoImprove(responseText, allowAutoChain) {
1834
+ if (!this.alphaZeroAutoImproveActive) {
1835
+ return false;
1836
+ }
1837
+ if (!allowAutoChain) {
1838
+ return true;
1839
+ }
1840
+ if (!responseText) {
1841
+ return false;
1842
+ }
1843
+ const normalized = responseText.toLowerCase();
1844
+ return (normalized.includes('no_more_improvements') ||
1845
+ normalized.includes('no more improvements') ||
1846
+ normalized.includes('stop_auto_improve'));
1847
+ }
1672
1848
  async handlePendingInteraction(input) {
1673
1849
  if (!this.pendingInteraction) {
1674
1850
  return false;
@@ -4689,8 +4865,10 @@ export class InteractiveShell {
4689
4865
  if (trimmed.toLowerCase() === 'cancel') {
4690
4866
  this.pendingInteraction = null;
4691
4867
  this.pendingSecretRetry = null;
4868
+ this.apiKeyGateActive = false;
4692
4869
  display.showInfo('Secret unchanged.');
4693
4870
  this.renderPromptArea();
4871
+ this.scheduleQueueProcessing();
4694
4872
  return;
4695
4873
  }
4696
4874
  try {
@@ -4699,6 +4877,7 @@ export class InteractiveShell {
4699
4877
  this.pendingInteraction = null;
4700
4878
  const deferred = this.pendingSecretRetry;
4701
4879
  this.pendingSecretRetry = null;
4880
+ this.apiKeyGateActive = false;
4702
4881
  if (pending.secret.providers.includes(this.sessionState.provider)) {
4703
4882
  if (this.rebuildAgent()) {
4704
4883
  this.resetChatBoxAfterModelSwap();
@@ -4713,8 +4892,10 @@ export class InteractiveShell {
4713
4892
  display.showError(message);
4714
4893
  this.pendingInteraction = null;
4715
4894
  this.pendingSecretRetry = null;
4895
+ this.apiKeyGateActive = false;
4716
4896
  }
4717
4897
  this.renderPromptArea();
4898
+ this.scheduleQueueProcessing();
4718
4899
  }
4719
4900
  async processRequest(userRequest) {
4720
4901
  if (this.isProcessing) {
@@ -4729,11 +4910,15 @@ export class InteractiveShell {
4729
4910
  if (!agent) {
4730
4911
  return;
4731
4912
  }
4913
+ this.hasShownThoughtProcess = false;
4732
4914
  const alphaZeroEngaged = this.alphaZeroModeEnabled;
4733
4915
  const alphaZeroDifficult = alphaZeroEngaged ? this.isDifficultProblem(userRequest) : false;
4734
4916
  const requestForAgent = alphaZeroEngaged
4735
4917
  ? this.buildAlphaZeroPrompt(userRequest, alphaZeroDifficult)
4736
4918
  : userRequest;
4919
+ const skipReflectionForThisRun = this.skipNextAutoReflection;
4920
+ this.skipNextAutoReflection = false;
4921
+ const scrollbackStartIndex = this.terminalInput.getScrollbackBuffer().length;
4737
4922
  const alphaZeroStatusId = 'alpha-zero';
4738
4923
  let alphaZeroStatusApplied = false;
4739
4924
  let alphaZeroTaskStarted = false;
@@ -4767,6 +4952,8 @@ export class InteractiveShell {
4767
4952
  this.uiAdapter.startProcessing('Working on your request');
4768
4953
  this.setProcessingStatus();
4769
4954
  let responseText = '';
4955
+ let detectedFailure = null;
4956
+ let hadUnhandledError = false;
4770
4957
  try {
4771
4958
  // Start streaming - no header needed, the input area already provides context
4772
4959
  this.startStreamingHeartbeat(alphaZeroEngaged ? 'AlphaZero RL' : 'Streaming response');
@@ -4789,18 +4976,18 @@ export class InteractiveShell {
4789
4976
  duration: 0,
4790
4977
  }));
4791
4978
  // AlphaZero: Check for failure in response
4792
- const failure = detectFailure(responseText, {
4979
+ detectedFailure = detectFailure(responseText, {
4793
4980
  toolCalls: this.currentToolCalls,
4794
4981
  userMessage: userRequest,
4795
4982
  });
4796
4983
  if (alphaZeroEngaged && alphaZeroTaskStarted && !alphaZeroTaskCompleted) {
4797
- this.alphaZeroMetrics.completeAlphaZeroTask(!failure);
4984
+ this.alphaZeroMetrics.completeAlphaZeroTask(!detectedFailure);
4798
4985
  alphaZeroTaskCompleted = true;
4799
4986
  }
4800
- if (failure) {
4801
- this.lastFailure = failure;
4987
+ if (detectedFailure) {
4988
+ this.lastFailure = detectedFailure;
4802
4989
  // Check if we have a recovery strategy
4803
- const strategy = findRecoveryStrategy(failure);
4990
+ const strategy = findRecoveryStrategy(detectedFailure);
4804
4991
  if (strategy) {
4805
4992
  display.showSystemMessage(`šŸ”„ Found recovery strategy for this type of issue (success rate: ${Math.round(strategy.successRate * 100)}%)`);
4806
4993
  }
@@ -4824,6 +5011,7 @@ export class InteractiveShell {
4824
5011
  }
4825
5012
  catch (error) {
4826
5013
  const handled = this.handleProviderError(error, () => this.processRequest(userRequest));
5014
+ hadUnhandledError = !handled;
4827
5015
  if (alphaZeroEngaged && alphaZeroTaskStarted && !alphaZeroTaskCompleted) {
4828
5016
  this.alphaZeroMetrics.completeAlphaZeroTask(false);
4829
5017
  alphaZeroTaskCompleted = true;
@@ -4834,6 +5022,24 @@ export class InteractiveShell {
4834
5022
  }
4835
5023
  }
4836
5024
  finally {
5025
+ const runLogEntry = this.buildRunLogEntry(userRequest, responseText, scrollbackStartIndex, {
5026
+ alphaZeroEngaged,
5027
+ alphaZeroDifficult,
5028
+ failureType: detectedFailure?.type ?? (hadUnhandledError ? 'unhandled-error' : null),
5029
+ });
5030
+ this.lastRunLog = runLogEntry;
5031
+ const allowAutoChain = alphaZeroEngaged && this.autoContinueEnabled && isErosolarRepo(this.workingDir);
5032
+ let shouldStopAuto = false;
5033
+ if (this.alphaZeroAutoImproveActive) {
5034
+ shouldStopAuto = this.shouldStopAlphaZeroAutoImprove(responseText, allowAutoChain);
5035
+ if (shouldStopAuto) {
5036
+ this.alphaZeroAutoImproveActive = false;
5037
+ this.alphaZeroAutoImproveIterations = 0;
5038
+ }
5039
+ }
5040
+ if (!skipReflectionForThisRun && !shouldStopAuto) {
5041
+ this.maybeQueueAlphaZeroSelfReflection(runLogEntry, alphaZeroEngaged, allowAutoChain);
5042
+ }
4837
5043
  if (alphaZeroEngaged && alphaZeroStatusApplied) {
4838
5044
  this.statusTracker.clearOverride(alphaZeroStatusId);
4839
5045
  }
@@ -4884,6 +5090,7 @@ export class InteractiveShell {
4884
5090
  if (!agent) {
4885
5091
  return;
4886
5092
  }
5093
+ this.hasShownThoughtProcess = false;
4887
5094
  this.isProcessing = true;
4888
5095
  this.uiUpdates.setMode('processing');
4889
5096
  this.terminalInput.setStreaming(true);
@@ -4924,6 +5131,7 @@ When truly finished with ALL tasks, explicitly state "TASK_FULLY_COMPLETE".`;
4924
5131
  }
4925
5132
  while (iteration < MAX_ITERATIONS) {
4926
5133
  iteration++;
5134
+ this.hasShownThoughtProcess = false;
4927
5135
  display.showSystemMessage(`\nšŸ“ Iteration ${iteration}/${MAX_ITERATIONS}`);
4928
5136
  this.updateStatusMessage(`Working on iteration ${iteration}...`);
4929
5137
  try {
@@ -5432,6 +5640,7 @@ What's the next action?`;
5432
5640
  // Send the error to the agent for fixing
5433
5641
  display.showThinking('Analyzing build errors');
5434
5642
  this.refreshStatusLine(true);
5643
+ this.hasShownThoughtProcess = false;
5435
5644
  const response = await this.withStreamingUi('Fixing build errors', () => this.agent.send(prompt, true));
5436
5645
  display.stopThinking();
5437
5646
  this.refreshStatusLine(true);
@@ -5467,22 +5676,15 @@ What's the next action?`;
5467
5676
  onStreamFallback: (info) => this.handleStreamingFallback(info),
5468
5677
  onAssistantMessage: (content, metadata) => {
5469
5678
  const enriched = this.buildDisplayMetadata(metadata);
5679
+ const parsed = this.splitThinkingResponse(content);
5680
+ const thinking = parsed?.thinking ?? null;
5681
+ const responseContent = parsed ? parsed.response?.trim() ?? '' : content.trim();
5470
5682
  // Update spinner based on message type
5471
5683
  if (metadata.isFinal) {
5684
+ this.presentThoughtProcess(thinking, enriched, { wasStreamed: metadata.wasStreamed });
5472
5685
  // Skip display if content was already streamed to avoid double-display
5473
- if (!metadata.wasStreamed) {
5474
- const parsed = this.splitThinkingResponse(content);
5475
- if (parsed?.thinking) {
5476
- const summary = this.extractThoughtSummary(parsed.thinking);
5477
- if (summary) {
5478
- display.updateThinking(`šŸ’­ ${summary}`);
5479
- }
5480
- display.showAssistantMessage(parsed.thinking, { ...enriched, isFinal: false });
5481
- }
5482
- const finalContent = parsed?.response?.trim() || content;
5483
- if (finalContent) {
5484
- display.showAssistantMessage(finalContent, enriched);
5485
- }
5686
+ if (!metadata.wasStreamed && responseContent) {
5687
+ display.showAssistantMessage(responseContent, enriched);
5486
5688
  }
5487
5689
  // Status shown in mode controls bar - no separate status line needed
5488
5690
  display.stopThinking();
@@ -5499,12 +5701,16 @@ What's the next action?`;
5499
5701
  void this.enforceAutoTests('final-response');
5500
5702
  }
5501
5703
  else {
5704
+ if (thinking) {
5705
+ this.presentThoughtProcess(thinking, enriched, { wasStreamed: metadata.wasStreamed });
5706
+ }
5502
5707
  // Non-final message = narrative text before tool calls (Claude Code style)
5503
5708
  // Stop spinner and show the narrative text directly
5504
5709
  display.stopThinking();
5505
5710
  // Skip display if content was already streamed to avoid double-display
5506
5711
  if (!metadata.wasStreamed) {
5507
- display.showNarrative(content.trim());
5712
+ const narrative = parsed?.response ?? content;
5713
+ display.showNarrative(narrative.trim());
5508
5714
  }
5509
5715
  // The isProcessing flag already shows "ā³ Processing..." - no need for duplicate status
5510
5716
  this.requestPromptRefresh();
@@ -5687,6 +5893,19 @@ What's the next action?`;
5687
5893
  contextWindowTokens: this.activeContextWindowTokens,
5688
5894
  };
5689
5895
  }
5896
+ presentThoughtProcess(thinking, metadata, options) {
5897
+ if (!thinking || this.hasShownThoughtProcess) {
5898
+ return;
5899
+ }
5900
+ const summary = this.extractThoughtSummary(thinking);
5901
+ if (summary) {
5902
+ display.updateThinking(`šŸ’­ ${summary}`);
5903
+ }
5904
+ if (!options?.wasStreamed) {
5905
+ display.showAssistantMessage(thinking, { ...metadata, isFinal: false });
5906
+ }
5907
+ this.hasShownThoughtProcess = true;
5908
+ }
5690
5909
  handleContextTelemetry(metadata, displayMetadata) {
5691
5910
  if (!metadata.isFinal) {
5692
5911
  return null;
@@ -6047,7 +6266,7 @@ What's the next action?`;
6047
6266
  }
6048
6267
  handleAgentSetupError(error, retryAction, providerOverride) {
6049
6268
  this.pendingInteraction = null;
6050
- const provider = providerOverride ?? this.sessionState.provider;
6269
+ const provider = providerOverride === undefined ? this.sessionState.provider : providerOverride;
6051
6270
  const apiKeyIssue = detectApiKeyError(error, provider);
6052
6271
  if (apiKeyIssue) {
6053
6272
  this.handleApiKeyIssue(apiKeyIssue, retryAction);
@@ -6067,7 +6286,8 @@ What's the next action?`;
6067
6286
  this.requestPromptRefresh(true);
6068
6287
  }
6069
6288
  handleProviderError(error, retryAction) {
6070
- const apiKeyIssue = detectApiKeyError(error, this.sessionState.provider);
6289
+ const providerHint = error instanceof MissingSecretError ? null : this.sessionState.provider;
6290
+ const apiKeyIssue = detectApiKeyError(error, providerHint);
6071
6291
  if (!apiKeyIssue) {
6072
6292
  return false;
6073
6293
  }
@@ -6076,13 +6296,19 @@ What's the next action?`;
6076
6296
  }
6077
6297
  handleApiKeyIssue(info, retryAction) {
6078
6298
  const secret = info.secret ?? null;
6079
- const providerLabel = info.provider ? this.providerLabel(info.provider) : 'the selected provider';
6299
+ const providerLabel = info.provider
6300
+ ? this.providerLabel(info.provider)
6301
+ : secret?.providers?.length
6302
+ ? this.providerLabel(secret.providers[0])
6303
+ : null;
6304
+ const targetLabel = providerLabel ?? secret?.label ?? 'this tool';
6305
+ this.apiKeyGateActive = !!secret;
6080
6306
  if (!secret) {
6081
6307
  this.pendingSecretRetry = null;
6082
6308
  const guidance = 'Run "/secrets" to configure the required API key or export it (e.g., EXPORT KEY=value) before launching the CLI.';
6083
6309
  const baseMessage = info.type === 'missing'
6084
- ? `An API key is required before using ${providerLabel}.`
6085
- : `API authentication failed for ${providerLabel}.`;
6310
+ ? `An API key is required before using ${targetLabel}.`
6311
+ : `API authentication failed for ${targetLabel}.`;
6086
6312
  display.showWarning(`${baseMessage} ${guidance}`.trim());
6087
6313
  return;
6088
6314
  }
@@ -6091,8 +6317,8 @@ What's the next action?`;
6091
6317
  display.showWarning(info.message.trim());
6092
6318
  }
6093
6319
  const prefix = isMissing
6094
- ? `${secret.label} is required before you can use ${providerLabel}.`
6095
- : `${secret.label} appears to be invalid for ${providerLabel}.`;
6320
+ ? `${secret.label} is required before you can use ${targetLabel}.`
6321
+ : `${secret.label} appears to be invalid for ${targetLabel}.`;
6096
6322
  display.showWarning(prefix);
6097
6323
  this.pendingSecretRetry = retryAction ?? null;
6098
6324
  this.pendingInteraction = { type: 'secret-input', secret };