llmist 1.6.1 → 1.6.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/{chunk-X5XQ6M5P.js → chunk-T3DIKQWU.js} +35 -7
- package/dist/chunk-T3DIKQWU.js.map +1 -0
- package/dist/{chunk-QR5IQXEM.js → chunk-TDRPJP2Q.js} +2 -2
- package/dist/cli.cjs +35 -7
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +3 -3
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +34 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -2
- package/dist/index.d.ts +3 -2
- package/dist/index.js +2 -2
- package/dist/testing/index.cjs +34 -6
- package/dist/testing/index.cjs.map +1 -1
- package/dist/testing/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-X5XQ6M5P.js.map +0 -1
- /package/dist/{chunk-QR5IQXEM.js.map → chunk-TDRPJP2Q.js.map} +0 -0
|
@@ -1089,7 +1089,7 @@ function applyLineLimit(lines, limit) {
|
|
|
1089
1089
|
}
|
|
1090
1090
|
return lines;
|
|
1091
1091
|
}
|
|
1092
|
-
function createGadgetOutputViewer(store) {
|
|
1092
|
+
function createGadgetOutputViewer(store, maxOutputChars = DEFAULT_MAX_OUTPUT_CHARS) {
|
|
1093
1093
|
return createGadget({
|
|
1094
1094
|
name: "GadgetOutputViewer",
|
|
1095
1095
|
description: "View stored output from gadgets that returned too much data. Use patterns to filter lines (like grep) and limit to control output size. Patterns are applied first in order, then the limit is applied to the result.",
|
|
@@ -1154,19 +1154,43 @@ function createGadgetOutputViewer(store) {
|
|
|
1154
1154
|
if (limit) {
|
|
1155
1155
|
lines = applyLineLimit(lines, limit);
|
|
1156
1156
|
}
|
|
1157
|
+
let output = lines.join("\n");
|
|
1157
1158
|
const totalLines = stored.lineCount;
|
|
1158
1159
|
const returnedLines = lines.length;
|
|
1159
1160
|
if (returnedLines === 0) {
|
|
1160
1161
|
return `No lines matched the filters. Original output had ${totalLines} lines.`;
|
|
1161
1162
|
}
|
|
1162
|
-
|
|
1163
|
-
|
|
1163
|
+
let truncatedBySize = false;
|
|
1164
|
+
let linesIncluded = returnedLines;
|
|
1165
|
+
if (output.length > maxOutputChars) {
|
|
1166
|
+
truncatedBySize = true;
|
|
1167
|
+
let truncatedOutput = "";
|
|
1168
|
+
linesIncluded = 0;
|
|
1169
|
+
for (const line of lines) {
|
|
1170
|
+
if (truncatedOutput.length + line.length + 1 > maxOutputChars) break;
|
|
1171
|
+
truncatedOutput += line + "\n";
|
|
1172
|
+
linesIncluded++;
|
|
1173
|
+
}
|
|
1174
|
+
output = truncatedOutput;
|
|
1175
|
+
}
|
|
1176
|
+
let header;
|
|
1177
|
+
if (truncatedBySize) {
|
|
1178
|
+
const remainingLines = returnedLines - linesIncluded;
|
|
1179
|
+
header = `[Showing ${linesIncluded} of ${totalLines} lines (truncated due to size limit)]
|
|
1180
|
+
[... ${remainingLines.toLocaleString()} more lines. Use limit parameter to paginate, e.g., limit: "${linesIncluded + 1}-${linesIncluded + 200}"]
|
|
1164
1181
|
`;
|
|
1165
|
-
|
|
1182
|
+
} else if (returnedLines < totalLines) {
|
|
1183
|
+
header = `[Showing ${returnedLines} of ${totalLines} lines]
|
|
1184
|
+
`;
|
|
1185
|
+
} else {
|
|
1186
|
+
header = `[Showing all ${totalLines} lines]
|
|
1187
|
+
`;
|
|
1188
|
+
}
|
|
1189
|
+
return header + output;
|
|
1166
1190
|
}
|
|
1167
1191
|
});
|
|
1168
1192
|
}
|
|
1169
|
-
var patternSchema;
|
|
1193
|
+
var patternSchema, DEFAULT_MAX_OUTPUT_CHARS;
|
|
1170
1194
|
var init_output_viewer = __esm({
|
|
1171
1195
|
"src/gadgets/output-viewer.ts"() {
|
|
1172
1196
|
"use strict";
|
|
@@ -1177,6 +1201,7 @@ var init_output_viewer = __esm({
|
|
|
1177
1201
|
before: z3.number().int().min(0).default(0).describe("Context lines before each match (like grep -B)"),
|
|
1178
1202
|
after: z3.number().int().min(0).default(0).describe("Context lines after each match (like grep -A)")
|
|
1179
1203
|
});
|
|
1204
|
+
DEFAULT_MAX_OUTPUT_CHARS = 76800;
|
|
1180
1205
|
}
|
|
1181
1206
|
});
|
|
1182
1207
|
|
|
@@ -3382,7 +3407,10 @@ var init_agent = __esm({
|
|
|
3382
3407
|
const contextWindow = limits?.contextWindow ?? FALLBACK_CONTEXT_WINDOW;
|
|
3383
3408
|
this.outputLimitCharLimit = Math.floor(contextWindow * (limitPercent / 100) * CHARS_PER_TOKEN);
|
|
3384
3409
|
if (this.outputLimitEnabled) {
|
|
3385
|
-
this.registry.register(
|
|
3410
|
+
this.registry.register(
|
|
3411
|
+
"GadgetOutputViewer",
|
|
3412
|
+
createGadgetOutputViewer(this.outputStore, this.outputLimitCharLimit)
|
|
3413
|
+
);
|
|
3386
3414
|
}
|
|
3387
3415
|
this.hooks = this.mergeOutputLimiterHook(options.hooks);
|
|
3388
3416
|
const baseBuilder = new LLMMessageBuilder(options.promptConfig);
|
|
@@ -8032,4 +8060,4 @@ export {
|
|
|
8032
8060
|
MockPromptRecorder,
|
|
8033
8061
|
waitFor
|
|
8034
8062
|
};
|
|
8035
|
-
//# sourceMappingURL=chunk-
|
|
8063
|
+
//# sourceMappingURL=chunk-T3DIKQWU.js.map
|