@kenkaiiii/gg-agent 5.76.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 +9 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +9 -2
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -362,6 +362,11 @@ interface AgentOptions {
|
|
|
362
362
|
/** Extra HTTP headers attached to every model request (e.g. Kimi For Coding
|
|
363
363
|
* client-identity headers). Merged into the underlying SDK default headers. */
|
|
364
364
|
defaultHeaders?: StreamOptions["defaultHeaders"];
|
|
365
|
+
/** Provider-specific request-body fields forwarded to every model request
|
|
366
|
+
* (e.g. OpenRouter `provider: { zdr: true }`). See gg-ai `ProviderOptions`. */
|
|
367
|
+
providerOptions?: StreamOptions["providerOptions"];
|
|
368
|
+
/** Custom fetch implementation forwarded to the provider transport. */
|
|
369
|
+
fetch?: StreamOptions["fetch"];
|
|
365
370
|
/** OpenAI service tier for latency-sensitive first-party API requests. */
|
|
366
371
|
serviceTier?: StreamOptions["serviceTier"];
|
|
367
372
|
/** Codex Responses-Lite request shape override (see StreamOptions). */
|
package/dist/index.d.ts
CHANGED
|
@@ -362,6 +362,11 @@ interface AgentOptions {
|
|
|
362
362
|
/** Extra HTTP headers attached to every model request (e.g. Kimi For Coding
|
|
363
363
|
* client-identity headers). Merged into the underlying SDK default headers. */
|
|
364
364
|
defaultHeaders?: StreamOptions["defaultHeaders"];
|
|
365
|
+
/** Provider-specific request-body fields forwarded to every model request
|
|
366
|
+
* (e.g. OpenRouter `provider: { zdr: true }`). See gg-ai `ProviderOptions`. */
|
|
367
|
+
providerOptions?: StreamOptions["providerOptions"];
|
|
368
|
+
/** Custom fetch implementation forwarded to the provider transport. */
|
|
369
|
+
fetch?: StreamOptions["fetch"];
|
|
365
370
|
/** OpenAI service tier for latency-sensitive first-party API requests. */
|
|
366
371
|
serviceTier?: StreamOptions["serviceTier"];
|
|
367
372
|
/** Codex Responses-Lite request shape override (see StreamOptions). */
|
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 ||
|
|
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;
|
|
@@ -829,6 +831,8 @@ async function* agentLoop(messages, options) {
|
|
|
829
831
|
clearToolUses: options.clearToolUses,
|
|
830
832
|
userAgent: options.userAgent,
|
|
831
833
|
defaultHeaders: options.defaultHeaders,
|
|
834
|
+
providerOptions: options.providerOptions,
|
|
835
|
+
fetch: options.fetch,
|
|
832
836
|
// Flip to non-streaming fallback after repeated stream stalls.
|
|
833
837
|
...useNonStreamingFallback ? { streaming: false } : {}
|
|
834
838
|
});
|
|
@@ -1507,6 +1511,7 @@ async function* agentLoop(messages, options) {
|
|
|
1507
1511
|
resolveTool: options.resolveTool,
|
|
1508
1512
|
toolMap,
|
|
1509
1513
|
invalidToolArgumentCounts,
|
|
1514
|
+
countedInvalidArguments: /* @__PURE__ */ new Set(),
|
|
1510
1515
|
markFatalToolArgumentError,
|
|
1511
1516
|
seenToolCalls: /* @__PURE__ */ new Set()
|
|
1512
1517
|
};
|
|
@@ -1738,8 +1743,10 @@ async function executeSingleToolCall(toolCall, options, pushEvent) {
|
|
|
1738
1743
|
if (err instanceof ZodError) {
|
|
1739
1744
|
const prettyError = prettifyError(err);
|
|
1740
1745
|
const failureKey = `${toolCall.name}:${prettyError}`;
|
|
1741
|
-
const
|
|
1746
|
+
const alreadyCounted = options.countedInvalidArguments.has(failureKey);
|
|
1747
|
+
const failureCount = (options.invalidToolArgumentCounts.get(failureKey) ?? 0) + (alreadyCounted ? 0 : 1);
|
|
1742
1748
|
options.invalidToolArgumentCounts.set(failureKey, failureCount);
|
|
1749
|
+
options.countedInvalidArguments.add(failureKey);
|
|
1743
1750
|
invalidArgAttempt = failureCount;
|
|
1744
1751
|
const hints = argumentHints(tool, toolCall.args);
|
|
1745
1752
|
resultContent = `Invalid arguments for tool \`${toolCall.name}\`:
|