@probelabs/probe 0.6.0-rc112 → 0.6.0-rc113

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.
@@ -73,6 +73,7 @@ export class ProbeAgent {
73
73
  * @param {boolean} [options.debug] - Enable debug mode
74
74
  * @param {boolean} [options.outline] - Enable outline-xml format for search results
75
75
  * @param {number} [options.maxResponseTokens] - Maximum tokens for AI responses
76
+ * @param {number} [options.maxIterations] - Maximum tool iterations (overrides MAX_TOOL_ITERATIONS env var)
76
77
  * @param {boolean} [options.disableMermaidValidation=false] - Disable automatic mermaid diagram validation and fixing
77
78
  * @param {boolean} [options.enableMcp=false] - Enable MCP tool integration
78
79
  * @param {string} [options.mcpConfigPath] - Path to MCP configuration file
@@ -90,6 +91,7 @@ export class ProbeAgent {
90
91
  this.tracer = options.tracer || null;
91
92
  this.outline = !!options.outline;
92
93
  this.maxResponseTokens = options.maxResponseTokens || parseInt(process.env.MAX_RESPONSE_TOKENS || '0', 10) || null;
94
+ this.maxIterations = options.maxIterations || null;
93
95
  this.disableMermaidValidation = !!options.disableMermaidValidation;
94
96
 
95
97
  // Bash configuration
@@ -929,12 +931,13 @@ When troubleshooting:
929
931
  // +1 for schema formatting
930
932
  // +2 for potential Mermaid validation retries (can be multiple diagrams)
931
933
  // +1 for potential JSON correction
932
- const maxIterations = options.schema ? MAX_TOOL_ITERATIONS + 4 : MAX_TOOL_ITERATIONS;
934
+ const baseMaxIterations = this.maxIterations || MAX_TOOL_ITERATIONS;
935
+ const maxIterations = options.schema ? baseMaxIterations + 4 : baseMaxIterations;
933
936
 
934
937
  if (this.debug) {
935
938
  console.log(`[DEBUG] Starting agentic flow for question: ${message.substring(0, 100)}...`);
936
939
  if (options.schema) {
937
- console.log(`[DEBUG] Schema provided, using extended iteration limit: ${maxIterations} (base: ${MAX_TOOL_ITERATIONS})`);
940
+ console.log(`[DEBUG] Schema provided, using extended iteration limit: ${maxIterations} (base: ${baseMaxIterations})`);
938
941
  }
939
942
  }
940
943
 
@@ -16653,7 +16653,7 @@ var require_package = __commonJS({
16653
16653
  module2.exports = {
16654
16654
  name: "@aws-sdk/client-bedrock-runtime",
16655
16655
  description: "AWS SDK for JavaScript Bedrock Runtime Client for Node.js, Browser and React Native",
16656
- version: "3.899.0",
16656
+ version: "3.901.0",
16657
16657
  scripts: {
16658
16658
  build: "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'",
16659
16659
  "build:cjs": "node ../../scripts/compilation/inline client-bedrock-runtime",
@@ -16672,51 +16672,51 @@ var require_package = __commonJS({
16672
16672
  dependencies: {
16673
16673
  "@aws-crypto/sha256-browser": "5.2.0",
16674
16674
  "@aws-crypto/sha256-js": "5.2.0",
16675
- "@aws-sdk/core": "3.899.0",
16676
- "@aws-sdk/credential-provider-node": "3.899.0",
16677
- "@aws-sdk/eventstream-handler-node": "3.893.0",
16678
- "@aws-sdk/middleware-eventstream": "3.893.0",
16679
- "@aws-sdk/middleware-host-header": "3.893.0",
16680
- "@aws-sdk/middleware-logger": "3.893.0",
16681
- "@aws-sdk/middleware-recursion-detection": "3.893.0",
16682
- "@aws-sdk/middleware-user-agent": "3.899.0",
16683
- "@aws-sdk/middleware-websocket": "3.893.0",
16684
- "@aws-sdk/region-config-resolver": "3.893.0",
16685
- "@aws-sdk/token-providers": "3.899.0",
16686
- "@aws-sdk/types": "3.893.0",
16687
- "@aws-sdk/util-endpoints": "3.895.0",
16688
- "@aws-sdk/util-user-agent-browser": "3.893.0",
16689
- "@aws-sdk/util-user-agent-node": "3.899.0",
16690
- "@smithy/config-resolver": "^4.2.2",
16691
- "@smithy/core": "^3.13.0",
16692
- "@smithy/eventstream-serde-browser": "^4.1.1",
16693
- "@smithy/eventstream-serde-config-resolver": "^4.2.1",
16694
- "@smithy/eventstream-serde-node": "^4.1.1",
16695
- "@smithy/fetch-http-handler": "^5.2.1",
16696
- "@smithy/hash-node": "^4.1.1",
16697
- "@smithy/invalid-dependency": "^4.1.1",
16698
- "@smithy/middleware-content-length": "^4.1.1",
16699
- "@smithy/middleware-endpoint": "^4.2.5",
16700
- "@smithy/middleware-retry": "^4.3.1",
16701
- "@smithy/middleware-serde": "^4.1.1",
16702
- "@smithy/middleware-stack": "^4.1.1",
16703
- "@smithy/node-config-provider": "^4.2.2",
16704
- "@smithy/node-http-handler": "^4.2.1",
16705
- "@smithy/protocol-http": "^5.2.1",
16706
- "@smithy/smithy-client": "^4.6.5",
16707
- "@smithy/types": "^4.5.0",
16708
- "@smithy/url-parser": "^4.1.1",
16709
- "@smithy/util-base64": "^4.1.0",
16710
- "@smithy/util-body-length-browser": "^4.1.0",
16711
- "@smithy/util-body-length-node": "^4.1.0",
16712
- "@smithy/util-defaults-mode-browser": "^4.1.5",
16713
- "@smithy/util-defaults-mode-node": "^4.1.5",
16714
- "@smithy/util-endpoints": "^3.1.2",
16715
- "@smithy/util-middleware": "^4.1.1",
16716
- "@smithy/util-retry": "^4.1.2",
16717
- "@smithy/util-stream": "^4.3.2",
16718
- "@smithy/util-utf8": "^4.1.0",
16719
- "@smithy/uuid": "^1.0.0",
16675
+ "@aws-sdk/core": "3.901.0",
16676
+ "@aws-sdk/credential-provider-node": "3.901.0",
16677
+ "@aws-sdk/eventstream-handler-node": "3.901.0",
16678
+ "@aws-sdk/middleware-eventstream": "3.901.0",
16679
+ "@aws-sdk/middleware-host-header": "3.901.0",
16680
+ "@aws-sdk/middleware-logger": "3.901.0",
16681
+ "@aws-sdk/middleware-recursion-detection": "3.901.0",
16682
+ "@aws-sdk/middleware-user-agent": "3.901.0",
16683
+ "@aws-sdk/middleware-websocket": "3.901.0",
16684
+ "@aws-sdk/region-config-resolver": "3.901.0",
16685
+ "@aws-sdk/token-providers": "3.901.0",
16686
+ "@aws-sdk/types": "3.901.0",
16687
+ "@aws-sdk/util-endpoints": "3.901.0",
16688
+ "@aws-sdk/util-user-agent-browser": "3.901.0",
16689
+ "@aws-sdk/util-user-agent-node": "3.901.0",
16690
+ "@smithy/config-resolver": "^4.3.0",
16691
+ "@smithy/core": "^3.14.0",
16692
+ "@smithy/eventstream-serde-browser": "^4.2.0",
16693
+ "@smithy/eventstream-serde-config-resolver": "^4.3.0",
16694
+ "@smithy/eventstream-serde-node": "^4.2.0",
16695
+ "@smithy/fetch-http-handler": "^5.3.0",
16696
+ "@smithy/hash-node": "^4.2.0",
16697
+ "@smithy/invalid-dependency": "^4.2.0",
16698
+ "@smithy/middleware-content-length": "^4.2.0",
16699
+ "@smithy/middleware-endpoint": "^4.3.0",
16700
+ "@smithy/middleware-retry": "^4.4.0",
16701
+ "@smithy/middleware-serde": "^4.2.0",
16702
+ "@smithy/middleware-stack": "^4.2.0",
16703
+ "@smithy/node-config-provider": "^4.3.0",
16704
+ "@smithy/node-http-handler": "^4.3.0",
16705
+ "@smithy/protocol-http": "^5.3.0",
16706
+ "@smithy/smithy-client": "^4.7.0",
16707
+ "@smithy/types": "^4.6.0",
16708
+ "@smithy/url-parser": "^4.2.0",
16709
+ "@smithy/util-base64": "^4.2.0",
16710
+ "@smithy/util-body-length-browser": "^4.2.0",
16711
+ "@smithy/util-body-length-node": "^4.2.0",
16712
+ "@smithy/util-defaults-mode-browser": "^4.2.0",
16713
+ "@smithy/util-defaults-mode-node": "^4.2.0",
16714
+ "@smithy/util-endpoints": "^3.2.0",
16715
+ "@smithy/util-middleware": "^4.2.0",
16716
+ "@smithy/util-retry": "^4.2.0",
16717
+ "@smithy/util-stream": "^4.4.0",
16718
+ "@smithy/util-utf8": "^4.2.0",
16719
+ "@smithy/uuid": "^1.1.0",
16720
16720
  tslib: "^2.6.2"
16721
16721
  },
16722
16722
  devDependencies: {
@@ -17453,7 +17453,7 @@ var require_package2 = __commonJS({
17453
17453
  module2.exports = {
17454
17454
  name: "@aws-sdk/client-sso",
17455
17455
  description: "AWS SDK for JavaScript Sso Client for Node.js, Browser and React Native",
17456
- version: "3.899.0",
17456
+ version: "3.901.0",
17457
17457
  scripts: {
17458
17458
  build: "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'",
17459
17459
  "build:cjs": "node ../../scripts/compilation/inline client-sso",
@@ -17472,41 +17472,41 @@ var require_package2 = __commonJS({
17472
17472
  dependencies: {
17473
17473
  "@aws-crypto/sha256-browser": "5.2.0",
17474
17474
  "@aws-crypto/sha256-js": "5.2.0",
17475
- "@aws-sdk/core": "3.899.0",
17476
- "@aws-sdk/middleware-host-header": "3.893.0",
17477
- "@aws-sdk/middleware-logger": "3.893.0",
17478
- "@aws-sdk/middleware-recursion-detection": "3.893.0",
17479
- "@aws-sdk/middleware-user-agent": "3.899.0",
17480
- "@aws-sdk/region-config-resolver": "3.893.0",
17481
- "@aws-sdk/types": "3.893.0",
17482
- "@aws-sdk/util-endpoints": "3.895.0",
17483
- "@aws-sdk/util-user-agent-browser": "3.893.0",
17484
- "@aws-sdk/util-user-agent-node": "3.899.0",
17485
- "@smithy/config-resolver": "^4.2.2",
17486
- "@smithy/core": "^3.13.0",
17487
- "@smithy/fetch-http-handler": "^5.2.1",
17488
- "@smithy/hash-node": "^4.1.1",
17489
- "@smithy/invalid-dependency": "^4.1.1",
17490
- "@smithy/middleware-content-length": "^4.1.1",
17491
- "@smithy/middleware-endpoint": "^4.2.5",
17492
- "@smithy/middleware-retry": "^4.3.1",
17493
- "@smithy/middleware-serde": "^4.1.1",
17494
- "@smithy/middleware-stack": "^4.1.1",
17495
- "@smithy/node-config-provider": "^4.2.2",
17496
- "@smithy/node-http-handler": "^4.2.1",
17497
- "@smithy/protocol-http": "^5.2.1",
17498
- "@smithy/smithy-client": "^4.6.5",
17499
- "@smithy/types": "^4.5.0",
17500
- "@smithy/url-parser": "^4.1.1",
17501
- "@smithy/util-base64": "^4.1.0",
17502
- "@smithy/util-body-length-browser": "^4.1.0",
17503
- "@smithy/util-body-length-node": "^4.1.0",
17504
- "@smithy/util-defaults-mode-browser": "^4.1.5",
17505
- "@smithy/util-defaults-mode-node": "^4.1.5",
17506
- "@smithy/util-endpoints": "^3.1.2",
17507
- "@smithy/util-middleware": "^4.1.1",
17508
- "@smithy/util-retry": "^4.1.2",
17509
- "@smithy/util-utf8": "^4.1.0",
17475
+ "@aws-sdk/core": "3.901.0",
17476
+ "@aws-sdk/middleware-host-header": "3.901.0",
17477
+ "@aws-sdk/middleware-logger": "3.901.0",
17478
+ "@aws-sdk/middleware-recursion-detection": "3.901.0",
17479
+ "@aws-sdk/middleware-user-agent": "3.901.0",
17480
+ "@aws-sdk/region-config-resolver": "3.901.0",
17481
+ "@aws-sdk/types": "3.901.0",
17482
+ "@aws-sdk/util-endpoints": "3.901.0",
17483
+ "@aws-sdk/util-user-agent-browser": "3.901.0",
17484
+ "@aws-sdk/util-user-agent-node": "3.901.0",
17485
+ "@smithy/config-resolver": "^4.3.0",
17486
+ "@smithy/core": "^3.14.0",
17487
+ "@smithy/fetch-http-handler": "^5.3.0",
17488
+ "@smithy/hash-node": "^4.2.0",
17489
+ "@smithy/invalid-dependency": "^4.2.0",
17490
+ "@smithy/middleware-content-length": "^4.2.0",
17491
+ "@smithy/middleware-endpoint": "^4.3.0",
17492
+ "@smithy/middleware-retry": "^4.4.0",
17493
+ "@smithy/middleware-serde": "^4.2.0",
17494
+ "@smithy/middleware-stack": "^4.2.0",
17495
+ "@smithy/node-config-provider": "^4.3.0",
17496
+ "@smithy/node-http-handler": "^4.3.0",
17497
+ "@smithy/protocol-http": "^5.3.0",
17498
+ "@smithy/smithy-client": "^4.7.0",
17499
+ "@smithy/types": "^4.6.0",
17500
+ "@smithy/url-parser": "^4.2.0",
17501
+ "@smithy/util-base64": "^4.2.0",
17502
+ "@smithy/util-body-length-browser": "^4.2.0",
17503
+ "@smithy/util-body-length-node": "^4.2.0",
17504
+ "@smithy/util-defaults-mode-browser": "^4.2.0",
17505
+ "@smithy/util-defaults-mode-node": "^4.2.0",
17506
+ "@smithy/util-endpoints": "^3.2.0",
17507
+ "@smithy/util-middleware": "^4.2.0",
17508
+ "@smithy/util-retry": "^4.2.0",
17509
+ "@smithy/util-utf8": "^4.2.0",
17510
17510
  tslib: "^2.6.2"
17511
17511
  },
17512
17512
  devDependencies: {
@@ -18655,7 +18655,7 @@ var init_package = __esm({
18655
18655
  "node_modules/@aws-sdk/nested-clients/package.json"() {
18656
18656
  package_default = {
18657
18657
  name: "@aws-sdk/nested-clients",
18658
- version: "3.899.0",
18658
+ version: "3.901.0",
18659
18659
  description: "Nested clients for AWS SDK packages.",
18660
18660
  main: "./dist-cjs/index.js",
18661
18661
  module: "./dist-es/index.js",
@@ -18684,41 +18684,41 @@ var init_package = __esm({
18684
18684
  dependencies: {
18685
18685
  "@aws-crypto/sha256-browser": "5.2.0",
18686
18686
  "@aws-crypto/sha256-js": "5.2.0",
18687
- "@aws-sdk/core": "3.899.0",
18688
- "@aws-sdk/middleware-host-header": "3.893.0",
18689
- "@aws-sdk/middleware-logger": "3.893.0",
18690
- "@aws-sdk/middleware-recursion-detection": "3.893.0",
18691
- "@aws-sdk/middleware-user-agent": "3.899.0",
18692
- "@aws-sdk/region-config-resolver": "3.893.0",
18693
- "@aws-sdk/types": "3.893.0",
18694
- "@aws-sdk/util-endpoints": "3.895.0",
18695
- "@aws-sdk/util-user-agent-browser": "3.893.0",
18696
- "@aws-sdk/util-user-agent-node": "3.899.0",
18697
- "@smithy/config-resolver": "^4.2.2",
18698
- "@smithy/core": "^3.13.0",
18699
- "@smithy/fetch-http-handler": "^5.2.1",
18700
- "@smithy/hash-node": "^4.1.1",
18701
- "@smithy/invalid-dependency": "^4.1.1",
18702
- "@smithy/middleware-content-length": "^4.1.1",
18703
- "@smithy/middleware-endpoint": "^4.2.5",
18704
- "@smithy/middleware-retry": "^4.3.1",
18705
- "@smithy/middleware-serde": "^4.1.1",
18706
- "@smithy/middleware-stack": "^4.1.1",
18707
- "@smithy/node-config-provider": "^4.2.2",
18708
- "@smithy/node-http-handler": "^4.2.1",
18709
- "@smithy/protocol-http": "^5.2.1",
18710
- "@smithy/smithy-client": "^4.6.5",
18711
- "@smithy/types": "^4.5.0",
18712
- "@smithy/url-parser": "^4.1.1",
18713
- "@smithy/util-base64": "^4.1.0",
18714
- "@smithy/util-body-length-browser": "^4.1.0",
18715
- "@smithy/util-body-length-node": "^4.1.0",
18716
- "@smithy/util-defaults-mode-browser": "^4.1.5",
18717
- "@smithy/util-defaults-mode-node": "^4.1.5",
18718
- "@smithy/util-endpoints": "^3.1.2",
18719
- "@smithy/util-middleware": "^4.1.1",
18720
- "@smithy/util-retry": "^4.1.2",
18721
- "@smithy/util-utf8": "^4.1.0",
18687
+ "@aws-sdk/core": "3.901.0",
18688
+ "@aws-sdk/middleware-host-header": "3.901.0",
18689
+ "@aws-sdk/middleware-logger": "3.901.0",
18690
+ "@aws-sdk/middleware-recursion-detection": "3.901.0",
18691
+ "@aws-sdk/middleware-user-agent": "3.901.0",
18692
+ "@aws-sdk/region-config-resolver": "3.901.0",
18693
+ "@aws-sdk/types": "3.901.0",
18694
+ "@aws-sdk/util-endpoints": "3.901.0",
18695
+ "@aws-sdk/util-user-agent-browser": "3.901.0",
18696
+ "@aws-sdk/util-user-agent-node": "3.901.0",
18697
+ "@smithy/config-resolver": "^4.3.0",
18698
+ "@smithy/core": "^3.14.0",
18699
+ "@smithy/fetch-http-handler": "^5.3.0",
18700
+ "@smithy/hash-node": "^4.2.0",
18701
+ "@smithy/invalid-dependency": "^4.2.0",
18702
+ "@smithy/middleware-content-length": "^4.2.0",
18703
+ "@smithy/middleware-endpoint": "^4.3.0",
18704
+ "@smithy/middleware-retry": "^4.4.0",
18705
+ "@smithy/middleware-serde": "^4.2.0",
18706
+ "@smithy/middleware-stack": "^4.2.0",
18707
+ "@smithy/node-config-provider": "^4.3.0",
18708
+ "@smithy/node-http-handler": "^4.3.0",
18709
+ "@smithy/protocol-http": "^5.3.0",
18710
+ "@smithy/smithy-client": "^4.7.0",
18711
+ "@smithy/types": "^4.6.0",
18712
+ "@smithy/url-parser": "^4.2.0",
18713
+ "@smithy/util-base64": "^4.2.0",
18714
+ "@smithy/util-body-length-browser": "^4.2.0",
18715
+ "@smithy/util-body-length-node": "^4.2.0",
18716
+ "@smithy/util-defaults-mode-browser": "^4.2.0",
18717
+ "@smithy/util-defaults-mode-node": "^4.2.0",
18718
+ "@smithy/util-endpoints": "^3.2.0",
18719
+ "@smithy/util-middleware": "^4.2.0",
18720
+ "@smithy/util-retry": "^4.2.0",
18721
+ "@smithy/util-utf8": "^4.2.0",
18722
18722
  tslib: "^2.6.2"
18723
18723
  },
18724
18724
  devDependencies: {
@@ -54486,7 +54486,9 @@ When presented with a broken Mermaid diagram, analyze it thoroughly and provide
54486
54486
  model: this.options.model,
54487
54487
  debug: this.options.debug,
54488
54488
  tracer: this.options.tracer,
54489
- allowEdit: this.options.allowEdit
54489
+ allowEdit: this.options.allowEdit,
54490
+ maxIterations: 2
54491
+ // Limit mermaid fixing to 2 iterations to prevent long loops
54490
54492
  });
54491
54493
  }
54492
54494
  return this.agent;
@@ -54545,9 +54547,7 @@ ${contentToFix}
54545
54547
 
54546
54548
  Provide only the corrected Mermaid diagram within a mermaid code block. Do not add any explanations or additional text.`;
54547
54549
  try {
54548
- const result = await this.agent.answer(prompt, [], {
54549
- schema: "Return only valid Mermaid diagram code within ```mermaid code block"
54550
- });
54550
+ const result = await this.agent.answer(prompt, []);
54551
54551
  const extractedDiagram = this.extractCorrectedDiagram(result);
54552
54552
  return extractedDiagram || result;
54553
54553
  } catch (error2) {
@@ -55303,6 +55303,7 @@ var init_ProbeAgent = __esm({
55303
55303
  * @param {boolean} [options.debug] - Enable debug mode
55304
55304
  * @param {boolean} [options.outline] - Enable outline-xml format for search results
55305
55305
  * @param {number} [options.maxResponseTokens] - Maximum tokens for AI responses
55306
+ * @param {number} [options.maxIterations] - Maximum tool iterations (overrides MAX_TOOL_ITERATIONS env var)
55306
55307
  * @param {boolean} [options.disableMermaidValidation=false] - Disable automatic mermaid diagram validation and fixing
55307
55308
  * @param {boolean} [options.enableMcp=false] - Enable MCP tool integration
55308
55309
  * @param {string} [options.mcpConfigPath] - Path to MCP configuration file
@@ -55319,6 +55320,7 @@ var init_ProbeAgent = __esm({
55319
55320
  this.tracer = options.tracer || null;
55320
55321
  this.outline = !!options.outline;
55321
55322
  this.maxResponseTokens = options.maxResponseTokens || parseInt(process.env.MAX_RESPONSE_TOKENS || "0", 10) || null;
55323
+ this.maxIterations = options.maxIterations || null;
55322
55324
  this.disableMermaidValidation = !!options.disableMermaidValidation;
55323
55325
  this.enableBash = !!options.enableBash;
55324
55326
  this.bashConfig = options.bashConfig || {};
@@ -56013,11 +56015,12 @@ You are working with a repository located at: ${searchDirectory}
56013
56015
  let currentIteration = 0;
56014
56016
  let completionAttempted = false;
56015
56017
  let finalResult = "I was unable to complete your request due to reaching the maximum number of tool iterations.";
56016
- const maxIterations = options.schema ? MAX_TOOL_ITERATIONS + 4 : MAX_TOOL_ITERATIONS;
56018
+ const baseMaxIterations = this.maxIterations || MAX_TOOL_ITERATIONS;
56019
+ const maxIterations = options.schema ? baseMaxIterations + 4 : baseMaxIterations;
56017
56020
  if (this.debug) {
56018
56021
  console.log(`[DEBUG] Starting agentic flow for question: ${message.substring(0, 100)}...`);
56019
56022
  if (options.schema) {
56020
- console.log(`[DEBUG] Schema provided, using extended iteration limit: ${maxIterations} (base: ${MAX_TOOL_ITERATIONS})`);
56023
+ console.log(`[DEBUG] Schema provided, using extended iteration limit: ${maxIterations} (base: ${baseMaxIterations})`);
56021
56024
  }
56022
56025
  }
56023
56026
  while (currentIteration < maxIterations && !completionAttempted) {
@@ -811,7 +811,8 @@ When presented with a broken Mermaid diagram, analyze it thoroughly and provide
811
811
  model: this.options.model,
812
812
  debug: this.options.debug,
813
813
  tracer: this.options.tracer,
814
- allowEdit: this.options.allowEdit
814
+ allowEdit: this.options.allowEdit,
815
+ maxIterations: 2 // Limit mermaid fixing to 2 iterations to prevent long loops
815
816
  });
816
817
  }
817
818
 
@@ -884,10 +885,11 @@ ${contentToFix}
884
885
  Provide only the corrected Mermaid diagram within a mermaid code block. Do not add any explanations or additional text.`;
885
886
 
886
887
  try {
887
- const result = await this.agent.answer(prompt, [], {
888
- schema: 'Return only valid Mermaid diagram code within ```mermaid code block'
889
- });
890
-
888
+ // Don't pass schema to avoid infinite loop where AI returns raw mermaid code
889
+ // instead of using attempt_completion tool. The custom prompt already instructs
890
+ // to return only mermaid code blocks.
891
+ const result = await this.agent.answer(prompt, []);
892
+
891
893
  // Extract the mermaid code from the response
892
894
  const extractedDiagram = this.extractCorrectedDiagram(result);
893
895
  return extractedDiagram || result;
@@ -16647,7 +16647,7 @@ var require_package = __commonJS({
16647
16647
  module2.exports = {
16648
16648
  name: "@aws-sdk/client-bedrock-runtime",
16649
16649
  description: "AWS SDK for JavaScript Bedrock Runtime Client for Node.js, Browser and React Native",
16650
- version: "3.899.0",
16650
+ version: "3.901.0",
16651
16651
  scripts: {
16652
16652
  build: "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'",
16653
16653
  "build:cjs": "node ../../scripts/compilation/inline client-bedrock-runtime",
@@ -16666,51 +16666,51 @@ var require_package = __commonJS({
16666
16666
  dependencies: {
16667
16667
  "@aws-crypto/sha256-browser": "5.2.0",
16668
16668
  "@aws-crypto/sha256-js": "5.2.0",
16669
- "@aws-sdk/core": "3.899.0",
16670
- "@aws-sdk/credential-provider-node": "3.899.0",
16671
- "@aws-sdk/eventstream-handler-node": "3.893.0",
16672
- "@aws-sdk/middleware-eventstream": "3.893.0",
16673
- "@aws-sdk/middleware-host-header": "3.893.0",
16674
- "@aws-sdk/middleware-logger": "3.893.0",
16675
- "@aws-sdk/middleware-recursion-detection": "3.893.0",
16676
- "@aws-sdk/middleware-user-agent": "3.899.0",
16677
- "@aws-sdk/middleware-websocket": "3.893.0",
16678
- "@aws-sdk/region-config-resolver": "3.893.0",
16679
- "@aws-sdk/token-providers": "3.899.0",
16680
- "@aws-sdk/types": "3.893.0",
16681
- "@aws-sdk/util-endpoints": "3.895.0",
16682
- "@aws-sdk/util-user-agent-browser": "3.893.0",
16683
- "@aws-sdk/util-user-agent-node": "3.899.0",
16684
- "@smithy/config-resolver": "^4.2.2",
16685
- "@smithy/core": "^3.13.0",
16686
- "@smithy/eventstream-serde-browser": "^4.1.1",
16687
- "@smithy/eventstream-serde-config-resolver": "^4.2.1",
16688
- "@smithy/eventstream-serde-node": "^4.1.1",
16689
- "@smithy/fetch-http-handler": "^5.2.1",
16690
- "@smithy/hash-node": "^4.1.1",
16691
- "@smithy/invalid-dependency": "^4.1.1",
16692
- "@smithy/middleware-content-length": "^4.1.1",
16693
- "@smithy/middleware-endpoint": "^4.2.5",
16694
- "@smithy/middleware-retry": "^4.3.1",
16695
- "@smithy/middleware-serde": "^4.1.1",
16696
- "@smithy/middleware-stack": "^4.1.1",
16697
- "@smithy/node-config-provider": "^4.2.2",
16698
- "@smithy/node-http-handler": "^4.2.1",
16699
- "@smithy/protocol-http": "^5.2.1",
16700
- "@smithy/smithy-client": "^4.6.5",
16701
- "@smithy/types": "^4.5.0",
16702
- "@smithy/url-parser": "^4.1.1",
16703
- "@smithy/util-base64": "^4.1.0",
16704
- "@smithy/util-body-length-browser": "^4.1.0",
16705
- "@smithy/util-body-length-node": "^4.1.0",
16706
- "@smithy/util-defaults-mode-browser": "^4.1.5",
16707
- "@smithy/util-defaults-mode-node": "^4.1.5",
16708
- "@smithy/util-endpoints": "^3.1.2",
16709
- "@smithy/util-middleware": "^4.1.1",
16710
- "@smithy/util-retry": "^4.1.2",
16711
- "@smithy/util-stream": "^4.3.2",
16712
- "@smithy/util-utf8": "^4.1.0",
16713
- "@smithy/uuid": "^1.0.0",
16669
+ "@aws-sdk/core": "3.901.0",
16670
+ "@aws-sdk/credential-provider-node": "3.901.0",
16671
+ "@aws-sdk/eventstream-handler-node": "3.901.0",
16672
+ "@aws-sdk/middleware-eventstream": "3.901.0",
16673
+ "@aws-sdk/middleware-host-header": "3.901.0",
16674
+ "@aws-sdk/middleware-logger": "3.901.0",
16675
+ "@aws-sdk/middleware-recursion-detection": "3.901.0",
16676
+ "@aws-sdk/middleware-user-agent": "3.901.0",
16677
+ "@aws-sdk/middleware-websocket": "3.901.0",
16678
+ "@aws-sdk/region-config-resolver": "3.901.0",
16679
+ "@aws-sdk/token-providers": "3.901.0",
16680
+ "@aws-sdk/types": "3.901.0",
16681
+ "@aws-sdk/util-endpoints": "3.901.0",
16682
+ "@aws-sdk/util-user-agent-browser": "3.901.0",
16683
+ "@aws-sdk/util-user-agent-node": "3.901.0",
16684
+ "@smithy/config-resolver": "^4.3.0",
16685
+ "@smithy/core": "^3.14.0",
16686
+ "@smithy/eventstream-serde-browser": "^4.2.0",
16687
+ "@smithy/eventstream-serde-config-resolver": "^4.3.0",
16688
+ "@smithy/eventstream-serde-node": "^4.2.0",
16689
+ "@smithy/fetch-http-handler": "^5.3.0",
16690
+ "@smithy/hash-node": "^4.2.0",
16691
+ "@smithy/invalid-dependency": "^4.2.0",
16692
+ "@smithy/middleware-content-length": "^4.2.0",
16693
+ "@smithy/middleware-endpoint": "^4.3.0",
16694
+ "@smithy/middleware-retry": "^4.4.0",
16695
+ "@smithy/middleware-serde": "^4.2.0",
16696
+ "@smithy/middleware-stack": "^4.2.0",
16697
+ "@smithy/node-config-provider": "^4.3.0",
16698
+ "@smithy/node-http-handler": "^4.3.0",
16699
+ "@smithy/protocol-http": "^5.3.0",
16700
+ "@smithy/smithy-client": "^4.7.0",
16701
+ "@smithy/types": "^4.6.0",
16702
+ "@smithy/url-parser": "^4.2.0",
16703
+ "@smithy/util-base64": "^4.2.0",
16704
+ "@smithy/util-body-length-browser": "^4.2.0",
16705
+ "@smithy/util-body-length-node": "^4.2.0",
16706
+ "@smithy/util-defaults-mode-browser": "^4.2.0",
16707
+ "@smithy/util-defaults-mode-node": "^4.2.0",
16708
+ "@smithy/util-endpoints": "^3.2.0",
16709
+ "@smithy/util-middleware": "^4.2.0",
16710
+ "@smithy/util-retry": "^4.2.0",
16711
+ "@smithy/util-stream": "^4.4.0",
16712
+ "@smithy/util-utf8": "^4.2.0",
16713
+ "@smithy/uuid": "^1.1.0",
16714
16714
  tslib: "^2.6.2"
16715
16715
  },
16716
16716
  devDependencies: {
@@ -17447,7 +17447,7 @@ var require_package2 = __commonJS({
17447
17447
  module2.exports = {
17448
17448
  name: "@aws-sdk/client-sso",
17449
17449
  description: "AWS SDK for JavaScript Sso Client for Node.js, Browser and React Native",
17450
- version: "3.899.0",
17450
+ version: "3.901.0",
17451
17451
  scripts: {
17452
17452
  build: "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'",
17453
17453
  "build:cjs": "node ../../scripts/compilation/inline client-sso",
@@ -17466,41 +17466,41 @@ var require_package2 = __commonJS({
17466
17466
  dependencies: {
17467
17467
  "@aws-crypto/sha256-browser": "5.2.0",
17468
17468
  "@aws-crypto/sha256-js": "5.2.0",
17469
- "@aws-sdk/core": "3.899.0",
17470
- "@aws-sdk/middleware-host-header": "3.893.0",
17471
- "@aws-sdk/middleware-logger": "3.893.0",
17472
- "@aws-sdk/middleware-recursion-detection": "3.893.0",
17473
- "@aws-sdk/middleware-user-agent": "3.899.0",
17474
- "@aws-sdk/region-config-resolver": "3.893.0",
17475
- "@aws-sdk/types": "3.893.0",
17476
- "@aws-sdk/util-endpoints": "3.895.0",
17477
- "@aws-sdk/util-user-agent-browser": "3.893.0",
17478
- "@aws-sdk/util-user-agent-node": "3.899.0",
17479
- "@smithy/config-resolver": "^4.2.2",
17480
- "@smithy/core": "^3.13.0",
17481
- "@smithy/fetch-http-handler": "^5.2.1",
17482
- "@smithy/hash-node": "^4.1.1",
17483
- "@smithy/invalid-dependency": "^4.1.1",
17484
- "@smithy/middleware-content-length": "^4.1.1",
17485
- "@smithy/middleware-endpoint": "^4.2.5",
17486
- "@smithy/middleware-retry": "^4.3.1",
17487
- "@smithy/middleware-serde": "^4.1.1",
17488
- "@smithy/middleware-stack": "^4.1.1",
17489
- "@smithy/node-config-provider": "^4.2.2",
17490
- "@smithy/node-http-handler": "^4.2.1",
17491
- "@smithy/protocol-http": "^5.2.1",
17492
- "@smithy/smithy-client": "^4.6.5",
17493
- "@smithy/types": "^4.5.0",
17494
- "@smithy/url-parser": "^4.1.1",
17495
- "@smithy/util-base64": "^4.1.0",
17496
- "@smithy/util-body-length-browser": "^4.1.0",
17497
- "@smithy/util-body-length-node": "^4.1.0",
17498
- "@smithy/util-defaults-mode-browser": "^4.1.5",
17499
- "@smithy/util-defaults-mode-node": "^4.1.5",
17500
- "@smithy/util-endpoints": "^3.1.2",
17501
- "@smithy/util-middleware": "^4.1.1",
17502
- "@smithy/util-retry": "^4.1.2",
17503
- "@smithy/util-utf8": "^4.1.0",
17469
+ "@aws-sdk/core": "3.901.0",
17470
+ "@aws-sdk/middleware-host-header": "3.901.0",
17471
+ "@aws-sdk/middleware-logger": "3.901.0",
17472
+ "@aws-sdk/middleware-recursion-detection": "3.901.0",
17473
+ "@aws-sdk/middleware-user-agent": "3.901.0",
17474
+ "@aws-sdk/region-config-resolver": "3.901.0",
17475
+ "@aws-sdk/types": "3.901.0",
17476
+ "@aws-sdk/util-endpoints": "3.901.0",
17477
+ "@aws-sdk/util-user-agent-browser": "3.901.0",
17478
+ "@aws-sdk/util-user-agent-node": "3.901.0",
17479
+ "@smithy/config-resolver": "^4.3.0",
17480
+ "@smithy/core": "^3.14.0",
17481
+ "@smithy/fetch-http-handler": "^5.3.0",
17482
+ "@smithy/hash-node": "^4.2.0",
17483
+ "@smithy/invalid-dependency": "^4.2.0",
17484
+ "@smithy/middleware-content-length": "^4.2.0",
17485
+ "@smithy/middleware-endpoint": "^4.3.0",
17486
+ "@smithy/middleware-retry": "^4.4.0",
17487
+ "@smithy/middleware-serde": "^4.2.0",
17488
+ "@smithy/middleware-stack": "^4.2.0",
17489
+ "@smithy/node-config-provider": "^4.3.0",
17490
+ "@smithy/node-http-handler": "^4.3.0",
17491
+ "@smithy/protocol-http": "^5.3.0",
17492
+ "@smithy/smithy-client": "^4.7.0",
17493
+ "@smithy/types": "^4.6.0",
17494
+ "@smithy/url-parser": "^4.2.0",
17495
+ "@smithy/util-base64": "^4.2.0",
17496
+ "@smithy/util-body-length-browser": "^4.2.0",
17497
+ "@smithy/util-body-length-node": "^4.2.0",
17498
+ "@smithy/util-defaults-mode-browser": "^4.2.0",
17499
+ "@smithy/util-defaults-mode-node": "^4.2.0",
17500
+ "@smithy/util-endpoints": "^3.2.0",
17501
+ "@smithy/util-middleware": "^4.2.0",
17502
+ "@smithy/util-retry": "^4.2.0",
17503
+ "@smithy/util-utf8": "^4.2.0",
17504
17504
  tslib: "^2.6.2"
17505
17505
  },
17506
17506
  devDependencies: {
@@ -18649,7 +18649,7 @@ var init_package = __esm({
18649
18649
  "node_modules/@aws-sdk/nested-clients/package.json"() {
18650
18650
  package_default = {
18651
18651
  name: "@aws-sdk/nested-clients",
18652
- version: "3.899.0",
18652
+ version: "3.901.0",
18653
18653
  description: "Nested clients for AWS SDK packages.",
18654
18654
  main: "./dist-cjs/index.js",
18655
18655
  module: "./dist-es/index.js",
@@ -18678,41 +18678,41 @@ var init_package = __esm({
18678
18678
  dependencies: {
18679
18679
  "@aws-crypto/sha256-browser": "5.2.0",
18680
18680
  "@aws-crypto/sha256-js": "5.2.0",
18681
- "@aws-sdk/core": "3.899.0",
18682
- "@aws-sdk/middleware-host-header": "3.893.0",
18683
- "@aws-sdk/middleware-logger": "3.893.0",
18684
- "@aws-sdk/middleware-recursion-detection": "3.893.0",
18685
- "@aws-sdk/middleware-user-agent": "3.899.0",
18686
- "@aws-sdk/region-config-resolver": "3.893.0",
18687
- "@aws-sdk/types": "3.893.0",
18688
- "@aws-sdk/util-endpoints": "3.895.0",
18689
- "@aws-sdk/util-user-agent-browser": "3.893.0",
18690
- "@aws-sdk/util-user-agent-node": "3.899.0",
18691
- "@smithy/config-resolver": "^4.2.2",
18692
- "@smithy/core": "^3.13.0",
18693
- "@smithy/fetch-http-handler": "^5.2.1",
18694
- "@smithy/hash-node": "^4.1.1",
18695
- "@smithy/invalid-dependency": "^4.1.1",
18696
- "@smithy/middleware-content-length": "^4.1.1",
18697
- "@smithy/middleware-endpoint": "^4.2.5",
18698
- "@smithy/middleware-retry": "^4.3.1",
18699
- "@smithy/middleware-serde": "^4.1.1",
18700
- "@smithy/middleware-stack": "^4.1.1",
18701
- "@smithy/node-config-provider": "^4.2.2",
18702
- "@smithy/node-http-handler": "^4.2.1",
18703
- "@smithy/protocol-http": "^5.2.1",
18704
- "@smithy/smithy-client": "^4.6.5",
18705
- "@smithy/types": "^4.5.0",
18706
- "@smithy/url-parser": "^4.1.1",
18707
- "@smithy/util-base64": "^4.1.0",
18708
- "@smithy/util-body-length-browser": "^4.1.0",
18709
- "@smithy/util-body-length-node": "^4.1.0",
18710
- "@smithy/util-defaults-mode-browser": "^4.1.5",
18711
- "@smithy/util-defaults-mode-node": "^4.1.5",
18712
- "@smithy/util-endpoints": "^3.1.2",
18713
- "@smithy/util-middleware": "^4.1.1",
18714
- "@smithy/util-retry": "^4.1.2",
18715
- "@smithy/util-utf8": "^4.1.0",
18681
+ "@aws-sdk/core": "3.901.0",
18682
+ "@aws-sdk/middleware-host-header": "3.901.0",
18683
+ "@aws-sdk/middleware-logger": "3.901.0",
18684
+ "@aws-sdk/middleware-recursion-detection": "3.901.0",
18685
+ "@aws-sdk/middleware-user-agent": "3.901.0",
18686
+ "@aws-sdk/region-config-resolver": "3.901.0",
18687
+ "@aws-sdk/types": "3.901.0",
18688
+ "@aws-sdk/util-endpoints": "3.901.0",
18689
+ "@aws-sdk/util-user-agent-browser": "3.901.0",
18690
+ "@aws-sdk/util-user-agent-node": "3.901.0",
18691
+ "@smithy/config-resolver": "^4.3.0",
18692
+ "@smithy/core": "^3.14.0",
18693
+ "@smithy/fetch-http-handler": "^5.3.0",
18694
+ "@smithy/hash-node": "^4.2.0",
18695
+ "@smithy/invalid-dependency": "^4.2.0",
18696
+ "@smithy/middleware-content-length": "^4.2.0",
18697
+ "@smithy/middleware-endpoint": "^4.3.0",
18698
+ "@smithy/middleware-retry": "^4.4.0",
18699
+ "@smithy/middleware-serde": "^4.2.0",
18700
+ "@smithy/middleware-stack": "^4.2.0",
18701
+ "@smithy/node-config-provider": "^4.3.0",
18702
+ "@smithy/node-http-handler": "^4.3.0",
18703
+ "@smithy/protocol-http": "^5.3.0",
18704
+ "@smithy/smithy-client": "^4.7.0",
18705
+ "@smithy/types": "^4.6.0",
18706
+ "@smithy/url-parser": "^4.2.0",
18707
+ "@smithy/util-base64": "^4.2.0",
18708
+ "@smithy/util-body-length-browser": "^4.2.0",
18709
+ "@smithy/util-body-length-node": "^4.2.0",
18710
+ "@smithy/util-defaults-mode-browser": "^4.2.0",
18711
+ "@smithy/util-defaults-mode-node": "^4.2.0",
18712
+ "@smithy/util-endpoints": "^3.2.0",
18713
+ "@smithy/util-middleware": "^4.2.0",
18714
+ "@smithy/util-retry": "^4.2.0",
18715
+ "@smithy/util-utf8": "^4.2.0",
18716
18716
  tslib: "^2.6.2"
18717
18717
  },
18718
18718
  devDependencies: {
@@ -54208,7 +54208,9 @@ When presented with a broken Mermaid diagram, analyze it thoroughly and provide
54208
54208
  model: this.options.model,
54209
54209
  debug: this.options.debug,
54210
54210
  tracer: this.options.tracer,
54211
- allowEdit: this.options.allowEdit
54211
+ allowEdit: this.options.allowEdit,
54212
+ maxIterations: 2
54213
+ // Limit mermaid fixing to 2 iterations to prevent long loops
54212
54214
  });
54213
54215
  }
54214
54216
  return this.agent;
@@ -54267,9 +54269,7 @@ ${contentToFix}
54267
54269
 
54268
54270
  Provide only the corrected Mermaid diagram within a mermaid code block. Do not add any explanations or additional text.`;
54269
54271
  try {
54270
- const result = await this.agent.answer(prompt, [], {
54271
- schema: "Return only valid Mermaid diagram code within ```mermaid code block"
54272
- });
54272
+ const result = await this.agent.answer(prompt, []);
54273
54273
  const extractedDiagram = this.extractCorrectedDiagram(result);
54274
54274
  return extractedDiagram || result;
54275
54275
  } catch (error2) {
@@ -55025,6 +55025,7 @@ var init_ProbeAgent = __esm({
55025
55025
  * @param {boolean} [options.debug] - Enable debug mode
55026
55026
  * @param {boolean} [options.outline] - Enable outline-xml format for search results
55027
55027
  * @param {number} [options.maxResponseTokens] - Maximum tokens for AI responses
55028
+ * @param {number} [options.maxIterations] - Maximum tool iterations (overrides MAX_TOOL_ITERATIONS env var)
55028
55029
  * @param {boolean} [options.disableMermaidValidation=false] - Disable automatic mermaid diagram validation and fixing
55029
55030
  * @param {boolean} [options.enableMcp=false] - Enable MCP tool integration
55030
55031
  * @param {string} [options.mcpConfigPath] - Path to MCP configuration file
@@ -55041,6 +55042,7 @@ var init_ProbeAgent = __esm({
55041
55042
  this.tracer = options.tracer || null;
55042
55043
  this.outline = !!options.outline;
55043
55044
  this.maxResponseTokens = options.maxResponseTokens || parseInt(process.env.MAX_RESPONSE_TOKENS || "0", 10) || null;
55045
+ this.maxIterations = options.maxIterations || null;
55044
55046
  this.disableMermaidValidation = !!options.disableMermaidValidation;
55045
55047
  this.enableBash = !!options.enableBash;
55046
55048
  this.bashConfig = options.bashConfig || {};
@@ -55735,11 +55737,12 @@ You are working with a repository located at: ${searchDirectory}
55735
55737
  let currentIteration = 0;
55736
55738
  let completionAttempted = false;
55737
55739
  let finalResult = "I was unable to complete your request due to reaching the maximum number of tool iterations.";
55738
- const maxIterations = options.schema ? MAX_TOOL_ITERATIONS + 4 : MAX_TOOL_ITERATIONS;
55740
+ const baseMaxIterations = this.maxIterations || MAX_TOOL_ITERATIONS;
55741
+ const maxIterations = options.schema ? baseMaxIterations + 4 : baseMaxIterations;
55739
55742
  if (this.debug) {
55740
55743
  console.log(`[DEBUG] Starting agentic flow for question: ${message.substring(0, 100)}...`);
55741
55744
  if (options.schema) {
55742
- console.log(`[DEBUG] Schema provided, using extended iteration limit: ${maxIterations} (base: ${MAX_TOOL_ITERATIONS})`);
55745
+ console.log(`[DEBUG] Schema provided, using extended iteration limit: ${maxIterations} (base: ${baseMaxIterations})`);
55743
55746
  }
55744
55747
  }
55745
55748
  while (currentIteration < maxIterations && !completionAttempted) {
package/cjs/index.cjs CHANGED
@@ -20173,7 +20173,7 @@ var require_package = __commonJS({
20173
20173
  module2.exports = {
20174
20174
  name: "@aws-sdk/client-bedrock-runtime",
20175
20175
  description: "AWS SDK for JavaScript Bedrock Runtime Client for Node.js, Browser and React Native",
20176
- version: "3.899.0",
20176
+ version: "3.901.0",
20177
20177
  scripts: {
20178
20178
  build: "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'",
20179
20179
  "build:cjs": "node ../../scripts/compilation/inline client-bedrock-runtime",
@@ -20192,51 +20192,51 @@ var require_package = __commonJS({
20192
20192
  dependencies: {
20193
20193
  "@aws-crypto/sha256-browser": "5.2.0",
20194
20194
  "@aws-crypto/sha256-js": "5.2.0",
20195
- "@aws-sdk/core": "3.899.0",
20196
- "@aws-sdk/credential-provider-node": "3.899.0",
20197
- "@aws-sdk/eventstream-handler-node": "3.893.0",
20198
- "@aws-sdk/middleware-eventstream": "3.893.0",
20199
- "@aws-sdk/middleware-host-header": "3.893.0",
20200
- "@aws-sdk/middleware-logger": "3.893.0",
20201
- "@aws-sdk/middleware-recursion-detection": "3.893.0",
20202
- "@aws-sdk/middleware-user-agent": "3.899.0",
20203
- "@aws-sdk/middleware-websocket": "3.893.0",
20204
- "@aws-sdk/region-config-resolver": "3.893.0",
20205
- "@aws-sdk/token-providers": "3.899.0",
20206
- "@aws-sdk/types": "3.893.0",
20207
- "@aws-sdk/util-endpoints": "3.895.0",
20208
- "@aws-sdk/util-user-agent-browser": "3.893.0",
20209
- "@aws-sdk/util-user-agent-node": "3.899.0",
20210
- "@smithy/config-resolver": "^4.2.2",
20211
- "@smithy/core": "^3.13.0",
20212
- "@smithy/eventstream-serde-browser": "^4.1.1",
20213
- "@smithy/eventstream-serde-config-resolver": "^4.2.1",
20214
- "@smithy/eventstream-serde-node": "^4.1.1",
20215
- "@smithy/fetch-http-handler": "^5.2.1",
20216
- "@smithy/hash-node": "^4.1.1",
20217
- "@smithy/invalid-dependency": "^4.1.1",
20218
- "@smithy/middleware-content-length": "^4.1.1",
20219
- "@smithy/middleware-endpoint": "^4.2.5",
20220
- "@smithy/middleware-retry": "^4.3.1",
20221
- "@smithy/middleware-serde": "^4.1.1",
20222
- "@smithy/middleware-stack": "^4.1.1",
20223
- "@smithy/node-config-provider": "^4.2.2",
20224
- "@smithy/node-http-handler": "^4.2.1",
20225
- "@smithy/protocol-http": "^5.2.1",
20226
- "@smithy/smithy-client": "^4.6.5",
20227
- "@smithy/types": "^4.5.0",
20228
- "@smithy/url-parser": "^4.1.1",
20229
- "@smithy/util-base64": "^4.1.0",
20230
- "@smithy/util-body-length-browser": "^4.1.0",
20231
- "@smithy/util-body-length-node": "^4.1.0",
20232
- "@smithy/util-defaults-mode-browser": "^4.1.5",
20233
- "@smithy/util-defaults-mode-node": "^4.1.5",
20234
- "@smithy/util-endpoints": "^3.1.2",
20235
- "@smithy/util-middleware": "^4.1.1",
20236
- "@smithy/util-retry": "^4.1.2",
20237
- "@smithy/util-stream": "^4.3.2",
20238
- "@smithy/util-utf8": "^4.1.0",
20239
- "@smithy/uuid": "^1.0.0",
20195
+ "@aws-sdk/core": "3.901.0",
20196
+ "@aws-sdk/credential-provider-node": "3.901.0",
20197
+ "@aws-sdk/eventstream-handler-node": "3.901.0",
20198
+ "@aws-sdk/middleware-eventstream": "3.901.0",
20199
+ "@aws-sdk/middleware-host-header": "3.901.0",
20200
+ "@aws-sdk/middleware-logger": "3.901.0",
20201
+ "@aws-sdk/middleware-recursion-detection": "3.901.0",
20202
+ "@aws-sdk/middleware-user-agent": "3.901.0",
20203
+ "@aws-sdk/middleware-websocket": "3.901.0",
20204
+ "@aws-sdk/region-config-resolver": "3.901.0",
20205
+ "@aws-sdk/token-providers": "3.901.0",
20206
+ "@aws-sdk/types": "3.901.0",
20207
+ "@aws-sdk/util-endpoints": "3.901.0",
20208
+ "@aws-sdk/util-user-agent-browser": "3.901.0",
20209
+ "@aws-sdk/util-user-agent-node": "3.901.0",
20210
+ "@smithy/config-resolver": "^4.3.0",
20211
+ "@smithy/core": "^3.14.0",
20212
+ "@smithy/eventstream-serde-browser": "^4.2.0",
20213
+ "@smithy/eventstream-serde-config-resolver": "^4.3.0",
20214
+ "@smithy/eventstream-serde-node": "^4.2.0",
20215
+ "@smithy/fetch-http-handler": "^5.3.0",
20216
+ "@smithy/hash-node": "^4.2.0",
20217
+ "@smithy/invalid-dependency": "^4.2.0",
20218
+ "@smithy/middleware-content-length": "^4.2.0",
20219
+ "@smithy/middleware-endpoint": "^4.3.0",
20220
+ "@smithy/middleware-retry": "^4.4.0",
20221
+ "@smithy/middleware-serde": "^4.2.0",
20222
+ "@smithy/middleware-stack": "^4.2.0",
20223
+ "@smithy/node-config-provider": "^4.3.0",
20224
+ "@smithy/node-http-handler": "^4.3.0",
20225
+ "@smithy/protocol-http": "^5.3.0",
20226
+ "@smithy/smithy-client": "^4.7.0",
20227
+ "@smithy/types": "^4.6.0",
20228
+ "@smithy/url-parser": "^4.2.0",
20229
+ "@smithy/util-base64": "^4.2.0",
20230
+ "@smithy/util-body-length-browser": "^4.2.0",
20231
+ "@smithy/util-body-length-node": "^4.2.0",
20232
+ "@smithy/util-defaults-mode-browser": "^4.2.0",
20233
+ "@smithy/util-defaults-mode-node": "^4.2.0",
20234
+ "@smithy/util-endpoints": "^3.2.0",
20235
+ "@smithy/util-middleware": "^4.2.0",
20236
+ "@smithy/util-retry": "^4.2.0",
20237
+ "@smithy/util-stream": "^4.4.0",
20238
+ "@smithy/util-utf8": "^4.2.0",
20239
+ "@smithy/uuid": "^1.1.0",
20240
20240
  tslib: "^2.6.2"
20241
20241
  },
20242
20242
  devDependencies: {
@@ -20973,7 +20973,7 @@ var require_package2 = __commonJS({
20973
20973
  module2.exports = {
20974
20974
  name: "@aws-sdk/client-sso",
20975
20975
  description: "AWS SDK for JavaScript Sso Client for Node.js, Browser and React Native",
20976
- version: "3.899.0",
20976
+ version: "3.901.0",
20977
20977
  scripts: {
20978
20978
  build: "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'",
20979
20979
  "build:cjs": "node ../../scripts/compilation/inline client-sso",
@@ -20992,41 +20992,41 @@ var require_package2 = __commonJS({
20992
20992
  dependencies: {
20993
20993
  "@aws-crypto/sha256-browser": "5.2.0",
20994
20994
  "@aws-crypto/sha256-js": "5.2.0",
20995
- "@aws-sdk/core": "3.899.0",
20996
- "@aws-sdk/middleware-host-header": "3.893.0",
20997
- "@aws-sdk/middleware-logger": "3.893.0",
20998
- "@aws-sdk/middleware-recursion-detection": "3.893.0",
20999
- "@aws-sdk/middleware-user-agent": "3.899.0",
21000
- "@aws-sdk/region-config-resolver": "3.893.0",
21001
- "@aws-sdk/types": "3.893.0",
21002
- "@aws-sdk/util-endpoints": "3.895.0",
21003
- "@aws-sdk/util-user-agent-browser": "3.893.0",
21004
- "@aws-sdk/util-user-agent-node": "3.899.0",
21005
- "@smithy/config-resolver": "^4.2.2",
21006
- "@smithy/core": "^3.13.0",
21007
- "@smithy/fetch-http-handler": "^5.2.1",
21008
- "@smithy/hash-node": "^4.1.1",
21009
- "@smithy/invalid-dependency": "^4.1.1",
21010
- "@smithy/middleware-content-length": "^4.1.1",
21011
- "@smithy/middleware-endpoint": "^4.2.5",
21012
- "@smithy/middleware-retry": "^4.3.1",
21013
- "@smithy/middleware-serde": "^4.1.1",
21014
- "@smithy/middleware-stack": "^4.1.1",
21015
- "@smithy/node-config-provider": "^4.2.2",
21016
- "@smithy/node-http-handler": "^4.2.1",
21017
- "@smithy/protocol-http": "^5.2.1",
21018
- "@smithy/smithy-client": "^4.6.5",
21019
- "@smithy/types": "^4.5.0",
21020
- "@smithy/url-parser": "^4.1.1",
21021
- "@smithy/util-base64": "^4.1.0",
21022
- "@smithy/util-body-length-browser": "^4.1.0",
21023
- "@smithy/util-body-length-node": "^4.1.0",
21024
- "@smithy/util-defaults-mode-browser": "^4.1.5",
21025
- "@smithy/util-defaults-mode-node": "^4.1.5",
21026
- "@smithy/util-endpoints": "^3.1.2",
21027
- "@smithy/util-middleware": "^4.1.1",
21028
- "@smithy/util-retry": "^4.1.2",
21029
- "@smithy/util-utf8": "^4.1.0",
20995
+ "@aws-sdk/core": "3.901.0",
20996
+ "@aws-sdk/middleware-host-header": "3.901.0",
20997
+ "@aws-sdk/middleware-logger": "3.901.0",
20998
+ "@aws-sdk/middleware-recursion-detection": "3.901.0",
20999
+ "@aws-sdk/middleware-user-agent": "3.901.0",
21000
+ "@aws-sdk/region-config-resolver": "3.901.0",
21001
+ "@aws-sdk/types": "3.901.0",
21002
+ "@aws-sdk/util-endpoints": "3.901.0",
21003
+ "@aws-sdk/util-user-agent-browser": "3.901.0",
21004
+ "@aws-sdk/util-user-agent-node": "3.901.0",
21005
+ "@smithy/config-resolver": "^4.3.0",
21006
+ "@smithy/core": "^3.14.0",
21007
+ "@smithy/fetch-http-handler": "^5.3.0",
21008
+ "@smithy/hash-node": "^4.2.0",
21009
+ "@smithy/invalid-dependency": "^4.2.0",
21010
+ "@smithy/middleware-content-length": "^4.2.0",
21011
+ "@smithy/middleware-endpoint": "^4.3.0",
21012
+ "@smithy/middleware-retry": "^4.4.0",
21013
+ "@smithy/middleware-serde": "^4.2.0",
21014
+ "@smithy/middleware-stack": "^4.2.0",
21015
+ "@smithy/node-config-provider": "^4.3.0",
21016
+ "@smithy/node-http-handler": "^4.3.0",
21017
+ "@smithy/protocol-http": "^5.3.0",
21018
+ "@smithy/smithy-client": "^4.7.0",
21019
+ "@smithy/types": "^4.6.0",
21020
+ "@smithy/url-parser": "^4.2.0",
21021
+ "@smithy/util-base64": "^4.2.0",
21022
+ "@smithy/util-body-length-browser": "^4.2.0",
21023
+ "@smithy/util-body-length-node": "^4.2.0",
21024
+ "@smithy/util-defaults-mode-browser": "^4.2.0",
21025
+ "@smithy/util-defaults-mode-node": "^4.2.0",
21026
+ "@smithy/util-endpoints": "^3.2.0",
21027
+ "@smithy/util-middleware": "^4.2.0",
21028
+ "@smithy/util-retry": "^4.2.0",
21029
+ "@smithy/util-utf8": "^4.2.0",
21030
21030
  tslib: "^2.6.2"
21031
21031
  },
21032
21032
  devDependencies: {
@@ -22175,7 +22175,7 @@ var init_package = __esm({
22175
22175
  "node_modules/@aws-sdk/nested-clients/package.json"() {
22176
22176
  package_default = {
22177
22177
  name: "@aws-sdk/nested-clients",
22178
- version: "3.899.0",
22178
+ version: "3.901.0",
22179
22179
  description: "Nested clients for AWS SDK packages.",
22180
22180
  main: "./dist-cjs/index.js",
22181
22181
  module: "./dist-es/index.js",
@@ -22204,41 +22204,41 @@ var init_package = __esm({
22204
22204
  dependencies: {
22205
22205
  "@aws-crypto/sha256-browser": "5.2.0",
22206
22206
  "@aws-crypto/sha256-js": "5.2.0",
22207
- "@aws-sdk/core": "3.899.0",
22208
- "@aws-sdk/middleware-host-header": "3.893.0",
22209
- "@aws-sdk/middleware-logger": "3.893.0",
22210
- "@aws-sdk/middleware-recursion-detection": "3.893.0",
22211
- "@aws-sdk/middleware-user-agent": "3.899.0",
22212
- "@aws-sdk/region-config-resolver": "3.893.0",
22213
- "@aws-sdk/types": "3.893.0",
22214
- "@aws-sdk/util-endpoints": "3.895.0",
22215
- "@aws-sdk/util-user-agent-browser": "3.893.0",
22216
- "@aws-sdk/util-user-agent-node": "3.899.0",
22217
- "@smithy/config-resolver": "^4.2.2",
22218
- "@smithy/core": "^3.13.0",
22219
- "@smithy/fetch-http-handler": "^5.2.1",
22220
- "@smithy/hash-node": "^4.1.1",
22221
- "@smithy/invalid-dependency": "^4.1.1",
22222
- "@smithy/middleware-content-length": "^4.1.1",
22223
- "@smithy/middleware-endpoint": "^4.2.5",
22224
- "@smithy/middleware-retry": "^4.3.1",
22225
- "@smithy/middleware-serde": "^4.1.1",
22226
- "@smithy/middleware-stack": "^4.1.1",
22227
- "@smithy/node-config-provider": "^4.2.2",
22228
- "@smithy/node-http-handler": "^4.2.1",
22229
- "@smithy/protocol-http": "^5.2.1",
22230
- "@smithy/smithy-client": "^4.6.5",
22231
- "@smithy/types": "^4.5.0",
22232
- "@smithy/url-parser": "^4.1.1",
22233
- "@smithy/util-base64": "^4.1.0",
22234
- "@smithy/util-body-length-browser": "^4.1.0",
22235
- "@smithy/util-body-length-node": "^4.1.0",
22236
- "@smithy/util-defaults-mode-browser": "^4.1.5",
22237
- "@smithy/util-defaults-mode-node": "^4.1.5",
22238
- "@smithy/util-endpoints": "^3.1.2",
22239
- "@smithy/util-middleware": "^4.1.1",
22240
- "@smithy/util-retry": "^4.1.2",
22241
- "@smithy/util-utf8": "^4.1.0",
22207
+ "@aws-sdk/core": "3.901.0",
22208
+ "@aws-sdk/middleware-host-header": "3.901.0",
22209
+ "@aws-sdk/middleware-logger": "3.901.0",
22210
+ "@aws-sdk/middleware-recursion-detection": "3.901.0",
22211
+ "@aws-sdk/middleware-user-agent": "3.901.0",
22212
+ "@aws-sdk/region-config-resolver": "3.901.0",
22213
+ "@aws-sdk/types": "3.901.0",
22214
+ "@aws-sdk/util-endpoints": "3.901.0",
22215
+ "@aws-sdk/util-user-agent-browser": "3.901.0",
22216
+ "@aws-sdk/util-user-agent-node": "3.901.0",
22217
+ "@smithy/config-resolver": "^4.3.0",
22218
+ "@smithy/core": "^3.14.0",
22219
+ "@smithy/fetch-http-handler": "^5.3.0",
22220
+ "@smithy/hash-node": "^4.2.0",
22221
+ "@smithy/invalid-dependency": "^4.2.0",
22222
+ "@smithy/middleware-content-length": "^4.2.0",
22223
+ "@smithy/middleware-endpoint": "^4.3.0",
22224
+ "@smithy/middleware-retry": "^4.4.0",
22225
+ "@smithy/middleware-serde": "^4.2.0",
22226
+ "@smithy/middleware-stack": "^4.2.0",
22227
+ "@smithy/node-config-provider": "^4.3.0",
22228
+ "@smithy/node-http-handler": "^4.3.0",
22229
+ "@smithy/protocol-http": "^5.3.0",
22230
+ "@smithy/smithy-client": "^4.7.0",
22231
+ "@smithy/types": "^4.6.0",
22232
+ "@smithy/url-parser": "^4.2.0",
22233
+ "@smithy/util-base64": "^4.2.0",
22234
+ "@smithy/util-body-length-browser": "^4.2.0",
22235
+ "@smithy/util-body-length-node": "^4.2.0",
22236
+ "@smithy/util-defaults-mode-browser": "^4.2.0",
22237
+ "@smithy/util-defaults-mode-node": "^4.2.0",
22238
+ "@smithy/util-endpoints": "^3.2.0",
22239
+ "@smithy/util-middleware": "^4.2.0",
22240
+ "@smithy/util-retry": "^4.2.0",
22241
+ "@smithy/util-utf8": "^4.2.0",
22242
22242
  tslib: "^2.6.2"
22243
22243
  },
22244
22244
  devDependencies: {
@@ -54353,7 +54353,9 @@ When presented with a broken Mermaid diagram, analyze it thoroughly and provide
54353
54353
  model: this.options.model,
54354
54354
  debug: this.options.debug,
54355
54355
  tracer: this.options.tracer,
54356
- allowEdit: this.options.allowEdit
54356
+ allowEdit: this.options.allowEdit,
54357
+ maxIterations: 2
54358
+ // Limit mermaid fixing to 2 iterations to prevent long loops
54357
54359
  });
54358
54360
  }
54359
54361
  return this.agent;
@@ -54412,9 +54414,7 @@ ${contentToFix}
54412
54414
 
54413
54415
  Provide only the corrected Mermaid diagram within a mermaid code block. Do not add any explanations or additional text.`;
54414
54416
  try {
54415
- const result = await this.agent.answer(prompt, [], {
54416
- schema: "Return only valid Mermaid diagram code within ```mermaid code block"
54417
- });
54417
+ const result = await this.agent.answer(prompt, []);
54418
54418
  const extractedDiagram = this.extractCorrectedDiagram(result);
54419
54419
  return extractedDiagram || result;
54420
54420
  } catch (error2) {
@@ -55170,6 +55170,7 @@ var init_ProbeAgent = __esm({
55170
55170
  * @param {boolean} [options.debug] - Enable debug mode
55171
55171
  * @param {boolean} [options.outline] - Enable outline-xml format for search results
55172
55172
  * @param {number} [options.maxResponseTokens] - Maximum tokens for AI responses
55173
+ * @param {number} [options.maxIterations] - Maximum tool iterations (overrides MAX_TOOL_ITERATIONS env var)
55173
55174
  * @param {boolean} [options.disableMermaidValidation=false] - Disable automatic mermaid diagram validation and fixing
55174
55175
  * @param {boolean} [options.enableMcp=false] - Enable MCP tool integration
55175
55176
  * @param {string} [options.mcpConfigPath] - Path to MCP configuration file
@@ -55186,6 +55187,7 @@ var init_ProbeAgent = __esm({
55186
55187
  this.tracer = options.tracer || null;
55187
55188
  this.outline = !!options.outline;
55188
55189
  this.maxResponseTokens = options.maxResponseTokens || parseInt(process.env.MAX_RESPONSE_TOKENS || "0", 10) || null;
55190
+ this.maxIterations = options.maxIterations || null;
55189
55191
  this.disableMermaidValidation = !!options.disableMermaidValidation;
55190
55192
  this.enableBash = !!options.enableBash;
55191
55193
  this.bashConfig = options.bashConfig || {};
@@ -55880,11 +55882,12 @@ You are working with a repository located at: ${searchDirectory}
55880
55882
  let currentIteration = 0;
55881
55883
  let completionAttempted = false;
55882
55884
  let finalResult = "I was unable to complete your request due to reaching the maximum number of tool iterations.";
55883
- const maxIterations = options.schema ? MAX_TOOL_ITERATIONS + 4 : MAX_TOOL_ITERATIONS;
55885
+ const baseMaxIterations = this.maxIterations || MAX_TOOL_ITERATIONS;
55886
+ const maxIterations = options.schema ? baseMaxIterations + 4 : baseMaxIterations;
55884
55887
  if (this.debug) {
55885
55888
  console.log(`[DEBUG] Starting agentic flow for question: ${message.substring(0, 100)}...`);
55886
55889
  if (options.schema) {
55887
- console.log(`[DEBUG] Schema provided, using extended iteration limit: ${maxIterations} (base: ${MAX_TOOL_ITERATIONS})`);
55890
+ console.log(`[DEBUG] Schema provided, using extended iteration limit: ${maxIterations} (base: ${baseMaxIterations})`);
55888
55891
  }
55889
55892
  }
55890
55893
  while (currentIteration < maxIterations && !completionAttempted) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@probelabs/probe",
3
- "version": "0.6.0-rc112",
3
+ "version": "0.6.0-rc113",
4
4
  "description": "Node.js wrapper for the probe code search tool",
5
5
  "main": "src/index.js",
6
6
  "module": "src/index.js",
@@ -73,6 +73,7 @@ export class ProbeAgent {
73
73
  * @param {boolean} [options.debug] - Enable debug mode
74
74
  * @param {boolean} [options.outline] - Enable outline-xml format for search results
75
75
  * @param {number} [options.maxResponseTokens] - Maximum tokens for AI responses
76
+ * @param {number} [options.maxIterations] - Maximum tool iterations (overrides MAX_TOOL_ITERATIONS env var)
76
77
  * @param {boolean} [options.disableMermaidValidation=false] - Disable automatic mermaid diagram validation and fixing
77
78
  * @param {boolean} [options.enableMcp=false] - Enable MCP tool integration
78
79
  * @param {string} [options.mcpConfigPath] - Path to MCP configuration file
@@ -90,6 +91,7 @@ export class ProbeAgent {
90
91
  this.tracer = options.tracer || null;
91
92
  this.outline = !!options.outline;
92
93
  this.maxResponseTokens = options.maxResponseTokens || parseInt(process.env.MAX_RESPONSE_TOKENS || '0', 10) || null;
94
+ this.maxIterations = options.maxIterations || null;
93
95
  this.disableMermaidValidation = !!options.disableMermaidValidation;
94
96
 
95
97
  // Bash configuration
@@ -929,12 +931,13 @@ When troubleshooting:
929
931
  // +1 for schema formatting
930
932
  // +2 for potential Mermaid validation retries (can be multiple diagrams)
931
933
  // +1 for potential JSON correction
932
- const maxIterations = options.schema ? MAX_TOOL_ITERATIONS + 4 : MAX_TOOL_ITERATIONS;
934
+ const baseMaxIterations = this.maxIterations || MAX_TOOL_ITERATIONS;
935
+ const maxIterations = options.schema ? baseMaxIterations + 4 : baseMaxIterations;
933
936
 
934
937
  if (this.debug) {
935
938
  console.log(`[DEBUG] Starting agentic flow for question: ${message.substring(0, 100)}...`);
936
939
  if (options.schema) {
937
- console.log(`[DEBUG] Schema provided, using extended iteration limit: ${maxIterations} (base: ${MAX_TOOL_ITERATIONS})`);
940
+ console.log(`[DEBUG] Schema provided, using extended iteration limit: ${maxIterations} (base: ${baseMaxIterations})`);
938
941
  }
939
942
  }
940
943
 
@@ -811,7 +811,8 @@ When presented with a broken Mermaid diagram, analyze it thoroughly and provide
811
811
  model: this.options.model,
812
812
  debug: this.options.debug,
813
813
  tracer: this.options.tracer,
814
- allowEdit: this.options.allowEdit
814
+ allowEdit: this.options.allowEdit,
815
+ maxIterations: 2 // Limit mermaid fixing to 2 iterations to prevent long loops
815
816
  });
816
817
  }
817
818
 
@@ -884,10 +885,11 @@ ${contentToFix}
884
885
  Provide only the corrected Mermaid diagram within a mermaid code block. Do not add any explanations or additional text.`;
885
886
 
886
887
  try {
887
- const result = await this.agent.answer(prompt, [], {
888
- schema: 'Return only valid Mermaid diagram code within ```mermaid code block'
889
- });
890
-
888
+ // Don't pass schema to avoid infinite loop where AI returns raw mermaid code
889
+ // instead of using attempt_completion tool. The custom prompt already instructs
890
+ // to return only mermaid code blocks.
891
+ const result = await this.agent.answer(prompt, []);
892
+
891
893
  // Extract the mermaid code from the response
892
894
  const extractedDiagram = this.extractCorrectedDiagram(result);
893
895
  return extractedDiagram || result;