@ancha-labs/cli 0.4.21 → 0.4.23
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/lib/ancha.mjs +7205 -5743
- package/lib/assets/docs/apps.md +36 -0
- package/lib/assets/docs/cloud.md +30 -0
- package/lib/assets/docs/compare.md +2 -0
- package/lib/assets/docs/explain.md +3 -0
- package/lib/assets/docs/run.md +14 -0
- package/lib/assets/docs/scenes.md +15 -0
- package/lib/assets/docs/tools.md +84 -1
- package/lib/assets/harbor/companion.mjs +3747 -3176
- package/lib/assets/ui/app.js +148 -60
- package/lib/mcp-entry.mjs +27 -4
- package/lib/worker.mjs +4287 -3473
- package/lib/world-server.mjs +3669 -3156
- package/package.json +1 -1
package/lib/assets/ui/app.js
CHANGED
|
@@ -162,7 +162,7 @@ function seedData(scene, selected) {
|
|
|
162
162
|
if (selected === "pagerduty") body2 = `<div class="seed-cards">${(s.services ?? []).map((v) => `<article class="record"><span class="small muted">Service</span><h3>${h(v.name)}</h3><p>${h(label2(v.escalation_policy))}</p>${(s.escalation_policies ?? []).filter((p) => label2(v.escalation_policy) === label2("$" + p.ref)).map((p) => `<ol>${(p.levels ?? []).map((l) => `<li>${h((l.targets ?? []).map(label2).join(", "))}${l.after ? ` \xB7 escalate after ${h(l.after)}` : ""}</li>`).join("")}</ol>`).join("")}${v.slack_channel ? `<p class="small muted">Slack \xB7 #${h(label2(v.slack_channel))}</p>` : ""}</article>`).join("")}${(s.incidents ?? []).map((i) => `<article class="record">${badge(i.status)}<h3>${h(i.title)}</h3><p>${h(label2(i.service))}</p></article>`).join("")}</div>`;
|
|
163
163
|
return `<h2>${h(toolName(selected))}</h2>${body2 || empty("No data seeded")}${details("Full starting data", s)}${selected === "datadog" ? details("Generated telemetry definitions", { metrics: scene.world_rules?.metrics, logs: scene.world_rules?.logs, monitors: scene.world_rules?.monitors }) : ""}`;
|
|
164
164
|
}
|
|
165
|
-
var countLabel = (
|
|
165
|
+
var countLabel = (count3, noun, plural = noun + "s") => `${count3} ${count3 === 1 ? noun : plural}`;
|
|
166
166
|
function agentLabel(agent, all) {
|
|
167
167
|
const twins = all.filter((other) => other.name === agent.name);
|
|
168
168
|
if (twins.length < 2) return String(agent.name);
|
|
@@ -535,7 +535,7 @@ function shortId(id, keep = 8) {
|
|
|
535
535
|
}
|
|
536
536
|
var facts = (items, label2 = "Facts") => `<dl class="c-facts" aria-label="${h(label2)}">${items.map((f) => `<div><dt>${h(f.label)}</dt><dd class="c-fact-value${f.mono ? " mono" : ""}"${f.title ? ` title="${h(f.title)}"` : ""}>${f.html ?? h(f.value)}</dd>${f.sub ? `<dd class="c-fact-sub">${h(f.sub)}</dd>` : ""}</div>`).join("")}</dl>`;
|
|
537
537
|
var stateCard = (title2, bodyHtml = "", actionHtml = "", kind = "empty") => `<section class="c-state c-state-${h(kind)}"><strong>${h(title2)}</strong>${bodyHtml ? `<p>${bodyHtml}</p>` : ""}${actionHtml}</section>`;
|
|
538
|
-
var skeletonRows = (
|
|
538
|
+
var skeletonRows = (count3) => `<div class="c-skeleton" aria-busy="true" aria-label="Loading">${Array.from({ length: count3 }, () => "<div><i></i><i></i><i></i></div>").join("")}</div>`;
|
|
539
539
|
var MINUTE = 6e4;
|
|
540
540
|
var HOUR2 = 36e5;
|
|
541
541
|
var DAY2 = 864e5;
|
|
@@ -581,7 +581,86 @@ function duration(ms) {
|
|
|
581
581
|
return `${Math.floor(s / 3600)} h ${String(Math.floor(s / 60) % 60).padStart(2, "0")} m`;
|
|
582
582
|
}
|
|
583
583
|
|
|
584
|
+
// cloud/shared/run-metadata.mjs
|
|
585
|
+
function runNumberOf(value) {
|
|
586
|
+
return Number.isSafeInteger(value) && value > 0 ? value : void 0;
|
|
587
|
+
}
|
|
588
|
+
function runLabel(run, fallback = run.id ?? run.runId ?? run.run_id ?? "") {
|
|
589
|
+
const number = runNumberOf(run.runNumber ?? run.summary?.runNumber);
|
|
590
|
+
return number === void 0 ? fallback : `#${number}`;
|
|
591
|
+
}
|
|
592
|
+
function github2(value) {
|
|
593
|
+
if (!value || typeof value !== "object" || Array.isArray(value) || Object.keys(value).sort().join(",") !== "repository,runId,serverUrl") throw new Error("Invalid GitHub Actions context.");
|
|
594
|
+
const { repository, runId, serverUrl } = value;
|
|
595
|
+
if (typeof repository !== "string" || !/^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+$/.test(repository) || repository.length > 201 || repository.split("/").some((p) => p === "." || p === "..") || typeof runId !== "string" || !/^[1-9]\d{0,19}$/.test(runId)) throw new Error("Invalid GitHub Actions context.");
|
|
596
|
+
let url2;
|
|
597
|
+
try {
|
|
598
|
+
url2 = new URL(serverUrl);
|
|
599
|
+
} catch {
|
|
600
|
+
throw new Error("Invalid GitHub Actions server.");
|
|
601
|
+
}
|
|
602
|
+
if (typeof serverUrl !== "string" || serverUrl.length > 2048 || url2.protocol !== "https:" || url2.username || url2.password || url2.search || url2.hash || url2.pathname !== "/") throw new Error("Invalid GitHub Actions server.");
|
|
603
|
+
return { repository, runId, serverUrl: url2.origin };
|
|
604
|
+
}
|
|
605
|
+
function validateRunMetadata(value) {
|
|
606
|
+
if (!value || typeof value !== "object" || Array.isArray(value) || Object.keys(value).some((k) => !["runNumber", "startedBy"].includes(k))) throw new Error("Invalid run metadata.");
|
|
607
|
+
if (value.runNumber !== void 0 && runNumberOf(value.runNumber) === void 0) throw new Error("Invalid run number.");
|
|
608
|
+
if (value.startedBy !== void 0) {
|
|
609
|
+
const by = value.startedBy;
|
|
610
|
+
if (!by || typeof by !== "object" || Array.isArray(by) || Object.keys(by).some((k) => !["source", "email", "repository", "url"].includes(k)) || !["console", "cli", "github-actions"].includes(by.source)) throw new Error("Invalid run starter.");
|
|
611
|
+
if (by.email !== void 0 && (typeof by.email !== "string" || by.email.length > 320 || /[\x00-\x1f\x7f]/.test(by.email))) throw new Error("Invalid run starter email.");
|
|
612
|
+
if (by.source === "github-actions") {
|
|
613
|
+
let u;
|
|
614
|
+
try {
|
|
615
|
+
u = new URL(by.url);
|
|
616
|
+
} catch {
|
|
617
|
+
throw new Error("Invalid workflow URL.");
|
|
618
|
+
}
|
|
619
|
+
const match = /^\/(.+)\/actions\/runs\/(\d+)$/.exec(u.pathname);
|
|
620
|
+
if (!match || match[1] !== by.repository || u.search || u.hash || u.username || u.password) throw new Error("Invalid workflow URL.");
|
|
621
|
+
github2({ repository: by.repository, runId: match[2], serverUrl: u.origin });
|
|
622
|
+
} else if (by.repository !== void 0 || by.url !== void 0) throw new Error("Invalid run starter context.");
|
|
623
|
+
}
|
|
624
|
+
return value;
|
|
625
|
+
}
|
|
626
|
+
function starterLabel(by) {
|
|
627
|
+
if (!by) return "";
|
|
628
|
+
return [by.email, by.source === "github-actions" ? "GitHub Actions" : by.source === "cli" ? "CLI" : "", by.repository].filter(Boolean).join(" \xB7 ");
|
|
629
|
+
}
|
|
630
|
+
|
|
631
|
+
// cloud/shared/outcome-counts.mjs
|
|
632
|
+
var count = (value) => Number.isSafeInteger(value) && value >= 0 ? value : void 0;
|
|
633
|
+
function attemptOutcome(attempt, graded) {
|
|
634
|
+
if (attempt.valid === false || attempt.exit === "invalid" || attempt.outcome === "invalid") return "invalid";
|
|
635
|
+
if (attempt.outcome === "skipped" || attempt.outcome === "xfailed") return "skipped";
|
|
636
|
+
if (graded === false || attempt.graded === false || attempt.outcome === "ungraded") return "ungraded";
|
|
637
|
+
if (attempt.outcome === "passed" || attempt.outcome === "failed") return attempt.outcome;
|
|
638
|
+
if (typeof attempt.passed === "boolean") return attempt.passed ? "passed" : "failed";
|
|
639
|
+
return ["completed", "error", "stopped"].includes(attempt.status) ? "ungraded" : "pending";
|
|
640
|
+
}
|
|
641
|
+
function countAttempts(attempts, requested, graded) {
|
|
642
|
+
const counts = { requested: Math.max(count(requested) ?? attempts.length, attempts.length), completed: 0, valid: 0, passed: 0, failed: 0, invalid: 0, ungraded: 0, skipped: 0, pending: 0 };
|
|
643
|
+
for (const attempt of attempts) {
|
|
644
|
+
const outcome = attemptOutcome(attempt, graded);
|
|
645
|
+
counts[outcome]++;
|
|
646
|
+
if (outcome !== "pending") counts.completed++;
|
|
647
|
+
if (["passed", "failed", "ungraded"].includes(outcome)) counts.valid++;
|
|
648
|
+
}
|
|
649
|
+
counts.pending += counts.requested - attempts.length;
|
|
650
|
+
return counts;
|
|
651
|
+
}
|
|
652
|
+
|
|
584
653
|
// frontend/src/runs-page.ts
|
|
654
|
+
function starterHtml(run) {
|
|
655
|
+
const by = run.startedBy ?? run.origin?.startedBy;
|
|
656
|
+
try {
|
|
657
|
+
validateRunMetadata({ startedBy: by });
|
|
658
|
+
} catch {
|
|
659
|
+
return "";
|
|
660
|
+
}
|
|
661
|
+
const label2 = h(starterLabel(by));
|
|
662
|
+
return by?.url ? `<a href="${h(by.url)}" target="_blank" rel="noopener noreferrer">${label2}</a>` : label2;
|
|
663
|
+
}
|
|
585
664
|
var SOURCES = { console: "Console", cli: "CLI", ci: "CI", cloud: "Cloud" };
|
|
586
665
|
var TARGETS = { local: "Local", docker: "Docker", hosted: "Hosted", cloud: "Cloud" };
|
|
587
666
|
var RANGES = { "24h": ["24 h", 864e5], "7d": ["7 d", 7 * 864e5], "30d": ["30 d", 30 * 864e5] };
|
|
@@ -602,12 +681,9 @@ function runCounts(run) {
|
|
|
602
681
|
const verified = summary?.verdictVersion === 2 ? summary.counts : void 0;
|
|
603
682
|
const declared = tasks.length && tasks.every((task) => Number.isSafeInteger(task.attempts) && task.attempts > 0) ? tasks.reduce((sum2, task) => sum2 + task.attempts, 0) : void 0;
|
|
604
683
|
const requested = verified?.requested ?? declared;
|
|
605
|
-
const
|
|
606
|
-
const
|
|
607
|
-
|
|
608
|
-
const failed = attempts.filter((a) => a.outcome === "failed").length;
|
|
609
|
-
const graded = typeof summary?.pass_rate === "number" || attempts.some((a) => ["passed", "failed"].includes(a.outcome));
|
|
610
|
-
return { requested, total: requested ?? attempts.length, passed, failed, invalid, skipped, graded, finished: batchCounts(run).finished };
|
|
684
|
+
const counts = countAttempts(attempts, requested, summary?.graded);
|
|
685
|
+
const graded = counts.passed + counts.failed > 0;
|
|
686
|
+
return { ...counts, requested, total: counts.requested, graded, finished: batchCounts(run).finished };
|
|
611
687
|
}
|
|
612
688
|
function runStatus(run) {
|
|
613
689
|
if (run.status === "queued") return "queued";
|
|
@@ -630,8 +706,8 @@ var productionBadge = (text2, tone2 = "neutral") => `<span class="k-badge ${tone
|
|
|
630
706
|
function productionTag(reproduction) {
|
|
631
707
|
const rows3 = Array.isArray(reproduction) ? reproduction.filter((r) => r && typeof r === "object") : [];
|
|
632
708
|
if (!rows3.length) return "";
|
|
633
|
-
const
|
|
634
|
-
const again =
|
|
709
|
+
const count3 = (verdict) => rows3.filter((r) => r.verdict === verdict).length;
|
|
710
|
+
const again = count3("reproduced") + count3("partly") + count3("crashed"), fixed = count3("not-reproduced"), differs = count3("differs");
|
|
635
711
|
if (rows3.length === 1) {
|
|
636
712
|
const [text2, tone2] = { reproduced: ["Same failure", "fail"], partly: ["Partly the same", "fail"], crashed: ["Agent crashed", "fail"], "not-reproduced": ["Fixed", "pass"], matches: ["Matches production", "pass"], differs: ["New failure", "warn"], unknown: ["Production ungraded", "neutral"], ungraded: ["Not compared", "neutral"] }[String(rows3[0].verdict)] ?? ["Not compared", "neutral"];
|
|
637
713
|
return productionBadge(text2, tone2);
|
|
@@ -639,21 +715,27 @@ function productionTag(reproduction) {
|
|
|
639
715
|
if (again) return productionBadge(`${again} of ${rows3.length} fail again`, "fail");
|
|
640
716
|
if (differs) return productionBadge(`${differs} new ${differs === 1 ? "failure" : "failures"}`, "warn");
|
|
641
717
|
if (fixed) return productionBadge(`${fixed} of ${rows3.length} fixed`, "pass");
|
|
642
|
-
return
|
|
718
|
+
return count3("matches") === rows3.length ? productionBadge("Matches production", "pass") : productionBadge("Not compared", "neutral");
|
|
643
719
|
}
|
|
644
720
|
function baselineNote(run) {
|
|
645
721
|
const comparison = run.comparison;
|
|
646
722
|
if (!comparison || !Array.isArray(comparison.scenes)) return void 0;
|
|
647
723
|
const name = comparison.baselineRunId ? `vs ${shortId(String(comparison.baselineRunId))}` : "vs baseline";
|
|
724
|
+
const delta = comparison.scenes.length === 1 ? Number(comparison.scenes[0].delta) : NaN;
|
|
725
|
+
const rounded = Math.round(Math.abs(delta) * 100);
|
|
726
|
+
const points = Number.isFinite(delta) ? delta === 0 ? "0 pts" : `${delta > 0 ? "+" : "\u2212"}${rounded ? `${rounded} pts` : "<1 pt"}` : "";
|
|
727
|
+
if (comparison.regressed) {
|
|
728
|
+
const checks2 = (comparison.droppedChecks ?? []).map((check) => `${comparison.scenes.length > 1 ? `${check.sceneId} / ` : ""}${check.check}: ${check.before.passed}/${check.before.total} \u2192 ${check.after.passed}/${check.after.total}`);
|
|
729
|
+
return { text: `${["regressed", ...checks2, points].filter(Boolean).join(" \xB7 ")} ${name}`, tone: "fail" };
|
|
730
|
+
}
|
|
648
731
|
if (comparison.scenes.length === 1) {
|
|
649
|
-
|
|
650
|
-
if (Number.isFinite(delta)) return { text: delta ? `${delta > 0 ? "+" : "\u2212"}${Math.abs(delta)} pts ${name}` : `no change ${name}`, tone: delta > 0 ? "pass" : delta < 0 ? "fail" : "neutral" };
|
|
732
|
+
if (Number.isFinite(delta)) return { text: delta ? `${points} ${name}` : `no change ${name}`, tone: delta > 0 ? "pass" : delta < 0 ? "fail" : "neutral" };
|
|
651
733
|
}
|
|
652
|
-
return
|
|
734
|
+
return { text: `held ${name}`, tone: "neutral" };
|
|
653
735
|
}
|
|
654
736
|
function attemptStates(run) {
|
|
655
737
|
const attempts = run.attempts ?? [], c = runCounts(run);
|
|
656
|
-
const states = attempts.map((a) => ["passed", "failed", "invalid", "skipped"].includes(a.outcome) ? a.outcome : ["running", "starting"].includes(a.status) ? "running" : a.status === "queued" ? "queued" : terminal(a.status) ? "done" : "queued");
|
|
738
|
+
const states = attempts.map((a) => ["passed", "failed", "invalid", "skipped", "ungraded"].includes(a.outcome) ? a.outcome : ["running", "starting"].includes(a.status) ? "running" : a.status === "queued" ? "queued" : terminal(a.status) ? "done" : "queued");
|
|
657
739
|
while (states.length < c.total) states.push("queued");
|
|
658
740
|
return states;
|
|
659
741
|
}
|
|
@@ -677,16 +759,20 @@ function attemptSquares(states, links = [], labels = []) {
|
|
|
677
759
|
return links[i] ? `<a ${attrs} href="${h(links[i])}" data-nav></a>` : `<span ${attrs}></span>`;
|
|
678
760
|
}).join("")}</span>`;
|
|
679
761
|
}
|
|
680
|
-
function row(item, now, compared) {
|
|
762
|
+
function row(item, now, compared, references) {
|
|
681
763
|
const run = item.run, c = runCounts(run), baseline = baselineNote(run);
|
|
764
|
+
const baselineId = run.comparison?.baselineRunId;
|
|
765
|
+
const baselineText = baseline ? `<span class="k-${baseline.tone === "fail" ? "fail-text" : baseline.tone === "pass" ? "pass-text" : "muted"}">${h(baseline.text)}</span>` : "\u2014";
|
|
766
|
+
const baselineLink = baseline && baselineId ? `<a href="/playgrounds/${encodeURIComponent(String(baselineId))}" data-nav>${baselineText}</a>${references.get(String(baselineId))?.origin?.branch === "main" ? '<span class="k-meta"> \xB7 main</span>' : ""}` : baselineText;
|
|
682
767
|
const attemptLinks = whereKey(run.origin) === "cloud" && !terminal(run.status) ? [] : (run.attempts ?? []).map((a) => a.id && a.taskId ? `/playgrounds/${encodeURIComponent(String(run.id))}?task=${encodeURIComponent(String(a.taskId))}&attempt=${encodeURIComponent(String(a.id))}` : void 0);
|
|
683
768
|
const pending = item.status === "queued" ? queueLabel(run.queue) || "Queued" : item.status === "running" ? "Graded as attempts finish" : "";
|
|
684
|
-
const note = [pending, c.graded && !c.requested ? "Rerun to record requested attempts" : "", c.invalid ? `${c.invalid} invalid` : "", c.skipped ? `${c.skipped} skipped` : "", !c.graded && !pending && !c.invalid && !c.skipped ? "No checks evaluated" : ""].filter(Boolean).join(" \xB7 ");
|
|
685
|
-
return `<tr><td class="wrap"><a class="rt-row" href="/playgrounds/${encodeURIComponent(String(run.id))}" data-nav><span class="rt-result"><span class="c-${item.status}">${resultBadge(item.status)}</span></span><span class="k-name">${h(run.origin?.branch
|
|
769
|
+
const note = [pending, c.graded && !c.requested ? "Rerun to record requested attempts" : "", c.invalid ? `${c.invalid} invalid` : "", c.skipped ? `${c.skipped} skipped` : "", c.ungraded ? `${c.ungraded} ungraded` : "", !c.graded && !pending && !c.invalid && !c.skipped ? "No checks evaluated" : ""].filter(Boolean).join(" \xB7 ");
|
|
770
|
+
return `<tr><td class="wrap"><a class="rt-row" href="/playgrounds/${encodeURIComponent(String(run.id))}" data-nav><span class="rt-result"><span class="c-${item.status}">${resultBadge(item.status)}</span></span><span class="k-name">${h(item.title)}</span>${run.origin?.branch ? `<span class="k-meta">${h(run.origin.branch)}</span>` : ""}<span class="k-id">${h(runLabel(run, `#${shortId(String(run.id))}`))}</span></a></td><td class="wrap"><span class="k-name">${h(item.agent || "\u2014")}</span>${item.command ? `<div class="k-id" title="${h(item.command)}">${h(item.command)}</div>` : ""}</td><td>${attemptSquares(attemptStates(run), attemptLinks)}<div class="k-meta">${h(`${c.finished} / ${c.total} done`)}</div></td><td class="num">${c.graded && c.requested ? `${c.passed}/${c.requested}` : "\u2014"}${note ? `<div class="k-meta">${h(note)}</div>` : ""}</td>` + (compared ? `<td>${baselineLink}</td>` : "") + `<td class="wrap k-meta">${h(originLabel(run.origin) || "Console")}${starterHtml(run) ? `<div>${starterHtml(run)}</div>` : ""}</td><td class="wrap num k-meta">${when(run.createdAt, now)}<div>${h(item.status === "queued" ? "Queued" : duration(item.ms))}</div></td></tr>`;
|
|
686
771
|
}
|
|
687
772
|
function runsTable(runs, options = {}) {
|
|
688
773
|
const now = options.now ?? Date.now(), compared = runs.some((run) => baselineNote(run));
|
|
689
|
-
|
|
774
|
+
const references = new Map((options.referenceRuns ?? runs).map((run) => [String(run.id), run]));
|
|
775
|
+
return `<section class="k-card runs-v2" aria-label="Runs"><div class="k-scroll"><table class="k-table wider"><thead><tr><th>Run</th><th>Agent</th><th>Results</th><th class="num">Passed</th>${compared ? "<th>Baseline</th>" : ""}<th>From</th><th class="num">When</th></tr></thead><tbody>${runs.map((run) => row(view(run, now), now, compared, references)).join("")}</tbody></table></div></section>`;
|
|
690
776
|
}
|
|
691
777
|
function filterUrl(filters, change) {
|
|
692
778
|
const next = { ...filters, ...change }, params = new URLSearchParams();
|
|
@@ -702,7 +788,7 @@ function runsPage(runs, filters, options = {}) {
|
|
|
702
788
|
const inRange = range ? all.filter((item) => now - timeOf(item.run.createdAt) <= RANGES[range][1]) : all;
|
|
703
789
|
const values = (pick, chosen) => [...new Set([...all.map(pick), chosen].filter((v) => Boolean(v)))];
|
|
704
790
|
const query = String(filters.q ?? "").trim().toLowerCase();
|
|
705
|
-
const matches = (item) => !query || [item.title, item.run.id, item.agent, item.command, item.run.test?.name, ...(item.run.tasks ?? []).flatMap((t) => [t.id, t.title, t.prompt])].some((v) => String(v ?? "").toLowerCase().includes(query));
|
|
791
|
+
const matches = (item) => !query || [item.title, item.run.origin?.branch, item.run.id, runLabel(item.run), item.agent, item.command, item.run.test?.name, ...(item.run.tasks ?? []).flatMap((t) => [t.id, t.title, t.prompt])].some((v) => String(v ?? "").toLowerCase().includes(query));
|
|
706
792
|
const shown = inRange.filter((item) => matches(item) && (!filters.agent || item.agent === filters.agent || item.run.agentId === filters.agent || item.run.entries?.some((entry) => entry.agentId === filters.agent)) && (!filters.result || item.status === filters.result) && (!filters.where || item.where === filters.where) && (!filters.commit || item.run.origin?.commit === filters.commit) && (!filters.source || item.run.origin?.source === filters.source) && (!filters.target || item.run.origin?.target === filters.target));
|
|
707
793
|
const select = (name, label2, choices, all2) => `<select class="k-filter" name="${name}" aria-label="${h(label2)}" data-run-filter><option value="">${h(all2)}</option>${choices.map(([value, text2]) => `<option value="${h(value)}" ${filters[name] === value ? "selected" : ""}>${h(text2)}</option>`).join("")}</select>`;
|
|
708
794
|
const commits = values((item) => item.run.origin?.commit, filters.commit);
|
|
@@ -715,7 +801,7 @@ function runsPage(runs, filters, options = {}) {
|
|
|
715
801
|
if (!shown.length) return `<div class="k-page">` + head2(meta) + bar + stateCard(filtered ? "No runs match these filters" : "No runs in this range", filtered ? h([query && `\u201C${filters.q}\u201D`, filters.agent && `Agent: ${named2 ?? filters.agent}`, filters.result && `Result: ${RESULT_ORDER.includes(filters.result) ? statusLabel(filters.result) : filters.result}`, filters.where && `Where: ${WHERE[filters.where] ?? filters.where}`, filters.commit && `Commit: ${filters.commit.slice(0, 7)}`].filter(Boolean).join(" \xB7 ")) : "", `<a class="button-link" href="${h(filtered ? filterUrl({ range: filters.range }, {}) : filterUrl(filters, { range: "" }))}" data-nav>${filtered ? "Clear filters" : "Show all runs"}</a>`, "filtered") + "</div>";
|
|
716
802
|
const limit = Math.max(PAGE, Number(filters.limit) || PAGE), page = shown.slice(0, limit);
|
|
717
803
|
const more = shown.length > page.length ? `<a class="button-link" href="${h(filterUrl(filters, { limit: limit + PAGE }))}" data-nav>Load ${Math.min(PAGE, shown.length - page.length)} more</a>` : "";
|
|
718
|
-
return `<div class="k-page">` + head2(meta) + bar + runsTable(page.map((item) => item.run), { now }) + `<div class="rt-foot"><span class="c-note">${page.length} of ${shown.length} ${shown.length === 1 ? "run" : "runs"}, newest first</span>${more}</div></div>`;
|
|
804
|
+
return `<div class="k-page">` + head2(meta) + bar + runsTable(page.map((item) => item.run), { now, referenceRuns: runs }) + `<div class="rt-foot"><span class="c-note">${page.length} of ${shown.length} ${shown.length === 1 ? "run" : "runs"}, newest first</span>${more}</div></div>`;
|
|
719
805
|
}
|
|
720
806
|
|
|
721
807
|
// frontend/src/experience.ts
|
|
@@ -1024,7 +1110,7 @@ function traceDescription(t) {
|
|
|
1024
1110
|
if (filename) result.push(filename);
|
|
1025
1111
|
}
|
|
1026
1112
|
if (t.service === "tools") {
|
|
1027
|
-
const fields2 = (value,
|
|
1113
|
+
const fields2 = (value, count3) => value && typeof value === "object" && !Array.isArray(value) ? Object.entries(value).filter(([, v]) => v === null || ["string", "number", "boolean"].includes(typeof v)).slice(0, count3).map(([k, v]) => `${k}: ${String(v).slice(0, 60)}`).join(", ") : "";
|
|
1028
1114
|
const args = fields2(t.request?.args, 3), answer = fields2(t.response?.result, 4);
|
|
1029
1115
|
if (args) result.push(args);
|
|
1030
1116
|
if (answer) result.push(`returned ${answer}`);
|
|
@@ -1135,7 +1221,7 @@ function attemptResult(observation2, scene, selectedCheck, baseHref = "") {
|
|
|
1135
1221
|
}
|
|
1136
1222
|
|
|
1137
1223
|
// frontend/src/attempt-workspace.ts
|
|
1138
|
-
var
|
|
1224
|
+
var count2 = (n, noun) => `${n} ${noun}${n === 1 ? "" : "s"}`;
|
|
1139
1225
|
var readOnlyRun = (batch) => batch.origin?.stored === true || batch.origin?.mirrored === true || ["cli", "ci", "pytest"].includes(batch.origin?.source);
|
|
1140
1226
|
var records = (value) => Array.isArray(value) ? value.filter((item) => item && typeof item === "object") : [];
|
|
1141
1227
|
var basePath = (batch) => "/playgrounds/" + encodeURIComponent(String(batch.id));
|
|
@@ -1144,7 +1230,7 @@ function taskDisplayName(task, index) {
|
|
|
1144
1230
|
const title2 = typeof task.title === "string" ? task.title.trim().replace(/\s+/g, " ") : "";
|
|
1145
1231
|
return title2 && title2.length <= 80 ? title2 : `Task ${index + 1}`;
|
|
1146
1232
|
}
|
|
1147
|
-
function
|
|
1233
|
+
function attemptOutcome2(attempt) {
|
|
1148
1234
|
if (attempt.outcome === "passed") return { key: "passed", label: "Passed", tone: "pass", mark: "\u2713" };
|
|
1149
1235
|
if (attempt.outcome === "failed") return { key: "failed", label: "Failed", tone: "fail", mark: "\u2717" };
|
|
1150
1236
|
if (attempt.outcome === "invalid") return { key: "invalid", label: "Invalid \xB7 harness", tone: "invalid", mark: "?" };
|
|
@@ -1218,7 +1304,7 @@ function executionBadge(attempt, compact = false) {
|
|
|
1218
1304
|
return `<span class="aw-execution ${tone2}">${h(attemptLabel(status))}</span>`;
|
|
1219
1305
|
}
|
|
1220
1306
|
function outcomeBadge(attempt) {
|
|
1221
|
-
const outcome =
|
|
1307
|
+
const outcome = attemptOutcome2(attempt);
|
|
1222
1308
|
return `<span class="aw-outcome ${outcome.tone}">${h(outcome.label)}</span>`;
|
|
1223
1309
|
}
|
|
1224
1310
|
function sentence(text2) {
|
|
@@ -1264,7 +1350,7 @@ function agentCrumb(batch) {
|
|
|
1264
1350
|
}
|
|
1265
1351
|
function runDetails(batch, tasks, attempts) {
|
|
1266
1352
|
const baseline = batch.comparison?.baselineRunId, total = timeOf(batch.finishedAt) - timeOf(batch.startedAt ?? batch.createdAt);
|
|
1267
|
-
return `<section class="k-card" aria-label="Details"><h2>Details</h2>` + (agentName(batch) ? detailRow("Agent", batch.agentId ? navLink(agentName(batch), "/agents/" + encodeURIComponent(String(batch.agentId))) : h(agentName(batch))) : "") + (batch.origin?.commit ? detailRow("Commit", `<span class="k-mono">${h(String(batch.origin.commit).slice(0, 7))}${batch.origin.dirty ? " + changes" : ""}</span>`) : "") + (baseline ? detailRow("Compared with", navLink(shortId(String(baseline)), "/playgrounds/" + encodeURIComponent(String(baseline)))) : "") + detailRow("From", h(originLabel(batch.origin) || "Console")) + (batch.createdAt ? detailRow("Started", `<time datetime="${h(batch.createdAt)}" title="${h(utc(batch.createdAt))}">${h(utcClock(batch.createdAt))}<span class="k-meta"> \xB7 ${h(utcDay(batch.createdAt))}</span></time>`) : "") + (Number.isFinite(total) && total >= 0 ? detailRow("Duration", h(duration(total))) : "") + detailRow("Tests \xD7 attempts", h(`${
|
|
1353
|
+
return `<section class="k-card" aria-label="Details"><h2>Details</h2>` + (agentName(batch) ? detailRow("Agent", batch.agentId ? navLink(agentName(batch), "/agents/" + encodeURIComponent(String(batch.agentId))) : h(agentName(batch))) : "") + (batch.origin?.commit ? detailRow("Commit", `<span class="k-mono">${h(String(batch.origin.commit).slice(0, 7))}${batch.origin.dirty ? " + changes" : ""}</span>`) : "") + (baseline ? detailRow("Compared with", navLink(shortId(String(baseline)), "/playgrounds/" + encodeURIComponent(String(baseline)))) : "") + (batch.rerunOf ? detailRow("Rerun of", `<a href="/runs/${h(encodeURIComponent(batch.rerunOf.runId))}">${h(shortId(batch.rerunOf.runId))}</a>${batch.rerunOf.mode === "failed" ? " \xB7 failed tests" : ""}`) : "") + detailRow("From", h(originLabel(batch.origin) || "Console")) + (starterHtml(batch) ? detailRow("Started by", starterHtml(batch)) : "") + (batch.createdAt ? detailRow("Started", `<time datetime="${h(batch.createdAt)}" title="${h(utc(batch.createdAt))}">${h(utcClock(batch.createdAt))}<span class="k-meta"> \xB7 ${h(utcDay(batch.createdAt))}</span></time>`) : "") + (Number.isFinite(total) && total >= 0 ? detailRow("Duration", h(duration(total))) : "") + detailRow("Tests \xD7 attempts", h(`${count2(tasks.length, "test")} \xB7 ${count2(runCounts({ ...batch, tasks, attempts }).total, "attempt")}`)) + (Number(batch.concurrency) > 0 ? detailRow("At once", h(`${batch.concurrency} attempts`)) : "") + (batch.exitCode !== void 0 ? detailRow("Exit", h(batch.exitCode)) : "") + "</section>";
|
|
1268
1354
|
}
|
|
1269
1355
|
function testSquares(batch, task, attempts) {
|
|
1270
1356
|
const states = attemptStates({ tasks: [task], attempts });
|
|
@@ -1281,15 +1367,17 @@ function runProgress(batch) {
|
|
|
1281
1367
|
return `<section class="k-card k-progress" aria-label="Progress"><div class="k-progress-line"><strong class="k-big mid">${c.finished} of ${c.total} attempts done</strong></div><div class="k-meter s059-meter" role="img" aria-label="${h(label2)}">${states.map((state) => `<span class="${resultClass(state)}"></span>`).join("")}</div><span class="k-meta">${h(label2)}. Results are graded as each attempt finishes.</span></section>`;
|
|
1282
1368
|
}
|
|
1283
1369
|
function renderRunOverview(batch, actionsHtml = "", options = {}) {
|
|
1370
|
+
if (options.task && batch.rerun && /^run_cloud_/.test(String(batch.id))) actionsHtml += `<form method="post" action="/tests/rerun"><input type="hidden" name="runId" value="${h(batch.id)}"><input type="hidden" name="name" value="${h(options.task)}"><input type="hidden" name="idempotencyKey" value="${h(batch.rerun.key)}-test"><button type="submit" class="k-btn primary">Run x5</button></form>`;
|
|
1371
|
+
if (!options.task && batch.rerun && /^run_cloud_/.test(String(batch.id))) actionsHtml += [["again", "Run again"], ...batch.rerun.failed ? [["failed", "Rerun failed"]] : []].map(([mode, label2]) => `<form method="post" action="/runs/${h(encodeURIComponent(batch.id))}/rerun"><input type="hidden" name="mode" value="${mode}"><input type="hidden" name="idempotencyKey" value="${h(batch.rerun.key)}-${mode}"><button type="submit" class="k-btn">${label2}</button></form>`).join("");
|
|
1284
1372
|
const groups = entrySections(batch), tasks = groups.flatMap((group) => group.tasks), allAttempts = records(batch.attempts), c = runCounts(batch);
|
|
1285
1373
|
const rows3 = groups.flatMap(({ entry, tasks: tasks2, attempts }) => tasks2.map((task) => ({ entry, task, attempts: attempts.filter((a) => a.taskId === task.id) }))).filter((row2) => !options.task || row2.task.id === options.task);
|
|
1286
|
-
const hasProduction = rows3.some((row2) => reproductionOf(batch, row2.task));
|
|
1374
|
+
const hasProduction = rows3.some((row2) => reproductionOf(batch, row2.task)), baseline = baselineNote(batch);
|
|
1287
1375
|
const failed = rows3.filter((row2) => row2.attempts.some((a) => a.outcome === "failed")).length;
|
|
1288
1376
|
const noResult = rows3.filter((row2) => row2.attempts.some((a) => ["completed", "error", "stopped"].includes(a.status) && !["passed", "failed"].includes(a.outcome))).length;
|
|
1289
|
-
return `<div class="k-page s059-run"><div class="s059-run-content k-stack"><nav class="k-crumbs" aria-label="Breadcrumb">${agentCrumb(batch)}${navLink("Runs", "/playgrounds")}<span>/</span><span aria-current="page"
|
|
1377
|
+
return `<div class="k-page s059-run"><div class="s059-run-content k-stack"><nav class="k-crumbs" aria-label="Breadcrumb">${agentCrumb(batch)}${navLink("Runs", "/playgrounds")}<span>/</span><span aria-current="page">${h(runLabel(batch, `#${shortId(String(batch.id))}`))}</span></nav><header class="k-head"><div class="k-title"><h1>${h(batch.groupName || runTitle(batch))} <span class="k-num">${h(runLabel(batch, `#${shortId(String(batch.id))}`))}</span></h1>${batch.origin?.branch ? `<span class="k-meta">${h(batch.origin.branch)}</span>` : ""}${resultBadge(runStatus(batch))}</div><div class="k-actions">${kitActions(actionsHtml)}</div></header>${queueLine(batch)}${errorMessage(batch.error)}<div class="k-cols"><div class="k-main">${options.task && rows3[0] ? `<section class="k-card k-task"><span class="k-label">Task</span><div>${h(rows3[0].task.prompt ?? "")}</div></section>${comparisonForm(batch, rows3[0].task, rows3[0].attempts)}` : ""}${["running", "starting", "queued"].includes(batch.status) ? runProgress(batch) : ""}<section class="k-card" aria-label="Tests"><div class="k-card-head"><h2>${c.passed} of ${c.total} passed</h2><nav class="k-seg" aria-label="Filter tests"><button type="button" id="run-filter-all" data-test-filter="all" aria-pressed="true">All (${rows3.length})</button><button type="button" id="run-filter-failed" data-test-filter="failed" aria-pressed="false">Failed (${failed})</button><button type="button" id="run-filter-none" data-test-filter="none" aria-pressed="false">No result (${noResult})</button></nav></div><div class="k-scroll"><table class="k-table mid"><thead><tr><th class="icon-cell"><span class="sr-only">Result</span></th><th>Test</th><th>Attempts</th><th class="num">Passed</th>${hasProduction ? "<th>vs production</th>" : ""}</tr></thead><tbody>${rows3.map(({ entry, task, attempts }) => {
|
|
1290
1378
|
const outcome = taskOutcome(attempts, hasChecks([task]), Number(task.attempts) || attempts.length), reproduction = reproductionOf(batch, task);
|
|
1291
1379
|
return `<tr data-test-row data-failed="${attempts.some((a) => a.outcome === "failed")}" data-none="${attempts.some((a) => ["completed", "error", "stopped"].includes(a.status) && !["passed", "failed"].includes(a.outcome))}"><td class="icon-cell">${resultIcon(taskKind(attempts))}</td><td class="wrap"><button class="k-name" type="button" id="run-test-${h(task.id)}" data-peek-task="${h(task.id)}" aria-haspopup="dialog">${h(taskDisplayName(task, tasks.indexOf(task)))}</button>${groups.length > 1 ? `<div class="k-meta">${h(entry?.agentName ?? entry?.name ?? "")}</div>` : ""}<div class="k-meta">${h(shortPrompt(task.prompt))}</div><template data-test-peek="${h(task.id)}">${testPeek(batch, task, attempts, tasks.indexOf(task))}</template></td><td>${testSquares(batch, task, attempts)}</td><td class="num">${attempts.some((a) => ["passed", "failed"].includes(a.outcome)) ? `${attempts.filter((a) => a.outcome === "passed").length}/${Number(task.attempts) || attempts.length}` : "\u2014"}<div class="k-meta">${h(outcome.note)}</div></td>${hasProduction ? `<td>${productionTag(reproduction ? [reproduction] : []) || "\u2014"}</td>` : ""}</tr>`;
|
|
1292
|
-
}).join("")}</tbody></table></div>${!rows3.length ? '<p class="k-empty">No tasks recorded.</p>' : ""}<p class="k-empty" data-test-empty hidden>No tests match this filter.</p></section></div><aside class="k-side">${runDetails(batch, tasks, allAttempts)}${
|
|
1380
|
+
}).join("")}</tbody></table></div>${!rows3.length ? '<p class="k-empty">No tasks recorded.</p>' : ""}<p class="k-empty" data-test-empty hidden>No tests match this filter.</p></section></div><aside class="k-side">${runDetails(batch, tasks, allAttempts)}${baseline ? `<p class="k-meta${baseline.tone === "fail" ? " k-fail-text" : ""}">${h(baseline.text)}</p>` : ""}</aside></div></div><div data-peek-host></div></div>`;
|
|
1293
1381
|
}
|
|
1294
1382
|
function mountRunOverview(container, state = {}) {
|
|
1295
1383
|
const page = container.querySelector(".s059-run");
|
|
@@ -1297,14 +1385,14 @@ function mountRunOverview(container, state = {}) {
|
|
|
1297
1385
|
const content = page.querySelector(".s059-run-content"), host = page.querySelector("[data-peek-host]");
|
|
1298
1386
|
const buttons = [...page.querySelectorAll("[data-peek-task]")];
|
|
1299
1387
|
const applyFilter = () => {
|
|
1300
|
-
let
|
|
1388
|
+
let count3 = 0;
|
|
1301
1389
|
const rows3 = [...page.querySelectorAll("[data-test-row]")];
|
|
1302
1390
|
for (const row2 of rows3) {
|
|
1303
1391
|
row2.hidden = state.filter === "failed" ? row2.dataset.failed !== "true" : state.filter === "none" ? row2.dataset.none !== "true" : false;
|
|
1304
|
-
if (!row2.hidden)
|
|
1392
|
+
if (!row2.hidden) count3++;
|
|
1305
1393
|
}
|
|
1306
1394
|
for (const button2 of page.querySelectorAll("[data-test-filter]")) button2.setAttribute("aria-pressed", String(button2.dataset.testFilter === (state.filter ?? "all")));
|
|
1307
|
-
page.querySelector("[data-test-empty]").hidden =
|
|
1395
|
+
page.querySelector("[data-test-empty]").hidden = count3 > 0 || rows3.length === 0;
|
|
1308
1396
|
};
|
|
1309
1397
|
const close = () => {
|
|
1310
1398
|
const id = state.peek;
|
|
@@ -1463,7 +1551,7 @@ function managedResponse(attempt) {
|
|
|
1463
1551
|
return original.replace(/<div class="response-text">[\s\S]*?<\/div>/, () => `<div class="aw-markdown">${safeMarkdown(text2)}</div>`);
|
|
1464
1552
|
}
|
|
1465
1553
|
function attemptKind(attempt) {
|
|
1466
|
-
const outcome =
|
|
1554
|
+
const outcome = attemptOutcome2(attempt).key;
|
|
1467
1555
|
if (outcome !== "ungraded") return outcome;
|
|
1468
1556
|
return attempt.status === "queued" ? "queued" : ["starting", "running"].includes(attempt.status) ? "running" : attempt.status === "error" ? "error" : attempt.status === "stopped" ? "stopped" : "ungraded";
|
|
1469
1557
|
}
|
|
@@ -1493,11 +1581,11 @@ function fieldsOf(value, limit = 60) {
|
|
|
1493
1581
|
walk(value, "");
|
|
1494
1582
|
return out;
|
|
1495
1583
|
}
|
|
1496
|
-
function gist(value,
|
|
1584
|
+
function gist(value, count3 = 3) {
|
|
1497
1585
|
if (value === void 0 || value === null || value === "") return "";
|
|
1498
1586
|
if (!(typeof value === "object")) return String(value).replace(/\s+/g, " ").slice(0, 120);
|
|
1499
|
-
const fields2 = fieldsOf(value,
|
|
1500
|
-
return fields2.slice(0,
|
|
1587
|
+
const fields2 = fieldsOf(value, count3 + 1).filter(([, v]) => v !== "");
|
|
1588
|
+
return fields2.slice(0, count3).map(([k, v]) => `${k}: ${v.length > 40 ? `${v.slice(0, 39)}\u2026` : v}`).join(", ") + (fields2.length > count3 ? ", \u2026" : "");
|
|
1501
1589
|
}
|
|
1502
1590
|
var fieldList = (value) => {
|
|
1503
1591
|
const fields2 = fieldsOf(value);
|
|
@@ -1560,7 +1648,7 @@ function stepsSection(observation2, checks2, callHref, jump) {
|
|
|
1560
1648
|
const stepOf = (check) => (Array.isArray(check.evidence) ? check.evidence : []).find((seq) => Number.isSafeInteger(seq) && seqs.has(Number(seq)));
|
|
1561
1649
|
const unlinked = failures.filter((check) => stepOf(check) === void 0);
|
|
1562
1650
|
const times = trace.map((t) => timeOf(t.tSim)).filter(Number.isFinite), start = times.length ? Math.min(...times) : NaN;
|
|
1563
|
-
return `<section class="k-card" aria-label="Steps"><div class="k-card-head"><h2>Steps</h2><span class="k-meta">${
|
|
1651
|
+
return `<section class="k-card" aria-label="Steps"><div class="k-card-head"><h2>Steps</h2><span class="k-meta">${count2(trace.length, "call")}</span></div>${unlinked.length ? `<div class="k-stack s059-unlinked">${unlinked.map((check) => failedCheckCard(check, jump)).join("")}</div>` : ""}<ol class="k-steps">${trace.map((call, i) => {
|
|
1564
1652
|
const seq = Number(call.seq), own = failures.filter((check) => stepOf(check) === seq), at2 = timeOf(call.tSim);
|
|
1565
1653
|
return `<li><div class="k-step${own.length ? " fail" : ""}" id="step-${h(seq)}"><span class="n">${i + 1}</span><span class="tool" title="${h(call.service ?? "")}">${h(call.service === "tools" ? "Tool" : toolName(String(call.service ?? "")) || "Call")}</span><span class="what">${navLink(callName(call), callHref(seq), "k-name")}${gist(call.service === "tools" ? call.request?.args : call.request) ? `<span class="s059-step-gist">${h(gist(call.service === "tools" ? call.request?.args : call.request))}</span>` : ""}</span><span class="t">${Number.isFinite(at2) && Number.isFinite(start) ? h(duration(at2 - start)) : "\u2014"}</span></div>${own.map((check) => `<div class="k-step-check">${failedCheckCard(check, jump)}</div>`).join("")}</li>`;
|
|
1566
1654
|
}).join("")}</ol>${trace.length ? "" : '<p class="k-empty">No calls in this attempt.</p>'}</section>`;
|
|
@@ -1611,8 +1699,8 @@ function renderAttemptWorkspace(batch, attempt, evidence, options = {}) {
|
|
|
1611
1699
|
const content = view2 === "tools" ? toolsNav + (tool ? capturedToolView(observation2, tool, { ...query, baseHref: attemptBase }) : '<p class="quiet-empty">No captured tool data.</p>') : view2 === "conversation" ? response + conversationView(observation2, { focus: query.focus }) : view2 === "logs" ? logs.trim() ? `<pre class="rd-log">${h(logs)}</pre>` : stateCard("No log", "The agent wrote nothing to its output in this attempt.") : response + callsSection(observation2, failing, Number(query.call) || void 0) + productionSection(batch, task, fullEvidence);
|
|
1612
1700
|
const tab2 = (label2, name, href2) => navLink(label2, href2, view2 === name ? "on" : "").replace("<a ", `<a ${view2 === name ? 'aria-current="page" ' : ""}`);
|
|
1613
1701
|
const ms = attemptMs(attempt), calls = Number(fullEvidence.toolCalls ?? attempt.toolCalls) || 0, id = String(batch.id), trace = reproductionOf(batch, task)?.trace;
|
|
1614
|
-
const details2 = `<section class="k-card" aria-label="Details"><h2>Details</h2>${detailRow("Agent", h(entry?.agentName ?? (agentName(batch) || "\u2014")))}${detailRow("Attempt", h(attempt.number))}${detailRow("Duration", h(ms === void 0 ? "\u2014" : duration(ms)))}${detailRow("Tool calls", String(calls))}${detailRow("From", h(originLabel(batch.origin) || "Console"))}${batch.createdAt ? detailRow("Started", `<time datetime="${h(batch.createdAt)}" title="${h(utc(batch.createdAt))}">${h(utcClock(batch.createdAt))} \xB7 ${h(utcDay(batch.createdAt))}</time>`) : ""}${trace ? detailRow("Production trace", `<code title="${h(trace)}">${h(String(trace).slice(0, 8))}</code>`) : ""}${detailRow("Run", navLink(shortId(id), basePath(batch)))}${detailRow("Test", h(task.id))}</section>`;
|
|
1615
|
-
return `<div class="k-page s059-attempt"><nav class="k-crumbs" aria-label="Breadcrumb">${agentCrumb({ ...batch, ...entry?.agentName ? { agentName: entry.agentName, agentId: entry.agentId } : {} })}${navLink(
|
|
1702
|
+
const details2 = `<section class="k-card" aria-label="Details"><h2>Details</h2>${detailRow("Agent", h(entry?.agentName ?? (agentName(batch) || "\u2014")))}${detailRow("Attempt", h(attempt.number))}${detailRow("Duration", h(ms === void 0 ? "\u2014" : duration(ms)))}${detailRow("Tool calls", String(calls))}${detailRow("From", h(originLabel(batch.origin) || "Console"))}${batch.createdAt ? detailRow("Started", `<time datetime="${h(batch.createdAt)}" title="${h(utc(batch.createdAt))}">${h(utcClock(batch.createdAt))} \xB7 ${h(utcDay(batch.createdAt))}</time>`) : ""}${trace ? detailRow("Production trace", `<code title="${h(trace)}">${h(String(trace).slice(0, 8))}</code>`) : ""}${detailRow("Run", navLink(runLabel(batch, shortId(id)), basePath(batch)))}${detailRow("Test", h(task.id))}</section>`;
|
|
1703
|
+
return `<div class="k-page s059-attempt"><nav class="k-crumbs" aria-label="Breadcrumb">${agentCrumb({ ...batch, ...entry?.agentName ? { agentName: entry.agentName, agentId: entry.agentId } : {} })}${navLink(runLabel(batch, shortId(id)), basePath(batch))}<span>/</span>${navLink(taskDisplayName(task, index), taskHref(batch, task))}<span>/</span><span aria-current="page">Attempt ${h(attempt.number)}</span>${copyButton(id, "Copy run id")}</nav><header class="k-head"><div class="k-title"><h1>${h(taskDisplayName(task, index))}</h1>${resultBadge(attemptKind(attempt))}${["starting", "running", "queued"].includes(attempt.status) ? executionBadge(attempt) : ""}</div><div class="k-actions">${cliRun(batch) ? copyCommand(`ancha explain ${id}`) : ""}${kitActions(options.actionsHtml ?? "")}</div></header><nav class="k-attempts" aria-label="Attempts">${attempts.map((a) => navLink(String(a.number), taskHref(batch, task, { attempt: a.id, ...view2 === "evidence" ? {} : { view: view2 } }), `k-att ${resultClass(attemptKind(a))}`).replace("<a ", `<a aria-label="Attempt ${h(a.number)}: ${h(resultLabel(attemptKind(a)))}" ${a.id === attempt.id ? 'aria-current="page" ' : ""}`)).join("")}</nav>${queueLine(batch)}${errorMessage(batch.error)}<div class="k-cols"><div class="k-main"><section class="k-card k-task s060-task"><span class="k-label">Task</span><div class="s060-task-text">${h(String(task.prompt ?? "").trim())}</div>${copyButton(codingAgentText(batch, task, fullEvidence, checks2), "Copy for coding agent")}</section>${invalidNote(attempt)}${stepsSection(observation2, checks2, callHref, jump)}${comparisonForm(batch, task, attempts, attempt)}<nav class="k-seg" aria-label="Attempt evidence">${people2 ? tab2("Conversation", "conversation", taskHref(batch, task, { attempt: attempt.id, view: "conversation" })) : ""}${tab2("Evidence", "evidence", people2 ? taskHref(batch, task, { attempt: attempt.id, view: "evidence" }) : attemptBase)}${tab2("World data", "tools", taskHref(batch, task, { attempt: attempt.id, view: "tools" }))}${tab2("Logs", "logs", taskHref(batch, task, { attempt: attempt.id, view: "logs" }))}</nav><div id="attempt-evidence" class="aw-evidence-body">${errorMessage(fullEvidence.error)}${content}</div></div><aside class="k-side">${attemptChecks(checks2, records(observation2.trace).filter((t) => t.path !== "console.manual_action").sort((a, b) => (Number(a.seq) || 0) - (Number(b.seq) || 0)), callHref, jump)}${details2}</aside></div></div>`;
|
|
1616
1704
|
}
|
|
1617
1705
|
function renderManagedComparison(data) {
|
|
1618
1706
|
const sides = records(data.attempts ?? [data.left, data.right]);
|
|
@@ -1632,7 +1720,7 @@ var resultBadge2 = (kind) => `<span class="k-badge ${tone(kind)}">${h(statusLabe
|
|
|
1632
1720
|
function attemptSquares2(attempts, runId, taskId) {
|
|
1633
1721
|
return `<div class="k-squares">${attempts.map((attempt) => {
|
|
1634
1722
|
const kind = attemptKind(attempt), state = kind === "running" ? "run" : kind === "queued" ? "queue" : tone(kind);
|
|
1635
|
-
const name = `Attempt ${attempt.number}: ${attemptLabel(attempt.status)} \xB7 ${
|
|
1723
|
+
const name = `Attempt ${attempt.number}: ${attemptLabel(attempt.status)} \xB7 ${attemptOutcome2(attempt).label}`;
|
|
1636
1724
|
return `<a data-nav class="k-sq ${state}" role="img" href="/playgrounds/${enc(runId)}?task=${enc(taskId)}&attempt=${enc(attempt.id)}" title="${h(name)}" aria-label="${h(name)}"></a>`;
|
|
1637
1725
|
}).join("")}</div>`;
|
|
1638
1726
|
}
|
|
@@ -1752,7 +1840,7 @@ function mountWorldWorkspace(node, options) {
|
|
|
1752
1840
|
if (disposed) return;
|
|
1753
1841
|
const currentRuns = selected ? setupRuns(runs, selected) : [], run = currentRuns[0], attempts = run?.attempts ?? [], tasks = selected?.tasks ?? [], choices = worldSetups(tests, world.id, agentId);
|
|
1754
1842
|
const usedBy = worldSetups(tests, world.id), datasets = world.configuration?.preset?.datasets ?? [];
|
|
1755
|
-
node.innerHTML = `<div class="k-page world-v2"><nav class="k-crumbs" aria-label="Breadcrumb"><a data-nav href="/worlds">Worlds</a><span>/</span><span aria-current="page">${h(world.name)}</span></nav><header class="k-head"><div><div class="k-title"><h1>${h(world.name)}</h1><span class="k-badge">Revision ${h(world.revision)}</span></div><div class="worlds-id"><code title="${h(world.id)}">${h(shortId(world.id))}</code>${copyButton(world.id, "Copy world id")}</div></div><div class="k-actions"><span class="world-agent-select"><select class="k-filter" aria-label="Agent" data-ww-select="agent"><option value="" disabled>Choose agent</option>${agents.map((a) => `<option value="${h(a.id)}" ${a.id === agentId ? "selected" : ""}>${h(agentLabel(a, agents))}</option>`).join("")}</select></span><a data-nav class="k-btn" href="${base}?data=1">View data</a><button class="k-btn" type="button" data-ww="configure">Configure</button>${selected ? options.runActions?.(selected.id) ?? button("Run tasks", "run-saved-test", selected.id, "k-btn primary") : ""}</div></header><p class="ww-error" role="alert" ${error ? "" : "hidden"}>${h(error)}</p>${errors.map((e) => `<p class="ww-error" role="alert">${h(e.message)}</p>`).join("")}${error || errors.length ? '<button class="k-btn" type="button" data-ww="retry">Retry loading tasks and runs</button>' : ""}${!loaded ? skeletonRows(4) : ""}<div class="k-cols"><div class="k-main">${choices.length > 1 ? `<span class="world-setup-select"><select class="k-filter" aria-label="Configuration" data-ww-select="test">${!selected ? '<option value="" selected disabled>New configuration</option>' : ""}${choices.map((t) => `<option value="${h(t.id)}" ${t.id === selected?.id ? "selected" : ""}>${h(t.name)}</option>`).join("")}</select></span>` : ""}${loaded && configure ? configuration2() : loaded ? `${run ? latestRun(run, attempts, tasks) : ""}<section class="k-card"><div class="k-card-head"><h2>Tasks${tasks.length ? ` \xB7 ${tasks.length}` : ""}</h2><div class="k-actions">${worldHistory(runs, world.id, agentId || void 0).length || selected ? `<button class="k-btn small" type="button" data-ww="history" aria-expanded="${showHistory}">History</button>` : ""}<button class="k-btn small" type="button" data-ww="configure">${tasks.length ? "Edit tasks" : "Add tasks"}</button></div></div>${tasks.length ? taskTable(tasks, attempts, run) : stateCard("Add tasks to this world", agents.length ? "Configure tasks for your agent to run." : "Connect an agent to run tasks.", agents.length ? '<button class="k-btn" type="button" data-ww="configure">Add tasks</button>' : '<a class="k-btn" data-nav href="/agents">Connect an agent</a>')}</section>${selected && !currentRuns.length && setupHistory(runs, selected).some((item) => item.earlier) ? '<p class="k-meta">This configuration has changed. Earlier attempts are in History.</p>' : ""}${showHistory ? history2() : ""}` : ""}${peopleSection(world, true)}</div><aside class="k-side"><section class="k-card"><div class="k-card-head"><h2>Tools \xB7 ${datasets.length}</h2><a data-nav href="${base}?edit=1">Edit world</a></div><div class="k-scroll" role="region" aria-label="World tools" tabindex="0"><table class="k-table"><thead><tr><th scope="col">Tool</th><th scope="col">Records</th></tr></thead><tbody>${datasets.map((dataset) => `<tr><td><a data-nav class="k-name world-tool-label" href="/tools/${enc(dataset.tool)}">${toolLogo(dataset.tool)}${h(toolName(dataset.tool))}</a></td><td><a data-nav class="k-name" href="${base}?data=1&tool=${enc(dataset.tool)}">View data</a></td></tr>`).join("")}</tbody></table></div>${!datasets.length ? '<p class="k-empty">No tools</p>' : ""}</section>${loaded ? `<section class="k-card"><div class="k-card-head"><h2>Used by ${usedBy.length} ${usedBy.length === 1 ? "test" : "tests"}</h2></div>${usedBy.length ? usedBy.map((test) => `<a data-nav class="k-kv k-name" href="${h(href2(test, test.agentId))}">${h(test.name)}</a>`).join("") : '<p class="k-empty">No tests</p>'}</section>` : ""}</aside></div></div>`;
|
|
1843
|
+
node.innerHTML = `<div class="k-page world-v2"><nav class="k-crumbs" aria-label="Breadcrumb"><a data-nav href="/worlds">Worlds</a><span>/</span><span aria-current="page">${h(world.name)}</span></nav><header class="k-head"><div><div class="k-title"><h1>${h(world.name)}</h1><span class="k-badge">Revision ${h(world.revision)}</span></div><div class="worlds-id"><code title="${h(world.id)}">${h(shortId(world.id))}</code>${copyButton(world.id, "Copy world id")}</div></div><div class="k-actions"><span class="world-agent-select"><select class="k-filter" aria-label="Agent" data-ww-select="agent"><option value="" disabled>Choose agent</option>${agents.map((a) => `<option value="${h(a.id)}" ${a.id === agentId ? "selected" : ""}>${h(agentLabel(a, agents))}</option>`).join("")}</select></span><a data-nav class="k-btn" href="${base}?data=1">View data</a><a data-nav class="k-btn" href="${h(base + "?new=1&configure=1" + (agentId ? "&agent=" + enc(agentId) : ""))}">New test in this world</a><button class="k-btn" type="button" data-ww="configure">Configure</button>${selected ? options.runActions?.(selected.id) ?? button("Run tasks", "run-saved-test", selected.id, "k-btn primary") : ""}</div></header><p class="ww-error" role="alert" ${error ? "" : "hidden"}>${h(error)}</p>${errors.map((e) => `<p class="ww-error" role="alert">${h(e.message)}</p>`).join("")}${error || errors.length ? '<button class="k-btn" type="button" data-ww="retry">Retry loading tasks and runs</button>' : ""}${!loaded ? skeletonRows(4) : ""}<div class="k-cols"><div class="k-main">${choices.length > 1 ? `<span class="world-setup-select"><select class="k-filter" aria-label="Configuration" data-ww-select="test">${!selected ? '<option value="" selected disabled>New configuration</option>' : ""}${choices.map((t) => `<option value="${h(t.id)}" ${t.id === selected?.id ? "selected" : ""}>${h(t.name)}</option>`).join("")}</select></span>` : ""}${loaded && configure ? configuration2() : loaded ? `${run ? latestRun(run, attempts, tasks) : ""}<section class="k-card"><div class="k-card-head"><h2>Tasks${tasks.length ? ` \xB7 ${tasks.length}` : ""}</h2><div class="k-actions">${worldHistory(runs, world.id, agentId || void 0).length || selected ? `<button class="k-btn small" type="button" data-ww="history" aria-expanded="${showHistory}">History</button>` : ""}<button class="k-btn small" type="button" data-ww="configure">${tasks.length ? "Edit tasks" : "Add tasks"}</button></div></div>${tasks.length ? taskTable(tasks, attempts, run) : stateCard("Add tasks to this world", agents.length ? "Configure tasks for your agent to run." : "Connect an agent to run tasks.", agents.length ? '<button class="k-btn" type="button" data-ww="configure">Add tasks</button>' : '<a class="k-btn" data-nav href="/agents">Connect an agent</a>')}</section>${selected && !currentRuns.length && setupHistory(runs, selected).some((item) => item.earlier) ? '<p class="k-meta">This configuration has changed. Earlier attempts are in History.</p>' : ""}${showHistory ? history2() : ""}` : ""}${peopleSection(world, true)}<section class="k-cmd-card"><strong>New test from your coding assistant</strong>${copyCommand(`ancha playground test create --name "<test name>" --agent ${agentId || "<agent id>"} --world ${world.id} --tasks tasks.json`)}</section></div><aside class="k-side"><section class="k-card"><div class="k-card-head"><h2>Tools \xB7 ${datasets.length}</h2><a data-nav href="${base}?edit=1">Edit world</a></div><div class="k-scroll" role="region" aria-label="World tools" tabindex="0"><table class="k-table"><thead><tr><th scope="col">Tool</th><th scope="col">Records</th></tr></thead><tbody>${datasets.map((dataset) => `<tr><td><a data-nav class="k-name world-tool-label" href="/tools/${enc(dataset.tool)}">${toolLogo(dataset.tool)}${h(toolName(dataset.tool))}</a></td><td><a data-nav class="k-name" href="${base}?data=1&tool=${enc(dataset.tool)}">View data</a></td></tr>`).join("")}</tbody></table></div>${!datasets.length ? '<p class="k-empty">No tools</p>' : ""}</section>${loaded ? `<section class="k-card"><div class="k-card-head"><h2>Used by ${usedBy.length} ${usedBy.length === 1 ? "test" : "tests"}</h2></div>${usedBy.length ? usedBy.map((test) => `<a data-nav class="k-kv k-name" href="${h(href2(test, test.agentId))}">${h(test.name)}</a>`).join("") : '<p class="k-empty">No tests</p>'}</section>` : ""}</aside></div></div>`;
|
|
1756
1844
|
}
|
|
1757
1845
|
function latestRun(run, attempts, tasks) {
|
|
1758
1846
|
const requested = run.summary?.counts?.requested ?? attempts.length, summary = executionSummary(attempts, requested), outcome = taskOutcome(attempts, hasChecks(run.tasks ?? tasks), requested);
|
|
@@ -1985,7 +2073,7 @@ function historyBars(runs, history2) {
|
|
|
1985
2073
|
const bars = runs.map((run) => {
|
|
1986
2074
|
const counts = runCounts(run), states = attemptStates(run);
|
|
1987
2075
|
const passed = counts.passed, failed = states.filter((state) => state === "failed").length;
|
|
1988
|
-
return { id: run.id, createdAt: run.createdAt, href: "/playgrounds/" + encodeURIComponent(run.id), passed, failed, none: Math.max(0, counts.total - passed - failed), total: counts.total };
|
|
2076
|
+
return { id: run.id, runNumber: run.runNumber, createdAt: run.createdAt, href: "/playgrounds/" + encodeURIComponent(run.id), passed, failed, none: Math.max(0, counts.total - passed - failed), total: counts.total };
|
|
1989
2077
|
});
|
|
1990
2078
|
for (const run of history2) {
|
|
1991
2079
|
if (!run.summary || bars.some((bar) => bar.id === run.runId)) continue;
|
|
@@ -1995,7 +2083,7 @@ function historyBars(runs, history2) {
|
|
|
1995
2083
|
const ungraded = summary?.verdict === "ungraded" || run.view?.state === "ungraded";
|
|
1996
2084
|
const passed = ungraded ? 0 : c?.passed ?? scenes.reduce((n, s) => n + Number(s.passed ?? 0), 0);
|
|
1997
2085
|
const failed = ungraded ? 0 : c?.failed ?? 0;
|
|
1998
|
-
bars.push({ id: run.runId, createdAt: summary.startedAt ?? run.status?.startedAt, href: "/playgrounds/" + encodeURIComponent(run.runId), passed, failed, none: Math.max(0, total - passed - failed), total });
|
|
2086
|
+
bars.push({ id: run.runId, runNumber: summary.runNumber, createdAt: summary.startedAt ?? run.status?.startedAt, href: "/playgrounds/" + encodeURIComponent(run.runId), passed, failed, none: Math.max(0, total - passed - failed), total });
|
|
1999
2087
|
}
|
|
2000
2088
|
return bars.sort(newestFirst).slice(0, 10).reverse();
|
|
2001
2089
|
}
|
|
@@ -2008,10 +2096,10 @@ function agentRecentRuns(runs, agent, emptyAction, options = {}) {
|
|
|
2008
2096
|
const recent = historyBars(runs, options.history ?? []), max = Math.max(1, ...recent.map((run) => run.total));
|
|
2009
2097
|
const legend = `<div class="ag-legend">${[["pass", "Passed"], ["fail", "Failed"], ["none", "No result"]].map(([kind, label2]) => `<span><span class="k-icon ${kind}" role="img" aria-label="${label2}"></span>${label2}</span>`).join("")}</div>`;
|
|
2010
2098
|
return `<section class="k-card" aria-label="Results over time"><div class="k-card-head"><h2>${recent.length ? `Last ${recent.length} ${recent.length === 1 ? "run" : "runs"}` : "Runs"}</h2>${legend}</div>${recent.length ? `<div class="k-scroll"><div class="ag-chart"><div class="ag-axis k-meta"><span>${max}</span><span>0</span></div><div class="ag-bars">${recent.map((run) => {
|
|
2011
|
-
const label2 = `Run ${shortId(String(run.id))}: ${run.passed} passed, ${run.failed} failed, ${run.none} no result`;
|
|
2099
|
+
const label2 = `Run ${runLabel(run, shortId(String(run.id)))}: ${run.passed} passed, ${run.failed} failed, ${run.none} no result`;
|
|
2012
2100
|
const pass = Math.round(10 * run.passed / max), fail = Math.round(10 * (run.passed + run.failed) / max) - pass;
|
|
2013
2101
|
const none = Math.round(10 * run.total / max) - pass - fail;
|
|
2014
|
-
return `<a class="ag-run" href="${h(run.href)}" data-nav aria-label="${h(label2)}" title="${h(label2)}"><span class="ag-run-stack" aria-hidden="true"><span class="ag-segment pass ag-h-${pass}"></span><span class="ag-segment fail ag-h-${fail}"></span><span class="ag-segment none ag-h-${none}"></span></span><span class="ag-run-id">${h(String(run.id).slice(-7))}</span></a>`;
|
|
2102
|
+
return `<a class="ag-run" href="${h(run.href)}" data-nav aria-label="${h(label2)}" title="${h(label2)}"><span class="ag-run-stack" aria-hidden="true"><span class="ag-segment pass ag-h-${pass}"></span><span class="ag-segment fail ag-h-${fail}"></span><span class="ag-segment none ag-h-${none}"></span></span><span class="ag-run-id">${h(runLabel(run, String(run.id).slice(-7)))}</span></a>`;
|
|
2015
2103
|
}).join("")}</div></div></div><p class="k-note"><a class="k-more" data-nav href="${h(all)}">All runs</a></p>` : stateCard("No runs yet", "Run a saved task to see its results here.", emptyAction)}</section>`;
|
|
2016
2104
|
}
|
|
2017
2105
|
function testLastRun(run, testId) {
|
|
@@ -2069,9 +2157,9 @@ var viewWorldsEmpty = (boot2) => viewBanner(boot2, /* @__PURE__ */ new Date(), "
|
|
|
2069
2157
|
|
|
2070
2158
|
// frontend/src/generated/tool-catalog.ts
|
|
2071
2159
|
var TOOL_CATALOG = [
|
|
2072
|
-
{ "name": "slack", "title": "Slack", "category": "Team chat", "description": "Channels, messages and threads", "version": "Web API", "env": ["SLACK_API_URL", "SLACK_BOT_TOKEN"], "endpoints": [["POST", "/api/apps.connections.open"], ["POST", "/api/auth.test"], ["POST", "/api/canvases.create"], ["POST", "/api/canvases.getContent"], ["POST", "/api/chat.delete"], ["POST", "/api/chat.getPermalink"], ["POST", "/api/chat.postMessage"], ["POST", "/api/chat.update"], ["POST", "/api/conversations.create"], ["POST", "/api/conversations.history"], ["POST", "/api/conversations.info"], ["POST", "/api/conversations.join"], ["POST", "/api/conversations.list"], ["POST", "/api/conversations.members"], ["POST", "/api/conversations.open"], ["POST", "/api/conversations.replies"], ["POST", "/api/files.info"], ["POST", "/api/files.list"], ["POST", "/api/reactions.add"], ["POST", "/api/reactions.get"], ["POST", "/api/reactions.remove"], ["POST", "/api/search.messages"], ["POST", "/api/users.conversations"], ["POST", "/api/users.info"], ["POST", "/api/users.list"], ["POST", "/api/users.lookupByEmail"], ["POST", "/api/views.publish"]] },
|
|
2160
|
+
{ "name": "slack", "title": "Slack", "category": "Team chat", "description": "Channels, messages and threads", "version": "Web API", "env": ["SLACK_API_URL", "SLACK_BOT_TOKEN"], "endpoints": [["POST", "/api/apps.connections.open"], ["POST", "/api/assistant.threads.setStatus"], ["POST", "/api/assistant.threads.setSuggestedPrompts"], ["POST", "/api/assistant.threads.setTitle"], ["POST", "/api/auth.test"], ["POST", "/api/canvases.create"], ["POST", "/api/canvases.getContent"], ["POST", "/api/chat.appendStream"], ["POST", "/api/chat.delete"], ["POST", "/api/chat.getPermalink"], ["POST", "/api/chat.postEphemeral"], ["POST", "/api/chat.postMessage"], ["POST", "/api/chat.startStream"], ["POST", "/api/chat.stopStream"], ["POST", "/api/chat.update"], ["POST", "/api/conversations.create"], ["POST", "/api/conversations.history"], ["POST", "/api/conversations.info"], ["POST", "/api/conversations.join"], ["POST", "/api/conversations.list"], ["POST", "/api/conversations.members"], ["POST", "/api/conversations.open"], ["POST", "/api/conversations.replies"], ["POST", "/api/files.info"], ["POST", "/api/files.list"], ["POST", "/api/reactions.add"], ["POST", "/api/reactions.get"], ["POST", "/api/reactions.remove"], ["POST", "/api/search.messages"], ["POST", "/api/users.conversations"], ["POST", "/api/users.info"], ["POST", "/api/users.list"], ["POST", "/api/users.lookupByEmail"], ["POST", "/api/views.publish"]] },
|
|
2073
2161
|
{ "name": "discord", "title": "Discord", "category": "Community chat", "description": "A community server as its bot sees it: channels, messages, threads and reactions", "version": "REST API v10", "env": ["DISCORD_API_URL", "DISCORD_BOT_TOKEN"], "endpoints": [["GET", "/api/v10/channels/{channel_id}"], ["GET", "/api/v10/channels/{channel_id}/messages"], ["POST", "/api/v10/channels/{channel_id}/messages"], ["GET", "/api/v10/channels/{channel_id}/messages/{message_id}"], ["PATCH", "/api/v10/channels/{channel_id}/messages/{message_id}"], ["DELETE", "/api/v10/channels/{channel_id}/messages/{message_id}"], ["GET", "/api/v10/channels/{channel_id}/messages/{message_id}/reactions/{emoji}"], ["PUT", "/api/v10/channels/{channel_id}/messages/{message_id}/reactions/{emoji}/@me"], ["DELETE", "/api/v10/channels/{channel_id}/messages/{message_id}/reactions/{emoji}/@me"], ["POST", "/api/v10/channels/{channel_id}/messages/{message_id}/threads"], ["GET", "/api/v10/channels/{channel_id}/pins"], ["PUT", "/api/v10/channels/{channel_id}/pins/{message_id}"], ["DELETE", "/api/v10/channels/{channel_id}/pins/{message_id}"], ["POST", "/api/v10/channels/{channel_id}/threads"], ["POST", "/api/v10/channels/{channel_id}/typing"], ["GET", "/api/v10/guilds/{guild_id}"], ["GET", "/api/v10/guilds/{guild_id}/channels"], ["GET", "/api/v10/guilds/{guild_id}/members"], ["GET", "/api/v10/guilds/{guild_id}/members/{user_id}"], ["GET", "/api/v10/guilds/{guild_id}/roles"], ["GET", "/api/v10/guilds/{guild_id}/threads/active"], ["GET", "/api/v10/users/{user_id}"], ["GET", "/api/v10/users/@me"], ["POST", "/api/v10/users/@me/channels"], ["GET", "/api/v10/users/@me/guilds"]] },
|
|
2074
|
-
{ "name": "github", "title": "GitHub", "category": "Code", "description": "Repositories, pull requests and deployments", "version": "REST", "env": ["GITHUB_API_URL", "GITHUB_TOKEN"], "endpoints": [["GET", "/repos/:owner/:repo/actions/runs"], ["GET", "/repos/:owner/:repo/actions/runs/:id"], ["POST", "/repos/:owner/:repo/actions/runs/:id/rerun"], ["GET", "/repos/:owner/:repo/actions/workflows/:workflow/runs"], ["GET", "/repos/:owner/:repo/branches"], ["GET", "/repos/:owner/:repo/branches/:branch"], ["GET", "/repos/:owner/:repo/check-runs/:id"], ["GET", "/repos/:owner/:repo/collaborators"], ["GET", "/repos/:owner/:repo/collaborators/:username"], ["PUT", "/repos/:owner/:repo/collaborators/:username"], ["DELETE", "/repos/:owner/:repo/collaborators/:username"], ["GET", "/repos/:owner/:repo/collaborators/:username/permission"], ["GET", "/repos/:owner/:repo/commits"], ["GET", "/repos/:owner/:repo/commits/:ref"], ["GET", "/repos/:owner/:repo/commits/:ref/check-runs"], ["GET", "/repos/:owner/:repo/compare/:base...:head"], ["PUT", "/repos/:owner/:repo/contents/:path"], ["GET", "/repos/:owner/:repo/contents/:path?"], ["GET", "/repos/:owner/:repo/deployments"], ["POST", "/repos/:owner/:repo/deployments"], ["GET", "/repos/:owner/:repo/deployments/:id"], ["GET", "/repos/:owner/:repo/deployments/:id/statuses"], ["POST", "/repos/:owner/:repo/deployments/:id/statuses"], ["GET", "/repos/:owner/:repo/deployments/:id/statuses/:statusId"], ["POST", "/repos/:owner/:repo/git/blobs"], ["GET", "/repos/:owner/:repo/git/blobs/:sha"], ["POST", "/repos/:owner/:repo/git/commits"], ["GET", "/repos/:owner/:repo/git/commits/:sha"], ["GET", "/repos/:owner/:repo/git/matching-refs/:ref?"], ["GET", "/repos/:owner/:repo/git/ref/:ref"], ["POST", "/repos/:owner/:repo/git/refs"], ["PATCH", "/repos/:owner/:repo/git/refs/:ref"], ["DELETE", "/repos/:owner/:repo/git/refs/:ref"], ["POST", "/repos/:owner/:repo/git/trees"], ["GET", "/repos/:owner/:repo/git/trees/:sha"], ["POST", "/graphql"], ["GET", "/repos/:owner/:repo/issues"], ["POST", "/repos/:owner/:repo/issues"], ["GET", "/repos/:owner/:repo/issues/:number"], ["PATCH", "/repos/:owner/:repo/issues/:number"], ["GET", "/repos/:owner/:repo/issues/:number/comments"], ["POST", "/repos/:owner/:repo/issues/:number/comments"], ["GET", "/repos/:owner/:repo/issues/:number/labels"], ["POST", "/repos/:owner/:repo/issues/:number/labels"], ["PUT", "/repos/:owner/:repo/issues/:number/labels"], ["DELETE", "/repos/:owner/:repo/issues/:number/labels"], ["DELETE", "/repos/:owner/:repo/issues/:number/labels/:name"], ["GET", "/repos/:owner/:repo/issues/comments"], ["GET", "/repos/:owner/:repo/issues/comments/:id"], ["PATCH", "/repos/:owner/:repo/issues/comments/:id"], ["DELETE", "/repos/:owner/:repo/issues/comments/:id"], ["GET", "/repos/:owner/:repo/labels"], ["POST", "/repos/:owner/:repo/labels"], ["GET", "/repos/:owner/:repo/labels/:name"], ["PATCH", "/repos/:owner/:repo/labels/:name"], ["DELETE", "/repos/:owner/:repo/labels/:name"], ["GET", "/orgs/:org/members"], ["GET", "/orgs/:org/members/:username"], ["DELETE", "/orgs/:org/members/:username"], ["GET", "/orgs/:org/memberships/:username"], ["DELETE", "/orgs/:org/memberships/:username"], ["GET", "/orgs/:org/repos"], ["GET", "/repos/:owner/:repo/pulls"], ["POST", "/repos/:owner/:repo/pulls"], ["GET", "/repos/:owner/:repo/pulls/:number"], ["PATCH", "/repos/:owner/:repo/pulls/:number"], ["GET", "/repos/:owner/:repo/pulls/:number/comments"], ["POST", "/repos/:owner/:repo/pulls/:number/comments"], ["GET", "/repos/:owner/:repo/pulls/:number/commits"], ["GET", "/repos/:owner/:repo/pulls/:number/files"], ["GET", "/repos/:owner/:repo/pulls/:number/merge"], ["PUT", "/repos/:owner/:repo/pulls/:number/merge"], ["GET", "/repos/:owner/:repo/pulls/:number/reviews"], ["POST", "/repos/:owner/:repo/pulls/:number/reviews"], ["GET", "/repos/:owner/:repo/pulls/:number/reviews/:id"], ["GET", "/repos/:owner/:repo/pulls/comments"], ["GET", "/repos/:owner/:repo/pulls/comments/:id"], ["PATCH", "/repos/:owner/:repo/pulls/comments/:id"], ["DELETE", "/repos/:owner/:repo/pulls/comments/:id"], ["GET", "/repos/:owner/:repo"], ["GET", "/user"], ["GET", "/user/repos"]] },
|
|
2162
|
+
{ "name": "github", "title": "GitHub", "category": "Code", "description": "Repositories, pull requests and deployments", "version": "REST", "env": ["GITHUB_API_URL", "GITHUB_TOKEN"], "endpoints": [["GET", "/repos/:owner/:repo/actions/runs"], ["GET", "/repos/:owner/:repo/actions/runs/:id"], ["POST", "/repos/:owner/:repo/actions/runs/:id/rerun"], ["GET", "/repos/:owner/:repo/actions/workflows/:workflow/runs"], ["GET", "/repos/:owner/:repo/branches"], ["GET", "/repos/:owner/:repo/branches/:branch"], ["GET", "/repos/:owner/:repo/check-runs/:id"], ["GET", "/repos/:owner/:repo/collaborators"], ["GET", "/repos/:owner/:repo/collaborators/:username"], ["PUT", "/repos/:owner/:repo/collaborators/:username"], ["DELETE", "/repos/:owner/:repo/collaborators/:username"], ["GET", "/repos/:owner/:repo/collaborators/:username/permission"], ["GET", "/repos/:owner/:repo/commits"], ["GET", "/repos/:owner/:repo/commits/:ref"], ["GET", "/repos/:owner/:repo/commits/:ref/check-runs"], ["GET", "/repos/:owner/:repo/compare/:base...:head"], ["PUT", "/repos/:owner/:repo/contents/:path"], ["GET", "/repos/:owner/:repo/contents/:path?"], ["GET", "/repos/:owner/:repo/deployments"], ["POST", "/repos/:owner/:repo/deployments"], ["GET", "/repos/:owner/:repo/deployments/:id"], ["GET", "/repos/:owner/:repo/deployments/:id/statuses"], ["POST", "/repos/:owner/:repo/deployments/:id/statuses"], ["GET", "/repos/:owner/:repo/deployments/:id/statuses/:statusId"], ["POST", "/repos/:owner/:repo/git/blobs"], ["GET", "/repos/:owner/:repo/git/blobs/:sha"], ["POST", "/repos/:owner/:repo/git/commits"], ["GET", "/repos/:owner/:repo/git/commits/:sha"], ["GET", "/repos/:owner/:repo/git/matching-refs/:ref?"], ["GET", "/repos/:owner/:repo/git/ref/:ref"], ["POST", "/repos/:owner/:repo/git/refs"], ["PATCH", "/repos/:owner/:repo/git/refs/:ref"], ["DELETE", "/repos/:owner/:repo/git/refs/:ref"], ["POST", "/repos/:owner/:repo/git/trees"], ["GET", "/repos/:owner/:repo/git/trees/:sha"], ["POST", "/graphql"], ["GET", "/repos/:owner/:repo/issues"], ["POST", "/repos/:owner/:repo/issues"], ["GET", "/repos/:owner/:repo/issues/:number"], ["PATCH", "/repos/:owner/:repo/issues/:number"], ["GET", "/repos/:owner/:repo/issues/:number/comments"], ["POST", "/repos/:owner/:repo/issues/:number/comments"], ["GET", "/repos/:owner/:repo/issues/:number/labels"], ["POST", "/repos/:owner/:repo/issues/:number/labels"], ["PUT", "/repos/:owner/:repo/issues/:number/labels"], ["DELETE", "/repos/:owner/:repo/issues/:number/labels"], ["DELETE", "/repos/:owner/:repo/issues/:number/labels/:name"], ["GET", "/repos/:owner/:repo/issues/comments"], ["GET", "/repos/:owner/:repo/issues/comments/:id"], ["PATCH", "/repos/:owner/:repo/issues/comments/:id"], ["DELETE", "/repos/:owner/:repo/issues/comments/:id"], ["GET", "/repos/:owner/:repo/labels"], ["POST", "/repos/:owner/:repo/labels"], ["GET", "/repos/:owner/:repo/labels/:name"], ["PATCH", "/repos/:owner/:repo/labels/:name"], ["DELETE", "/repos/:owner/:repo/labels/:name"], ["GET", "/orgs/:org/members"], ["GET", "/orgs/:org/members/:username"], ["DELETE", "/orgs/:org/members/:username"], ["GET", "/orgs/:org/memberships/:username"], ["DELETE", "/orgs/:org/memberships/:username"], ["GET", "/orgs/:org/repos"], ["GET", "/repos/:owner/:repo/pulls"], ["POST", "/repos/:owner/:repo/pulls"], ["GET", "/repos/:owner/:repo/pulls/:number"], ["PATCH", "/repos/:owner/:repo/pulls/:number"], ["GET", "/repos/:owner/:repo/pulls/:number/comments"], ["POST", "/repos/:owner/:repo/pulls/:number/comments"], ["GET", "/repos/:owner/:repo/pulls/:number/commits"], ["GET", "/repos/:owner/:repo/pulls/:number/files"], ["GET", "/repos/:owner/:repo/pulls/:number/merge"], ["PUT", "/repos/:owner/:repo/pulls/:number/merge"], ["GET", "/repos/:owner/:repo/pulls/:number/reviews"], ["POST", "/repos/:owner/:repo/pulls/:number/reviews"], ["GET", "/repos/:owner/:repo/pulls/:number/reviews/:id"], ["GET", "/repos/:owner/:repo/pulls/comments"], ["GET", "/repos/:owner/:repo/pulls/comments/:id"], ["PATCH", "/repos/:owner/:repo/pulls/comments/:id"], ["DELETE", "/repos/:owner/:repo/pulls/comments/:id"], ["GET", "/repos/:owner/:repo"], ["GET", "/search/issues"], ["GET", "/user"], ["GET", "/user/repos"]] },
|
|
2075
2163
|
{ "name": "linear", "title": "Linear", "category": "Issues", "description": "Issues, projects and team workflows", "version": "GraphQL", "env": ["LINEAR_API_URL", "LINEAR_API_KEY"], "endpoints": [["QUERY", "comment"], ["MUTATION", "commentCreate"], ["MUTATION", "commentDelete"], ["QUERY", "comments"], ["MUTATION", "commentUpdate"], ["QUERY", "issue"], ["MUTATION", "issueAddLabel"], ["MUTATION", "issueArchive"], ["MUTATION", "issueCreate"], ["MUTATION", "issueDelete"], ["QUERY", "issueLabel"], ["MUTATION", "issueLabelCreate"], ["QUERY", "issueLabels"], ["MUTATION", "issueRemoveLabel"], ["QUERY", "issues"], ["MUTATION", "issueUpdate"], ["QUERY", "organization"], ["QUERY", "project"], ["QUERY", "projects"], ["QUERY", "searchIssues"], ["QUERY", "team"], ["QUERY", "teams"], ["QUERY", "user"], ["QUERY", "users"], ["QUERY", "viewer"], ["QUERY", "workflowState"], ["QUERY", "workflowStates"]] },
|
|
2076
2164
|
{ "name": "jira", "title": "Jira", "category": "Issues", "description": "Issues, JQL search, comments, transitions and sprints", "version": "REST v3/v2 and agile 1.0", "env": ["JIRA_BASE_URL", "JIRA_EMAIL", "JIRA_API_TOKEN"], "endpoints": [["POST", "/rest/agile/1.0/backlog/issue"], ["GET", "/rest/agile/1.0/board"], ["GET", "/rest/agile/1.0/board/:id"], ["GET", "/rest/agile/1.0/board/:id/backlog"], ["GET", "/rest/agile/1.0/board/:id/issue"], ["GET", "/rest/agile/1.0/board/:id/sprint"], ["POST", "/rest/agile/1.0/sprint"], ["GET", "/rest/agile/1.0/sprint/:id"], ["POST", "/rest/agile/1.0/sprint/:id"], ["GET", "/rest/agile/1.0/sprint/:id/issue"], ["POST", "/rest/agile/1.0/sprint/:id/issue"], ["GET", "/rest/api/3/field"], ["POST", "/rest/api/3/issue"], ["GET", "/rest/api/3/issue/:key"], ["PUT", "/rest/api/3/issue/:key"], ["DELETE", "/rest/api/3/issue/:key"], ["PUT", "/rest/api/3/issue/:key/assignee"], ["GET", "/rest/api/3/issue/:key/changelog"], ["GET", "/rest/api/3/issue/:key/comment"], ["POST", "/rest/api/3/issue/:key/comment"], ["GET", "/rest/api/3/issue/:key/comment/:id"], ["PUT", "/rest/api/3/issue/:key/comment/:id"], ["DELETE", "/rest/api/3/issue/:key/comment/:id"], ["GET", "/rest/api/3/issue/:key/transitions"], ["POST", "/rest/api/3/issue/:key/transitions"], ["GET", "/rest/api/3/issue/:key/watchers"], ["POST", "/rest/api/3/issue/:key/watchers"], ["DELETE", "/rest/api/3/issue/:key/watchers"], ["POST", "/rest/api/3/issue/bulk"], ["GET", "/rest/api/3/issue/createmeta/:key/issuetypes"], ["GET", "/rest/api/3/issue/createmeta/:key/issuetypes/:type"], ["POST", "/rest/api/3/issueLink"], ["GET", "/rest/api/3/issueLink/:id"], ["DELETE", "/rest/api/3/issueLink/:id"], ["GET", "/rest/api/3/issueLinkType"], ["GET", "/rest/api/3/issuetype"], ["GET", "/rest/api/3/label"], ["GET", "/rest/api/3/myself"], ["GET", "/rest/api/3/priority"], ["GET", "/rest/api/3/project"], ["GET", "/rest/api/3/project/:key"], ["GET", "/rest/api/3/project/:key/components"], ["GET", "/rest/api/3/project/:key/statuses"], ["GET", "/rest/api/3/project/:key/versions"], ["GET", "/rest/api/3/project/search"], ["GET", "/rest/api/3/resolution"], ["GET", "/rest/api/3/search"], ["POST", "/rest/api/3/search"], ["POST", "/rest/api/3/search/approximate-count"], ["GET", "/rest/api/3/search/jql"], ["POST", "/rest/api/3/search/jql"], ["GET", "/rest/api/3/serverInfo"], ["GET", "/rest/api/3/status"], ["GET", "/rest/api/3/statuscategory"], ["GET", "/rest/api/3/user"], ["GET", "/rest/api/3/user/assignable/search"], ["GET", "/rest/api/3/user/search"]] },
|
|
2077
2165
|
{ "name": "asana", "title": "Asana", "category": "Projects", "description": "Projects, sections, tasks, subtasks and comments", "version": "REST API 1.0", "env": ["ASANA_API_URL", "ASANA_ACCESS_TOKEN"], "endpoints": [["GET", "/api/1.0/projects"], ["GET", "/api/1.0/projects/{project_gid}"], ["GET", "/api/1.0/projects/{project_gid}/sections"], ["POST", "/api/1.0/projects/{project_gid}/sections"], ["GET", "/api/1.0/projects/{project_gid}/tasks"], ["POST", "/api/1.0/sections/{section_gid}/addTask"], ["GET", "/api/1.0/sections/{section_gid}/tasks"], ["GET", "/api/1.0/tasks"], ["POST", "/api/1.0/tasks"], ["GET", "/api/1.0/tasks/{task_gid}"], ["PUT", "/api/1.0/tasks/{task_gid}"], ["DELETE", "/api/1.0/tasks/{task_gid}"], ["POST", "/api/1.0/tasks/{task_gid}/addProject"], ["POST", "/api/1.0/tasks/{task_gid}/removeProject"], ["GET", "/api/1.0/tasks/{task_gid}/stories"], ["POST", "/api/1.0/tasks/{task_gid}/stories"], ["GET", "/api/1.0/tasks/{task_gid}/subtasks"], ["POST", "/api/1.0/tasks/{task_gid}/subtasks"], ["GET", "/api/1.0/users"], ["GET", "/api/1.0/users/{user_gid}"], ["GET", "/api/1.0/workspaces"], ["GET", "/api/1.0/workspaces/{workspace_gid}"], ["GET", "/api/1.0/workspaces/{workspace_gid}/tasks/search"]] },
|
|
@@ -2354,8 +2442,8 @@ function mountTestFlow(node, options) {
|
|
|
2354
2442
|
} else if (step === "tasks") {
|
|
2355
2443
|
node.innerHTML += `<form id="test-tasks"><label>Test name<input name="name" value="${h(draft.name)}" required maxlength="120" placeholder="e.g. Customer follow-ups"></label><div id="task-editors">${taskFields(draft.tasks)}</div><button type="button" data-flow="add-task">Add task</button><div class="task-start-bar"><label>Run at once<input name="concurrency" type="number" min="1" max="10" value="${h(draft.concurrency)}" required></label><button type="submit" class="primary">Review</button></div></form>`;
|
|
2356
2444
|
} else {
|
|
2357
|
-
const
|
|
2358
|
-
node.innerHTML += `<section class="test-review"><h2>${h(draft.name)}</h2><div class="review-world"><span>${h(agent.name)}</span><span aria-hidden="true">\u2192</span><strong>${h(world?.name ?? "Loading saved world\u2026")}</strong>${world ? `<span class="muted">Revision ${h(world.revision)}</span>` : ""}<span class="world-marks">${(world?.configuration.preset.datasets ?? []).map((d) => toolLogo(d.tool)).join("")}</span></div>${draft.tasks.map((t, i) => `<div class="review-task"><span class="muted">${i + 1}</span><p>${h(t.prompt)}</p><span>${t.attempts} trials \xB7 ${Number((t.timeoutMs / 6e4).toFixed(2))} min</span></div>`).join("")}<div class="flow-footer"><span>${
|
|
2445
|
+
const count3 = draft.tasks.reduce((n, t) => n + t.attempts, 0);
|
|
2446
|
+
node.innerHTML += `<section class="test-review"><h2>${h(draft.name)}</h2><div class="review-world"><span>${h(agent.name)}</span><span aria-hidden="true">\u2192</span><strong>${h(world?.name ?? "Loading saved world\u2026")}</strong>${world ? `<span class="muted">Revision ${h(world.revision)}</span>` : ""}<span class="world-marks">${(world?.configuration.preset.datasets ?? []).map((d) => toolLogo(d.tool)).join("")}</span></div>${draft.tasks.map((t, i) => `<div class="review-task"><span class="muted">${i + 1}</span><p>${h(t.prompt)}</p><span>${t.attempts} trials \xB7 ${Number((t.timeoutMs / 6e4).toFixed(2))} min</span></div>`).join("")}<div class="flow-footer"><span>${count3} trials \xB7 up to ${Math.min(count3, draft.concurrency)} at once</span>${pending ? "" : `<button type="button" data-flow="save-test" ${!world ? "disabled" : ""}>Save test</button>`}<button type="button" data-flow="run-test" class="primary" ${!world ? "disabled" : ""}>${pending ? "Retry same run" : draft.savedTest ? "Run test" : "Save and run"}</button></div></section>`;
|
|
2359
2447
|
}
|
|
2360
2448
|
}
|
|
2361
2449
|
async function execute(action2) {
|
|
@@ -2575,7 +2663,7 @@ function mountGroupFlow(node, options) {
|
|
|
2575
2663
|
}
|
|
2576
2664
|
let saving = false, error = "";
|
|
2577
2665
|
const selectedWorld = () => options.worlds.find((world) => world.id === draft.worldId && world.revision === draft.worldRevision);
|
|
2578
|
-
const
|
|
2666
|
+
const count3 = () => draft.tasks.reduce((sum2, task) => sum2 + Number(task.attempts || 0), 0) * draft.agentIds.length;
|
|
2579
2667
|
const remember = () => {
|
|
2580
2668
|
try {
|
|
2581
2669
|
sessionStorage.setItem(key, JSON.stringify(draft));
|
|
@@ -2606,7 +2694,7 @@ function mountGroupFlow(node, options) {
|
|
|
2606
2694
|
}
|
|
2607
2695
|
function render() {
|
|
2608
2696
|
remember();
|
|
2609
|
-
const world = selectedWorld(), selected = new Set(draft.agentIds), total =
|
|
2697
|
+
const world = selectedWorld(), selected = new Set(draft.agentIds), total = count3();
|
|
2610
2698
|
const pending = !!draft.pendingSubmission, uncertain = !!draft.submissionUncertain;
|
|
2611
2699
|
node.innerHTML = `<div class="flow-error group-flow-error" role="alert" ${error ? "" : "hidden"}>${h(error)}</div>${pending || uncertain ? '<p class="hint" role="status">We could not confirm whether this run started. Retry the same request to avoid creating a duplicate.</p>' : ""}${draft.step === "review" ? `<form id="group-run-form"><section class="group-review"><h2>${h(draft.name || "Agent comparison")}</h2><div class="group-review-summary"><strong>${draft.agentIds.length} agents</strong><span>${h(world?.name ?? "Shared world")} \xB7 revision ${h(world?.revision ?? "unselected")}</span></div><div class="group-review-agents">${options.agents.filter((a) => selected.has(a.id)).map((a) => `<span>${h(a.name)}</span>`).join("")}</div>${draft.tasks.map((task, index) => `<div class="review-task"><span class="muted">Task ${index + 1}</span><p>${h(task.prompt)}</p><span>${task.attempts} trials \xB7 ${timeLimit(task.timeoutMs)}</span></div>`).join("")}<div class="flow-footer"><span>${total} trials \xB7 up to ${Math.min(Number(draft.concurrency), total)} requested at once</span>${pending || uncertain ? "" : `<button type="button" data-group="back">Edit</button>`}<button type="submit" class="primary" ${saving || uncertain ? "disabled" : ""}>${pending ? "Retry same request" : "Start group run"}</button></div></section></form>` : `<form id="group-run-form"><section class="group-section"><label>Run name<input name="name" value="${h(draft.name)}" maxlength="120" required></label><fieldset class="group-agent-select"><legend>Agents</legend>${options.agents.map((agent) => `<label class="group-agent-choice"><input type="checkbox" name="agentIds" value="${h(agent.id)}" ${selected.has(agent.id) ? "checked" : ""}><span><strong>${h(agentLabel(agent, options.agents))}</strong></span></label>`).join("")}</fieldset><label>Shared world<select name="worldId" required><option value="">Choose a world</option>${options.worlds.map((w) => `<option value="${h(w.id)}" ${w.id === draft.worldId ? "selected" : ""}>${h(w.name)} \xB7 revision ${h(w.revision)}</option>`).join("")}</select></label>${options.worlds.length ? "" : '<p class="quiet-empty">Create a world from an agent\u2019s New test flow before starting a group run.</p>'}</section><section class="group-section"><div class="section-title"><h2>Tasks</h2><button type="button" data-group="add-task">Add task</button></div><div id="group-task-editors">${taskFields(draft.tasks)}</div><div class="task-start-bar"><label>Run at once<input name="concurrency" type="number" min="1" max="10" value="${h(draft.concurrency)}" required></label><span id="group-attempt-count">${total} trials across ${draft.agentIds.length} agents</span><button type="submit" class="primary" ${options.agents.length < 2 || options.worlds.length === 0 ? "disabled" : ""}>Review</button></div></section></form>`}`;
|
|
2612
2700
|
}
|
|
@@ -2795,8 +2883,8 @@ function toolTiles(tools, filters = {}, worlds2 = []) {
|
|
|
2795
2883
|
function toolsCatalog(tools, filters = {}, worlds2 = []) {
|
|
2796
2884
|
const categories = [...new Set(filteredTools(tools).map((t) => toolCategory[t.name] ?? "Tool"))];
|
|
2797
2885
|
return `<section class="tools-catalog k-stack" aria-label="Tool catalog"><div class="k-head"><h2 class="k-h2">Mock tools \xB7 ${tools.length}</h2><label class="mock-tool-search"><span class="sr-only">Search tools</span><input class="k-field" id="tools-search" type="search" placeholder="Search name, category or description" value="${h(filters.q ?? "")}"></label></div><div class="k-seg" role="group" aria-label="Tool category">${["", ...categories].map((category) => {
|
|
2798
|
-
const
|
|
2799
|
-
return `<button type="button" data-tool-category="${h(category)}" aria-pressed="${(filters.category ?? "") === category}">${h(category || "All")} <span class="k-count">${
|
|
2886
|
+
const count3 = category ? tools.filter((t) => (toolCategory[t.name] ?? "Tool") === category).length : tools.length;
|
|
2887
|
+
return `<button type="button" data-tool-category="${h(category)}" aria-pressed="${(filters.category ?? "") === category}">${h(category || "All")} <span class="k-count">${count3}</span></button>`;
|
|
2800
2888
|
}).join("")}</div><p class="tools-result-count k-meta" role="status">${filteredTools(tools, filters).length} of ${tools.length} tools</p><div id="tool-tiles">${toolTiles(tools, filters, worlds2)}</div></section>`;
|
|
2801
2889
|
}
|
|
2802
2890
|
function toolEndpoints(coverage) {
|
|
@@ -2861,7 +2949,7 @@ function comparisonSetup(runId, runs) {
|
|
|
2861
2949
|
function comparisonResults(result, labels) {
|
|
2862
2950
|
const percent2 = (rate) => `${(rate * 100).toLocaleString("en-US", { maximumFractionDigits: 1 })}%`;
|
|
2863
2951
|
const change = (delta) => delta === 0 ? "No change" : Math.abs(delta * 100) < 0.1 ? `${delta > 0 ? "Increase" : "Decrease"} under 0.1 percentage points` : `${delta > 0 ? "+" : "\u2212"}${Math.abs(delta * 100).toLocaleString("en-US", { maximumFractionDigits: 1 })} percentage points`;
|
|
2864
|
-
const attempts = (
|
|
2952
|
+
const attempts = (count3) => `${count3} ${count3 === 1 ? "attempt" : "attempts"}`;
|
|
2865
2953
|
return `<p>${result.regressed ? "Pass rate decreased in one or more scenarios." : "No decrease in pass rate."}</p><div class="table-wrap comparison-table"><table><thead><tr><th scope="col">Scenario</th><th scope="col">Before</th><th scope="col">After</th><th scope="col">Change</th></tr></thead><tbody>${result.scenes.map((s, index) => `<tr><th scope="row">${h(labels[s.sceneId] ?? `Scenario ${index + 1}`)}</th><td><strong>${percent2(s.before)}</strong><span class="comparison-attempts">${attempts(s.beforeTrials)}</span></td><td><strong>${percent2(s.after)}</strong><span class="comparison-attempts">${attempts(s.afterTrials)}</span></td><td>${badge(change(s.delta), s.delta > 0 ? "good" : s.delta < 0 ? "bad" : "")}</td></tr>`).join("")}</tbody></table></div><p class="hint">Observed pass rates; no claim of statistical significance.</p>${details("Comparison details", result)}`;
|
|
2866
2954
|
}
|
|
2867
2955
|
function dataSelection(item) {
|
|
@@ -3423,13 +3511,13 @@ function updateTaskCount() {
|
|
|
3423
3511
|
const form = document.querySelector("#playground-form");
|
|
3424
3512
|
if (!form) return;
|
|
3425
3513
|
rememberDraft();
|
|
3426
|
-
const draft = agentDraft(form.dataset.agent),
|
|
3514
|
+
const draft = agentDraft(form.dataset.agent), count3 = draft.tasks.reduce((n, t) => n + (Number.isFinite(t.attempts) ? t.attempts : 0), 0);
|
|
3427
3515
|
const summary = document.querySelector("#task-count");
|
|
3428
|
-
if (summary) summary.textContent = `${
|
|
3516
|
+
if (summary) summary.textContent = `${count3} ${count3 === 1 ? "trial" : "trials"} \xB7 ${Math.min(draft.concurrency, count3)} at a time`;
|
|
3429
3517
|
const submit = form.querySelector("button[type=submit]");
|
|
3430
|
-
if (submit) submit.disabled = !playgroundReadiness.ready || !configuredTools().length ||
|
|
3518
|
+
if (submit) submit.disabled = !playgroundReadiness.ready || !configuredTools().length || count3 < 1 || count3 > 100;
|
|
3431
3519
|
const limit = document.querySelector("#task-limit");
|
|
3432
|
-
if (limit) limit.textContent =
|
|
3520
|
+
if (limit) limit.textContent = count3 > 100 ? "Use at most 100 trials per run." : "";
|
|
3433
3521
|
}
|
|
3434
3522
|
function taskInputFields(input) {
|
|
3435
3523
|
const kind = input?.kind ?? "";
|
|
@@ -3855,8 +3943,8 @@ function setupData() {
|
|
|
3855
3943
|
function updateRunCount() {
|
|
3856
3944
|
const form = document.querySelector("#test-form");
|
|
3857
3945
|
if (!form) return;
|
|
3858
|
-
const values = new FormData(form),
|
|
3859
|
-
document.querySelector("#run-count").textContent = `${
|
|
3946
|
+
const values = new FormData(form), count3 = 1 + values.getAll("extraScenes").length, repeats = Number(values.get("trials") || 1), parallel = Number(values.get("parallel") || 1);
|
|
3947
|
+
document.querySelector("#run-count").textContent = `${count3 * repeats} ${count3 * repeats === 1 ? "attempt" : "attempts"}${count3 > 1 ? ` across ${count3} scenarios` : ""}${count3 * repeats > 1 ? ` \xB7 up to ${parallel} at a time` : ""}`;
|
|
3860
3948
|
}
|
|
3861
3949
|
async function testForm(selected = "", preferred = selectedAgent) {
|
|
3862
3950
|
boot = await api("/bootstrap");
|