@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.
@@ -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);