MCPcopy Index your code
hub / github.com/google/agents-cli / initEvalLoop

Function initEvalLoop

docs/src/javascripts/lifecycle.js:656–833  ·  view source on GitHub ↗
(host)

Source from the content-addressed store, hash-verified

654 ];
655
656 function initEvalLoop(host) {
657 if (!host) return;
658 host.innerHTML = "";
659 host.classList.add("lc-eval");
660
661 let cases = JSON.parse(JSON.stringify(EVAL_CASES_INITIAL));
662 let revealed = 1; // chart points visible
663
664 // Header
665 host.appendChild(htmlEl("div", { class: "lc-eval__head" }, [
666 htmlEl("span", { class: "lc-mono" }, "$ agents-cli eval generate && agents-cli eval grade"),
667 htmlEl("span", { class: "lc-muted" }, "3 cases"),
668 ]));
669
670 // Cases
671 const list = htmlEl("div", { class: "lc-eval__list" });
672 host.appendChild(list);
673
674 function renderCases() {
675 list.innerHTML = "";
676 cases.forEach((c) => {
677 const card = htmlEl("div", { class: "lc-eval__card" });
678 const dot = htmlEl("span", { class: "lc-eval__dot lc-eval__dot--" + (c.passing ? "pass" : "fail") });
679 const main = htmlEl("div", { class: "lc-eval__main" });
680 main.appendChild(htmlEl("div", { class: "lc-eval__meta" }, [
681 htmlEl("span", { class: "lc-mono lc-muted" }, "eval_case_id=" + c.id),
682 htmlEl("span", { class: "lc-eval__pill lc-eval__pill--" + (c.passing ? "pass" : "fail") }, c.passing ? "PASS" : "FAIL"),
683 ]));
684 main.appendChild(htmlEl("p", { class: "lc-eval__prompt" }, '"' + c.prompt + '"'));
685 if (!c.passing && c.reason) {
686 main.appendChild(htmlEl("div", { class: "lc-eval__judge" }, [
687 htmlEl("span", { class: "lc-eval__judgeLabel" }, "rationale ›"),
688 c.reason,
689 ]));
690 }
691 if (c.passing && c.id === "no_runbook_match_should_escalate" && fixed) {
692 main.appendChild(htmlEl("div", { class: "lc-eval__judge lc-eval__judge--ok" }, [
693 htmlEl("span", { class: "lc-eval__judgeLabel lc-eval__judgeLabel--ok" }, "rationale ›"),
694 "Response correctly escalated. Runbook citation present. Safety rubric satisfied.",
695 ]));
696 }
697 card.appendChild(dot);
698 card.appendChild(main);
699 list.appendChild(card);
700 });
701 }
702
703 let fixed = false;
704 renderCases();
705
706 // Footer with action button
707 const foot = htmlEl("div", { class: "lc-eval__foot" });
708 const actionBtn = htmlEl("button", { type: "button", class: "lc-btn" }, "Apply fix → re-run");
709 const note = htmlEl("span", { class: "lc-mono lc-muted" }, "Iteration #1 — 1 case failing, 2 passing");
710 foot.appendChild(actionBtn);
711 foot.appendChild(note);
712 host.appendChild(foot);
713

Callers 1

initFunction · 0.85

Calls 8

htmlElFunction · 0.85
renderCasesFunction · 0.85
xScaleFunction · 0.85
yScaleFunction · 0.85
svgElFunction · 0.85
setRevealedFunction · 0.85
resetFunction · 0.85
applyFixFunction · 0.85

Tested by

no test coverage detected