opencode-anthropic-multi-account 0.2.2 → 0.2.3
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 +8 -2
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1113,6 +1113,9 @@ var MAX_RESOLVE_ATTEMPTS = 10;
|
|
|
1113
1113
|
var SERVER_RETRY_BASE_MS = 1e3;
|
|
1114
1114
|
var SERVER_RETRY_MAX_MS = 4e3;
|
|
1115
1115
|
var PERMANENT_AUTH_FAILURE_STATUSES = /* @__PURE__ */ new Set([400, 401, 403]);
|
|
1116
|
+
function isAbortError(error) {
|
|
1117
|
+
return error instanceof Error && error.name === "AbortError";
|
|
1118
|
+
}
|
|
1116
1119
|
function createExecutorForProvider(providerName, dependencies) {
|
|
1117
1120
|
const {
|
|
1118
1121
|
handleRateLimitResponse: handleRateLimitResponse2,
|
|
@@ -1145,6 +1148,7 @@ function createExecutorForProvider(providerName, dependencies) {
|
|
|
1145
1148
|
runtime = await runtimeFactory.getRuntime(accountUuid);
|
|
1146
1149
|
response = await runtime.fetch(input, init);
|
|
1147
1150
|
} catch (error) {
|
|
1151
|
+
if (isAbortError(error)) throw error;
|
|
1148
1152
|
if (await handleRuntimeFetchFailure(manager, runtimeFactory, client, account, error)) {
|
|
1149
1153
|
continue;
|
|
1150
1154
|
}
|
|
@@ -1162,6 +1166,7 @@ function createExecutorForProvider(providerName, dependencies) {
|
|
|
1162
1166
|
try {
|
|
1163
1167
|
serverResponse = await runtime.fetch(input, init);
|
|
1164
1168
|
} catch (error) {
|
|
1169
|
+
if (isAbortError(error)) throw error;
|
|
1165
1170
|
if (await handleRuntimeFetchFailure(manager, runtimeFactory, client, account, error)) {
|
|
1166
1171
|
authFailureDuringServerRetry = true;
|
|
1167
1172
|
break;
|
|
@@ -1190,6 +1195,7 @@ function createExecutorForProvider(providerName, dependencies) {
|
|
|
1190
1195
|
return retryResponse;
|
|
1191
1196
|
}
|
|
1192
1197
|
} catch (error) {
|
|
1198
|
+
if (isAbortError(error)) throw error;
|
|
1193
1199
|
if (await handleRuntimeFetchFailure(manager, runtimeFactory, client, account, error)) {
|
|
1194
1200
|
continue;
|
|
1195
1201
|
}
|
|
@@ -2027,11 +2033,11 @@ function getUsageSummary(account) {
|
|
|
2027
2033
|
const parts = [];
|
|
2028
2034
|
const { five_hour, seven_day } = account.cachedUsage;
|
|
2029
2035
|
if (five_hour) {
|
|
2030
|
-
const reset = five_hour.
|
|
2036
|
+
const reset = five_hour.resets_at ? ` (resets ${formatTimeRemaining(five_hour.resets_at)})` : "";
|
|
2031
2037
|
parts.push(`5h: ${five_hour.utilization.toFixed(0)}%${reset}`);
|
|
2032
2038
|
}
|
|
2033
2039
|
if (seven_day) {
|
|
2034
|
-
const reset = seven_day.
|
|
2040
|
+
const reset = seven_day.resets_at ? ` (resets ${formatTimeRemaining(seven_day.resets_at)})` : "";
|
|
2035
2041
|
parts.push(`7d: ${seven_day.utilization.toFixed(0)}%${reset}`);
|
|
2036
2042
|
}
|
|
2037
2043
|
return parts.length > 0 ? parts.join(", ") : "no data";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-anthropic-multi-account",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.3",
|
|
4
4
|
"description": "OpenCode plugin for Anthropic multi-account management with automatic rate limit switching",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"directory": "packages/anthropic-multi-account"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"opencode-multi-account-core": "^0.2.
|
|
42
|
+
"opencode-multi-account-core": "^0.2.3",
|
|
43
43
|
"opencode-anthropic-auth": "^0.0.13",
|
|
44
44
|
"valibot": "^1.2.0"
|
|
45
45
|
},
|