@kenkaiiii/gg-agent 5.35.0 → 5.36.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 +10 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +13 -9
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -1344,9 +1344,9 @@ function capToolResults(toolResults, maxToolResultChars) {
|
|
|
1344
1344
|
const originalChars = toolResult.content.length;
|
|
1345
1345
|
const headChars = Math.floor(max * 0.7);
|
|
1346
1346
|
const tailChars = max - headChars;
|
|
1347
|
-
const head = toolResult.content
|
|
1348
|
-
const tail = toolResult.content
|
|
1349
|
-
const omitted = originalChars -
|
|
1347
|
+
const head = (0, import_gg_ai.sliceHead)(toolResult.content, headChars);
|
|
1348
|
+
const tail = (0, import_gg_ai.sliceTail)(toolResult.content, tailChars);
|
|
1349
|
+
const omitted = originalChars - head.length - tail.length;
|
|
1350
1350
|
toolResult.content = head + `
|
|
1351
1351
|
|
|
1352
1352
|
[... ${omitted} characters omitted ...]
|
|
@@ -1381,11 +1381,11 @@ function capTurnToolResults(toolResults, maxTurnToolResultChars) {
|
|
|
1381
1381
|
const headChars = Math.floor(fairShare * 0.7);
|
|
1382
1382
|
const tailChars = fairShare - headChars;
|
|
1383
1383
|
const omitted = originalChars - fairShare;
|
|
1384
|
-
toolResult.content = toolResult.content
|
|
1384
|
+
toolResult.content = (0, import_gg_ai.sliceHead)(toolResult.content, headChars) + `
|
|
1385
1385
|
|
|
1386
1386
|
[... ${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 ...]
|
|
1387
1387
|
|
|
1388
|
-
` + (
|
|
1388
|
+
` + (0, import_gg_ai.sliceTail)(toolResult.content, tailChars);
|
|
1389
1389
|
toolResult.capped = {
|
|
1390
1390
|
originalChars: toolResult.capped?.originalChars ?? originalChars,
|
|
1391
1391
|
keptChars: toolResult.content.length,
|
|
@@ -1404,12 +1404,14 @@ function truncateToolResultText(text, maxChars) {
|
|
|
1404
1404
|
if (text.length <= maxChars) return text;
|
|
1405
1405
|
const tailChars = Math.min(Math.floor(maxChars * 0.3), 2e4);
|
|
1406
1406
|
const headChars = Math.max(maxChars - tailChars, 0);
|
|
1407
|
-
const
|
|
1408
|
-
|
|
1407
|
+
const head = (0, import_gg_ai.sliceHead)(text, headChars);
|
|
1408
|
+
const tail = (0, import_gg_ai.sliceTail)(text, tailChars);
|
|
1409
|
+
const omitted = text.length - head.length - tail.length;
|
|
1410
|
+
return `${head}
|
|
1409
1411
|
|
|
1410
1412
|
[... ${omitted} characters omitted after context overflow ...]
|
|
1411
1413
|
|
|
1412
|
-
${
|
|
1414
|
+
${tail}`;
|
|
1413
1415
|
}
|
|
1414
1416
|
function truncateOversizedToolResults(messages, maxChars) {
|
|
1415
1417
|
if (maxChars <= 0) return false;
|