@kenkaiiii/gg-agent 5.77.0 → 5.79.0

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 CHANGED
@@ -469,7 +469,9 @@ function classifyOverload(err) {
469
469
  if (statusCode === 529 || msg.includes("overloaded") || msg.includes("529")) {
470
470
  return "overloaded";
471
471
  }
472
- if (statusCode === 500 || statusCode === 502 || statusCode === 503 || statusCode === 504 || statusCode === 507 || msg.includes("api_error") || msg.includes("server_error") || msg.includes("internal server error") || msg.includes("bad gateway") || msg.includes("service unavailable") || msg.includes("gateway timeout") || msg.includes("exceeded request buffer limit while retrying upstream")) {
472
+ if (statusCode === 500 || statusCode === 502 || statusCode === 503 || statusCode === 504 || statusCode === 507 || // Cloudflare edge errors (origin unreachable, timed out). api.anthropic.com
473
+ // returned a 520 HTML page mid-run in the 2026-10-09 arena; it is transient.
474
+ statusCode !== void 0 && statusCode >= 520 && statusCode <= 524 || msg.includes("api_error") || msg.includes("server_error") || msg.includes("internal server error") || msg.includes("bad gateway") || msg.includes("service unavailable") || msg.includes("gateway timeout") || msg.includes("exceeded request buffer limit while retrying upstream")) {
473
475
  return "provider_error";
474
476
  }
475
477
  return null;
@@ -1509,6 +1511,7 @@ async function* agentLoop(messages, options) {
1509
1511
  resolveTool: options.resolveTool,
1510
1512
  toolMap,
1511
1513
  invalidToolArgumentCounts,
1514
+ countedInvalidArguments: /* @__PURE__ */ new Set(),
1512
1515
  markFatalToolArgumentError,
1513
1516
  seenToolCalls: /* @__PURE__ */ new Set()
1514
1517
  };
@@ -1740,8 +1743,10 @@ async function executeSingleToolCall(toolCall, options, pushEvent) {
1740
1743
  if (err instanceof ZodError) {
1741
1744
  const prettyError = prettifyError(err);
1742
1745
  const failureKey = `${toolCall.name}:${prettyError}`;
1743
- const failureCount = (options.invalidToolArgumentCounts.get(failureKey) ?? 0) + 1;
1746
+ const alreadyCounted = options.countedInvalidArguments.has(failureKey);
1747
+ const failureCount = (options.invalidToolArgumentCounts.get(failureKey) ?? 0) + (alreadyCounted ? 0 : 1);
1744
1748
  options.invalidToolArgumentCounts.set(failureKey, failureCount);
1749
+ options.countedInvalidArguments.add(failureKey);
1745
1750
  invalidArgAttempt = failureCount;
1746
1751
  const hints = argumentHints(tool, toolCall.args);
1747
1752
  resultContent = `Invalid arguments for tool \`${toolCall.name}\`: