@ancha-labs/cli 0.4.41 → 0.4.42
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 +9252 -8469
- package/lib/assets/docs/scenes.md +17 -0
- package/lib/assets/harbor/companion.mjs +3138 -3107
- package/lib/assets/ui/app.js +19 -2
- package/lib/mcp-entry.mjs +369 -338
- package/lib/worker.mjs +3737 -3555
- package/lib/world-server.mjs +3119 -3088
- package/package.json +1 -1
package/lib/assets/ui/app.js
CHANGED
|
@@ -21267,13 +21267,29 @@ function renderRunOverview(batch, actionsHtml = "", options = {}) {
|
|
|
21267
21267
|
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><a class="k-btn" href="/tests/edit?runId=${h(encodeURIComponent(batch.id))}&name=${h(encodeURIComponent(options.task))}">Edit</a>`;
|
|
21268
21268
|
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("");
|
|
21269
21269
|
const groups = entrySections(batch), tasks = groups.flatMap((group) => group.tasks), allAttempts = records(batch.attempts), c = runCounts(batch);
|
|
21270
|
-
|
|
21270
|
+
let 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);
|
|
21271
|
+
const families = batch.status === "completed" ? records(batch.families) : [];
|
|
21272
|
+
const familyKey = (parentId, fingerprint) => JSON.stringify([parentId, fingerprint]);
|
|
21273
|
+
const rowKey = (task) => task.variant ? familyKey(task.variant.parentId, task.variant.parentFingerprint) : void 0;
|
|
21274
|
+
const familyStarts = /* @__PURE__ */ new Map();
|
|
21275
|
+
if (families.length) {
|
|
21276
|
+
const grouped = families.flatMap((family) => {
|
|
21277
|
+
const key = familyKey(family.parentId, family.parentFingerprint);
|
|
21278
|
+
const members2 = family.rows.flatMap((member) => rows3.filter((row2) => row2.task.id === member.sceneId && rowKey(row2.task) === key));
|
|
21279
|
+
if (members2[0]) familyStarts.set(members2[0].task.id, family);
|
|
21280
|
+
return members2;
|
|
21281
|
+
});
|
|
21282
|
+
const included = new Set(grouped);
|
|
21283
|
+
rows3 = [...rows3.filter((row2) => !included.has(row2)), ...grouped];
|
|
21284
|
+
}
|
|
21271
21285
|
const hasProduction = rows3.some((row2) => reproductionOf(batch, row2.task)), baseline = baselineNote(batch);
|
|
21272
21286
|
const failed = rows3.filter((row2) => row2.attempts.some((a) => a.outcome === "failed")).length;
|
|
21273
21287
|
const noResult = rows3.filter((row2) => row2.attempts.some((a) => ["completed", "error", "stopped"].includes(a.status) && !["passed", "failed"].includes(a.outcome))).length;
|
|
21274
21288
|
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 }) => {
|
|
21275
21289
|
const outcome = taskOutcome(attempts, hasChecks([task]), Number(task.attempts) || attempts.length), reproduction = reproductionOf(batch, task);
|
|
21276
|
-
|
|
21290
|
+
const family = familyStarts.get(task.id), a = family?.attempts;
|
|
21291
|
+
const familyHeading = family && a ? `<tr data-family-row="${h(familyKey(family.parentId, family.parentFingerprint))}"><td class="wrap" colspan="${hasProduction ? 5 : 4}"><strong>Variants of ${h(family.parentId)}</strong><div class="k-meta">${family.variantsMet} of ${family.variants} variants passed \xB7 ${a.passed}/${a.requested} attempts (${family.passRate === null ? "\u2014" : `${(family.passRate * 100).toFixed(1)}%`}) \xB7 ${a.failed} failed \xB7 ${a.invalid} invalid \xB7 ${a.ungraded} ungraded \xB7 ${a.notRun} not run</div></td></tr>` : "";
|
|
21292
|
+
return `${familyHeading}<tr data-test-row${task.variant ? ` data-family-key="${h(rowKey(task))}"` : ""} data-failed="${attempts.some((a2) => a2.outcome === "failed")}" data-none="${attempts.some((a2) => ["completed", "error", "stopped"].includes(a2.status) && !["passed", "failed"].includes(a2.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(task.variant?.change ?? taskDisplayName(task, tasks.indexOf(task)))}</button>${groups.length > 1 ? `<div class="k-meta">${h(entry?.agentName ?? entry?.name ?? "")}</div>` : ""}${task.variant ? `<div class="k-id">${h(task.id)}</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((a2) => ["passed", "failed"].includes(a2.outcome)) ? `${attempts.filter((a2) => a2.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>`;
|
|
21277
21293
|
}).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>`;
|
|
21278
21294
|
}
|
|
21279
21295
|
function mountRunOverview(container, state = {}) {
|
|
@@ -21288,6 +21304,7 @@ function mountRunOverview(container, state = {}) {
|
|
|
21288
21304
|
row2.hidden = state.filter === "failed" ? row2.dataset.failed !== "true" : state.filter === "none" ? row2.dataset.none !== "true" : false;
|
|
21289
21305
|
if (!row2.hidden) count3++;
|
|
21290
21306
|
}
|
|
21307
|
+
for (const heading2 of page.querySelectorAll("[data-family-row]")) heading2.hidden = !rows3.some((row2) => row2.dataset.familyKey === heading2.dataset.familyRow && !row2.hidden);
|
|
21291
21308
|
for (const button2 of page.querySelectorAll("[data-test-filter]")) button2.setAttribute("aria-pressed", String(button2.dataset.testFilter === (state.filter ?? "all")));
|
|
21292
21309
|
page.querySelector("[data-test-empty]").hidden = count3 > 0 || rows3.length === 0;
|
|
21293
21310
|
};
|