oroute-cli 0.2.0 → 0.2.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.
Files changed (2) hide show
  1. package/dist/oroute.cjs +16 -8
  2. package/package.json +1 -1
package/dist/oroute.cjs CHANGED
@@ -243494,7 +243494,7 @@ ${YELLOW} \uCD5C\uB300 \uB77C\uC778 \uC218(${MULTILINE_MAX_LINES})\uC5D0 \uB3C4
243494
243494
  });
243495
243495
  }
243496
243496
  async function agentChat(config) {
243497
- const apiUrl = config.apiUrl ?? "http://localhost:3001";
243497
+ const apiUrl = config.apiUrl ?? "https://api.oroute.itshin.com";
243498
243498
  let model = config.model ?? "auto";
243499
243499
  let cwd = process.cwd();
243500
243500
  const homeDir = os7.homedir();
@@ -244016,7 +244016,13 @@ ${headers.join("\n")}${RESET}
244016
244016
  continue;
244017
244017
  }
244018
244018
  const msg = err instanceof Error ? err.message : "unknown error";
244019
- printError(`Request failed: ${msg}`);
244019
+ if (msg.includes("fetch failed") || msg.includes("ECONNREFUSED") || msg.includes("Could not resolve")) {
244020
+ printError(`API \uC11C\uBC84\uC5D0 \uC5F0\uACB0\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4 (${apiUrl})`);
244021
+ console.log(`${YELLOW} \uC11C\uBC84\uAC00 \uC544\uC9C1 \uBC30\uD3EC\uB418\uC9C0 \uC54A\uC558\uAC70\uB098 \uB124\uD2B8\uC6CC\uD06C \uBB38\uC81C\uC77C \uC218 \uC788\uC2B5\uB2C8\uB2E4.${RESET}`);
244022
+ console.log(`${GRAY} \uB85C\uCEEC \uC11C\uBC84 \uC0AC\uC6A9: oroute --api-url http://localhost:3001${RESET}`);
244023
+ } else {
244024
+ printError(`Request failed: ${msg}`);
244025
+ }
244020
244026
  messages.pop();
244021
244027
  continueLoop = false;
244022
244028
  }
@@ -244103,6 +244109,7 @@ var WHITE2 = "\x1B[37m";
244103
244109
  var VERSION = "0.2.0";
244104
244110
  var CONFIG_DIR = path18.join(os9.homedir(), ".oroute");
244105
244111
  var CONFIG_FILE = path18.join(CONFIG_DIR, "config.json");
244112
+ var DEFAULT_API_URL = "https://api.oroute.itshin.com";
244106
244113
  var LOCAL_API_URL = "http://localhost:3001";
244107
244114
  var ASCII_CHARACTER = `
244108
244115
  ${GRAY4} \u2584\u2584\u2588\u2588\u2588\u2584\u2584
@@ -244119,7 +244126,8 @@ ${GRAY4} \u2584\u2584\u2588\u2588\u2588\u2584\u2584
244119
244126
  \u2514\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2518${RESET2}`;
244120
244127
  function displayInlineImage(imagePath, width = 20) {
244121
244128
  const termProgram = process.env["TERM_PROGRAM"] ?? "";
244122
- const supportsImages = ["iTerm.app", "WezTerm"].includes(termProgram);
244129
+ const isWindows = process.platform === "win32";
244130
+ const supportsImages = !isWindows && ["iTerm.app", "WezTerm"].includes(termProgram);
244123
244131
  if (!supportsImages) return false;
244124
244132
  try {
244125
244133
  const imageData = fs19.readFileSync(imagePath);
@@ -244250,7 +244258,7 @@ async function loginWithApiKey(config) {
244250
244258
  console.log(`${YELLOW3} Invalid key format. O'Route keys start with "or-"${RESET2}`);
244251
244259
  return;
244252
244260
  }
244253
- const apiUrl = config.apiUrl ?? LOCAL_API_URL;
244261
+ const apiUrl = config.apiUrl ?? DEFAULT_API_URL;
244254
244262
  console.log(`${GRAY4} Verifying key...${RESET2}`);
244255
244263
  try {
244256
244264
  const res = await fetch(`${apiUrl}/v1/providers/status`, {
@@ -244276,7 +244284,7 @@ async function loginWithApiKey(config) {
244276
244284
  }
244277
244285
  }
244278
244286
  async function loginWithGoogle(config) {
244279
- const apiUrl = config.apiUrl ?? LOCAL_API_URL;
244287
+ const apiUrl = config.apiUrl ?? DEFAULT_API_URL;
244280
244288
  console.log(`${GRAY4} Requesting device code...${RESET2}`);
244281
244289
  try {
244282
244290
  const res = await fetch(`${apiUrl}/v1/auth/device`, {
@@ -244329,7 +244337,7 @@ async function chat(config) {
244329
244337
  console.log(`${YELLOW3} No API Key configured. Run option 1 first.${RESET2}`);
244330
244338
  return;
244331
244339
  }
244332
- const apiUrl = config.apiUrl ?? LOCAL_API_URL;
244340
+ const apiUrl = config.apiUrl ?? DEFAULT_API_URL;
244333
244341
  const model = config.model ?? "auto";
244334
244342
  const cwd = process.cwd();
244335
244343
  console.log(`${GREEN2}${BOLD2} O'Route${RESET2} v${VERSION}`);
@@ -244378,7 +244386,7 @@ async function chat(config) {
244378
244386
  }
244379
244387
  }
244380
244388
  async function checkStatus(config) {
244381
- const apiUrl = config.apiUrl ?? LOCAL_API_URL;
244389
+ const apiUrl = config.apiUrl ?? DEFAULT_API_URL;
244382
244390
  console.log(`${GRAY4} Checking O'Route status...${RESET2}`);
244383
244391
  try {
244384
244392
  const res = await fetch(`${apiUrl}/health`, { signal: AbortSignal.timeout(5e3) });
@@ -244467,7 +244475,7 @@ async function main() {
244467
244475
  console.log(`${YELLOW3}No API Key. Run: oroute login${RESET2}`);
244468
244476
  process.exit(1);
244469
244477
  }
244470
- const apiUrl = config.apiUrl ?? LOCAL_API_URL;
244478
+ const apiUrl = config.apiUrl ?? DEFAULT_API_URL;
244471
244479
  try {
244472
244480
  const res = await fetch(`${apiUrl}/v1/messages`, {
244473
244481
  method: "POST",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oroute-cli",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "description": "O'Route CLI — AI API auto-routing for 13 models from your terminal",
5
5
  "type": "module",
6
6
  "bin": {