@probelabs/probe 0.6.0-rc233 → 0.6.0-rc235
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-rc235-aarch64-apple-darwin.tar.gz +0 -0
- package/bin/binaries/probe-v0.6.0-rc235-aarch64-unknown-linux-musl.tar.gz +0 -0
- package/bin/binaries/probe-v0.6.0-rc235-x86_64-apple-darwin.tar.gz +0 -0
- package/bin/binaries/probe-v0.6.0-rc235-x86_64-pc-windows-msvc.zip +0 -0
- package/bin/binaries/probe-v0.6.0-rc235-x86_64-unknown-linux-musl.tar.gz +0 -0
- package/build/agent/ProbeAgent.js +32 -1
- package/build/agent/index.js +482 -1005
- package/build/agent/schemaUtils.js +74 -1
- package/build/agent/tasks/taskTool.js +6 -1
- package/cjs/agent/ProbeAgent.cjs +482 -1005
- package/cjs/index.cjs +482 -1005
- package/package.json +2 -2
- package/src/agent/ProbeAgent.js +32 -1
- package/src/agent/schemaUtils.js +74 -1
- package/src/agent/tasks/taskTool.js +6 -1
- package/bin/binaries/probe-v0.6.0-rc233-aarch64-apple-darwin.tar.gz +0 -0
- package/bin/binaries/probe-v0.6.0-rc233-aarch64-unknown-linux-musl.tar.gz +0 -0
- package/bin/binaries/probe-v0.6.0-rc233-x86_64-apple-darwin.tar.gz +0 -0
- package/bin/binaries/probe-v0.6.0-rc233-x86_64-pc-windows-msvc.zip +0 -0
- package/bin/binaries/probe-v0.6.0-rc233-x86_64-unknown-linux-musl.tar.gz +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@probelabs/probe",
|
|
3
|
-
"version": "0.6.0-
|
|
3
|
+
"version": "0.6.0-rc235",
|
|
4
4
|
"description": "Node.js wrapper for the probe code search tool",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"module": "src/index.js",
|
|
@@ -79,7 +79,7 @@
|
|
|
79
79
|
"@ai-sdk/openai": "^2.0.10",
|
|
80
80
|
"@anthropic-ai/claude-agent-sdk": "^0.1.46",
|
|
81
81
|
"@modelcontextprotocol/sdk": "^1.0.0",
|
|
82
|
-
"@nyariv/sandboxjs": "
|
|
82
|
+
"@nyariv/sandboxjs": "github:probelabs/SandboxJS",
|
|
83
83
|
"@probelabs/maid": "^0.0.24",
|
|
84
84
|
"acorn": "^8.15.0",
|
|
85
85
|
"acorn-walk": "^8.3.4",
|
package/src/agent/ProbeAgent.js
CHANGED
|
@@ -81,7 +81,8 @@ import {
|
|
|
81
81
|
generateSchemaInstructions,
|
|
82
82
|
isJsonSchemaDefinition,
|
|
83
83
|
createSchemaDefinitionCorrectionPrompt,
|
|
84
|
-
validateAndFixMermaidResponse
|
|
84
|
+
validateAndFixMermaidResponse,
|
|
85
|
+
tryAutoWrapForSimpleSchema
|
|
85
86
|
} from './schemaUtils.js';
|
|
86
87
|
import { removeThinkingTags } from './xmlParsingUtils.js';
|
|
87
88
|
import { predefinedPrompts } from './shared/prompts.js';
|
|
@@ -3679,6 +3680,17 @@ Follow these instructions carefully:
|
|
|
3679
3680
|
const executeToolCall = async () => {
|
|
3680
3681
|
// For delegate tool, pass current iteration, max iterations, session ID, and config
|
|
3681
3682
|
if (toolName === 'delegate') {
|
|
3683
|
+
// Reconstruct allowedTools array preserving all modes (same logic as clone())
|
|
3684
|
+
let allowedToolsForDelegate = null;
|
|
3685
|
+
if (this.allowedTools.mode === 'whitelist') {
|
|
3686
|
+
allowedToolsForDelegate = [...this.allowedTools.allowed];
|
|
3687
|
+
} else if (this.allowedTools.mode === 'none') {
|
|
3688
|
+
allowedToolsForDelegate = [];
|
|
3689
|
+
} else if (this.allowedTools.mode === 'all' && this.allowedTools.exclusions?.length > 0) {
|
|
3690
|
+
allowedToolsForDelegate = ['*', ...this.allowedTools.exclusions.map(t => '!' + t)];
|
|
3691
|
+
}
|
|
3692
|
+
// If mode is 'all' with no exclusions, leave as null (default)
|
|
3693
|
+
|
|
3682
3694
|
const enhancedParams = {
|
|
3683
3695
|
...toolParams,
|
|
3684
3696
|
currentIteration,
|
|
@@ -3689,6 +3701,12 @@ Follow these instructions carefully:
|
|
|
3689
3701
|
model: this.model, // Inherit model
|
|
3690
3702
|
searchDelegate: this.searchDelegate,
|
|
3691
3703
|
enableTasks: this.enableTasks, // Inherit task management (subagent gets isolated TaskManager)
|
|
3704
|
+
enableMcp: !!this.mcpBridge, // Inherit MCP enablement
|
|
3705
|
+
mcpConfig: this.mcpConfig, // Inherit MCP configuration
|
|
3706
|
+
mcpConfigPath: this.mcpConfigPath, // Inherit MCP config path
|
|
3707
|
+
enableBash: this.enableBash, // Inherit bash enablement
|
|
3708
|
+
bashConfig: this.bashConfig, // Inherit bash configuration
|
|
3709
|
+
allowedTools: allowedToolsForDelegate, // Inherit allowed tools from parent
|
|
3692
3710
|
debug: this.debug,
|
|
3693
3711
|
tracer: this.tracer
|
|
3694
3712
|
};
|
|
@@ -4501,6 +4519,19 @@ Convert your previous response content into actual JSON data that follows this s
|
|
|
4501
4519
|
retryCount = 1; // Start at 1 since we already did one correction
|
|
4502
4520
|
}
|
|
4503
4521
|
|
|
4522
|
+
// Before entering correction loop, try auto-wrapping for simple schemas
|
|
4523
|
+
// This avoids re-invoking AI for schemas like {text: string} where we can just wrap programmatically
|
|
4524
|
+
if (!validation.isValid) {
|
|
4525
|
+
const autoWrapped = tryAutoWrapForSimpleSchema(finalResult, options.schema, { debug: this.debug });
|
|
4526
|
+
if (autoWrapped) {
|
|
4527
|
+
if (this.debug) {
|
|
4528
|
+
console.log(`[DEBUG] JSON validation: Auto-wrapped plain text for simple schema`);
|
|
4529
|
+
}
|
|
4530
|
+
finalResult = autoWrapped;
|
|
4531
|
+
validation = validateJsonResponse(finalResult, { debug: this.debug });
|
|
4532
|
+
}
|
|
4533
|
+
}
|
|
4534
|
+
|
|
4504
4535
|
while (!validation.isValid && retryCount < maxRetries) {
|
|
4505
4536
|
if (this.debug) {
|
|
4506
4537
|
console.log(`[DEBUG] JSON validation: attempt_completion validation failed (attempt ${retryCount + 1}/${maxRetries}):`, validation.error);
|
package/src/agent/schemaUtils.js
CHANGED
|
@@ -771,6 +771,78 @@ export function isJsonSchemaDefinition(jsonString, options = {}) {
|
|
|
771
771
|
}
|
|
772
772
|
}
|
|
773
773
|
|
|
774
|
+
/**
|
|
775
|
+
* Check if schema is a simple text wrapper (e.g., {text: string} or {response: string})
|
|
776
|
+
* These schemas can be auto-wrapped without re-invoking the AI
|
|
777
|
+
* @param {string} schema - The schema string
|
|
778
|
+
* @returns {Object|null} - Object with field name if simple wrapper, null otherwise
|
|
779
|
+
*/
|
|
780
|
+
export function isSimpleTextWrapperSchema(schema) {
|
|
781
|
+
if (!schema || typeof schema !== 'string') {
|
|
782
|
+
return null;
|
|
783
|
+
}
|
|
784
|
+
|
|
785
|
+
const trimmed = schema.trim();
|
|
786
|
+
|
|
787
|
+
// Match patterns like: {text: string}, {"text": "string"}, {response: string}, etc.
|
|
788
|
+
// These are simple wrappers that just need a single text field
|
|
789
|
+
const simplePatterns = [
|
|
790
|
+
/^\{\s*["']?(\w+)["']?\s*:\s*["']?string["']?\s*\}$/i,
|
|
791
|
+
/^\{\s*["']?type["']?\s*:\s*["']?object["']?\s*,\s*["']?properties["']?\s*:\s*\{\s*["']?(\w+)["']?\s*:\s*\{\s*["']?type["']?\s*:\s*["']?string["']?\s*\}\s*\}\s*\}$/i
|
|
792
|
+
];
|
|
793
|
+
|
|
794
|
+
for (const pattern of simplePatterns) {
|
|
795
|
+
const match = trimmed.match(pattern);
|
|
796
|
+
if (match) {
|
|
797
|
+
return { fieldName: match[1] };
|
|
798
|
+
}
|
|
799
|
+
}
|
|
800
|
+
|
|
801
|
+
return null;
|
|
802
|
+
}
|
|
803
|
+
|
|
804
|
+
/**
|
|
805
|
+
* Try to auto-wrap plain text for simple wrapper schemas
|
|
806
|
+
* Returns wrapped JSON if successful, null if not applicable
|
|
807
|
+
* @param {string} response - The response to wrap
|
|
808
|
+
* @param {string} schema - The schema string
|
|
809
|
+
* @param {Object} options - Options
|
|
810
|
+
* @param {boolean} [options.debug=false] - Enable debug logging
|
|
811
|
+
* @returns {string|null} - Wrapped JSON string or null
|
|
812
|
+
*/
|
|
813
|
+
export function tryAutoWrapForSimpleSchema(response, schema, options = {}) {
|
|
814
|
+
const { debug = false } = options;
|
|
815
|
+
|
|
816
|
+
const wrapperInfo = isSimpleTextWrapperSchema(schema);
|
|
817
|
+
if (!wrapperInfo) {
|
|
818
|
+
if (debug) {
|
|
819
|
+
console.log(`[DEBUG] Auto-wrap: Schema is not a simple text wrapper`);
|
|
820
|
+
}
|
|
821
|
+
return null;
|
|
822
|
+
}
|
|
823
|
+
|
|
824
|
+
// Check if response is already valid JSON
|
|
825
|
+
try {
|
|
826
|
+
JSON.parse(response);
|
|
827
|
+
// Already valid JSON, don't wrap
|
|
828
|
+
if (debug) {
|
|
829
|
+
console.log(`[DEBUG] Auto-wrap: Response is already valid JSON, skipping`);
|
|
830
|
+
}
|
|
831
|
+
return null;
|
|
832
|
+
} catch {
|
|
833
|
+
// Not valid JSON, proceed with wrapping
|
|
834
|
+
}
|
|
835
|
+
|
|
836
|
+
// Wrap the plain text in the schema structure
|
|
837
|
+
const wrapped = JSON.stringify({ [wrapperInfo.fieldName]: response });
|
|
838
|
+
|
|
839
|
+
if (debug) {
|
|
840
|
+
console.log(`[DEBUG] Auto-wrap: Wrapped plain text in {"${wrapperInfo.fieldName}": ...} (${response.length} chars)`);
|
|
841
|
+
}
|
|
842
|
+
|
|
843
|
+
return wrapped;
|
|
844
|
+
}
|
|
845
|
+
|
|
774
846
|
/**
|
|
775
847
|
* Create a correction prompt for invalid JSON
|
|
776
848
|
* @param {string} invalidResponse - The invalid JSON response
|
|
@@ -817,9 +889,10 @@ export function createJsonCorrectionPrompt(invalidResponse, schema, errorOrValid
|
|
|
817
889
|
const level = Math.min(retryCount, strengthLevels.length - 1);
|
|
818
890
|
const currentLevel = strengthLevels[level];
|
|
819
891
|
|
|
892
|
+
// Include full response - truncating loses context the AI needs to fix the issue
|
|
820
893
|
let prompt = `${currentLevel.prefix} Your previous response is not valid JSON and cannot be parsed. Here's what you returned:
|
|
821
894
|
|
|
822
|
-
${invalidResponse
|
|
895
|
+
${invalidResponse}
|
|
823
896
|
|
|
824
897
|
Error: ${enhancedError}
|
|
825
898
|
|
|
@@ -42,7 +42,7 @@ Manage tasks for tracking progress during code exploration and problem-solving.
|
|
|
42
42
|
|
|
43
43
|
Parameters:
|
|
44
44
|
- action: (required) The action to perform: create, update, complete, delete, list
|
|
45
|
-
- tasks: (optional)
|
|
45
|
+
- tasks: (optional) Array of task objects for batch operations. Place raw JSON array directly between tags.
|
|
46
46
|
- id: (optional) Task ID for single operations (e.g., "task-1")
|
|
47
47
|
- title: (optional) Task title for create/update
|
|
48
48
|
- description: (optional) Task description for create/update
|
|
@@ -51,6 +51,11 @@ Parameters:
|
|
|
51
51
|
- dependencies: (optional) JSON array of task IDs that must be completed first
|
|
52
52
|
- after: (optional) Task ID to insert the new task after (for ordering). By default, new tasks are appended to the end
|
|
53
53
|
|
|
54
|
+
IMPORTANT - JSON Format:
|
|
55
|
+
Place raw JSON arrays directly between tags without quotes or escaping:
|
|
56
|
+
CORRECT: <tasks>[{"title": "Do X"}]</tasks>
|
|
57
|
+
INCORRECT: <tasks>"[{\"title\": \"Do X\"}]"</tasks>
|
|
58
|
+
|
|
54
59
|
Usage Examples:
|
|
55
60
|
|
|
56
61
|
Creating a single task:
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|