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
package/dist/index.cjs
CHANGED
|
@@ -1101,7 +1101,7 @@ function applyLineLimit(lines, limit) {
|
|
|
1101
1101
|
}
|
|
1102
1102
|
return lines;
|
|
1103
1103
|
}
|
|
1104
|
-
function createGadgetOutputViewer(store) {
|
|
1104
|
+
function createGadgetOutputViewer(store, maxOutputChars = DEFAULT_MAX_OUTPUT_CHARS) {
|
|
1105
1105
|
return createGadget({
|
|
1106
1106
|
name: "GadgetOutputViewer",
|
|
1107
1107
|
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.",
|
|
@@ -1166,19 +1166,43 @@ function createGadgetOutputViewer(store) {
|
|
|
1166
1166
|
if (limit) {
|
|
1167
1167
|
lines = applyLineLimit(lines, limit);
|
|
1168
1168
|
}
|
|
1169
|
+
let output = lines.join("\n");
|
|
1169
1170
|
const totalLines = stored.lineCount;
|
|
1170
1171
|
const returnedLines = lines.length;
|
|
1171
1172
|
if (returnedLines === 0) {
|
|
1172
1173
|
return `No lines matched the filters. Original output had ${totalLines} lines.`;
|
|
1173
1174
|
}
|
|
1174
|
-
|
|
1175
|
-
|
|
1175
|
+
let truncatedBySize = false;
|
|
1176
|
+
let linesIncluded = returnedLines;
|
|
1177
|
+
if (output.length > maxOutputChars) {
|
|
1178
|
+
truncatedBySize = true;
|
|
1179
|
+
let truncatedOutput = "";
|
|
1180
|
+
linesIncluded = 0;
|
|
1181
|
+
for (const line of lines) {
|
|
1182
|
+
if (truncatedOutput.length + line.length + 1 > maxOutputChars) break;
|
|
1183
|
+
truncatedOutput += line + "\n";
|
|
1184
|
+
linesIncluded++;
|
|
1185
|
+
}
|
|
1186
|
+
output = truncatedOutput;
|
|
1187
|
+
}
|
|
1188
|
+
let header;
|
|
1189
|
+
if (truncatedBySize) {
|
|
1190
|
+
const remainingLines = returnedLines - linesIncluded;
|
|
1191
|
+
header = `[Showing ${linesIncluded} of ${totalLines} lines (truncated due to size limit)]
|
|
1192
|
+
[... ${remainingLines.toLocaleString()} more lines. Use limit parameter to paginate, e.g., limit: "${linesIncluded + 1}-${linesIncluded + 200}"]
|
|
1176
1193
|
`;
|
|
1177
|
-
|
|
1194
|
+
} else if (returnedLines < totalLines) {
|
|
1195
|
+
header = `[Showing ${returnedLines} of ${totalLines} lines]
|
|
1196
|
+
`;
|
|
1197
|
+
} else {
|
|
1198
|
+
header = `[Showing all ${totalLines} lines]
|
|
1199
|
+
`;
|
|
1200
|
+
}
|
|
1201
|
+
return header + output;
|
|
1178
1202
|
}
|
|
1179
1203
|
});
|
|
1180
1204
|
}
|
|
1181
|
-
var import_zod, patternSchema;
|
|
1205
|
+
var import_zod, patternSchema, DEFAULT_MAX_OUTPUT_CHARS;
|
|
1182
1206
|
var init_output_viewer = __esm({
|
|
1183
1207
|
"src/gadgets/output-viewer.ts"() {
|
|
1184
1208
|
"use strict";
|
|
@@ -1190,6 +1214,7 @@ var init_output_viewer = __esm({
|
|
|
1190
1214
|
before: import_zod.z.number().int().min(0).default(0).describe("Context lines before each match (like grep -B)"),
|
|
1191
1215
|
after: import_zod.z.number().int().min(0).default(0).describe("Context lines after each match (like grep -A)")
|
|
1192
1216
|
});
|
|
1217
|
+
DEFAULT_MAX_OUTPUT_CHARS = 76800;
|
|
1193
1218
|
}
|
|
1194
1219
|
});
|
|
1195
1220
|
|
|
@@ -3395,7 +3420,10 @@ var init_agent = __esm({
|
|
|
3395
3420
|
const contextWindow = limits?.contextWindow ?? FALLBACK_CONTEXT_WINDOW;
|
|
3396
3421
|
this.outputLimitCharLimit = Math.floor(contextWindow * (limitPercent / 100) * CHARS_PER_TOKEN);
|
|
3397
3422
|
if (this.outputLimitEnabled) {
|
|
3398
|
-
this.registry.register(
|
|
3423
|
+
this.registry.register(
|
|
3424
|
+
"GadgetOutputViewer",
|
|
3425
|
+
createGadgetOutputViewer(this.outputStore, this.outputLimitCharLimit)
|
|
3426
|
+
);
|
|
3399
3427
|
}
|
|
3400
3428
|
this.hooks = this.mergeOutputLimiterHook(options.hooks);
|
|
3401
3429
|
const baseBuilder = new LLMMessageBuilder(options.promptConfig);
|