@probelabs/probe 0.6.0-rc283 → 0.6.0-rc285
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-rc285-aarch64-apple-darwin.tar.gz +0 -0
- package/bin/binaries/probe-v0.6.0-rc285-aarch64-unknown-linux-musl.tar.gz +0 -0
- package/bin/binaries/probe-v0.6.0-rc285-x86_64-apple-darwin.tar.gz +0 -0
- package/bin/binaries/probe-v0.6.0-rc285-x86_64-pc-windows-msvc.zip +0 -0
- package/bin/binaries/probe-v0.6.0-rc285-x86_64-unknown-linux-musl.tar.gz +0 -0
- package/build/agent/ProbeAgent.d.ts +1 -1
- package/build/agent/ProbeAgent.js +333 -486
- package/build/agent/contextCompactor.js +17 -10
- package/build/agent/index.js +301 -702
- package/build/agent/schemaUtils.js +10 -11
- package/build/agent/shared/prompts.js +2 -2
- package/build/agent/tasks/taskTool.js +3 -3
- package/build/agent/tools.js +0 -2
- package/build/index.js +0 -2
- package/build/tools/analyzeAll.js +4 -4
- package/build/tools/common.js +55 -55
- package/build/tools/index.js +0 -1
- package/build/tools/vercel.js +3 -3
- package/cjs/agent/ProbeAgent.cjs +33158 -42860
- package/cjs/index.cjs +31325 -41082
- package/package.json +8 -8
- package/src/agent/ProbeAgent.d.ts +1 -1
- package/src/agent/ProbeAgent.js +333 -486
- package/src/agent/contextCompactor.js +17 -10
- package/src/agent/index.js +8 -2
- package/src/agent/schemaUtils.js +10 -11
- package/src/agent/shared/prompts.js +2 -2
- package/src/agent/tasks/taskTool.js +3 -3
- package/src/agent/tools.js +0 -2
- package/src/index.js +0 -2
- package/src/tools/analyzeAll.js +4 -4
- package/src/tools/common.js +55 -55
- package/src/tools/index.js +0 -1
- package/src/tools/vercel.js +3 -3
- package/bin/binaries/probe-v0.6.0-rc283-aarch64-apple-darwin.tar.gz +0 -0
- package/bin/binaries/probe-v0.6.0-rc283-aarch64-unknown-linux-musl.tar.gz +0 -0
- package/bin/binaries/probe-v0.6.0-rc283-x86_64-apple-darwin.tar.gz +0 -0
- package/bin/binaries/probe-v0.6.0-rc283-x86_64-pc-windows-msvc.zip +0 -0
- package/bin/binaries/probe-v0.6.0-rc283-x86_64-unknown-linux-musl.tar.gz +0 -0
|
@@ -59,25 +59,32 @@ export function isContextLimitError(error) {
|
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
/**
|
|
62
|
-
* Check if an assistant message
|
|
63
|
-
*
|
|
62
|
+
* Check if an assistant message represents a completion (final answer).
|
|
63
|
+
* A completion is an assistant message with no tool calls and non-empty text content.
|
|
64
|
+
* Also supports backward compatibility with old attempt_completion tool calls.
|
|
64
65
|
*/
|
|
65
66
|
function messageContainsCompletion(msg) {
|
|
66
|
-
//
|
|
67
|
+
// Backward compat: detect old attempt_completion tool calls in historical conversations
|
|
67
68
|
if (Array.isArray(msg.toolInvocations)) {
|
|
68
69
|
if (msg.toolInvocations.some(t => t.toolName === 'attempt_completion')) return true;
|
|
69
70
|
}
|
|
70
|
-
// Native tool calling: OpenAI format uses tool_calls
|
|
71
71
|
if (Array.isArray(msg.tool_calls)) {
|
|
72
72
|
if (msg.tool_calls.some(t => t.function?.name === 'attempt_completion')) return true;
|
|
73
73
|
}
|
|
74
|
-
// Multipart content (Vercel AI SDK v4+)
|
|
75
74
|
if (Array.isArray(msg.content)) {
|
|
76
75
|
if (msg.content.some(p => p.type === 'tool-call' && p.toolName === 'attempt_completion')) return true;
|
|
76
|
+
// New detection: assistant message with text parts but no tool-call parts
|
|
77
|
+
const hasToolCalls = msg.content.some(p => p.type === 'tool-call');
|
|
78
|
+
const hasText = msg.content.some(p => (p.type === 'text' && p.text?.trim()));
|
|
79
|
+
if (!hasToolCalls && hasText) return true;
|
|
77
80
|
}
|
|
78
|
-
// Text content
|
|
81
|
+
// Text content: no tool calls means this is a final text response
|
|
79
82
|
const text = typeof msg.content === 'string' ? msg.content : '';
|
|
80
|
-
|
|
83
|
+
if (text.includes('attempt_completion')) return true;
|
|
84
|
+
// New: assistant message with text content and no tool invocations/calls is a completion
|
|
85
|
+
const hasNoToolCalls = !Array.isArray(msg.toolInvocations) && !Array.isArray(msg.tool_calls);
|
|
86
|
+
if (hasNoToolCalls && text.trim().length > 0) return true;
|
|
87
|
+
return false;
|
|
81
88
|
}
|
|
82
89
|
|
|
83
90
|
/**
|
|
@@ -87,7 +94,7 @@ function messageContainsCompletion(msg) {
|
|
|
87
94
|
* A "segment" is:
|
|
88
95
|
* - user message (role: 'user')
|
|
89
96
|
* - followed by 0+ assistant messages (internal monologue)
|
|
90
|
-
* - ending with
|
|
97
|
+
* - ending with a final answer (assistant message with no tool calls)
|
|
91
98
|
*
|
|
92
99
|
* @param {Array} messages - Array of message objects with {role, content}
|
|
93
100
|
* @returns {Array} - Array of segments, each containing {userIndex, monologueIndices, finalIndex}
|
|
@@ -127,7 +134,7 @@ export function identifyMessageSegments(messages) {
|
|
|
127
134
|
|
|
128
135
|
// Assistant message is part of monologue
|
|
129
136
|
if (msg.role === 'assistant' && currentSegment) {
|
|
130
|
-
// Check if this
|
|
137
|
+
// Check if this is a completion message (no tool calls, or legacy attempt_completion)
|
|
131
138
|
const hasCompletion = messageContainsCompletion(msg);
|
|
132
139
|
|
|
133
140
|
if (hasCompletion) {
|
|
@@ -155,7 +162,7 @@ export function identifyMessageSegments(messages) {
|
|
|
155
162
|
*
|
|
156
163
|
* Strategy:
|
|
157
164
|
* 1. Keep all user messages
|
|
158
|
-
* 2. Keep all final answers (
|
|
165
|
+
* 2. Keep all final answers (completion messages)
|
|
159
166
|
* 3. Remove intermediate monologue messages from completed segments
|
|
160
167
|
* 4. Keep the most recent (active) segment intact
|
|
161
168
|
*
|