@probelabs/probe 0.6.0-rc260 → 0.6.0-rc262

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@probelabs/probe",
3
- "version": "0.6.0-rc260",
3
+ "version": "0.6.0-rc262",
4
4
  "description": "Node.js wrapper for the probe code search tool",
5
5
  "main": "src/index.js",
6
6
  "module": "src/index.js",
@@ -11,7 +11,7 @@ import { DEFAULT_VALID_TOOLS, buildToolTagPattern } from '../tools/common.js';
11
11
  * @param {string} xmlString - The XML string to clean
12
12
  * @returns {string} - Cleaned XML string without thinking tags
13
13
  */
14
- export function removeThinkingTags(xmlString) {
14
+ export function removeThinkingTags(xmlString, validTools = DEFAULT_VALID_TOOLS) {
15
15
  let result = xmlString;
16
16
 
17
17
  // Remove all properly closed thinking tags first
@@ -26,8 +26,8 @@ export function removeThinkingTags(xmlString) {
26
26
  const afterThinking = result.substring(thinkingIndex + '<thinking>'.length);
27
27
 
28
28
  // Look for any tool tags in the remaining content
29
- // Use the shared tool list to build the pattern dynamically
30
- const toolPattern = buildToolTagPattern(DEFAULT_VALID_TOOLS);
29
+ // Use the provided valid tools list to build the pattern dynamically
30
+ const toolPattern = buildToolTagPattern(validTools);
31
31
  const toolMatch = afterThinking.match(toolPattern);
32
32
 
33
33
  if (toolMatch) {
@@ -201,7 +201,9 @@ export function processXmlWithThinkingAndRecovery(xmlString, validTools = []) {
201
201
  const thinkingContent = extractThinkingContent(xmlString);
202
202
 
203
203
  // Remove thinking tags and their content from the XML string
204
- const cleanedXmlString = removeThinkingTags(xmlString);
204
+ // Forward validTools so that tool tags (e.g. edit, create) inside unclosed
205
+ // thinking blocks are preserved when they are in the valid tools list
206
+ const cleanedXmlString = removeThinkingTags(xmlString, validTools.length > 0 ? validTools : undefined);
205
207
 
206
208
  // Check for attempt_complete recovery patterns
207
209
  const recoveryResult = checkAttemptCompleteRecovery(cleanedXmlString, validTools);