@probelabs/probe 0.6.0-rc227 → 0.6.0-rc228
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/bin/binaries/probe-v0.6.0-rc228-aarch64-apple-darwin.tar.gz +0 -0
- package/bin/binaries/probe-v0.6.0-rc228-aarch64-unknown-linux-musl.tar.gz +0 -0
- package/bin/binaries/probe-v0.6.0-rc228-x86_64-apple-darwin.tar.gz +0 -0
- package/bin/binaries/probe-v0.6.0-rc228-x86_64-pc-windows-msvc.zip +0 -0
- package/bin/binaries/probe-v0.6.0-rc228-x86_64-unknown-linux-musl.tar.gz +0 -0
- package/build/agent/index.js +25 -9
- package/build/agent/outputTruncator.js +23 -10
- package/cjs/agent/ProbeAgent.cjs +6662 -8966
- package/cjs/index.cjs +6665 -8969
- package/package.json +1 -1
- package/src/agent/outputTruncator.js +23 -10
- package/bin/binaries/probe-v0.6.0-rc227-aarch64-apple-darwin.tar.gz +0 -0
- package/bin/binaries/probe-v0.6.0-rc227-aarch64-unknown-linux-musl.tar.gz +0 -0
- package/bin/binaries/probe-v0.6.0-rc227-x86_64-apple-darwin.tar.gz +0 -0
- package/bin/binaries/probe-v0.6.0-rc227-x86_64-pc-windows-msvc.zip +0 -0
- package/bin/binaries/probe-v0.6.0-rc227-x86_64-unknown-linux-musl.tar.gz +0 -0
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/build/agent/index.js
CHANGED
|
@@ -68681,8 +68681,6 @@ async function truncateIfNeeded(content, tokenCounter, sessionId, maxTokens) {
|
|
|
68681
68681
|
if (tokenCount <= limit) {
|
|
68682
68682
|
return { truncated: false, content };
|
|
68683
68683
|
}
|
|
68684
|
-
const maxChars = limit * CHARS_PER_TOKEN2;
|
|
68685
|
-
const truncatedContent = content.substring(0, maxChars);
|
|
68686
68684
|
let tempFilePath = null;
|
|
68687
68685
|
let fileError = null;
|
|
68688
68686
|
try {
|
|
@@ -68694,22 +68692,38 @@ async function truncateIfNeeded(content, tokenCounter, sessionId, maxTokens) {
|
|
|
68694
68692
|
fileError = err.message || "Unknown file system error";
|
|
68695
68693
|
tempFilePath = null;
|
|
68696
68694
|
}
|
|
68695
|
+
let truncatedBody;
|
|
68696
|
+
const useTail = limit >= MIN_LIMIT_FOR_TAIL;
|
|
68697
|
+
if (useTail) {
|
|
68698
|
+
const headTokens = limit - TAIL_TOKENS;
|
|
68699
|
+
const headChars = headTokens * CHARS_PER_TOKEN2;
|
|
68700
|
+
const tailChars = TAIL_TOKENS * CHARS_PER_TOKEN2;
|
|
68701
|
+
const headContent = content.substring(0, headChars);
|
|
68702
|
+
const tailContent = content.substring(content.length - tailChars);
|
|
68703
|
+
const omittedTokens = tokenCount - headTokens - TAIL_TOKENS;
|
|
68704
|
+
truncatedBody = `${headContent}
|
|
68705
|
+
|
|
68706
|
+
... ${omittedTokens} tokens omitted ...
|
|
68707
|
+
|
|
68708
|
+
${tailContent}`;
|
|
68709
|
+
} else {
|
|
68710
|
+
const maxChars = limit * CHARS_PER_TOKEN2;
|
|
68711
|
+
truncatedBody = content.substring(0, maxChars);
|
|
68712
|
+
}
|
|
68697
68713
|
let message;
|
|
68698
68714
|
if (tempFilePath) {
|
|
68699
68715
|
message = `Output exceeded maximum size (${tokenCount} tokens, limit: ${limit}).
|
|
68700
68716
|
Full output saved to: ${tempFilePath}
|
|
68701
68717
|
|
|
68702
|
-
--- Truncated Output
|
|
68703
|
-
${
|
|
68704
|
-
...
|
|
68718
|
+
--- Truncated Output ---
|
|
68719
|
+
${truncatedBody}
|
|
68705
68720
|
--- End of Truncated Output ---`;
|
|
68706
68721
|
} else {
|
|
68707
68722
|
message = `Output exceeded maximum size (${tokenCount} tokens, limit: ${limit}).
|
|
68708
68723
|
Warning: Could not save full output to file (${fileError}).
|
|
68709
68724
|
|
|
68710
|
-
--- Truncated Output
|
|
68711
|
-
${
|
|
68712
|
-
...
|
|
68725
|
+
--- Truncated Output ---
|
|
68726
|
+
${truncatedBody}
|
|
68713
68727
|
--- End of Truncated Output ---`;
|
|
68714
68728
|
}
|
|
68715
68729
|
return {
|
|
@@ -68720,12 +68734,14 @@ ${truncatedContent}
|
|
|
68720
68734
|
error: fileError || void 0
|
|
68721
68735
|
};
|
|
68722
68736
|
}
|
|
68723
|
-
var DEFAULT_MAX_OUTPUT_TOKENS, CHARS_PER_TOKEN2;
|
|
68737
|
+
var DEFAULT_MAX_OUTPUT_TOKENS, CHARS_PER_TOKEN2, TAIL_TOKENS, MIN_LIMIT_FOR_TAIL;
|
|
68724
68738
|
var init_outputTruncator = __esm({
|
|
68725
68739
|
"src/agent/outputTruncator.js"() {
|
|
68726
68740
|
"use strict";
|
|
68727
68741
|
DEFAULT_MAX_OUTPUT_TOKENS = 2e4;
|
|
68728
68742
|
CHARS_PER_TOKEN2 = 4;
|
|
68743
|
+
TAIL_TOKENS = 1e3;
|
|
68744
|
+
MIN_LIMIT_FOR_TAIL = 2e3;
|
|
68729
68745
|
}
|
|
68730
68746
|
});
|
|
68731
68747
|
|
|
@@ -5,6 +5,8 @@ import { randomUUID } from 'crypto';
|
|
|
5
5
|
|
|
6
6
|
const DEFAULT_MAX_OUTPUT_TOKENS = 20000;
|
|
7
7
|
const CHARS_PER_TOKEN = 4; // Conservative approximation
|
|
8
|
+
const TAIL_TOKENS = 1000; // Number of tokens to show from the end of truncated output
|
|
9
|
+
const MIN_LIMIT_FOR_TAIL = 2000; // Minimum token limit to use head+tail split
|
|
8
10
|
|
|
9
11
|
/**
|
|
10
12
|
* Validate and normalize a token limit value.
|
|
@@ -61,10 +63,6 @@ export async function truncateIfNeeded(content, tokenCounter, sessionId, maxToke
|
|
|
61
63
|
return { truncated: false, content };
|
|
62
64
|
}
|
|
63
65
|
|
|
64
|
-
// Truncate to approximately maxTokens worth of characters
|
|
65
|
-
const maxChars = limit * CHARS_PER_TOKEN;
|
|
66
|
-
const truncatedContent = content.substring(0, maxChars);
|
|
67
|
-
|
|
68
66
|
// Try to write full output to temp file
|
|
69
67
|
let tempFilePath = null;
|
|
70
68
|
let fileError = null;
|
|
@@ -79,22 +77,37 @@ export async function truncateIfNeeded(content, tokenCounter, sessionId, maxToke
|
|
|
79
77
|
tempFilePath = null;
|
|
80
78
|
}
|
|
81
79
|
|
|
80
|
+
// Build truncated content with head + tail for better context
|
|
81
|
+
let truncatedBody;
|
|
82
|
+
const useTail = limit >= MIN_LIMIT_FOR_TAIL;
|
|
83
|
+
|
|
84
|
+
if (useTail) {
|
|
85
|
+
const headTokens = limit - TAIL_TOKENS;
|
|
86
|
+
const headChars = headTokens * CHARS_PER_TOKEN;
|
|
87
|
+
const tailChars = TAIL_TOKENS * CHARS_PER_TOKEN;
|
|
88
|
+
const headContent = content.substring(0, headChars);
|
|
89
|
+
const tailContent = content.substring(content.length - tailChars);
|
|
90
|
+
const omittedTokens = tokenCount - headTokens - TAIL_TOKENS;
|
|
91
|
+
truncatedBody = `${headContent}\n\n... ${omittedTokens} tokens omitted ...\n\n${tailContent}`;
|
|
92
|
+
} else {
|
|
93
|
+
const maxChars = limit * CHARS_PER_TOKEN;
|
|
94
|
+
truncatedBody = content.substring(0, maxChars);
|
|
95
|
+
}
|
|
96
|
+
|
|
82
97
|
let message;
|
|
83
98
|
if (tempFilePath) {
|
|
84
99
|
message = `Output exceeded maximum size (${tokenCount} tokens, limit: ${limit}).
|
|
85
100
|
Full output saved to: ${tempFilePath}
|
|
86
101
|
|
|
87
|
-
--- Truncated Output
|
|
88
|
-
${
|
|
89
|
-
...
|
|
102
|
+
--- Truncated Output ---
|
|
103
|
+
${truncatedBody}
|
|
90
104
|
--- End of Truncated Output ---`;
|
|
91
105
|
} else {
|
|
92
106
|
message = `Output exceeded maximum size (${tokenCount} tokens, limit: ${limit}).
|
|
93
107
|
Warning: Could not save full output to file (${fileError}).
|
|
94
108
|
|
|
95
|
-
--- Truncated Output
|
|
96
|
-
${
|
|
97
|
-
...
|
|
109
|
+
--- Truncated Output ---
|
|
110
|
+
${truncatedBody}
|
|
98
111
|
--- End of Truncated Output ---`;
|
|
99
112
|
}
|
|
100
113
|
|