@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.
Files changed (39) hide show
  1. package/bin/binaries/probe-v0.6.0-rc285-aarch64-apple-darwin.tar.gz +0 -0
  2. package/bin/binaries/probe-v0.6.0-rc285-aarch64-unknown-linux-musl.tar.gz +0 -0
  3. package/bin/binaries/probe-v0.6.0-rc285-x86_64-apple-darwin.tar.gz +0 -0
  4. package/bin/binaries/probe-v0.6.0-rc285-x86_64-pc-windows-msvc.zip +0 -0
  5. package/bin/binaries/probe-v0.6.0-rc285-x86_64-unknown-linux-musl.tar.gz +0 -0
  6. package/build/agent/ProbeAgent.d.ts +1 -1
  7. package/build/agent/ProbeAgent.js +333 -486
  8. package/build/agent/contextCompactor.js +17 -10
  9. package/build/agent/index.js +301 -702
  10. package/build/agent/schemaUtils.js +10 -11
  11. package/build/agent/shared/prompts.js +2 -2
  12. package/build/agent/tasks/taskTool.js +3 -3
  13. package/build/agent/tools.js +0 -2
  14. package/build/index.js +0 -2
  15. package/build/tools/analyzeAll.js +4 -4
  16. package/build/tools/common.js +55 -55
  17. package/build/tools/index.js +0 -1
  18. package/build/tools/vercel.js +3 -3
  19. package/cjs/agent/ProbeAgent.cjs +33158 -42860
  20. package/cjs/index.cjs +31325 -41082
  21. package/package.json +8 -8
  22. package/src/agent/ProbeAgent.d.ts +1 -1
  23. package/src/agent/ProbeAgent.js +333 -486
  24. package/src/agent/contextCompactor.js +17 -10
  25. package/src/agent/index.js +8 -2
  26. package/src/agent/schemaUtils.js +10 -11
  27. package/src/agent/shared/prompts.js +2 -2
  28. package/src/agent/tasks/taskTool.js +3 -3
  29. package/src/agent/tools.js +0 -2
  30. package/src/index.js +0 -2
  31. package/src/tools/analyzeAll.js +4 -4
  32. package/src/tools/common.js +55 -55
  33. package/src/tools/index.js +0 -1
  34. package/src/tools/vercel.js +3 -3
  35. package/bin/binaries/probe-v0.6.0-rc283-aarch64-apple-darwin.tar.gz +0 -0
  36. package/bin/binaries/probe-v0.6.0-rc283-aarch64-unknown-linux-musl.tar.gz +0 -0
  37. package/bin/binaries/probe-v0.6.0-rc283-x86_64-apple-darwin.tar.gz +0 -0
  38. package/bin/binaries/probe-v0.6.0-rc283-x86_64-pc-windows-msvc.zip +0 -0
  39. 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 contains an attempt_completion tool call.
63
- * Supports both native tool calling (toolInvocations/tool_calls) and text content.
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
- // Native tool calling: Vercel AI SDK uses toolInvocations
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 fallback
81
+ // Text content: no tool calls means this is a final text response
79
82
  const text = typeof msg.content === 'string' ? msg.content : '';
80
- return text.includes('attempt_completion');
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 attempt_completion tool call (final answer)
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 contains an attempt_completion tool call (native or XML format)
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 (attempt_completion)
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
  *