@ancha-labs/cli 0.4.24 → 0.4.25

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.
@@ -20,8 +20,8 @@ var time = (value) => {
20
20
  var rows = (data, key) => Array.isArray(data[key]) ? data[key] : [];
21
21
  function table(data, fields2) {
22
22
  if (!data.length) return empty("No records at this point.");
23
- const keys = fields2 ?? [...new Set(data.flatMap((d) => Object.keys(d)))].slice(0, 7);
24
- return `<div class="table-wrap"><table><thead><tr>${keys.map((k) => `<th>${h(k.replaceAll("_", " "))}</th>`).join("")}</tr></thead><tbody>${data.map((d) => `<tr>${keys.map((k) => `<td>${typeof d[k] === "object" && d[k] !== null ? `<span class="mono">${json(d[k])}</span>` : ["at", "evaluated_at", "created_at"].includes(k) && d[k] != null ? `<time title="${h(d[k])}">${h(time(d[k]))}</time>` : h(d[k])}</td>`).join("")}</tr>`).join("")}</tbody></table></div>`;
23
+ const keys2 = fields2 ?? [...new Set(data.flatMap((d) => Object.keys(d)))].slice(0, 7);
24
+ return `<div class="table-wrap"><table><thead><tr>${keys2.map((k) => `<th>${h(k.replaceAll("_", " "))}</th>`).join("")}</tr></thead><tbody>${data.map((d) => `<tr>${keys2.map((k) => `<td>${typeof d[k] === "object" && d[k] !== null ? `<span class="mono">${json(d[k])}</span>` : ["at", "evaluated_at", "created_at"].includes(k) && d[k] != null ? `<time title="${h(d[k])}">${h(time(d[k]))}</time>` : h(d[k])}</td>`).join("")}</tr>`).join("")}</tbody></table></div>`;
25
25
  }
26
26
  function named(scene, ref2) {
27
27
  if (typeof ref2 !== "string") return "";
@@ -86,8 +86,8 @@ function connectionSetup(scene, index) {
86
86
  }
87
87
  function checks(checks2, manual = false) {
88
88
  return `<h2>${manual ? "Current conditions" : "Results"}</h2>${checks2.map((c) => {
89
- const status = c.status === "skipped" ? "Skipped" : c.error ? "Evaluation error" : c.passed ? "Satisfied" : "Unmet";
90
- return `<article class="check"><div class="row">${badge(status, c.passed ? "good" : c.error ? "bad" : "warn")}<strong>${h(c.id)}</strong>${badge(c.required ? "Required" : "Advisory")}</div><p>${h(c.explanation ?? c.warning ?? "")}</p><dl><dt>Expected</dt><dd>${h(c.expected)}</dd><dt>Observed</dt><dd>${h(c.actual)}</dd></dl>${c.error ? `<p class="error">${h(c.error)}</p>` : ""}${c.warning ? `<p class="hint">${h(c.warning)}</p>` : ""}${c.evidence?.length ? `<p class="hint">Evidence ${c.evidence.map((seq) => button(`#${seq}`, "evidence", String(seq), "link")).join(" ")}</p>` : ""}</article>`;
89
+ const status2 = c.status === "skipped" ? "Skipped" : c.error ? "Evaluation error" : c.passed ? "Satisfied" : "Unmet";
90
+ return `<article class="check"><div class="row">${badge(status2, c.passed ? "good" : c.error ? "bad" : "warn")}<strong>${h(c.id)}</strong>${badge(c.required ? "Required" : "Advisory")}</div><p>${h(c.explanation ?? c.warning ?? "")}</p><dl><dt>Expected</dt><dd>${h(c.expected)}</dd><dt>Observed</dt><dd>${h(c.actual)}</dd></dl>${c.error ? `<p class="error">${h(c.error)}</p>` : ""}${c.warning ? `<p class="hint">${h(c.warning)}</p>` : ""}${c.evidence?.length ? `<p class="hint">Evidence ${c.evidence.map((seq) => button(`#${seq}`, "evidence", String(seq), "link")).join(" ")}</p>` : ""}</article>`;
91
91
  }).join("") || empty("No evaluated conditions available.")}`;
92
92
  }
93
93
  function timeline(o, filter2 = "all", selected) {
@@ -650,6 +650,62 @@ function countAttempts(attempts, requested, graded) {
650
650
  return counts;
651
651
  }
652
652
 
653
+ // cloud/shared/repair-status.mjs
654
+ var integer = (value) => Number.isSafeInteger(value) && value >= 0;
655
+ var keys = (value, names) => value && typeof value === "object" && !Array.isArray(value) && Object.keys(value).length === names.length && names.every((name) => Object.hasOwn(value, name));
656
+ var countKeys = ["requested", "completed", "valid", "invalid", "skipped"];
657
+ var checkKeys = ["check", "production", "passed", "total", "invalid", "skipped"];
658
+ function validRepairEvidence(evidence) {
659
+ if (!keys(evidence, [...countKeys, "checks"]) || !countKeys.every((key) => integer(evidence[key])) || evidence.completed > evidence.requested || evidence.valid + evidence.invalid + evidence.skipped !== evidence.completed || !Array.isArray(evidence.checks)) return false;
660
+ const names = /* @__PURE__ */ new Set();
661
+ return evidence.checks.every((check) => {
662
+ if (!keys(check, checkKeys) || typeof check.check !== "string" || !check.check || names.has(check.check) || !["passed", "failed", "unknown"].includes(check.production) || !["passed", "total", "invalid", "skipped"].every((key) => integer(check[key])) || check.passed + check.invalid + check.skipped > check.total || check.total > evidence.requested) return false;
663
+ names.add(check.check);
664
+ return true;
665
+ });
666
+ }
667
+ var status = (kind, label2, tone2 = "neutral") => ({ kind, label: label2, tone: tone2 });
668
+ var incomplete = () => status("incomplete", "Comparison incomplete");
669
+ var original = () => status("not-reproduced", "Original failure not reproduced");
670
+ var legacy = {
671
+ reproduced: ["Same failure", "fail"],
672
+ partly: ["Partly the same", "fail"],
673
+ crashed: ["Agent crashed", "fail"],
674
+ matches: ["Matches production", "pass"],
675
+ differs: ["New failure", "warn"],
676
+ unknown: ["Production ungraded", "neutral"],
677
+ ungraded: ["Not compared", "neutral"]
678
+ };
679
+ function repairStatus(row2) {
680
+ const evidence = row2?.repairEvidence;
681
+ if (evidence !== void 0) {
682
+ if (!validRepairEvidence(evidence) || row2.error !== void 0 || evidence.requested === 0 || evidence.completed !== evidence.requested || evidence.valid !== evidence.requested || evidence.invalid !== 0 || evidence.skipped !== 0 || evidence.checks.some((check) => check.total !== evidence.requested || check.invalid !== 0 || check.skipped !== 0)) return incomplete();
683
+ const failed = evidence.checks.filter((check) => check.production === "failed");
684
+ if (row2.verdict !== "crashed" && failed.length && failed.every((check) => check.passed === evidence.requested)) {
685
+ return evidence.checks.every((check) => check.passed === evidence.requested) ? status("fixed", "Fixed", "pass") : status("other-checks-failed", "Original failure cleared \xB7 Other checks failed", "warn");
686
+ }
687
+ }
688
+ if (row2?.verdict === "not-reproduced") return original();
689
+ const [label2, tone2] = Object.hasOwn(legacy, row2?.verdict) ? legacy[row2.verdict] : ["Not compared", "neutral"];
690
+ return status(row2?.verdict ?? "ungraded", label2, tone2);
691
+ }
692
+ function productionStatus(reproduction) {
693
+ const rows3 = Array.isArray(reproduction) ? reproduction.filter((row2) => row2 && typeof row2 === "object") : [];
694
+ if (!rows3.length) return void 0;
695
+ const states = rows3.map(repairStatus);
696
+ if (states.length === 1) return states[0];
697
+ if (states.some((state) => state.kind === "incomplete")) return incomplete();
698
+ const again = states.filter((state) => ["reproduced", "partly", "crashed"].includes(state.kind)).length;
699
+ if (again) return status("reproduced", `${again} of ${rows3.length} fail again`, "fail");
700
+ if (states.some((state) => state.kind === "other-checks-failed")) return status("other-checks-failed", "Original failure cleared \xB7 Other checks failed", "warn");
701
+ const differs = states.filter((state) => state.kind === "differs").length;
702
+ if (differs) return status("differs", `${differs} new ${differs === 1 ? "failure" : "failures"}`, "warn");
703
+ if (states.some((state) => state.kind === "not-reproduced")) return original();
704
+ if (states.some((state) => !["fixed", "matches"].includes(state.kind))) return status("ungraded", "Not compared");
705
+ const fixed = states.filter((state) => state.kind === "fixed").length;
706
+ return fixed ? status("fixed", `${fixed} of ${rows3.length} fixed`, "pass") : status("matches", "Matches production", "pass");
707
+ }
708
+
653
709
  // frontend/src/runs-page.ts
654
710
  function starterHtml(run) {
655
711
  const by = run.startedBy ?? run.origin?.startedBy;
@@ -704,18 +760,8 @@ function runTitle(run) {
704
760
  }
705
761
  var productionBadge = (text2, tone2 = "neutral") => `<span class="k-badge ${tone2 === "pass" ? "pass" : tone2 === "fail" ? "fail" : tone2 === "warn" ? "none" : ""}">${h(text2)}</span>`;
706
762
  function productionTag(reproduction) {
707
- const rows3 = Array.isArray(reproduction) ? reproduction.filter((r) => r && typeof r === "object") : [];
708
- if (!rows3.length) return "";
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");
711
- if (rows3.length === 1) {
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"];
713
- return productionBadge(text2, tone2);
714
- }
715
- if (again) return productionBadge(`${again} of ${rows3.length} fail again`, "fail");
716
- if (differs) return productionBadge(`${differs} new ${differs === 1 ? "failure" : "failures"}`, "warn");
717
- if (fixed) return productionBadge(`${fixed} of ${rows3.length} fixed`, "pass");
718
- return count3("matches") === rows3.length ? productionBadge("Matches production", "pass") : productionBadge("Not compared", "neutral");
763
+ const status2 = productionStatus(reproduction);
764
+ return status2 ? productionBadge(status2.label, status2.tone) : "";
719
765
  }
720
766
  function baselineNote(run) {
721
767
  const comparison = run.comparison;
@@ -767,7 +813,7 @@ function row(item, now, compared, references) {
767
813
  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);
768
814
  const pending = item.status === "queued" ? queueLabel(run.queue) || "Queued" : item.status === "running" ? "Graded as attempts finish" : "";
769
815
  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>`;
816
+ 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 k-clamp" 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>`;
771
817
  }
772
818
  function runsTable(runs, options = {}) {
773
819
  const now = options.now ?? Date.now(), compared = runs.some((run) => baselineNote(run));
@@ -794,8 +840,8 @@ function runsPage(runs, filters, options = {}) {
794
840
  const commits = values((item) => item.run.origin?.commit, filters.commit);
795
841
  const named2 = filters.agent ? all.find((item) => item.run.agentId === filters.agent)?.agent : void 0;
796
842
  const agentChoices = values((item) => item.agent, named2 ? void 0 : filters.agent).map((v) => [v === named2 ? filters.agent : v, v]);
797
- const legacy = ["range"].filter((key) => filters[key]).map((key) => `<input type="hidden" name="${key}" value="${h(filters[key])}">`).join("");
798
- const bar = `<form class="runs-filters k-filters" aria-label="Filter runs" role="search">${legacy}<input class="k-field grow" aria-label="Search runs" type="search" name="q" value="${h(filters.q ?? "")}" placeholder="Search by request, test or run id" data-run-search>` + select("agent", "Agent", agentChoices, "All agents") + select("result", "Result", RESULT_ORDER.filter((kind) => all.some((item) => item.status === kind) || filters.result === kind).map((kind) => [kind, statusLabel(kind)]), "Any result") + select("where", "Where", values((item) => item.where, filters.where).map((v) => [v, WHERE[v] ?? v]), "Anywhere") + select("source", "Source", values((item) => item.run.origin?.source, filters.source).map((v) => [v, SOURCES[v] ?? v]), "Any source") + select("target", "Target", values((item) => item.run.origin?.target, filters.target).map((v) => [v, TARGETS[v] ?? v]), "Any target") + (commits.length ? select("commit", "Commit", commits.map((v) => [v, v.slice(0, 7)]), "Any commit") : "") + "</form>";
843
+ const legacy2 = ["range"].filter((key) => filters[key]).map((key) => `<input type="hidden" name="${key}" value="${h(filters[key])}">`).join("");
844
+ const bar = `<form class="runs-filters k-filters" aria-label="Filter runs" role="search">${legacy2}<input class="k-field grow" aria-label="Search runs" type="search" name="q" value="${h(filters.q ?? "")}" placeholder="Search by request, test or run id" data-run-search>` + select("agent", "Agent", agentChoices, "All agents") + select("result", "Result", RESULT_ORDER.filter((kind) => all.some((item) => item.status === kind) || filters.result === kind).map((kind) => [kind, statusLabel(kind)]), "Any result") + select("where", "Where", values((item) => item.where, filters.where).map((v) => [v, WHERE[v] ?? v]), "Anywhere") + select("source", "Source", values((item) => item.run.origin?.source, filters.source).map((v) => [v, SOURCES[v] ?? v]), "Any source") + select("target", "Target", values((item) => item.run.origin?.target, filters.target).map((v) => [v, TARGETS[v] ?? v]), "Any target") + (commits.length ? select("commit", "Commit", commits.map((v) => [v, v.slice(0, 7)]), "Any commit") : "") + "</form>";
799
845
  const meta = range ? `${inRange.length} in the last ${RANGES[range][0].replace(" h", " hours").replace(" d", " days")}` : `${all.length} ${all.length === 1 ? "run" : "runs"}`;
800
846
  const filtered = Boolean(query || filters.agent || filters.result || filters.where || filters.commit || filters.source || filters.target);
801
847
  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>";
@@ -826,7 +872,7 @@ var usableMs = (value) => {
826
872
  var ordered = (values, key) => values.slice().sort((a, b) => (milliseconds(a[key]) || 0) - (milliseconds(b[key]) || 0));
827
873
  var pill = (value, tone2 = "") => `<span class="pill ${h(tone2)}">${h(value)}</span>`;
828
874
  var empty2 = (value) => `<p class="muted experience-empty">${h(value)}</p>`;
829
- var heading = (name, context = "", status = "") => `<header class="tool-title"><div><h2>${h(name)}</h2>${context ? `<span class="muted">${h(context)}</span>` : ""}</div>${status}</header>`;
875
+ var heading = (name, context = "", status2 = "") => `<header class="tool-title"><div><h2>${h(name)}</h2>${context ? `<span class="muted">${h(context)}</span>` : ""}</div>${status2}</header>`;
830
876
  function href(base, query) {
831
877
  const safe = base.startsWith("/") && !base.startsWith("//") || base.startsWith("?") ? base : "";
832
878
  const [pathname, search = ""] = safe.split("?");
@@ -1019,8 +1065,8 @@ function githubView(o, options) {
1019
1065
  const issue = list2(s.issues).find((i) => same(i.repo_id, r.id) && same(i.number, p.number));
1020
1066
  return `<article class="tool-change"><div class="row"><strong>#${h(p.number)} ${h(text(issue?.title) || "Pull request")}</strong>${pill(p.merged ? "Merged" : text(issue?.state) || "Open", p.merged ? "good" : "")}</div>${issue?.body ? `<p>${h(readable(issue.body))}</p>` : ""}${configuration(s, p.head_sha, p.base_sha)}</article>`;
1021
1067
  }).join("")}` : empty2("No pull requests in the captured data.")}${deployments.length ? `<h3 class="tool-section-title">Deployments</h3><ol class="event-list tool-events">${deployments.map((d) => {
1022
- const status = ordered(list2(s.deployment_statuses).filter((v) => same(v.deployment_id, d.id)), "created_at").at(-1);
1023
- return `<li><time>${h(at(d.created_at))}</time><span>${h(text(d.environment) || "Deployment")} \xB7 ${h(text(status?.state) || "Status not captured")}${status?.description ? ` \u2014 ${h(readable(status.description))}` : ""}</span></li>`;
1068
+ const status2 = ordered(list2(s.deployment_statuses).filter((v) => same(v.deployment_id, d.id)), "created_at").at(-1);
1069
+ return `<li><time>${h(at(d.created_at))}</time><span>${h(text(d.environment) || "Deployment")} \xB7 ${h(text(status2?.state) || "Status not captured")}${status2?.description ? ` \u2014 ${h(readable(status2.description))}` : ""}</span></li>`;
1024
1070
  }).join("")}</ol>` : ""}</article>`;
1025
1071
  }).join("") || empty2("No repositories in the captured data.")}</section>`;
1026
1072
  }
@@ -1215,8 +1261,8 @@ function attemptResult(observation2, scene, selectedCheck, baseHref = "") {
1215
1261
  if (index == null || index < 0 || index >= checks2.length) index = firstMissed < 0 ? 0 : firstMissed;
1216
1262
  const selected = checks2[index], selectedState = checkState(selected, provisional);
1217
1263
  return `<div class="result-heading"><div><h2>${h(verdict)}</h2><span class="muted">${h(subtitle)}</span></div></div><div class="result-workspace"><nav class="check-list" aria-label="Expected outcomes">${checks2.map((c, i) => {
1218
- const status = checkState(c, provisional);
1219
- return `<a data-nav class="check-item ${i === index ? "active selected" : ""}" ${i === index ? 'aria-current="true"' : ""} href="${h(href(baseHref, { view: "result", check: c.id, tool: null, channel: null, thread: null }))}"><span class="check-mark ${h(status.tone)}" aria-label="${h(status.label)}">${status.mark}</span><span>${h(checkLabel(scene, c))}${c.required === false ? '<small class="muted">Advisory</small>' : ""}</span></a>`;
1264
+ const status2 = checkState(c, provisional);
1265
+ return `<a data-nav class="check-item ${i === index ? "active selected" : ""}" ${i === index ? 'aria-current="true"' : ""} href="${h(href(baseHref, { view: "result", check: c.id, tool: null, channel: null, thread: null }))}"><span class="check-mark ${h(status2.tone)}" aria-label="${h(status2.label)}">${status2.mark}</span><span>${h(checkLabel(scene, c))}${c.required === false ? '<small class="muted">Advisory</small>' : ""}</span></a>`;
1220
1266
  }).join("")}</nav><section class="selected-evidence" aria-label="Selected outcome evidence"><header class="tool-title"><h3>${h(checkLabel(scene, selected))}</h3>${pill(selectedState.label, selectedState.tone)}</header>${selected.error ? `<p class="error">${h(readable(selected.error))}</p>` : selected.status === "skipped" ? `<p>${h(readable(selected.warning) || "This check was not evaluated.")}</p>` : ""}<div class="evidence-surface">${checkEvidence(observation2, scene, selected, baseHref)}</div></section></div>`;
1221
1267
  }
1222
1268
 
@@ -1295,13 +1341,13 @@ function taskOutcome(attempts, checked = false, requested = attempts.length) {
1295
1341
  return { value: `${s.finished}/${s.total}`, note: s.active ? "running" : s.queued ? "queued" : s.skipped ? `finished \xB7 ${s.skipped} skipped` : checked ? "finished \xB7 not graded" : "finished \xB7 no checks", tone: "neutral" };
1296
1342
  }
1297
1343
  function executionBadge(attempt, compact = false) {
1298
- const status = String(attempt.status ?? "unavailable");
1299
- if (status === "starting") {
1344
+ const status2 = String(attempt.status ?? "unavailable");
1345
+ if (status2 === "starting") {
1300
1346
  const since = startingSince(attempt);
1301
- return `<span class="aw-execution active">${compact ? "Starting" : h(attemptLabel(status))} <span data-since="${since}">${elapsedLabel(since)}</span></span>`;
1347
+ return `<span class="aw-execution active">${compact ? "Starting" : h(attemptLabel(status2))} <span data-since="${since}">${elapsedLabel(since)}</span></span>`;
1302
1348
  }
1303
- const tone2 = status === "error" ? "error" : ["running", "starting"].includes(status) ? "active" : "neutral";
1304
- return `<span class="aw-execution ${tone2}">${h(attemptLabel(status))}</span>`;
1349
+ const tone2 = status2 === "error" ? "error" : ["running", "starting"].includes(status2) ? "active" : "neutral";
1350
+ return `<span class="aw-execution ${tone2}">${h(attemptLabel(status2))}</span>`;
1305
1351
  }
1306
1352
  function outcomeBadge(attempt) {
1307
1353
  const outcome = attemptOutcome2(attempt);
@@ -1535,8 +1581,8 @@ function capturedToolView(observation2, tool, options) {
1535
1581
  return content === unavailable ? `<p class="quiet-empty">${h(toolName(tool))} data is unavailable for this attempt.</p>` : content;
1536
1582
  }
1537
1583
  function managedResponse(attempt) {
1538
- const original = responseView(attempt);
1539
- if (typeof attempt.response !== "string" || !attempt.response.trim()) return original;
1584
+ const original2 = responseView(attempt);
1585
+ if (typeof attempt.response !== "string" || !attempt.response.trim()) return original2;
1540
1586
  let text2 = attempt.response;
1541
1587
  if (/^\s*[\[{]/.test(text2)) {
1542
1588
  try {
@@ -1548,7 +1594,7 @@ function managedResponse(attempt) {
1548
1594
  } catch {
1549
1595
  }
1550
1596
  }
1551
- return original.replace(/<div class="response-text">[\s\S]*?<\/div>/, () => `<div class="aw-markdown">${safeMarkdown(text2)}</div>`);
1597
+ return original2.replace(/<div class="response-text">[\s\S]*?<\/div>/, () => `<div class="aw-markdown">${safeMarkdown(text2)}</div>`);
1552
1598
  }
1553
1599
  function attemptKind(attempt) {
1554
1600
  const outcome = attemptOutcome2(attempt).key;
@@ -1587,8 +1633,8 @@ function gist(value, count3 = 3) {
1587
1633
  const fields2 = fieldsOf(value, count3 + 1).filter(([, v]) => v !== "");
1588
1634
  return fields2.slice(0, count3).map(([k, v]) => `${k}: ${v.length > 40 ? `${v.slice(0, 39)}\u2026` : v}`).join(", ") + (fields2.length > count3 ? ", \u2026" : "");
1589
1635
  }
1590
- var fieldList = (value) => {
1591
- const fields2 = fieldsOf(value);
1636
+ var fieldList = (value, limit = 60) => {
1637
+ const fields2 = fieldsOf(value, limit);
1592
1638
  if (!fields2.length || fields2.length === 1 && !fields2[0][0] && !fields2[0][1]) return '<p class="muted">Empty</p>';
1593
1639
  if (fields2.length === 1 && !fields2[0][0]) return `<p class="rd-text">${h(fields2[0][1])}</p>`;
1594
1640
  return `<dl class="rd-fields">${fields2.map(([k, v]) => `<dt>${h(k)}</dt><dd>${h(v)}</dd>`).join("")}</dl>`;
@@ -1608,8 +1654,8 @@ function callsSection(observation2, failing, open) {
1608
1654
  const seq = Number(t.seq), checks2 = failing.get(seq) ?? [], ms = timeOf(t.tSim), error = Boolean(t.gap || t.issue || Number(t.status) >= 400 || t.response?.ok === false);
1609
1655
  const args = t.service === "tools" ? t.request?.args : t.service === "agent" ? t.request?.output : t.request;
1610
1656
  const answer = t.service === "tools" ? t.response?.error ?? t.response?.result : t.service === "agent" ? void 0 : t.response;
1611
- const status = t.status === void 0 ? "" : `<span class="rd-code${error ? " bad" : ""}">${h(t.status)}</span>`;
1612
- return `<details class="rd-call${checks2.length ? " failing" : ""}" id="call-${h(seq)}"${seq === open ? " open" : ""}><summary><span class="num">${h(seq)}</span><span class="rd-call-name"><code>${h(callName(t))}</code>${checks2.length ? `<span class="rd-fails" title="${h(checks2.join(", "))}">fails ${checks2.length} ${checks2.length === 1 ? "check" : "checks"}</span>` : ""}</span><span class="rd-call-args">${h(gist(args)) || '<span class="muted">none</span>'}</span><span class="rd-call-answer">${status}${h(t.service === "agent" && t.path === "/done" ? "the agent ended its turn" : gist(answer))}</span><span class="rd-call-source">${h(callSource(t))}</span><span class="num rd-call-at"${Number.isFinite(ms) ? ` title="${h(utc(ms))}"` : ""}>${Number.isFinite(ms) && Number.isFinite(start) ? `+${h(duration(ms - start))}` : "\u2014"}</span></summary><div class="rd-call-body"><div><h4>Request \xB7 <code>${h(`${t.method ?? ""} ${t.path ?? ""}`.trim())}</code></h4>${fieldList(args)}</div><div><h4>Response${t.status === void 0 ? "" : ` \xB7 ${h(t.status)}`}${t.response?.source ? ` \xB7 ${h(String(t.response.source))}` : ""}</h4>${t.issue?.message ? `<p class="rd-text bad">${h(t.issue.message)}</p>` : ""}${answer === void 0 && t.service === "agent" ? '<p class="muted">The agent ended its turn.</p>' : fieldList(answer)}</div></div></details>`;
1657
+ const status2 = t.status === void 0 ? "" : `<span class="rd-code${error ? " bad" : ""}">${h(t.status)}</span>`;
1658
+ return `<details class="rd-call${checks2.length ? " failing" : ""}" id="call-${h(seq)}"${seq === open ? " open" : ""}><summary><span class="num">${h(seq)}</span><span class="rd-call-name"><code>${h(callName(t))}</code>${checks2.length ? `<span class="rd-fails" title="${h(checks2.join(", "))}">fails ${checks2.length} ${checks2.length === 1 ? "check" : "checks"}</span>` : ""}</span><span class="rd-call-args">${h(gist(args)) || '<span class="muted">none</span>'}</span><span class="rd-call-answer">${status2}${h(t.service === "agent" && t.path === "/done" ? "the agent ended its turn" : gist(answer))}</span><span class="rd-call-source">${h(callSource(t))}</span><span class="num rd-call-at"${Number.isFinite(ms) ? ` title="${h(utc(ms))}"` : ""}>${Number.isFinite(ms) && Number.isFinite(start) ? `+${h(duration(ms - start))}` : "\u2014"}</span></summary><div class="rd-call-body"><div><h4>Request \xB7 <code>${h(`${t.method ?? ""} ${t.path ?? ""}`.trim())}</code></h4>${fieldList(args)}</div><div><h4>Response${t.status === void 0 ? "" : ` \xB7 ${h(t.status)}`}${t.response?.source ? ` \xB7 ${h(String(t.response.source))}` : ""}</h4>${t.issue?.message ? `<p class="rd-text bad">${h(t.issue.message)}</p>` : ""}${answer === void 0 && t.service === "agent" ? '<p class="muted">The agent ended its turn.</p>' : fieldList(answer)}</div></div></details>`;
1613
1659
  }).join("");
1614
1660
  const head2 = `<div class="rd-calls-head" aria-hidden="true"><span>#</span><span>Call</span><span>Arguments</span><span>Response</span><span>Source</span><span>At</span></div>`;
1615
1661
  return `<section class="rd-section" id="calls" aria-label="Calls"><div class="rd-section-head"><h3>Calls</h3><span>${trace.length} ${trace.length === 1 ? "call" : "calls"}${Number.isFinite(span) && trace.length > 1 ? ` over ${h(duration(span))} of world time` : ""}${trace.length > shown.length ? ` \xB7 the first ${shown.length} shown` : ""}</span></div><div class="rd-calls-scroll"><div class="rd-calls">${head2}${rows3}</div></div></section>`;
@@ -1639,8 +1685,8 @@ function checkFields(value) {
1639
1685
  return fieldsOf(value);
1640
1686
  }
1641
1687
  function failedCheckCard(check, jump) {
1642
- const expected = new Map(checkFields(check.expected)), actual = new Map(checkFields(check.actual)), keys = [.../* @__PURE__ */ new Set([...expected.keys(), ...actual.keys()])], person2 = jump(String(check.id));
1643
- return `<section class="k-check" aria-label="${h(check.id)}"><header class="k-check-head"><span>${resultIcon("failed")}${h(check.id)}</span>${check.kind ? `<span class="k-badge">${check.kind === "judge" ? "AI judge" : "Rule"}</span>` : ""}${check.required === false ? '<span class="k-badge">Optional</span>' : ""}</header><table class="k-fields"><thead><tr><th>Field</th><th>Expected</th><th>Got</th></tr></thead><tbody>${keys.map((key) => `<tr><td>${h(key || "Result")}</td><td>${h(expected.get(key) ?? "\u2014")}</td><td${expected.get(key) !== actual.get(key) ? ' class="off"' : ""}>${h(actual.get(key) ?? "\u2014")}</td></tr>`).join("")}</tbody></table>${check.explanation ? `<p>${h(check.explanation)}</p>` : ""}${person2 ? `<p>${navLink("See in the conversation", person2, "aw-check-jump")}</p>` : ""}</section>`;
1688
+ const expected = new Map(checkFields(check.expected)), actual = new Map(checkFields(check.actual)), keys2 = [.../* @__PURE__ */ new Set([...expected.keys(), ...actual.keys()])], person2 = jump(String(check.id));
1689
+ return `<section class="k-check" aria-label="${h(check.id)}"><header class="k-check-head"><span>${resultIcon("failed")}${h(check.id)}</span>${check.kind ? `<span class="k-badge">${check.kind === "judge" ? "AI judge" : "Rule"}</span>` : ""}${check.required === false ? '<span class="k-badge">Optional</span>' : ""}</header><table class="k-fields"><thead><tr><th>Field</th><th>Expected</th><th>Got</th></tr></thead><tbody>${keys2.map((key) => `<tr><td>${h(key || "Result")}</td><td>${h(expected.get(key) ?? "\u2014")}</td><td${expected.get(key) !== actual.get(key) ? ' class="off"' : ""}>${h(actual.get(key) ?? "\u2014")}</td></tr>`).join("")}</tbody></table>${check.explanation ? `<p>${h(check.explanation)}</p>` : ""}${person2 ? `<p>${navLink("See in the conversation", person2, "aw-check-jump")}</p>` : ""}${check.details ? `<details><summary>Record details</summary>${fieldList(check.details, Infinity)}</details>` : ""}</section>`;
1644
1690
  }
1645
1691
  function stepsSection(observation2, checks2, callHref, jump) {
1646
1692
  const trace = records(observation2.trace).filter((t) => t.path !== "console.manual_action").sort((a, b) => (Number(a.seq) || 0) - (Number(b.seq) || 0));
@@ -2637,8 +2683,8 @@ function groupRunDefinition(draft, agents) {
2637
2683
  return { name: String(draft.name ?? "").trim(), entries: chosen.map((agent) => ({ agentId: agent.id, worldId, worldRevision, tasks, seed: String(draft.seed ?? "group-1") })), concurrency, idempotencyKey: draft.idempotencyKey };
2638
2684
  }
2639
2685
  function submissionWasDefinitivelyRejected(error) {
2640
- const status = error && typeof error === "object" ? error.status : void 0;
2641
- return Number.isInteger(status) && Number(status) >= 400 && Number(status) < 500 && Number(status) !== 409;
2686
+ const status2 = error && typeof error === "object" ? error.status : void 0;
2687
+ return Number.isInteger(status2) && Number(status2) >= 400 && Number(status2) < 500 && Number(status2) !== 409;
2642
2688
  }
2643
2689
  var groupSubmissionWasRejected = submissionWasDefinitivelyRejected;
2644
2690
  function testRunSubmission(testId, idempotencyKey) {
@@ -2859,8 +2905,8 @@ function connectionsView(info, mode, tool) {
2859
2905
  return tabs + `<label>Tool<select id="connection-tool">${Object.keys(info.services).map((id) => `<option value="${h(id)}" ${id === tool ? "selected" : ""}>${h(toolName(id))}</option>`).join("")}</select></label><div class="connection-fields">${(fields[tool] ?? []).filter((key) => info.env[key]).map((key) => `<label>${connectionLabel(key)}<input readonly value="${h(info.env[key])}" aria-label="${h(key)}"><span class="field-variable">${h(key)}</span></label>`).join("")}</div>${tool === "google-ads" ? `<p>${button("Download TLS certificate", "download-certificate", "", "link")}</p>` : ""}<div class="actions">${button("Copy tool settings", "copy-connections", "", "primary")}${button("Download all settings", "download-connections")}</div><p class="hint">Use these local values in your tool client. Refresh the sandbox to see its changes.</p>`;
2860
2906
  }
2861
2907
  function connectionText(info, tool) {
2862
- const keys = tool ? fields[tool] ?? [] : Object.keys(info.env);
2863
- return keys.filter((key) => info.env[key] !== void 0).map((key) => `${key}=${JSON.stringify(info.env[key])}`).join("\n") + "\n";
2908
+ const keys2 = tool ? fields[tool] ?? [] : Object.keys(info.env);
2909
+ return keys2.filter((key) => info.env[key] !== void 0).map((key) => `${key}=${JSON.stringify(info.env[key])}`).join("\n") + "\n";
2864
2910
  }
2865
2911
 
2866
2912
  // frontend/src/tools-page.ts
@@ -2919,8 +2965,8 @@ function settingsPage(boot2) {
2919
2965
  // frontend/src/journey.ts
2920
2966
  function connectionStatus(verification) {
2921
2967
  if (!verification) return badge("Not checked");
2922
- const status = verification.status;
2923
- return badge(status === "connected" || status === "verified" ? "Connected" : status === "running" ? "Connecting" : status === "failed" ? "Connection failed" : status === "stale" ? "Needs recheck" : "Not checked", status === "connected" || status === "verified" ? "good" : status === "failed" ? "bad" : "warn");
2968
+ const status2 = verification.status;
2969
+ return badge(status2 === "connected" || status2 === "verified" ? "Connected" : status2 === "running" ? "Connecting" : status2 === "failed" ? "Connection failed" : status2 === "stale" ? "Needs recheck" : "Not checked", status2 === "connected" || status2 === "verified" ? "good" : status2 === "failed" ? "bad" : "warn");
2924
2970
  }
2925
2971
  function scenarioList(scenes) {
2926
2972
  return `<div class="scenario-list">${scenes.map((s) => `<a class="scenario-row" href="/scenarios/${encodeURIComponent(s.key)}" data-nav><div><h2>${h(title(s.scene))}</h2><p>${h(s.scene.twins.map(toolName).join(" \xB7 "))}</p></div>${s.origin === "draft" ? badge("Draft \xB7 unverified") : ""}<span aria-hidden="true">\u2192</span></a>`).join("")}</div>`;
@@ -3576,11 +3622,11 @@ function renderAgents(id) {
3576
3622
  selectedAgent = "agent:" + a.id;
3577
3623
  const q = new URLSearchParams(location.search), page = q.get("tab") ?? "overview", base = "/agents/" + enc2(a.id);
3578
3624
  const operation = connectionOperation, connecting = operation?.state === "connecting", queuedConnect = operation?.state === "queued";
3579
- const status = agentConnection(a, operation).label;
3625
+ const status2 = agentConnection(a, operation).label;
3580
3626
  const primary = page === "setup" ? "" : agentPrimary(a, operation);
3581
3627
  const blocked = blockedConnect?.agentId === a.id ? blockedConnect : null;
3582
3628
  if (blocked) blockedConnect = null;
3583
- const connectionNotice = blocked ? `<div role="alert">${stateCard("Connection waiting", runnerBusyHtml(blocked.message, blocked.run), "", "queued")}</div>` : connecting || queuedConnect ? `<div class="connect-progress c-state c-state-${connecting ? "running" : "queued"}" role="status"><div>${statusMark(connecting ? "running" : "queued", status)}<p>${h(operation?.message ?? (queuedConnect ? "Waiting for another connection to finish." : ""))}</p></div>${button("Cancel", "cancel-connect", operation.id, "k-btn")}</div>` : operation?.state === "failed" ? `<div role="alert">${stateCard("Couldn\u2019t connect", h(operation.message ?? operation.error ?? "Check your settings and try again."), navLink("Edit connection", url(base, { tab: "setup" }), "k-btn"), "error")}</div>` : "";
3629
+ const connectionNotice = blocked ? `<div role="alert">${stateCard("Connection waiting", runnerBusyHtml(blocked.message, blocked.run), "", "queued")}</div>` : connecting || queuedConnect ? `<div class="connect-progress c-state c-state-${connecting ? "running" : "queued"}" role="status"><div>${statusMark(connecting ? "running" : "queued", status2)}<p>${h(operation?.message ?? (queuedConnect ? "Waiting for another connection to finish." : ""))}</p></div>${button("Cancel", "cancel-connect", operation.id, "k-btn")}</div>` : operation?.state === "failed" ? `<div role="alert">${stateCard("Couldn\u2019t connect", h(operation.message ?? operation.error ?? "Check your settings and try again."), navLink("Edit connection", url(base, { tab: "setup" }), "k-btn"), "error")}</div>` : "";
3584
3630
  let content = "";
3585
3631
  if (page === "new-test") {
3586
3632
  if (q.get("test") && !savedPlaygroundTests.some((t) => t.id === q.get("test"))) {
@@ -3866,14 +3912,14 @@ function renderAttempt(scene, trial) {
3866
3912
  const q = new URLSearchParams(location.search), base = url("/runs/" + enc2(current.runId), { scene, trial }), view2 = q.get("view") ?? "activity", tool = q.get("tool"), tools = recorded?.twins ?? Object.keys(observation.state ?? {});
3867
3913
  const o = { ...observation, checks: Array.isArray(observation.checks) ? observation.checks : observation.checks?.checks ?? [] }, diagnostic = current.metadata?.diagnostic;
3868
3914
  const tabs = navTabs([["activity", "Activity", url("/runs/" + enc2(current.runId), { scene, trial, view: "activity" })], ["sandbox", "Tools", url("/runs/" + enc2(current.runId), { scene, trial, view: "sandbox" })], ...!diagnostic ? [["result", "Outcomes", url("/runs/" + enc2(current.runId), { scene, trial, view: "result" })]] : []], view2 === "tools" ? "sandbox" : view2);
3869
- const status = legacyObservation.state === "live" ? badge("Running", "accent") : observation.entry ? attemptStatus(observation.entry, diagnostic) : badge(legacyObservation.attempt?.state ?? "Unavailable");
3915
+ const status2 = legacyObservation.state === "live" ? badge("Running", "accent") : observation.entry ? attemptStatus(observation.entry, diagnostic) : badge(legacyObservation.attempt?.state ?? "Unavailable");
3870
3916
  let content = legacyObservation.reason ? `<p class="quiet-empty">${h(legacyObservation.reason)}</p>` : "";
3871
3917
  if (legacyObservation.observation) {
3872
3918
  if (view2 === "result") content += attemptResult(o, recorded, q.get("check"), base);
3873
3919
  else if (["sandbox", "tools"].includes(view2)) content += `<nav class="tool-nav" aria-label="Trial tools">${tools.map((t) => navLink(toolName(t), url("/runs/" + enc2(current.runId), { scene, trial, view: "sandbox", tool: t }), t === (tool || tools[0]) ? "active" : "")).join("")}</nav><p class="preview-context">${legacyObservation.state === "live" ? "Current captured data" : "Captured final data"}</p>${toolView(o, tool || tools[0], { ...Object.fromEntries(q), baseHref: base })}`;
3874
3920
  else content += `${observation.taskDelivery?.response ? responseView({ response: observation.taskDelivery.response, status: legacyObservation.state === "live" ? "running" : "completed" }) : ""}${activityView(o, { baseHref: base })}`;
3875
3921
  }
3876
- shell("runs", navLink("\u2190 Run", "/runs/" + enc2(current.runId), "back") + head(`${recorded ? title(recorded) : runCaseTitle(scene)} \xB7 trial ${trial}`, current.owned ? button("Stop run", "cancel-run", current.runId) : diagnostic ? "" : button("Run again", "rerun", current.runId, "primary")) + `<p class="task-prompt">${h(recorded?.task ?? "The exact task is not available in this saved result.")}</p><div class="batch-progress">${status}</div>${tabs}<div id="attempt-evidence">${content}</div>`);
3922
+ shell("runs", navLink("\u2190 Run", "/runs/" + enc2(current.runId), "back") + head(`${recorded ? title(recorded) : runCaseTitle(scene)} \xB7 trial ${trial}`, current.owned ? button("Stop run", "cancel-run", current.runId) : diagnostic ? "" : button("Run again", "rerun", current.runId, "primary")) + `<p class="task-prompt">${h(recorded?.task ?? "The exact task is not available in this saved result.")}</p><div class="batch-progress">${status2}</div>${tabs}<div id="attempt-evidence">${content}</div>`);
3877
3923
  }
3878
3924
  function modal(heading2, content, wide = false) {
3879
3925
  dialog.className = wide ? "wide" : "";
@@ -3892,16 +3938,16 @@ function executionFields(policy = { mode: "container", image: "node:24-slim" },
3892
3938
  return `<input type="hidden" name="originalExecutionImage" value="${h(policy.image ?? "")}"><input type="hidden" name="originalExecutionPreparation" value="${h(policy.preparation ?? "")}"><label>Execution<select id="execution-mode" name="executionMode">${fromConfig ? '<option value="config" selected>Use configuration file</option>' : ""}<option value="container" ${contained ? "selected" : ""}>Container</option><option value="host" ${mode === "host" ? "selected" : ""}>Host process \xB7 not contained</option></select></label><p class="hint" id="execution-detail">${mode === "config" ? "Uses agent.execution from the file; omitted means host process." : contained ? "Fresh container for every trial." : "Runs on this computer with access to its files and network."}</p><div id="container-fields" ${contained ? "" : "hidden"}><p class="hint" id="execution-runtime" role="status">Checking container runtime\u2026</p><label>Linux image<input name="executionImage" placeholder="e.g. my-agent:latest" value="${h(policy.image ?? "")}" ${contained ? "required" : "disabled"}></label><p class="hint">The image must include your agent\u2019s Linux dependencies.</p><label>Project paths<input name="executionFiles" value="${h((policy.files ?? ["."]).join(", "))}" ${contained ? "" : "disabled"}></label><p class="hint">Comma-separated paths. Credentials and local dependencies are excluded.</p><div class="form-grid"><label>Credentials to pass<input name="executionEnv" placeholder="OPENROUTER_API_KEY" value="${h((policy.env ?? []).join(", "))}" ${contained ? "" : "disabled"}></label><label>Allowed model domains<input name="executionHosts" placeholder="openrouter.ai" value="${h((policy.modelHosts ?? []).join(", "))}" ${contained ? "" : "disabled"}></label></div><p class="hint">Variable names only. Exact domains; all other internet access is blocked.</p><input type="hidden" name="executionCpus" value="${h(policy.cpus ?? 1)}"><input type="hidden" name="executionMemory" value="${h(policy.memoryMb ?? 512)}"><input type="hidden" name="executionPids" value="${h(policy.pids ?? 128)}"></div>`;
3893
3939
  }
3894
3940
  async function executionRuntime() {
3895
- const status = document.querySelector("#execution-runtime");
3896
- if (!status) return;
3941
+ const status2 = document.querySelector("#execution-runtime");
3942
+ if (!status2) return;
3897
3943
  try {
3898
3944
  const runtime = await api("/execution");
3899
- if (status.isConnected) {
3900
- status.textContent = runtime.available ? "Container runtime ready" : runtime.message;
3901
- status.classList.toggle("error", !runtime.available);
3945
+ if (status2.isConnected) {
3946
+ status2.textContent = runtime.available ? "Container runtime ready" : runtime.message;
3947
+ status2.classList.toggle("error", !runtime.available);
3902
3948
  }
3903
3949
  } catch {
3904
- if (status.isConnected) status.textContent = "Container runtime could not be checked. Runs require a ready runtime.";
3950
+ if (status2.isConnected) status2.textContent = "Container runtime could not be checked. Runs require a ready runtime.";
3905
3951
  }
3906
3952
  }
3907
3953
  function executionValue(data) {
@@ -943,6 +943,8 @@ button.k-name{all:unset;cursor:pointer;font-weight:500;color:var(--k-ink);overfl
943
943
  button.k-name:focus-visible{outline:2px solid var(--k-ink);outline-offset:2px;border-radius:4px}
944
944
  .k-table a.k-quiet{color:var(--k-mid);text-decoration:none}.k-table a.k-quiet:hover{color:var(--k-ink);text-decoration:underline}
945
945
  .k-id{font-family:var(--k-mono);font-size:12.5px;color:var(--k-mid)}
946
+ /* At most two lines of a long value (a multi-line agent command); the whole value is in its title. */
947
+ .k-clamp{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;overflow-wrap:anywhere}
946
948
 
947
949
  /* Badges (radius 4) and status icons: pass with a check, fail with an ×, no result with a !. */
948
950
  .k-badge{display:inline-flex;align-items:center;gap:5px;padding:3px 8px;border-radius:4px;background:var(--k-neutral-tint);color:var(--k-soft);font-size:12px;font-weight:600;line-height:1.35;white-space:nowrap;vertical-align:middle}
package/lib/mcp-entry.mjs CHANGED
@@ -57470,12 +57470,33 @@ var AnswerNumberSchema = external_exports.strictObject({
57470
57470
  tolerance: external_exports.number().nonnegative().optional().describe("How far the stated number may be from value; default: half the last decimal place of value (1200.00 \u2192 0.005, 1240.5 \u2192 0.05, 1200 \u2192 0.5)")
57471
57471
  });
57472
57472
  var texts = external_exports.union([external_exports.string().min(1), external_exports.array(external_exports.string().min(1)).min(1)]);
57473
+ var AnswerRowSchema = external_exports.record(external_exports.string().min(1), external_exports.union([external_exports.string(), external_exports.number(), external_exports.boolean(), external_exports.null()])).superRefine((row, ctx) => {
57474
+ if (!Object.keys(row).length) ctx.addIssue({ code: "custom", message: "a row needs at least one column" });
57475
+ if (Object.hasOwn(row, "amount_minor")) {
57476
+ if (!Number.isSafeInteger(row.amount_minor)) ctx.addIssue({ code: "custom", path: ["amount_minor"], message: "amount_minor must be a safe integer in minor units" });
57477
+ if (typeof row.currency !== "string" || !/^[A-Z]{3}$/.test(row.currency)) ctx.addIssue({ code: "custom", path: ["currency"], message: "amount_minor requires an explicit three-letter uppercase currency" });
57478
+ }
57479
+ });
57480
+ var AnswerRowsSchema = external_exports.strictObject({
57481
+ field: external_exports.string().min(1).describe("The top-level answer field containing the rows"),
57482
+ expected: external_exports.array(AnswerRowSchema).describe("Exact rows, compared as an unordered multiset with exact columns and values")
57483
+ }).superRefine(({ expected }, ctx) => {
57484
+ const columns = JSON.stringify(Object.keys(expected[0] ?? {}).sort());
57485
+ expected.forEach((row, i) => {
57486
+ if (JSON.stringify(Object.keys(row).sort()) !== columns) ctx.addIssue({ code: "custom", path: ["expected", i], message: "every expected row must have the same columns" });
57487
+ });
57488
+ });
57473
57489
  var AnswerCheckSchema = external_exports.strictObject({
57474
57490
  contains: texts.optional().describe("Text the final answer must contain, each piece"),
57475
57491
  not_contains: texts.optional().describe("Text the final answer must not contain"),
57476
57492
  numbers: external_exports.array(AnswerNumberSchema).min(1).optional().describe("Numbers the final answer must state, each within its tolerance; thousands separators, currency codes and symbols, minus signs and parentheses for negatives are read"),
57477
- case: external_exports.enum(["insensitive", "sensitive"]).optional().describe("How contains and not_contains compare letters; default insensitive")
57478
- }).describe("Checks the agent's final answer (what it posts to ANCHA_DONE_URL, its HTTP reply, or what it prints on stdout): the text and numbers it states");
57493
+ case: external_exports.enum(["insensitive", "sensitive"]).optional().describe("How contains and not_contains compare letters; default insensitive"),
57494
+ rows: AnswerRowsSchema.optional()
57495
+ }).superRefine((check3, ctx) => {
57496
+ if (check3.rows !== void 0) for (const key2 of ["contains", "not_contains", "numbers", "case"]) {
57497
+ if (check3[key2] !== void 0) ctx.addIssue({ code: "custom", path: [key2], message: `rows is mutually exclusive with ${key2}` });
57498
+ }
57499
+ }).describe("Checks the agent's final answer (what it posts to ANCHA_DONE_URL, its HTTP reply, or what it prints on stdout): text and numbers, or exact structured rows");
57479
57500
 
57480
57501
  // packages/core/src/duration.ts
57481
57502
  var DURATION_RE = /^(-?)(?:(\d+)d)?(?:(\d+)h)?(?:(\d+)m)?(?:(\d+)s)?(?:(\d+)ms)?$/;
@@ -58090,6 +58111,7 @@ var GitHubIssueCheckSchema = external_exports.strictObject({
58090
58111
  body_contains: textList.optional(),
58091
58112
  labels: external_exports.array(external_exports.string().min(1)).min(1).optional().describe("The issue has every one of these labels"),
58092
58113
  state: external_exports.enum(["open", "closed"]).optional(),
58114
+ state_reason: external_exports.enum(["completed", "not_planned", "duplicate", "reopened"]).nullable().optional().describe("The issue state reason, or null after clearing"),
58093
58115
  count: external_exports.number().int().min(0).optional().describe("Exactly this many issues match"),
58094
58116
  count_gte: external_exports.number().int().min(0).optional(),
58095
58117
  count_lte: external_exports.number().int().min(0).optional()
@@ -66930,6 +66952,14 @@ var NetsuiteUnchangedCheckSchema = external_exports.strictObject({
66930
66952
  except: external_exports.array(external_exports.strictObject({ type: external_exports.enum(netsuiteRecordTypes), id: id8.optional(), externalId: text11.optional() }).refine((check3) => check3.id === void 0 !== (check3.externalId === void 0), { message: "name the record with id or with externalId, not both" })).optional()
66931
66953
  });
66932
66954
  var NetsuiteCountCheckSchema = external_exports.strictObject({ type: external_exports.enum(netsuiteRecordTypes), count: external_exports.number().int().min(0), includeSettlement: external_exports.boolean().optional() });
66955
+ var NetsuitePreservedCheckSchema = external_exports.strictObject({
66956
+ type: external_exports.enum(netsuiteRecordTypes),
66957
+ id: id8,
66958
+ except_fields: external_exports.array(external_exports.string().regex(/^[A-Za-z_][A-Za-z0-9_]*$/, "name a top-level field")).refine(
66959
+ (fields3) => new Set(fields3).size === fields3.length,
66960
+ "name each field once"
66961
+ )
66962
+ });
66933
66963
 
66934
66964
  // packages/core/src/scene/schema.ts
66935
66965
  var SUPPORTED_TWINS = ["slack", "github", "datadog", "pagerduty", "linkedin-ads", "salesforce", "gong", "hubspot", "ga4", "google-ads", "chatgpt-ads", "open-meteo", "google-drive", "gmail", "amazon-s3", "linear", "okta", "stripe", "clerk", "better-stack", "notion", "attio", "dropbox", "resend", "microsoft-word", "outlook", "shopify", "lob", "paypal", "jira", "kalshi", "intercom", "zendesk", "google-calendar", "twilio", "asana", "discord", "sentry", "airtable", "netsuite", "carrier-portal"];
@@ -67072,6 +67102,7 @@ var GitHubSeedSchema = external_exports.strictObject({
67072
67102
  title: external_exports.string(),
67073
67103
  body: external_exports.string().optional(),
67074
67104
  state: external_exports.enum(["open", "closed"]).optional(),
67105
+ state_reason: external_exports.enum(["completed", "not_planned", "duplicate"]).optional().describe("Reason for a closed issue"),
67075
67106
  user: refUse3.optional().describe("Author; defaults to the GitHub bot"),
67076
67107
  labels: external_exports.array(external_exports.string()).optional(),
67077
67108
  assignees: external_exports.array(refUse3).optional().describe("Assigned GitHub users"),
@@ -67150,6 +67181,7 @@ var StateCheckSchema = external_exports.union([
67150
67181
  external_exports.strictObject({ "zendesk.unchanged": ZendeskUnchangedCheckSchema }),
67151
67182
  external_exports.strictObject({ "netsuite.record": NetsuiteRecordCheckSchema }),
67152
67183
  external_exports.strictObject({ "netsuite.unchanged": NetsuiteUnchangedCheckSchema }),
67184
+ external_exports.strictObject({ "netsuite.preserved": NetsuitePreservedCheckSchema }),
67153
67185
  external_exports.strictObject({ "netsuite.count": NetsuiteCountCheckSchema }),
67154
67186
  external_exports.strictObject({ "carrier-portal.request": CarrierRequestCheckSchema }),
67155
67187
  external_exports.strictObject({ "carrier-portal.downloaded": CarrierDownloadCheckSchema }),