erosolar-cli 2.1.169 → 2.1.171

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 (59) hide show
  1. package/dist/codex/capabilities/codexCoreCapability.d.ts +6 -0
  2. package/dist/codex/capabilities/codexCoreCapability.d.ts.map +1 -0
  3. package/dist/codex/capabilities/codexCoreCapability.js +516 -0
  4. package/dist/codex/capabilities/codexCoreCapability.js.map +1 -0
  5. package/dist/codex/fs.d.ts +4 -0
  6. package/dist/codex/fs.d.ts.map +1 -0
  7. package/dist/codex/fs.js +25 -0
  8. package/dist/codex/fs.js.map +1 -0
  9. package/dist/codex/persistence/planStore.d.ts +4 -0
  10. package/dist/codex/persistence/planStore.d.ts.map +1 -0
  11. package/dist/codex/persistence/planStore.js +59 -0
  12. package/dist/codex/persistence/planStore.js.map +1 -0
  13. package/dist/codex/pluginAllowlist.d.ts +4 -0
  14. package/dist/codex/pluginAllowlist.d.ts.map +1 -0
  15. package/dist/codex/pluginAllowlist.js +14 -0
  16. package/dist/codex/pluginAllowlist.js.map +1 -0
  17. package/dist/codex/types.d.ts +21 -0
  18. package/dist/codex/types.d.ts.map +1 -0
  19. package/dist/codex/types.js +62 -0
  20. package/dist/codex/types.js.map +1 -0
  21. package/dist/core/agent.d.ts +13 -0
  22. package/dist/core/agent.d.ts.map +1 -1
  23. package/dist/core/agent.js +90 -15
  24. package/dist/core/agent.js.map +1 -1
  25. package/dist/headless/evalMode.d.ts.map +1 -1
  26. package/dist/headless/evalMode.js +6 -0
  27. package/dist/headless/evalMode.js.map +1 -1
  28. package/dist/headless/headlessApp.d.ts.map +1 -1
  29. package/dist/headless/headlessApp.js +6 -0
  30. package/dist/headless/headlessApp.js.map +1 -1
  31. package/dist/mcp/sseClient.d.ts +4 -1
  32. package/dist/mcp/sseClient.d.ts.map +1 -1
  33. package/dist/mcp/sseClient.js +36 -2
  34. package/dist/mcp/sseClient.js.map +1 -1
  35. package/dist/mcp/stdioClient.d.ts +4 -1
  36. package/dist/mcp/stdioClient.d.ts.map +1 -1
  37. package/dist/mcp/stdioClient.js +41 -1
  38. package/dist/mcp/stdioClient.js.map +1 -1
  39. package/dist/mcp/toolBridge.d.ts +3 -0
  40. package/dist/mcp/toolBridge.d.ts.map +1 -1
  41. package/dist/mcp/toolBridge.js +2 -2
  42. package/dist/mcp/toolBridge.js.map +1 -1
  43. package/dist/mcp/types.d.ts +18 -0
  44. package/dist/mcp/types.d.ts.map +1 -1
  45. package/dist/shell/interactiveShell.d.ts +9 -0
  46. package/dist/shell/interactiveShell.d.ts.map +1 -1
  47. package/dist/shell/interactiveShell.js +56 -0
  48. package/dist/shell/interactiveShell.js.map +1 -1
  49. package/dist/shell/shellApp.d.ts.map +1 -1
  50. package/dist/shell/shellApp.js +9 -7
  51. package/dist/shell/shellApp.js.map +1 -1
  52. package/dist/ui/PromptController.d.ts +3 -0
  53. package/dist/ui/PromptController.d.ts.map +1 -1
  54. package/dist/ui/PromptController.js.map +1 -1
  55. package/dist/ui/UnifiedUIRenderer.d.ts +3 -0
  56. package/dist/ui/UnifiedUIRenderer.d.ts.map +1 -1
  57. package/dist/ui/UnifiedUIRenderer.js +16 -0
  58. package/dist/ui/UnifiedUIRenderer.js.map +1 -1
  59. package/package.json +1 -1
@@ -90,6 +90,7 @@ export class InteractiveShell {
90
90
  profile;
91
91
  profileLabel;
92
92
  workingDir;
93
+ codexContext;
93
94
  runtimeSession;
94
95
  baseSystemPrompt;
95
96
  workspaceOptions;
@@ -136,6 +137,7 @@ export class InteractiveShell {
136
137
  autosaveEnabled;
137
138
  verificationEnabled = false;
138
139
  criticalApprovalMode = 'auto';
140
+ codexApprovalForced = false;
139
141
  editGuardMode = 'display-edits';
140
142
  pendingPermissionInput = null;
141
143
  suppressNextNetworkReset = false;
@@ -190,6 +192,7 @@ export class InteractiveShell {
190
192
  version;
191
193
  alternateScreenEnabled;
192
194
  welcomeShown = false;
195
+ guardrailBannerShown = false;
193
196
  renderer;
194
197
  // Message queue for streaming mode coordination - prevents race conditions
195
198
  pendingMessages = [];
@@ -197,6 +200,7 @@ export class InteractiveShell {
197
200
  this.profile = config.profile;
198
201
  this.profileLabel = config.profileLabel;
199
202
  this.workingDir = config.workingDir;
203
+ this.codexContext = config.codexContext;
200
204
  this.runtimeSession = config.session;
201
205
  this.baseSystemPrompt = config.baseSystemPrompt;
202
206
  this.workspaceOptions = { ...config.workspaceOptions };
@@ -204,6 +208,10 @@ export class InteractiveShell {
204
208
  this.thinkingMode = this.sessionPreferences.thinkingMode;
205
209
  this.autosaveEnabled = this.sessionPreferences.autosave;
206
210
  this.criticalApprovalMode = this.sessionPreferences.criticalApprovalMode;
211
+ if (this.codexContext && this.shouldForceApprovalMode(this.codexContext.approvalPolicy)) {
212
+ this.criticalApprovalMode = 'approval';
213
+ this.codexApprovalForced = true;
214
+ }
207
215
  const featureFlags = loadFeatureFlags();
208
216
  this.verificationEnabled = featureFlags.verification === true;
209
217
  this.sessionRestoreConfig = config.sessionRestore ?? { mode: 'none' };
@@ -507,6 +515,51 @@ export class InteractiveShell {
507
515
  }
508
516
  return pathValue;
509
517
  }
518
+ shouldForceApprovalMode(policy) {
519
+ return policy === 'on-request' || policy === 'untrusted' || policy === 'never';
520
+ }
521
+ getGuardrailMeta() {
522
+ if (!this.codexContext) {
523
+ return {};
524
+ }
525
+ const approvals = this.codexContext.approvalPolicy === 'on-request' || this.codexContext.approvalPolicy === 'untrusted'
526
+ ? 'ask'
527
+ : this.codexContext.approvalPolicy === 'never'
528
+ ? 'never'
529
+ : 'auto';
530
+ const sandbox = this.codexContext.sandboxMode === 'workspace-write'
531
+ ? 'workspace'
532
+ : this.codexContext.sandboxMode === 'danger-full-access'
533
+ ? 'danger'
534
+ : this.codexContext.sandboxMode;
535
+ const network = this.codexContext.networkAccess === 'enabled' ? 'enabled' : 'restricted';
536
+ return { sandbox, network, approvals };
537
+ }
538
+ describePlanPath() {
539
+ const planPath = join(this.workingDir, '.erosolar', 'codex', 'plan.json');
540
+ const relative = planPath.startsWith(this.workingDir) && planPath.length > this.workingDir.length
541
+ ? planPath.slice(this.workingDir.length + 1)
542
+ : planPath;
543
+ return this.abbreviatePath(relative);
544
+ }
545
+ maybeShowCodexGuardrails() {
546
+ if (!this.codexContext || this.guardrailBannerShown) {
547
+ return;
548
+ }
549
+ const meta = this.getGuardrailMeta();
550
+ const lines = [];
551
+ lines.push(`Guardrails: sandbox ${meta.sandbox ?? 'workspace'} · network ${meta.network ?? 'restricted'} · approvals ${meta.approvals ?? 'auto'}`);
552
+ lines.push('Flow: plan before edits, targeted reads, one in-progress step, validate once at the end.');
553
+ const planPath = this.describePlanPath();
554
+ if (planPath) {
555
+ lines.push(`Plan file: ${planPath}`);
556
+ }
557
+ if (this.codexApprovalForced) {
558
+ lines.push('Approval mode set to ask per environment policy.');
559
+ }
560
+ this.streamEventBlock(lines.join('\n'));
561
+ this.guardrailBannerShown = true;
562
+ }
510
563
  async checkAndShowUpdates() {
511
564
  try {
512
565
  const { checkForUpdates, getUpdateDecision, formatUpdateBanner, performBackgroundUpdate, readAutoUpdateState, shouldShowUpdateNotification, } = await import('../core/updateChecker.js');
@@ -624,6 +677,7 @@ export class InteractiveShell {
624
677
  this.terminalInput.start();
625
678
  this.resetRendererStreamingMode();
626
679
  await this.showWelcomeBanner();
680
+ this.maybeShowCodexGuardrails();
627
681
  // Now refresh control bar with profile/model/version info
628
682
  this.refreshControlBar();
629
683
  // Now sync renderer and control bar state
@@ -1646,7 +1700,9 @@ export class InteractiveShell {
1646
1700
  criticalApprovalHotkey: 'ctrl+shift+a',
1647
1701
  });
1648
1702
  const workspaceDisplay = this.abbreviatePath(this.workingDir);
1703
+ const guardrails = this.getGuardrailMeta();
1649
1704
  this.terminalInput.setChromeMeta({
1705
+ ...guardrails,
1650
1706
  profile: this.profileLabel,
1651
1707
  workspace: workspaceDisplay,
1652
1708
  directory: workspaceDisplay,