chore(confidence-engine): expose reconstruction fallback path

This commit is contained in:
2026-09-05 19:13:39 +01:00
parent c7a0a79d0f
commit cd1c6f4fc5
9 changed files with 119 additions and 5 deletions
+8 -1
View File
@@ -73,6 +73,7 @@ export async function analyseScenario(scenario, opts = {}) {
const provider = getProvider();
let rawResponse;
let providerApiPath;
let providerExecution;
try {
const providerResult = await provider.generateReconstruction(
promptObj.prompt,
@@ -86,6 +87,7 @@ export async function analyseScenario(scenario, opts = {}) {
) {
rawResponse = providerResult.response;
providerApiPath = providerResult.providerApiPath;
providerExecution = providerResult.providerExecution;
} else {
rawResponse = providerResult;
}
@@ -95,6 +97,7 @@ export async function analyseScenario(scenario, opts = {}) {
Date.now() - startTime,
"500",
e.providerApiPath,
e.providerExecution,
);
}
@@ -150,6 +153,7 @@ export async function analyseScenario(scenario, opts = {}) {
promptVersion,
compatibility,
providerApiPath,
providerExecution,
);
}
@@ -169,7 +173,7 @@ function tryValidateAgainstSchema(data, schema) {
// ── Result builders ──────────────────────────────────
function buildErrorResponse(message, elapsed, statusCode = 500, providerApiPath) {
function buildErrorResponse(message, elapsed, statusCode = 500, providerApiPath, providerExecution) {
return {
success: false,
error: message,
@@ -180,6 +184,7 @@ function buildErrorResponse(message, elapsed, statusCode = 500, providerApiPath)
promptVersion: null,
statusCode,
providerApiPath,
providerExecution,
};
}
@@ -233,6 +238,7 @@ function buildPartialResult(
version,
compatibility,
providerApiPath,
providerExecution,
) {
let errors = [];
const validationIssues = error?.issues ?? [];
@@ -260,6 +266,7 @@ function buildPartialResult(
errors,
validationIssues,
providerApiPath,
providerExecution,
...buildCompatibilityDiagnostics(compatibility),
};
}