@kenkaiiii/gg-agent 5.22.3 → 5.22.4
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 +24 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +24 -7
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -228,9 +228,9 @@ async function* agentLoop(messages, options) {
|
|
|
228
228
|
const STREAM_THINKING_IDLE_TIMEOUT_MS = 3e5;
|
|
229
229
|
const STREAM_THINKING_HARD_TIMEOUT_MS = 6e5;
|
|
230
230
|
const NON_STREAMING_HARD_TIMEOUT_MS = 3e5;
|
|
231
|
-
const
|
|
232
|
-
const firstEventTimeoutMs =
|
|
233
|
-
const initialHardTimeoutMs =
|
|
231
|
+
const usesSilentReasoningBudget = options.provider === "sakana" || options.provider === "openai" && options.thinking != null;
|
|
232
|
+
const firstEventTimeoutMs = usesSilentReasoningBudget ? STREAM_THINKING_IDLE_TIMEOUT_MS : STREAM_FIRST_EVENT_TIMEOUT_MS;
|
|
233
|
+
const initialHardTimeoutMs = usesSilentReasoningBudget ? STREAM_THINKING_HARD_TIMEOUT_MS : STREAM_HARD_TIMEOUT_MS;
|
|
234
234
|
const MAX_TOOLCALL_DELTA_CHARS = 1e6;
|
|
235
235
|
const MAX_TOOLCALL_DELTA_EVENTS = 2e4;
|
|
236
236
|
let logicalTurnStartedAt = 0;
|
|
@@ -258,7 +258,10 @@ async function* agentLoop(messages, options) {
|
|
|
258
258
|
messages: messages.length,
|
|
259
259
|
chars: msgChars,
|
|
260
260
|
provider: options.provider,
|
|
261
|
-
model: options.model
|
|
261
|
+
model: options.model,
|
|
262
|
+
thinking: options.thinking ?? "off",
|
|
263
|
+
firstEventTimeoutMs,
|
|
264
|
+
initialHardTimeoutMs
|
|
262
265
|
});
|
|
263
266
|
}
|
|
264
267
|
if (firstTurn && options.getSteeringMessages) {
|
|
@@ -694,15 +697,29 @@ async function* agentLoop(messages, options) {
|
|
|
694
697
|
continue;
|
|
695
698
|
}
|
|
696
699
|
if (transportFailure) {
|
|
700
|
+
const cause = malformed ? "malformed_stream" : socketDrop ? "socket_drop" : "stream_stall";
|
|
697
701
|
diag("stall_exhausted", {
|
|
698
702
|
stallRetries: MAX_STALL_RETRIES,
|
|
699
703
|
provider: options.provider,
|
|
700
|
-
model: options.model
|
|
704
|
+
model: options.model,
|
|
705
|
+
cause,
|
|
706
|
+
nonStreaming: useNonStreamingFallback,
|
|
707
|
+
events: streamEventCount,
|
|
708
|
+
eventTypes: eventTypeCounts,
|
|
709
|
+
lastEventType,
|
|
710
|
+
sinceLastEventMs: Date.now() - lastEventTime,
|
|
711
|
+
attemptDurationMs: Date.now() - streamCallStart,
|
|
712
|
+
maxConsumerLagMs
|
|
701
713
|
});
|
|
702
714
|
yield {
|
|
703
715
|
type: "error",
|
|
704
|
-
error: new
|
|
705
|
-
`The API provider
|
|
716
|
+
error: new GGAIError(
|
|
717
|
+
`The connection to the API provider stopped responding after ${MAX_STALL_RETRIES} automatic retries. Your conversation is preserved.`,
|
|
718
|
+
{
|
|
719
|
+
source: "network",
|
|
720
|
+
hint: "Retry once. If it keeps happening on this device, disable any VPN or proxy and allow GG Coder through firewall or antivirus web protection.",
|
|
721
|
+
cause: err
|
|
722
|
+
}
|
|
706
723
|
)
|
|
707
724
|
};
|
|
708
725
|
break;
|