@kenkaiiii/gg-agent 5.29.0 → 5.30.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 +26 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +26 -4
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -63,6 +63,7 @@ function isLocalBackendUrl(baseUrl) {
|
|
|
63
63
|
|
|
64
64
|
// src/agent-loop.ts
|
|
65
65
|
var DEFAULT_MAX_TURNS = 300;
|
|
66
|
+
var DEFAULT_TOOL_TIMEOUT_MS = 3e5;
|
|
66
67
|
var _diagFn = null;
|
|
67
68
|
function setStreamDiagnostic(fn) {
|
|
68
69
|
_diagFn = fn;
|
|
@@ -732,7 +733,15 @@ async function* agentLoop(messages, options) {
|
|
|
732
733
|
role: "assistant",
|
|
733
734
|
content: [{ type: "text", text: attemptText }]
|
|
734
735
|
});
|
|
735
|
-
messages.push({
|
|
736
|
+
messages.push({
|
|
737
|
+
role: "user",
|
|
738
|
+
content: PARTIAL_CONTINUATION_PROMPT,
|
|
739
|
+
provenance: {
|
|
740
|
+
source: "runtime",
|
|
741
|
+
kind: "continuation",
|
|
742
|
+
visibility: "hidden"
|
|
743
|
+
}
|
|
744
|
+
});
|
|
736
745
|
preservedChars = attemptText.length;
|
|
737
746
|
}
|
|
738
747
|
diag("retry", {
|
|
@@ -902,7 +911,15 @@ async function* agentLoop(messages, options) {
|
|
|
902
911
|
model: options.model
|
|
903
912
|
});
|
|
904
913
|
yield { type: "truncated", reason: "max_tokens", continued: true };
|
|
905
|
-
messages.push({
|
|
914
|
+
messages.push({
|
|
915
|
+
role: "user",
|
|
916
|
+
content: MAX_TOKENS_CONTINUATION_PROMPT,
|
|
917
|
+
provenance: {
|
|
918
|
+
source: "runtime",
|
|
919
|
+
kind: "continuation",
|
|
920
|
+
visibility: "hidden"
|
|
921
|
+
}
|
|
922
|
+
});
|
|
906
923
|
continue;
|
|
907
924
|
}
|
|
908
925
|
yield { type: "truncated", reason: "max_tokens", continued: false };
|
|
@@ -1043,7 +1060,12 @@ async function* agentLoop(messages, options) {
|
|
|
1043
1060
|
};
|
|
1044
1061
|
messages.push({
|
|
1045
1062
|
role: "user",
|
|
1046
|
-
content: turnBudgetContinuationPrompt()
|
|
1063
|
+
content: turnBudgetContinuationPrompt(),
|
|
1064
|
+
provenance: {
|
|
1065
|
+
source: "runtime",
|
|
1066
|
+
kind: "continuation",
|
|
1067
|
+
visibility: "hidden"
|
|
1068
|
+
}
|
|
1047
1069
|
});
|
|
1048
1070
|
}
|
|
1049
1071
|
}
|
|
@@ -1109,7 +1131,7 @@ async function executeSingleToolCall(toolCall, options, pushEvent) {
|
|
|
1109
1131
|
try {
|
|
1110
1132
|
const parsed = tool.parameters.parse(toolCall.args);
|
|
1111
1133
|
const callerSignal = options.signal;
|
|
1112
|
-
const toolTimeout = AbortSignal.timeout(
|
|
1134
|
+
const toolTimeout = AbortSignal.timeout(tool.timeoutMs ?? DEFAULT_TOOL_TIMEOUT_MS);
|
|
1113
1135
|
const ctx = {
|
|
1114
1136
|
signal: callerSignal ? AbortSignal.any([callerSignal, toolTimeout]) : toolTimeout,
|
|
1115
1137
|
toolCallId: toolCall.id,
|