@ancha-labs/cli 0.4.18 → 0.4.20

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.
@@ -8,7 +8,7 @@ The run says where it runs. A cloud run announces acceptance with `run_submitted
8
8
 
9
9
  ## What the agent gets
10
10
 
11
- New run summaries use `verdictVersion: 2`. Each test (an entry of `scenes`) has `counts.requested`, `completed`, `valid`, `passed`, `invalid` and `skipped`. The pass-rate denominator is the requested count, including invalid, skipped and unfinished trials. “Pass all k” requires all k requested trials to complete validly and pass. HTML and the console show invalid attempts separately. Older reports stay readable; comparison with an old baseline lacking these counts exits 2 and asks you to rerun the reference and save a fresh baseline.
11
+ New run summaries use `verdictVersion: 3`. Each test (an entry of `scenes`) has `counts.requested`, `completed`, `valid`, `passed`, `invalid` and `skipped`. The pass-rate denominator is the requested count, including invalid, skipped and unfinished trials. “Pass all k” requires all k requested trials to complete validly and pass. A test with no check evaluated is ungraded (`graded: false`); the run's verdict is `ungraded` when any test is ungraded and none failed. HTML and the console show invalid attempts separately. Older reports stay readable; comparison with an old baseline lacking these counts exits 2 and asks you to rerun the reference and save a fresh baseline.
12
12
 
13
13
  Each trial gets the tools' URLs and fake credentials (`ancha docs integrations`), `ANCHA_TASK` and `ANCHA_TASK_FILE` (a file holding the task), `ANCHA_ATTEMPT_ID`, `ANCHA_STATE_DIR` (keep memory there, so trials stay independent), `ANCHA_EVENTS_URL`, `ANCHA_EVENTS_TOKEN` and `ANCHA_DONE_URL` for agents that receive events or finish explicitly, and `ANCHA_AGENT_PORT` for HTTP agents. No SDK is installed and no paid AI call is made for you. An agent that reads its task under another name gets it with `agent.env: { MY_TASK: "{{task}}" }` (`{{task_file}}` for the file's path); `ancha init` writes that line when it finds the name in the agent's code or usage text.
14
14
 
@@ -95,7 +95,7 @@ function timeline(o, filter2 = "all", selected) {
95
95
  const manual = new Set(trace.filter((t) => t.path === "console.manual_action").flatMap((t) => t.response?.sequences ?? []));
96
96
  const source = (t) => manual.has(t.seq) || t.path === "console.manual_action" ? "manual" : t.source;
97
97
  const filtered = trace.filter((t) => filter2 === "all" || source(t) === filter2);
98
- return `<div class="row between"><h2>Activity</h2><label class="inline">Show <select id="timeline-filter">${["all", "world", "manual", "agent", "delivery"].map((v) => `<option value="${v}" ${filter2 === v ? "selected" : ""}>${h(v)}</option>`).join("")}</select></label></div><p class="hint">${filtered.length} operations</p><div class="timeline">${filtered.slice(-300).reverse().map((t) => `<details id="event-${t.seq}" class="event ${t.seq === selected ? "selected" : ""}" ${t.seq === selected ? "open" : ""}><summary><span class="event-seq">#${t.seq}</span><span>${badge(source(t), source(t) === "manual" ? "accent" : "")}<strong>${h(t.note ?? t.path)}</strong><small>${h(t.service)} \xB7 ${h(time(t.tSim))}${t.status ? ` \xB7 HTTP ${t.status}` : ""}${t.gap ? " \xB7 Unsupported endpoint" : ""}</small></span></summary>${code(t)}</details>`).join("") || empty("No activity matches this filter.")}</div>${filtered.length > 300 ? '<p class="hint">Showing the latest 300 operations.</p>' : ""}`;
98
+ return `<div class="row between"><h2>Activity</h2><select class="k-filter" aria-label="Activity source" id="timeline-filter">${["all", "world", "manual", "agent", "delivery"].map((v) => `<option value="${v}" ${filter2 === v ? "selected" : ""}>${h(v === "all" ? "Any source" : v)}</option>`).join("")}</select></div><p class="hint">${filtered.length} operations</p><div class="timeline">${filtered.slice(-300).reverse().map((t) => `<details id="event-${t.seq}" class="event ${t.seq === selected ? "selected" : ""}" ${t.seq === selected ? "open" : ""}><summary><span class="event-seq">#${t.seq}</span><span>${badge(source(t), source(t) === "manual" ? "accent" : "")}<strong>${h(t.note ?? t.path)}</strong><small>${h(t.service)} \xB7 ${h(time(t.tSim))}${t.status ? ` \xB7 HTTP ${t.status}` : ""}${t.gap ? " \xB7 Unsupported endpoint" : ""}</small></span></summary>${code(t)}</details>`).join("") || empty("No activity matches this filter.")}</div>${filtered.length > 300 ? '<p class="hint">Showing the latest 300 operations.</p>' : ""}`;
99
99
  }
100
100
  function slack(o, manual, channel2, thread2) {
101
101
  const s = o.state?.slack ?? {}, channels = rows(s, "channels"), active = channels.find((c) => c.id === channel2) ?? channels[0];
@@ -704,12 +704,12 @@ function runsPage(runs, filters, options = {}) {
704
704
  const query = String(filters.q ?? "").trim().toLowerCase();
705
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));
706
706
  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
- const select = (name, label2, choices, all2 = "All") => `<label class="s059-filter"><span>${h(label2)}</span><select class="k-field" name="${name}" 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></label>`;
707
+ 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
708
  const commits = values((item) => item.run.origin?.commit, filters.commit);
709
709
  const named2 = filters.agent ? all.find((item) => item.run.agentId === filters.agent)?.agent : void 0;
710
710
  const agentChoices = values((item) => item.agent, named2 ? void 0 : filters.agent).map((v) => [v === named2 ? filters.agent : v, v]);
711
711
  const legacy = ["range"].filter((key) => filters[key]).map((key) => `<input type="hidden" name="${key}" value="${h(filters[key])}">`).join("");
712
- 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) + select("result", "Result", RESULT_ORDER.filter((kind) => all.some((item) => item.status === kind) || filters.result === kind).map((kind) => [kind, statusLabel(kind)])) + select("where", "Where", values((item) => item.where, filters.where).map((v) => [v, WHERE[v] ?? v])) + select("source", "Source", values((item) => item.run.origin?.source, filters.source).map((v) => [v, SOURCES[v] ?? v])) + select("target", "Target", values((item) => item.run.origin?.target, filters.target).map((v) => [v, TARGETS[v] ?? v])) + (commits.length ? select("commit", "Commit", commits.map((v) => [v, v.slice(0, 7)]), "Any") : "") + "</form>";
712
+ 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>";
713
713
  const meta = range ? `${inRange.length} in the last ${RANGES[range][0].replace(" h", " hours").replace(" d", " days")}` : `${all.length} ${all.length === 1 ? "run" : "runs"}`;
714
714
  const filtered = Boolean(query || filters.agent || filters.result || filters.where || filters.commit || filters.source || filters.target);
715
715
  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>";
@@ -1612,7 +1612,7 @@ function renderAttemptWorkspace(batch, attempt, evidence, options = {}) {
1612
1612
  const tab2 = (label2, name, href2) => navLink(label2, href2, view2 === name ? "on" : "").replace("<a ", `<a ${view2 === name ? 'aria-current="page" ' : ""}`);
1613
1613
  const ms = attemptMs(attempt), calls = Number(fullEvidence.toolCalls ?? attempt.toolCalls) || 0, id = String(batch.id), trace = reproductionOf(batch, task)?.trace;
1614
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("#" + 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 ?? "")}<button type="button" class="k-btn${options.actionsHtml?.includes("primary") ? "" : " primary"}" data-action="copy-text" data-value="${h(codingAgentText(batch, task, fullEvidence, checks2))}">Copy for coding agent</button></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"><span class="k-label">Task</span><div>${h(String(task.prompt ?? "").trim())}</div></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>`;
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("#" + 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
1616
  }
1617
1617
  function renderManagedComparison(data) {
1618
1618
  const sides = records(data.attempts ?? [data.left, data.right]);
@@ -1746,13 +1746,13 @@ function mountWorldWorkspace(node, options) {
1746
1746
  }
1747
1747
  function configuration2() {
1748
1748
  const d = getDraft(), pinned = Number(d.worldRevision) !== world.revision, startingWorld = revisions.get(Number(d.worldRevision));
1749
- return `<section class="ww-configure k-card pad"><div class="k-card-head"><h2>Configure</h2><button class="k-btn" type="button" data-ww="close">Close</button></div><form class="ww-form"><div class="form-grid"><label>Agent<select class="k-field" name="agentId" required><option value="">Choose agent</option>${agents.map((a) => `<option value="${h(a.id)}" ${d.agentId === a.id ? "selected" : ""}>${h(agentLabel(a, agents))}</option>`).join("")}</select></label><label>Configuration name<input class="k-field" name="name" required maxlength="120" value="${h(d.name)}"></label></div><section class="ww-tools k-card pad"><div class="k-card-head"><h3>Tools</h3><a data-nav href="${base}?edit=1">Edit world</a></div><div class="ww-tool-list">${(startingWorld?.configuration.preset.datasets ?? []).map((item) => `<a data-nav href="/tools/${enc(item.tool)}">${toolLogo(item.tool)}${h(toolName(item.tool))}</a>`).join("")}</div>${pinned ? `<label>Starting data<select class="k-field" name="worldRevision"><option value="${h(d.worldRevision)}">Saved revision ${h(d.worldRevision)}</option><option value="${world.revision}">Current revision ${world.revision}</option></select></label>` : `<input type="hidden" name="worldRevision" value="${h(d.worldRevision)}">`}</section><div class="k-card-head"><h3>Tasks</h3><button class="k-btn" type="button" data-ww="add-task" ${d.tasks.length >= 20 ? "disabled" : ""}>Add task</button></div><div class="ww-task-fields">${d.tasks.map((task, index) => `<article class="ww-task-editor" data-task-id="${h(task.id)}"><div class="k-card-head"><h3>Task ${index + 1}</h3>${d.tasks.length > 1 ? `<button class="k-btn" type="button" data-ww="remove-task" data-value="${h(task.id)}">Remove</button>` : ""}</div><label>Task name <span class="muted">optional</span><input class="k-field" name="title" maxlength="120" value="${h(task.title ?? "")}" placeholder="Task ${index + 1}"></label><label>Instructions<textarea class="k-field" name="prompt" required maxlength="20000" rows="4">${h(task.prompt)}</textarea></label><div class="ww-task-options"><label>Repeat<input class="k-field" type="number" name="attempts" min="1" max="100" value="${h(task.attempts)}" required><span>times</span></label><label>Time limit <span class="muted">minutes</span><input class="k-field" type="number" name="minutes" min="0.016666666666666666" max="60" step="any" value="${h(task.timeoutMs / 6e4)}" required></label></div><label class="ww-checks-field">Checks <span class="muted">optional \xB7 JSON list, see <a href="/docs#checks" target="_blank" rel="noopener">Docs</a></span><textarea class="k-field" name="checks" rows="${Math.min(12, Math.max(3, checksText(task).split("\n").length))}" spellcheck="false" maxlength="20000" placeholder='[{"id": "posted", "trace": {"called": "* /api/chat.postMessage"}}]'>${h(checksText(task))}</textarea></label></article>`).join("")}</div><div class="ww-footer"><label>Run at once<input class="k-field" name="concurrency" type="number" min="1" max="10" value="${h(d.concurrency)}" required></label><button type="submit" class="k-btn primary" ${saving ? "disabled" : ""}>${saving ? "Saving\u2026" : "Save configuration"}</button></div></form></section>`;
1749
+ return `<section class="ww-configure k-card pad"><div class="k-card-head"><h2>Configure</h2><button class="k-btn" type="button" data-ww="close">Close</button></div><form class="ww-form"><div class="form-grid"><select class="k-filter" aria-label="Agent" name="agentId" required><option value="">Choose agent</option>${agents.map((a) => `<option value="${h(a.id)}" ${d.agentId === a.id ? "selected" : ""}>${h(agentLabel(a, agents))}</option>`).join("")}</select><label>Configuration name<input class="k-field" name="name" required maxlength="120" value="${h(d.name)}"></label></div><section class="ww-tools k-card pad"><div class="k-card-head"><h3>Tools</h3><a data-nav href="${base}?edit=1">Edit world</a></div><div class="ww-tool-list">${(startingWorld?.configuration.preset.datasets ?? []).map((item) => `<a data-nav href="/tools/${enc(item.tool)}">${toolLogo(item.tool)}${h(toolName(item.tool))}</a>`).join("")}</div>${pinned ? `<label>Starting data<select class="k-field" name="worldRevision"><option value="${h(d.worldRevision)}">Saved revision ${h(d.worldRevision)}</option><option value="${world.revision}">Current revision ${world.revision}</option></select></label>` : `<input type="hidden" name="worldRevision" value="${h(d.worldRevision)}">`}</section><div class="k-card-head"><h3>Tasks</h3><button class="k-btn" type="button" data-ww="add-task" ${d.tasks.length >= 20 ? "disabled" : ""}>Add task</button></div><div class="ww-task-fields">${d.tasks.map((task, index) => `<article class="ww-task-editor" data-task-id="${h(task.id)}"><div class="k-card-head"><h3>Task ${index + 1}</h3>${d.tasks.length > 1 ? `<button class="k-btn" type="button" data-ww="remove-task" data-value="${h(task.id)}">Remove</button>` : ""}</div><label>Task name <span class="muted">optional</span><input class="k-field" name="title" maxlength="120" value="${h(task.title ?? "")}" placeholder="Task ${index + 1}"></label><label>Instructions<textarea class="k-field" name="prompt" required maxlength="20000" rows="4">${h(task.prompt)}</textarea></label><div class="ww-task-options"><label>Repeat<input class="k-field" type="number" name="attempts" min="1" max="100" value="${h(task.attempts)}" required><span>times</span></label><label>Time limit <span class="muted">minutes</span><input class="k-field" type="number" name="minutes" min="0.016666666666666666" max="60" step="any" value="${h(task.timeoutMs / 6e4)}" required></label></div><label class="ww-checks-field">Checks <span class="muted">optional \xB7 JSON list, see <a href="/docs#checks" target="_blank" rel="noopener">Docs</a></span><textarea class="k-field" name="checks" rows="${Math.min(12, Math.max(3, checksText(task).split("\n").length))}" spellcheck="false" maxlength="20000" placeholder='[{"id": "posted", "trace": {"called": "* /api/chat.postMessage"}}]'>${h(checksText(task))}</textarea></label></article>`).join("")}</div><div class="ww-footer"><label>Run at once<input class="k-field" name="concurrency" type="number" min="1" max="10" value="${h(d.concurrency)}" required></label><button type="submit" class="k-btn primary" ${saving ? "disabled" : ""}>${saving ? "Saving\u2026" : "Save configuration"}</button></div></form></section>`;
1750
1750
  }
1751
1751
  function render() {
1752
1752
  if (disposed) return;
1753
1753
  const currentRuns = selected ? setupRuns(runs, selected) : [], run = currentRuns[0], attempts = run?.attempts ?? [], tasks = selected?.tasks ?? [], choices = worldSetups(tests, world.id, agentId);
1754
1754
  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"><label class="world-agent-select">Agent<select class="k-field" 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></label><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 ? `<label class="world-setup-select">Configuration<select class="k-field" 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></label>` : ""}${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&amp;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>`;
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&amp;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
1756
  }
1757
1757
  function latestRun(run, attempts, tasks) {
1758
1758
  const requested = run.summary?.counts?.requested ?? attempts.length, summary = executionSummary(attempts, requested), outcome = taskOutcome(attempts, hasChecks(run.tasks ?? tasks), requested);
@@ -2246,7 +2246,7 @@ function testCard(test, world, base, actions, detail = false) {
2246
2246
  return `<section class="agent-saved-test k-card"><header class="k-card-head"><div>${detail ? "" : `<a class="test-title" data-nav href="${h(base)}?tab=test&test=${encodeURIComponent(test.id)}">${h(test.name)}</a>`}<div class="test-context">${world ? `<a data-nav href="/worlds/${encodeURIComponent(world.id)}">${h(world.name)}</a>` : "Saved world"}<span>\xB7</span><span>${test.tasks.length} ${test.tasks.length === 1 ? "task" : "tasks"}</span></div></div><div class="k-actions">${actions}</div></header><div class="k-scroll" tabindex="0" aria-label="Test tasks"><table class="k-table"><thead><tr><th scope="col">Prompt</th><th scope="col" class="num">Repeat</th></tr></thead><tbody>${test.tasks.map((task) => `<tr><td class="wrap"><span class="ag-prompt" title="${h(task.prompt)}">${h(task.prompt)}</span></td><td class="num">${h(task.attempts)}</td></tr>`).join("")}</tbody></table></div></section>`;
2247
2247
  }
2248
2248
  var SECTIONS = { worlds: "Worlds", agents: "Agents", playgrounds: "Runs", tools: "Tools", help: "Help", settings: "Settings" };
2249
- var notFoundPage = (hosted) => `<p>Nothing lives at this address.</p><p>${hosted ? '<a href="/start">Go to Overview</a>' : '<a href="/playgrounds" data-nav>Go to Runs</a>'}</p>`;
2249
+ var notFoundPage = (hosted) => `<p>Nothing lives at this address.</p><p>${hosted ? '<a href="/overview">Go to Overview</a>' : '<a href="/playgrounds" data-nav>Go to Runs</a>'}</p>`;
2250
2250
  var missingRun = (message) => /^(?:invalid playground run id|playground run was not found|run not found)\.?$/i.test(message);
2251
2251
  var agentsHome = (hosted) => hosted ? "/agents?tab=connected" : "/agents";
2252
2252
  var taskTool = (name) => name !== "google-ads";
@@ -3868,7 +3868,7 @@ async function testForm(selected = "", preferred = selectedAgent) {
3868
3868
  if (requested && !["compiled", "bundled"].includes(requested.origin) && ["reference", "null"].includes(profile?.id)) profile = profiles.find((p) => p.available && !["reference", "null"].includes(p.id));
3869
3869
  if (!profile) return agentForm();
3870
3870
  const scenes = runnableScenes(profile.id), chosen = scenes.find((s) => s.key === selected) ?? scenes.find((s) => s.scene.id === "false-alarm") ?? scenes[0];
3871
- modal("Run scenario", `<form id="test-form"><label>Agent<select name="profile" id="profile">${profiles.map((p) => `<option value="${h(p.id)}" ${p.id === profile.id ? "selected" : ""} ${p.available ? "" : "disabled"}>${h(p.id === "reference" ? "Sample \xB7 scripted responder" : p.name)}</option>`).join("")}</select></label><p id="profile-detail" class="hint">${h(profile.detail)}</p><label>Scenario<select name="scene" id="test-scene" required>${scenes.map((s) => `<option value="${h(s.key)}" ${s.key === chosen?.key ? "selected" : ""}>${h(title(s.scene))}</option>`).join("")}</select></label><div id="selected-data"></div><details class="run-options"><summary>Repeat or test more scenarios</summary><div class="form-inset"><div class="form-grid"><label>Trials per scenario<input type="number" name="trials" min="1" max="10" value="1" required></label><label>At the same time<input type="number" name="parallel" min="1" max="4" value="1" required></label></div><fieldset><legend>Additional scenarios</legend><div id="extra-scenarios"></div></fieldset><label>World seed<input name="seed" value="test-1" maxlength="100"></label><p class="hint">Repeats use the same data and seed. Each gets fresh tool state. Agent memory follows its saved setup.</p></div></details><div class="run-submit"><span id="run-count" class="small muted"></span><button class="primary">Start run</button></div></form>`);
3871
+ modal("Run scenario", `<form id="test-form"><select class="k-filter" aria-label="Agent" name="profile" id="profile">${profiles.map((p) => `<option value="${h(p.id)}" ${p.id === profile.id ? "selected" : ""} ${p.available ? "" : "disabled"}>${h(p.id === "reference" ? "Sample \xB7 scripted responder" : p.name)}</option>`).join("")}</select><p id="profile-detail" class="hint">${h(profile.detail)}</p><label>Scenario<select name="scene" id="test-scene" required>${scenes.map((s) => `<option value="${h(s.key)}" ${s.key === chosen?.key ? "selected" : ""}>${h(title(s.scene))}</option>`).join("")}</select></label><div id="selected-data"></div><details class="run-options"><summary>Repeat or test more scenarios</summary><div class="form-inset"><div class="form-grid"><label>Trials per scenario<input type="number" name="trials" min="1" max="10" value="1" required></label><label>At the same time<input type="number" name="parallel" min="1" max="4" value="1" required></label></div><fieldset><legend>Additional scenarios</legend><div id="extra-scenarios"></div></fieldset><label>World seed<input name="seed" value="test-1" maxlength="100"></label><p class="hint">Repeats use the same data and seed. Each gets fresh tool state. Agent memory follows its saved setup.</p></div></details><div class="run-submit"><span id="run-count" class="small muted"></span><button class="primary">Start run</button></div></form>`);
3872
3872
  setupData();
3873
3873
  }
3874
3874
  function verifyAgentForm(id) {
@@ -506,7 +506,7 @@ body.navigating main{opacity:.55;transition:opacity .15s .25s;cursor:progress}
506
506
  .view-banner{display:flex;align-items:center;gap:16px;margin:0 0 24px;padding:16px 18px;border:1px solid var(--line);border-radius:10px;background:var(--raised,#fafaf8)}.view-banner>div{flex:1;min-width:0}.view-banner strong{display:block;font-weight:600}.view-banner p{margin:4px 0 0;color:var(--muted);font-size:13px}.view-banner button{flex:none}.view-note{color:var(--muted);font-size:13px}
507
507
  @media (max-width:560px){.view-banner{flex-direction:column;align-items:flex-start}}
508
508
  /* A world's starting data before any run (SPEC-027) */
509
- .world-data-note{margin:-12px 0 20px;color:var(--muted);font-size:13px}.world-data-tabs{display:flex;flex-wrap:wrap;gap:4px 22px}.world-data-tabs a{gap:8px;align-items:center}.world-data-logo{display:inline-flex;width:16px;height:16px}.world-data-logo svg,.world-data-logo img{width:16px;height:16px}.folder-scenes{margin-top:36px}.folder-scenes .world-catalog-item p{overflow-wrap:anywhere;font-size:12px}.ww-world-actions .button-link{color:var(--ink)}
509
+ .world-data-note{margin:-12px 0 20px;color:var(--muted);font-size:13px}.world-data-tabs{display:flex;flex-wrap:wrap;gap:4px 22px}.world-data-tabs a{gap:8px;align-items:center}.world-data-logo{display:inline-flex;width:16px;height:16px}.folder-scenes{margin-top:36px}.folder-scenes .world-catalog-item p{overflow-wrap:anywhere;font-size:12px}.ww-world-actions .button-link{color:var(--ink)}
510
510
 
511
511
  /* A run title can be one long id: it wraps instead of widening the page. Skipped checks are neither pass nor fail. */
512
512
  .aw-header h1,.ww-header h1,.page-head h1{overflow-wrap:anywhere}
@@ -860,6 +860,15 @@ input,textarea,select{border-color:var(--input-line);border-radius:8px}
860
860
  .ag-page .ag-prompt{white-space:pre-wrap;overflow-wrap:anywhere}
861
861
  @media(max-width:650px){.ag-page .folder-input{flex-wrap:wrap}.ag-task{flex-wrap:wrap;gap:4px}.ag-facts .ag-copy{justify-content:flex-start}}
862
862
 
863
+ /* S060 entry: compact filters and the attempt evidence copy action. */
864
+ .runs-filters.k-filters{align-items:center}.runs-filters select.k-filter{min-width:0}
865
+ .s060-task>.s060-task-text{font-size:15px;min-width:0;overflow-wrap:anywhere}.s060-task>.c-copy{flex:none;align-self:flex-start;margin-left:auto}
866
+
867
+ /* s060 cli-fix: world data tabs keep image, SVG and letter icons inside the same slot. */
868
+ .world-data-logo{flex:none}
869
+ .world-data-logo>*{width:16px;height:16px;flex:none}
870
+ .world-data-logo span.catalog-letter{font-size:10px;border-radius:4px}
871
+
863
872
  /* Ancha's component kit (SPEC-058, Jay's design canvas "Ancha app: IA and core screens"). One file for both renderers:
864
873
  frontend/scripts/build.mjs appends it to the console's style.css, and app.ancha.io's own pages link the same file as
865
874
  cloud/gateway/static/kit.css (a test keeps the two equal). Classes only: the console's CSP allows no inline styles.
@@ -968,7 +977,7 @@ a.k-sq:focus-visible{outline:2px solid var(--k-ink);outline-offset:1px}
968
977
  .k-btn.primary:hover{background:#2B2A2E;border-color:#2B2A2E;color:#FFFFFF}
969
978
  .k-btn.small{min-height:32px;padding:0 12px;font-size:13px}
970
979
  .k-btn:disabled,.k-btn[aria-disabled="true"]{opacity:.5;cursor:default}
971
- .k-btn:focus-visible,.k-seg>:focus-visible,.k-field:focus-visible{outline:2px solid var(--k-ink);outline-offset:2px}
980
+ .k-btn:focus-visible,.k-seg>:focus-visible,.k-field:focus-visible,.k-filter:focus-visible{outline:2px solid var(--k-ink);outline-offset:2px}
972
981
 
973
982
  /* Filters: a segmented control, or fields in a row (search, then selects). */
974
983
  .k-seg{display:inline-flex;flex-wrap:wrap;gap:2px;padding:3px;border-radius:6px;background:var(--k-on)}
@@ -981,6 +990,9 @@ a.k-sq:focus-visible{outline:2px solid var(--k-ink);outline-offset:1px}
981
990
  .k-field.grow{flex:1 1 280px;min-width:0}
982
991
  select.k-field{appearance:none;-webkit-appearance:none;padding-right:32px;background:#FFFFFF var(--k-i-chevron) right 10px center/14px 14px no-repeat;cursor:pointer}
983
992
 
993
+ select.k-filter{appearance:none;-webkit-appearance:none;width:auto;min-width:0;max-width:100%;height:38px;min-height:38px;margin:0;padding:0 32px 0 12px;border:1px solid var(--k-input);border-radius:6px;background:#FFFFFF var(--k-i-chevron) right 10px center/14px 14px no-repeat;color:var(--k-ink);font:inherit;font-size:14px;box-sizing:border-box;cursor:pointer;text-overflow:ellipsis}
994
+ select.k-filter:hover{border-color:#B9B7B0}
995
+
984
996
  /* A switch for on and off (a test is on or off). */
985
997
  .k-switch{position:relative;display:inline-block;flex:none;width:32px;height:18px;margin:0;padding:0;border:0;border-radius:999px;background:#D6D5D0;vertical-align:middle;cursor:pointer;min-height:0}
986
998
  .k-switch::after{content:"";position:absolute;top:2px;left:2px;width:14px;height:14px;border-radius:999px;background:#FFFFFF;box-shadow:0 1px 2px rgba(0,0,0,.2);transition:left .12s ease}