@probelabs/probe 0.6.0-rc86 → 0.6.0-rc87
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/build/agent/ProbeAgent.js +36 -0
- package/build/agent/index.js +31 -0
- package/cjs/agent/ProbeAgent.cjs +31 -0
- package/cjs/index.cjs +31 -0
- package/package.json +1 -1
- package/src/agent/ProbeAgent.js +36 -0
|
@@ -1240,6 +1240,42 @@ Convert your previous response content into actual JSON data that follows this s
|
|
|
1240
1240
|
}
|
|
1241
1241
|
}
|
|
1242
1242
|
|
|
1243
|
+
// Final mermaid validation for all responses (regardless of schema or attempt_completion)
|
|
1244
|
+
if (!this.disableMermaidValidation) {
|
|
1245
|
+
try {
|
|
1246
|
+
if (this.debug) {
|
|
1247
|
+
console.log(`[DEBUG] Mermaid validation: Performing final mermaid validation on result...`);
|
|
1248
|
+
}
|
|
1249
|
+
|
|
1250
|
+
const finalMermaidValidation = await validateAndFixMermaidResponse(finalResult, {
|
|
1251
|
+
debug: this.debug,
|
|
1252
|
+
path: this.allowedFolders[0],
|
|
1253
|
+
provider: this.clientApiProvider,
|
|
1254
|
+
model: this.model,
|
|
1255
|
+
tracer: this.tracer
|
|
1256
|
+
});
|
|
1257
|
+
|
|
1258
|
+
if (finalMermaidValidation.wasFixed) {
|
|
1259
|
+
finalResult = finalMermaidValidation.fixedResponse;
|
|
1260
|
+
if (this.debug) {
|
|
1261
|
+
console.log(`[DEBUG] Mermaid validation: Final result diagrams fixed`);
|
|
1262
|
+
if (finalMermaidValidation.performanceMetrics) {
|
|
1263
|
+
console.log(`[DEBUG] Mermaid validation: Final validation took ${finalMermaidValidation.performanceMetrics.totalTimeMs}ms`);
|
|
1264
|
+
}
|
|
1265
|
+
}
|
|
1266
|
+
} else if (this.debug && finalMermaidValidation.diagrams?.length > 0) {
|
|
1267
|
+
console.log(`[DEBUG] Mermaid validation: Final result validation completed (${finalMermaidValidation.diagrams.length} diagrams found, no fixes needed)`);
|
|
1268
|
+
}
|
|
1269
|
+
} catch (error) {
|
|
1270
|
+
if (this.debug) {
|
|
1271
|
+
console.log(`[DEBUG] Mermaid validation: Final validation failed with error: ${error.message}`);
|
|
1272
|
+
}
|
|
1273
|
+
// Don't fail the entire request if final mermaid validation fails
|
|
1274
|
+
}
|
|
1275
|
+
} else if (this.debug) {
|
|
1276
|
+
console.log(`[DEBUG] Mermaid validation: Skipped final validation due to disableMermaidValidation option`);
|
|
1277
|
+
}
|
|
1278
|
+
|
|
1243
1279
|
return finalResult;
|
|
1244
1280
|
|
|
1245
1281
|
} catch (error) {
|
package/build/agent/index.js
CHANGED
|
@@ -5109,6 +5109,37 @@ Convert your previous response content into actual JSON data that follows this s
|
|
|
5109
5109
|
}
|
|
5110
5110
|
}
|
|
5111
5111
|
}
|
|
5112
|
+
if (!this.disableMermaidValidation) {
|
|
5113
|
+
try {
|
|
5114
|
+
if (this.debug) {
|
|
5115
|
+
console.log(`[DEBUG] Mermaid validation: Performing final mermaid validation on result...`);
|
|
5116
|
+
}
|
|
5117
|
+
const finalMermaidValidation = await validateAndFixMermaidResponse(finalResult, {
|
|
5118
|
+
debug: this.debug,
|
|
5119
|
+
path: this.allowedFolders[0],
|
|
5120
|
+
provider: this.clientApiProvider,
|
|
5121
|
+
model: this.model,
|
|
5122
|
+
tracer: this.tracer
|
|
5123
|
+
});
|
|
5124
|
+
if (finalMermaidValidation.wasFixed) {
|
|
5125
|
+
finalResult = finalMermaidValidation.fixedResponse;
|
|
5126
|
+
if (this.debug) {
|
|
5127
|
+
console.log(`[DEBUG] Mermaid validation: Final result diagrams fixed`);
|
|
5128
|
+
if (finalMermaidValidation.performanceMetrics) {
|
|
5129
|
+
console.log(`[DEBUG] Mermaid validation: Final validation took ${finalMermaidValidation.performanceMetrics.totalTimeMs}ms`);
|
|
5130
|
+
}
|
|
5131
|
+
}
|
|
5132
|
+
} else if (this.debug && finalMermaidValidation.diagrams?.length > 0) {
|
|
5133
|
+
console.log(`[DEBUG] Mermaid validation: Final result validation completed (${finalMermaidValidation.diagrams.length} diagrams found, no fixes needed)`);
|
|
5134
|
+
}
|
|
5135
|
+
} catch (error) {
|
|
5136
|
+
if (this.debug) {
|
|
5137
|
+
console.log(`[DEBUG] Mermaid validation: Final validation failed with error: ${error.message}`);
|
|
5138
|
+
}
|
|
5139
|
+
}
|
|
5140
|
+
} else if (this.debug) {
|
|
5141
|
+
console.log(`[DEBUG] Mermaid validation: Skipped final validation due to disableMermaidValidation option`);
|
|
5142
|
+
}
|
|
5112
5143
|
return finalResult;
|
|
5113
5144
|
} catch (error) {
|
|
5114
5145
|
console.error(`[ERROR] ProbeAgent.answer failed:`, error);
|
package/cjs/agent/ProbeAgent.cjs
CHANGED
|
@@ -4857,6 +4857,37 @@ Convert your previous response content into actual JSON data that follows this s
|
|
|
4857
4857
|
}
|
|
4858
4858
|
}
|
|
4859
4859
|
}
|
|
4860
|
+
if (!this.disableMermaidValidation) {
|
|
4861
|
+
try {
|
|
4862
|
+
if (this.debug) {
|
|
4863
|
+
console.log(`[DEBUG] Mermaid validation: Performing final mermaid validation on result...`);
|
|
4864
|
+
}
|
|
4865
|
+
const finalMermaidValidation = await validateAndFixMermaidResponse(finalResult, {
|
|
4866
|
+
debug: this.debug,
|
|
4867
|
+
path: this.allowedFolders[0],
|
|
4868
|
+
provider: this.clientApiProvider,
|
|
4869
|
+
model: this.model,
|
|
4870
|
+
tracer: this.tracer
|
|
4871
|
+
});
|
|
4872
|
+
if (finalMermaidValidation.wasFixed) {
|
|
4873
|
+
finalResult = finalMermaidValidation.fixedResponse;
|
|
4874
|
+
if (this.debug) {
|
|
4875
|
+
console.log(`[DEBUG] Mermaid validation: Final result diagrams fixed`);
|
|
4876
|
+
if (finalMermaidValidation.performanceMetrics) {
|
|
4877
|
+
console.log(`[DEBUG] Mermaid validation: Final validation took ${finalMermaidValidation.performanceMetrics.totalTimeMs}ms`);
|
|
4878
|
+
}
|
|
4879
|
+
}
|
|
4880
|
+
} else if (this.debug && finalMermaidValidation.diagrams?.length > 0) {
|
|
4881
|
+
console.log(`[DEBUG] Mermaid validation: Final result validation completed (${finalMermaidValidation.diagrams.length} diagrams found, no fixes needed)`);
|
|
4882
|
+
}
|
|
4883
|
+
} catch (error) {
|
|
4884
|
+
if (this.debug) {
|
|
4885
|
+
console.log(`[DEBUG] Mermaid validation: Final validation failed with error: ${error.message}`);
|
|
4886
|
+
}
|
|
4887
|
+
}
|
|
4888
|
+
} else if (this.debug) {
|
|
4889
|
+
console.log(`[DEBUG] Mermaid validation: Skipped final validation due to disableMermaidValidation option`);
|
|
4890
|
+
}
|
|
4860
4891
|
return finalResult;
|
|
4861
4892
|
} catch (error) {
|
|
4862
4893
|
console.error(`[ERROR] ProbeAgent.answer failed:`, error);
|
package/cjs/index.cjs
CHANGED
|
@@ -4943,6 +4943,37 @@ Convert your previous response content into actual JSON data that follows this s
|
|
|
4943
4943
|
}
|
|
4944
4944
|
}
|
|
4945
4945
|
}
|
|
4946
|
+
if (!this.disableMermaidValidation) {
|
|
4947
|
+
try {
|
|
4948
|
+
if (this.debug) {
|
|
4949
|
+
console.log(`[DEBUG] Mermaid validation: Performing final mermaid validation on result...`);
|
|
4950
|
+
}
|
|
4951
|
+
const finalMermaidValidation = await validateAndFixMermaidResponse(finalResult, {
|
|
4952
|
+
debug: this.debug,
|
|
4953
|
+
path: this.allowedFolders[0],
|
|
4954
|
+
provider: this.clientApiProvider,
|
|
4955
|
+
model: this.model,
|
|
4956
|
+
tracer: this.tracer
|
|
4957
|
+
});
|
|
4958
|
+
if (finalMermaidValidation.wasFixed) {
|
|
4959
|
+
finalResult = finalMermaidValidation.fixedResponse;
|
|
4960
|
+
if (this.debug) {
|
|
4961
|
+
console.log(`[DEBUG] Mermaid validation: Final result diagrams fixed`);
|
|
4962
|
+
if (finalMermaidValidation.performanceMetrics) {
|
|
4963
|
+
console.log(`[DEBUG] Mermaid validation: Final validation took ${finalMermaidValidation.performanceMetrics.totalTimeMs}ms`);
|
|
4964
|
+
}
|
|
4965
|
+
}
|
|
4966
|
+
} else if (this.debug && finalMermaidValidation.diagrams?.length > 0) {
|
|
4967
|
+
console.log(`[DEBUG] Mermaid validation: Final result validation completed (${finalMermaidValidation.diagrams.length} diagrams found, no fixes needed)`);
|
|
4968
|
+
}
|
|
4969
|
+
} catch (error) {
|
|
4970
|
+
if (this.debug) {
|
|
4971
|
+
console.log(`[DEBUG] Mermaid validation: Final validation failed with error: ${error.message}`);
|
|
4972
|
+
}
|
|
4973
|
+
}
|
|
4974
|
+
} else if (this.debug) {
|
|
4975
|
+
console.log(`[DEBUG] Mermaid validation: Skipped final validation due to disableMermaidValidation option`);
|
|
4976
|
+
}
|
|
4946
4977
|
return finalResult;
|
|
4947
4978
|
} catch (error) {
|
|
4948
4979
|
console.error(`[ERROR] ProbeAgent.answer failed:`, error);
|
package/package.json
CHANGED
package/src/agent/ProbeAgent.js
CHANGED
|
@@ -1240,6 +1240,42 @@ Convert your previous response content into actual JSON data that follows this s
|
|
|
1240
1240
|
}
|
|
1241
1241
|
}
|
|
1242
1242
|
|
|
1243
|
+
// Final mermaid validation for all responses (regardless of schema or attempt_completion)
|
|
1244
|
+
if (!this.disableMermaidValidation) {
|
|
1245
|
+
try {
|
|
1246
|
+
if (this.debug) {
|
|
1247
|
+
console.log(`[DEBUG] Mermaid validation: Performing final mermaid validation on result...`);
|
|
1248
|
+
}
|
|
1249
|
+
|
|
1250
|
+
const finalMermaidValidation = await validateAndFixMermaidResponse(finalResult, {
|
|
1251
|
+
debug: this.debug,
|
|
1252
|
+
path: this.allowedFolders[0],
|
|
1253
|
+
provider: this.clientApiProvider,
|
|
1254
|
+
model: this.model,
|
|
1255
|
+
tracer: this.tracer
|
|
1256
|
+
});
|
|
1257
|
+
|
|
1258
|
+
if (finalMermaidValidation.wasFixed) {
|
|
1259
|
+
finalResult = finalMermaidValidation.fixedResponse;
|
|
1260
|
+
if (this.debug) {
|
|
1261
|
+
console.log(`[DEBUG] Mermaid validation: Final result diagrams fixed`);
|
|
1262
|
+
if (finalMermaidValidation.performanceMetrics) {
|
|
1263
|
+
console.log(`[DEBUG] Mermaid validation: Final validation took ${finalMermaidValidation.performanceMetrics.totalTimeMs}ms`);
|
|
1264
|
+
}
|
|
1265
|
+
}
|
|
1266
|
+
} else if (this.debug && finalMermaidValidation.diagrams?.length > 0) {
|
|
1267
|
+
console.log(`[DEBUG] Mermaid validation: Final result validation completed (${finalMermaidValidation.diagrams.length} diagrams found, no fixes needed)`);
|
|
1268
|
+
}
|
|
1269
|
+
} catch (error) {
|
|
1270
|
+
if (this.debug) {
|
|
1271
|
+
console.log(`[DEBUG] Mermaid validation: Final validation failed with error: ${error.message}`);
|
|
1272
|
+
}
|
|
1273
|
+
// Don't fail the entire request if final mermaid validation fails
|
|
1274
|
+
}
|
|
1275
|
+
} else if (this.debug) {
|
|
1276
|
+
console.log(`[DEBUG] Mermaid validation: Skipped final validation due to disableMermaidValidation option`);
|
|
1277
|
+
}
|
|
1278
|
+
|
|
1243
1279
|
return finalResult;
|
|
1244
1280
|
|
|
1245
1281
|
} catch (error) {
|