@compilr-dev/cli 0.8.1 → 0.8.2

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.
Binary file
package/dist/repl-v2.js CHANGED
@@ -31,7 +31,7 @@ import { renderMascotWithLogo } from './ui/mascot/renderer.js';
31
31
  import { getStartupHighlights } from './changelog/index.js';
32
32
  import { registerCommands, executeCommand, allCommands, getAutocompleteCommands, setSkillCommandLoader, saveCurrentSession, saveCurrentTeam, loadProjectSession, archiveCurrentSession, convertMessagesToItems, } from './commands-v2/index.js';
33
33
  import { getCustomCommandRegistry } from './commands/custom-registry.js';
34
- import { getPlanModePrompt, createHandoffTool, createConsultTool, createDelegateTool, createDelegateBackgroundTool, } from '@compilr-dev/sdk';
34
+ import { getPlanModePrompt, createHandoffTool, createConsultTool, createDelegateTool, createDelegateBackgroundTool, classifyAgentError, } from '@compilr-dev/sdk';
35
35
  import { getHandoffHandler, getConsultHandler, getDelegateHandler, getDelegateBackgroundHandler, } from './shared-handlers.js';
36
36
  import { planRepository } from './db/repositories/index.js';
37
37
  import { PlanApprovalOverlayV2, } from './ui/overlay/impl/plan-approval-overlay-v2.js';
@@ -144,6 +144,26 @@ ${JSON.stringify(state.messages, null, 2)}
144
144
  log.error({ component: 'repl', err: error }, 'Failed to log agent request');
145
145
  }
146
146
  }
147
+ /**
148
+ * Map an agent/provider error to a terminal-friendly message. Classification is
149
+ * shared across hosts via the SDK (classifyAgentError); only the remediation
150
+ * wording is CLI-specific. The CLI checks for a *missing* key at startup, so this
151
+ * mainly catches an *invalid/expired* key surfacing as a runtime 401 mid-turn.
152
+ */
153
+ function friendlyTurnError(err) {
154
+ switch (classifyAgentError(err).category) {
155
+ case 'auth':
156
+ return 'Invalid or missing API key for this provider. Set a valid key with /keys (or export the provider env var). No key? Restart with --provider ollama for free local models.';
157
+ case 'rate_limit':
158
+ return 'Rate limited by the provider. Wait a moment and try again.';
159
+ case 'overloaded':
160
+ return 'The provider is overloaded right now. Try again in a moment.';
161
+ case 'connection':
162
+ return "Can't reach the provider. Check your internet connection and try again.";
163
+ default:
164
+ return String(err);
165
+ }
166
+ }
147
167
  // =============================================================================
148
168
  // REPL V2 Class
149
169
  // =============================================================================
@@ -3035,7 +3055,7 @@ export class ReplV2 {
3035
3055
  }
3036
3056
  catch (err) {
3037
3057
  if (!signal.aborted) {
3038
- this.ui.print({ type: 'error', message: String(err) });
3058
+ this.ui.print({ type: 'error', message: friendlyTurnError(err) });
3039
3059
  }
3040
3060
  this.ui.setAgentRunning(false);
3041
3061
  this.ui.setThinking(false); // Ensure thinking indicator is cleared
@@ -3287,7 +3307,7 @@ export class ReplV2 {
3287
3307
  }
3288
3308
  catch (err) {
3289
3309
  if (!signal.aborted) {
3290
- this.ui.print({ type: 'error', message: `${label} Error: ${String(err)}` });
3310
+ this.ui.print({ type: 'error', message: `${label} ${friendlyTurnError(err)}` });
3291
3311
  // Notify other terminals about failure
3292
3312
  try {
3293
3313
  const sid = getActiveTerminalSessionId();
@@ -3602,7 +3622,7 @@ export class ReplV2 {
3602
3622
  }
3603
3623
  catch (err) {
3604
3624
  if (!signal.aborted) {
3605
- this.ui.print({ type: 'error', message: String(err) });
3625
+ this.ui.print({ type: 'error', message: friendlyTurnError(err) });
3606
3626
  }
3607
3627
  this.ui.setAgentRunning(false);
3608
3628
  this.ui.setThinking(false); // Ensure thinking indicator is cleared
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@compilr-dev/cli",
3
- "version": "0.8.1",
3
+ "version": "0.8.2",
4
4
  "description": "AI-powered coding assistant CLI using @compilr-dev/agents",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -60,7 +60,7 @@
60
60
  "@compilr-dev/editor-core": "^0.0.2",
61
61
  "@compilr-dev/factory": "^0.1.35",
62
62
  "@compilr-dev/logger": "^0.1.0",
63
- "@compilr-dev/sdk": "^0.14.0",
63
+ "@compilr-dev/sdk": "^0.15.0",
64
64
  "@compilr-dev/ui-core": "^0.0.1",
65
65
  "@modelcontextprotocol/sdk": "^1.23.0",
66
66
  "ansi-escapes": "^7.3.0",