@capagents/forgeqe 3.4.6 → 3.4.8
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/dist/forgeqe.js +2149 -2010
- package/dist/requirement-agent/requirements_agent/config.py +7 -8
- package/dist/requirement-agent/requirements_agent/llm/providers.py +11 -1
- package/dist/template.html +2 -2
- package/dist/web/assets/{3d-force-graph-nC19sloS.js → 3d-force-graph-CiCC5APC.js} +1 -1
- package/dist/web/assets/{Agent-D_W8YJWv.js → Agent-BB5w6CFT.js} +7 -7
- package/dist/web/assets/{AgentWork-CPYvG2HI.js → AgentWork-BIDUzmaq.js} +1 -1
- package/dist/web/assets/{ApiTests-CElarw4P.js → ApiTests-B9xJf6Cy.js} +5 -5
- package/dist/web/assets/{Browse-hN_pjYbP.js → Browse-DWBe9mKl.js} +1 -1
- package/dist/web/assets/Chat-DHpceBhs.js +3 -0
- package/dist/web/assets/CommandPalette-C94g3GC3.js +1 -0
- package/dist/web/assets/{Compare-DBNzy6Hm.js → Compare-BZBgd0y1.js} +1 -1
- package/dist/web/assets/{Compare-DlSaG3td.js → Compare-DdpFDNye.js} +1 -1
- package/dist/web/assets/Cost-DeG7MOk_.js +1 -0
- package/dist/web/assets/{Data-BSemg5Ky.js → Data-C23A9m-E.js} +1 -1
- package/dist/web/assets/Desktop-DEMEf1js.js +1 -0
- package/dist/web/assets/{DesktopReview-CDv_Swu0.js → DesktopReview-QI-8PPuf.js} +1 -1
- package/dist/web/assets/{DeviceScreen-DDERg3YQ.js → DeviceScreen-DJiqz1aE.js} +1 -1
- package/dist/web/assets/Evidence-CCgOWjCG.js +1 -0
- package/dist/web/assets/{Explore-GAaQCWbY.js → Explore-BaWlUaKG.js} +1 -1
- package/dist/web/assets/Features-BVmUtZ3B.js +1 -0
- package/dist/web/assets/{FileTree-a0-UuNhM.js → FileTree-hV2COTtr.js} +1 -1
- package/dist/web/assets/{Flags-B9BwmpT9.js → Flags-B4d9s8zr.js} +1 -1
- package/dist/web/assets/Flaky-CZw09rGV.js +1 -0
- package/dist/web/assets/{Impact-D-2WTh3g.js → Impact-C0RrcnHq.js} +2 -2
- package/dist/web/assets/{Jobs-BtLMd2Pe.js → Jobs-DJLhtCP4.js} +1 -1
- package/dist/web/assets/{KindPage-YFqKZMNZ.js → KindPage-BDDN_Tvk.js} +1 -1
- package/dist/web/assets/{LiveDevice-BDmDTtX_.js → LiveDevice-mowq_cHn.js} +1 -1
- package/dist/web/assets/{Migration-Bs1Qc0Yg.js → Migration-BMN6ORSe.js} +4 -4
- package/dist/web/assets/Mobile-Cb-MttFC.js +2 -0
- package/dist/web/assets/Observability-Jj9dRXFD.js +1 -0
- package/dist/web/assets/{OwnItems-CO-zBy4W.js → OwnItems-DE8fyJHx.js} +1 -1
- package/dist/web/assets/PageAgent--Trp4TeQ.js +1 -0
- package/dist/web/assets/Product-D6eFHH3k.js +6 -0
- package/dist/web/assets/Production-BHY4nlNS.js +1 -0
- package/dist/web/assets/Quality-D0ZwjBaV.js +1 -0
- package/dist/web/assets/Readiness-Ck09aYm6.js +1 -0
- package/dist/web/assets/Record-CZ8vdz9z.js +1 -0
- package/dist/web/assets/{Regression-DuP8VGvl.js → Regression-DpksCvrY.js} +2 -2
- package/dist/web/assets/RelationGraph-ceeoXUfO.js +1 -0
- package/dist/web/assets/Reports-DwQ4rGuE.js +2 -0
- package/dist/web/assets/{Requirements-BnOO72Q7.js → Requirements-CrrPYfmf.js} +1 -1
- package/dist/web/assets/Responsive-D-_Z1zWt.js +3 -0
- package/dist/web/assets/RunDiff-6ubx_siR.js +1 -0
- package/dist/web/assets/Settings-B-VqCcSI.js +21 -0
- package/dist/web/assets/{SiteScan-BVI8Z-cC.js → SiteScan-Atalzdep.js} +1 -1
- package/dist/web/assets/{Steps-CZxAX4yk.js → Steps-DJKLOcXA.js} +1 -1
- package/dist/web/assets/{TestData-CyqXcyZv.js → TestData-D8X3YVNO.js} +1 -1
- package/dist/web/assets/{TestManagement-UKBq1Jcj.js → TestManagement-CFkof7HP.js} +2 -2
- package/dist/web/assets/WhatsNew-Zh7ANIT4.js +1 -0
- package/dist/web/assets/agentSettingsSheet-BXo7tt4e.js +1 -0
- package/dist/web/assets/api-C5wO4oo1.js +1 -0
- package/dist/web/assets/choice-DU4-gNa8.js +1 -0
- package/dist/web/assets/{dataParts-DD4VTinq.js → dataParts-XwGL6chT.js} +1 -1
- package/dist/web/assets/{desktopAppPath-Ch1JeF98.js → desktopAppPath-ClRxEs7y.js} +1 -1
- package/dist/web/assets/{flowTheme-BP9HI_83.js → flowTheme-C6XgxapL.js} +1 -1
- package/dist/web/assets/index-4aprf7A6.css +2 -0
- package/dist/web/assets/index-Bm0NGw2p.js +186 -0
- package/dist/web/assets/{nav-DS7OIItb.js → nav-BVGAdkgR.js} +1 -1
- package/dist/web/assets/{pageBack-BKHdI-pD.js → pageBack-C6KF2YWt.js} +1 -1
- package/dist/web/assets/paletteCommands-4ZbMQrvq.js +5 -0
- package/dist/web/assets/{parts-EZhmj8re.js → parts-Bw9UqYIt.js} +1 -1
- package/dist/web/assets/{productParts-Cjy7N4bQ.js → productParts-C2WZmf3J.js} +1 -1
- package/dist/web/assets/{qualityParts-Bnl_yBH6.js → qualityParts-xNbrX_EB.js} +1 -1
- package/dist/web/assets/{recordTest-DOqE44_1.js → recordTest-ecnqAff5.js} +1 -1
- package/dist/web/assets/searchRecents-BRxclL5B.js +1 -0
- package/dist/web/assets/{stepper-PKh2muBc.js → stepper-ghyjNRgc.js} +1 -1
- package/dist/web/assets/surface-CJmzHqOR.js +1 -0
- package/dist/web/assets/uploadBuild-sQwJpid1.js +1 -0
- package/dist/web/assets/{wizardParts-DgElx0Cb.js → wizardParts-CtlGV71f.js} +1 -1
- package/dist/web/index.html +8 -8
- package/package.json +1 -1
- package/py/forgeqe_engine/capture.py +80 -2
- package/py/forgeqe_engine/d365.py +117 -11
- package/py/forgeqe_engine/llm.py +30 -1
- package/py/forgeqe_engine/memory.py +91 -25
- package/py/forgeqe_engine/recordsession.py +9 -1
- package/py/forgeqe_engine/service.py +8 -0
- package/py/forgeqe_engine/webrecord_page.py +87 -4
- package/dist/web/assets/Chat-CJsKzudh.js +0 -3
- package/dist/web/assets/CommandPalette-Bupa5F4q.js +0 -1
- package/dist/web/assets/Cost-DsERWen5.js +0 -1
- package/dist/web/assets/Desktop-BcXzby1F.js +0 -1
- package/dist/web/assets/Evidence-BYQvjtqD.js +0 -1
- package/dist/web/assets/Features-BoFooP6n.js +0 -1
- package/dist/web/assets/Flaky-NIz-XNcl.js +0 -1
- package/dist/web/assets/Mobile-zXRXR_3S.js +0 -2
- package/dist/web/assets/Observability-qNxOzrmI.js +0 -1
- package/dist/web/assets/PageAgent-C0u0uyou.js +0 -1
- package/dist/web/assets/Product-5nybx8oL.js +0 -6
- package/dist/web/assets/Production-C2FVz9Df.js +0 -1
- package/dist/web/assets/Quality-CwlN84zJ.js +0 -1
- package/dist/web/assets/Readiness-gzFYSc8y.js +0 -1
- package/dist/web/assets/Record-DeucQwHe.js +0 -1
- package/dist/web/assets/RelationGraph-8Ko7oUzf.js +0 -1
- package/dist/web/assets/Reports-Bk5A2rMW.js +0 -2
- package/dist/web/assets/Responsive-9eqRKydd.js +0 -3
- package/dist/web/assets/RunDiff-DAiOiWdE.js +0 -1
- package/dist/web/assets/Settings-jkOoqeEY.js +0 -21
- package/dist/web/assets/WhatsNew-BnWCLSSu.js +0 -1
- package/dist/web/assets/agentSettingsSheet-Bca1rnig.js +0 -1
- package/dist/web/assets/api-BJHzfOse.js +0 -1
- package/dist/web/assets/choice-W0qOx_1k.js +0 -1
- package/dist/web/assets/coverage-DbHm8BUP.js +0 -5
- package/dist/web/assets/index-B9F7yrF9.css +0 -2
- package/dist/web/assets/index-DZMkBMxL.js +0 -186
- package/dist/web/assets/palette-BEo5X3wD.js +0 -1
- package/dist/web/assets/paletteCommands-DdFd3e0-.js +0 -1
- package/dist/web/assets/sectionList-B6NF3ZMb.js +0 -1
- package/dist/web/assets/surface-c1kG1KPS.js +0 -1
|
@@ -30,7 +30,7 @@ from pathlib import Path
|
|
|
30
30
|
from types import SimpleNamespace
|
|
31
31
|
from typing import Any, Awaitable, Callable, Dict, List, Optional, Set, Tuple
|
|
32
32
|
|
|
33
|
-
from .capture import capture_element, element_facts_cdp, locate_check
|
|
33
|
+
from .capture import capture_element, element_facts_cdp, locate_check, verify_within
|
|
34
34
|
from .clientcert import client_cert_host
|
|
35
35
|
from .network import NetworkCapture
|
|
36
36
|
from .d365 import ATTRS as D365_ATTRS, clean_facts as d365_clean_facts, note as d365_note
|
|
@@ -1207,6 +1207,14 @@ class RecordSession:
|
|
|
1207
1207
|
target = Target(url, live.facts, counted_at_event(live.locators, data["matches"]), live.frames, closed_shadow=closed)
|
|
1208
1208
|
# None of its own locators unique: the one anchored on its container (the page script counted it), where there is one.
|
|
1209
1209
|
anchored = within_locator(data.get("anchor"))
|
|
1210
|
+
# A named part of the page or a keyed row, while the element still shows: counted again in the browser's own
|
|
1211
|
+
# accessibility tree, whose reading of names decides over the page script's (capture.verify_within).
|
|
1212
|
+
if anchored and backend and "t" not in anchored["within"] and await self._shows(sid, int(backend)):
|
|
1213
|
+
anchored = await verify_within(_Page(self.client, sid), int(backend), anchored)
|
|
1214
|
+
if anchored is None:
|
|
1215
|
+
# Not this element alone as the browser reads it: the container by its text, counted beside it.
|
|
1216
|
+
fallback_anchor = within_locator(data.get("anchor_text"))
|
|
1217
|
+
anchored = fallback_anchor if fallback_anchor and "t" in fallback_anchor["within"] else None
|
|
1210
1218
|
if anchored and generic_name(target.facts) and not any((l.get("type") in ("test_id", "id") or l.get("site") == "d365") and l.get("verified") for l in target.locators):
|
|
1211
1219
|
# A name many controls share ("Close" of a toast): another like it may show on a replay; its container first.
|
|
1212
1220
|
locs = [anchored] + [l for l in target.locators if l.get("type") != "within"]
|
|
@@ -51,6 +51,7 @@ from .llm import (
|
|
|
51
51
|
copilot_gateway,
|
|
52
52
|
_usage_from_history,
|
|
53
53
|
_agent_usage,
|
|
54
|
+
takes_images,
|
|
54
55
|
)
|
|
55
56
|
from .browser import (
|
|
56
57
|
VIDEO_FILE,
|
|
@@ -1602,6 +1603,13 @@ async def run_browser_task(req: RunRequest, emit: Emit, cancel_event: asyncio.Ev
|
|
|
1602
1603
|
guard_busy_done(agent_tools)
|
|
1603
1604
|
# Outermost: a <secret> tag that would not be filled here is refused before anything is typed or recorded.
|
|
1604
1605
|
guard_secrets(agent_tools, sensitive or {})
|
|
1606
|
+
if not takes_images(req.llm if isinstance(req.llm, dict) else None):
|
|
1607
|
+
# A text-only model (Ollama's, unless the profile says "vision": true) works from the page's text: sent a
|
|
1608
|
+
# screenshot, Ollama refuses the step or the model never sees it.
|
|
1609
|
+
agent_kw["use_vision"] = False
|
|
1610
|
+
if persona:
|
|
1611
|
+
personas.exclude_markup(agent_tools)
|
|
1612
|
+
emit({"type": "log", "level": "info", "text": 'This model does not read screenshots, so the browser agent works from the page\'s text. Set "vision": true on the profile if it does.'})
|
|
1605
1613
|
agent_kw["tools"] = agent_tools
|
|
1606
1614
|
agent_kw.update(_browser_use_agent_tuning_kwargs())
|
|
1607
1615
|
if extend_msg:
|
|
@@ -261,7 +261,7 @@ RECORDER_JS = r"""(() => {
|
|
|
261
261
|
const d365Path = (e) => {
|
|
262
262
|
const out = [];
|
|
263
263
|
for (let x = e, i = 0; x && x.nodeType === 1 && i <= D365.path_up && x !== document.body && out.length < D365.path_max; x = up(x), i++) {
|
|
264
|
-
for (const k of D365.path_attrs) { const v = x.getAttribute(k); if (v && out.length < D365.path_max) out.push([k, v.slice(0, 200)]); }
|
|
264
|
+
for (const k of D365.path_attrs) { const v = x.getAttribute(k); if (v && (k !== 'role' || D365.path_roles.includes(v)) && out.length < D365.path_max) out.push([k, v.slice(0, 200)]); }
|
|
265
265
|
}
|
|
266
266
|
return out;
|
|
267
267
|
};
|
|
@@ -452,17 +452,100 @@ RECORDER_JS = r"""(() => {
|
|
|
452
452
|
}
|
|
453
453
|
return null;
|
|
454
454
|
};
|
|
455
|
+
// ---- in the named part of the page that holds it, or in the row a key cell names --------------------------------
|
|
456
|
+
// A SaaS page repeats its controls: a "Save" in every dialog, an "Edit" on every row. Playwright reads a page as a
|
|
457
|
+
// person does: the Save of the dialog named "New Contact" (getByRole('dialog', { name }).getByRole('button', …)), the
|
|
458
|
+
// Edit of the row whose cell says "INV-1042" (getByRole('row').filter({ has: getByRole('cell', { name }) })…). Each
|
|
459
|
+
// is counted as Playwright's role queries count (shown, never inside aria-hidden or inert) and kept only when it finds
|
|
460
|
+
// this element alone. Kept in step with NAMED_SCOPE_ROLES and KEY_ROLES in memory.py and replay.ts.
|
|
461
|
+
const SCOPE_ROLES = new Set(['dialog', 'alertdialog', 'region', 'form', 'group', 'tabpanel', 'navigation', 'complementary',
|
|
462
|
+
'search', 'toolbar', 'menu', 'menubar', 'list', 'listbox', 'grid', 'table', 'treegrid', 'tree', 'tablist', 'article']);
|
|
463
|
+
// A tag's own role, where it is one of those (a <section> or a <form> is a region or a form only once named, and the
|
|
464
|
+
// name is required below).
|
|
465
|
+
const SCOPE_TAGS = { DIALOG: 'dialog', SECTION: 'region', FORM: 'form', FIELDSET: 'group', DETAILS: 'group', NAV: 'navigation',
|
|
466
|
+
ASIDE: 'complementary', TABLE: 'table', UL: 'list', OL: 'list', ARTICLE: 'article' };
|
|
467
|
+
const SCOPE_SEL = '[role], dialog, section, form, fieldset, details, nav, aside, table, ul, ol, article';
|
|
468
|
+
const firstRole = (x) => (x.getAttribute('role') || '').trim().split(/\s+/)[0];
|
|
469
|
+
const scopeRole = (x) => { const r = firstRole(x); if (r) return SCOPE_ROLES.has(r) ? r : ''; return SCOPE_TAGS[x.tagName] || ''; };
|
|
470
|
+
// A scope's name as Playwright computes it for these roles: aria-labelledby or aria-label, a fieldset's legend, a
|
|
471
|
+
// table's caption; never the text inside it (a dialog is not named by its heading unless it points at it).
|
|
472
|
+
const scopeName = (x) => {
|
|
473
|
+
let n = labelText(x);
|
|
474
|
+
if (!n && x.tagName === 'FIELDSET') { const l = x.querySelector(':scope > legend'); n = l ? norm(l.textContent) : ''; }
|
|
475
|
+
if (!n && x.tagName === 'TABLE') { const c = x.querySelector(':scope > caption'); n = c ? norm(c.textContent) : ''; }
|
|
476
|
+
return n;
|
|
477
|
+
};
|
|
478
|
+
const scopeNameOk = (n) => !!n && n.length <= 80 && !XP_GEN_TEXT.test(n);
|
|
479
|
+
const KEY_ROLES = new Set(['cell', 'gridcell', 'rowheader']);
|
|
480
|
+
const cellRole = (x) => {
|
|
481
|
+
const r = firstRole(x);
|
|
482
|
+
if (r) return KEY_ROLES.has(r) ? r : '';
|
|
483
|
+
if (x.tagName !== 'TD') return '';
|
|
484
|
+
const t = x.closest('table');
|
|
485
|
+
return t && ['grid', 'treegrid'].includes(firstRole(t)) ? 'gridcell' : 'cell';
|
|
486
|
+
};
|
|
487
|
+
const CELL_SEL = 'td, [role=cell], [role=gridcell], [role=rowheader]';
|
|
488
|
+
const ROW_SEL = 'tr, [role=row]';
|
|
489
|
+
const isRow = (x) => { const r = firstRole(x); return r ? r === 'row' : x.tagName === 'TR'; };
|
|
490
|
+
const cellName = (x) => labelText(x) || textOf(x);
|
|
491
|
+
// The element inside the scope by its role (and name, written whole: a name with a state at its end is left to the
|
|
492
|
+
// other anchors), as innerOf counts it there.
|
|
493
|
+
const scopeInner = (e, f, box) => {
|
|
494
|
+
if (f.name && nameKey(f.name) !== f.name) return null;
|
|
495
|
+
const i = innerOf(e, f, box);
|
|
496
|
+
return i && i.type === 'role' ? i : null;
|
|
497
|
+
};
|
|
498
|
+
const scopeFor = (e, f) => {
|
|
499
|
+
for (let box = up(e), i = 0; box && i < 12 && box !== document.body && box !== document.documentElement; box = up(box), i++) {
|
|
500
|
+
if (box.nodeType !== 1 || !axShown(box)) continue;
|
|
501
|
+
if (isRow(box)) {
|
|
502
|
+
const inner = scopeInner(e, f, box);
|
|
503
|
+
if (inner) {
|
|
504
|
+
const keys = [];
|
|
505
|
+
for (const c of box.querySelectorAll(CELL_SEL)) {
|
|
506
|
+
if (deepContains(c, e) || !axShown(c)) continue;
|
|
507
|
+
const role = cellRole(c), name = cellName(c);
|
|
508
|
+
if (role && scopeNameOk(name) && !keys.some((k) => k.name === name)) keys.push({ role, name });
|
|
509
|
+
}
|
|
510
|
+
// A name first (an invoice number, a customer), a state or an amount (SHAKY_TEXT) only after.
|
|
511
|
+
const ordered = [...keys.filter((k) => !SHAKY_TEXT.test(k.name)), ...keys.filter((k) => SHAKY_TEXT.test(k.name))].slice(0, 12);
|
|
512
|
+
const rows = ordered.length ? deepAll(ROW_SEL).filter((x) => isRow(x) && axShown(x)) : [];
|
|
513
|
+
for (const k of ordered) {
|
|
514
|
+
const same = deepAll(CELL_SEL).filter((x) => axShown(x) && cellRole(x) === k.role && cellName(x) === k.name);
|
|
515
|
+
if (same.length !== 1) continue;
|
|
516
|
+
// Every row that holds it, as filter({ has }) finds them: a row nested in another is two.
|
|
517
|
+
const holding = rows.filter((r) => deepContains(r, same[0]));
|
|
518
|
+
if (holding.length === 1 && holding[0] === box) return { c: { role: 'row' }, k, i: inner };
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
const role = scopeRole(box);
|
|
523
|
+
const name = role ? scopeName(box) : '';
|
|
524
|
+
if (scopeNameOk(name)) {
|
|
525
|
+
const peers = deepAll(SCOPE_SEL).filter((x) => scopeRole(x) === role && axShown(x) && scopeName(x) === name);
|
|
526
|
+
if (peers.length === 1 && peers[0] === box) { const inner = scopeInner(e, f, box); if (inner) return { c: { role, name }, i: inner }; }
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
return null;
|
|
530
|
+
};
|
|
455
531
|
const GENERIC_NAMES = new Set(['close', '×', 'x', '✕', 'ok', 'cancel', 'delete', 'remove', 'edit', 'dismiss', 'more', 'yes', 'no', 'save', 'next', 'back', 'view', 'open']);
|
|
456
532
|
// Unique by a locator of its own: no anchor needed.
|
|
457
533
|
const uniqueAlone = (m) => [m.role, m.text, m.label, m.name, m.href, m.attr && m.attr.id, m.attr && m.attr['data-testid']].some((n) => n === 1);
|
|
458
534
|
const describeEl = (e) => {
|
|
459
535
|
const f = facts(e);
|
|
460
536
|
const m = matches(e, f);
|
|
461
|
-
let anchor = null;
|
|
537
|
+
let anchor = null, textAnchor = null;
|
|
462
538
|
// A name many controls share ("Close", "×", "Delete"): unique now, another like it may show on a replay (a second
|
|
463
539
|
// toast), so the container that holds it is kept too.
|
|
464
|
-
if (!uniqueAlone(m) || GENERIC_NAMES.has(String(f.name || f.text || '').trim().toLowerCase())) {
|
|
465
|
-
|
|
540
|
+
if (!uniqueAlone(m) || GENERIC_NAMES.has(String(f.name || f.text || '').trim().toLowerCase())) {
|
|
541
|
+
let scope = null;
|
|
542
|
+
try { scope = scopeFor(e, f); } catch (err) { scope = null; }
|
|
543
|
+
try { anchor = anchorFor(e, f); } catch (err) { anchor = null; }
|
|
544
|
+
// The named part or keyed row first; the container by its text stays beside it, for when the browser's own
|
|
545
|
+
// accessibility tree does not agree with this script's count (recordsession.py, capture.verify_within).
|
|
546
|
+
if (scope) { textAnchor = anchor; anchor = scope; }
|
|
547
|
+
}
|
|
548
|
+
return { id: ref(e), el: f, matches: m, url: location.href, ...(anchor ? { anchor } : {}), ...(textAnchor ? { anchor_text: textAnchor } : {}) };
|
|
466
549
|
};
|
|
467
550
|
|
|
468
551
|
// ---- the Recorder panel, docked in the page, with the pick highlight and the key bar --------------------------------
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{t}from"./react-BDur5s0O.js";import{r as n}from"./route-9BkoTWUE.js";import{V as r,c as i,z as a}from"./surface-c1kG1KPS.js";import{t as o}from"./utils-DJRAScIl.js";import{t as s}from"./jsx-runtime-LKYXHABd.js";import{I as c}from"./palette-BEo5X3wD.js";import{m as l}from"./sectionList-B6NF3ZMb.js";import{T as u,U as d,V as f,b as p,f as m}from"./api-BJHzfOse.js";import{F as h,I as g,N as _,O as v,P as y,T as b,g as x,k as S,m as ee,n as C,t as w}from"./pageBack-BKHdI-pD.js";import{Gr as T,M as E,Mn as D,N as O,Vn as k,Zt as te,i as ne,nr as re,or as A,sr as ie,vn as j,w as ae}from"./line-icons-Cwj9OmCz.js";import{u as M}from"./nav-DS7OIItb.js";import{$ as oe,An as se,Cn as ce,Dn as le,En as ue,Fn as N,J as P,K as F,L as I,Mn as de,Mt as L,Nn as fe,Nt as R,On as z,Pt as B,Q as pe,Sn as me,Tn as he,Y as ge,cn as V,ct as _e,en as ve,et as ye,gn as be,hn as xe,kn as H,kt as U,lt as Se,pn as W,q as Ce,rn as we,tn as Te,wn as Ee}from"./index-DZMkBMxL.js";import{n as De}from"./recordTest-DOqE44_1.js";import{t as G}from"./DeviceScreen-DDERg3YQ.js";import{t as Oe}from"./LiveDevice-BDmDTtX_.js";var K=e(t(),1),q=s(),J=e=>e.some(e=>e.type===`tool`&&e.event?.type===`device`),Y=`(min-width: 1100px)`;function X(){let[e,t]=(0,K.useState)(()=>window.matchMedia(Y).matches);return(0,K.useEffect)(()=>{let e=window.matchMedia(Y),n=()=>t(e.matches);return e.addEventListener(`change`,n),()=>e.removeEventListener(`change`,n)},[]),e}function Z(e,t,n){let[r,i]=(0,K.useState)(null),a=(0,K.useCallback)(()=>{d.chatDevice(e).then(i,()=>{})},[e]);(0,K.useEffect)(a,[a,n,t]);let o=!!r?.live.length;return(0,K.useEffect)(()=>{if(!t&&!o)return;let e=H(a,1e3);return()=>z(e)},[t,o,a]),r}function Q({last:e}){let[t,n]=(0,K.useState)(()=>[...e.steps].reverse().find(e=>e.shot)?.n??0),[a,s]=(0,K.useState)(``);return(0,K.useEffect)(()=>{if(s(``),!t)return;let n=!1;return u.shot(e.run,t).then(e=>!n&&s(e),()=>{}),()=>{n=!0}},[e.run,t]),(0,q.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-4`,children:[(0,q.jsxs)(`p`,{className:`m-0 flex items-center gap-2 text-body-sm`,children:[e.ok?(0,q.jsx)(O,{size:16,"aria-label":`Passed`,className:`flex-none text-pass`}):(0,q.jsx)(E,{size:16,"aria-label":`Failed`,className:`flex-none text-fail`}),(0,q.jsx)(`span`,{className:`font-medium`,children:e.name}),(0,q.jsx)(`span`,{className:`text-muted`,children:`· ended`})]}),t>0&&(0,q.jsx)(G,{src:a,alt:`The screen after step ${t}`,size:`min(100%, 240px)`}),e.steps.length?(0,q.jsx)(`ol`,{"aria-label":`Its steps`,className:o(i,`m-0 flex list-none flex-col divide-y divide-line-soft p-0 text-body-sm`),children:e.steps.map(e=>(0,q.jsx)(`li`,{children:(0,q.jsxs)(`button`,{type:`button`,disabled:!e.shot,onClick:()=>n(e.n),"aria-current":e.n===t||void 0,className:o(r,`items-start gap-2 text-ink-2`,e.n===t&&`text-ink`),children:[e.ok?(0,q.jsx)(O,{size:14,"aria-label":`Done`,className:`mt-1 flex-none text-pass`}):(0,q.jsx)(E,{size:14,"aria-label":`Failed`,className:`mt-1 flex-none text-fail`}),(0,q.jsxs)(`span`,{className:`min-w-0 [overflow-wrap:anywhere]`,children:[`Step `,e.n,e.error?`: ${e.error}`:``]})]})},e.n))}):(0,q.jsx)(`p`,{className:`m-0 text-body-sm text-muted`,children:`The run kept no steps.`})]})}function $({chat:e,d:t}){let[n,r]=(0,K.useState)(``),i=(0,K.useCallback)(t=>d.chatScreen(e,t),[e]);if(!t)return(0,q.jsx)(x,{shape:`detail`,card:!1});let a=t.live.find(e=>e.id===n)??t.live[0];return a?(0,q.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-4`,children:[t.live.length>1&&(0,q.jsx)(b,{value:a.id,onChange:r,items:t.live.map(e=>({id:e.id,label:e.device||e.id.split(`/`).at(-1)||`Device`}))}),(0,q.jsx)(Oe,{d:a,picture:i,size:`min(100%, 240px)`})]}):t.last?(0,q.jsx)(Q,{last:t.last},t.last.run):(0,q.jsx)(`p`,{className:`m-0 text-body-sm text-muted`,children:`The device shows here while a mobile run works on it.`})}function ke({chat:e,events:t,busy:n}){let r=X(),i=J(t),a=t.filter(e=>e.type===`tool`&&e.event?.type===`device`).length,[o,s]=(0,K.useState)(!1),[c,l]=(0,K.useState)(!1),u=Z(e,n&&i,a);(0,K.useEffect)(()=>s(!1),[a]);let d=i&&r&&!o;if((0,K.useEffect)(()=>(window.dispatchEvent(new CustomEvent(F,{detail:d})),()=>void window.dispatchEvent(new CustomEvent(F,{detail:!1}))),[d]),!i)return{button:null,pane:null};let f=u?.live[0]?.device||`Device`;return{button:d?null:(0,q.jsxs)(y,{size:`sm`,onClick:()=>r?s(!1):l(!0),"data-tip":`Show the device this chat's run works on`,children:[(0,q.jsx)(A,{"aria-hidden":`true`}),`Show the device`]}),pane:d?(0,q.jsxs)(`aside`,{"aria-label":`Device`,className:`sticky top-0 flex h-(--screen) w-[360px] flex-none flex-col border-l border-line-soft bg-surface-muted`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-2 px-4 pt-4`,children:[(0,q.jsx)(A,{size:16,"aria-hidden":`true`,className:`flex-none text-icon`}),(0,q.jsx)(`span`,{className:`flex-1 truncate text-body-sm font-medium`,children:f}),(0,q.jsx)(y,{size:`icon`,variant:`icon`,onClick:()=>s(!0),"aria-label":`Hide the device`,"data-tip":`Hide the device`,"data-tip-side":`left`,children:(0,q.jsx)(D,{strokeWidth:1.8,"aria-hidden":`true`})})]}),(0,q.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-4 overflow-y-auto px-4 pt-2 pb-4`,children:(0,q.jsx)($,{chat:e,d:u})})]}):(0,q.jsx)(N,{open:c&&!r,onClose:()=>l(!1),title:f,description:`The device this chat's mobile run works on.`,footer:(0,q.jsxs)(y,{onClick:()=>l(!1),children:[(0,q.jsx)(T,{"aria-hidden":`true`}),`Close`]}),children:(0,q.jsx)(`div`,{className:`pt-4`,children:(0,q.jsx)($,{chat:e,d:u})})})}}function Ae({id:e}){let[t,r]=(0,K.useState)([]),[i,s]=(0,K.useState)(null),[c,u]=(0,K.useState)(!1),[d,f]=(0,K.useState)(``),[v,b]=(0,K.useState)(``),[x,S]=(0,K.useState)(!1),C=fe(v,b,`reply`,{chat:e}),T=(0,K.useRef)(null),E=(0,K.useRef)(null),D=(0,K.useRef)(!0),[O,k]=(0,K.useState)(!0);(0,K.useEffect)(()=>{let t=!1,n=0,i=0;return r([]),s(null),f(``),b(``),C.reset(),(async()=>{for(;!t;)try{let a=await p.events(e,n,n>0);if(t)return;i=0,f(``),s({title:a.title,state:a.state,profile:a.profile,settingsChanged:a.settingsChanged===!0,...a.recording?{recording:a.recording}:{}}),a.events.length&&(n=a.events[a.events.length-1].n,r(e=>[...e,...a.events]))}catch(e){if(t)return;let n=pe(++i,e.status??0,e.message);if(n.say!==null&&f(n.say),n.giveUp)return;await oe(n.waitMs)}})(),()=>{t=!0}},[e]);let A=(0,K.useMemo)(()=>_e(t),[t]),M=(0,K.useMemo)(()=>{let e=new Map;for(let t of A.turns.flatMap(e=>e.changes)){let n=e.get(t.path);e.set(t.path,n?{...n,added:n.added+t.added,removed:n.removed+t.removed}:{path:t.path,added:t.added,removed:t.removed})}return[...e.values()]},[A]),N=(0,K.useMemo)(()=>{let e=[];for(let t of A.turns){for(let n of t.tests)n.testFile&&e.push({label:n.ok?`Test`:`Test (failed)`,path:n.testFile,kind:`test`});for(let n of t.reports)e.push({label:/\.html?$/i.test(n.path)?`Report`:`Run report`,path:n.path,kind:`report`})}return e.filter((t,n)=>e.findIndex(e=>e.path===t.path)===n)},[A]),P=(0,K.useMemo)(()=>Se(A),[A]),F=(0,K.useRef)(()=>{});ge(A.context||A.usage||M.length||N.length||A.uses||P.length?{context:A.context,usage:A.usage,agents:A.agents,model:A.model?.name,changes:M,outputs:N,uses:A.uses,commands:P,busy:i?.state===`busy`||i?.state===`starting`,...M.length?{onCreatePr:()=>F.current()}:{}}:null);let I=i?.state,L=I===`busy`||I===`starting`,R=I===`closed`||I===`failed`,z=A.turns.at(-1),B=!!z&&!z.outcome&&(z.asks.some(e=>e.answer===void 0)||z.waits.some(e=>e.answer===void 0)),V=me();ce(e,A.turns.flatMap(e=>e.actions),i!==null,t=>V(t,e)),(0,K.useEffect)(()=>{let e=document.documentElement,t=()=>window.innerHeight+window.scrollY>=e.scrollHeight-48,n=e=>{D.current=e,k(e)},r=window.scrollY,i=()=>{t()?n(!0):window.scrollY<r-2&&n(!1),r=window.scrollY},a=new ResizeObserver(()=>{D.current&&!t()&&window.scrollTo({top:e.scrollHeight,behavior:`instant`})});return T.current&&a.observe(T.current),E.current&&a.observe(E.current),window.addEventListener(`scroll`,i,{passive:!0}),()=>{a.disconnect(),window.removeEventListener(`scroll`,i)}},[]);let H=(0,K.useRef)(/^turn-(\d{1,5})$/.exec(location.hash.split(`/`)[3]??``)?.[1]),U=A.turns.length;(0,K.useEffect)(()=>{let e=H.current;!e||U<Number(e)||(H.current=void 0,D.current=!1,k(!1),requestAnimationFrame(()=>document.getElementById(`turn-${e}`)?.scrollIntoView({block:`start`,behavior:a()})))},[U]);let W=()=>{D.current=!0,k(!0),window.scrollTo({top:document.documentElement.scrollHeight,behavior:a()})},[G,Oe]=(0,K.useState)(null);(0,K.useEffect)(()=>void m.settings().then(Oe,()=>{}),[]);let J=(0,K.useCallback)(async e=>{try{await e()}catch(e){f(e.message)}},[]),Y=le(`chat-${e}`.replace(/[^\w-]/g,``).slice(0,80),e=>{b(e),ue(`reply`)}),X=async t=>{if(x||!t.trim()&&!C.hasFiles)return!1;S(!0),D.current=!0,k(!0);try{let n=await C.wrap(t);return n.trim()?(await p.send(e,n),f(``),b(``),C.reset({keep:!0}),Y.close(),!0):!1}catch(e){return f(e.message),!1}finally{S(!1)}};F.current=()=>{if(i?.state===`busy`||i?.state===`starting`||x)return;let e=M.map(e=>`- ${e.path}`).join(`
|
|
2
|
-
`);X(`Open a pull request with the changes you made in this chat:\n${e}\n\nUse a new branch, a clear title and description, and tell me its link.`)};let Z=i?ve(i):void 0,Q=Z&&Z.agent!==`forgeqe`?Z:void 0,$=ke({chat:e,events:t,busy:L});return(0,q.jsxs)(`div`,{className:`flex min-h-(--screen) flex-col`,children:[(0,q.jsxs)(`header`,{className:`sticky top-0 z-20 flex items-center gap-1 border-b border-line-soft bg-canvas py-4 pr-16 pl-6 md:pr-6`,children:[(0,q.jsx)(Ce,{}),i?.recording?(0,q.jsx)(w,{href:De(i.recording.run),label:`Recording`,className:`ml-1 self-center`}):Q?(0,q.jsx)(w,{href:n(`agents`,Q.id),label:l(Q.agent).name,className:`ml-1 self-center`}):null,(0,q.jsx)(`h1`,{className:`m-0 ml-2 min-w-0 flex-1 truncate text-body-lg font-medium`,children:i?.title||`Chat`}),$.button,A.model&&(0,q.jsxs)(`span`,{className:`hidden min-h-9 items-center gap-2 rounded-sm px-2 text-body-sm text-ink-2 sm:inline-flex`,"data-tip":`The model this chat uses`,children:[(0,q.jsx)(_,{icon:ie,size:14,className:`text-icon`}),A.model.name]})]}),(0,q.jsxs)(`div`,{className:`flex min-w-0 flex-auto`,children:[(0,q.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,q.jsxs)(`main`,{ref:T,className:`mx-auto box-border flex w-full max-w-[960px] flex-auto flex-col gap-8 px-6 pt-8 pb-6`,children:[!i&&!d&&(0,q.jsx)(`p`,{role:`status`,className:`m-0 text-body-sm text-muted`,children:`Opening the chat…`}),i?.recording&&(0,q.jsxs)(`p`,{className:o(g.info,`m-0`),children:[`This chat writes the test from the recording `,(0,q.jsx)(`a`,{href:De(i.recording.run),children:i.recording.name}),`. The recording shows how it goes, and it goes on if you leave.`]}),A.turns.map((t,n)=>(0,q.jsxs)(`section`,{id:`turn-${n+1}`,"aria-label":`Message ${n+1}`,className:`flex scroll-mt-20 flex-col gap-6`,children:[(0,q.jsx)(de,{text:t.user,scope:{chat:e}}),(0,q.jsx)(ye,{turn:t,live:n===A.turns.length-1&&!R,onAnswer:(t,n)=>J(()=>p.answer(e,t,n)),onProceed:(t,n)=>J(()=>p.proceed(e,t,n))})]},t.id)),z?.outcome===`done`&&z.next.length>0&&!L&&!R&&(0,q.jsx)(`div`,{className:`flex flex-wrap gap-2 pl-12`,children:z.next.map(e=>(0,q.jsx)(y,{"data-tip":e.request===e.label?void 0:e.request,onClick:()=>void X(e.request),children:e.label},e.label))}),(A.fatal||R&&A.ended)&&(0,q.jsxs)(`div`,{role:`alert`,className:o(A.fatal||I===`failed`?g.fail:`pt-2 text-body-sm text-muted`,`flex flex-col gap-2 leading-relaxed`),children:[(0,q.jsxs)(`span`,{className:`flex items-start gap-2 [overflow-wrap:anywhere]`,children:[!(A.fatal||I===`failed`)&&(0,q.jsx)(te,{size:14,"aria-hidden":`true`,className:`mt-1 flex-none`}),(0,q.jsxs)(`span`,{children:[A.fatal||A.ended?.message||(I===`failed`?`ForgeQE stopped unexpectedly.`:`This chat has ended.`),R&&` Write below and ForgeQE picks it up again.`]})]}),A.ended?.stderr&&(0,q.jsx)(`pre`,{className:o(`overflow-auto rounded-base bg-surface-muted p-4 font-mono text-body-sm leading-relaxed whitespace-pre-wrap text-ink-2 [overflow-wrap:anywhere]`,`m-0 max-h-[200px]`),children:(0,q.jsx)(ee,{text:A.ended.stderr.join(`
|
|
3
|
-
`)})}),(0,q.jsxs)(`span`,{className:`flex flex-wrap gap-2`,children:[(0,q.jsxs)(`a`,{className:h({size:`sm`}),href:n(),"data-tip":`Start a new chat`,children:[(0,q.jsx)(j,{"aria-hidden":`true`}),`Chat`]}),A.fatal&&/model|key|sign/i.test(A.fatal)&&(0,q.jsxs)(`a`,{className:h({size:`sm`}),href:n(`settings`,`models`),"data-tip":`Set up the models`,children:[(0,q.jsx)(re,{"aria-hidden":`true`}),`Models`]}),A.fatal&&/runtime|engine|setup/i.test(A.fatal)&&(0,q.jsxs)(`a`,{className:h({size:`sm`}),href:n(`settings`,`setup`),children:[(0,q.jsx)(re,{"aria-hidden":`true`}),`Set up`]})]})]}),A.notes.map((e,t)=>(0,q.jsx)(`p`,{className:`m-0 text-body-sm text-muted [overflow-wrap:anywhere]`,children:e},t))]}),(0,q.jsx)(`div`,{ref:E,className:`sticky bottom-0 z-10 bg-gradient-to-t from-canvas from-70% to-transparent px-6 pt-4 pb-6`,children:(0,q.jsxs)(`div`,{className:`relative mx-auto flex w-full max-w-[880px] flex-col gap-2`,children:[!O&&L&&(0,q.jsxs)(y,{size:`sm`,onClick:W,"data-tip":`Go to the latest activity`,className:`absolute -top-11 left-1/2 -translate-x-1/2 shadow-sm`,children:[(0,q.jsx)(ne,{"aria-hidden":`true`}),`Latest`]}),(0,q.jsxs)(`div`,{"aria-live":`polite`,children:[i?.settingsChanged&&!L&&!R&&!B&&(0,q.jsxs)(`div`,{role:`status`,className:o(g.info,`mb-2 flex flex-wrap items-center gap-2`),children:[(0,q.jsx)(`span`,{className:`min-w-0 flex-1`,children:`The settings changed since this chat started. Carry on with them? The conversation is kept.`}),(0,q.jsxs)(y,{size:`sm`,variant:`primary`,disabled:c,onClick:()=>{u(!0),p.refresh(e).then(()=>{u(!1),s(e=>e&&{...e,settingsChanged:!1,state:`starting`})},e=>{u(!1),f(e.message)})},"data-tip":`Carry on with the new settings`,children:[(0,q.jsx)(ae,{"aria-hidden":`true`}),`Apply`]})]}),(d||C.error)&&(0,q.jsx)(`p`,{role:`alert`,className:o(g.fail,`m-0`),children:d||C.error})]}),(0,q.jsx)(se,{id:`reply`,label:`Reply to ForgeQE`,rows:1,value:v,onChange:b,onSend:()=>void X(v),onStop:()=>J(()=>p.stop(e)),busy:L&&!B,disabled:x||B||Y.running,canSend:!!v.trim()||C.hasFiles,onEdit:C.onEdit,onKey:C.onKeyDown,onFiles:C.onFiles,dropping:C.dropping,drop:C.drop,mentions:C.mentions,combo:C.combo,top:(0,q.jsxs)(q.Fragment,{children:[C.chips,Y.state&&(0,q.jsx)(he,{state:Y.state,onStop:()=>void Y.stop(),onUndo:Y.undo,onClose:Y.close}),(0,q.jsx)(be,{chat:e})]}),left:(0,q.jsxs)(q.Fragment,{children:[C.fileInput,(0,q.jsx)(Te,{attach:{pick:C.pick},started:{chat:e,thread:A,ended:R,snap:G,onError:f}}),(0,q.jsx)(Ee,{running:Y.running,disabled:!v.trim()||x||B,onClick:()=>void Y.start(v)}),(0,q.jsx)(xe,{chat:e,disabled:x||Y.running})]}),placeholder:R?`Write to carry on this chat…`:B?`Answer above to go on`:L?`ForgeQE is working…`:`Reply to ForgeQE…`,right:(0,q.jsx)(we,{chat:e,thread:A,ended:R,busy:L||x,snap:G,onError:f})})]})})]}),$.pane]})]})}var je=[{id:`all`,label:`All`},{id:`working`,label:`Working`},{id:`waiting`,label:`Needs you`},{id:`done`,label:`Your turn`},{id:`ended`,label:`Ended`}];function Me({hits:e}){return(0,q.jsxs)(`section`,{"aria-labelledby":`said-title`,className:i,children:[(0,q.jsxs)(`h2`,{id:`said-title`,className:`sticky top-0 z-[1] m-0 border-b border-line-soft bg-surface-muted/95 px-6 py-2 text-body-sm font-medium text-muted backdrop-blur`,children:[`What was said `,(0,q.jsxs)(`span`,{className:`font-normal tabular-nums`,children:[`· `,e.length]})]}),(0,q.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-2`,children:e.map((e,t)=>{let i=e.where.split(` › `)[0]??``,a=e.where.split(` › `).slice(1).join(` › `),s=e.text.replace(/^User:[\s\S]*?\n\nYou: /,``).replace(/\s+/g,` `).trim(),c=e.source===`chats`,l=(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,q.jsx)(`span`,{className:`truncate text-body-sm font-medium`,children:a||s}),(0,q.jsx)(`span`,{className:`truncate text-body-sm text-muted`,children:s})]}),(0,q.jsxs)(`span`,{className:`flex max-w-60 min-w-0 flex-col items-end justify-self-end gap-1 text-right`,children:[(0,q.jsx)(`span`,{className:`max-w-full truncate text-body-sm text-muted`,children:i}),c?(0,q.jsxs)(`span`,{className:`text-body-sm text-muted tabular-nums`,children:[`Message `,e.line]}):(0,q.jsx)(S,{tone:`neutral`,children:`Terminal chat`})]})]}),u=`grid min-h-14 grid-cols-[minmax(0,1fr)_auto] gap-x-4`;return(0,q.jsx)(`li`,{children:c?(0,q.jsx)(`a`,{href:n(`chats`,e.file.replace(/\.json$/,``),`turn-${e.line}`),className:o(r,u),children:l}):(0,q.jsx)(`div`,{className:o(u,`items-center px-4 py-2 text-ink`),children:l})},`${e.source}/${e.file}:${e.line}:${t}`)})})]})}function Ne(){let[e,t]=(0,K.useState)(null),[r,i]=(0,K.useState)(``),[a,s]=(0,K.useState)(`all`),[l,u]=(0,K.useState)(``),d=async e=>{let n=(await Promise.allSettled(e.map(e=>p.stop(e)))).find(e=>e.status===`rejected`);i(n?`Could not stop every chat: ${String(n.reason?.message??n.reason)}`:``),await p.list().then(e=>t(e.chats),()=>void 0)};(0,K.useEffect)(()=>{let e=!1,n=()=>p.list().then(n=>!e&&t(n.chats),t=>!e&&i(t.message));n();let r=H(n,5e3);return()=>{e=!0,z(r)}},[]);let m=(0,K.useMemo)(()=>{let t={all:0,working:0,waiting:0,done:0,ended:0};for(let n of e||[])t.all++,t[B(n)]++;return t},[e]),_=(0,K.useMemo)(()=>(e||[]).filter(e=>(a===`all`||B(e)===a)&&R(e,l)),[e,a,l]),[y,b]=(0,K.useState)(null);return(0,K.useEffect)(()=>{let e=l.trim();if(e.length<3)return b(null);let t=!1,n=setTimeout(()=>{f.searchDocs(e,{scope:`chats`,top_k:8}).then(n=>!t&&b({query:e,hits:n.hits}),()=>!t&&b(null))},400);return()=>{t=!0,clearTimeout(n)}},[l]),(0,q.jsxs)(`div`,{className:`flex min-h-(--screen) flex-col`,children:[(0,q.jsx)(P,{}),(0,q.jsxs)(`main`,{className:o(I,`gap-6`),children:[(0,q.jsx)(C,{}),(0,q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4`,children:[(0,q.jsx)(W,{pixel:c.chats,size:`lg`,head:!0}),(0,q.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,q.jsx)(`h1`,{className:`m-0 text-headline-md`,children:M(`chats`)}),(0,q.jsx)(`span`,{className:`text-body-sm text-muted`,children:`Each one is its own ForgeQE agent in your project folder. Past chats stay here after forgeqe web restarts, to read or carry on.`})]}),(0,q.jsxs)(`a`,{className:o(h({variant:`accent`}),`gap-2`),href:n(),children:[(0,q.jsx)(k,{"aria-hidden":`true`}),`New chat`]})]}),r&&(0,q.jsx)(`p`,{role:`alert`,className:o(g.fail,`m-0`),children:r}),!e&&!r&&(0,q.jsx)(x,{shape:`rows`,count:6}),e&&e.length===0&&(0,q.jsx)(V,{icon:j,title:`No chats yet`,action:(0,q.jsxs)(`a`,{className:h({size:`sm`}),href:n(),"data-tip":`Start a chat`,children:[(0,q.jsx)(j,{"aria-hidden":`true`}),`Chat`]}),children:`Ask ForgeQE to run test cases, explore a journey, write a test or review requirements. Each chat shows up here, and stays after forgeqe web restarts so you can carry it on.`}),y&&y.hits.length>0&&(0,q.jsx)(Me,{hits:y.hits}),e&&e.length>0&&(0,q.jsx)(`div`,{children:(0,q.jsx)(L,{rows:_,resetKey:`${a}-${l}`,empty:`No chat matches.`,onStop:d,tools:(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(v,{id:`find-a-chat`,label:`Find a chat`,value:l,onChange:u}),(0,q.jsx)(U,{label:`Show`,value:a,onChange:s,options:je.map(e=>({id:e.id,label:e.label,n:m[e.id],...e.id===`waiting`&&m.waiting?{tone:`text-warn`}:{}}))})]})})})]})]})}export{Ae as Chat,Ne as Chats};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{t}from"./react-BDur5s0O.js";import{P as n,f as r}from"./surface-c1kG1KPS.js";import{t as i}from"./utils-DJRAScIl.js";import{t as a}from"./jsx-runtime-LKYXHABd.js";import{H as o,I as s,q as c,r as l,t as u}from"./palette-BEo5X3wD.js";import{M as d,i as f}from"./sectionList-B6NF3ZMb.js";import{Qn as p}from"./line-icons-Cwj9OmCz.js";import{everyCommand as m}from"./paletteCommands-DdFd3e0-.js";var h=e(t(),1),g=a();function _({open:e,onClose:t,pages:a,query:_=``}){let v=(0,h.useRef)(null),y=(0,h.useId)(),[b,x]=(0,h.useState)(``),[S,C]=(0,h.useState)(0),w=d(),T=(0,h.useMemo)(()=>m(a),[a,w]),E=(0,h.useMemo)(()=>u(T,b),[T,b]),D=Math.min(S,Math.max(E.length-1,0));(0,h.useEffect)(()=>{let t=v.current;t&&(e&&!t.open&&(x(_),C(0),t.showModal()),!e&&t.open&&t.close())},[e,_]),(0,h.useEffect)(()=>{if(e)return window.addEventListener(`hashchange`,t),()=>window.removeEventListener(`hashchange`,t)},[e,t]),(0,h.useEffect)(()=>{document.getElementById(`${y}-${D}`)?.scrollIntoView({block:`nearest`})},[D,y]);let O=e=>{e&&(t(),location.hash=e.href)};return(0,g.jsx)(`dialog`,{ref:v,"aria-label":`Go to`,onCancel:e=>{e.preventDefault(),t()},onClick:e=>{e.target===v.current&&t()},className:i(c,`fixed top-[12vh] mx-auto mt-0 w-[min(640px,calc(100vw-32px))] max-w-none p-0 backdrop:bg-[rgba(15,23,42,0.2)]`),children:e&&(0,g.jsxs)(`div`,{className:`flex max-h-[70vh] flex-col`,children:[(0,g.jsxs)(`div`,{className:`relative border-b border-line-soft px-4 py-4`,children:[(0,g.jsx)(p,{size:14,"aria-hidden":`true`,className:`pointer-events-none absolute top-1/2 left-[26px] -translate-y-1/2 text-muted`}),(0,g.jsx)(`label`,{htmlFor:`${y}-q`,className:`sr-only`,children:`Go to a page, an agent or a setting`}),(0,g.jsx)(n,{autoFocus:!0,id:`${y}-q`,type:`text`,search:!0,role:`combobox`,"aria-expanded":`true`,"aria-controls":y,"aria-activedescendant":E.length?`${y}-${D}`:void 0,autoComplete:`off`,spellCheck:!1,value:b,placeholder:`Go to a page, an agent or a setting`,onChange:e=>{x(e.target.value),C(0)},onKeyDown:e=>{e.key===`ArrowDown`?(e.preventDefault(),C((D+1)%Math.max(E.length,1))):e.key===`ArrowUp`?(e.preventDefault(),C((D-1+E.length)%Math.max(E.length,1))):e.key===`Escape`?(e.preventDefault(),t()):e.key===`Enter`&&(e.preventDefault(),o(e)||O(E[D]))},className:`pl-8`})]}),(0,g.jsxs)(`ul`,{id:y,role:`listbox`,"aria-label":`Found`,className:`m-0 flex min-h-0 list-none flex-col overflow-y-auto p-2`,children:[E.length===0&&(0,g.jsx)(`li`,{role:`presentation`,className:`px-2 py-2 text-body-sm text-muted`,children:`Nothing called that.`}),E.map((e,t)=>(0,g.jsxs)(`li`,{id:`${y}-${t}`,role:`option`,"aria-selected":t===D,onMouseMove:()=>t!==D&&C(t),onClick:()=>O(e),className:`flex w-full min-h-11 cursor-pointer items-center gap-4 rounded-base border-0 bg-transparent px-4 py-2 text-left text-body-sm text-ink no-underline transition-colors duration-150 hover:bg-tint hover:text-ink aria-[current]:bg-tint-hover aria-selected:bg-tint-hover aria-pressed:bg-tint-hover aria-checked:bg-tint-hover has-[:checked]:bg-tint-hover disabled:cursor-not-allowed disabled:opacity-50`,children:[(0,g.jsx)(`span`,{className:`flex size-6 flex-none items-center justify-center`,children:e.agent?(0,g.jsx)(l,{agent:e.agent,px:18,decorative:!0}):e.kind===`agent`?(0,g.jsx)(l,{agent:f.find(t=>`agent:${t.id}`===e.id)?.agent||``,px:18,decorative:!0}):(0,g.jsx)(r,{name:e.icon||s[e.id]||(e.kind===`page`?`feature`:s.settings),px:18})}),(0,g.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,g.jsx)(`span`,{className:`truncate text-body-sm`,children:e.label}),(0,g.jsx)(`span`,{className:`truncate text-body-sm text-muted`,children:e.meta})]})]},e.id))]}),(0,g.jsx)(`p`,{className:`m-0 border-t border-line-soft px-4 py-2 text-body-sm text-muted`,children:`↑ ↓ to move · Enter to open · Esc to close`})]})})}export{_ as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{t}from"./react-BDur5s0O.js";import{r as n}from"./route-9BkoTWUE.js";import{n as r,t as i}from"./utils-DJRAScIl.js";import{t as a}from"./jsx-runtime-LKYXHABd.js";import{I as o}from"./palette-BEo5X3wD.js";import{v as s}from"./api-BJHzfOse.js";import{F as c,I as l,T as u,_ as d,g as f,n as p,w as m,y as h}from"./pageBack-BKHdI-pD.js";import{Er as g,Jn as _,K as v,On as ee,Rn as y,Tr as b,Zt as x,b as S,cr as C,h as te,mr as ne,o as re,tn as w}from"./line-icons-Cwj9OmCz.js";import{u as T}from"./nav-DS7OIItb.js";import{Ft as E,G as D,Gt as O,J as k,Kt as A,L as j,U as ie,Ut as M,Vt as N,W as P,Wt as F,Xt as I,bt as L,cn as R,pn as z,vt as B,xt as V,yt as H,zt as U}from"./index-DZMkBMxL.js";import{d as W}from"./qualityParts-Bnl_yBH6.js";var G=e(t(),1),K={view:e=>s(`GET`,`/api/cost?days=${e}`)},q=a(),J=e=>e.input+e.output;function Y(e,t){let n=J(e)-e.unpriced-e.otherCurrency;return[t&&n>0?`${e.estimates?`≈`:``}${H(e.amount,t)}`:``,e.unpriced?`${V(e.unpriced)} tokens with no price`:``,e.otherCurrency?`${V(e.otherCurrency)} in another currency`:``].filter(Boolean).join(`, `)||(J(e)?`no price`:`nothing`)}function ae({series:e,currency:t}){let[n,r]=(0,G.useState)(-1),i=!!t&&e.some(e=>e.amount>0),a=e=>i?e.amount:J(e),o=e=>i?H(e,t):`${V(e)} tokens`,s=e.reduce((e,t)=>e+a(t),0),c=e.filter(e=>e.sessions>0).length,l=e.reduce((e,t)=>a(t)>a(e)?t:e,e[0]),u=n>=0?e[n]:e[e.length-1],f=e=>new Date(`${e}T12:00:00Z`).toLocaleDateString(void 0,{month:`short`,day:`numeric`});return(0,q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,q.jsxs)(`p`,{"aria-live":`polite`,className:`m-0 text-body-sm text-ink-2`,children:[(0,q.jsx)(`span`,{className:`font-medium`,children:f(u.day)}),`: `,Y(u,t),`, `,V(J(u)),` tokens in `,u.sessions,` session`,u.sessions===1?``:`s`]}),(0,q.jsx)(d,{series:[{values:e.map(a)}],label:`${i?`Spend`:`Tokens`} a day for the last ${e.length} days: ${o(s)} in all, on ${c} day${c===1?``:`s`} with sessions; the busiest was ${f(l.day)} with ${o(a(l))}.`,hover:n,onHover:r,className:`h-[160px]`,axis:[f(e[0].day),f(e[e.length-1].day)]})]})}var X=12;function Z({rows:e,currency:t,label:n,empty:r}){if(!e.length)return(0,q.jsx)(R,{className:`py-4`,children:r});let i=!!t&&e.some(e=>e.amount>0),a=e=>i?e.amount:J(e),o=Math.max(Number.MIN_VALUE,e.reduce((e,t)=>e+a(t),0));return(0,q.jsx)(h,{label:n,rows:e.slice(0,X).map(e=>({key:e.key,label:e.label,value:i?Y(e,t):`${V(J(e))} tokens`,sub:i?`${V(J(e))} tokens`:Y(e,t),share:a(e)/o})),more:e.length>X?`and ${e.length-X} more`:void 0})}function oe({savings:e}){let{currency:t,rows:n,total:r,baseline:i}=e,a=(e,t)=>Math.abs(e)<=Math.max(.005,Math.abs(t)*.005)?0:Math.abs(e),o=(e,n)=>!t||a(e,n)===0?`the same either way`:e>0?`saved ${H(e,t)}`:`${H(-e,t)} more`,s=(e,t)=>`${a(e,t)===0?`—`:e>0?`↓`:`↑`} ${o(e,t)}`,c=Math.max(Number.MIN_VALUE,...n.map(e=>a(e.delta,e.baseline)));return(0,q.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,q.jsxs)(`p`,{className:`m-0 text-body-sm text-ink-2`,children:[`Against running everything on `,(0,q.jsx)(`span`,{className:`font-medium`,children:i.profile}),`: `,s(r.delta,r.baseline),` over `,r.calls,` call`,r.calls===1?``:`s`,t?` (${H(r.actual,t)} paid, ${H(r.baseline,t)} on ${i.profile} alone)`:``,`.`]}),(0,q.jsx)(`ul`,{"aria-label":`What routing cost each area against ${i.profile} alone: ${n.map(e=>`${e.label}, ${o(e.delta,e.baseline)}`).join(`; `)}.`,className:`m-0 flex list-none flex-col gap-4 p-0`,children:n.map(e=>(0,q.jsxs)(`li`,{className:`flex flex-col gap-1`,children:[(0,q.jsx)(`span`,{"data-tip":e.label,className:`min-w-0 truncate text-body-sm font-medium`,children:e.label}),(0,q.jsx)(m,{share:a(e.delta,e.baseline)/c,lead:a(e.delta,e.baseline)===c,text:s(e.delta,e.baseline)})]},e.area||`none`))}),e.excluded.length>0&&(0,q.jsxs)(`p`,{className:`m-0 text-body-sm text-muted`,children:[`Left out: `,e.excluded.map(e=>`${e.calls} call${e.calls===1?``:`s`} where ${e.why}`).join(`, `),`.`]})]})}var se=[{id:`7`,label:`Last 7 days`},{id:`30`,label:`Last 30 days`},{id:`90`,label:`Last 90 days`}],ce={off:`Routing is off (llm.routing): every call uses the active profile, or the model an agent names.`,shadow:`Routing is in test mode (llm.routing: shadow): picks are logged, the active profile is used.`,auto:`Routing is on (llm.routing: auto): planning gets the most capable model, each other area the one that suits it by llm.strategy.`};function Q({id:e,title:t,icon:n,children:r,note:i,className:a}){return(0,q.jsx)(I,{id:e,icon:n,title:t,description:i,className:a,children:r})}var $=`first:pt-6`;function le(){let[e,t]=(0,G.useState)(30),[a,s]=(0,G.useState)(null),[d,m]=(0,G.useState)(``),h=(0,G.useCallback)(()=>{m(``),K.view(e).then(s,e=>m(e.message))},[e]);(0,G.useEffect)(h,[h]);let _=a&&a.days===e?a:null,O=_?.totals,A=_?.currency,M=_?[B(A),_.ledger?.currency?`At the price of the day each call was made, this project's ${r(_.ledger.calls,`model call`)} in these days cost ${H(_.ledger.amount,_.ledger.currency)}, as the workspace panel and Tokenomics show; here they are priced at today's prices.`:``,_.totals.otherCurrency?`${V(_.totals.otherCurrency)} tokens are priced in another currency than ${A} and are left out of the amounts.`:``,_.source.skipped?`${_.source.skipped} log file${_.source.skipped===1?` was`:`s were`} skipped: a link, or not inside the logs folder.`:``,_.source.truncated?`${_.source.truncated} very long log${_.source.truncated===1?` was`:`s were`} read only in part.`:``].filter(Boolean):[];return(0,q.jsxs)(`div`,{className:`flex min-h-(--screen) flex-col`,children:[(0,q.jsx)(k,{}),(0,q.jsxs)(`main`,{className:i(j,`@container flex-auto gap-4`),children:[(0,q.jsx)(p,{}),(0,q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4`,children:[(0,q.jsx)(z,{pixel:o.cost,size:`lg`,head:!0}),(0,q.jsx)(`h1`,{className:`m-0 text-headline-md`,children:T(`cost`)})]}),(0,q.jsx)(D,{more:(0,q.jsxs)(q.Fragment,{children:[`Read from the session logs`,_?(0,q.jsxs)(q.Fragment,{children:[` `,`in `,(0,q.jsx)(`code`,{className:`font-mono text-body-sm`,children:_.source.logs})]}):``,` `,`and the runs kept after them. Tokens are priced as ForgeQE prices them today: a profile's price in llms.json, else its model's list price`,_?.pricesFrom?` (list of ${_.pricesFrom})`:``,`. Tokens with no known price are counted apart, never as free. A GitHub Copilot seat is not billed per token. Each session is in the day it started.`]}),children:`See what this project's model calls cost, and where the money went.`}),(0,q.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:(0,q.jsx)(u,{items:se,value:`${e}`,onChange:e=>t(Number(e))})}),d&&(0,q.jsx)(`p`,{role:`alert`,className:i(l.fail,`m-0`),children:d}),!_&&!d&&(0,q.jsx)(f,{shape:`detail`}),_&&O&&!O.sessions&&(0,q.jsx)(R,{icon:v,title:`No model calls in the last ${e} days`,action:(0,q.jsxs)(`a`,{className:c({size:`sm`}),href:n(`runs`),"data-tip":`Open Runs`,children:[(0,q.jsx)(re,{"aria-hidden":`true`}),`Runs`]}),children:(0,q.jsx)(`span`,{className:`text-ink-2`,children:`Every ForgeQE session writes a log with the tokens its agents used. Start a chat or a run, and what it cost shows here.`})}),(0,q.jsxs)(`div`,{className:`flex flex-col gap-8`,children:[_&&O&&O.sessions>0&&(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(ie,{label:`What the model calls cost`,children:[(0,q.jsx)(P,{tip:O.estimates?`${O.estimates} session${O.estimates===1?``:`s`} estimated`:`${_.from} to ${_.to}`,dot:`neutral`,value:A&&O.input+O.output>O.unpriced?`${O.estimates?`≈`:``}${H(O.amount,A)}`:`no price`,label:`spent`}),(0,q.jsx)(P,{tip:L(O),dot:`neutral`,value:V(O.input+O.output),label:`tokens`}),(0,q.jsx)(P,{tip:O.unpriced?`Not in what was spent`:`Every token priced`,dot:O.unpriced?`warn`:`pass`,value:V(O.unpriced),label:`tokens with no price`}),(0,q.jsx)(P,{dot:`neutral`,value:O.sessions,label:`sessions with model calls`}),(0,q.jsx)(P,{dot:`neutral`,value:A&&O.amount>0?H(O.amount/O.sessions,A):`–`,label:`per session on average`})]}),M.length>0&&(0,q.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0 text-body-sm text-ink-2`,children:M.map(e=>(0,q.jsxs)(`li`,{className:`flex items-start gap-2`,children:[(0,q.jsx)(x,{size:14,"aria-hidden":`true`,className:`mt-1 flex-none text-muted`}),e]},e))}),(0,q.jsx)(Q,{id:`cost-days`,title:`Over time`,icon:b,children:(0,q.jsx)(ae,{series:_.series,currency:A})}),(0,q.jsxs)(`div`,{className:`grid gap-6 @3xl:grid-cols-2`,children:[(0,q.jsx)(Q,{id:`cost-agent`,title:`By agent`,icon:te,className:$,children:(0,q.jsx)(Z,{rows:_.byAgent,currency:A,label:`Spend by agent`,empty:`No agent used a model.`})}),(0,q.jsx)(Q,{id:`cost-origin`,title:`By what started it`,icon:y,className:$,children:(0,q.jsx)(Z,{rows:_.byOrigin,currency:A,label:`Spend by what started the session`,empty:`Nothing yet.`})}),(0,q.jsx)(Q,{id:`cost-model`,title:`By model`,icon:C,className:$,children:(0,q.jsx)(Z,{rows:_.byModel,currency:A,label:`Spend by model`,empty:`Nothing yet.`})}),(0,q.jsx)(Q,{id:`cost-area`,title:`By area of work`,icon:w,className:$,children:(0,q.jsx)(Z,{rows:_.byArea,currency:A,label:`Spend by area of work`,empty:`No model call recorded an area of work yet.`})}),(0,q.jsx)(Q,{id:`cost-job`,title:`By job`,icon:S,className:$,children:(0,q.jsx)(Z,{rows:_.byJob,currency:A,label:`Spend by job`,empty:`No job's run used a model in this window.`})})]}),_.savings&&(0,q.jsx)(Q,{id:`cost-savings`,title:`What routing cost`,icon:v,note:_.savings.unavailable||`Each area against running everything on ${_.savings.baseline.profile}, which is what routing: off does. Both sides at today's prices. An area can cost more on purpose — coding is routed to a stronger model. This is price alone: nothing here checked that a cheaper model would have answered as well.`,children:!_.savings.unavailable&&(0,q.jsx)(oe,{savings:_.savings})}),(0,q.jsx)(Q,{id:`cost-sessions`,title:`Sessions`,icon:ne,children:(0,q.jsx)(U,{label:`Sessions`,placeholder:`Find a session, model or origin`,resetKey:e,empty:`No session used a model.`,head:(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`th`,{scope:`col`,className:i(`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,`w-[38%]`),children:`Session`}),(0,q.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,children:`Started`}),(0,q.jsx)(`th`,{scope:`col`,className:i(`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,`hidden @xl:table-cell`),children:`Started by`}),(0,q.jsx)(`th`,{scope:`col`,className:i(`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,`hidden @2xl:table-cell`),children:`Model`}),(0,q.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-right text-label-md font-medium whitespace-nowrap text-muted`,children:`Tokens`}),(0,q.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-right text-label-md font-medium whitespace-nowrap text-muted`,children:`Cost`})]}),children:_.sessions.map(e=>(0,q.jsxs)(`tr`,{className:`h-12 border-t border-line-soft align-middle transition-colors duration-150 data-[state=selected]:bg-tint-hover`,children:[(0,q.jsx)(`td`,{className:i(`px-4 py-2`,`max-w-0`),children:(0,q.jsx)(`a`,{href:n(`runs`,encodeURIComponent(e.name)),"data-tip":`${e.title} · forgeqe ${e.command}${e.from===`kept`?` · its log is gone; from the kept run`:``}`,className:`block truncate`,children:e.title})}),(0,q.jsx)(`td`,{className:i(`px-4 py-2`,`whitespace-nowrap text-muted`),"data-tip":W(e.startedAt),"data-sort":new Date(e.startedAt).getTime()||0,children:E(e.startedAt)}),(0,q.jsx)(`td`,{className:i(`px-4 py-2`,`hidden max-w-[180px] truncate @xl:table-cell`),"data-tip":e.origin,children:e.origin}),(0,q.jsx)(`td`,{className:i(`px-4 py-2`,`hidden max-w-[220px] truncate @2xl:table-cell`),"data-tip":e.models.join(`, `),children:e.models.join(`, `)}),(0,q.jsx)(`td`,{className:`px-4 py-2 text-right whitespace-nowrap tabular-nums`,"data-sort":e.tokens,children:V(e.tokens)}),(0,q.jsx)(`td`,{className:i(`px-4 py-2 text-right whitespace-nowrap tabular-nums`,e.amount===void 0&&`text-warn`),"data-sort":e.amount??-1,"data-tip":e.unpriced?`${V(e.unpriced)} tokens with no price`:e.estimate?`An estimate: part of it was routed to another model, or its cached price is derived`:void 0,children:e.amount===void 0||!A?(0,q.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,q.jsx)(g,{size:13,"aria-hidden":`true`}),`no price`]}):(0,q.jsxs)(q.Fragment,{children:[e.estimate?`≈`:``,H(e.amount,A),e.unpriced?(0,q.jsx)(`span`,{className:`text-warn`,children:` +?`}):null]})})]},e.name))})})]}),_&&_.packs.length>0&&(0,q.jsx)(Q,{id:`cost-packs`,title:`Regression packs`,icon:ee,note:`What one run of a pack costs, from the sessions that ran or healed it in this window (forgeqe pack run or heal, or a job that runs it), divided by its runs that have a session.`,children:(0,q.jsx)(U,{label:`Regression packs`,placeholder:`Find a pack`,resetKey:e,empty:`No packs.`,head:(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,children:`Pack`}),(0,q.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-right text-label-md font-medium whitespace-nowrap text-muted`,children:`Runs`}),(0,q.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-right text-label-md font-medium whitespace-nowrap text-muted`,children:`Sessions`}),(0,q.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,children:`Costs about`})]}),children:_.packs.map(e=>(0,q.jsxs)(`tr`,{className:`h-12 border-t border-line-soft align-middle transition-colors duration-150 data-[state=selected]:bg-tint-hover`,children:[(0,q.jsx)(`td`,{className:i(`px-4 py-2`,`max-w-0`),children:(0,q.jsx)(`a`,{href:n(`regression`,encodeURIComponent(e.name)),"data-tip":e.name,className:`block truncate`,children:e.name})}),(0,q.jsx)(`td`,{className:`px-4 py-2 text-right whitespace-nowrap tabular-nums`,children:e.runs}),(0,q.jsx)(`td`,{className:`px-4 py-2 text-right whitespace-nowrap tabular-nums`,children:e.sessions}),(0,q.jsx)(`td`,{className:i(`px-4 py-2`,`text-body-sm`),"data-sort":e.perRun??-1,children:e.perRun!==void 0&&A?(0,q.jsxs)(`span`,{className:`tabular-nums`,children:[H(e.perRun,A),` per run`,e.unpriced?`, and ${V(e.unpriced)} tokens with no price`:``]}):e.missing?(0,q.jsxs)(`span`,{className:`flex items-start gap-2 text-ink-2`,children:[(0,q.jsx)(g,{size:14,"aria-label":`Not known`,className:`mt-1 flex-none text-warn`}),e.missing]}):(0,q.jsx)(`span`,{className:`text-muted`,children:`No runs in this window.`})})]},e.name))})}),_&&(0,q.jsx)(ue,{router:_.router,byArea:_.byArea})]})]})]})}function ue({router:e,byArea:t}){let n=e=>{let n=(t.find(t=>t.area===e)?.models??[]).map(e=>`${e.model} ×${e.calls}`),r=n.slice(0,3);return{text:n.length>3?`${r.join(`, `)} and ${n.length-3} more`:r.join(`, `),all:n.join(`, `)}},r=e.areas.map(e=>e.area).filter(t=>e.models.some(e=>e.ratings[t]!==void 0));return(0,q.jsxs)(Q,{id:`cost-router`,title:`Model router`,icon:_,note:(0,q.jsxs)(q.Fragment,{children:[ce[e.mode],` `,e.exists?(0,q.jsxs)(q.Fragment,{children:[`Ratings from `,(0,q.jsx)(`code`,{className:`font-mono text-body-sm`,children:e.file}),e.profiledAt?(0,q.jsxs)(`span`,{"data-tip":W(e.profiledAt),children:[`, made `,E(e.profiledAt)]}):``,e.by?` by ${e.by}`:``,`.`,e.current?``:` They rate other profiles than llms.json has now, so the router does not use them; forgeqe models --profile-models rates them again.`]}):`No models are rated yet: forgeqe models --profile-models rates them, once, into .forgeqe/model-profile.json.`,e.escalations?` ${e.escalations} answer${e.escalations===1?` was`:`s were`} sent to a stronger model in this window.`:``]}),children:[(0,q.jsx)(U,{label:`Model ratings`,search:!1,empty:`No profiles in llms.json.`,head:(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`th`,{scope:`col`,className:F,children:`Profile`}),(0,q.jsx)(`th`,{scope:`col`,className:i(F,`hidden @xl:table-cell`),children:`Model`}),r.map(e=>(0,q.jsx)(`th`,{scope:`col`,className:i(O,`hidden capitalize @2xl:table-cell`),children:e},e)),(0,q.jsx)(`th`,{scope:`col`,className:O,children:`Price per million`})]}),children:e.models.map(e=>(0,q.jsxs)(`tr`,{className:A,children:[(0,q.jsx)(`td`,{className:i(N,`max-w-0`),children:(0,q.jsx)(`span`,{"data-tip":e.reason?`${e.name} · ${e.tier??``} · ${e.reason}`:e.name,className:`block truncate font-medium`,children:e.name})}),(0,q.jsxs)(`td`,{className:i(N,`hidden max-w-[220px] truncate @xl:table-cell`),"data-tip":`${e.provider}/${e.model}`,children:[e.provider,`/`,e.model]}),r.map(t=>(0,q.jsx)(`td`,{className:i(M,`hidden @2xl:table-cell`,e.ratings[t]===void 0&&`text-muted`),children:e.ratings[t]??`–`},t)),(0,q.jsx)(`td`,{className:i(M,!e.price&&`text-muted`),"data-sort":e.price?e.price.input+e.price.output:-1,children:e.price?`${H(e.price.input,e.price.currency)} in, ${H(e.price.output,e.price.currency)} out`:e.provider===`github_copilot`?`seat`:`no price`})]},e.name))}),(0,q.jsx)(U,{label:`Router picks`,search:!1,empty:`No areas.`,head:(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`th`,{scope:`col`,className:F,children:`Area`}),(0,q.jsx)(`th`,{scope:`col`,className:O,children:`Bar`}),(0,q.jsx)(`th`,{scope:`col`,className:F,children:`Picks now`}),(0,q.jsx)(`th`,{scope:`col`,className:i(F,`hidden @xl:table-cell`),children:`Picked in this window`}),(0,q.jsx)(`th`,{scope:`col`,className:i(F,`hidden @2xl:table-cell`),children:`Ran on`})]}),children:e.areas.map(t=>(0,q.jsxs)(`tr`,{className:A,children:[(0,q.jsx)(`td`,{className:i(N,`max-w-0`),children:(0,q.jsx)(`span`,{"data-tip":t.title,className:`block truncate capitalize`,children:t.area})}),(0,q.jsx)(`td`,{className:M,children:t.bar}),(0,q.jsx)(`td`,{className:i(N,`max-w-0`),children:t.pick?(0,q.jsxs)(`span`,{"data-tip":t.pick.reason,className:`block truncate`,children:[t.pick.profile,t.pick.rating===void 0?null:(0,q.jsxs)(`span`,{className:`text-muted`,children:[` · rated `,t.pick.rating]})]}):(0,q.jsx)(`span`,{className:`text-muted`,children:e.mode===`off`?`the active profile`:`nothing passes the checks`})}),(0,q.jsx)(`td`,{className:i(N,`hidden @xl:table-cell`),children:t.seen.length?t.seen.map(e=>`${e.profile} ×${e.n}`).join(`, `):(0,q.jsx)(`span`,{className:`text-muted`,children:`–`})}),(0,q.jsx)(`td`,{className:i(N,`hidden max-w-0 @2xl:table-cell`),children:(()=>{let e=n(t.area);return e.text?(0,q.jsx)(`span`,{"data-tip":e.all,className:`block truncate`,children:e.text}):(0,q.jsx)(`span`,{className:`text-muted`,children:`–`})})()})]},t.area))})]})}export{le as Cost};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{t}from"./react-BDur5s0O.js";import{n,r}from"./route-9BkoTWUE.js";import{I as i,P as a,c as o}from"./surface-c1kG1KPS.js";import{n as s,t as c}from"./utils-DJRAScIl.js";import{t as l}from"./jsx-runtime-LKYXHABd.js";import{d as u}from"./sectionList-B6NF3ZMb.js";import{T as d,X as f,b as p}from"./api-BJHzfOse.js";import{I as m,N as h,P as g,T as _,g as v,i as y,k as b}from"./pageBack-BKHdI-pD.js";import{Cn as x,Cr as S,Gr as C,Hr as w,In as T,Lr as E,M as D,N as O,Pr as k,Rn as A,Vn as j,Wr as M,cn as N,cr as P,lt as ee,nr as te,r as ne,tt as re,ur as ie,vn as ae,w as oe}from"./line-icons-Cwj9OmCz.js";import{u as se}from"./nav-DS7OIItb.js";import{Bt as F,Et as ce,Fn as I,Ft as L,G as le,Gt as R,Kt as z,On as ue,Tt as B,Ut as V,Vt as H,Wt as U,Xt as W,cn as de,kn as fe,l as pe,n as me,t as G,zt as K}from"./index-DZMkBMxL.js";import{f as q,l as J,o as he,r as Y}from"./dataParts-DD4VTinq.js";import{n as ge,t as _e}from"./desktopAppPath-Ch1JeF98.js";import{t as ve}from"./DesktopReview-CDv_Swu0.js";var X=e(t(),1),Z=l(),Q=[`workflows`,`runs`,`machine`],ye={workflows:w,runs:A,machine:x},be={replay:[`Replaying the workflow`,`Replayed the workflow`,`working`],explore:[`Exploring the app`,`Explored the app`,`thinking`],validate:[`Checking the workflow`,`Checked the workflow`,`searching`],setup:[`Setting up the desktop engine`,`Set up the desktop engine`,`working`],doctor:[`Checking this machine`,`Checked this machine`,`searching`]},xe={explore:`Explored`,record:`Recorded`,project:`Project`},Se={replay:`Replay`,explore:`Explore`,record:`Recording`,maestro:`Maestro`},Ce=e=>e.mode===`replay`&&e.ok&&e.heals>0&&!e.healsAccepted;async function we(e,t){try{let{id:t}=await p.start(e,{});location.hash=r(`chats`,t)}catch(e){t(e.message)}}function Te(){let[e,t]=(0,X.useState)(null),[n,r]=(0,X.useState)(``),[i,a]=(0,X.useState)(!1),o=(0,X.useCallback)(()=>{d.view().then(e=>{t(e),r(``)},e=>r(e.message))},[]);(0,X.useEffect)(o,[o]);let s=!!e?.job?.running;return(0,X.useEffect)(()=>{if(!s)return;let e=fe(o,1e3);return()=>ue(e)},[s,o]),{view:e,error:n,setError:r,busy:i||s,act:async e=>{a(!0),r(``);try{return await e(),o(),!0}catch(e){return r(e.message),!1}finally{a(!1)}},load:o,stop:()=>void d.stop().then(o)}}function Ee({w:e,page:t,onClose:n}){let{view:r}=t,[l,u]=(0,X.useState)({}),[f,p]=(0,X.useState)(``),[h,_]=(0,X.useState)(r.heal),[v,y]=(0,X.useState)(!1);(0,X.useEffect)(()=>{e&&(u(Object.fromEntries(e.variables.map(e=>[e.name,e.value]))),p(``),_(r.heal),y(!1))},[e,r.heal]);let b=f.startsWith(`file:`)?{file:f.slice(5)}:f.startsWith(`request:`)?{request:f.slice(8)}:void 0,x=c(o,`flex flex-col gap-4`);return(0,Z.jsx)(I,{open:!!e,onClose:n,title:e?`Replay ${e.name}`:`Replay`,description:`Runs the workflow's steps in its app with no model, checking its expect steps. It takes over this machine's mouse and keyboard while it runs: use a test machine and a test account.`,footer:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(g,{onClick:n,children:[(0,Z.jsx)(C,{"aria-hidden":`true`}),`Cancel`]}),(0,Z.jsxs)(g,{variant:`primary`,disabled:t.busy||!e,onClick:async()=>{e&&await t.act(()=>d.replay({workflow:e.path,variables:l,...b?{rows:b}:{},heal:h,updateBaselines:v}))&&n()},"data-tip":`Replay now`,children:[(0,Z.jsx)(A,{"aria-hidden":`true`}),`Replay`]})]}),children:e&&(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4 pt-4`,children:[(0,Z.jsxs)(`p`,{className:`m-0 flex flex-wrap gap-x-4 text-body-sm text-muted`,children:[(0,Z.jsx)(`span`,{className:`font-mono`,children:e.path}),(0,Z.jsxs)(`span`,{children:[e.app||`no app`,` · `,s(e.steps,`step`),` · `,s(e.checks,`check`)]})]}),e.checks===0&&(0,Z.jsx)(`p`,{className:c(m.warn,`m-0`),children:`It has no checks of the outcome: a replay passes when its steps run. Ask the agent to add expect steps.`}),e.variables.length>0&&(0,Z.jsx)(W,{level:3,icon:k,title:`Values`,className:x,children:(0,Z.jsx)(`div`,{className:`grid grid-cols-[repeat(auto-fit,minmax(200px,1fr))] gap-4`,children:e.variables.map(e=>(0,Z.jsx)(Y,{label:e.name,children:(0,Z.jsx)(a,{value:l[e.name]??``,onChange:t=>u({...l,[e.name]:t.target.value})})},e.name))})}),(0,Z.jsx)(W,{level:3,icon:re,title:`Test data`,className:x,children:(0,Z.jsx)(Y,{label:`Rows`,hint:`Each row replays the workflow once, its columns over the values above.`,children:(0,Z.jsxs)(i,{value:f,onChange:e=>p(e.target.value),children:[(0,Z.jsx)(`option`,{value:``,children:`Once, with the values above`}),r.rows.files.map(e=>(0,Z.jsxs)(`option`,{value:`file:${e}`,children:[`Each row of `,e]},e)),r.rows.requests.map(e=>(0,Z.jsxs)(`option`,{value:`request:${e}`,children:[`Each row of request `,e]},e))]})})}),(0,Z.jsxs)(W,{level:3,icon:te,title:`While it runs`,className:x,children:[(0,Z.jsx)(q,{on:h,set:_,children:`Heal a step whose control moved`}),(0,Z.jsx)(q,{on:v,set:y,children:`Take new image baselines`})]})]})})}function De({open:e,page:t,onClose:n}){let{view:r}=t,[o,s]=(0,X.useState)(r.apps[0]?.name??``),[l,u]=(0,X.useState)(``),[f,p]=(0,X.useState)(``);return(0,Z.jsx)(I,{open:e,onClose:n,title:`Explore a goal`,description:`DeskPilot carries out the goal in the app with a vision model and saves what it did as a workflow, with checks of the outcome, to replay with no model.`,footer:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(g,{onClick:n,children:[(0,Z.jsx)(C,{"aria-hidden":`true`}),`Cancel`]}),(0,Z.jsxs)(g,{variant:`primary`,disabled:t.busy||!l.trim()||!o,onClick:async()=>{await t.act(()=>d.explore(o,l.trim(),f.trim()))&&(u(``),p(``),n())},"data-tip":`Start: DeskPilot takes over the mouse and keyboard`,children:[(0,Z.jsx)(P,{"aria-hidden":`true`}),`Start exploring`]})]}),children:(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4 pt-4`,children:[(0,Z.jsx)(Y,{label:`App`,children:(0,Z.jsx)(i,{value:o,onChange:e=>s(e.target.value),children:r.apps.map(e=>(0,Z.jsx)(`option`,{value:e.name,children:e.name},e.name))})}),(0,Z.jsx)(Y,{label:`Goal`,hint:`One line, as you would ask a tester.`,children:(0,Z.jsx)(a,{value:l,maxLength:500,placeholder:`Create an invoice for Contoso and save it`,onChange:e=>u(e.target.value)})}),(0,Z.jsx)(Y,{label:`Name`,hint:`Optional: the workflow's name.`,children:(0,Z.jsx)(a,{value:f,maxLength:80,onChange:e=>p(e.target.value)})}),(0,Z.jsxs)(`p`,{className:c(m.warn,`m-0 flex gap-2`),children:[(0,Z.jsx)(D,{size:16,"aria-hidden":`true`,className:`mt-1 flex-none`}),`DeskPilot controls this machine's mouse and keyboard in `,o||`the app`,`, in that app's windows only (no shell commands). Use a test machine and a test account.`]})]})})}function Oe({open:e,page:t,onClose:n}){let{view:r}=t,[i,a]=(0,X.useState)(r.windows),[o,s]=(0,X.useState)(!1);return(0,Z.jsx)(I,{open:e,onClose:n,title:`Set up the desktop engine`,description:`Downloads ForgeQE's pinned packages for desktop replay on this machine, and takes a few minutes.`,footer:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(g,{onClick:n,children:[(0,Z.jsx)(C,{"aria-hidden":`true`}),`Cancel`]}),(0,Z.jsxs)(g,{variant:`primary`,disabled:t.busy,onClick:async()=>{await t.act(()=>d.setup({ufo:r.windows&&i,force:o}))&&n()},children:[(0,Z.jsx)(M,{"aria-hidden":`true`}),`Set up`]})]}),children:(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4 pt-4`,children:[r.windows?(0,Z.jsx)(q,{on:i,set:a,children:`Exploring a goal too (DeskPilot)`}):(0,Z.jsx)(`p`,{className:`m-0 text-body-sm text-muted`,children:`On this system workflows replay by accessibility calls, which this sets up too. Exploring and recording by hand need Windows.`}),(0,Z.jsx)(q,{on:o,set:s,children:`Set it up again from scratch`})]})})}var $=e=>(e??[]).map(e=>/\s/.test(e)?`"${e}"`:e).join(` `);function ke({open:e,editing:t,page:n,onClose:r}){let[i,o]=(0,X.useState)(``),[s,l]=(0,X.useState)(``),[u,f]=(0,X.useState)(!1),[p,m]=(0,X.useState)(``),[h,_]=(0,X.useState)(``),[v,y]=(0,X.useState)(``),[b,x]=(0,X.useState)(!1);(0,X.useEffect)(()=>{e&&(o(t?.path??``),l(t?.name??``),f(!!t),m(t?.description??``),_($(t?.args)),y(``))},[e,t]);let S=async()=>{x(!0),y(``);let e={name:s.trim(),path:i.trim(),...h.trim()?{args:h.trim()}:{},...p.trim()?{description:p.trim()}:{}};try{await(t?d.editApp(e):d.addApp(e)),n.load(),r()}catch(e){y(e.message)}finally{x(!1)}};return(0,Z.jsx)(I,{open:e,onClose:r,title:t?`Change ${t.name}`:`Add a desktop app`,description:t?`Its program, arguments and description. Its name stays: workflows and the agent name it by it.`:`The app's program on this computer: an .exe on Windows. It is added to the active environment's apps (or forgeqe.yaml's), so it can be recorded, explored and replayed by its name.`,footer:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(g,{onClick:r,children:[(0,Z.jsx)(C,{"aria-hidden":`true`}),`Cancel`]}),(0,Z.jsxs)(g,{variant:`accent`,disabled:b||!i.trim()||!s.trim(),onClick:()=>void S(),children:[t?(0,Z.jsx)(oe,{"aria-hidden":`true`}):(0,Z.jsx)(j,{"aria-hidden":`true`}),b?t?`Saving…`:`Adding…`:t?`Save`:`Add the app`]})]}),children:(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4 pt-4`,children:[(0,Z.jsx)(Y,{label:`Program`,hint:`Type its path, or Browse to choose it on this computer.`,children:(0,Z.jsx)(_e,{value:i,onChange:e=>{o(e),u||l(e.trim()?ge(e):``)},onPicked:(e,t)=>{u||l(t)},onError:y})}),(0,Z.jsx)(Y,{label:`Arguments`,hint:`Optional: what the app starts with. Quotes keep spaces together; each goes to the app as it is, no shell.`,children:(0,Z.jsx)(a,{value:h,maxLength:500,spellCheck:!1,placeholder:`--server qa-db01 --profile "Test User"`,onChange:e=>_(e.target.value),className:`font-mono text-body-sm`})}),(0,Z.jsx)(Y,{label:`Name`,hint:t?`Fixed: workflows name the app by it.`:`How workflows and the agent name it: letters, digits and _ . -`,children:(0,Z.jsx)(a,{value:s,maxLength:40,spellCheck:!1,readOnly:!!t,className:c(t&&`bg-surface-muted text-muted`),onChange:e=>{f(!0),l(e.target.value)}})}),(0,Z.jsx)(Y,{label:`What it is for`,hint:`Optional: one line the agent reads to pick the app.`,children:(0,Z.jsx)(a,{value:p,maxLength:200,placeholder:`Back-office invoicing`,onChange:e=>m(e.target.value)})}),v&&(0,Z.jsx)(J,{text:v})]})})}function Ae({app:e,page:t,onClose:n}){let[r,i]=(0,X.useState)(null),[a,o]=(0,X.useState)(``),[l,u]=(0,X.useState)(!1);return(0,X.useEffect)(()=>{e&&(i(null),o(``),d.removeApp(e.name,!1).then(i,e=>o(e.message)))},[e]),(0,Z.jsx)(I,{open:!!e,onClose:n,title:e?`Remove ${e.name}`:`Remove the app`,description:`It comes off the apps list, so it can no longer be recorded or replayed until it is added again. Its workflows and recordings stay.`,footer:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(g,{onClick:n,children:[(0,Z.jsx)(C,{"aria-hidden":`true`}),`Cancel`]}),(0,Z.jsxs)(g,{busy:l,variant:`destructive`,disabled:l||!r,onClick:async()=>{if(e){u(!0);try{await d.removeApp(e.name,!0),t.load(),n()}catch(e){o(e.message)}finally{u(!1)}}},children:[(0,Z.jsx)(S,{"aria-hidden":`true`}),l?`Removing…`:`Remove`]})]}),children:(0,Z.jsx)(`div`,{className:`flex flex-col gap-4 pt-4 text-body-sm`,children:a?(0,Z.jsx)(J,{text:a}):r?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`m-0 text-ink-2`,children:[`From `,r.where,`.`]}),r.usedBy.length?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:c(m.warn,`m-0`),children:[s(r.usedBy.length,`workflow`),` name`,r.usedBy.length===1?`s`:``,` it and will not replay until an app of that name is added again.`]}),(0,Z.jsxs)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0 font-mono text-body-sm text-ink-2`,children:[r.usedBy.slice(0,20).map(e=>(0,Z.jsx)(`li`,{className:`truncate`,"data-tip":e,children:e},e)),r.usedBy.length>20&&(0,Z.jsxs)(`li`,{className:`font-sans text-muted`,children:[`and `,r.usedBy.length-20,` more`]})]})]}):(0,Z.jsx)(`p`,{className:`m-0 text-muted`,children:`No workflow names it.`})]}):(0,Z.jsx)(`p`,{role:`status`,className:`m-0 text-muted`,children:`Looking for the workflows that use it…`})})})}function je({page:e,onReplay:t,onExplore:n,onSteps:a}){let{view:o}=e,[s,l]=(0,X.useState)(o.apps[0]?.name??``),u=o.windows?void 0:o.windowsOnly,p=()=>e.act(async()=>{await f.start({kind:`desktop`,app:s}),location.hash=r(`record`)});return(0,Z.jsx)(K,{label:`Desktop workflows`,minWidth:720,height:F,placeholder:`Find a workflow`,empty:`No workflows yet: record one by hand, explore a goal, or keep .yaml files with format: forgeqe-desktop-v1 in the project.`,tools:(0,Z.jsxs)(`div`,{className:`ml-auto flex flex-wrap items-center gap-2`,children:[o.apps.length>1&&(0,Z.jsx)(i,{size:`sm`,"aria-label":`App to record`,value:s,onChange:e=>l(e.target.value),className:`w-auto`,children:o.apps.map(e=>(0,Z.jsx)(`option`,{value:e.name,children:e.name},e.name))}),(0,Z.jsxs)(g,{size:`sm`,disabled:e.busy||!o.windows||!s,onClick:()=>void p(),"data-tip":u??`Record your steps in ${s}: no model`,children:[(0,Z.jsx)(x,{"aria-hidden":`true`}),`Record by hand`]}),(0,Z.jsxs)(g,{size:`sm`,variant:`primary`,disabled:e.busy||!o.windows||!o.apps.length,onClick:n,"data-tip":u??`DeskPilot carries out a goal and saves it as a workflow`,children:[(0,Z.jsx)(P,{"aria-hidden":`true`}),`Explore a goal`]})]}),head:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`th`,{scope:`col`,className:U,children:`Workflow`}),(0,Z.jsx)(`th`,{scope:`col`,className:U,children:`App`}),(0,Z.jsx)(`th`,{scope:`col`,className:R,children:`Steps`}),(0,Z.jsx)(`th`,{scope:`col`,className:R,children:`Checks`}),(0,Z.jsx)(`th`,{scope:`col`,className:U,children:`From`}),(0,Z.jsx)(`th`,{scope:`col`,className:U,children:(0,Z.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:o.workflows.map(n=>(0,Z.jsxs)(`tr`,{className:z,children:[(0,Z.jsx)(`td`,{className:H,children:(0,Z.jsxs)(`span`,{className:`flex flex-col gap-1`,children:[(0,Z.jsx)(g,{variant:`link`,size:`inline`,onClick:()=>a(n),className:`self-start text-left whitespace-normal text-ink`,children:n.name}),(0,Z.jsx)(`span`,{className:`max-w-[300px] truncate font-mono text-body-sm text-muted`,"data-tip":n.path,children:n.path})]})}),(0,Z.jsx)(`td`,{className:c(H,`whitespace-nowrap`),children:n.app||(0,Z.jsx)(`span`,{className:`text-muted`,children:`—`})}),(0,Z.jsx)(`td`,{className:V,children:n.steps}),(0,Z.jsx)(`td`,{className:c(V,n.checks===0&&`text-warn`),"data-tip":n.checks===0?`No checks of the outcome: a replay passes when its steps run`:void 0,children:n.checks}),(0,Z.jsxs)(`td`,{className:c(H,`whitespace-nowrap`),children:[xe[n.from],(0,Z.jsx)(`span`,{className:`block text-body-sm text-muted`,children:L(n.modified)})]}),(0,Z.jsx)(`td`,{className:c(H,`whitespace-nowrap text-right`),children:(0,Z.jsxs)(`span`,{className:`inline-flex gap-1`,children:[(0,Z.jsx)(g,{size:`icon`,variant:`icon`,onClick:()=>a(n),"aria-label":`Open ${n.name}`,"data-tip":`Open it: steps, checks, test data, last run`,className:`size-8`,children:(0,Z.jsx)(ee,{"aria-hidden":`true`})}),(0,Z.jsx)(g,{size:`icon`,variant:`icon`,disabled:e.busy,onClick:()=>t(n),"aria-label":`Replay ${n.name}`,"data-tip":`Replay ${n.name}`,className:`size-8`,children:(0,Z.jsx)(A,{"aria-hidden":`true`})}),(0,Z.jsx)(g,{size:`icon`,variant:`icon`,disabled:e.busy,onClick:()=>void e.act(()=>d.validate(n.path)),"aria-label":`Check ${n.name}`,"data-tip":`Check it without running it`,className:`size-8`,children:(0,Z.jsx)(N,{"aria-hidden":`true`})}),(0,Z.jsx)(g,{size:`icon`,variant:`icon`,onClick:()=>void we(`DeskPilot: look at the desktop workflow ${n.path} and tell me what to fix or add (a wait, a timeout, a dialog to dismiss, checks of the outcome); change it with desktop_edit_workflow only after showing me the change.`,e.setError),"aria-label":`Improve ${n.name} with the agent`,"data-tip":`Improve it with the agent`,className:`size-8`,children:(0,Z.jsx)(E,{"aria-hidden":`true`})})]})})]},n.path))})}function Me({page:e}){let{view:t}=e,[n,r]=(0,X.useState)(`all`),[i,a]=(0,X.useState)(``),o=t.runs.filter(e=>!e.ok),l=t.runs.filter(Ce),u=n===`failed`?o:n===`heals`?l:t.runs;return(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[i&&(0,Z.jsx)(`p`,{role:`status`,className:c(m.pass,`m-0`),children:i}),(0,Z.jsx)(K,{label:`Desktop runs`,minWidth:720,height:F,resetKey:n,placeholder:`Find a run`,empty:n===`all`?`No desktop runs yet: replay, record or explore a workflow.`:`None.`,tools:(0,Z.jsx)(_,{value:n,onChange:r,items:[{id:`all`,label:`All`,n:t.runs.length},{id:`failed`,label:`Failed`,n:o.length,alert:!0},{id:`heals`,label:`Heals to accept`,n:l.length}]}),head:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`th`,{scope:`col`,className:U,children:`Run`}),(0,Z.jsx)(`th`,{scope:`col`,className:U,children:`Result`}),(0,Z.jsx)(`th`,{scope:`col`,className:R,children:`Steps`}),(0,Z.jsx)(`th`,{scope:`col`,className:U,children:`Heals`}),(0,Z.jsx)(`th`,{scope:`col`,className:U,children:(0,Z.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:u.map(t=>(0,Z.jsxs)(`tr`,{className:z,children:[(0,Z.jsx)(`td`,{className:H,children:(0,Z.jsxs)(`span`,{className:`flex flex-col gap-1`,children:[(0,Z.jsxs)(`span`,{className:`font-medium`,children:[Se[t.mode],`: `,t.name]}),(0,Z.jsx)(`span`,{className:`text-body-sm text-muted`,children:[t.app,L(t.at)].filter(Boolean).join(` · `)}),(t.failed||t.error)&&(0,Z.jsx)(`span`,{className:`max-w-[380px] truncate text-body-sm text-fail`,"data-tip":t.failed?t.failed.error:t.error,children:t.failed?`Step ${t.failed.index} (${t.failed.op}): ${t.failed.error||`failed`}`:t.error})]})}),(0,Z.jsx)(`td`,{className:c(H,`whitespace-nowrap`),children:(0,Z.jsx)(b,{tone:t.ok?`pass`:`fail`,children:t.many?`${t.many.passed} of ${t.many.total}`:t.ok?`Passed`:`Failed`})}),(0,Z.jsx)(`td`,{className:V,children:t.steps||(0,Z.jsx)(`span`,{className:`text-muted`,children:`—`})}),(0,Z.jsx)(`td`,{className:c(H,`whitespace-nowrap`),children:t.heals?t.healsAccepted?(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-body-sm text-pass`,children:[(0,Z.jsx)(O,{size:14,"aria-hidden":`true`}),`In the workflow`]}):t.ok?(0,Z.jsxs)(g,{size:`sm`,disabled:e.busy,onClick:()=>void e.act(async()=>{let e=await d.acceptHeals(t.dir);a(`Wrote ${s(e.written,`healed step`)} into ${e.workflow}.`)}),"data-tip":`Write the new locators into the workflow`,children:[(0,Z.jsx)(M,{"aria-hidden":`true`}),`Accept `,s(t.heals,`heal`)]}):(0,Z.jsxs)(`span`,{className:`text-body-sm text-muted`,"data-tip":`The replay failed after healing, so its heals may be wrong`,children:[s(t.heals,`heal`),`, not offered`]}):(0,Z.jsx)(`span`,{className:`text-muted`,children:`—`})}),(0,Z.jsx)(`td`,{className:c(H,`whitespace-nowrap text-right`),children:(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[t.report&&(0,Z.jsx)(y,{path:t.report,children:`Report`}),!t.ok&&(0,Z.jsx)(g,{size:`icon`,variant:`icon`,onClick:()=>void we(`DeskPilot: the desktop ${t.mode} ${t.dir} failed${t.workflow?` (workflow ${t.workflow})`:``}. Read its report, tell me why, and offer a fix.`,e.setError),"aria-label":`Ask the agent why it failed`,"data-tip":`Ask the agent why it failed`,className:`size-8`,children:(0,Z.jsx)(ae,{"aria-hidden":`true`})})]})})]},t.dir))})]})}function Ne({page:e,onSetup:t,onAdd:n,onEdit:i,onRemove:a}){let{view:s}=e,l=(s.driver===`auto`?s.windows?`pywinauto`:`agent-desktop`:s.driver)===`pywinauto`?`the mouse and keyboard`:`accessibility calls`,u=[{label:`Replay`,ok:s.engine.ready,note:s.engine.ready?`On ${l}`:(s.engine.error||`The desktop engine is not set up`).replace(/^./,e=>e.toUpperCase())},{label:`Explore and record`,ok:s.windows&&s.engine.ufo,note:s.windows?s.engine.ufo?`Set up`:`Not set up`:`Windows only`},{label:`Healing`,ok:s.heal,note:s.heal?`A moved control is healed with the model`:`desktop.heal is off`}],f=c(o,`flex flex-col`);return(0,Z.jsxs)(`div`,{className:`grid grid-cols-[repeat(auto-fit,minmax(min(100%,320px),1fr))] items-start gap-6`,children:[(0,Z.jsxs)(W,{id:`desktop-machine`,icon:x,title:`This machine`,divider:!1,children:[(0,Z.jsx)(`ul`,{className:c(f,`m-0 list-none divide-y divide-line-soft p-0`),children:u.map(e=>(0,Z.jsxs)(`li`,{className:`flex items-start gap-2 px-4 py-2`,children:[e.ok?(0,Z.jsx)(O,{size:16,"aria-label":`Ready`,className:`mt-1 flex-none text-pass`}):(0,Z.jsx)(D,{size:16,"aria-label":`Not ready`,className:`mt-1 flex-none text-warn`}),(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,Z.jsx)(`span`,{className:`text-body-sm font-medium`,children:e.label}),(0,Z.jsx)(`span`,{className:`text-body-sm text-muted [overflow-wrap:anywhere]`,"data-tip":!e.ok&&e.label===`Explore and record`&&s.windowsOnly?s.windowsOnly:void 0,children:e.note})]})]},e.label))}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,Z.jsxs)(g,{size:`sm`,disabled:e.busy,onClick:()=>void e.act(()=>d.doctor()),"data-tip":`Whether replay can run here unattended`,children:[(0,Z.jsx)(N,{"aria-hidden":`true`}),`Check`]}),(0,Z.jsxs)(g,{size:`sm`,variant:s.engine.ready?`outline`:`primary`,disabled:e.busy,onClick:t,"data-tip":`Download and set up the desktop engine`,children:[(0,Z.jsx)(M,{"aria-hidden":`true`}),`Set up`]})]})]}),(0,Z.jsxs)(W,{id:`desktop-apps`,icon:ne,title:`Apps`,divider:!1,actions:(0,Z.jsxs)(g,{size:`sm`,onClick:n,"data-tip":`Add an app by its program on this computer`,children:[(0,Z.jsx)(j,{"aria-hidden":`true`}),`Add an app`]}),children:[s.apps.length?(0,Z.jsx)(`ul`,{className:c(f,`m-0 list-none divide-y divide-line-soft p-0`),children:s.apps.map(e=>(0,Z.jsxs)(`li`,{className:`group flex items-start gap-2 px-4 py-2`,children:[(0,Z.jsx)(h,{icon:x,size:16,className:`mt-1 flex-none text-muted`}),(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,Z.jsx)(`span`,{className:`text-body-sm font-medium`,children:e.name}),(0,Z.jsxs)(`span`,{className:`truncate font-mono text-body-sm text-muted`,"data-tip":[e.path,...e.args??[]].join(` `),children:[e.path||`No path`,e.args?.length?(0,Z.jsxs)(`span`,{className:`text-ink-2`,children:[` `,$(e.args)]}):null]}),e.description&&(0,Z.jsx)(`span`,{className:`text-body-sm text-muted`,children:e.description})]}),(0,Z.jsxs)(`span`,{className:`flex flex-none gap-1`,children:[(0,Z.jsx)(g,{size:`icon`,variant:`icon`,onClick:()=>i(e),"aria-label":`Change ${e.name}`,"data-tip":`Change ${e.name}`,className:`size-8`,children:(0,Z.jsx)(T,{"aria-hidden":`true`})}),(0,Z.jsx)(g,{size:`icon`,variant:`icon`,onClick:()=>a(e),"aria-label":`Remove ${e.name}`,"data-tip":`Remove ${e.name}`,className:`size-8`,children:(0,Z.jsx)(S,{"aria-hidden":`true`})})]})]},e.name))}):(0,Z.jsxs)(de,{className:`py-4`,children:[`No desktop apps yet: add one by its program, or in `,(0,Z.jsx)(`a`,{href:r(`settings`,`environments`),children:`Settings, Environments`}),`.`]}),(0,Z.jsxs)(`p`,{className:`m-0 text-body-sm text-muted`,children:[`Secrets a workflow may type: `,s.secrets.length?s.secrets.join(`, `):`none`,`.`,s.refusedSecrets.length>0&&(0,Z.jsxs)(`span`,{className:`text-fail`,children:[` `,s.refusedSecrets.join(`, `),` `,s.refusedSecrets.length===1?`is`:`are`,` ForgeQE's own: take `,s.refusedSecrets.length===1?`it`:`them`,` out of desktop.secrets, or nothing replays.`]})]})]})]})}function Pe({view:e,onTab:t}){let n=e.runs.filter(e=>e.mode===`replay`),r=n.filter(e=>e.ok).length,i=n[0],a=e.runs.filter(Ce).length,o=e.workflows.filter(e=>e.checks===0).length;return(0,Z.jsxs)(ce,{label:`Desktop at a glance`,children:[(0,Z.jsx)(B,{compact:!0,label:`Workflows`,value:e.workflows.length,note:o?(0,Z.jsxs)(`span`,{className:`text-warn`,children:[o,` without checks`]}):`${s(e.apps.length,`app`)}`}),(0,Z.jsx)(B,{compact:!0,label:`Replays passed`,value:n.length?`${r} of ${n.length}`:(0,Z.jsx)(`span`,{className:`text-body-sm text-muted`,children:`None yet`}),tone:n.length&&r<n.length?`text-fail`:void 0,...i?{note:`Last ${L(i.at)}`}:{}}),(0,Z.jsx)(B,{compact:!0,label:`Heals to accept`,value:a,tone:a?`text-accent-fg`:void 0,note:a?(0,Z.jsx)(g,{variant:`link`,size:`inline`,onClick:()=>t(`runs`),children:`Review them`}):`From passed replays`}),(0,Z.jsx)(B,{compact:!0,label:`Replay here`,value:e.engine.ready?`Ready`:`Not set up`,tone:e.engine.ready?`text-pass`:`text-warn`,note:e.engine.ready?e.windows?`Windows`:`Explore needs Windows`:(0,Z.jsx)(g,{variant:`link`,size:`inline`,onClick:()=>t(`machine`),children:`Set it up`})})]})}function Fe({sub:e}){let t=Te(),{view:i,error:a}=t,o=u(`desktop`),s=(e??``).split(`/`),l=s[0]===`workflow`&&s[1]?n(s[1]):``,f=l?`workflows`:Q.includes(s[0])?s[0]:G,[p,h]=(0,X.useState)(null),[_,y]=(0,X.useState)(!1),[b,x]=(0,X.useState)(!1),[S,C]=(0,X.useState)(!1),[w,T]=(0,X.useState)(),[E,D]=(0,X.useState)(null),O=l&&i?.workflows.find(e=>e.path===l)||null,k=e=>location.hash=e?r(`desktop`,`workflow`,encodeURIComponent(e.path)):r(`desktop`,`workflows`),A=i?.job??null,j=e=>e===`agent`?r(`desktop`,G):r(`desktop`,e),M=e=>location.hash=j(e),N={workflows:`Workflows`,runs:`Runs`,machine:`Machine and apps`},P=i?{workflows:i.workflows.length,runs:i.runs.length}:{};return(0,Z.jsxs)(me,{title:se(`desktop`),page:o,label:`Desktop apps`,current:f,tabHref:j,onPick:M,tabs:Q.map(e=>({id:e,label:N[e],icon:ye[e],...P[e]===void 0?{}:{n:P[e]}})),below:(0,Z.jsx)(pe,{page:o}),children:[(0,Z.jsx)(le,{more:(0,Z.jsx)(Z.Fragment,{children:`Explore a goal with DeskPilot or record your steps by hand, then replay them with no model; a control that moved is healed and offered for the workflow.`}),children:`Test your Windows desktop apps with workflows that replay on their own.`}),a&&(0,Z.jsx)(J,{text:a}),!i&&!a&&(0,Z.jsx)(v,{shape:`rows`}),i&&O&&(0,Z.jsx)(ve,{workflow:O.path,backLabel:`Workflows`,tab:s[2],onTab:e=>location.hash=e===`steps`?r(`desktop`,`workflow`,encodeURIComponent(O.path)):r(`desktop`,`workflow`,encodeURIComponent(O.path),e),onClose:()=>{k(null),t.load()}},O.path),i&&!O&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Pe,{view:i,onTab:M}),A&&(A.running||!A.endedAt||Date.now()-Date.parse(A.endedAt)<6e5)&&(0,Z.jsx)(he,{job:A,onStop:t.stop,words:be}),A?.question&&(0,Z.jsxs)(`div`,{className:c(m.info,`flex flex-col gap-2`),children:[(0,Z.jsx)(`p`,{className:`m-0 font-medium`,children:A.question.title}),A.question.detail&&(0,Z.jsx)(`p`,{className:`m-0 text-ink-2`,children:A.question.detail}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[A.question.options.map(e=>(0,Z.jsx)(g,{size:`sm`,onClick:()=>void t.act(()=>d.answer(A.question.id,e.id)),children:e.label},e.id)),(0,Z.jsxs)(g,{size:`sm`,variant:`danger`,onClick:()=>void t.act(()=>d.answer(A.question.id,null)),children:[(0,Z.jsx)(ie,{fill:`currentColor`,"aria-hidden":`true`}),`Stop`]})]})]}),(0,Z.jsxs)(`div`,{children:[f===`workflows`&&(0,Z.jsx)(je,{page:{...t,view:i},onReplay:h,onExplore:()=>y(!0),onSteps:k}),f===`runs`&&(0,Z.jsx)(Me,{page:{...t,view:i}}),f===`machine`&&(0,Z.jsx)(Ne,{page:{...t,view:i},onSetup:()=>x(!0),onAdd:()=>{T(void 0),C(!0)},onEdit:e=>{T(e),C(!0)},onRemove:D})]}),(0,Z.jsx)(Ee,{w:p,page:{...t,view:i},onClose:()=>h(null)}),(0,Z.jsx)(De,{open:_,page:{...t,view:i},onClose:()=>y(!1)}),(0,Z.jsx)(Oe,{open:b,page:{...t,view:i},onClose:()=>x(!1)}),(0,Z.jsx)(ke,{open:S,editing:w,page:{...t,view:i},onClose:()=>C(!1)}),(0,Z.jsx)(Ae,{app:E,page:{...t,view:i},onClose:()=>D(null)})]})]})}export{Fe as Desktop};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{t}from"./react-BDur5s0O.js";import{n,r}from"./route-9BkoTWUE.js";import{I as i,L as a,P as o,V as s,c,i as l,s as u}from"./surface-c1kG1KPS.js";import{n as d,t as f}from"./utils-DJRAScIl.js";import{t as p}from"./jsx-runtime-LKYXHABd.js";import{I as m}from"./palette-BEo5X3wD.js";import{O as h}from"./api-BJHzfOse.js";import{F as g,I as _,N as v,O as y,P as b,T as ee,d as x,g as S,k as C,n as w,o as T}from"./pageBack-BKHdI-pD.js";import{B as E,D as te,E as D,Er as O,Gr as k,Jn as A,N as j,Nt as M,O as ne,R as N,Tt as re,Vn as ie,Wr as ae,Yn as oe,Zt as se,_ as ce,cn as P,cr as le,ir as ue,it as de,k as fe,on as pe,pt as me,vn as he,w as ge,x as _e,xt as ve,yn as ye,z as be}from"./line-icons-Cwj9OmCz.js";import{Dt as xe,Ft as F,G as I,Gt as Se,It as Ce,J as we,Jt as Te,Kt as Ee,L as De,U as Oe,Ut as ke,V as Ae,Vt as je,W as L,Wt as Me,Zt as Ne,cn as R,pn as Pe,zt as z}from"./index-DZMkBMxL.js";import{i as B,r as V}from"./productParts-Cjy7N4bQ.js";var H=e(t(),1),U=p(),Fe={"forgeqe-session":`ForgeQE session`,otlp:`OpenTelemetry trace`,jsonl:`the agent's own log`,langfuse:`Langfuse`,langsmith:`LangSmith`},Ie={tool:ae,model:le,say:he,plan:P,handoff:A,ask:he,policy:ue,error:O},Le={text:`What it said`,file_change:`A file it changed`,report:`A report`,test_result:`A test result`,message:`A message it sent`},Re={request:`the request`,tool_result:`a tool's result`,file:`a file`,document:`a document`,memory:`memory`,agent:`another agent's answer`,person:`a person`},W=e=>e.replace(/[\u0000-\u0008\u000b-\u001f\u007f-\u009f\u2028\u2029]/g,e=>`\\u${e.charCodeAt(0).toString(16).padStart(4,`0`)}`),G=e=>{if(!e)return``;let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString([],{month:`short`,day:`numeric`,...t.getFullYear()===new Date().getFullYear()?{}:{year:`numeric`},hour:`numeric`,minute:`2-digit`,second:`2-digit`})},K=25,q={PASS:{tone:`pass`,label:`Pass`},WARN:{tone:`warn`,label:`Warning`},FAIL:{tone:`fail`,label:`Fail`},UNKNOWN:{tone:`neutral`,label:`Not known`}},J={required_steps:`Required steps`,allowed_actions:`Allowed actions`,tool_inputs:`Tool inputs`,limits:`Limits`,handover:`Hand-over`,statements:`What it said`,grounded_decisions:`Grounded decisions`,data_allowed:`Data allowed`,data_used:`Facts from its data`,stated_reasons:`Stated reasons`,instructions_in_data:`Instructions in data`,business_rules:`Business rules`,architecture:`Architecture`,dependencies:`Dependencies`,regression:`Regression`,security:`Security`,acceptance:`Acceptance criteria`,build_and_test:`Build and test`,content_rules:`Answer rules`,grounded:`Grounded in its inputs`,rubric:`Owner's rubric`},ze={build:{title:`Does the change work?`,icon:re},behaviour:{title:`Did it work the agreed way?`,icon:E},decisions:{title:`Did it decide on the right grounds, with data it may use?`,icon:oe},content:{title:`Was its answer right: on topic, grounded, complete?`,icon:me},domain:{title:`Was its change right for the product?`,icon:ce}},Y=200,Be=`Agent governance`;function X({id:e,back:t=!0,children:n}){let r=Ae.some(t=>t.id===e);return(0,U.jsxs)(U.Fragment,{children:[t&&(0,U.jsx)(w,{}),(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-6 gap-y-2`,children:[(0,U.jsxs)(`span`,{className:`flex items-center gap-4`,children:[(0,U.jsx)(Pe,{pixel:m[r?Ae[0].id:e],size:`lg`,head:!0}),(0,U.jsx)(`h1`,{className:`m-0 text-headline-md`,children:r?Be:n})]}),r&&(0,U.jsx)(xe,{label:`Governance`,links:Ae,current:e})]})]})}function Z({shape:e=`rows`}){return(0,U.jsx)(S,{shape:e})}function Ve(){return(0,U.jsxs)(R,{page:!0,icon:re,title:`No agent run recorded yet`,action:(0,U.jsx)(`a`,{href:`/help/guide`,target:`_blank`,rel:`noreferrer noopener`,className:g({size:`sm`}),children:`Read how to record a run`}),children:[`An agent's runs show here once they are recorded: while it runs, from its traces, or afterwards, from an export or its own log. At a terminal that is `,(0,U.jsx)(`code`,{children:`forgeqe evidence receive`}),` or `,(0,U.jsx)(`code`,{children:`forgeqe evidence record`}),`.`]})}var He=(0,U.jsxs)(U.Fragment,{children:[`Receive an agent's OpenTelemetry traces while it runs with `,(0,U.jsx)(`code`,{children:`forgeqe evidence receive`}),`; record a file with `,(0,U.jsx)(`code`,{children:`forgeqe evidence record`}),`: an OpenTelemetry export, a Langfuse or LangSmith export, an agent's own JSON log with `,(0,U.jsx)(`code`,{children:`--mapping mapping.yaml`}),`, or ForgeQE's own last session with `,(0,U.jsx)(`code`,{children:`--latest`}),`.`]});function Ue({refused:e}){return e.length?(0,U.jsxs)(`section`,{"aria-label":`Files that are not run records`,className:f(_.warn,`flex flex-col gap-1`),children:[(0,U.jsxs)(`span`,{className:`font-medium`,children:[d(e.length,`file`),` in the runs folder `,e.length===1?`is`:`are`,` not a run record and `,e.length===1?`is`:`are`,` not shown:`]}),e.slice(0,10).map(e=>(0,U.jsx)(`span`,{className:`[overflow-wrap:anywhere]`,children:e},e))]}):null}function We(){let[e,t]=(0,H.useState)(null),[n,i]=(0,H.useState)(``);return(0,H.useEffect)(()=>{h.overview().then(t,e=>i(e.message))},[]),(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(X,{id:`evidence`,children:`Evidence`}),(0,U.jsx)(I,{more:(0,U.jsxs)(U.Fragment,{children:[`What AI agents did, how, what they decided and why, and what data they used, from the records of their runs. What an agent says about its own work is kept as a claim, to be checked against what it did; what a record cannot say is listed, never guessed. `,He]}),children:`See what your AI agents did and decided, and whether it was what was agreed.`}),n&&(0,U.jsx)(V,{text:n}),!e&&!n&&(0,U.jsx)(Z,{shape:`detail`}),e&&(0,U.jsx)(Ue,{refused:e.refused}),e&&!e.runs&&(0,U.jsx)(Ve,{}),e&&e.runs>0&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(Oe,{label:`What is recorded`,children:[(0,U.jsx)(L,{dot:`neutral`,value:e.runs,label:e.runs===1?`run recorded`:`runs recorded`}),(0,U.jsx)(L,{dot:`neutral`,value:e.agents.length,label:e.agents.length===1?`agent`:`agents`})]}),(0,U.jsx)(`h2`,{className:`sr-only`,children:`What is recorded`}),(0,U.jsx)(B,{id:`agents`,title:`Agents`,icon:le,n:e.agents.length,children:(0,U.jsx)(`ul`,{"aria-label":`Agents`,className:f(`surface rounded-lg bg-bg p-6 shadow-sm`,`m-0 list-none`),children:e.agents.map(e=>(0,U.jsx)(`li`,{children:(0,U.jsxs)(`a`,{href:r(`evidence`,encodeURIComponent(e.name)),className:f(`flex w-full min-h-11 cursor-pointer items-center gap-4 rounded-base border-0 bg-transparent px-4 py-2 text-left text-body-sm text-ink no-underline transition-colors duration-150 hover:bg-tint hover:text-ink aria-[current]:bg-tint-hover aria-selected:bg-tint-hover aria-pressed:bg-tint-hover aria-checked:bg-tint-hover has-[:checked]:bg-tint-hover disabled:cursor-not-allowed disabled:opacity-50`,`min-h-12 flex-wrap gap-x-4 gap-y-1`),children:[(0,U.jsxs)(`span`,{className:`flex min-w-0 flex-[1_1_320px] flex-col`,children:[(0,U.jsx)(`span`,{className:`truncate text-body-sm font-medium`,children:W(e.name)}),(0,U.jsxs)(`span`,{className:`truncate text-body-sm text-muted`,children:[e.versions.length?`versions ${e.versions.slice(0,4).join(`, `)}${e.versions.length>4?`, …`:``} · `:``,`from `,e.sources.map(e=>Fe[e]||e).join(`, `)]})]}),(0,U.jsx)(`span`,{className:`text-body-sm text-ink-2 tabular-nums`,children:d(e.runs,`run`)}),(0,U.jsx)(`span`,{className:`text-body-sm text-ink-2 tabular-nums`,children:d(e.decisions,`decision`)}),(0,U.jsxs)(`span`,{className:`text-body-sm text-muted tabular-nums`,children:[d(e.gaps,`thing`,`things`),` not known`]}),(0,U.jsx)(`span`,{className:`text-body-sm text-ink-2`,children:e.contract?`${e.contract.approved?`Contract approved`:`Contract not approved`}: ${[`FAIL`,`WARN`,`UNKNOWN`,`PASS`].filter(t=>e.verdicts[t]).map(t=>d(e.verdicts[t],{FAIL:`failed run`,WARN:`warning`,UNKNOWN:`not known`,PASS:`passed run`}[t],{FAIL:`failed runs`,WARN:`warnings`,UNKNOWN:`not known`,PASS:`passed runs`}[t])).join(`, `)}`:`No contract`}),(0,U.jsx)(`span`,{className:`text-body-sm text-muted tabular-nums`,"data-tip":G(e.last),children:e.last?F(e.last):``})]})},e.name))})})]})]})}var Ge={PASS:`Passed`,WARN:`Warned`,FAIL:`Failed`,UNKNOWN:`Not known`,NONE:`Not judged`};function Ke({t:e,label:t,on:n,onToggle:r,fail:i}){return e.n?(0,U.jsx)(b,{variant:`link`,size:`inline`,"aria-pressed":n,"aria-label":`${e.n}: ${t}. Show the runs`,onClick:r,className:f(`min-h-7 min-w-7 justify-end rounded-full px-2 tabular-nums aria-pressed:bg-accent-soft`,i&&!n&&`text-fail`),children:e.n}):(0,U.jsx)(`span`,{className:`inline-flex min-h-7 items-center justify-end px-2 text-muted tabular-nums`,children:`0`})}function qe({pick:e,d:t,onClose:n}){let[i,a]=(0,H.useState)(!1),o=i?e.runs:e.runs.slice(0,25);return(0,U.jsxs)(`div`,{className:f(u,`flex flex-col gap-2`),children:[(0,U.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-4 gap-y-1`,children:[(0,U.jsxs)(`span`,{className:`text-body-sm font-medium text-ink [overflow-wrap:anywhere]`,children:[d(e.runs.length,`run`),` behind `,W(e.label)]}),(0,U.jsxs)(b,{size:`sm`,variant:`outline`,onClick:n,children:[(0,U.jsx)(k,{"aria-hidden":`true`}),`Close`]})]}),(0,U.jsx)(`ul`,{"aria-label":`Runs behind ${e.label}`,className:`m-0 list-none border-t border-line-soft py-1`,children:o.map(e=>{let n=t.brief[e];return(0,U.jsx)(`li`,{children:(0,U.jsxs)(`a`,{href:r(`evidence-runs`,encodeURIComponent(e)),className:f(s,`grid min-h-10 grid-cols-[auto_minmax(0,1fr)_auto] gap-x-4`),children:[n&&n.status!==`NONE`?(0,U.jsx)(C,{tone:q[n.status].tone,children:q[n.status].label}):(0,U.jsx)(`span`,{className:`text-body-sm text-muted`,children:`Not judged`}),(0,U.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,U.jsx)(`span`,{className:`truncate text-body-sm`,children:W(n?.request||e)}),(0,U.jsxs)(`span`,{className:`truncate font-mono text-body-sm text-muted`,children:[e,n?.version?` · ${W(n.version)}`:``]})]}),(0,U.jsx)(`span`,{className:`text-right text-body-sm text-muted tabular-nums`,"data-tip":G(n?.started),children:n?.started?F(n.started):``})]})},e)})}),e.runs.length>o.length&&(0,U.jsxs)(b,{size:`sm`,variant:`ghost`,onClick:()=>a(!0),children:[(0,U.jsx)(D,{"aria-hidden":`true`}),`All (`,e.runs.length,`)`]})]})}function Je({agent:e}){let[t,n]=(0,H.useState)(null),[a,o]=(0,H.useState)(``),[s,c]=(0,H.useState)(null),[l,u]=(0,H.useState)(null);(0,H.useEffect)(()=>{h.dashboard(e).then(n,e=>o(e.message))},[e]);let d=e=>e?W(e):`no version`,p=t?t.versions.find(e=>e.version===s)||t.versions[0]:void 0,m=e=>l&&t&&l.key.startsWith(`${e}|`)?(0,U.jsx)(qe,{pick:l,d:t,onClose:()=>u(null)},l.key):null,g=(e,t,n,r)=>{let i=`${e}|${n}`;return(0,U.jsx)(Ke,{t,label:n,on:l?.key===i,onToggle:()=>u(l?.key===i?null:{key:i,label:n,runs:t.runs}),fail:r})};return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(w,{to:{href:r(`evidence`),label:`Evidence`}}),(0,U.jsx)(X,{id:`evidence`,back:!1,children:W(e)}),(0,U.jsx)(I,{more:(0,U.jsx)(U.Fragment,{children:`Every number opens the runs it counts; not known and not judged are never counted as passed. Worked out now from the runs and their verdicts, with people's overrules applied.`}),children:`How this agent's runs were judged, version by version and week by week.`}),a&&(0,U.jsx)(V,{text:a}),!t&&!a&&(0,U.jsx)(Z,{shape:`detail`}),t?.problems.map(e=>(0,U.jsx)(V,{text:e},e)),t&&p&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-6 gap-y-1 text-body-sm`,children:[(0,U.jsxs)(Oe,{label:`Its runs and versions`,children:[(0,U.jsx)(L,{dot:`neutral`,value:t.runs.n,label:t.runs.n===1?`run`:`runs`}),(0,U.jsx)(L,{dot:`neutral`,value:t.versions.length,label:t.versions.length===1?`version`:`versions`})]}),(0,U.jsx)(`a`,{href:r(`evidence-runs`,`agent`,encodeURIComponent(e)),children:`All its runs`}),(0,U.jsx)(`a`,{href:r(`evidence-learn`,encodeURIComponent(e)),children:`What to change`})]}),(0,U.jsx)(`h2`,{className:`sr-only`,children:`Its numbers`}),(0,U.jsxs)(B,{id:`versions`,title:`Versions`,icon:M,n:t.versions.length,children:[(0,U.jsx)(z,{label:`Versions of ${e}`,search:!1,minWidth:640,head:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,children:`Version`}),[`Runs`,`Passed`,`Warned`,`Failed`,`Not known`,`Not judged`].map(e=>(0,U.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-right text-label-md font-medium whitespace-nowrap text-muted`,children:e},e)),(0,U.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,children:`Last run`})]}),children:t.versions.map(e=>(0,U.jsxs)(`tr`,{className:`h-12 border-t border-line-soft align-middle transition-colors duration-150 data-[state=selected]:bg-tint-hover`,children:[(0,U.jsx)(`th`,{scope:`row`,className:f(`px-4 py-2`,`text-left font-medium`),children:d(e.version)}),(0,U.jsx)(`td`,{className:`px-4 py-2 text-right whitespace-nowrap tabular-nums`,"data-sort":e.runs.n,children:g(`versions`,e.runs,`${d(e.version)}: runs`)}),[`PASS`,`WARN`,`FAIL`,`UNKNOWN`,`NONE`].map(t=>(0,U.jsx)(`td`,{className:`px-4 py-2 text-right whitespace-nowrap tabular-nums`,"data-sort":e.outcome[t].n,children:g(`versions`,e.outcome[t],`${d(e.version)}: ${Ge[t].toLowerCase()}`,t===`FAIL`)},t)),(0,U.jsx)(`td`,{className:f(`px-4 py-2`,`text-muted`),"data-tip":G(e.last),"data-sort":e.last&&Date.parse(e.last)||0,children:e.last?F(e.last):``})]},e.version))}),m(`versions`)]}),t.versions.length>1&&t.benchmark.length>0&&(0,U.jsxs)(B,{id:`benchmark`,title:`Versions side by side`,icon:oe,children:[(0,U.jsx)(`p`,{className:`m-0 text-body-sm text-muted`,children:`Each check: the share of a version's runs that passed it, of the runs it judged. The number after it opens the runs that did not pass.`}),(0,U.jsx)(z,{label:`Versions side by side`,search:!1,minWidth:480,head:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,children:`Check`}),t.versions.map(e=>(0,U.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-right text-label-md font-medium whitespace-nowrap text-muted`,children:d(e.version)},e.version))]}),children:t.benchmark.map(e=>(0,U.jsxs)(`tr`,{className:`h-12 border-t border-line-soft align-middle transition-colors duration-150 data-[state=selected]:bg-tint-hover`,children:[(0,U.jsx)(`th`,{scope:`row`,className:f(`px-4 py-2`,`text-left font-medium`),children:J[e.check]}),e.versions.map(t=>{let n={n:t.judged.n-t.pass.n,runs:t.judged.runs.filter(e=>!t.pass.runs.includes(e))};return(0,U.jsx)(`td`,{className:`px-4 py-2 text-right whitespace-nowrap tabular-nums`,"data-sort":t.rate??-1,children:t.rate===null?(0,U.jsx)(`span`,{className:`text-muted`,children:`not judged`}):(0,U.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,U.jsxs)(`span`,{className:f(t.rate<1&&`text-ink`),children:[Math.round(t.rate*100),`% of `,t.judged.n]}),n.n>0&&(0,U.jsx)(`span`,{className:`text-muted`,children:`·`}),n.n>0&&g(`benchmark`,n,`${J[e.check]} on ${d(t.version)}: not passed`,!0)]})},t.version)})]},`${e.lens}-${e.check}`))}),m(`benchmark`)]}),(0,U.jsxs)(B,{id:`checks`,title:`Checks`,icon:P,n:p.checks.length,children:[t.versions.length>1&&(0,U.jsxs)(`label`,{className:`flex w-fit items-center gap-2 text-body-sm text-ink-2`,children:[`Version`,(0,U.jsx)(i,{value:p.version,onChange:e=>{c(e.target.value),u(null)},children:t.versions.map(e=>(0,U.jsx)(`option`,{value:e.version,children:e.version||`no version`},e.version))})]}),p.checks.length?(0,U.jsx)(z,{label:`Checks of ${d(p.version)}`,search:!1,minWidth:600,head:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,children:`Check`}),(0,U.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,children:`Lens`}),[`Passed`,`Warned`,`Failed`,`Not known`,`Overruled`].map(e=>(0,U.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-right text-label-md font-medium whitespace-nowrap text-muted`,children:e},e))]}),children:p.checks.map(e=>(0,U.jsxs)(`tr`,{className:`h-12 border-t border-line-soft align-middle transition-colors duration-150 data-[state=selected]:bg-tint-hover`,children:[(0,U.jsx)(`th`,{scope:`row`,className:f(`px-4 py-2`,`text-left font-medium`),children:J[e.check]}),(0,U.jsx)(`td`,{className:f(`px-4 py-2`,`text-muted`),children:it[e.lens]}),[`PASS`,`WARN`,`FAIL`,`UNKNOWN`].map(t=>(0,U.jsx)(`td`,{className:`px-4 py-2 text-right whitespace-nowrap tabular-nums`,"data-sort":e.outcome[t].n,children:g(`checks`,e.outcome[t],`${J[e.check]}: ${Ge[t].toLowerCase()}`,t===`FAIL`)},t)),(0,U.jsx)(`td`,{className:`px-4 py-2 text-right whitespace-nowrap tabular-nums`,"data-sort":e.overruled.n,children:g(`checks`,e.overruled,`${J[e.check]}: overruled`)})]},`${e.lens}-${e.check}`))}):(0,U.jsxs)(`p`,{className:`m-0 text-body-sm text-muted`,children:[`No contract judged these runs: `,(0,U.jsx)(`a`,{href:r(`evidence-contracts`),children:`Contracts`}),` says what one agrees.`]}),m(`checks`)]}),p.rules.length>0&&(0,U.jsxs)(B,{id:`recurring`,title:`What keeps going wrong`,icon:O,n:p.rules.length,children:[(0,U.jsx)(`ul`,{"aria-label":`What keeps going wrong`,className:f(`surface rounded-lg bg-bg p-6 shadow-sm`,`m-0 list-none`),children:p.rules.slice(0,20).map(e=>(0,U.jsxs)(`li`,{className:`flex flex-col gap-1 border-b border-line-soft px-4 py-2 last:border-b-0`,children:[(0,U.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-4 gap-y-1`,children:[(0,U.jsx)(C,{tone:q[e.status].tone,children:q[e.status].label}),(0,U.jsxs)(`span`,{className:`text-body-sm font-medium`,children:[J[e.check],`: `,W(e.rule)]}),(0,U.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-body-sm text-muted`,children:[`in `,g(`recurring`,e.runs,`${J[e.check]}: ${e.rule}`),` `,e.runs.n===1?`run`:`runs`]})]}),(0,U.jsxs)(`span`,{className:`text-body-sm text-ink-2 [overflow-wrap:anywhere]`,children:[`For example: `,W(e.example)]})]},`${e.check}-${e.rule}`))}),m(`recurring`)]}),(0,U.jsxs)(B,{id:`weeks`,title:`Week by week`,icon:_e,n:t.weeks.length,children:[(0,U.jsx)(z,{label:`Week by week`,search:!1,minWidth:520,head:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,children:`Week`}),[`PASS`,`WARN`,`FAIL`,`UNKNOWN`,`NONE`].map(e=>(0,U.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-right text-label-md font-medium whitespace-nowrap text-muted`,children:Ge[e]},e))]}),children:t.weeks.toReversed().map(e=>(0,U.jsxs)(`tr`,{className:`h-12 border-t border-line-soft align-middle transition-colors duration-150 data-[state=selected]:bg-tint-hover`,children:[(0,U.jsx)(`th`,{scope:`row`,className:f(`px-4 py-2`,`text-left font-medium tabular-nums`),children:e.week===`undated`?`No date`:e.week}),[`PASS`,`WARN`,`FAIL`,`UNKNOWN`,`NONE`].map(t=>(0,U.jsx)(`td`,{className:`px-4 py-2 text-right whitespace-nowrap tabular-nums`,"data-sort":e.outcome[t].n,children:g(`weeks`,e.outcome[t],`${e.week}: ${Ge[t].toLowerCase()}`,t===`FAIL`)},t))]},e.week))}),m(`weeks`)]})]})]})}function Ye({agent:e}){let[t,n]=(0,H.useState)(null),[a,o]=(0,H.useState)([]),[s,c]=(0,H.useState)(``),[l,u]=(0,H.useState)(``),[p,m]=(0,H.useState)(e),[g,_]=(0,H.useState)(`all`),[v,x]=(0,H.useState)(0);(0,H.useEffect)(()=>{h.runs().then(e=>{n(e.runs),o(e.refused)},e=>c(e.message))},[]),(0,H.useEffect)(()=>m(e),[e]);let S=(0,H.useMemo)(()=>[...new Set((t||[]).map(e=>e.agent))].sort(),[t]),C=l.toLowerCase().split(/\s+/).filter(Boolean),w=(t||[]).filter(e=>(!p||e.agent===p)&&C.every(t=>`${e.agent} ${e.request||``} ${e.id} ${e.source.name}`.toLowerCase().includes(t))),T=g===`failed`?w.filter(e=>e.failed):w,E={all:w.length,failed:w.filter(e=>e.failed).length},D=Math.max(1,Math.ceil(T.length/K)),O=Math.min(v,D-1),k=T.slice(O*K,O*K+K);(0,H.useEffect)(()=>x(0),[l,p,g]);let A=t||[],M=A.filter(e=>e.failed).length;return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(X,{id:`evidence-runs`,children:`Agent runs`}),(0,U.jsx)(I,{more:(0,U.jsxs)(U.Fragment,{children:[`Open one for its timeline: each step, the data it took in, what it decided and the reason it gave, and what the record cannot say. `,He]}),children:`Every agent run recorded here, newest first.`}),s&&(0,U.jsx)(V,{text:s}),!t&&!s&&(0,U.jsx)(Z,{}),(0,U.jsx)(Ue,{refused:a}),t&&!t.length&&(0,U.jsx)(Ve,{}),t&&t.length>0&&(0,U.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,U.jsxs)(Oe,{label:`Runs recorded`,children:[(0,U.jsx)(L,{dot:`neutral`,value:A.length,label:A.length===1?`run`:`runs`}),(0,U.jsx)(L,{dot:M?`fail`:`pass`,value:M,label:`with a failed step (${Math.round(M/A.length*100)}%)`}),(0,U.jsx)(L,{dot:`neutral`,value:A.reduce((e,t)=>e+t.decisions,0),label:A.reduce((e,t)=>e+t.decisions,0)===1?`decision`:`decisions`}),(0,U.jsx)(L,{dot:`neutral`,value:new Set(A.map(e=>e.agent)).size,label:new Set(A.map(e=>e.agent)).size===1?`agent`:`agents`})]}),(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,U.jsx)(y,{id:`evidence-search`,label:`Find a run`,value:l,onChange:u,placeholder:`Find a run by what was asked`}),(0,U.jsx)(ee,{items:[{id:`all`,label:`All`,n:E.all},{id:`failed`,label:`Failed`,n:E.failed,alert:!0}],value:g,onChange:_}),S.length>1&&(0,U.jsxs)(i,{size:`sm`,"aria-label":`Agent`,value:p,onChange:e=>m(e.target.value),className:`w-auto pr-8 pl-4`,children:[(0,U.jsx)(`option`,{value:``,children:`Every agent`}),S.map(e=>(0,U.jsx)(`option`,{value:e,children:W(e)},e))]})]}),(0,U.jsxs)(`div`,{className:`surface rounded-lg bg-bg p-6 shadow-sm`,children:[(0,U.jsxs)(`ul`,{"aria-label":`Agent runs`,className:`m-0 list-none p-2`,children:[!k.length&&(0,U.jsx)(`li`,{className:`px-4 py-4 text-body-sm text-muted`,children:`Nothing matches.`}),k.map((e,t)=>(0,U.jsxs)(`li`,{className:`contents`,children:[(t===0||Ce(k[t-1].started)!==Ce(e.started))&&(0,U.jsx)(`span`,{className:`block px-4 pt-4 pb-1 text-body-sm font-medium text-muted`,children:Ce(e.started)}),(0,U.jsxs)(`a`,{href:r(`evidence-runs`,encodeURIComponent(e.id)),className:f(`flex w-full min-h-11 cursor-pointer items-center gap-4 rounded-base border-0 bg-transparent px-4 py-2 text-left text-body-sm text-ink no-underline transition-colors duration-150 hover:bg-tint hover:text-ink aria-[current]:bg-tint-hover aria-selected:bg-tint-hover aria-pressed:bg-tint-hover aria-checked:bg-tint-hover has-[:checked]:bg-tint-hover disabled:cursor-not-allowed disabled:opacity-50`,`grid min-h-12 grid-cols-[auto_minmax(0,1fr)_auto] gap-x-4`),children:[e.failed?(0,U.jsx)(be,{size:16,"aria-label":`${e.failed} failed ${e.failed===1?`step`:`steps`}`,className:`flex-none text-fail`}):(0,U.jsx)(j,{size:16,"aria-label":`No failed step`,className:`flex-none text-muted`}),(0,U.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,U.jsx)(`span`,{className:`truncate text-body-sm font-medium`,"data-tip":e.request||e.agent,children:W(e.request||`${e.agent}: request not recorded`)}),(0,U.jsx)(`span`,{className:`truncate text-body-sm text-muted`,children:[W(`${e.agent}${e.version?` ${e.version}`:``}`),d(e.steps,`step`),d(e.decisions,`decision`),`${d(e.gaps,`thing`,`things`)} not known`,Fe[e.source.kind],e.content?`content kept`:`inputs as fingerprints`,e.verdict?`verdict: ${q[e.verdict].label.toLowerCase()}`:`no contract`].join(` · `)})]}),(0,U.jsx)(`span`,{className:`text-right text-body-sm text-muted tabular-nums`,"data-tip":G(e.started),children:e.started?F(e.started):``})]})]},e.id))]}),(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4 border-t border-line-soft px-4 py-2 text-body-sm text-muted`,children:[(0,U.jsx)(`span`,{className:`flex-1`,children:T.length?`${O*K+1}–${Math.min(T.length,O*K+K)} of ${T.length}`:`0 runs`}),D>1&&(0,U.jsxs)(`nav`,{"aria-label":`Pages of agent runs`,className:`flex items-center gap-1`,children:[(0,U.jsx)(b,{size:`sm`,variant:`ghost`,disabled:O===0,onClick:()=>x(O-1),"aria-label":`Newer runs`,"data-tip":`Newer runs`,children:(0,U.jsx)(te,{"aria-hidden":`true`})}),(0,U.jsxs)(`span`,{className:`px-1 tabular-nums`,children:[`Page `,O+1,` of `,D]}),(0,U.jsx)(b,{size:`sm`,variant:`ghost`,disabled:O>=D-1,onClick:()=>x(O+1),"aria-label":`Older runs`,"data-tip":`Older runs`,children:(0,U.jsx)(ne,{"aria-hidden":`true`})})]})]})]})]})]})}function Q({t:e,label:t}){let[n,r]=(0,H.useState)(!1);if(e.text===void 0)return(0,U.jsxs)(`span`,{className:`font-mono text-body-sm text-muted`,children:[t,`: fingerprint only, `,e.chars.toLocaleString(),` characters, sha256 `,e.sha256.slice(0,12),`…`]});let i=e.text.length>600;return(0,U.jsxs)(`span`,{className:`flex flex-col items-start gap-1`,children:[(0,U.jsx)(`span`,{className:`text-body-sm whitespace-pre-wrap text-ink-2 [overflow-wrap:anywhere]`,children:W(i&&!n?`${e.text.slice(0,600)}…`:e.text)}),i&&(0,U.jsxs)(b,{variant:`link`,size:`inline`,onClick:()=>r(!n),"data-tip":n?void 0:`Show all ${e.text.length.toLocaleString()} characters`,className:`gap-1`,children:[n?(0,U.jsx)(fe,{size:12,"aria-hidden":`true`}):(0,U.jsx)(D,{size:12,"aria-hidden":`true`}),n?`Less`:`More`]})]})}function Xe({d:e}){return(0,U.jsxs)(`div`,{className:`flex flex-col gap-1 border-l-2 border-accent-line pl-4`,children:[(0,U.jsxs)(`span`,{className:`text-body-sm font-medium text-muted`,children:[`Decided`,e.by?` · by ${W(e.by)}`:``]}),(0,U.jsxs)(`span`,{className:`text-body-sm text-ink [overflow-wrap:anywhere]`,children:[W(e.what),`: `,(0,U.jsx)(`b`,{className:`font-medium`,children:W(e.chose)})]}),e.options&&e.options.length>0&&(0,U.jsxs)(`span`,{className:`text-body-sm text-muted [overflow-wrap:anywhere]`,children:[`Options: `,W(e.options.join(`, `))]}),e.reason?(0,U.jsxs)(`span`,{className:`flex flex-col gap-1`,children:[(0,U.jsx)(`span`,{className:`text-body-sm text-muted`,children:`The reason given (a claim, not checked yet):`}),(0,U.jsx)(Q,{t:e.reason,label:`reason`})]}):(0,U.jsx)(`span`,{className:`text-body-sm text-muted`,children:`No reason given.`})]})}function Ze({s:e,r:t}){let n=(e.inputs||[]).map(e=>t.inputs.find(t=>t.id===e)).filter(e=>!!e),r=t.decisions.filter(t=>t.step===e.seq),i=t.statements.filter(t=>t.step===e.seq),a=Object.entries(e.facts||{});return(0,U.jsxs)(`li`,{id:`evidence-step-${e.seq}`,tabIndex:-1,className:`grid scroll-mt-4 grid-cols-[36px_minmax(0,1fr)] gap-x-2 border-b border-line-soft py-2 outline-none last:border-b-0 focus-visible:bg-accent-soft`,children:[(0,U.jsx)(`span`,{className:`pt-1 text-right text-body-sm text-muted tabular-nums`,children:e.seq}),(0,U.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2`,children:[(0,U.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,U.jsx)(v,{icon:Ie[e.kind]||ae,size:14,className:`flex-none`}),(0,U.jsx)(`span`,{className:`text-body-sm font-medium [overflow-wrap:anywhere]`,children:W(e.name)}),(0,U.jsx)(`span`,{className:`text-body-sm text-muted`,children:e.kind}),e.agent&&(0,U.jsxs)(`span`,{className:`text-body-sm text-muted`,children:[`· by `,W(e.agent)]}),e.ok===!1&&(0,U.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-body-sm text-fail`,children:[(0,U.jsx)(be,{size:13,"aria-hidden":`true`}),`failed`]}),e.ms!==void 0&&(0,U.jsxs)(`span`,{className:`text-body-sm text-muted tabular-nums`,children:[`· `,e.ms.toLocaleString(),` ms`]})]}),a.length>0&&(0,U.jsx)(`span`,{className:`text-body-sm text-muted [overflow-wrap:anywhere]`,children:W(a.map(([e,t])=>`${e}: ${String(t)}`).join(` · `))}),e.detail&&(0,U.jsx)(Q,{t:e.detail,label:`details`}),e.instructions&&(0,U.jsxs)(`details`,{className:`border-l-2 border-line pl-4`,children:[(0,U.jsx)(`summary`,{className:`cursor-pointer text-body-sm font-medium text-muted`,children:(()=>{let n=t.steps.filter(t=>t.seq<e.seq&&t.instructions?.sha256===e.instructions.sha256);return n.length?`Instructions, the same as step ${n[n.length-1].seq}`:`Instructions given to the model`})()}),(0,U.jsx)(`div`,{className:`mt-1`,children:(0,U.jsx)(Q,{t:e.instructions,label:`instructions`})})]}),n.map(e=>(0,U.jsxs)(`div`,{className:`flex flex-col gap-1 border-l-2 border-line pl-4`,children:[(0,U.jsxs)(`span`,{className:`text-body-sm font-medium text-muted [overflow-wrap:anywhere]`,children:[`Took in `,Re[e.kind]||e.kind,` from `,W(e.source)]}),(0,U.jsx)(Q,{t:e.kind===`request`&&e.data.text===void 0&&t.request?.text?.text!==void 0&&t.request.text.sha256===e.data.sha256?t.request.text:e.data,label:`content`})]},e.id)),r.map(e=>(0,U.jsx)(Xe,{d:e},e.seq)),i.map(e=>(0,U.jsxs)(`div`,{className:`flex flex-col gap-1 border-l-2 border-line pl-4`,children:[(0,U.jsx)(`span`,{className:`text-body-sm font-medium text-muted`,children:`Said (a claim about its own work, not checked yet)`}),(0,U.jsx)(Q,{t:e.text,label:`statement`})]},e.seq))]})]})}function Qe({r:e,goTo:t}){let n=e.steps.filter(e=>e.kind===`model`),r=n.find(e=>e.instructions),i=new Set(n.filter(e=>e.instructions).map(e=>e.instructions.sha256)).size,a=e.outputs.filter(e=>e.kind===`text`),o=a[a.length-1],s=a.slice(0,-1),c=e.outputs.filter(e=>e.kind!==`text`),u=e=>n.reduce((t,n)=>t+(typeof n.facts?.[e]==`number`?n.facts[e]:0),0),d=u(`tokens_in`),f=u(`tokens_out`),p=[...new Set(n.map(e=>e.name))],m=({children:e})=>(0,U.jsx)(`span`,{className:`text-body-sm font-medium text-muted`,children:e}),h=({seq:e})=>(0,U.jsxs)(b,{variant:`link`,size:`inline`,onClick:()=>t(e),children:[`step `,e]});return(0,U.jsx)(B,{id:`evidence-io`,title:`Prompt and output`,icon:ye,children:(0,U.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(n.length>0||d+f>0)&&(0,U.jsxs)(`p`,{className:`m-0 text-body-sm text-ink-2`,children:[n.length,` model `,n.length===1?`call`:`calls`,p.length?` (${W(p.join(`, `))})`:``,d+f>0?` · ${d.toLocaleString()} tokens in, ${f.toLocaleString()} out`:``]}),(0,U.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2`,children:[(0,U.jsxs)(m,{children:[`Instructions (system prompt)`,r?(0,U.jsxs)(U.Fragment,{children:[` · from `,(0,U.jsx)(h,{seq:r.seq})]}):null,i>1?` · ${i} different ones in this run`:``]}),(0,U.jsx)(`div`,{className:l,children:r?.instructions?(0,U.jsx)(Q,{t:r.instructions,label:`instructions`}):(0,U.jsx)(`span`,{className:`text-body-sm text-muted`,children:`Not in the record: its source did not hold the instructions the model was given.`})})]}),(0,U.jsxs)(`div`,{className:`grid gap-4 @3xl:grid-cols-2`,children:[(0,U.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2`,children:[(0,U.jsxs)(m,{children:[`Request`,e.request?.by?` · from ${W(e.request.by)}`:``,e.request?.from?` · read from the ${W(e.request.from)}`:``]}),(0,U.jsx)(`div`,{className:l,children:e.request?.text?(0,U.jsx)(Q,{t:e.request.text,label:`request`}):(0,U.jsx)(`span`,{className:`text-body-sm text-muted`,children:`Not in the record: its source did not say what the agent was asked.`})})]}),(0,U.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2`,children:[(0,U.jsxs)(m,{children:[`Final answer`,o?(0,U.jsxs)(U.Fragment,{children:[` · `,(0,U.jsx)(h,{seq:o.step})]}):null]}),(0,U.jsx)(`div`,{className:l,children:o?.data?(0,U.jsx)(Q,{t:o.data,label:`answer`}):(0,U.jsx)(`span`,{className:`text-body-sm text-muted`,children:`Not in the record: its source did not say what the agent answered.`})})]})]}),c.length>0&&(0,U.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2`,children:[(0,U.jsxs)(m,{children:[`What it produced (`,c.length,`)`]}),(0,U.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0`,children:c.map(e=>(0,U.jsxs)(`li`,{className:`flex flex-wrap items-center gap-x-2 text-body-sm text-ink-2`,children:[Le[e.kind]||e.kind,e.target?(0,U.jsx)(`span`,{className:`font-mono text-body-sm [overflow-wrap:anywhere]`,children:W(e.target)}):null,`· `,(0,U.jsx)(h,{seq:e.step})]},e.id))})]}),s.length>0&&(0,U.jsxs)(`details`,{className:`group flex flex-col gap-2`,children:[(0,U.jsxs)(`summary`,{className:`cursor-pointer text-body-sm font-medium text-muted`,children:[`What it said on the way (`,s.length,`)`]}),(0,U.jsx)(`ol`,{className:`m-0 mt-2 flex list-none flex-col gap-2 p-0`,children:s.map(e=>(0,U.jsxs)(`li`,{className:`flex flex-col gap-1 border-l-2 border-line pl-4`,children:[(0,U.jsx)(h,{seq:e.step}),e.data?(0,U.jsx)(Q,{t:e.data,label:`said`}):null]},e.id))})]})]})})}function $e({id:e}){let[t,n]=(0,H.useState)(null),[i,a]=(0,H.useState)(``),[o,s]=(0,H.useState)(Y);(0,H.useEffect)(()=>{h.run(e).then(n,e=>a(e.message))},[e]);let c=(0,U.jsx)(w,{to:{href:r(`evidence-runs`),label:`All agent runs`}});if(!t)return(0,U.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[c,i?(0,U.jsx)(V,{text:i}):(0,U.jsx)(Z,{shape:`detail`})]});let l=t.decisions.filter(e=>!e.step),u=t.steps.filter(e=>e.ok===!1).length,d=e=>{e>o&&s(Math.ceil(e/Y)*Y),requestAnimationFrame(()=>{let t=document.getElementById(`evidence-step-${e}`);t?.scrollIntoView({block:`start`}),t?.focus({preventScroll:!0})})},p=[...t.gaps,...t.truncated?[t.truncated]:[]];return(0,U.jsxs)(`section`,{"aria-labelledby":`evidence-run-h`,className:`flex flex-col gap-6`,children:[(0,U.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[c,(0,U.jsx)(Ne,{id:`evidence-run-h`,icon:A,title:W(t.request?.text?.text?t.request.text.text.slice(0,200):`${t.agent.name}: request not recorded`)}),(0,U.jsxs)(`p`,{className:`m-0 text-body-sm text-ink-2 [overflow-wrap:anywhere]`,children:[W(`${t.agent.name}${t.agent.version?` ${t.agent.version}`:``}${t.agent.model?` · ${t.agent.model}`:``}${t.agent.provider?` (${t.agent.provider})`:``}`),` · from `,Fe[t.source.kind],`, `,W(t.source.name),t.started?` · ${G(t.started)}`:``,t.ended&&t.ended!==t.started?` to ${G(t.ended)}`:``]}),(0,U.jsx)(`p`,{className:`m-0 font-mono text-body-sm text-muted`,children:t.id})]}),(0,U.jsxs)(`div`,{className:`flex flex-wrap gap-x-6 gap-y-1 text-body-sm text-muted`,children:[(0,U.jsxs)(`span`,{children:[(0,U.jsx)(`b`,{className:`text-ink tabular-nums`,children:t.steps.length}),` `,t.steps.length===1?`step`:`steps`]}),(0,U.jsxs)(`span`,{children:[(0,U.jsx)(`b`,{className:f(`tabular-nums`,u?`text-fail`:`text-ink`),children:u}),` failed`]}),(0,U.jsxs)(`span`,{children:[(0,U.jsx)(`b`,{className:`text-ink tabular-nums`,children:t.inputs.length}),` `,t.inputs.length===1?`input`:`inputs`]}),(0,U.jsxs)(`span`,{children:[(0,U.jsx)(`b`,{className:`text-ink tabular-nums`,children:t.decisions.length}),` `,t.decisions.length===1?`decision`:`decisions`]}),(0,U.jsxs)(`span`,{children:[(0,U.jsx)(`b`,{className:`text-ink tabular-nums`,children:t.statements.length}),` `,t.statements.length===1?`claim`:`claims`]}),(0,U.jsx)(`span`,{children:t.content?`Content kept, with secrets cut out`:`Inputs kept as fingerprints only`})]}),(0,U.jsx)(Qe,{r:t,goTo:d}),(0,U.jsx)(et,{id:t.id,goTo:d}),(0,U.jsx)(B,{id:`evidence-gaps`,title:`What the record cannot say`,icon:se,n:p.length,children:p.length?(0,U.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:p.map(e=>(0,U.jsx)(`li`,{className:`border-b border-line-soft py-2 text-body-sm text-ink-2 last:border-b-0 [overflow-wrap:anywhere]`,children:W(e)},e))}):(0,U.jsx)(`p`,{className:`m-0 text-body-sm text-muted`,children:`Nothing: the source said everything the record holds.`})}),(0,U.jsxs)(B,{id:`evidence-timeline`,title:`Timeline`,icon:A,n:t.steps.length,children:[(0,U.jsx)(`ol`,{"aria-label":`Steps`,className:`m-0 flex list-none flex-col p-0`,children:t.steps.slice(0,o).map(e=>(0,U.jsx)(Ze,{s:e,r:t},e.seq))}),t.steps.length>o&&(0,U.jsxs)(b,{size:`sm`,variant:`ghost`,className:`self-start`,onClick:()=>s(o+Y),"data-tip":`Show ${Math.min(Y,t.steps.length-o)} more of ${t.steps.length-o}`,children:[(0,U.jsx)(D,{"aria-hidden":`true`}),`More (`,Math.min(Y,t.steps.length-o),`)`]})]}),l.length>0&&(0,U.jsx)(B,{id:`evidence-loose`,title:`Decisions not tied to a step`,icon:oe,n:l.length,children:(0,U.jsx)(`div`,{className:`flex flex-col gap-4`,children:l.map(e=>(0,U.jsx)(Xe,{d:e},e.seq))})}),(0,U.jsx)(B,{id:`evidence-inputs`,title:`Data it took in`,icon:ve,n:t.inputs.length,children:t.inputs.length?(0,U.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:t.inputs.map(e=>(0,U.jsxs)(`li`,{className:`flex flex-wrap items-baseline gap-x-4 gap-y-1 border-b border-line-soft py-2 last:border-b-0`,children:[(0,U.jsxs)(`span`,{className:`min-w-0 flex-[1_1_320px] text-body-sm [overflow-wrap:anywhere]`,children:[(0,U.jsx)(`span`,{className:`font-medium`,children:Re[e.kind]||e.kind}),` `,(0,U.jsx)(`span`,{className:`text-muted`,children:`from`}),` `,W(e.source)]}),(0,U.jsxs)(`span`,{className:`text-body-sm text-muted tabular-nums`,children:[`step `,e.step]}),(0,U.jsx)(`span`,{className:`font-mono text-body-sm text-muted`,children:e.data.text===void 0?`${e.data.chars.toLocaleString()} chars · ${e.data.sha256.slice(0,12)}`:`kept`})]},e.id))}):(0,U.jsx)(`p`,{className:`m-0 text-body-sm text-muted`,children:`The record holds no input.`})})]})}function et({id:e,goTo:t}){let[n,i]=(0,H.useState)(null),[a,o]=(0,H.useState)(``),[s,l]=(0,H.useState)(0),u=()=>l(e=>e+1);if((0,H.useEffect)(()=>{h.verdict(e).then(i,e=>o(e.message))},[e,s]),a)return(0,U.jsx)(V,{text:a});if(!n)return(0,U.jsx)(Z,{shape:`lines`});let d=n.why||!n.verdicts.length?(0,U.jsx)(B,{id:`evidence-behaviour`,title:ze.behaviour.title,icon:E,children:(0,U.jsxs)(`p`,{className:`m-0 text-body-sm leading-relaxed text-ink-2`,children:[`Not judged: `,W(n.why||`no contract judges this agent.`),` A contract says what was agreed for an agent; `,(0,U.jsx)(`a`,{href:r(`evidence-contracts`),children:`Contracts`}),` lists them.`]})}):null;return(0,U.jsxs)(U.Fragment,{children:[n.work&&(0,U.jsxs)(`p`,{className:f(`m-0`,_[n.work.personTakesOver?`warn`:`info`]),children:[n.work.attempt?`Fix attempt ${n.work.attempt} of 2 at `:`The first run of work tried again in `,n.work.attempt?(0,U.jsx)(`a`,{href:r(`evidence-runs`,encodeURIComponent(n.work.first)),children:n.work.first}):`${n.work.runs.length-1} ${n.work.runs.length===2?`fix attempt`:`fix attempts`}`,n.work.personTakesOver?`: findings are still open after the last attempt, so a person takes over.`:`.`]}),d,n.verdicts.map(e=>(0,U.jsx)(B,{id:`evidence-${e.lens}`,title:ze[e.lens].title,icon:ze[e.lens].icon,children:(0,U.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-1`,children:[(0,U.jsx)(C,{tone:q[e.status].tone,children:q[e.status].label}),(0,U.jsx)(`span`,{className:`text-body-sm text-ink-2 [overflow-wrap:anywhere]`,children:e.contract?(0,U.jsxs)(U.Fragment,{children:[`By contract `,W(e.contract.name),`, version `,W(e.contract.version),`, `,e.contract.approved?`approved`:`not approved: it can only warn`]}):`Against the product graph: advisory, it can only warn`})]}),e.notes.map(e=>(0,U.jsx)(`p`,{className:`m-0 text-body-sm text-muted [overflow-wrap:anywhere]`,children:W(e)},e)),(0,U.jsx)(`ul`,{"aria-label":`Checks`,className:f(c,`m-0 flex list-none flex-col`),children:e.checks.map(n=>(0,U.jsxs)(`li`,{className:`flex flex-col gap-2 border-b border-line-soft px-4 py-2 last:border-b-0`,children:[(0,U.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-4 gap-y-1`,children:[(0,U.jsx)(`span`,{className:`min-w-[152px] text-body-sm font-medium`,children:J[n.check]}),(0,U.jsx)(C,{tone:q[n.status].tone,children:q[n.status].label}),(0,U.jsxs)(`span`,{className:`text-body-sm text-muted [overflow-wrap:anywhere]`,children:[W(n.checked),n.gating?` · can fail a run`:n.advisory&&e.contract?.approved?` · ${n.advisory}`:``]})]}),n.findings.map(n=>(0,U.jsx)(nt,{f:n,run:e.run,goTo:t,onOverruled:u},n.id))]},n.check))}),e.lens===`content`&&n.rubric&&(0,U.jsx)(tt,{run:e.run,rubric:n.rubric,onGraded:u})]})},e.lens))]})}function tt({run:e,rubric:t,onGraded:n}){let[r,i]=(0,H.useState)(null),[o,s]=(0,H.useState)(``),[l,u]=(0,H.useState)(!1),[d,p]=(0,H.useState)(``),m=o.trim().length>=10&&o.trim().length<=500,g=async()=>{if(r){u(!0),p(``);try{await h.grade(e,r.id,r.grade,o.trim()),i(null),s(``),n()}catch(e){p(e.message)}finally{u(!1)}}};return(0,U.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,U.jsx)(`h4`,{className:`m-0 text-body-sm font-medium`,children:`Grade the answer`}),(0,U.jsxs)(`p`,{className:`m-0 text-body-sm text-muted`,children:[t.criteria.some(e=>e.id===`scenario`)?`Its scenario is graded by a person: the release gate counts it only once you have graded it. `:``,t.criteria.some(e=>e.id!==`scenario`)?`The judge's misses count only once it agrees with people's grades. `:``,`Read the answer, then say whether it meets each criterion; your grade is kept with your name.`]}),t.answer!==void 0&&(0,U.jsx)(`p`,{className:f(`rounded-base bg-surface-muted p-4`,`m-0 whitespace-pre-wrap text-body-sm text-ink [overflow-wrap:anywhere]`),children:W(t.answer)}),(0,U.jsx)(`ul`,{"aria-label":`Rubric criteria`,className:f(c,`m-0 flex list-none flex-col`),children:t.criteria.map(e=>(0,U.jsxs)(`li`,{className:`flex flex-col gap-2 border-b border-line-soft px-4 py-2 last:border-b-0`,children:[(0,U.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-4 gap-y-1`,children:[(0,U.jsxs)(`span`,{className:`text-body-sm text-ink [overflow-wrap:anywhere]`,children:[(0,U.jsx)(`span`,{className:`font-mono text-muted`,children:e.id}),` `,W(e.text)]}),e.grade&&(0,U.jsx)(C,{tone:e.grade.grade===`meets`?`pass`:`warn`,children:e.grade.grade===`meets`?`Meets`:`Misses`}),(0,U.jsx)(`span`,{className:`text-body-sm text-muted`,children:e.grade?`Grade again:`:`Grade:`}),[`meets`,`misses`].map(t=>(0,U.jsx)(b,{variant:`link`,size:`inline`,"aria-label":`${e.id} ${t===`meets`?`meets`:`misses`}`,onClick:()=>i({id:e.id,grade:t}),className:`min-h-7 px-2`,children:t===`meets`?`Meets`:`Misses`},t))]}),e.grade&&(0,U.jsxs)(`span`,{className:`text-body-sm text-ink-2 [overflow-wrap:anywhere]`,children:[`Graded by `,W(e.grade.by),` `,G(e.grade.at),`: `,W(e.grade.reason)]}),r?.id===e.id&&(0,U.jsxs)(`div`,{className:f(`panel rounded-md bg-(--page-surface-strong) p-6`,`flex max-w-[640px] flex-col gap-2`),children:[(0,U.jsxs)(`label`,{htmlFor:`grade-${e.id}`,className:`text-body-sm font-medium text-ink-2`,children:[`Why does the answer `,r.grade===`meets`?`meet`:`miss`,` it?`]}),(0,U.jsx)(a,{id:`grade-${e.id}`,value:o,onChange:e=>s(e.target.value),rows:2,maxLength:500,placeholder:`For example: it says the customer must send a photo by Friday.`}),d&&(0,U.jsx)(V,{text:d}),(0,U.jsxs)(`span`,{className:`flex gap-2`,children:[(0,U.jsxs)(b,{busy:l,size:`sm`,disabled:!m||l,onClick:g,"data-tip":r.grade===`meets`?`Keep the grade: meets`:`Keep the grade: misses`,children:[(0,U.jsx)(ge,{"aria-hidden":`true`}),l?`Keeping…`:`Keep`]}),(0,U.jsxs)(b,{size:`sm`,variant:`outline`,onClick:()=>i(null),children:[(0,U.jsx)(k,{"aria-hidden":`true`}),`Cancel`]})]})]})]},e.id))})]})}function nt({f:e,run:t,goTo:n,onOverruled:r}){let[i,o]=(0,H.useState)(!1),[s,c]=(0,H.useState)(``),[l,u]=(0,H.useState)(!1),[d,p]=(0,H.useState)(``),m=s.trim().length>=10&&s.trim().length<=500,g=async()=>{u(!0),p(``);try{await h.overrule(t,e.id,s.trim()),o(!1),r()}catch(e){p(e.message)}finally{u(!1)}};return(0,U.jsxs)(`div`,{className:f(`flex flex-col gap-1 border-l-2 pl-4`,e.overruled?`border-line opacity-80`:e.status===`FAIL`?`border-fail`:e.status===`WARN`?`border-warn`:`border-line`),children:[(0,U.jsx)(`span`,{className:f(`text-body-sm [overflow-wrap:anywhere]`,e.overruled?`text-ink-2`:`text-ink`),children:W(e.what)}),e.fix&&!e.overruled&&(0,U.jsxs)(`span`,{className:`text-body-sm text-ink-2 [overflow-wrap:anywhere]`,children:[`Fix: `,W(e.fix)]}),e.overruled&&(0,U.jsxs)(`span`,{className:`text-body-sm text-ink-2 [overflow-wrap:anywhere]`,children:[`Overruled by `,W(e.overruled.by),` `,G(e.overruled.at),` (`,e.overruled.via===`web`?`on this page`:`at a terminal`,`): `,W(e.overruled.reason)]}),(0,U.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1 text-body-sm text-muted`,children:[(0,U.jsx)(`span`,{className:`[overflow-wrap:anywhere]`,children:W(e.source)}),e.location&&(0,U.jsx)(`span`,{className:`font-mono [overflow-wrap:anywhere]`,children:W(`${e.location.repo?`${e.location.repo}/`:``}${e.location.file}${e.location.line?`:${e.location.line}`:``}`)}),[...new Set(e.steps)].slice(0,12).map(e=>(0,U.jsxs)(b,{variant:`link`,size:`inline`,onClick:()=>n(e),className:`min-h-7 px-2 tabular-nums`,children:[`step `,e]},e)),!e.overruled&&e.status!==`UNKNOWN`&&!i&&(0,U.jsxs)(b,{variant:`link`,size:`inline`,onClick:()=>o(!0),className:`min-h-7 gap-1 px-2`,children:[(0,U.jsx)(N,{size:12,"aria-hidden":`true`}),`Overrule`]})]}),i&&(0,U.jsxs)(`div`,{className:f(`panel rounded-md bg-(--page-surface-strong) p-6`,`flex max-w-[640px] flex-col gap-2`),children:[(0,U.jsx)(`label`,{htmlFor:`overrule-${e.id}`,className:`text-body-sm font-medium text-ink-2`,children:`Why is this finding wrong, or right to accept? It is kept with your name, and the finding stops counting.`}),(0,U.jsx)(a,{id:`overrule-${e.id}`,value:s,onChange:e=>c(e.target.value),rows:2,maxLength:500,placeholder:`For example: the owner agreed this removal in the change's review.`}),d&&(0,U.jsx)(V,{text:d}),(0,U.jsxs)(`span`,{className:`flex gap-2`,children:[(0,U.jsxs)(b,{busy:l,size:`sm`,disabled:!m||l,onClick:g,children:[(0,U.jsx)(N,{"aria-hidden":`true`}),l?`Overruling…`:`Overrule`]}),(0,U.jsxs)(b,{size:`sm`,variant:`outline`,onClick:()=>o(!1),children:[(0,U.jsx)(k,{"aria-hidden":`true`}),`Cancel`]})]})]})]})}function rt(){let[e,t]=(0,H.useState)(null),[n,i]=(0,H.useState)(``);return(0,H.useEffect)(()=>{h.review().then(t,e=>i(e.message))},[]),(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(X,{id:`evidence-review`,children:`Review queue`}),(0,U.jsx)(I,{more:(0,U.jsx)(U.Fragment,{children:`Runs whose findings are still open, the failed first, then work whose two fix attempts are used, where a person takes over. Open a run to read its findings, and overrule one with a reason where it is wrong or right to accept. Then the answers the rubric's judge could not settle, for a person to grade, and every finding people overruled, and why.`}),children:`What waits for a person: open findings to read, answers to grade, and what was overruled.`}),n&&(0,U.jsx)(V,{text:n}),!e&&!n&&(0,U.jsx)(Z,{}),e?.problems.map(e=>(0,U.jsx)(V,{text:e},e)),e&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`h2`,{className:`sr-only`,children:`What waits, what to grade, and what was overruled`}),(0,U.jsx)(B,{id:`waiting`,title:`Waiting for a person`,icon:E,n:e.waiting.length,children:e.waiting.length?(0,U.jsx)(`ul`,{"aria-label":`Waiting for a person`,className:f(`surface rounded-lg bg-bg p-6 shadow-sm`,`m-0 list-none`),children:e.waiting.map(e=>(0,U.jsx)(`li`,{children:(0,U.jsxs)(`a`,{href:r(`evidence-runs`,encodeURIComponent(e.run)),className:f(`flex w-full min-h-11 cursor-pointer items-center gap-4 rounded-base border-0 bg-transparent px-4 py-2 text-left text-body-sm text-ink no-underline transition-colors duration-150 hover:bg-tint hover:text-ink aria-[current]:bg-tint-hover aria-selected:bg-tint-hover aria-pressed:bg-tint-hover aria-checked:bg-tint-hover has-[:checked]:bg-tint-hover disabled:cursor-not-allowed disabled:opacity-50`,`grid min-h-12 grid-cols-[auto_minmax(0,1fr)_auto] gap-x-4`),children:[(0,U.jsx)(C,{tone:q[e.status].tone,children:q[e.status].label}),(0,U.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,U.jsx)(`span`,{className:`truncate text-body-sm font-medium`,children:W(e.request||`${e.agent}: request not recorded`)}),(0,U.jsx)(`span`,{className:`truncate text-body-sm text-muted`,children:[W(e.agent),d(e.open,`open finding`),e.failed?`${e.failed} failing`:``,e.attempt?`fix attempt ${e.attempt} of 2`:``,e.personTakesOver?`a person takes over`:``].filter(Boolean).join(` · `)})]}),(0,U.jsx)(`span`,{className:`text-right text-body-sm text-muted tabular-nums`,"data-tip":G(e.started),children:e.started?F(e.started):``})]})},e.run))}):(0,U.jsx)(R,{className:`py-4`,children:`Nothing waits: no run has an open finding.`})}),e.grade.length>0&&(0,U.jsxs)(B,{id:`grade`,title:`Answers to grade`,icon:P,n:e.grade.length,children:[(0,U.jsx)(`p`,{className:`m-0 text-body-sm text-muted`,children:`The rubric's judge could not settle these answers: it is not yet calibrated against people's grades, or it disagreed with itself. Grading them settles each one and calibrates the judge.`}),(0,U.jsx)(`ul`,{"aria-label":`Answers to grade`,className:f(`surface rounded-lg bg-bg p-6 shadow-sm`,`m-0 list-none`),children:e.grade.map(e=>(0,U.jsx)(`li`,{children:(0,U.jsxs)(`a`,{href:r(`evidence-runs`,encodeURIComponent(e.run)),className:f(`flex w-full min-h-11 cursor-pointer items-center gap-4 rounded-base border-0 bg-transparent px-4 py-2 text-left text-body-sm text-ink no-underline transition-colors duration-150 hover:bg-tint hover:text-ink aria-[current]:bg-tint-hover aria-selected:bg-tint-hover aria-pressed:bg-tint-hover aria-checked:bg-tint-hover has-[:checked]:bg-tint-hover disabled:cursor-not-allowed disabled:opacity-50`,`grid min-h-12 grid-cols-[minmax(0,1fr)_auto] gap-x-4`),children:[(0,U.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,U.jsx)(`span`,{className:`truncate text-body-sm font-medium`,children:W(e.request||`${e.agent}: request not recorded`)}),(0,U.jsx)(`span`,{className:`truncate text-body-sm text-muted`,children:[W(e.agent),`${e.ungraded} of ${e.criteria} ${e.criteria===1?`criterion`:`criteria`} not graded`].join(` · `)})]}),(0,U.jsx)(`span`,{className:`text-right text-body-sm text-muted tabular-nums`,"data-tip":G(e.started),children:e.started?F(e.started):``})]})},e.run))})]}),(0,U.jsx)(B,{id:`overruled`,title:`Overruled by people`,icon:oe,n:e.overruled.length,children:e.overruled.length?(0,U.jsx)(`ul`,{"aria-label":`Overruled findings`,className:f(`surface rounded-lg bg-bg p-6 shadow-sm`,`m-0 list-none`),children:e.overruled.map(e=>(0,U.jsxs)(`li`,{className:`flex flex-col gap-1 border-b border-line-soft px-4 py-2 last:border-b-0`,children:[(0,U.jsxs)(`span`,{className:`text-body-sm [overflow-wrap:anywhere]`,children:[(0,U.jsx)(`a`,{href:r(`evidence-runs`,encodeURIComponent(e.run)),children:W(e.agent||e.run)}),` · `,W(`${e.check}/${e.rule}`),e.what?`: ${W(e.what)}`:``]}),(0,U.jsxs)(`span`,{className:`text-body-sm text-ink-2 [overflow-wrap:anywhere]`,children:[W(e.by),` `,G(e.at),` (`,e.via===`web`?`on the page`:`at a terminal`,`): `,W(e.reason)]})]},`${e.run}-${e.finding}-${e.at}`))}):(0,U.jsx)(`p`,{className:`m-0 text-body-sm text-muted`,children:`No finding has been overruled.`})})]})]})}var it={build:`Build and test`,behaviour:`Behaviour`,decisions:`Decisions and data`,content:`Content`,domain:`Domain`};function at({s:e}){let[t,n]=(0,H.useState)(e.versions[0]||``),[r,a]=(0,H.useState)(e.versions[1]||``),[o,s]=(0,H.useState)(null),[l,u]=(0,H.useState)(``);(0,H.useEffect)(()=>{e.agent&&t&&(u(``),h.release(e.agent,t,r===t?``:r).then(s,e=>u(e.message)))},[e.agent,t,r]);let p=e=>{if(e===void 0)return``;if(e===null)return`Not run`;let t=e.runs.filter(e=>e.pass).length;return e.short?`Too few runs (${e.runs.length})`:e.pass?e.runs.length===1?`Pass`:t===e.runs.length?`Pass ×${e.runs.length}`:`Pass (${t} of ${e.runs.length})`:e.runs.length>1?`Fail (${e.runs.length-t} of ${e.runs.length} failed)`:`Fail`},m=o?[...new Set([...Object.keys(o.candidate.lensPass),...Object.keys(o.live?.lensPass||{})])]:[];return(0,U.jsxs)(`li`,{className:f(c,`flex flex-col gap-4`),children:[(0,U.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-4 gap-y-1`,children:[(0,U.jsx)(`span`,{className:`text-body-lg font-medium [overflow-wrap:anywhere]`,children:W(e.agent||e.name)}),(0,U.jsxs)(`span`,{className:`text-body-sm text-muted`,children:[W(`${e.name}.yaml`),` · `,d(e.scenarios.length,`scenario`)]})]}),e.problem&&(0,U.jsx)(V,{text:e.problem}),e.agent&&!e.versions.length&&(0,U.jsxs)(`p`,{className:`m-0 text-body-sm text-muted`,children:[`No run of `,W(e.agent),` is recorded yet: run each scenario's request through a version and record it (forgeqe evidence scenarios lists them).`]}),e.versions.length>0&&(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-body-sm`,children:[(0,U.jsx)(`label`,{htmlFor:`cand-${e.name}`,children:`Candidate`}),(0,U.jsx)(i,{size:`sm`,id:`cand-${e.name}`,value:t,onChange:e=>n(e.target.value),className:`w-auto pr-8 pl-4`,children:e.versions.map(e=>(0,U.jsx)(`option`,{value:e,children:W(e)},e))}),(0,U.jsx)(`label`,{htmlFor:`live-${e.name}`,children:`against live`}),(0,U.jsxs)(i,{size:`sm`,id:`live-${e.name}`,value:r,onChange:e=>a(e.target.value),className:`w-auto pr-8 pl-4`,children:[(0,U.jsx)(`option`,{value:``,children:`No live version`}),e.versions.filter(e=>e!==t).map(e=>(0,U.jsx)(`option`,{value:e,children:W(e)},e))]})]}),l&&(0,U.jsx)(V,{text:l}),o&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-4 gap-y-1`,children:[(0,U.jsx)(C,{tone:o.status===`ready`?`pass`:`fail`,children:o.status===`ready`?`Ready`:`Held`}),(0,U.jsx)(`span`,{className:`text-body-sm text-ink-2`,children:o.status===`ready`?`Not worse on any lens, and every misuse and injection test passed. A person releases it.`:`Held: a person decides, with what follows.`})]}),o.reasons.length>0&&(0,U.jsx)(`ul`,{className:`m-0 flex list-disc flex-col gap-1 pl-6 text-body-sm text-ink-2`,children:o.reasons.map(e=>(0,U.jsx)(`li`,{className:`[overflow-wrap:anywhere]`,children:W(e)},e))}),(0,U.jsxs)(z,{label:`Scenarios of ${e.agent}`,search:!1,sortable:!1,minWidth:520,head:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,children:`Scenario`}),(0,U.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,children:`Kind`}),o.live&&(0,U.jsxs)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,children:[W(o.live.version),` (live)`]}),(0,U.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,children:W(o.candidate.version)})]}),children:[e.scenarios.map(e=>(0,U.jsxs)(`tr`,{className:`h-12 border-t border-line-soft align-middle transition-colors duration-150 data-[state=selected]:bg-tint-hover`,children:[(0,U.jsx)(`th`,{scope:`row`,className:f(`px-4 py-2`,`text-left font-medium`),"data-tip":e.request,children:W(e.id)}),(0,U.jsx)(`td`,{className:`px-4 py-2`,children:e.kind}),o.live&&(0,U.jsx)(`td`,{className:f(`px-4 py-2`,o.live.cells[e.id]&&!o.live.cells[e.id].pass&&`text-fail`),children:p(o.live.cells[e.id])}),(0,U.jsx)(`td`,{className:f(`px-4 py-2`,(o.candidate.cells[e.id]===null||o.candidate.cells[e.id]&&!o.candidate.cells[e.id].pass)&&`text-fail`),children:p(o.candidate.cells[e.id])})]},e.id)),m.map(e=>(0,U.jsxs)(`tr`,{className:`h-12 border-t border-line-soft align-middle transition-colors duration-150 data-[state=selected]:bg-tint-hover`,children:[(0,U.jsxs)(`th`,{scope:`row`,className:f(`px-4 py-2`,`text-left text-muted`),children:[it[e],`: scenarios passed`]}),(0,U.jsx)(`td`,{className:`px-4 py-2`}),o.live&&(0,U.jsx)(`td`,{className:f(`px-4 py-2`,`tabular-nums`),children:o.live.lensPass[e]??0}),(0,U.jsx)(`td`,{className:f(`px-4 py-2`,`tabular-nums`,o.live&&(o.candidate.lensPass[e]??0)<(o.live.lensPass[e]??0)&&`text-fail`),children:o.candidate.lensPass[e]??0})]},e)),(0,U.jsxs)(`tr`,{className:`h-12 border-t border-line-soft align-middle transition-colors duration-150 data-[state=selected]:bg-tint-hover`,children:[(0,U.jsx)(`th`,{scope:`row`,className:f(`px-4 py-2`,`text-left text-muted`),children:`The owners' expectations met`}),(0,U.jsx)(`td`,{className:`px-4 py-2`}),o.live&&(0,U.jsx)(`td`,{className:f(`px-4 py-2`,`tabular-nums`),children:o.live.golden}),(0,U.jsx)(`td`,{className:f(`px-4 py-2`,`tabular-nums`,o.live&&o.candidate.golden<o.live.golden&&`text-fail`),children:o.candidate.golden})]})]}),(0,U.jsx)(ut,{g:o}),(0,U.jsx)(ot,{g:o}),(0,U.jsx)(dt,{g:o,ids:e.scenarios.map(e=>e.id)})]}),e.history.length>0&&(0,U.jsxs)(`details`,{className:`text-body-sm`,children:[(0,U.jsxs)(`summary`,{className:`cursor-pointer text-ink-2`,children:[`Gates kept (`,e.history.length,`)`]}),(0,U.jsx)(`ul`,{className:`m-0 mt-1 flex list-none flex-col gap-1 p-0`,children:e.history.map(e=>(0,U.jsxs)(`li`,{className:`text-body-sm text-ink-2 [overflow-wrap:anywhere]`,children:[G(e.at),` · `,W(e.by),` · `,W(e.candidate),e.live?` against ${W(e.live)}`:``,`: `,e.status===`ready`?`ready`:`held`,e.reasons.length?` (${W(e.reasons[0])}${e.reasons.length>1?`, and ${e.reasons.length-1} more`:``})`:``]},e.at))})]})]})}function ot({g:e}){let t=Object.entries(e.candidate.cells).flatMap(([e,t])=>(t?.runs??[]).filter(e=>e.awaitingGrade).map(t=>({sid:e,run:t.run})));return t.length?(0,U.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,U.jsxs)(`h4`,{className:`m-0 text-body-sm font-medium`,children:[`Answers waiting for your grade (`,t.length,`)`]}),(0,U.jsx)(`p`,{className:`m-0 text-body-sm text-muted`,children:`These scenarios are graded by a person: until an answer is graded, it is not known, and the scenario does not pass.`}),(0,U.jsx)(`ul`,{"aria-label":`Answers waiting for a grade`,className:`m-0 flex list-none flex-col gap-1 p-0 text-body-sm`,children:t.map(e=>(0,U.jsx)(`li`,{children:(0,U.jsxs)(`a`,{href:r(`evidence-runs`,encodeURIComponent(e.run)),className:`text-accent-fg hover:underline`,children:[W(e.sid),`: `,e.run]})},e.run))})]}):null}function st({f:e}){return(0,U.jsxs)(`li`,{className:f(c,`flex flex-col gap-2`),children:[(0,U.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-4 gap-y-1`,children:[(0,U.jsx)(C,{tone:e.applied||e.proven?`pass`:`fail`,children:e.applied?`Applied`:e.proven?`Proven`:`Not proven`}),(0,U.jsx)(`span`,{className:`text-body-sm font-medium [overflow-wrap:anywhere]`,children:W(e.instruction)}),(0,U.jsx)(`span`,{className:`font-mono text-body-sm text-muted`,children:e.id})]}),(0,U.jsxs)(`span`,{className:`text-body-sm text-ink-2 [overflow-wrap:anywhere]`,children:[`Adds it to `,W(e.file),`, for `,W(e.cause),` of `,(0,U.jsx)(`a`,{href:r(`evidence-runs`,encodeURIComponent(e.run)),className:`font-mono`,children:e.run}),` (scenario `,W(e.scenario),`, `,W(e.version),`).`]}),(0,U.jsxs)(`span`,{className:`text-body-sm text-ink-2 [overflow-wrap:anywhere]`,children:[`The cause: `,e.proof.replace(`-`,` `),` (`,W(e.why),`)`,e.replays.length?(0,U.jsxs)(U.Fragment,{children:[`; replays `,Tt(e.replays)]}):null,`.`]}),(0,U.jsxs)(`span`,{className:`text-body-sm text-ink-2 [overflow-wrap:anywhere]`,children:[`The suite, run from the patched copy against `,W(e.version),`: `,e.gate.status===`ready`?`no worse`:`held: ${W(e.gate.reasons.join(` `))}`]}),e.applied&&(0,U.jsxs)(`span`,{className:`text-body-sm text-ink-2 [overflow-wrap:anywhere]`,children:[`Applied by `,W(e.applied.by),` `,G(e.applied.at),`: `,W(e.applied.reason)]}),(0,U.jsxs)(`details`,{className:`text-body-sm`,children:[(0,U.jsx)(`summary`,{className:`cursor-pointer text-ink-2`,children:`The patch`}),(0,U.jsx)(`pre`,{className:f(x,`m-0 mt-1 overflow-x-auto`),children:W(e.patch)})]})]})}function ct({d:e,onDecided:t}){let n=e.scenario,r=n.expect||{},i=e.source.kind===`run`?`a run that failed`:e.source.kind===`story`?`an acceptance criterion`:e.source.kind===`rule`?`a business rule of the product, at`:`a defect`,a=e=>(e||[]).map(e=>W(e)).join(`, `);return(0,U.jsxs)(`li`,{className:`flex flex-col gap-2 border-b border-line-soft px-4 py-4 last:border-b-0`,children:[(0,U.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-4 gap-y-1`,children:[(0,U.jsx)(`span`,{className:`font-mono text-body-sm text-muted`,children:e.id}),(0,U.jsxs)(`span`,{className:`text-body-sm font-medium [overflow-wrap:anywhere]`,children:[W(n.id),` for `,W(e.agent)]}),(0,U.jsx)(C,{tone:`neutral`,children:n.kind}),n.held_out&&(0,U.jsx)(C,{tone:`neutral`,children:`Held out`}),e.decided&&(0,U.jsx)(C,{tone:e.decided.decision===`accepted`?`pass`:`warn`,children:e.decided.decision===`accepted`?`Accepted`:`Rejected`})]}),(0,U.jsxs)(`span`,{className:`text-body-sm text-ink-2 [overflow-wrap:anywhere]`,children:[`Drafted by `,e.by===`code`?`code`:`a model`,` from `,i,` `,e.source.url&&T(e.source.url)===`web`?(0,U.jsx)(`a`,{href:e.source.url,target:`_blank`,rel:`noreferrer noopener`,className:`text-accent-fg hover:underline`,children:W(e.source.ref)}):W(e.source.ref),e.source.criterion?` ${W(e.source.criterion)}`:``,e.source.quote?(0,U.jsxs)(U.Fragment,{children:[`: “`,W(e.source.quote),`”`]}):e.source.why?(0,U.jsxs)(U.Fragment,{children:[`: `,W(e.source.why)]}):null]}),(0,U.jsx)(`p`,{className:f(l,`m-0 whitespace-pre-wrap text-body-sm text-ink [overflow-wrap:anywhere]`),children:W(n.request)}),(0,U.jsxs)(`ul`,{className:`m-0 flex list-disc flex-col gap-1 pl-6 text-body-sm text-ink-2`,children:[r.chose&&(0,U.jsxs)(`li`,{children:[`Expects it to choose `,a(r.chose)]}),r.not_chose&&(0,U.jsxs)(`li`,{children:[`Expects it never to choose `,a(r.not_chose)]}),r.says&&(0,U.jsxs)(`li`,{children:[`Expects it to say: `,a(r.says)]}),r.not_says&&(0,U.jsxs)(`li`,{children:[`Expects it never to say: `,a(r.not_says)]}),r.graded&&(0,U.jsx)(`li`,{children:`A person grades each answer`}),(0,U.jsx)(`li`,{children:r.clean?`Every lens must find nothing`:`The lenses are counted lens by lens`})]}),e.decided?(0,U.jsxs)(`span`,{className:`text-body-sm text-ink-2 [overflow-wrap:anywhere]`,children:[e.decided.decision===`accepted`?`Accepted`:`Rejected`,` by `,W(e.decided.by),` `,G(e.decided.at),e.decided.scenario?` as ${W(e.decided.scenario)}`:``,`: `,W(e.decided.reason)]}):(0,U.jsxs)(`span`,{className:`flex flex-wrap gap-2`,children:[(0,U.jsx)(wt,{agent:e.id,uid:`${e.id}-accept`,label:`Add`,icon:ie,tip:`Add to the suite`,action:(t,n)=>h.decideDraft(e.id,`accepted`,t,n),onDone:t}),(0,U.jsx)(wt,{agent:e.id,uid:`${e.id}-reject`,label:`Reject`,icon:N,action:(t,n)=>h.decideDraft(e.id,`rejected`,t,n),onDone:t})]})]})}function lt({onDecided:e}){let[t,n]=(0,H.useState)(null),[r,i]=(0,H.useState)(``),a=()=>h.drafts().then(n,e=>i(e.message));(0,H.useEffect)(()=>{a()},[]);let o=t?.drafts.filter(e=>!e.decided).length??0;return(0,U.jsxs)(B,{id:`drafts`,title:`Drafted scenarios`,icon:P,n:o,children:[(0,U.jsxs)(`p`,{className:`m-0 text-body-sm text-muted`,children:[`Drafted from work items' acceptance criteria and defects (`,(0,U.jsx)(`code`,{children:`forgeqe evidence draft <agent> --from ado:N`}),`) or the product graph's business rules (`,(0,U.jsx)(`code`,{children:`--from-product`}),`), each resting on a quote of its source, or from a run that failed (`,(0,U.jsx)(`code`,{children:`--run <id>`}),`). Nothing is added by itself: add each to the suite, or reject it. About one in five is held out by ForgeQE, so the team tuning the agent does not choose what it is measured on.`]}),r&&(0,U.jsx)(V,{text:r}),t?.problems.map(e=>(0,U.jsx)(V,{text:e},e)),t&&!t.drafts.length&&(0,U.jsx)(`p`,{className:`m-0 text-body-sm text-muted`,children:`No draft yet.`}),t&&t.drafts.length>0&&(0,U.jsx)(`ul`,{"aria-label":`Drafted scenarios`,className:f(`surface rounded-lg bg-bg p-6 shadow-sm`,`m-0 flex list-none flex-col`),children:t.drafts.map(t=>(0,U.jsx)(ct,{d:t,onDecided:()=>{a(),e()}},t.id))})]})}function ut({g:e}){let t=[...e.live?[e.live]:[],e.candidate],n=e=>e&&e.n?`${Math.round(e.pass/e.n*100)}% of ${e.n}`:`-`,r=[...[...new Set(t.flatMap(e=>Object.keys(e.pooled.lens)))].map(e=>[it[e],t=>n(t.pooled.lens[e])]),[`The owners' expectations`,e=>n(e.pooled.golden)],[`Weakest lens (the summary)`,e=>e.pooled.weakest?`${Math.round(e.pooled.weakest.score*100)}% (${it[e.pooled.weakest.lens]})`:`-`],...t.some(e=>e.pooled.heldOut.n)?[[`Held-out scenarios`,e=>n(e.pooled.heldOut)]]:[],[`Steps per run`,e=>e.pooled.effort.runs?e.pooled.effort.steps.toFixed(1):`-`],[`Tool calls per run`,e=>e.pooled.effort.runs?e.pooled.effort.tools.toFixed(1):`-`],[`Time per run`,e=>e.pooled.effort.ms===null?`-`:`${(e.pooled.effort.ms/1e3).toFixed(1)} s`]];return(0,U.jsxs)(`details`,{className:`text-body-sm`,children:[(0,U.jsx)(`summary`,{className:`cursor-pointer text-ink-2`,children:`Scores: runs passed, lens by lens`}),(0,U.jsx)(`p`,{className:`m-0 mt-1 text-body-sm text-muted`,children:`A lens's score is its runs passed of the runs it judged. The summary is the weakest lens, never an average: one lens cannot make up for another. Effort is shown, never held against a version on its own.`}),(0,U.jsx)(z,{label:`Scores`,search:!1,sortable:!1,minWidth:420,head:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`th`,{scope:`col`,className:Me,children:`Score`}),t.map(t=>(0,U.jsxs)(`th`,{scope:`col`,className:Se,children:[W(t.version),e.live&&t===e.live?` (live)`:``]},t.version))]}),children:r.map(([e,n])=>(0,U.jsxs)(`tr`,{className:Ee,children:[(0,U.jsx)(`th`,{scope:`row`,className:f(je,`text-left font-medium`),children:e}),t.map(e=>(0,U.jsx)(`td`,{className:ke,children:n(e)},e.version))]},e))})]})}function dt({g:e,ids:t}){let n=e=>e?e.runs.find(e=>e.path?.unmet.length)??e.runs.find(e=>e.path):void 0,i=t.flatMap(t=>{let r=n(e.candidate.cells[t]),i=e.live?n(e.live.cells[t]):void 0;return r?.path||i?.path?[{id:t,cand:r,live:i}]:[]});if(!i.length)return null;let a={same:``,missing:`expected, not done`,extra:`done, not expected`},o=(e,t)=>t?.path?(0,U.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,U.jsxs)(`span`,{className:`text-body-sm text-muted`,children:[e,`: `,(0,U.jsx)(`a`,{href:r(`evidence-runs`,encodeURIComponent(t.run)),className:`font-mono`,children:t.run}),t.path.match===null?``:` · match ${Math.round(t.path.match*100)}%, efficiency ${Math.round((t.path.efficiency??0)*100)}%`]}),(0,U.jsx)(`ol`,{className:`m-0 flex list-none flex-col gap-1 p-0 font-mono text-body-sm`,children:(t.path.alignment.length?t.path.alignment:t.path.actual.map(e=>({kind:`same`,step:e}))).map((e,t)=>(0,U.jsxs)(`li`,{className:f(`[overflow-wrap:anywhere]`,e.kind===`missing`&&`text-fail`,e.kind===`extra`&&`text-warn`),children:[e.kind===`missing`?`− `:e.kind===`extra`?`+ `:` `,W(e.step),e.kind!==`same`&&(0,U.jsxs)(`span`,{className:`font-sans text-body-sm text-muted`,children:[` (`,a[e.kind],`)`]})]},`${t}-${e.step}`))}),t.path.unmet.map(e=>(0,U.jsx)(`span`,{className:`text-body-sm text-fail [overflow-wrap:anywhere]`,children:W(e)},e))]}):(0,U.jsxs)(`span`,{className:`text-body-sm text-muted`,children:[e,`: not run`]});return(0,U.jsxs)(`details`,{className:`text-body-sm`,children:[(0,U.jsxs)(`summary`,{className:`cursor-pointer text-ink-2`,children:[`Paths: expected against actual (`,i.length,`)`]}),(0,U.jsx)(`ul`,{className:`m-0 mt-2 flex list-none flex-col gap-4 p-0`,children:i.map(t=>(0,U.jsxs)(`li`,{className:f(c,`flex flex-col gap-2`),children:[(0,U.jsx)(`span`,{className:`text-body-sm font-medium`,children:W(t.id)}),(0,U.jsxs)(`div`,{className:`grid gap-4 @[640px]:grid-cols-2`,children:[e.live&&o(`${e.live.version} (live)`,t.live),o(e.candidate.version,t.cand)]})]},t.id))})]})}function ft(){let[e,t]=(0,H.useState)(null),[n,r]=(0,H.useState)(``),i=()=>h.releases().then(t,e=>r(e.message));return(0,H.useEffect)(()=>{i()},[]),(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(X,{id:`evidence-releases`,children:`Releases`}),(0,U.jsx)(I,{more:(0,U.jsxs)(U.Fragment,{children:[`Before a version is released: its runs of the agent's scenario suite (stories, past defects, misuse and injection tests, each with what its owners expect) against the live version's. It is held when it is worse on any lens, meets fewer expectations, or fails a misuse or injection test; not run, or not known, is never a pass. A person releases; `,(0,U.jsx)(`code`,{children:`forgeqe evidence release`}),` keeps each gate. A suite is written in `,(0,U.jsx)(`code`,{children:`.forgeqe/evidence/scenarios/<agent>.yaml`}),` (docs/EVIDENCE.md has its form).`]}),children:`Release an agent's new version only when it does at least as well as the live one on its scenarios.`}),n&&(0,U.jsx)(V,{text:n}),!e&&!n&&(0,U.jsx)(Z,{}),e&&!e.suites.length&&(0,U.jsx)(R,{className:`py-4`,children:`No scenario suite yet: add drafted scenarios below to start one. A suite can also be written by hand; How it works says where.`}),e&&e.suites.length>0&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`h2`,{className:`sr-only`,children:`Each agent's scenario suite and release gate`}),(0,U.jsx)(B,{id:`suites`,title:`Scenario suites`,icon:P,n:e.suites.length,children:(0,U.jsx)(`ul`,{"aria-label":`Scenario suites`,className:`m-0 flex list-none flex-col gap-4 p-0`,children:e.suites.map(e=>(0,U.jsx)(at,{s:e},e.name))})})]}),e&&(0,U.jsx)(lt,{onDecided:i})]})}var pt={approved:{tone:`pass`,label:`Approved`},changed:{tone:`warn`,label:`Changed since approved`},draft:{tone:`neutral`,label:`Not approved`},invalid:{tone:`fail`,label:`Cannot be read`}};function mt(){let[e,t]=(0,H.useState)(null),[n,r]=(0,H.useState)(``);(0,H.useEffect)(()=>{h.contracts().then(t,e=>r(e.message))},[]);let i=e=>e===null?`–`:`${Math.round(e*100)}%`;return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(X,{id:`evidence-contracts`,children:`Contracts`}),(0,U.jsx)(I,{more:(0,U.jsxs)(U.Fragment,{children:[`A contract says the steps an agent must take, what it may and may never do, its limits, what a person decides, and what its statements need behind them. Each run is checked against its agent's approved contract. A contract nobody approved, or a check not yet measured well enough on labelled runs, only warns. Start one with `,(0,U.jsx)(`code`,{children:`forgeqe evidence contract new "<agent>"`}),`; a person approves it at a terminal with `,(0,U.jsx)(`code`,{children:`forgeqe evidence contract approve <name>`}),`.`]}),children:`What each agent's owner agreed it must and may do, and how well each check is measured.`}),n&&(0,U.jsx)(V,{text:n}),!e&&!n&&(0,U.jsx)(Z,{}),e&&!e.contracts.length&&(0,U.jsx)(R,{className:`py-4`,children:`No contract yet. Without one, a run's record is kept, but nothing checks it against what was agreed.`}),e&&(0,U.jsx)(`h2`,{className:`sr-only`,children:`The contracts and how each check is measured`}),e&&e.contracts.length>0&&(0,U.jsx)(B,{id:`contracts`,title:`Contracts`,icon:ve,n:e.contracts.length,children:(0,U.jsx)(`ul`,{"aria-label":`Contracts`,className:`m-0 flex list-none flex-col gap-4 p-0`,children:e.contracts.map(e=>(0,U.jsxs)(`li`,{className:f(`surface rounded-lg bg-bg p-6 shadow-sm`,`flex flex-col gap-2`),children:[(0,U.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-4 gap-y-1`,children:[(0,U.jsx)(`span`,{className:`text-body-lg font-medium [overflow-wrap:anywhere]`,children:W(e.agent||e.name)}),(0,U.jsx)(C,{tone:pt[e.state].tone,children:pt[e.state].label}),(0,U.jsxs)(`span`,{className:`text-body-sm text-muted [overflow-wrap:anywhere]`,children:[W(`${e.name}.yaml`),e.version?` · version ${W(e.version)}`:``,e.approved?` · approved ${G(e.approved.at)} by ${W(e.approved.by)}`:``]})]}),e.problem&&(0,U.jsx)(V,{text:e.problem}),e.says.length>0&&(0,U.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0`,children:e.says.map(e=>(0,U.jsx)(`li`,{className:`text-body-sm text-ink-2 [overflow-wrap:anywhere]`,children:W(e)},e))}),(0,U.jsx)(`span`,{className:`text-body-sm text-muted`,children:e.gates.length?`Can fail a run: ${e.gates.map(e=>J[e]).join(`, `)}.`:`No check can fail a run under it yet: what they find is a warning.`})]},e.name))})}),e&&(0,U.jsxs)(B,{id:`measured`,title:`How well each check is measured`,icon:M,children:[(0,U.jsxs)(`p`,{className:`m-0 text-body-sm leading-relaxed text-ink-2`,children:[`On `,d(e.measured.records,`labelled run`),`: runs whose right findings a person wrote down (ForgeQE's own, and the project's in .forgeqe/evidence/labelled). A check may fail a run only when its owner's bar is met on at least `,e.measured.min,` labelled findings.`]}),e.measured.problems.map(e=>(0,U.jsx)(V,{text:`Not measured: ${e}`},e)),(0,U.jsx)(`div`,{className:`@container`,children:(0,U.jsx)(z,{label:`How well each check is measured`,search:!1,head:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,children:`Check`}),[`Labelled`,`Found right`,`Found wrong`,`Missed`,`Precision`,`Recall`].map(e=>(0,U.jsx)(`th`,{scope:`col`,className:f(`px-4 py-2 text-right text-label-md font-medium whitespace-nowrap text-muted`,`whitespace-normal`,ht.has(e)&&`hidden @lg:table-cell`),children:e},e))]}),children:Object.keys(J).filter(t=>e.measured.checks[t]).map(t=>{let n=e.measured.checks[t];return(0,U.jsxs)(`tr`,{className:`h-12 border-t border-line-soft align-middle transition-colors duration-150 data-[state=selected]:bg-tint-hover`,children:[(0,U.jsx)(`th`,{scope:`row`,className:f(`px-4 py-2`,`text-left font-medium`),children:J[t]}),(0,U.jsx)(`td`,{className:f(`px-4 py-2 text-right whitespace-nowrap tabular-nums`,n.labelled<e.measured.min&&`text-muted`),children:n.labelled}),(0,U.jsx)(`td`,{className:f(`px-4 py-2 text-right whitespace-nowrap tabular-nums`,`hidden @lg:table-cell`),children:n.tp}),(0,U.jsx)(`td`,{className:f(`px-4 py-2 text-right whitespace-nowrap tabular-nums`,`hidden @lg:table-cell`,n.fp>0&&`text-fail`),children:n.fp}),(0,U.jsx)(`td`,{className:f(`px-4 py-2 text-right whitespace-nowrap tabular-nums`,`hidden @lg:table-cell`,n.fn>0&&`text-fail`),children:n.fn}),(0,U.jsx)(`td`,{className:`px-4 py-2 text-right whitespace-nowrap tabular-nums`,children:i(n.precision)}),(0,U.jsx)(`td`,{className:`px-4 py-2 text-right whitespace-nowrap tabular-nums`,children:i(n.recall)})]},t)})})})]})]})}var ht=new Set([`Found right`,`Found wrong`,`Missed`]),gt={proven:{tone:`pass`,label:`Proven`},promising:{tone:`neutral`,label:`Promising`},"not-replayed":{tone:`neutral`,label:`Not replayed`},refuted:{tone:`fail`,label:`Refuted`},"side-effects":{tone:`warn`,label:`Side effects`}},_t={instruction:`Its instructions`,tool:`A tool`,data:`Its data`};function vt({p:e,onDecided:t}){let[n,i]=(0,H.useState)(null),[o,s]=(0,H.useState)(``),[c,l]=(0,H.useState)(!1),[u,p]=(0,H.useState)(``),m=o.trim().length>=10&&o.trim().length<=500,g=async()=>{if(n){l(!0),p(``);try{await h.decide(e.agent,e.id,n,o.trim()),i(null),t()}catch(e){p(e.message)}finally{l(!1)}}};return(0,U.jsxs)(`li`,{className:`flex flex-col gap-1 border-b border-line-soft px-4 py-2 last:border-b-0`,children:[(0,U.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-4 gap-y-1`,children:[(0,U.jsx)(C,{tone:e.state===`approved`?`pass`:e.state===`declined`?`neutral`:`warn`,children:e.state===`approved`?`Approved`:e.state===`declined`?`Declined`:`Open`}),(0,U.jsx)(`span`,{className:`text-body-sm font-medium text-ink-2`,children:e.kind===`fix`?`Fix, proven by replay`:`Guidance for its instructions`}),(0,U.jsx)(`span`,{className:`font-mono text-body-sm text-muted`,children:e.id})]}),(0,U.jsx)(`span`,{className:`text-body-sm text-ink [overflow-wrap:anywhere]`,children:W(e.text)}),(0,U.jsxs)(`span`,{className:`text-body-sm text-muted [overflow-wrap:anywhere]`,children:[`Because `,W(e.because),`. `,d(e.runs.length,`run`),e.replays?`, ${d(e.replays.length,`replay`)}`:``,`:`,` `,[...e.runs,...e.replays??[]].slice(0,8).map((e,t)=>(0,U.jsxs)(`span`,{children:[t?`, `:``,(0,U.jsx)(`a`,{href:r(`evidence-runs`,encodeURIComponent(e)),className:`font-mono`,children:e})]},e))]}),e.decision&&(0,U.jsxs)(`span`,{className:`text-body-sm text-ink-2 [overflow-wrap:anywhere]`,children:[e.state===`approved`?`Approved`:`Declined`,` by `,W(e.decision.by),` `,G(e.decision.at),` (`,e.decision.via===`web`?`on this page`:`at a terminal`,`): `,W(e.decision.reason)]}),e.state===`open`&&!n&&(0,U.jsxs)(`span`,{className:`flex gap-2`,children:[(0,U.jsxs)(b,{size:`sm`,onClick:()=>i(`approved`),children:[(0,U.jsx)(j,{"aria-hidden":`true`}),`Approve`]}),(0,U.jsxs)(b,{size:`sm`,variant:`ghost`,onClick:()=>i(`declined`),children:[(0,U.jsx)(N,{"aria-hidden":`true`}),`Decline`]})]}),n&&(0,U.jsxs)(`div`,{className:f(`panel rounded-md bg-(--page-surface-strong) p-6`,`flex max-w-[640px] flex-col gap-2`),children:[(0,U.jsx)(`label`,{htmlFor:`decide-${e.id}`,className:`text-body-sm font-medium text-ink-2`,children:n===`approved`?`Why approve it? It is kept with your name; the team then puts it into the agent: Evidence changes nothing itself.`:`Why decline it? It is kept with your name.`}),(0,U.jsx)(a,{id:`decide-${e.id}`,value:o,onChange:e=>s(e.target.value),rows:2,maxLength:500,placeholder:`For example: the replays show the claim data is the cause.`}),u&&(0,U.jsx)(V,{text:u}),(0,U.jsxs)(`span`,{className:`flex gap-2`,children:[(0,U.jsxs)(b,{busy:c,size:`sm`,disabled:!m||c,onClick:g,children:[n===`approved`?(0,U.jsx)(j,{"aria-hidden":`true`}):(0,U.jsx)(N,{"aria-hidden":`true`}),c?`Keeping…`:n===`approved`?`Approve`:`Decline`]}),(0,U.jsxs)(b,{size:`sm`,variant:`outline`,onClick:()=>i(null),children:[(0,U.jsx)(k,{"aria-hidden":`true`}),`Cancel`]})]})]})]})}function yt({agent:e,run:t,c:n,candidates:i,onLinked:a}){let o=i,[s,c]=(0,H.useState)(!1),[l,u]=(0,H.useState)([]),[d,p]=(0,H.useState)(!1),[m,g]=(0,H.useState)(``);return(0,U.jsxs)(`div`,{className:f(`flex flex-col gap-1 border-l-2 pl-4`,n.status===`proven`?`border-pass`:n.status===`refuted`?`border-fail`:n.status===`side-effects`?`border-warn`:`border-line`),children:[(0,U.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-4 gap-y-1`,children:[(0,U.jsx)(C,{tone:gt[n.status].tone,children:gt[n.status].label}),(0,U.jsxs)(`span`,{className:`text-body-sm font-medium`,children:[n.id,` · `,_t[n.kind],`: `,W(n.where)]}),(0,U.jsxs)(`span`,{className:`text-body-sm text-muted`,children:[`of `,J[n.finding.check],`: `,W(n.finding.rule)]})]}),(0,U.jsxs)(`span`,{className:`text-body-sm text-ink [overflow-wrap:anywhere]`,children:[`Change: `,W(n.change)]}),(0,U.jsxs)(`span`,{className:`text-body-sm text-muted [overflow-wrap:anywhere]`,children:[W(n.why),`.`]}),n.replays.map(e=>(0,U.jsxs)(`span`,{className:`text-body-sm text-ink-2 [overflow-wrap:anywhere]`,children:[`Replay `,(0,U.jsx)(`a`,{href:r(`evidence-runs`,encodeURIComponent(e.run)),className:`font-mono`,children:e.run}),`: `,e.gone&&!e.broke.length&&e.changeSeen!==!1?`the finding is gone`:W(e.why.join(`; `))]},e.run)),!s&&o.length>0&&n.status!==`proven`&&(0,U.jsx)(`span`,{children:(0,U.jsxs)(b,{variant:`link`,size:`inline`,onClick:()=>c(!0),"data-tip":`Link replays`,className:`min-h-7 gap-1`,children:[(0,U.jsx)(pe,{size:12,"aria-hidden":`true`}),`Link`]})}),s&&(0,U.jsxs)(`fieldset`,{className:f(`panel rounded-md bg-(--page-surface-strong) p-6`,`m-0 flex max-w-[640px] flex-col gap-2 border-0`),children:[(0,U.jsxs)(`legend`,{className:`sr-only`,children:[`Replays of `,n.id]}),(0,U.jsx)(`span`,{className:`text-body-sm font-medium text-ink-2`,children:`Which runs are this request run again with this change? Only runs of the same agent and request, after this one, are listed.`}),o.map(e=>(0,U.jsxs)(`label`,{className:`flex min-h-8 items-center gap-2 text-body-sm`,children:[(0,U.jsx)(Te,{checked:l.includes(e),onCheckedChange:t=>u(n=>t?[...n,e]:n.filter(t=>t!==e))}),(0,U.jsx)(`span`,{className:`font-mono`,children:e})]},e)),m&&(0,U.jsx)(V,{text:m}),(0,U.jsxs)(`span`,{className:`flex gap-2`,children:[(0,U.jsxs)(b,{busy:d,size:`sm`,disabled:!l.length||d,onClick:async()=>{p(!0),g(``);try{await h.replay(e,t,n.id,l),c(!1),u([]),a()}catch(e){g(e.message)}finally{p(!1)}},"data-tip":`Link the picked replays`,children:[(0,U.jsx)(pe,{"aria-hidden":`true`}),d?`Linking…`:l.length?`Link (${l.length})`:`Link`]}),(0,U.jsxs)(b,{size:`sm`,variant:`outline`,onClick:()=>c(!1),children:[(0,U.jsx)(k,{"aria-hidden":`true`}),`Cancel`]})]})]})]})}function bt({sub:e}){let[t,a]=(0,H.useState)(null),[o,s]=(0,H.useState)(e?n(e):``),[c,l]=(0,H.useState)(null),[u,d]=(0,H.useState)(``),[p,m]=(0,H.useState)(0);(0,H.useEffect)(()=>{h.overview().then(e=>{let t=e.agents.map(e=>e.name);a(t),s(e=>e||t[0]||``)},e=>d(e.message))},[]),(0,H.useEffect)(()=>{o&&(l(null),h.learn(o).then(l,e=>d(e.message)))},[o,p]);let g=()=>m(e=>e+1);return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(X,{id:`evidence-learn`,children:`Learn`}),(0,U.jsx)(I,{more:(0,U.jsx)(U.Fragment,{children:`Each open finding has its possible causes (its instructions, a tool, the data it took in); a cause is proven when the same request, run again three times with that one change, no longer gives the finding and breaks nothing else. Proven causes and rules broken again and again are proposed; a person approves or declines each, and the team puts what is approved into the agent. Evidence changes nothing itself.`}),children:`What to change in an agent, from what its runs got wrong.`}),u&&(0,U.jsx)(V,{text:u}),t&&!t.length&&(0,U.jsx)(Ve,{}),t&&t.length>1&&(0,U.jsxs)(`label`,{className:`flex w-fit items-center gap-2 text-body-sm text-ink-2`,children:[`Agent`,(0,U.jsx)(i,{value:o,onChange:e=>s(e.target.value),children:t.map(e=>(0,U.jsx)(`option`,{value:e,children:W(e)},e))})]}),o&&!c&&!u&&(0,U.jsx)(Z,{}),c?.problems.map(e=>(0,U.jsx)(V,{text:e},e)),c&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`h2`,{className:`sr-only`,children:[`Proposals and causes of `,W(c.agent)]}),(0,U.jsxs)(B,{id:`proposals`,title:`Proposals`,icon:le,n:c.proposals.length,children:[c.proposals.length?(0,U.jsx)(`ul`,{"aria-label":`Proposals`,className:f(`surface rounded-lg bg-bg p-6 shadow-sm`,`m-0 list-none`),children:c.proposals.map(e=>(0,U.jsx)(vt,{p:e,onDecided:g},e.id))}):(0,U.jsx)(R,{className:`py-4`,children:`Nothing to propose yet. A rule broken in three runs of the agent's latest version is proposed as guidance; a cause proven by replay, as a fix.`}),c.proposals.some(e=>e.state===`approved`)&&(0,U.jsxs)(`p`,{className:`m-0 text-body-sm text-muted`,children:[(0,U.jsxs)(`code`,{children:[`forgeqe evidence guidance `,W(c.agent)]}),` writes what was approved as Markdown, to put into the agent.`]})]}),(0,U.jsxs)(B,{id:`fixes`,title:`Fixes proven by the harness`,icon:ae,n:c.fixes.length,children:[(0,U.jsxs)(`p`,{className:`m-0 text-body-sm text-muted`,children:[`A cause in the agent's instructions, added to a copy of them and run by ForgeQE's harness: proven on 3 clean replays and a suite that is no worse. The project is not changed: a person applies a proven fix at a terminal (`,(0,U.jsx)(`code`,{children:`forgeqe evidence fix apply <fix>`}),`), or puts its patch on a branch for a pull request.`]}),c.fixes.length?(0,U.jsx)(`ul`,{"aria-label":`Fixes`,className:`m-0 flex list-none flex-col gap-2 p-0`,children:c.fixes.map(e=>(0,U.jsx)(st,{f:e},`${e.id}-${e.at}`))}):(0,U.jsxs)(`p`,{className:`m-0 text-body-sm text-muted`,children:[`No fix proven yet: `,(0,U.jsx)(`code`,{children:`forgeqe evidence fix <run> H1`}),` proves one of a cause below.`]})]}),(0,U.jsx)(B,{id:`causes`,title:`Causes of its findings`,icon:A,n:c.runs.length,children:c.runs.length?(0,U.jsx)(`ul`,{"aria-label":`Runs and their causes`,className:`m-0 flex list-none flex-col gap-2 p-0`,children:c.runs.map(e=>(0,U.jsxs)(`li`,{className:f(`surface rounded-lg bg-bg p-6 shadow-sm`,`flex flex-col gap-2`),children:[(0,U.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-4 gap-y-1`,children:[(0,U.jsx)(`a`,{href:r(`evidence-runs`,encodeURIComponent(e.run)),className:`text-body-sm font-medium [overflow-wrap:anywhere]`,children:W(e.request||e.run)}),(0,U.jsxs)(`span`,{className:`font-mono text-body-sm text-muted`,children:[e.run,e.version?` · ${W(e.version)}`:``]})]}),e.causes.map(t=>(0,U.jsx)(yt,{agent:c.agent,run:e.run,c:t,candidates:e.candidates,onLinked:g},t.key)),!e.candidates.length&&(0,U.jsxs)(`span`,{className:`text-body-sm text-muted`,children:[`No run of the same request is recorded after it yet: `,(0,U.jsxs)(`code`,{children:[`forgeqe evidence replay-kit `,e.run,` H1`]}),` says what to change for a replay.`]})]},e.run))}):(0,U.jsx)(`p`,{className:`m-0 text-body-sm text-muted`,children:`No run of this agent has an open finding.`})})]})]})}var $={observe:`Observe`,assist:`Assist`,act:`Act`,autonomous:`Autonomous`},xt={observe:`a person reviews everything it does`,assist:`a person approves each change it makes`,act:`it acts alone within its contract; people review its findings`,autonomous:`it acts alone; only alerts reach people`},St={model:`Model`,tool:`Tool`,knowledge:`Knowledge`,check:`Check`,judge:`Judge`,trust:`Trust`},Ct=[`observe`,`assist`,`act`,`autonomous`];function wt({agent:e,label:t,icon:n,tip:r,action:i,children:s,onDone:c,uid:l}){let[d,p]=(0,H.useState)(!1),[m,h]=(0,H.useState)(``),[g,_]=(0,H.useState)(``),[v,y]=(0,H.useState)(!1),[ee,x]=(0,H.useState)(``),S=m.trim().length>=10&&m.trim().length<=500&&g===e,C=async()=>{y(!0),x(``);try{await i(g,m.trim()),p(!1),h(``),_(``),c()}catch(e){x(e.message)}finally{y(!1)}};if(!d)return(0,U.jsx)(`span`,{children:(0,U.jsxs)(b,{size:`sm`,onClick:()=>p(!0),"data-tip":r,children:[(0,U.jsx)(n,{"aria-hidden":`true`}),t]})});let w=`${t}${l?`-${l}`:``}`.toLowerCase().replace(/[^a-z0-9]+/g,`-`);return(0,U.jsxs)(`div`,{className:f(u,`flex max-w-[640px] flex-col gap-2`),children:[s,(0,U.jsx)(`label`,{htmlFor:`${w}-reason`,className:`text-body-sm font-medium text-ink-2`,children:`Why? It is kept with your name and in the audit.`}),(0,U.jsx)(a,{id:`${w}-reason`,value:m,onChange:e=>h(e.target.value),rows:2,maxLength:500}),(0,U.jsxs)(`label`,{htmlFor:`${w}-confirm`,className:`text-body-sm font-medium text-ink-2`,children:[`Type `,W(e),` to confirm`]}),(0,U.jsx)(o,{id:`${w}-confirm`,value:g,onChange:e=>_(e.target.value),autoComplete:`off`}),ee&&(0,U.jsx)(V,{text:ee}),(0,U.jsxs)(`span`,{className:`flex gap-2`,children:[(0,U.jsxs)(b,{busy:v,size:`sm`,disabled:!S||v,onClick:C,"data-tip":r,children:[(0,U.jsx)(n,{"aria-hidden":`true`}),v?`Keeping…`:t]}),(0,U.jsxs)(b,{size:`sm`,variant:`outline`,onClick:()=>p(!1),children:[(0,U.jsx)(k,{"aria-hidden":`true`}),`Cancel`]})]})]})}function Tt(e){return(0,U.jsxs)(U.Fragment,{children:[e.slice(0,8).map((e,t)=>(0,U.jsxs)(`span`,{children:[t?`, `:``,(0,U.jsx)(`a`,{href:r(`evidence-runs`,encodeURIComponent(e)),className:`font-mono`,children:e})]},e)),e.length>8?`, and ${e.length-8} more`:``]})}function Et({sub:e}){let t=e?n(e):``,[a,o]=(0,H.useState)(null),[s,c]=(0,H.useState)(``),[l,u]=(0,H.useState)(0),[p,m]=(0,H.useState)(`observe`),g=()=>u(e=>e+1);(0,H.useEffect)(()=>{c(``),h.monitor(t||void 0).then(o,e=>c(e.message))},[t,l]);let _=async()=>{try{let e=await h.audit(t),n=URL.createObjectURL(new Blob([`${JSON.stringify(e,null,2)}\n`],{type:`application/json`})),r=document.createElement(`a`);r.href=n,r.download=`${t.replace(/[^A-Za-z0-9_.-]+/g,`-`).replace(/^[-.]+/,``).slice(0,60)||`agent`}.audit.json`,r.click(),URL.revokeObjectURL(n)}catch(e){c(e.message)}},y=a?.agent;return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(X,{id:`evidence-monitor`,children:`Monitor`}),(0,U.jsx)(I,{more:(0,U.jsxs)(U.Fragment,{children:[`For each agent evaluated: what changed since its baseline (a model, a tool, the documents it reads, a check doing worse, its contract or judge), how much autonomy its evidence supports and what a person granted it, and every decision people made about it, to export. The nightly job is `,(0,U.jsx)(`code`,{children:`forgeqe evidence drift --all`}),`.`]}),children:`Watch what changes in each agent, and how much it can be trusted to do alone.`}),s&&(0,U.jsx)(V,{text:s}),!a&&!s&&(0,U.jsx)(Z,{}),a?.problems.map(e=>(0,U.jsx)(V,{text:e},e)),a&&!a.inventory.length&&(0,U.jsx)(Ve,{}),a&&a.inventory.length>0&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`h2`,{className:`sr-only`,children:`Agents and their governance`}),(0,U.jsxs)(B,{id:`inventory`,title:`Inventory`,icon:ce,n:a.inventory.length,children:[(0,U.jsx)(z,{label:`Agents evaluated`,search:!1,minWidth:760,head:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,children:`Agent`}),(0,U.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,children:`Versions`}),(0,U.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,children:`Models`}),(0,U.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-right text-label-md font-medium whitespace-nowrap text-muted`,children:`Tools`}),(0,U.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,children:`Contract`}),(0,U.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,children:`Trust`}),(0,U.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-right text-label-md font-medium whitespace-nowrap text-muted`,children:`Alerts`})]}),children:a.inventory.map(e=>(0,U.jsxs)(`tr`,{className:`h-12 border-t border-line-soft align-middle transition-colors duration-150 data-[state=selected]:bg-tint-hover`,children:[(0,U.jsx)(`th`,{scope:`row`,className:f(`px-4 py-2`,`text-left font-medium`),children:(0,U.jsx)(`a`,{href:r(`evidence-monitor`,encodeURIComponent(e.agent)),"aria-current":e.agent===t?`page`:void 0,children:W(e.agent)})}),(0,U.jsx)(`td`,{className:f(`px-4 py-2`,`text-muted`),children:e.versions.slice(0,3).map(W).join(`, `)||`none named`}),(0,U.jsx)(`td`,{className:f(`px-4 py-2`,`text-muted [overflow-wrap:anywhere]`),children:e.models.slice(0,3).map(W).join(`, `)||`none named`}),(0,U.jsx)(`td`,{className:`px-4 py-2 text-right whitespace-nowrap tabular-nums`,children:e.tools.length}),(0,U.jsx)(`td`,{className:f(`px-4 py-2`,`text-muted`),children:e.contract?e.contract.approved?`Approved`:`Not approved`:`None`}),(0,U.jsx)(`td`,{className:`px-4 py-2`,children:e.granted?`${$[e.granted]} (supports ${$[e.supported].toLowerCase()})`:`Not granted (supports ${$[e.supported].toLowerCase()})`}),(0,U.jsx)(`td`,{className:f(`px-4 py-2 text-right whitespace-nowrap tabular-nums`,e.alerts>0&&`text-fail`),"data-sort":e.baseline||e.alerts?e.alerts:-1,children:e.baseline||e.alerts?e.alerts:(0,U.jsx)(`span`,{className:`text-muted`,children:`no baseline`})})]},e.agent))}),!t&&(0,U.jsx)(`p`,{className:`m-0 text-body-sm text-muted`,children:`Open an agent to see its drift, its trust and its audit.`})]}),y&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(B,{id:`drift`,title:`Drift of ${y.name}`,icon:M,n:y.drift.alerts.length,children:[y.drift.baseline?(0,U.jsxs)(`p`,{className:`m-0 text-body-sm text-muted`,children:[`Since its baseline (`,y.drift.baseline.version?W(y.drift.baseline.version):`no version`,`, `,d(y.drift.baseline.runs,`run`),`, set by `,W(y.drift.baseline.by),` `,G(y.drift.baseline.at),`): `,d(y.drift.since.length,`run`),`.`]}):(0,U.jsx)(`p`,{className:`m-0 text-body-sm text-muted`,children:`No baseline is set: what changed cannot be said. Set one when a version is released.`}),y.drift.alerts.length>0&&(0,U.jsx)(`ul`,{"aria-label":`Drift alerts`,className:f(`surface rounded-lg bg-bg p-6 shadow-sm`,`m-0 list-none`),children:y.drift.alerts.map(e=>(0,U.jsxs)(`li`,{className:`flex flex-col gap-1 border-b border-line-soft px-4 py-2 last:border-b-0`,children:[(0,U.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-4 gap-y-1`,children:[(0,U.jsx)(C,{tone:`warn`,children:St[e.kind]}),(0,U.jsx)(`span`,{className:`text-body-sm [overflow-wrap:anywhere]`,children:W(e.what)})]}),e.runs.length>0&&(0,U.jsxs)(`span`,{className:`text-body-sm text-muted [overflow-wrap:anywhere]`,children:[`In `,Tt(e.runs)]})]},`${e.kind}-${e.subject}`))}),y.drift.baseline&&!y.drift.alerts.length&&(0,U.jsx)(R,{className:`py-4`,children:`Nothing changed since the baseline.`}),(0,U.jsx)(wt,{agent:y.name,label:`Set baseline`,icon:ge,tip:y.drift.baseline?`Set a new baseline`:`Set the baseline`,action:(e,t)=>h.baseline(y.name,e,t),onDone:g,children:(0,U.jsx)(`span`,{className:`text-body-sm text-ink-2`,children:`The baseline becomes its latest version's runs as they are judged now: their models, tools, documents and each check's pass rate.`})})]}),(0,U.jsxs)(B,{id:`trust`,title:`Trust in ${y.name}`,icon:ue,children:[(0,U.jsxs)(`p`,{className:`m-0 text-body-sm`,children:[`Its evidence supports `,(0,U.jsx)(`b`,{children:$[y.trust.supported]}),`: `,xt[y.trust.supported],`.`,` `,y.trust.granted?(0,U.jsxs)(U.Fragment,{children:[`Granted: `,(0,U.jsx)(`b`,{children:$[y.trust.granted.level]}),`, by `,W(y.trust.granted.by),` `,G(y.trust.granted.at),`: `,W(y.trust.granted.reason)]}):`No level is granted.`]}),(0,U.jsx)(`ul`,{"aria-label":`What each level needs`,className:f(`surface rounded-lg bg-bg p-6 shadow-sm`,`m-0 list-none`),children:y.trust.criteria.filter(e=>e.level!==`observe`).map(e=>(0,U.jsxs)(`li`,{className:`flex items-start gap-2 border-b border-line-soft px-4 py-2 text-body-sm last:border-b-0`,children:[(0,U.jsx)(v,{icon:e.met?j:be,size:15,className:e.met?`mt-1 text-pass`:`mt-1 text-muted`}),(0,U.jsx)(`span`,{className:`w-[96px] shrink-0 font-medium`,children:$[e.level]}),(0,U.jsxs)(`span`,{className:`text-ink-2 [overflow-wrap:anywhere]`,children:[(0,U.jsx)(`span`,{className:`sr-only`,children:e.met?`Met: `:`Not met: `}),W(e.what)]})]},`${e.level}-${e.what}`))}),(0,U.jsx)(wt,{agent:y.name,label:`Grant`,icon:j,tip:`Grant a trust level`,action:(e,t)=>h.trust(y.name,p,e,t),onDone:g,children:(0,U.jsxs)(`label`,{className:`flex w-fit items-center gap-2 text-body-sm font-medium text-ink-2`,children:[`Level`,(0,U.jsx)(i,{value:p,onChange:e=>m(e.target.value),children:Ct.slice(0,Ct.indexOf(y.trust.supported)+1).map(e=>(0,U.jsxs)(`option`,{value:e,children:[$[e],`: `,xt[e]]},e))})]})})]}),(0,U.jsxs)(B,{id:`audit`,title:`Audit`,icon:ve,children:[(0,U.jsxs)(`p`,{className:`m-0 text-body-sm text-muted`,children:[`Every decision people made about `,W(y.name),` (its contract's approval, overrules, grades, replays, proposals, release gates, baselines and trust), each with who made it, when, why, and the runs it rested on as they are recorded now.`]}),(0,U.jsx)(`span`,{children:(0,U.jsxs)(b,{size:`sm`,onClick:_,"data-tip":`Download the audit`,children:[(0,U.jsx)(de,{"aria-hidden":`true`}),`Download`]})})]})]})]})]})}function Dt({page:e,sub:t}){let r=(t||``).split(`/`),i=r[0]===`agent`&&r[1]?n(r[1]):``,a=e===`evidence-runs`&&r[0]&&r[0]!==`agent`?n(r[0]):``;return(0,U.jsxs)(`div`,{className:`flex min-h-(--screen) flex-col`,children:[(0,U.jsx)(we,{}),(0,U.jsx)(`main`,{className:f(De,`@container flex-auto gap-4`),children:e===`evidence`?t?(0,U.jsx)(Je,{agent:n(t)},t):(0,U.jsx)(We,{}):e===`evidence-contracts`?(0,U.jsx)(mt,{}):e===`evidence-review`?(0,U.jsx)(rt,{}):e===`evidence-releases`?(0,U.jsx)(ft,{}):e===`evidence-learn`?(0,U.jsx)(bt,{sub:t}):e===`evidence-monitor`?(0,U.jsx)(Et,{sub:t},t||``):a?(0,U.jsx)($e,{id:a},a):(0,U.jsx)(Ye,{agent:i})})]})}export{Dt as Evidence};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{t}from"./react-BDur5s0O.js";import{r as n}from"./route-9BkoTWUE.js";import{I as r,c as i}from"./surface-c1kG1KPS.js";import{n as a,t as o}from"./utils-DJRAScIl.js";import{t as s}from"./jsx-runtime-LKYXHABd.js";import{I as c}from"./palette-BEo5X3wD.js";import{A as l,b as u}from"./api-BJHzfOse.js";import{I as d,O as f,P as p,a as m,g as h,k as g,n as _}from"./pageBack-BKHdI-pD.js";import{B as v,Cn as y,Ct as b,Dn as x,E as S,G as C,Gn as w,Gr as T,I as E,Lt as D,Nt as O,P as k,R as A,Rt as j,k as M,l as N,nr as P,or as F,tr as I,tt as L,vn as R,zn as z}from"./line-icons-Cwj9OmCz.js";import{t as B}from"./collapse-C0q3vXUR.js";import{Et as V,Fn as H,J as U,L as W,Tt as G,Xt as K,Zt as q,kt as J,pn as Y}from"./index-DZMkBMxL.js";var X=e(t(),1),Z=s(),ee={API:z,"Automated tests":C,Browser:j,Data:L,Desktop:y,Mobile:F,Operations:I,"Pull requests":D,Quality:O,Release:w,Setup:P,Systems:x,"Test cases":v},Q={ready:{label:`Ready`,tone:`pass`,icon:N,color:`text-pass`},partial:{label:`Partly set up`,tone:`warn`,icon:E,color:`text-warn`},needs_setup:{label:`Needs setup`,tone:`neutral`,icon:k,color:`text-muted`}},te={models:`Models`,integrations:`Integrations`,monitor:`Monitor`,notifications:`Notifications`,agents:`Agents`,environments:`Environments`,containers:`Containers`,databases:`Databases`},$=4;async function ne(e,t){try{let{id:t}=await u.start(e,{});location.hash=n(`chats`,t)}catch(e){t(e.message)}}function re({f:e,onScope:t,busy:s}){let[c,u]=(0,X.useState)(null),[d,f]=(0,X.useState)(``),[h,g]=(0,X.useState)(``);(0,X.useEffect)(()=>{l.detail(e.id).then(u,e=>f(e.message))},[e.id]);let _=e.gaps.filter(e=>!e.optional),v=e.gaps.filter(e=>e.optional);return(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4 py-4`,children:[(0,Z.jsx)(`p`,{className:`m-0 text-body-sm text-ink-2`,children:e.summary}),[[_,`Needs`],[v,`Would do more with`]].map(([e,t])=>e.length?(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)(`span`,{className:`text-body-sm font-medium`,children:t}),(0,Z.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-2 p-0`,children:e.map((e,r)=>(0,Z.jsxs)(`li`,{className:o(i,`flex flex-col gap-1 text-body-sm`),children:[(0,Z.jsx)(`span`,{className:o(t===`Needs`?`text-ink`:`text-ink-2`),children:e.missing}),(0,Z.jsx)(`span`,{className:`text-body-sm text-muted`,children:e.fix}),e.settings&&(0,Z.jsxs)(`a`,{href:n(`settings`,e.settings),className:`inline-flex items-center gap-1 self-start text-body-sm font-medium`,children:[(0,Z.jsx)(P,{size:13,"aria-hidden":`true`}),`Set it up in Settings, `,te[e.settings]||e.settings]})]},r))})]},t):null),e.inputs.length>0&&(0,Z.jsxs)(`p`,{className:`m-0 text-body-sm text-ink-2`,children:[`From your request: `,e.inputs.join(`; `),`.`]}),d&&(0,Z.jsx)(`p`,{className:`m-0 text-body-sm text-fail`,children:d}),c&&(0,Z.jsxs)(Z.Fragment,{children:[c.examples.length>0&&(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)(`span`,{className:`text-body-sm font-medium`,children:`Ask for it like this`}),(0,Z.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:c.examples.slice(0,4).map(t=>(0,Z.jsxs)(p,{size:`sm`,disabled:e.state===`needs_setup`,"data-tip":e.state===`needs_setup`?`Set it up first`:`Start a chat with this request`,onClick:()=>void ne(t,g),className:`h-auto min-h-8 max-w-full py-2 text-left whitespace-normal`,children:[(0,Z.jsx)(R,{"aria-hidden":`true`}),t]},t))}),h&&(0,Z.jsx)(`span`,{className:`text-body-sm text-fail`,children:h})]}),c.limits.length>0&&(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Z.jsx)(`span`,{className:`text-body-sm font-medium`,children:`What it does not do`}),(0,Z.jsx)(`ul`,{className:`m-0 list-disc pl-6 text-body-sm text-ink-2`,children:c.limits.map(e=>(0,Z.jsx)(`li`,{children:e},e))})]}),c.docs.length>0&&(0,Z.jsxs)(`details`,{children:[(0,Z.jsxs)(`summary`,{className:`cursor-pointer text-body-sm font-medium`,children:[`How it works (`,a(c.docs.length,`section`),`)`]}),(0,Z.jsx)(`div`,{className:`mt-2 flex flex-col gap-4`,children:c.docs.map(e=>(0,Z.jsxs)(`section`,{className:`surface rounded-lg bg-bg p-6 shadow-sm`,children:[(0,Z.jsx)(`h4`,{className:`m-0 mb-1 text-body-sm font-medium`,children:e.heading}),(0,Z.jsx)(m,{text:e.text,className:`text-body-sm`})]},e.heading))})]}),(0,Z.jsxs)(`span`,{className:`font-mono text-body-sm text-muted [overflow-wrap:anywhere]`,children:[`Tools: `,c.tools.join(`, `)]})]}),(0,Z.jsxs)(`label`,{className:`flex flex-wrap items-center gap-4 pt-4 text-body-sm`,children:[(0,Z.jsxs)(`span`,{className:`flex-[1_1_240px]`,children:[`The agent gets its tools`,(0,Z.jsx)(`span`,{className:`block text-body-sm text-muted`,children:`agent.capabilities in forgeqe.yaml`})]}),(0,Z.jsxs)(r,{value:e.scope,disabled:s,onChange:e=>t(e.target.value),className:`w-[240px]`,children:[(0,Z.jsx)(`option`,{value:`auto`,children:`When a request is about it`}),(0,Z.jsx)(`option`,{value:`always`,children:`Always`}),(0,Z.jsx)(`option`,{value:`off`,children:`Never, in this project`})]})]})]})}function ie({embedded:e=!1}={}){let[t,n]=(0,X.useState)(null),[r,i]=(0,X.useState)(``),[a,s]=(0,X.useState)(``),[u,m]=(0,X.useState)(`all`),[v,y]=(0,X.useState)(``),[x,C]=(0,X.useState)(!1),[w,E]=(0,X.useState)([]),[D,O]=(0,X.useState)(!1),k=(0,X.useCallback)(()=>l.view().then(n,e=>i(e.message)),[]);(0,X.useEffect)(()=>void k(),[k]);let j=(0,X.useMemo)(()=>{let e=v.toLowerCase().split(/\s+/).filter(Boolean);return(t?.areas||[]).map(t=>({...t,features:t.features.filter(n=>(u===`all`||(u===`ready`?n.state!==`needs_setup`:n.state!==`ready`))&&e.every(e=>`${n.title} ${n.summary} ${t.area}`.toLowerCase().includes(e)))})).filter(e=>e.features.length)},[t,u,v]),N=async(e,t)=>{C(!0);try{n(await l.scope(e,t)),i(``)}catch(e){i(e.message)}finally{C(!1)}},P=t?.counts,F=t?.areas.flatMap(e=>e.features).find(e=>e.id===a),I=(0,Z.jsxs)(Z.Fragment,{children:[r&&(0,Z.jsx)(`p`,{role:`alert`,className:o(d.fail,`m-0`),children:r}),!t&&!r&&(0,Z.jsx)(h,{shape:`cards`,count:6}),t&&P&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(V,{label:`Features`,children:[(0,Z.jsx)(G,{icon:Q.ready.icon,label:`Ready`,value:String(P.ready)}),(0,Z.jsx)(G,{icon:Q.partial.icon,label:`Partly set up`,value:String(P.partial)}),(0,Z.jsx)(G,{icon:Q.needs_setup.icon,label:`Need setup`,value:String(P.needs_setup)})]}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(J,{label:`Show`,value:u,onChange:m,options:[{id:`all`,label:`All`},{id:`needs`,label:`Needs setup`},{id:`ready`,label:`Ready`}]}),(0,Z.jsx)(f,{id:`find-a-feature`,label:`Find a feature`,value:v,onChange:y})]}),j.length===0&&(0,Z.jsx)(`p`,{className:`m-0 text-body-sm text-muted`,children:`Nothing matches.`}),(0,Z.jsx)(`div`,{className:`@container`,children:(0,Z.jsx)(`div`,{className:`grid auto-rows-fr grid-cols-1 items-stretch gap-4 @2xl:grid-cols-2 @5xl:grid-cols-3`,children:j.map((e,t)=>{let n=u!==`all`||v.trim()!==``||w.includes(e.area),r=n?e.features:e.features.slice(0,$),i=e.features.length-$,a=`area-list-${t}`;return(0,Z.jsxs)(`section`,{"aria-labelledby":`area-${t}`,className:o(`surface rounded-lg bg-bg p-6 shadow-sm`,`@container/col flex min-w-0 flex-col`),children:[(0,Z.jsx)(q,{id:`area-${t}`,icon:ee[e.area]||b,title:e.area,n:e.features.length,className:`px-2 pt-2 pb-4`}),(0,Z.jsx)(`ul`,{id:a,className:`m-0 flex list-none flex-col gap-1 p-0`,children:r.map(e=>{let t=Q[e.state];return(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>s(e.id),className:o(`flex w-full min-h-11 cursor-pointer items-center gap-4 rounded-base border-0 bg-transparent px-4 py-2 text-left text-body-sm text-ink no-underline transition-colors duration-150 hover:bg-tint hover:text-ink aria-[current]:bg-tint-hover aria-selected:bg-tint-hover aria-pressed:bg-tint-hover aria-checked:bg-tint-hover has-[:checked]:bg-tint-hover disabled:cursor-not-allowed disabled:opacity-50`,`gap-2`),children:[(0,Z.jsx)(t.icon,{size:16,"aria-hidden":`true`,className:o(`flex-none`,t.color)}),(0,Z.jsx)(`span`,{className:`min-w-0 flex-1`,children:e.title}),(0,Z.jsxs)(`span`,{className:`sr-only`,children:[`, `,t.label]}),e.scope!==`auto`&&(0,Z.jsx)(`span`,{className:`flex-none text-body-sm text-muted`,children:e.scope===`always`?`Always given`:`Off here`}),(0,Z.jsx)(`span`,{className:`flex-none text-body-sm font-medium text-accent`,children:`More`})]})},e.id)})}),i>0&&u===`all`&&!v.trim()&&(0,Z.jsxs)(p,{variant:`ghost`,size:`sm`,"aria-expanded":n,"aria-controls":a,onClick:()=>E(n?w.filter(t=>t!==e.area):[...w,e.area]),"data-tip":n?`Fewer features`:`More features (${i})`,className:`mt-auto w-full justify-center gap-2 text-muted`,children:[n?(0,Z.jsx)(M,{"aria-hidden":`true`}):(0,Z.jsx)(S,{"aria-hidden":`true`}),n?`Less`:`More (${i})`]})]},e.area)})})}),(0,Z.jsx)(H,{open:!!F,wide:!0,onClose:()=>s(``),title:F?.title||``,description:F&&(0,Z.jsx)(g,{tone:Q[F.state].tone,icon:F.state!==`needs_setup`,children:Q[F.state].label}),footer:(0,Z.jsxs)(p,{onClick:()=>s(``),children:[(0,Z.jsx)(T,{"aria-hidden":`true`}),`Close`]}),children:F&&(0,Z.jsx)(re,{f:F,busy:x,onScope:e=>void N(F.id,e)})}),t.outOfScope.length>0&&(0,Z.jsx)(K,{icon:A,title:`Not what ForgeQE does`,n:t.outOfScope.length,actions:(0,Z.jsxs)(p,{size:`sm`,variant:`ghost`,"aria-expanded":D,"aria-controls":`out-of-scope`,onClick:()=>O(!D),children:[D?(0,Z.jsx)(M,{"aria-hidden":`true`}):(0,Z.jsx)(S,{"aria-hidden":`true`}),D?`Hide`:`Show`]}),children:(0,Z.jsx)(B,{open:D,id:`out-of-scope`,children:(0,Z.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0 text-body-sm`,children:t.outOfScope.map(e=>(0,Z.jsxs)(`li`,{children:[e.what,e.instead?(0,Z.jsxs)(`span`,{className:`text-muted`,children:[`; instead: `,e.instead]}):null]},e.what))})})})]})]});return e?(0,Z.jsx)(`div`,{className:`flex flex-col gap-6`,children:I}):(0,Z.jsxs)(`div`,{className:`flex min-h-(--screen) flex-col`,children:[(0,Z.jsx)(U,{}),(0,Z.jsxs)(`main`,{className:o(W,`flex-auto gap-6`),children:[(0,Z.jsx)(_,{}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4`,children:[(0,Z.jsx)(Y,{pixel:c.features,size:`lg`,head:!0}),(0,Z.jsx)(`h1`,{className:`m-0 flex-1 text-headline-md`,children:`What's ready`})]}),(0,Z.jsx)(`p`,{className:`m-0 text-body-sm leading-relaxed text-ink-2`,children:`What ForgeQE can do here. Pick one to see what it needs.`}),I]})]})}export{ie as Features};
|