sam-coder-cli 1.0.3 → 1.0.4

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 (2) hide show
  1. package/bin/agi-cli.js +6 -2
  2. package/package.json +1 -1
package/bin/agi-cli.js CHANGED
@@ -400,6 +400,9 @@ async function callOpenRouterWithTools(messages) {
400
400
  });
401
401
 
402
402
  if (!response.ok) {
403
+ if (response.status === 401) {
404
+ throw new Error('AuthenticationError: Invalid API key. Please run /setup to reconfigure.');
405
+ }
403
406
  const error = await response.json();
404
407
  throw new Error(`API error: ${error.error?.message || response.statusText}`);
405
408
  }
@@ -431,6 +434,9 @@ async function callOpenRouterWithFunctions(messages) {
431
434
  });
432
435
 
433
436
  if (!response.ok) {
437
+ if (response.status === 401) {
438
+ throw new Error('AuthenticationError: Invalid API key. Please run /setup to reconfigure.');
439
+ }
434
440
  const error = await response.json();
435
441
  throw new Error(`API error: ${error.error?.message || response.statusText}`);
436
442
  }
@@ -790,8 +796,6 @@ async function start() {
790
796
  let config = await readConfig();
791
797
  if (!config || !config.OPENROUTER_API_KEY) {
792
798
  config = await runSetup();
793
- console.log('\nSetup complete. Please start the application again.');
794
- process.exit(0);
795
799
  }
796
800
 
797
801
  OPENROUTER_API_KEY = config.OPENROUTER_API_KEY;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sam-coder-cli",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "description": "SAM-CODER: An animated command-line AI assistant with agency capabilities.",
5
5
  "main": "bin/agi-cli.js",
6
6
  "bin": {