copilot-api-plus 1.2.2 → 1.2.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.
package/README.md CHANGED
@@ -50,7 +50,7 @@
50
50
  | 🛡️ **网络弹性** | 120s 连接超时 + 指数退避重试(2s/5s/10s) |
51
51
  | ✂️ **上下文透传** | 全量透传上下文至上游 API,由客户端(如 Claude Code)自行管理压缩 |
52
52
  | 🔍 **智能模型匹配** | 自动处理模型名格式差异(日期后缀、dash/dot 版本号等) |
53
- | 🧠 **Thinking 思考链** | 自动为支持的模型启用深度思考(thinking/reasoning),提升代码质量 |
53
+ | 🧠 **Thinking 思维链** | 自动为支持的模型启用深度思考(thinking/reasoning),提升代码质量 |
54
54
 
55
55
  ---
56
56
 
package/dist/main.js CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { n as forwardError, t as HTTPError } from "./error-CvwUkoEo.js";
3
- import { a as stopCopilotTokenRefresh, c as cacheModels, d as isNullish, f as sleep, g as ensurePaths, h as PATHS, i as setupGitHubToken, l as cacheVSCodeVersion, m as getCopilotUsage, n as refreshCopilotToken, o as pollAccessToken, p as accountManager, r as setupCopilotToken, s as getDeviceCode, t as clearGithubToken, u as findModel } from "./token-CsSZOO_Z.js";
3
+ import { _ as ensurePaths, a as stopCopilotTokenRefresh, c as accountManager, d as cacheVSCodeVersion, f as findModel, g as PATHS, h as sleep, i as setupGitHubToken, l as getCopilotUsage, m as rootCause, n as refreshCopilotToken, o as pollAccessToken, p as isNullish, r as setupCopilotToken, s as getDeviceCode, t as clearGithubToken, u as cacheModels } from "./token-CMRVLQJZ.js";
4
4
  import { a as GITHUB_BASE_URL, c as copilotHeaders, n as state, o as GITHUB_CLIENT_ID, s as copilotBaseUrl, u as standardHeaders } from "./get-user-BT7hEyDN.js";
5
5
  import { createRequire } from "node:module";
6
6
  import { defineCommand, runMain } from "citty";
@@ -223,7 +223,8 @@ const addAccount = defineCommand({
223
223
  consola.success(`Account added: ${account.githubLogin} (${account.label})`);
224
224
  consola.info(`Total accounts: ${accountManager.accountCount}`);
225
225
  } catch (err) {
226
- consola.error("Failed to add account:", err);
226
+ consola.warn(`Failed to add account: ${rootCause(err)}`);
227
+ consola.debug("Failed to add account:", err);
227
228
  process.exitCode = 1;
228
229
  }
229
230
  }
@@ -280,7 +281,8 @@ const listAccounts = defineCommand({
280
281
  consola.log(botBorder);
281
282
  consola.log("");
282
283
  } catch (err) {
283
- consola.error("Failed to list accounts:", err);
284
+ consola.warn(`Failed to list accounts: ${rootCause(err)}`);
285
+ consola.debug("Failed to list accounts:", err);
284
286
  process.exitCode = 1;
285
287
  }
286
288
  }
@@ -355,7 +357,8 @@ const removeAccount = defineCommand({
355
357
  process.exitCode = 1;
356
358
  }
357
359
  } catch (err) {
358
- consola.error("Failed to remove account:", err);
360
+ consola.warn(`Failed to remove account: ${rootCause(err)}`);
361
+ consola.debug("Failed to remove account:", err);
359
362
  process.exitCode = 1;
360
363
  }
361
364
  }
@@ -427,7 +430,8 @@ const checkUsage = defineCommand({
427
430
  const completionsLine = summarizeQuota("Completions", usage.quota_snapshots.completions);
428
431
  consola.box(`Copilot Usage (plan: ${usage.copilot_plan})\nQuota resets: ${usage.quota_reset_date}\n\nQuotas:\n ${premiumLine}\n ${chatLine}\n ${completionsLine}`);
429
432
  } catch (err) {
430
- consola.error("Failed to fetch Copilot usage:", err);
433
+ consola.warn(`Failed to fetch Copilot usage: ${rootCause(err)}`);
434
+ consola.debug("Failed to fetch Copilot usage:", err);
431
435
  process.exit(1);
432
436
  }
433
437
  }
@@ -1861,7 +1865,8 @@ async function createWithSingleAccount(payload) {
1861
1865
  body: bodyString
1862
1866
  });
1863
1867
  } catch (refreshError) {
1864
- consola.error("Failed to refresh token:", refreshError);
1868
+ consola.warn(`Failed to refresh token: ${rootCause(refreshError)}`);
1869
+ consola.debug("Failed to refresh token:", refreshError);
1865
1870
  }
1866
1871
  }
1867
1872
  if (!response.ok) {
@@ -3054,7 +3059,7 @@ async function runServer(options) {
3054
3059
  const { HTTPError } = await import("./error-DLqcVQL_.js");
3055
3060
  if (error instanceof HTTPError && error.response.status === 401) {
3056
3061
  consola.error("Failed to get Copilot token - GitHub token may be invalid or Copilot access revoked");
3057
- const { clearGithubToken } = await import("./token-BsOH3gXZ.js");
3062
+ const { clearGithubToken } = await import("./token-CHJ7rYg0.js");
3058
3063
  await clearGithubToken();
3059
3064
  consola.info("Please restart to re-authenticate");
3060
3065
  }