Spaces:
Running
Running
sync: 190 file da Baida98/AI@059fa18d (2026-08-26 12:05 UTC) [deploy-all]
#116
by Baida07 - opened
- benchmark-extended.mjs +28 -0
benchmark-extended.mjs
CHANGED
|
@@ -334,6 +334,13 @@ FSH.research_synthesis =
|
|
| 334 |
"3. Ragionamento: [come hai derivato la risposta]\n" +
|
| 335 |
"4. Confidence: [alta/media/bassa + perché]";
|
| 336 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 337 |
FSH.feature =
|
| 338 |
"FEATURE TYPESCRIPT — implementazione completa:\n" +
|
| 339 |
"1. **Interfaccia** (tipi + contratto pubblico)\n" +
|
|
@@ -437,6 +444,25 @@ async function repairCodeCorrectIfNeeded(task, agent, timeoutMs) {
|
|
| 437 |
if(!repaired.failed&&checked?.buildPassed&&checked?.testsPassed)return{agent:repaired,retried:true,reason};
|
| 438 |
return{agent:{...agent,repairFailureReason,repairFallbackEmpty:!repairedOutput.trim()},retried:true,reason:`${reason}:${repairFailureReason}`};
|
| 439 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 440 |
async function repairFeatureIfNeeded(task, agent, timeoutMs) {
|
| 441 |
if (task.category !== "feature" || agent.failed) return {agent, retried:false, reason:null};
|
| 442 |
let first; try { first=await task.verify(agent.output||""); } catch { return {agent,retried:false,reason:null}; }
|
|
@@ -2460,6 +2486,8 @@ async function runOneSeed(seed,opts={}){
|
|
| 2460 |
let agent=await callAgentWithRetry(task,transportTimeout);
|
| 2461 |
const repair=await repairSecurityIfNeeded(task,agent,Math.min(transportTimeout,120000));
|
| 2462 |
agent=repair.agent;
|
|
|
|
|
|
|
| 2463 |
const featureRepair=await repairFeatureIfNeeded(task,agent,transportTimeout);
|
| 2464 |
agent=featureRepair.agent;
|
| 2465 |
const codeRepair=await repairCodeCorrectIfNeeded(task,agent,transportTimeout);
|
|
|
|
| 334 |
"3. Ragionamento: [come hai derivato la risposta]\n" +
|
| 335 |
"4. Confidence: [alta/media/bassa + perché]";
|
| 336 |
|
| 337 |
+
FSH.data_analysis =
|
| 338 |
+
"ANALISI NUMERICA VERIFICABILE:\n" +
|
| 339 |
+
"1. Usa esclusivamente i record JSON forniti nel task; non chiedere altro contesto.\n" +
|
| 340 |
+
"2. Calcola internamente somma, conteggio e media; individua massimo e outlier.\n" +
|
| 341 |
+
"3. Restituisci soltanto quattro bullet nominati Media, Picco, Anomalia e Trend.\n" +
|
| 342 |
+
"4. Per Media, Picco e Anomalia inserisci sempre sia il mese sia il valore numerico richiesto.";
|
| 343 |
+
|
| 344 |
FSH.feature =
|
| 345 |
"FEATURE TYPESCRIPT — implementazione completa:\n" +
|
| 346 |
"1. **Interfaccia** (tipi + contratto pubblico)\n" +
|
|
|
|
| 444 |
if(!repaired.failed&&checked?.buildPassed&&checked?.testsPassed)return{agent:repaired,retried:true,reason};
|
| 445 |
return{agent:{...agent,repairFailureReason,repairFallbackEmpty:!repairedOutput.trim()},retried:true,reason:`${reason}:${repairFailureReason}`};
|
| 446 |
}
|
| 447 |
+
async function repairDataAnalysisIfNeeded(task, agent, timeoutMs) {
|
| 448 |
+
if (task.category !== "data_analysis" || agent.failed) return {agent,retried:false,reason:null};
|
| 449 |
+
let first;
|
| 450 |
+
try { first = await task.verify(agent.output || ""); } catch { return {agent,retried:false,reason:null}; }
|
| 451 |
+
if (first.buildPassed && first.testsPassed) return {agent,retried:false,reason:null};
|
| 452 |
+
const detail = String(first.detail || "validator non superato");
|
| 453 |
+
const repairGoal = `${task.prompt}\n\n---\nDATA_ANALYSIS REPAIR OBBLIGATORIO\nLa risposta precedente non ha superato il controllo deterministico: ${detail}.\nNon chiedere ulteriori dati e ignora ogni contesto non presente nel JSON qui sopra. Calcola di nuovo dai record forniti: (1) somma tutti i valori e dividi per il numero di mesi; (2) individua il valore massimo e il suo mese; (3) individua il valore fuori scala e il suo mese.\nRestituisci esclusivamente queste quattro righe, senza introduzione, spiegazioni o Markdown aggiuntivo:\n- **Media: N**\n- **Picco: MESE (N)**\n- **Anomalia: MESE (N)**\n- **Trend: testo breve**\nUsa i nomi mese presenti nel JSON e valori numerici effettivamente calcolati. Non copiare esempi o placeholder.`;
|
| 454 |
+
if (!F_JSON) process.stdout.write(` ⟳ repair data_analysis (${detail.slice(0,60)})... `);
|
| 455 |
+
const repaired = await callAgent(repairGoal, Math.min(timeoutMs, 120000), {maxSteps:4});
|
| 456 |
+
let checked = null;
|
| 457 |
+
if (!repaired.failed) {
|
| 458 |
+
try { checked = await task.verify(repaired.output || ""); } catch {}
|
| 459 |
+
}
|
| 460 |
+
if (!F_JSON) process.stdout.write(`${checked?.testsPassed ? "pass" : "fail"}\n`);
|
| 461 |
+
if (!repaired.failed && checked?.buildPassed && checked?.testsPassed) {
|
| 462 |
+
return {agent:repaired,retried:true,reason:detail};
|
| 463 |
+
}
|
| 464 |
+
return {agent:{...agent,dataAnalysisRepairFailure:String(repaired.failureReason || detail)},retried:true,reason:detail};
|
| 465 |
+
}
|
| 466 |
async function repairFeatureIfNeeded(task, agent, timeoutMs) {
|
| 467 |
if (task.category !== "feature" || agent.failed) return {agent, retried:false, reason:null};
|
| 468 |
let first; try { first=await task.verify(agent.output||""); } catch { return {agent,retried:false,reason:null}; }
|
|
|
|
| 2486 |
let agent=await callAgentWithRetry(task,transportTimeout);
|
| 2487 |
const repair=await repairSecurityIfNeeded(task,agent,Math.min(transportTimeout,120000));
|
| 2488 |
agent=repair.agent;
|
| 2489 |
+
const dataAnalysisRepair=await repairDataAnalysisIfNeeded(task,agent,transportTimeout);
|
| 2490 |
+
agent=dataAnalysisRepair.agent;
|
| 2491 |
const featureRepair=await repairFeatureIfNeeded(task,agent,transportTimeout);
|
| 2492 |
agent=featureRepair.agent;
|
| 2493 |
const codeRepair=await repairCodeCorrectIfNeeded(task,agent,transportTimeout);
|