opencode-copilot-account-switcher 0.10.10 → 0.10.11

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.
@@ -1113,6 +1113,14 @@ export function isRetryableCopilotFetchError(error) {
1113
1113
  const message = getErrorMessage(error);
1114
1114
  return RETRYABLE_MESSAGES.some((part) => message.includes(part));
1115
1115
  }
1116
+ function isRetryableCopilotJsonParseError(error) {
1117
+ if (!error || isAbortError(error))
1118
+ return false;
1119
+ const message = getErrorMessage(error);
1120
+ const name = error instanceof Error ? error.name : "";
1121
+ const hasAiJsonParseSignature = name === "AI_JSONParseError" || message.includes("ai_jsonparseerror");
1122
+ return hasAiJsonParseSignature && message.includes("json parsing failed") && message.includes("text:");
1123
+ }
1116
1124
  export function createCopilotRetryingFetch(baseFetch, options) {
1117
1125
  const notifier = options?.notifier ?? noopNotifier;
1118
1126
  return async function retryingFetch(request, init) {
@@ -1292,11 +1300,14 @@ export function createCopilotRetryingFetch(baseFetch, options) {
1292
1300
  return response;
1293
1301
  }
1294
1302
  catch (error) {
1303
+ const retryableByMessage = isRetryableCopilotFetchError(error);
1304
+ const retryableCopilotJsonParse = isRetryableCopilotJsonParseError(error);
1295
1305
  debugLog("fetch threw", {
1296
1306
  message: getErrorMessage(error),
1297
- retryableByMessage: isRetryableCopilotFetchError(error),
1307
+ retryableByMessage,
1308
+ retryableCopilotJsonParse,
1298
1309
  });
1299
- if (!isCopilotUrl(safeRequest) || !isRetryableCopilotFetchError(error)) {
1310
+ if (!isCopilotUrl(safeRequest) || (!retryableByMessage && !retryableCopilotJsonParse)) {
1300
1311
  throw error;
1301
1312
  }
1302
1313
  if (isRetryableApiCallError(error)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-copilot-account-switcher",
3
- "version": "0.10.10",
3
+ "version": "0.10.11",
4
4
  "description": "GitHub Copilot account switcher plugin for OpenCode",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",