@kenkaiiii/gg-agent 5.77.0 → 5.78.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.cjs CHANGED
@@ -502,7 +502,9 @@ function classifyOverload(err) {
502
502
  if (statusCode === 529 || msg.includes("overloaded") || msg.includes("529")) {
503
503
  return "overloaded";
504
504
  }
505
- 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")) {
505
+ if (statusCode === 500 || statusCode === 502 || statusCode === 503 || statusCode === 504 || statusCode === 507 || // Cloudflare edge errors (origin unreachable, timed out). api.anthropic.com
506
+ // returned a 520 HTML page mid-run in the 2026-10-09 arena; it is transient.
507
+ 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")) {
506
508
  return "provider_error";
507
509
  }
508
510
  return null;
@@ -1542,6 +1544,7 @@ async function* agentLoop(messages, options) {
1542
1544
  resolveTool: options.resolveTool,
1543
1545
  toolMap,
1544
1546
  invalidToolArgumentCounts,
1547
+ countedInvalidArguments: /* @__PURE__ */ new Set(),
1545
1548
  markFatalToolArgumentError,
1546
1549
  seenToolCalls: /* @__PURE__ */ new Set()
1547
1550
  };
@@ -1773,8 +1776,10 @@ async function executeSingleToolCall(toolCall, options, pushEvent) {
1773
1776
  if (err instanceof import_zod.ZodError) {
1774
1777
  const prettyError = (0, import_zod.prettifyError)(err);
1775
1778
  const failureKey = `${toolCall.name}:${prettyError}`;
1776
- const failureCount = (options.invalidToolArgumentCounts.get(failureKey) ?? 0) + 1;
1779
+ const alreadyCounted = options.countedInvalidArguments.has(failureKey);
1780
+ const failureCount = (options.invalidToolArgumentCounts.get(failureKey) ?? 0) + (alreadyCounted ? 0 : 1);
1777
1781
  options.invalidToolArgumentCounts.set(failureKey, failureCount);
1782
+ options.countedInvalidArguments.add(failureKey);
1778
1783
  invalidArgAttempt = failureCount;
1779
1784
  const hints = argumentHints(tool, toolCall.args);
1780
1785
  resultContent = `Invalid arguments for tool \`${toolCall.name}\`: