@kenkaiiii/gg-agent 5.22.0 → 5.22.2
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 +14 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +14 -2
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1172,16 +1172,22 @@ function capToolResults(toolResults, maxToolResultChars) {
|
|
|
1172
1172
|
const max = Math.min(maxToolResultChars, hardMax);
|
|
1173
1173
|
for (const toolResult of toolResults) {
|
|
1174
1174
|
if (typeof toolResult.content !== "string" || toolResult.content.length <= max) continue;
|
|
1175
|
+
const originalChars = toolResult.content.length;
|
|
1175
1176
|
const headChars = Math.floor(max * 0.7);
|
|
1176
1177
|
const tailChars = max - headChars;
|
|
1177
1178
|
const head = toolResult.content.slice(0, headChars);
|
|
1178
1179
|
const tail = toolResult.content.slice(-tailChars);
|
|
1179
|
-
const omitted =
|
|
1180
|
+
const omitted = originalChars - headChars - tailChars;
|
|
1180
1181
|
toolResult.content = head + `
|
|
1181
1182
|
|
|
1182
1183
|
[... ${omitted} characters omitted ...]
|
|
1183
1184
|
|
|
1184
1185
|
` + tail;
|
|
1186
|
+
toolResult.capped = {
|
|
1187
|
+
originalChars,
|
|
1188
|
+
keptChars: toolResult.content.length,
|
|
1189
|
+
scope: "per-result"
|
|
1190
|
+
};
|
|
1185
1191
|
}
|
|
1186
1192
|
}
|
|
1187
1193
|
function capTurnToolResults(toolResults, maxTurnToolResultChars) {
|
|
@@ -1202,14 +1208,20 @@ function capTurnToolResults(toolResults, maxTurnToolResultChars) {
|
|
|
1202
1208
|
continue;
|
|
1203
1209
|
}
|
|
1204
1210
|
remaining -= fairShare;
|
|
1211
|
+
const originalChars = toolResult.content.length;
|
|
1205
1212
|
const headChars = Math.floor(fairShare * 0.7);
|
|
1206
1213
|
const tailChars = fairShare - headChars;
|
|
1207
|
-
const omitted =
|
|
1214
|
+
const omitted = originalChars - fairShare;
|
|
1208
1215
|
toolResult.content = toolResult.content.slice(0, headChars) + `
|
|
1209
1216
|
|
|
1210
1217
|
[... ${omitted} characters trimmed: this turn's combined tool results exceeded the per-turn budget. Re-run this call alone with narrower filters or offset/limit if you need the omitted content ...]
|
|
1211
1218
|
|
|
1212
1219
|
` + (tailChars > 0 ? toolResult.content.slice(-tailChars) : "");
|
|
1220
|
+
toolResult.capped = {
|
|
1221
|
+
originalChars: toolResult.capped?.originalChars ?? originalChars,
|
|
1222
|
+
keptChars: toolResult.content.length,
|
|
1223
|
+
scope: "per-turn"
|
|
1224
|
+
};
|
|
1213
1225
|
}
|
|
1214
1226
|
}
|
|
1215
1227
|
function normalizeToolResult(raw) {
|