@nalvietnam/avatar-cli 1.12.0 → 1.12.1
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/dist/index.js +9 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -223,7 +223,7 @@ function spinnerWithElapsed(prefix) {
|
|
|
223
223
|
}
|
|
224
224
|
|
|
225
225
|
// src/lib/check-claude-code-subscription-and-quota.ts
|
|
226
|
-
var QUOTA_VERIFY_TIMEOUT_MS =
|
|
226
|
+
var QUOTA_VERIFY_TIMEOUT_MS = 6e4;
|
|
227
227
|
var QUOTA_VERIFY_PROMPT = "ok";
|
|
228
228
|
function checkClaudeCodeSubscriptionAuth() {
|
|
229
229
|
const result = spawnSync("claude", ["auth", "status"], { encoding: "utf8" });
|
|
@@ -283,7 +283,7 @@ function getQuotaErrorHint(reason) {
|
|
|
283
283
|
case "rate_limit":
|
|
284
284
|
return "B\u1ECB rate limit t\u1EA1m th\u1EDDi. Ch\u1EDD v\xE0i ph\xFAt r\u1ED3i ch\u1EA1y `avatar ai setup`.";
|
|
285
285
|
case "timeout":
|
|
286
|
-
return "
|
|
286
|
+
return "Timeout 60s: (1) m\u1EA1ng VN ch\u1EADm \u2014 th\u1EED VPN, (2) Anthropic API spike \u2014 retry v\xE0i ph\xFAt, (3) token v\u1EABn auth nh\u01B0ng quota h\u1EBFt \xE2m th\u1EA7m \u2014 check t\u1EA1i claude.ai/settings/usage.";
|
|
287
287
|
default:
|
|
288
288
|
return "L\u1ED7i ch\u01B0a bi\u1EBFt. Xem stderr \u1EDF tr\xEAn + ch\u1EA1y `claude --print ok` tay \u0111\u1EC3 debug.";
|
|
289
289
|
}
|
|
@@ -294,8 +294,13 @@ function verifyClaudeCodeQuota() {
|
|
|
294
294
|
timeout: QUOTA_VERIFY_TIMEOUT_MS,
|
|
295
295
|
stdio: ["ignore", "pipe", "pipe"]
|
|
296
296
|
});
|
|
297
|
-
|
|
298
|
-
|
|
297
|
+
const isTimeout = result.signal === "SIGTERM" || result.status === 143 || result.error?.code === "ETIMEDOUT";
|
|
298
|
+
if (isTimeout) {
|
|
299
|
+
return {
|
|
300
|
+
ok: false,
|
|
301
|
+
reason: "timeout",
|
|
302
|
+
detail: `claude --print > ${QUOTA_VERIFY_TIMEOUT_MS / 1e3}s (m\u1EA1ng ch\u1EADm / API rate limit / token revoked kh\xF4ng return error)`
|
|
303
|
+
};
|
|
299
304
|
}
|
|
300
305
|
const stderr = result.stderr || "";
|
|
301
306
|
const stdout = result.stdout || "";
|