@capagents/forgeqe 2.4.1 → 2.4.3

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.
Files changed (52) hide show
  1. package/HOW_TO_USE.md +30 -2
  2. package/dist/forgeqe.js +886 -886
  3. package/dist/template.html +68 -68
  4. package/dist/web/assets/ApiTests-COjGUsDY.js +2 -0
  5. package/dist/web/assets/Chat-CyqRSXc8.js +3 -0
  6. package/dist/web/assets/Data-BJgavRbu.js +4 -0
  7. package/dist/web/assets/Features-Bm_SBs_c.js +1 -0
  8. package/dist/web/assets/Jobs-Ck0OWWJG.js +3 -0
  9. package/dist/web/assets/Quality-pkuA-YCK.js +1 -0
  10. package/dist/web/assets/Record-BD41jna_.js +1 -0
  11. package/dist/web/assets/Regression-BFlO7ftm.js +2 -0
  12. package/dist/web/assets/Reports-BQn91ihX.js +2 -0
  13. package/dist/web/assets/Response-BJL6h7CC.js +8 -0
  14. package/dist/web/assets/Runs-DByThGHX.js +2 -0
  15. package/dist/web/assets/chevron-right-BQ4RpZ7j.js +1 -0
  16. package/dist/web/assets/circle-dashed-CTDl-0Bc.js +1 -0
  17. package/dist/web/assets/external-link-BkCWQrcv.js +1 -0
  18. package/dist/web/assets/file-chart-column-increasing-Drhj-0iV.js +1 -0
  19. package/dist/web/assets/filters-XcHKtoNp.js +1 -0
  20. package/dist/web/assets/index-857AKuh_.css +2 -0
  21. package/dist/web/assets/index-CC1NKA4m.js +26 -0
  22. package/dist/web/assets/{markdown-B1Rz6VFK.js → markdown-O59qSrAj.js} +5 -5
  23. package/dist/web/assets/rotate-ccw-Boqlo07S.js +1 -0
  24. package/dist/web/assets/sticky-note-CwLqIORS.js +1 -0
  25. package/dist/web/assets/terminal-BwCjxg-g.js +1 -0
  26. package/dist/web/assets/trash-CsMADECv.js +1 -0
  27. package/dist/web/assets/trending-up-DWCiNSD1.js +1 -0
  28. package/dist/web/index.html +2 -3
  29. package/docs/WEB_APP.md +141 -0
  30. package/docs/user-guide.html +22 -2
  31. package/package.json +1 -1
  32. package/dist/web/assets/ApiTests-CoFraMwL.js +0 -2
  33. package/dist/web/assets/Chat-BRCv-waj.js +0 -3
  34. package/dist/web/assets/Data-C-xQyf3P.js +0 -4
  35. package/dist/web/assets/Features-VtoyECeO.js +0 -1
  36. package/dist/web/assets/Jobs-8t_bMM0e.js +0 -3
  37. package/dist/web/assets/Quality-DS_r7p5G.js +0 -1
  38. package/dist/web/assets/Record-uvTYm_xC.js +0 -1
  39. package/dist/web/assets/Regression-C09uOUEu.js +0 -2
  40. package/dist/web/assets/Reports-CZTOMDhT.js +0 -3
  41. package/dist/web/assets/Response-CgGBxdB7.js +0 -8
  42. package/dist/web/assets/Runs-B29dpes6.js +0 -2
  43. package/dist/web/assets/circle-dashed-zjN_W6rR.js +0 -1
  44. package/dist/web/assets/external-link-D2pA4PJ0.js +0 -1
  45. package/dist/web/assets/file-chart-column-increasing-FSDL2nUM.js +0 -1
  46. package/dist/web/assets/index-CJr3aeU5.css +0 -2
  47. package/dist/web/assets/index-DuYynJ55.js +0 -24
  48. package/dist/web/assets/rotate-ccw-dA-H7K_B.js +0 -1
  49. package/dist/web/assets/status-xNQO8J6U.js +0 -3
  50. package/dist/web/assets/sticky-note-BuQrlbjE.js +0 -1
  51. package/dist/web/assets/terminal-ib42D5b6.js +0 -1
  52. package/dist/web/assets/trash-540pMBsR.js +0 -1
@@ -0,0 +1 @@
1
+ import{zt as e}from"./index-CC1NKA4m.js";var t={name:`rotate-ccw`,size:24,node:[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]};t.node;var n=e(t);export{n as t};
@@ -0,0 +1 @@
1
+ import{zt as e}from"./index-CC1NKA4m.js";var t={name:`sticky-note`,size:24,node:[[`path`,{d:`M21 9a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 15 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2z`,key:`1dfntj`}],[`path`,{d:`M15 3v5a1 1 0 0 0 1 1h5`,key:`6s6qgf`}]]};t.node;var n=e(t);export{n as t};
@@ -0,0 +1 @@
1
+ import{zt as e}from"./index-CC1NKA4m.js";var t={name:`terminal`,size:24,node:[[`path`,{d:`M12 19h8`,key:`baeox8`}],[`path`,{d:`m4 17 6-6-6-6`,key:`1yngyt`}]]};t.node;var n=e(t);export{n as t};
@@ -0,0 +1 @@
1
+ import{zt as e}from"./index-CC1NKA4m.js";var t={name:`trash`,size:24,node:[[`path`,{d:`M10 11v6`,key:`nco0om`}],[`path`,{d:`M14 11v6`,key:`outv1u`}],[`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`,key:`miytrc`}],[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`,key:`e791ji`}]],aliases:[`trash-2`]};t.node;var n=e(t);export{n as t};
@@ -0,0 +1 @@
1
+ import{zt as e}from"./index-CC1NKA4m.js";var t={name:`trending-down`,size:24,node:[[`path`,{d:`M16 17h6v-6`,key:`t6n2it`}],[`path`,{d:`m22 17-8.5-8.5-5 5L2 7`,key:`x473p`}]]};t.node;var n=e(t),r={name:`trending-up`,size:24,node:[[`path`,{d:`M16 7h6v6`,key:`box55l`}],[`path`,{d:`m22 7-8.5 8.5-5-5L2 17`,key:`1t1m79`}]]};r.node;var i=e(r);export{n,i as t};
@@ -5,9 +5,8 @@
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
6
  <meta name="referrer" content="no-referrer" />
7
7
  <title>ForgeQE</title>
8
- <script type="module" crossorigin src="/assets/index-DuYynJ55.js"></script>
9
- <link rel="modulepreload" crossorigin href="/assets/status-xNQO8J6U.js">
10
- <link rel="stylesheet" crossorigin href="/assets/index-CJr3aeU5.css">
8
+ <script type="module" crossorigin src="/assets/index-CC1NKA4m.js"></script>
9
+ <link rel="stylesheet" crossorigin href="/assets/index-857AKuh_.css">
11
10
  </head>
12
11
  <body>
13
12
  <div id="root"></div>
@@ -0,0 +1,141 @@
1
+ # The web app
2
+
3
+ `forgeqe web` opens ForgeQE in your browser: the same agents as the shell, with a chat on Home, pages for recordings,
4
+ runs, reports, API tests, quality, data, regression packs and schedules, and every setting as a form. It runs on your
5
+ computer only and works on one project folder at a time, as the CLI works in the folder it is started in.
6
+
7
+ ## Starting it
8
+
9
+ ```sh
10
+ npm install -g @capagents/forgeqe # once
11
+ forgeqe web # in a project folder, or anywhere
12
+ ```
13
+
14
+ It prints an address such as `http://127.0.0.1:53817/#token=…`. Open it. The page keeps the token for that browser tab
15
+ only; another tab, or the page after the token is gone, says it is signed out: open the printed address again. Ctrl+C
16
+ in the terminal stops it.
17
+
18
+ | Option | What it does |
19
+ |---|---|
20
+ | `--port N` | A fixed port instead of a free one, for a bookmark or when a port is taken. |
21
+ | `--config forgeqe.yaml` | Work on the folder of that file. |
22
+
23
+ ## The first time: Set up
24
+
25
+ The first page is **Settings › Set up**, in four steps. Until the folder has a `forgeqe.yaml`, the other sections of
26
+ Settings are locked.
27
+
28
+ 1. **Project folder.** The folder ForgeQE works on: browse to it, type its path, or make a new folder. It can be a clone
29
+ of your test repository (tests written from passed runs go there), a clone of the application, or an empty folder to
30
+ try ForgeQE in. ForgeQE does not clone repositories: clone with git first, then pick the folder.
31
+ 2. **ForgeQE in this folder.** The same as `forgeqe init`: `forgeqe.yaml`, `llms.json`, the environment files and a
32
+ `.forgeqe` folder with prompts, skills and guardrails to change. Files already there are kept, and
33
+ `.forgeqe/reports/` is added to `.gitignore`.
34
+ 3. **This computer.** What ForgeQE runs with (the browser engine and the agent runtime), with **Install what's
35
+ missing**, which runs `forgeqe setup` and shows its output.
36
+ 4. **A model.** At least one model with its key or sign-in, under **Models**.
37
+
38
+ Next time, `forgeqe web` opens the folder it is started in when ForgeQE is set up there, else the last project opened
39
+ (it keeps the last ten).
40
+
41
+ **For a team.** One person sets ForgeQE up in the shared test repository and commits what it made: `forgeqe.yaml`, the
42
+ environment files, `llms.json`, and the team's guardrails, prompts and skills under `.forgeqe/`. Everyone else clones
43
+ the repository, runs `forgeqe web` in it, and adds their own keys in Settings. Keys and passwords never go in those
44
+ files: each person's are in their own credential store.
45
+
46
+ ## The layout
47
+
48
+ - **The sidebar, on the left.** New chat; **Work**: Home, Record, Regression, API tests, Quality, Data, Runs, Reports,
49
+ Jobs; **Agents**: Knowledge, Memory, Guardrails, Skills, Prompts, What's ready; the recent chats with All chats; Help
50
+ (the user guide) and Settings. It closes to give the page the width, and is a drawer on a phone.
51
+ - **The workspace panel, on the right.** The project, its repository and branch, and the test environment; the context
52
+ and tokens of the chat and of the project, in your local currency (pounds in the UK, from the European Central Bank's
53
+ daily rates); the background tasks running now; the files a chat changed, with **Create pull request**; and what it
54
+ produced (reports, tests, recordings). It closes too, and opens over the page on a narrower screen.
55
+
56
+ ## Home and a chat
57
+
58
+ Home is one box: say what to test, in your words. Under it, suggestions (Run test cases, Explore a journey, Write a
59
+ test, Review requirements) fill the box with an example; they do not send.
60
+
61
+ In the box:
62
+
63
+ - **Tools**: whether this chat writes the test into the repository and shows the browser, and what comes from the
64
+ settings (where browsers run, where test cases come from). They can be changed in a chat that has started.
65
+ - **The model**: Auto routing, or one of your models.
66
+ - **Attach**: files for the agent to read.
67
+ - **Refine**: rewrites your request precisely against what ForgeQE knows here, in the same box, without running
68
+ anything; Undo puts your words back.
69
+
70
+ A reply shows the work as it happens:
71
+
72
+ - **The plan** as a chain: what is done (a tick), what is being worked on now, and what is next.
73
+ - **The agents**: each step under the agent doing it (ForgeQE's agent, the browser agent, Scribe), and each handoff
74
+ from one to another.
75
+ - **The latest activity**, live, with the full log a click away.
76
+ - **The result**: each test with its status, file and the command to run it; reports as links; every file changed with
77
+ its diff.
78
+ - **Next steps** as buttons (run it on another browser, open a pull request, investigate a failure), each a new
79
+ request in the chat.
80
+
81
+ **Stop** ends the work in progress. While the agent works the page follows the latest step; scroll up and it stops
82
+ following, and **Latest activity** takes you back.
83
+
84
+ **All chats** lists every chat since `forgeqe web` started, newest first, grouped by day: Working, Needs you, Your turn
85
+ and Ended as filters, a search, and 50 at a time.
86
+
87
+ ## The pages
88
+
89
+ | Page | What it is for |
90
+ |---|---|
91
+ | **Record** | Do a test's steps yourself in a browser or a Windows app ForgeQE opens; each click, entry and check is recorded. A web recording becomes a test through a chat; a desktop one replays with no model. The recordings, searched and paged. |
92
+ | **Regression** | Regression packs for a release: built from test cases, run, and healed, with their results. |
93
+ | **API tests** | Contract sets from an API description or the calls a browser run saw; scenarios that chain calls. Run them (calls that change data only after you agree), see each call's result, write them as tests. |
94
+ | **Quality** | What each browser run measured: accessibility (WCAG), Core Web Vitals, and visual changes against approved baselines, with **Approve as the new baseline**; and each page's trend. |
95
+ | **Data** | Databases (read-only queries; test data only with a writable database and your confirmation), test data, and data flows. |
96
+ | **Runs** | Every ForgeQE session in the project, from here, a schedule or the terminal: 25 to a page with filters. A run shows its summary, the conversation, its activity, and its details. |
97
+ | **Reports** | Every report ForgeQE wrote, each opening as its HTML report in a new tab; and the project report: every run together, with pass rate by day, what fails most, flaky cases and defects. |
98
+ | **Jobs** | Scheduled and long jobs (the jobs service): their runs, logs and alerts. |
99
+ | **Knowledge** | What the agents know about your product, and adding to it. |
100
+ | **Memory** | What ForgeQE learned from runs that passed, by site: flows replayed without a model, and pages with their elements. Clearing a site's memory asks first. |
101
+ | **Guardrails** | The rules every agent follows. |
102
+ | **Skills** | What the agents know how to do, by the agents that use them; add, edit and remove the project's own. |
103
+ | **Prompts** | The instructions each agent starts from, with the agents that use each; edit one, or add your team's own for chosen agents. |
104
+ | **What's ready** | Each capability, whether it is ready here, and what it still needs. |
105
+
106
+ ### Reports the agent writes
107
+
108
+ Ask for a report in a chat ("a report of all open defects", "release status for all projects") and the agent writes
109
+ one from the results of the calls it made. The report has three pages: **Overview** (the summary, and when the rows
110
+ are work items: how many are open, critical and high, unassigned, how old, untouched for 30 days, the ones that need
111
+ someone now, and charts by project, person, age and week), **the rows** with filters and a CSV export, and
112
+ **Sources**, each call the rows came from. The analytics are worked out from the rows; the model writes none of them.
113
+ See [Reports from the agent](../HOW_TO_USE.md#reports-from-the-agent).
114
+
115
+ ## Settings
116
+
117
+ Settings takes over the window: one menu on the left, with **Back to ForgeQE** and **Search settings** (by name or
118
+ `forgeqe.yaml` key), and the sections under General, AI, Testing, Activity and Advanced. Each setting shows its
119
+ `forgeqe.yaml` key under its help.
120
+
121
+ Changes save themselves. A key or password typed in Settings goes to your credential store under its variable's name,
122
+ never into a settings file, and is never shown again. **Files** shows each settings file as text for what the forms do
123
+ not cover. Every option in `forgeqe.example.yaml` has a field.
124
+
125
+ ## Safe by design
126
+
127
+ - It listens on `127.0.0.1` only, with a random token checked on every call, and refuses requests from other sites.
128
+ - Nothing a page shows is taken as HTML: replies, tickets and reports are drawn as text and links, and a link opens
129
+ only when it is a web or mail address.
130
+ - A file a reply names opens through a short-lived link in its own sandbox, so a report's scripts never reach the app.
131
+ - Commands the pages start are built from fixed lists of what is allowed; anything that changes data, costs model
132
+ calls or posts outside asks first.
133
+
134
+ ## When something is wrong
135
+
136
+ | You see | What to do |
137
+ |---|---|
138
+ | The page says it is signed out | Open the address `forgeqe web` printed again; each tab needs it once. |
139
+ | The port is in use | `forgeqe web --port 4711` (any free port). |
140
+ | Settings sections are locked | Set up ForgeQE in the project folder first (Settings › Set up, step 2). |
141
+ | A chat cannot start | Settings › Set up, steps 3 and 4: install what is missing, and add a model with its key. |
@@ -371,6 +371,7 @@ a:hover{text-decoration-color:var(--guide-accent)}
371
371
  <tbody>
372
372
  <tr><td>This guide</td><td>Setup and how to run</td></tr>
373
373
  <tr><td><a href="../docs/user-guide.html"><code>docs/user-guide.html</code></a></td><td>This guide as one page, with every feature: what it needs, how to ask for it, and its details</td></tr>
374
+ <tr><td><a href="../docs/WEB_APP.md"><code>docs/WEB_APP.md</code></a></td><td>The web app (<code>forgeqe web</code>): setting up, the chat, every page, and Settings</td></tr>
374
375
  <tr><td><a href="../forgeqe-architecture.html"><code>forgeqe-architecture.html</code></a></td><td>Single-view map: subagents, tools, and capabilities</td></tr>
375
376
  <tr><td><a href="../docs/ARCHITECTURE.md"><code>docs/ARCHITECTURE.md</code></a></td><td>Architecture reference: modules, protocols, and loops</td></tr>
376
377
  <tr><td><a href="../README.md"><code>README.md</code></a></td><td>Overview</td></tr>
@@ -455,6 +456,9 @@ forgeqe doctor # checks the engine, the SDK, the agent ru
455
456
  Run SHOP-12 and SHOP-14 from Jira, two browsers at once
456
457
  Write a Playwright test for that run in ../app
457
458
  </code></pre>
459
+ <p>Or in your browser, with the same agents, a page for each kind of work, and every setting as a form:</p>
460
+ <pre><code class="language-bash">forgeqe web # prints http://127.0.0.1:…/#token=…: open it, then Settings › Set up
461
+ </code></pre>
458
462
  <p>Without the shell:</p>
459
463
  <pre><code class="language-bash">forgeqe run &quot;Search hotels in Mumbai on booking.com&quot; --plain
460
464
  forgeqe suite cases.yaml --parallel 3 # what pipelines call
@@ -877,6 +881,16 @@ Summary: Show the deployed build in each environment, and why each deployment fa
877
881
  </table></div>
878
882
  <p>In the button prompt, ←/→ or Tab move between buttons, Enter confirms, Esc cancels, and a mouse click works too. <code>esc stop</code> and <code>ctrl+c close</code> in the bar under the prompt are also clickable. <strong>Stop and close</strong> waits until the browser has shut down and the run's files are saved, then closes ForgeQE.</p>
879
883
  </div></section>
884
+ <section class="doc sub" id="doc-how_to_use-the-web-app"><h4>The web app</h4><div class="prose"><p><code>forgeqe web</code> is the shell in your browser: a chat on Home with the plan, each agent's steps and handoffs, the live
885
+ activity, and the results (tests, reports, diffs) as they happen; pages for recording, regression packs, API tests,
886
+ quality, data, runs, reports and schedules; and every setting as a form, with keys kept in your credential store. It
887
+ listens on <code>127.0.0.1</code> only and needs the token in the address it prints.</p>
888
+ <pre><code class="language-bash">forgeqe web # a free port; open the address it prints
889
+ forgeqe web --port 4711 # a fixed port
890
+ </code></pre>
891
+ <p>The first page is Settings › Set up: the project folder (an existing clone, or a new folder), ForgeQE in it (the same
892
+ as <code>forgeqe init</code>), what this computer needs, and a model. See <a href="../docs/WEB_APP.md">docs/WEB_APP.md</a> for every page.</p>
893
+ </div></section>
880
894
  </section>
881
895
  <section class="doc" id="doc-how_to_use-4-without-the-shell">
882
896
  <h3>Without the shell</h3>
@@ -4522,12 +4536,18 @@ forgeqe visual approve --page /home # make this run's /home the baseline (asks
4522
4536
  </ul>
4523
4537
  <p>The report goes to the reports folder (<code>export.out_dir</code>, <code>.forgeqe/reports/</code> by default):</p>
4524
4538
  <pre><code>.forgeqe/reports/open-defects-all-projects-20261013-101512/
4525
- report.html # one file: summary, filters, charts, sortable table, Sources
4539
+ report.html # one file: Overview (summary, analytics, charts), the rows (filters, sortable table), Sources
4526
4540
  report.md # the same, to edit, paste into a wiki, or attach
4527
4541
  open-defects.csv # each dataset's rows
4528
4542
  evidence/E1.json # the raw result of each tool call the report used
4529
4543
  </code></pre>
4530
- <p>The page adds filters for the columns that are in the data (Project, State, Type, Priority, Severity, Assigned To, Area, Iteration, …, and other columns with a short list of values). The counts, the charts (click a bar to filter by it), and the table follow the filters, and <strong>Export CSV</strong> saves the rows you filtered. <strong>Sources</strong> lists each tool call, when it ran, and how many rows it gave, with a link to its raw result.</p>
4544
+ <p>The page has three parts in its menu:</p>
4545
+ <ul>
4546
+ <li><strong>Overview</strong>: the summary, then what the data says. When the rows are work items (defects, bugs, tickets), it works out from them: how many are open, critical and high, unassigned (and how many of those are critical or high), their median and oldest age, and how many had no change in 30 days; <strong>Needs someone now</strong>, the critical and high ones with nobody on them or untouched for 30 days; severity by project, who has them (the same person written &quot;Khan, Javed&quot; or &quot;Javed Khan&quot; counted once), how old they are, how many were opened each week, and the most used tags. Other data gets a count by each of its columns. Click a bar to see its rows.</li>
4547
+ <li><strong>The rows</strong> (named after the data, such as Open defects): filters for the columns that are in the data (Project, State, Type, Priority, Severity, Assigned To, Area, Iteration, …, and other columns with a short list of values), a search, a table sorted by any column, 50 rows at a time, and <strong>Export CSV</strong> for the rows you filtered.</li>
4548
+ <li><strong>Sources</strong>: each tool call, when it ran, and how many rows it gave, with a link to its raw result.</li>
4549
+ </ul>
4550
+ <p>The analytics are arithmetic on the rows, worked out in the page; the model writes none of them.</p>
4531
4551
  <p>The chat gets a short summary and a card with the paths as links, and <strong>Open the report</strong> appears as a next step. To post it, ask for it (&quot;post the report to the release channel&quot;) once <code>notify.channels</code> is set up; the reports folder is linked when it is served (<code>notify.report_url</code>).</p>
4532
4552
  </div>
4533
4553
  </section>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capagents/forgeqe",
3
- "version": "2.4.1",
3
+ "version": "2.4.3",
4
4
  "description": "ForgeQE: a browser agent CLI that runs goals and test cases in local Chrome or Chromium, or BrowserStack and TestMu AI/LambdaTest when configured, and turns passing runs into tests in your repo",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "repository": {
@@ -1,2 +0,0 @@
1
- import{$ as e,I as t,J as n,K as r,Kt as i,L as a,N as o,P as s,Q as c,R as l,Vt as u,Y as d,Z as f,fn as p,it as m,ln as h,nt as g,p as _,pt as v,q as y,qt as b,r as x,t as S}from"./status-xNQO8J6U.js";import"./markdown-B1Rz6VFK.js";import{t as C}from"./file-chart-column-increasing-FSDL2nUM.js";import{A as w,S as T,f as E,p as D}from"./index-DuYynJ55.js";var O={name:`braces`,size:24,node:[[`path`,{d:`M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1`,key:`ezmyqa`}],[`path`,{d:`M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1`,key:`e1hn23`}]],aliases:[`curly-braces`]};O.node;var k=u(O),A={name:`link-2`,size:24,node:[[`path`,{d:`M9 17H7A5 5 0 0 1 7 7h2`,key:`8i5ue5`}],[`path`,{d:`M15 7h2a5 5 0 1 1 0 10h-2`,key:`1b9ql8`}],[`line`,{x1:`8`,x2:`16`,y1:`12`,y2:`12`,key:`1jonct`}]]};A.node;var j=u(A),M=p(h(),1),N=f(),P={passed:`pass`,failed:`fail`,error:`fail`,skipped:`neutral`},F={GET:`text-pass`,POST:`text-accent`,PUT:`text-warn`,PATCH:`text-warn`,DELETE:`text-fail`},I={run:`a browser run's calls`,openapi:`OpenAPI`,swagger:`Swagger`,wsdl:`WSDL`,graphql:`GraphQL`,proto:`.proto`,case:`a test case`,text:`a description`},L=e=>new Date(e).toLocaleString([],{month:`short`,day:`numeric`,hour:`numeric`,minute:`2-digit`}),R=e=>e?e.failed||e.error?`fail`:e.passed?`pass`:`neutral`:`neutral`;function z({job:e,onStop:t}){let n=(0,M.useRef)(null);(0,M.useEffect)(()=>{n.current&&(n.current.scrollTop=n.current.scrollHeight)},[e.lines.length]);let[r,i]={contracts:[`Making contracts`,`Made contracts`],run:[`Running the contracts`,`Ran the contracts`],scenarios:[`Making scenarios`,`Made scenarios`],"run-scenarios":[`Running the scenarios`,`Ran the scenarios`]}[e.kind]??[`Working`,`Done`],a=(e.kind===`run`||e.kind===`run-scenarios`)&&e.exitCode===1;return(0,N.jsxs)(`section`,{"aria-label":e.running?r:i,className:`flex flex-col gap-2 rounded-[14px] border border-line-soft p-4`,children:[(0,N.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,N.jsx)(`span`,{className:`flex-1 font-medium`,children:e.running?r:i}),(0,N.jsx)(S,{orb:e.kind===`contracts`?`handing`:e.kind===`scenarios`?`writing`:`working`,tone:e.running?`running`:e.exitCode===0?`pass`:a?`warn`:`fail`,children:e.running?`Working`:e.exitCode===0?`Done`:a?`Some failed`:`Did not finish`}),e.running&&(0,N.jsxs)(d,{onClick:t,className:`border-fail text-fail hover:bg-fail-soft`,children:[(0,N.jsx)(m,{size:14,fill:`currentColor`,"aria-hidden":`true`}),`Stop`]})]}),(0,N.jsx)(`code`,{className:`font-mono text-[12px] text-muted [overflow-wrap:anywhere]`,children:e.command}),(0,N.jsxs)(`details`,{open:e.running,children:[(0,N.jsxs)(`summary`,{className:`cursor-pointer text-sm text-muted`,children:[`Output (`,e.lines.length,` lines)`]}),(0,N.jsx)(`pre`,{ref:n,className:`mt-2 max-h-[300px] overflow-auto rounded-[10px] bg-surface-muted p-3 font-mono text-[12px] leading-relaxed whitespace-pre-wrap text-ink-2`,children:e.lines.join(`
2
- `)||`Starting…`})]})]})}var B=({m:e})=>(0,N.jsx)(`span`,{className:c(`w-[58px] flex-none font-mono text-[12px] font-semibold`,F[e.toUpperCase()]||`text-ink-2`),children:e.toUpperCase()});function V({c:e,r:t}){let n=Array.isArray(e.expect.status)?e.expect.status.join(` or `):e.expect.status;return(0,N.jsxs)(`li`,{className:`flex flex-col gap-1 border-t border-line-soft py-2 text-sm first:border-t-0`,children:[(0,N.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,N.jsx)(B,{m:e.method}),(0,N.jsx)(`span`,{className:`min-w-0 flex-1 font-mono text-[13px] [overflow-wrap:anywhere]`,children:e.protocol===`rest`?e.path:e.name}),e.writes&&(0,N.jsx)(S,{tone:`warn`,children:`Changes data`}),e.needsData?.length?(0,N.jsxs)(S,{tone:`neutral`,icon:!1,children:[`Needs real `,e.needsData.join(`, `)]}):null,t&&(0,N.jsx)(S,{tone:P[t.status],children:t.status===`skipped`?`Skipped`:t.httpStatus?`${t.httpStatus}`:t.status})]}),(0,N.jsx)(`span`,{className:`pl-[66px] text-[12px] text-muted`,children:[n?`expects ${n}`:``,e.expect.contentType,e.expect.keyFields?.length?`${e.expect.keyFields.length} key field${e.expect.keyFields.length===1?``:`s`}`:``,e.auth?`${e.auth.type} auth`:``].filter(Boolean).join(` · `)}),t&&t.status!==`passed`&&(t.reason||t.checks.some(e=>!e.ok))&&(0,N.jsx)(`span`,{className:c(`pl-[66px] text-[12px] [overflow-wrap:anywhere]`,t.status===`skipped`?`text-muted`:`text-fail`),children:[t.reason,...t.checks.filter(e=>!e.ok).map(e=>`${e.name}${e.detail?`: ${e.detail}`:``}`)].filter(Boolean).join(` · `)})]})}function H({s:e,r:t}){let[n,r]=(0,M.useState)(!1);return(0,N.jsxs)(`li`,{className:`border-t border-line-soft first:border-t-0`,children:[(0,N.jsxs)(`button`,{type:`button`,"aria-expanded":n,onClick:()=>r(!n),className:`flex min-h-[52px] w-full cursor-pointer items-center gap-3 border-0 bg-transparent px-1 py-2 text-left text-ink hover:bg-surface-muted`,children:[(0,N.jsx)(E,{size:16,"aria-hidden":`true`,className:`flex-none text-muted`}),(0,N.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,N.jsx)(`span`,{className:`text-sm [overflow-wrap:anywhere]`,children:e.name}),(0,N.jsxs)(`span`,{className:`truncate text-[12px] text-muted`,children:[e.kind,` · `,e.steps.length,` step`,e.steps.length===1?``:`s`,e.cleanup?.length?` · ${e.cleanup.length} cleanup`:``,e.caseId?` · ${e.caseId}`:``]})]}),e.writes&&(0,N.jsx)(S,{tone:`warn`,children:`Changes data`}),t&&(0,N.jsx)(S,{tone:P[t.status],children:t.status.charAt(0).toUpperCase()+t.status.slice(1)})]}),n&&(0,N.jsxs)(`ol`,{className:`m-0 mb-3 ml-8 flex list-none flex-col gap-1 border-l border-line pl-3 text-sm`,children:[e.steps.map((e,n)=>{let r=t?.steps[n];return(0,N.jsxs)(`li`,{className:`flex flex-col`,children:[(0,N.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,N.jsx)(B,{m:e.method}),(0,N.jsx)(`span`,{className:`min-w-0 flex-1 font-mono text-[12px] [overflow-wrap:anywhere]`,children:e.path}),r&&(0,N.jsx)(S,{tone:P[r.status],children:r.httpStatus?String(r.httpStatus):r.status})]}),(0,N.jsxs)(`span`,{className:`pl-[66px] text-[12px] text-muted`,children:[e.name,e.save&&Object.keys(e.save).length?` · keeps ${Object.keys(e.save).join(`, `)}`:``,e.noAuth?` · without credentials`:``]}),r&&r.checks.some(e=>!e.ok)&&(0,N.jsx)(`span`,{className:`pl-[66px] text-[12px] text-fail`,children:r.checks.filter(e=>!e.ok).map(e=>`${e.name}${e.detail?`: ${e.detail}`:``}`).join(` · `)})]},n)}),e.cleanup?.map((e,t)=>(0,N.jsxs)(`li`,{className:`flex items-center gap-2 text-muted`,children:[(0,N.jsx)(B,{m:e.method}),(0,N.jsx)(`span`,{className:`font-mono text-[12px]`,children:e.path}),(0,N.jsx)(`span`,{className:`text-[12px]`,children:`cleanup`})]},`c${t}`)),t?.reason&&(0,N.jsx)(`li`,{className:`text-[12px] text-fail [overflow-wrap:anywhere]`,children:t.reason})]})]})}function U({what:e,writes:t,defaultUrl:n,onRun:i,onCancel:a,needsData:s}){let[c,l]=(0,M.useState)(n),[u,f]=(0,M.useState)(!1),[p,m]=(0,M.useState)(!1);return(0,N.jsxs)(`div`,{className:`flex flex-col gap-3 rounded-[12px] border border-accent-line bg-accent-soft p-4`,children:[(0,N.jsx)(`span`,{className:`font-medium`,children:e}),(0,N.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm`,children:[`Against`,(0,N.jsx)(o,{value:c,spellCheck:!1,placeholder:`https://qa.example.com/api`,onChange:e=>l(e.target.value),className:`max-w-[480px] bg-bg`})]}),t>0&&(0,N.jsxs)(`span`,{className:`flex items-start gap-3 text-sm`,children:[(0,N.jsx)(r,{checked:u,onChange:f,label:`Also run the calls that change data`}),(0,N.jsxs)(`span`,{className:`flex flex-col`,children:[`Also run the `,t,` call`,t===1?``:`s`,` that change data`,(0,N.jsx)(`span`,{className:`text-[13px] text-warn`,children:`Only on a test environment: they create, change or delete data there.`})]})]}),s?(0,N.jsxs)(`span`,{className:`flex items-center gap-3 text-sm`,children:[(0,N.jsx)(r,{checked:p,onChange:m,label:`Also run calls with made-up values`}),`Also run the `,s,` call`,s===1?``:`s`,` whose values were made up`]}):null,(0,N.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,N.jsxs)(d,{variant:`primary`,onClick:()=>i({...c.trim()?{baseUrl:c.trim()}:{},allowWrites:u,includeNeedsData:p}),children:[(0,N.jsx)(v,{size:16,"aria-hidden":`true`}),`Run`]}),(0,N.jsx)(d,{onClick:a,children:`Don't run`})]})]})}function W({open:n,onClose:i,view:a,set:l,onMake:u,busy:f}){let[p,m]=(0,M.useState)(`spec`),[h,g]=(0,M.useState)(``),[_,v]=(0,M.useState)(``),[y,b]=(0,M.useState)(``),[x,S]=(0,M.useState)(!0);(0,M.useEffect)(()=>{n&&(m(l.source.kind===`run`?`run`:`spec`),g(l.source.kind===`run`?``:a.runs[0]?.id??``))},[n,l.source.kind,a.runs]);let C=(e,t,n)=>(0,N.jsxs)(`label`,{className:c(`flex cursor-pointer items-start gap-3 rounded-[12px] border px-3 py-2.5`,p===e?`border-accent bg-accent-soft`:`border-line-soft hover:bg-surface-muted`),children:[(0,N.jsx)(`input`,{type:`radio`,name:`sc-from`,checked:p===e,onChange:()=>m(e),className:`mt-1 size-4 accent-accent`}),(0,N.jsxs)(`span`,{className:`flex flex-col`,children:[(0,N.jsx)(`span`,{className:`text-sm font-medium`,children:t}),(0,N.jsx)(`span`,{className:`text-[13px] text-muted`,children:n})]})]});return(0,N.jsx)(t,{open:n,onClose:i,title:`Make scenarios`,description:`API calls in order, where later calls use values earlier answers gave, added to ${l.name}. Nothing runs until you run them.`,footer:(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(d,{onClick:i,children:`Cancel`}),(0,N.jsx)(d,{variant:`primary`,disabled:f||p===`cases`&&!_.trim()||p===`text`&&!y.trim(),onClick:()=>u({from:p,...p===`run`&&h?{run:h}:{},...p===`cases`?{cases:_}:{},...p===`text`?{text:y}:{},...p===`spec`?{negative:x}:{}}),children:`Make scenarios`})]}),children:(0,N.jsxs)(`div`,{className:`flex flex-col gap-2 pt-3`,children:[C(`spec`,`From the API description`,`Each resource's lifecycle, browsing, the description's links, and negative cases (no model)`),p===`spec`&&(0,N.jsxs)(`span`,{className:`flex items-center gap-2 pl-10 text-sm`,children:[(0,N.jsx)(r,{checked:x,onChange:S,label:`Negative cases`}),` Negative cases: an id that does not exist, no credentials, an empty body`]}),C(`run`,`From a browser run`,`The calls the application made, in order, with the values passed on (no model)`),p===`run`&&(0,N.jsxs)(s,{"aria-label":`Browser run`,value:h,onChange:e=>g(e.target.value),className:`ml-10 max-w-[440px]`,children:[(0,N.jsx)(`option`,{value:``,children:`The latest run`}),a.runs.map(t=>(0,N.jsxs)(`option`,{value:t.id,children:[t.goal,` · `,e(t.calls,`call`),` · `,L(t.at)]},t.id))]}),C(`cases`,`From test cases`,`One scenario per case, planned by the model against the set's operations`),p===`cases`&&(0,N.jsx)(o,{"aria-label":`Test cases`,value:_,spellCheck:!1,placeholder:`ado:2238, jira:SHOP-12`,onChange:e=>v(e.target.value),className:`ml-10 max-w-[440px]`}),C(`text`,`From a description`,`In plain words, planned by the model; a step no operation does is listed, never invented`),p===`text`&&(0,N.jsx)(o,{"aria-label":`The scenario`,value:y,maxLength:1e3,placeholder:`Create a user, log in, add two items, check out, the total is the sum`,onChange:e=>b(e.target.value),className:`ml-10`})]})})}function G({open:n,onClose:r,view:i,onMake:a,busy:c}){let[l,u]=(0,M.useState)(`spec`),[f,p]=(0,M.useState)(``),[m,h]=(0,M.useState)(``),[g,_]=(0,M.useState)(``),[v,y]=(0,M.useState)(``);return(0,M.useEffect)(()=>{n&&(p(i.specs[0]??``),h(``),_(``),y(i.baseUrl??``),u(i.specs.length||!i.runs.length?`spec`:`run`))},[n,i]),(0,N.jsx)(t,{open:n,onClose:r,title:`New contract set`,description:`One contract per operation: an example call and what its answer must have (status, content type, schema, key fields). Making them runs nothing.`,footer:(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(d,{onClick:r,children:`Cancel`}),(0,N.jsx)(d,{variant:`primary`,disabled:c||l===`spec`&&!f.trim(),onClick:()=>a({from:l,...l===`spec`?{spec:f.trim()}:m?{run:m}:{},...g.trim()?{name:g.trim()}:{},...v.trim()?{baseUrl:v.trim()}:{}}),children:`Make contracts`})]}),children:(0,N.jsxs)(`div`,{className:`flex flex-col gap-4 pt-3`,children:[(0,N.jsxs)(`fieldset`,{className:`m-0 flex flex-col gap-2 border-0 p-0`,children:[(0,N.jsx)(`legend`,{className:`mb-1.5 text-sm font-medium`,children:`From`}),(0,N.jsxs)(`label`,{className:`flex min-h-9 cursor-pointer items-center gap-2 text-sm`,children:[(0,N.jsx)(`input`,{type:`radio`,name:`set-from`,checked:l===`spec`,onChange:()=>u(`spec`),className:`size-4 accent-accent`}),`An API description: OpenAPI or Swagger, WSDL, GraphQL, .proto, or grpc://`]}),l===`spec`&&(0,N.jsxs)(`div`,{className:`flex flex-col gap-1.5 pl-6`,children:[(0,N.jsx)(o,{"aria-label":`API description`,value:f,spellCheck:!1,list:`spec-files`,placeholder:`https://shop.test/openapi.json, or a file in the project`,onChange:e=>p(e.target.value)}),(0,N.jsx)(`datalist`,{id:`spec-files`,children:i.specs.map(e=>(0,N.jsx)(`option`,{value:e},e))}),i.specs.length>0&&(0,N.jsxs)(`span`,{className:`text-[13px] text-muted`,children:[`In this project: `,i.specs.slice(0,6).join(`, `)]})]}),(0,N.jsxs)(`label`,{className:`flex min-h-9 cursor-pointer items-center gap-2 text-sm`,children:[(0,N.jsx)(`input`,{type:`radio`,name:`set-from`,checked:l===`run`,onChange:()=>u(`run`),className:`size-4 accent-accent`}),`The calls a browser run saw the application make`]}),l===`run`&&(0,N.jsxs)(s,{"aria-label":`Browser run`,value:m,onChange:e=>h(e.target.value),className:`ml-6 max-w-[440px]`,children:[(0,N.jsx)(`option`,{value:``,children:`The latest run`}),i.runs.map(t=>(0,N.jsxs)(`option`,{value:t.id,children:[t.goal,` · `,e(t.calls,`call`),` · `,L(t.at)]},t.id))]})]}),(0,N.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm font-medium`,children:[`Name`,(0,N.jsx)(o,{value:g,maxLength:120,placeholder:`Petstore`,onChange:e=>_(e.target.value)})]}),(0,N.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm font-medium`,children:[`Base URL`,(0,N.jsx)(o,{value:v,spellCheck:!1,placeholder:`https://qa.shop.test/api`,onChange:e=>y(e.target.value)}),(0,N.jsxs)(`span`,{className:`text-[13px] font-normal text-muted`,children:[`Where the contracts run when not where they were recorded or described.`,i.headers.length?` Each call sends ${i.headers.join(`, `)} from api.headers in forgeqe.yaml.`:` Credentials go in api.headers in forgeqe.yaml, as references to environment variables.`]})]})]})})}function K({id:e,view:t,busy:n,act:r,version:o}){let[s,c]=(0,M.useState)(null),[u,f]=(0,M.useState)(``),[p,m]=(0,M.useState)(null),[h,g]=(0,M.useState)(!1),[y,x]=(0,M.useState)(``);(0,M.useEffect)(()=>{let t=!1;return i.set(e).then(e=>!t&&(c(e),f(``)),e=>!t&&f(e.message)),()=>{t=!0}},[e,o]),(0,M.useEffect)(()=>m(null),[e]);let O=(0,M.useMemo)(()=>new Map((s?.last.contracts?.results??[]).map(e=>[e.id,e])),[s]),A=(0,M.useMemo)(()=>new Map((s?.last.scenarios?.results??[]).map(e=>[e.id,e])),[s]);if(u)return(0,N.jsx)(`p`,{className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail`,children:u});if(!s)return(0,N.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`Loading…`});let j=s.contracts.filter(e=>e.writes).length,P=s.contracts.filter(e=>e.needsData?.length).length,F=s.scenarios??[],z=s.last.contracts,B=s.last.scenarios,G=t.baseUrl||s.baseUrl||``,K=async e=>{try{let{id:t}=await b.start(`Write the API contracts${e?` and scenarios`:``} of set ${s.id} as tests in the repository: call write_api_tests with set_id ${s.id}${e?` and scenarios ["all"]`:``}. Show me the plan before you write.`,{});location.hash=l(`chats`,t)}catch(e){x(e.message)}};return(0,N.jsxs)(`section`,{"aria-labelledby":`set-h`,className:`flex min-w-0 flex-1 flex-col gap-6`,children:[(0,N.jsxs)(`div`,{className:`flex flex-wrap items-start gap-3`,children:[(0,N.jsxs)(`div`,{className:`flex min-w-0 flex-[1_1_260px] flex-col gap-1`,children:[(0,N.jsx)(`h2`,{id:`set-h`,className:`m-0 text-[22px] font-semibold tracking-[-0.01em] [overflow-wrap:anywhere]`,children:s.name}),(0,N.jsxs)(`span`,{className:`text-sm text-muted [overflow-wrap:anywhere]`,children:[`From `,I[s.source.kind]||s.source.kind,` `,(0,N.jsx)(`span`,{className:`font-mono text-[12px]`,children:s.source.ref}),` · `,L(s.createdAt)]}),s.baseUrl&&(0,N.jsx)(`span`,{className:`font-mono text-[12px] text-muted [overflow-wrap:anywhere]`,children:s.baseUrl})]}),(0,N.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,N.jsxs)(d,{variant:`primary`,disabled:n||!s.contracts.length,onClick:()=>m(`contracts`),children:[(0,N.jsx)(v,{size:16,"aria-hidden":`true`}),`Run contracts`]}),(0,N.jsxs)(d,{disabled:n||!F.length,onClick:()=>m(`scenarios`),children:[(0,N.jsx)(v,{size:16,"aria-hidden":`true`}),`Run scenarios`]}),(0,N.jsxs)(d,{disabled:n,onClick:()=>g(!0),children:[(0,N.jsx)(T,{size:16,"aria-hidden":`true`}),`Make scenarios`]})]})]}),p===`contracts`&&(0,N.jsx)(U,{what:`Run ${s.contracts.length} contract${s.contracts.length===1?``:`s`}`,writes:j,needsData:P,defaultUrl:G,onCancel:()=>m(null),onRun:e=>{m(null),r(()=>i.run(s.id,e))}}),p===`scenarios`&&(0,N.jsx)(U,{what:`Run ${F.length} scenario${F.length===1?``:`s`}`,writes:F.filter(e=>e.writes).length,defaultUrl:G,onCancel:()=>m(null),onRun:e=>{m(null),r(()=>i.runScenarios(s.id,{...e.baseUrl?{baseUrl:e.baseUrl}:{},allowWrites:e.allowWrites}))}}),(0,N.jsxs)(`div`,{className:`flex flex-wrap gap-3`,children:[(0,N.jsx)(_,{icon:k,label:`Contracts`,value:String(s.contracts.length),note:[j?`${j} change data`:``,P?`${P} need real values`:``].filter(Boolean).join(` · `)||void 0}),(0,N.jsx)(_,{icon:E,label:`Scenarios`,value:String(F.length)}),(0,N.jsx)(_,{icon:w,label:`Contracts run`,value:z?`${z.counts.passed}/${z.counts.passed+z.counts.failed+z.counts.error}`:`–`,note:z?`passed · ${L(z.at)}`:`Not run yet`}),(0,N.jsx)(_,{icon:w,label:`Scenarios run`,value:B?`${B.counts.passed}/${B.counts.passed+B.counts.failed+B.counts.error}`:`–`,note:B?`passed · ${L(B.at)}`:`Not run yet`})]}),(0,N.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[z?.report&&(0,N.jsxs)(d,{onClick:async()=>x(await a(z.report)),children:[(0,N.jsx)(C,{size:16,"aria-hidden":`true`}),`Contracts report`]}),B?.report&&(0,N.jsxs)(d,{onClick:async()=>x(await a(B.report)),children:[(0,N.jsx)(C,{size:16,"aria-hidden":`true`}),`Scenarios report`]}),(0,N.jsxs)(d,{variant:`ghost`,onClick:()=>void K(F.length>0),children:[(0,N.jsx)(D,{size:16,"aria-hidden":`true`}),`Write them as tests`]}),y&&(0,N.jsx)(`span`,{className:`text-[13px] text-fail`,children:y})]}),(0,N.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,N.jsxs)(`div`,{className:`flex flex-wrap items-baseline gap-2`,children:[(0,N.jsxs)(`h3`,{className:`m-0 flex-1 text-base font-semibold`,children:[`Contracts (`,s.contracts.length,`)`]}),z&&(0,N.jsxs)(S,{tone:R(z.counts),children:[z.counts.passed,` passed · `,z.counts.failed+z.counts.error,` failed · `,z.counts.skipped,` skipped`]})]}),(0,N.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:s.contracts.slice(0,300).map(e=>(0,N.jsx)(V,{c:e,r:O.get(e.id)},e.id))}),s.skipped?.length?(0,N.jsxs)(`p`,{className:`m-0 text-[13px] text-muted`,children:[`Left out: `,s.skipped.slice(0,10).join(`; `)]}):null]}),(0,N.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,N.jsxs)(`div`,{className:`flex flex-wrap items-baseline gap-2`,children:[(0,N.jsxs)(`h3`,{className:`m-0 flex-1 text-base font-semibold`,children:[`Scenarios (`,F.length,`)`]}),B&&(0,N.jsxs)(S,{tone:R(B.counts),children:[B.counts.passed,` passed · `,B.counts.failed+B.counts.error,` failed · `,B.counts.skipped,` skipped`]})]}),F.length?(0,N.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:F.map(e=>(0,N.jsx)(H,{s:e,r:A.get(e.id)},e.id))}):(0,N.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`None yet: Make scenarios chains the calls end to end, from the description, a browser run, test cases, or a few words.`})]}),(0,N.jsx)(W,{open:h,onClose:()=>g(!1),view:t,set:s,busy:n,onMake:e=>{g(!1),r(()=>i.scenarios(s.id,e))}})]})}function q({sub:t}){let[r,a]=(0,M.useState)(null),[o,s]=(0,M.useState)(``),[u,f]=(0,M.useState)(!1),[p,m]=(0,M.useState)(!1),h=(0,M.useCallback)(()=>{i.view().then(e=>{a(e),s(``)},e=>s(e.message))},[]);(0,M.useEffect)(h,[h]);let _=!!r?.job?.running;(0,M.useEffect)(()=>{if(!_)return;let e=setInterval(h,1500);return()=>clearInterval(e)},[_,h]);let v=async e=>{f(!0),s(``);try{await e(),h()}catch(e){s(e.message)}finally{f(!1)}},b=t?decodeURIComponent(t):``,S=r?.sets.find(e=>e.id===b)||r?.sets[0],C=`${r?.job?.endedAt??``}|${S?.at??``}`;return(0,N.jsxs)(`div`,{className:`flex min-h-screen flex-col`,children:[(0,N.jsx)(x,{}),(0,N.jsxs)(`main`,{className:`@container mx-auto box-border flex w-full max-w-[1180px] flex-auto flex-col gap-4 px-6 pt-10 pb-10`,children:[(0,N.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,N.jsx)(y,{icon:g,size:`lg`}),(0,N.jsx)(`h1`,{className:`m-0 flex-1 text-[26px] font-semibold tracking-[-0.01em]`,children:`API tests`}),(0,N.jsxs)(d,{variant:`primary`,disabled:!r||_,onClick:()=>m(!0),children:[(0,N.jsx)(T,{size:16,"aria-hidden":`true`}),`New contract set`]})]}),(0,N.jsx)(`p`,{className:`m-0 max-w-[74ch] text-sm leading-relaxed text-muted`,children:`Test the API directly: REST, GraphQL, SOAP and gRPC. Contracts come from an API description or from the calls a browser run saw the application make; scenarios chain calls end to end. Both run straight against the API, with no browser and no model, in a fraction of a UI test's time.`}),o&&(0,N.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:o}),!r&&!o&&(0,N.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Loading…`}),r?.job&&(0,N.jsx)(z,{job:r.job,onStop:()=>v(()=>i.stop())}),r&&(r.sets.length?(0,N.jsxs)(`div`,{className:`flex flex-col gap-6 @2xl:flex-row @2xl:items-start @2xl:gap-8`,children:[(0,N.jsxs)(`nav`,{"aria-label":`Contract sets`,className:`flex min-w-0 flex-col gap-1 @2xl:sticky @2xl:top-6 @2xl:w-[250px] @2xl:flex-none`,children:[(0,N.jsxs)(`span`,{className:`px-3 text-[13px] font-medium text-muted`,children:[`Contract sets (`,r.sets.length,`)`]}),(0,N.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:r.sets.map(t=>{let i=t.last?.contracts;return(0,N.jsx)(`li`,{children:(0,N.jsxs)(`a`,{href:l(`api-tests`,encodeURIComponent(t.id)),"aria-current":S?.id===t.id?`page`:void 0,className:c(`flex min-h-[60px] items-center gap-3 rounded-[12px] px-3 py-2 text-ink no-underline`,S?.id===t.id?`bg-surface-strong hover:text-ink`:`hover:bg-surface-muted hover:text-ink`),children:[r?.job?.running&&r.job.target===t.id?(0,N.jsx)(n,{state:`working`,label:`Working on it`,px:16}):(0,N.jsx)(`span`,{className:c(`size-2.5 flex-none rounded-full`,i?i.counts.failed||i.counts.error?`bg-fail`:`bg-pass`:`bg-line`),"aria-label":i?i.counts.failed||i.counts.error?`failures`:`passed`:`not run`}),(0,N.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,N.jsx)(`span`,{className:`truncate text-[15px] font-medium`,children:t.name}),(0,N.jsxs)(`span`,{className:`truncate text-[13px] text-muted`,children:[e(t.contracts,`contract`),t.scenarios?` · ${e(t.scenarios,`scenario`)}`:``,` · `,L(t.at)]})]})]})},t.id)})})]}),S&&(0,N.jsx)(K,{id:S.id,view:r,busy:u||_,act:v,version:C})]}):(0,N.jsxs)(`div`,{className:`flex flex-col items-start gap-3 rounded-[18px] border border-line p-6`,children:[(0,N.jsx)(j,{size:24,"aria-hidden":`true`,className:`text-muted`}),(0,N.jsxs)(`p`,{className:`m-0 max-w-[62ch] leading-relaxed text-ink-2`,children:[`No API contracts yet. Make a set from your OpenAPI, Swagger, WSDL, GraphQL or .proto description`,r.runs.length?`, or from the ${e(r.runs[0].calls,`call`)} the run "${r.runs[0].goal}" saw`:``,`.`]}),(0,N.jsx)(d,{onClick:()=>m(!0),children:`New contract set`})]}))]}),r&&(0,N.jsx)(G,{open:p,onClose:()=>m(!1),view:r,busy:u||_,onMake:e=>v(async()=>{await i.contracts(e),m(!1)})})]})}export{q as ApiTests};
@@ -1,3 +0,0 @@
1
- import{$ as e,Gt as t,N as n,Q as r,R as i,Vt as a,X as o,Y as s,Z as c,a as l,at as u,fn as d,ht as f,ln as p,n as m,q as h,qt as g,r as _,t as v}from"./status-xNQO8J6U.js";import{n as y,r as b}from"./Response-CgGBxdB7.js";import{_ as x,a as S,b as C,c as w,d as T,g as E,i as D,l as ee,o as te,s as ne,u as re}from"./index-DuYynJ55.js";import{n as O,t as k}from"./when-CHnpLdYw.js";var A={name:`arrow-down`,size:24,node:[[`path`,{d:`M12 5v14`,key:`s699le`}],[`path`,{d:`m19 12-7 7-7-7`,key:`1idqje`}]]};A.node;var j=a(A),M=d(p(),1),N=c();function P({id:e}){let[n,a]=(0,M.useState)([]),[c,u]=(0,M.useState)(null),[d,f]=(0,M.useState)(``),[p,h]=(0,M.useState)(``),[_,v]=(0,M.useState)(!1),C=(0,M.useRef)(null),O=(0,M.useRef)(null),k=(0,M.useRef)(!0),[A,P]=(0,M.useState)(!0);(0,M.useEffect)(()=>{let t=!1,n=0;return a([]),u(null),f(``),(async()=>{for(;!t;)try{let r=await g.events(e,n,n>0);if(t||(f(``),u({title:r.title,state:r.state,profile:r.profile}),r.events.length&&(n=r.events[r.events.length-1].n,a(e=>[...e,...r.events])),(r.state===`closed`||r.state===`failed`)&&!r.events.length))return}catch(e){if(t||(f(e.message),e.status===404))return;await new Promise(e=>setTimeout(e,2e3))}})(),()=>{t=!0}},[e]);let F=(0,M.useMemo)(()=>b(n),[n]),I=(0,M.useMemo)(()=>{let e=new Map;for(let t of F.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()]},[F]),L=(0,M.useMemo)(()=>{let e=[];for(let t of F.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)},[F]),R=(0,M.useRef)(()=>{});l(F.context||F.usage||I.length||L.length?{context:F.context,usage:F.usage,model:F.model?.name,changes:I,outputs:L,busy:c?.state===`busy`||c?.state===`starting`,...I.length?{onCreatePr:()=>R.current()}:{}}:null);let z=c?.state,B=z===`busy`||z===`starting`,V=z===`closed`||z===`failed`,H=F.turns.at(-1),U=!!H&&!H.outcome&&(H.asks.some(e=>e.answer===void 0)||H.waits.some(e=>e.answer===void 0));(0,M.useEffect)(()=>{let e=document.documentElement,t=()=>window.innerHeight+window.scrollY>=e.scrollHeight-48,n=e=>{k.current=e,P(e)},r=window.scrollY,i=()=>{t()?n(!0):window.scrollY<r-2&&n(!1),r=window.scrollY},a=new ResizeObserver(()=>{k.current&&!t()&&window.scrollTo({top:e.scrollHeight})});return C.current&&a.observe(C.current),O.current&&a.observe(O.current),window.addEventListener(`scroll`,i,{passive:!0}),()=>{a.disconnect(),window.removeEventListener(`scroll`,i)}},[]);let ie=()=>{k.current=!0,P(!0),window.scrollTo({top:document.documentElement.scrollHeight,behavior:`smooth`})},[W,G]=(0,M.useState)(null);(0,M.useEffect)(()=>void t.settings().then(G,()=>{}),[]);let[K,q]=(0,M.useState)(!1),[J,Y]=(0,M.useState)({});(0,M.useEffect)(()=>Y({}),[F.headed,F.writeTests]);let X={...S(W),headed:J.headed??F.headed??!1,code:J.code??F.writeTests??!0},Z=(0,M.useCallback)(async e=>{try{await e()}catch(e){f(e.message)}},[]),Q=ee(`chat-${e}`.replace(/[^\w-]/g,``).slice(0,80),e=>{h(e),w(`reply`)}),$=async t=>{if(t.trim()&&!_){v(!0),k.current=!0,P(!0);try{await g.send(e,t.trim()),h(``),f(``),Q.close()}catch(e){f(e.message)}finally{v(!1)}}};return R.current=()=>{if(c?.state===`busy`||c?.state===`starting`||_)return;let e=I.map(e=>`- ${e.path}`).join(`
2
- `);$(`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.`)},(0,N.jsxs)(`div`,{className:`flex min-h-screen flex-col`,children:[(0,N.jsxs)(`header`,{className:`sticky top-0 z-20 flex items-center gap-1 border-b border-line-soft bg-bg py-3 pr-16 pl-5`,children:[(0,N.jsx)(m,{}),(0,N.jsx)(`h1`,{className:`m-0 ml-2 min-w-0 flex-1 truncate text-base font-semibold`,children:c?.title||`Chat`}),F.model&&(0,N.jsxs)(`span`,{className:`hidden min-h-9 items-center gap-1.5 rounded-lg px-2 text-sm text-ink-2 sm:inline-flex`,title:`The model this chat uses`,children:[(0,N.jsx)(E,{size:14,fill:`currentColor`,"aria-hidden":`true`,className:`text-accent`}),F.model.name]})]}),(0,N.jsxs)(`main`,{ref:C,className:`mx-auto box-border flex w-full max-w-[960px] flex-auto flex-col gap-8 px-6 pt-8 pb-6`,children:[!c&&!d&&(0,N.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Opening the chat…`}),F.turns.map((t,n)=>(0,N.jsxs)(`section`,{"aria-label":`Message ${n+1}`,className:`flex flex-col gap-5`,children:[(0,N.jsx)(`div`,{className:`ml-auto max-w-[min(85%,640px)] rounded-[18px] bg-surface-strong px-4 py-2.5 text-[15px] leading-relaxed whitespace-pre-wrap text-ink [overflow-wrap:anywhere]`,children:t.user}),(0,N.jsx)(y,{turn:t,live:n===F.turns.length-1&&!V,onAnswer:(t,n)=>Z(()=>g.answer(e,t,n)),onProceed:(t,n)=>Z(()=>g.proceed(e,t,n))})]},t.id)),H?.outcome===`done`&&H.next.length>0&&!B&&!V&&(0,N.jsx)(`div`,{className:`flex flex-wrap gap-2 pl-12`,children:H.next.map(e=>(0,N.jsx)(`button`,{type:`button`,title:e.request===e.label?void 0:e.request,onClick:()=>void $(e.request),className:`inline-flex min-h-10 cursor-pointer items-center rounded-full border border-line bg-bg px-4 text-sm font-medium text-ink-2 hover:border-accent-line hover:bg-accent-soft hover:text-ink`,children:e.label},e.label))}),(F.fatal||V&&F.ended)&&(0,N.jsxs)(`div`,{role:`alert`,className:r(`flex flex-col gap-2 rounded-[14px] px-4 py-3 text-sm leading-relaxed`,F.fatal||z===`failed`?`bg-fail-soft text-fail`:`bg-surface-muted text-ink-2`),children:[(0,N.jsx)(`span`,{className:`[overflow-wrap:anywhere]`,children:F.fatal||F.ended?.message||(z===`failed`?`ForgeQE stopped unexpectedly.`:`This chat has ended.`)}),F.ended?.stderr&&(0,N.jsx)(`pre`,{className:`m-0 max-h-[200px] overflow-auto rounded-lg bg-bg/60 px-3 py-2 font-mono text-[12px] whitespace-pre-wrap text-ink-2 [overflow-wrap:anywhere]`,children:F.ended.stderr.join(`
3
- `)}),(0,N.jsxs)(`span`,{className:`flex flex-wrap gap-2`,children:[(0,N.jsx)(`a`,{className:o({size:`sm`}),href:i(),children:`Start a new chat`}),F.fatal&&/model|key|sign/i.test(F.fatal)&&(0,N.jsx)(`a`,{className:o({size:`sm`}),href:i(`settings`,`models`),children:`Models`}),F.fatal&&/runtime|engine|setup/i.test(F.fatal)&&(0,N.jsx)(`a`,{className:o({size:`sm`}),href:i(`settings`,`setup`),children:`Set up`})]})]}),F.notes.map((e,t)=>(0,N.jsx)(`p`,{className:`m-0 text-sm text-muted [overflow-wrap:anywhere]`,children:e},t))]}),(0,N.jsx)(`div`,{ref:O,className:`sticky bottom-0 z-10 bg-gradient-to-t from-bg from-70% to-transparent px-6 pt-4 pb-5`,children:(0,N.jsxs)(`div`,{className:`relative mx-auto flex w-full max-w-[880px] flex-col gap-2`,children:[!A&&B&&(0,N.jsxs)(`button`,{type:`button`,onClick:ie,className:`absolute -top-11 left-1/2 inline-flex min-h-8 -translate-x-1/2 cursor-pointer items-center gap-1.5 rounded-full border border-line bg-bg px-3 text-[13px] font-medium text-ink-2 shadow-sm hover:text-ink`,children:[(0,N.jsx)(j,{size:14,"aria-hidden":`true`}),`Latest activity`]}),(0,N.jsx)(`div`,{"aria-live":`polite`,children:d&&(0,N.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:d})}),(0,N.jsx)(re,{id:`reply`,label:`Reply to ForgeQE`,rows:1,value:p,onChange:h,onSend:()=>void $(p),onStop:()=>Z(()=>g.stop(e)),busy:B&&!U,disabled:V||_||U||Q.running,top:Q.state&&(0,N.jsx)(ne,{state:Q.state,onStop:()=>void Q.stop(),onUndo:Q.undo,onClose:Q.close}),left:(0,N.jsxs)(N.Fragment,{children:[(0,N.jsxs)(`div`,{className:`relative`,children:[(0,N.jsxs)(s,{variant:`ghost`,className:`px-2.5 text-[15px]`,disabled:V,"aria-expanded":K,"aria-haspopup":`dialog`,onClick:()=>q(!K),children:[(0,N.jsx)(x,{size:18,strokeWidth:1.8,"aria-hidden":`true`}),`Tools`,(X.headed||!X.code)&&(0,N.jsx)(`span`,{"aria-hidden":`true`,className:`size-1.5 rounded-full bg-accent`})]}),(0,N.jsx)(T,{open:K,onClose:()=>q(!1),label:`Tools for this chat`,role:`dialog`,side:`auto`,className:`left-0 w-[min(380px,calc(100vw-48px))]`,children:(0,N.jsx)(D,{tools:X,chat:{model:F.model?.name,provider:F.model?.provider},onChange:t=>{let n={};t.headed!==X.headed&&(n.headed=t.headed),t.code!==X.code&&(n.writeTests=t.code),Object.keys(n).length&&(Y({headed:t.headed,code:t.code}),Z(()=>g.settings(e,n)))}})})]}),(0,N.jsx)(te,{running:Q.running,disabled:!p.trim()||V||_||U,onClick:()=>void Q.start(p)})]}),placeholder:V?`This chat has ended`:U?`Answer above to go on`:B?`ForgeQE is working…`:`Reply to ForgeQE…`})]})})]})}function F(e){return e.waiting||e.state===`ready`&&e.outcome===`needs_input`?`waiting`:e.state===`busy`||e.state===`starting`?`working`:e.state===`closed`||e.state===`failed`?`ended`:`done`}var I={working:{label:`Working`,tone:`running`},waiting:{label:`Needs you`,tone:`warn`},done:{label:`Your turn`,tone:`pass`},ended:{label:`Ended`,tone:`neutral`}},L=[{id:`all`,label:`All`},{id:`working`,label:`Working`},{id:`waiting`,label:`Needs you`},{id:`done`,label:`Your turn`},{id:`ended`,label:`Ended`}];function R({c:t}){let n=F(t),a=I[n];return(0,N.jsxs)(`a`,{href:i(`chats`,t.id),className:`group grid min-h-14 grid-cols-[minmax(0,1fr)_auto] items-center gap-x-4 rounded-[10px] px-3 py-2 text-ink no-underline hover:bg-surface-muted hover:text-ink @3xl:grid-cols-[minmax(0,1fr)_120px_90px_150px_96px]`,children:[(0,N.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,N.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[n===`waiting`&&(0,N.jsx)(`span`,{"aria-hidden":`true`,className:`size-2 flex-none rounded-full bg-warn`}),(0,N.jsx)(`span`,{className:`truncate text-[14px] font-medium`,children:t.title})]}),(0,N.jsx)(`span`,{className:r(`truncate text-[12.5px]`,t.lastReply?`text-muted`:`text-muted italic`),children:t.lastReply||(n===`working`?`Working on the first answer…`:`No answer yet`)})]}),(0,N.jsx)(`span`,{className:`justify-self-end @3xl:justify-self-start`,children:(0,N.jsx)(v,{tone:a.tone,orb:t.state===`starting`?`waiting`:`working`,children:a.label})}),(0,N.jsx)(`span`,{className:`hidden text-[13px] text-muted tabular-nums @3xl:block`,children:t.turns?e(t.turns,`message`):`—`}),(0,N.jsx)(`span`,{className:`hidden min-w-0 items-center gap-1 truncate text-[13px] text-muted @3xl:flex`,children:t.profile?(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(E,{size:11,fill:`currentColor`,"aria-hidden":`true`,className:`flex-none text-accent`}),(0,N.jsx)(`span`,{className:`truncate`,children:t.profile})]}):`Default model`}),(0,N.jsx)(`span`,{className:`hidden text-right text-[13px] text-muted tabular-nums @3xl:block`,children:k(t.lastAt||t.started)})]})}var z=50;function B(){let[e,t]=(0,M.useState)(null),[a,c]=(0,M.useState)(``),[l,d]=(0,M.useState)(`all`),[p,m]=(0,M.useState)(``),[v,y]=(0,M.useState)(z);(0,M.useEffect)(()=>y(z),[l,p]),(0,M.useEffect)(()=>{let e=!1,n=()=>g.list().then(n=>!e&&t(n.chats),t=>!e&&c(t.message));n();let r=setInterval(n,5e3);return()=>{e=!0,clearInterval(r)}},[]);let b=(0,M.useMemo)(()=>{let t={all:0,working:0,waiting:0,done:0,ended:0};for(let n of e||[])t.all++,t[F(n)]++;return t},[e]),x=(0,M.useMemo)(()=>{let t=p.toLowerCase().split(/\s+/).filter(Boolean),n=e=>Date.parse(e.lastAt||e.started)||0;return(e||[]).filter(e=>(l===`all`||F(e)===l)&&t.every(t=>`${e.title} ${e.lastReply||``} ${e.profile||``}`.toLowerCase().includes(t))).sort((e,t)=>n(t)-n(e))},[e,l,p]),S=(0,M.useMemo)(()=>{let e=[];for(let t of x.slice(0,v)){let n=O(t.lastAt||t.started),r=e.find(e=>e.day===n);r?r.chats.push(t):e.push({day:n,chats:[t]})}return e},[x,v]);return(0,N.jsxs)(`div`,{className:`flex min-h-screen flex-col`,children:[(0,N.jsx)(_,{}),(0,N.jsxs)(`main`,{className:`mx-auto box-border flex w-full max-w-[1180px] flex-col gap-5 px-6 pt-8 pb-10`,children:[(0,N.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,N.jsx)(h,{icon:f,size:`lg`}),(0,N.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,N.jsx)(`h1`,{className:`m-0 text-[26px] font-semibold tracking-[-0.01em]`,children:`Chats`}),(0,N.jsx)(`span`,{className:`text-[13px] text-muted`,children:`Each one is its own ForgeQE agent in your project folder, for as long as forgeqe web runs.`})]}),(0,N.jsxs)(`a`,{className:r(o({variant:`primary`}),`gap-2`),href:i(),children:[(0,N.jsx)(u,{size:16,"aria-hidden":`true`}),`New chat`]})]}),e&&e.length>0&&(0,N.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,N.jsx)(`div`,{role:`radiogroup`,"aria-label":`Show`,className:`flex flex-wrap gap-1 rounded-full bg-surface-strong p-1`,children:L.map(e=>(0,N.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":l===e.id,onClick:()=>d(e.id),className:r(`inline-flex min-h-8 cursor-pointer items-center gap-1.5 rounded-full border-0 px-3 text-sm font-medium`,l===e.id?`bg-bg text-ink shadow-sm`:`bg-transparent text-muted hover:text-ink`),children:[e.label,(0,N.jsx)(`span`,{className:r(`tabular-nums text-[12px]`,e.id===`waiting`&&b.waiting?`text-warn`:`text-muted`),children:b[e.id]})]},e.id))}),(0,N.jsxs)(`div`,{className:`relative min-w-0 flex-[1_1_240px]`,children:[(0,N.jsx)(C,{size:16,"aria-hidden":`true`,className:`pointer-events-none absolute top-1/2 left-3 -translate-y-1/2 text-muted`}),(0,N.jsx)(n,{type:`search`,"aria-label":`Find a chat`,value:p,placeholder:`Find a chat`,onChange:e=>m(e.target.value),className:`pl-9`})]})]}),a&&(0,N.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail`,children:a}),!e&&!a&&(0,N.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`Loading…`}),e&&e.length===0&&(0,N.jsxs)(`div`,{className:`flex flex-col items-center gap-4 rounded-[18px] border border-dashed border-line px-6 py-14 text-center`,children:[(0,N.jsx)(h,{icon:f,size:`lg`}),(0,N.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,N.jsx)(`span`,{className:`text-lg font-semibold`,children:`No chats yet`}),(0,N.jsx)(`span`,{className:`max-w-[48ch] text-sm text-muted`,children:`Ask ForgeQE to run test cases, explore a journey, write a test or review requirements. Each chat shows up here while forgeqe web runs.`})]}),(0,N.jsx)(`a`,{className:o({variant:`primary`}),href:i(),children:`Start a chat`})]}),e&&e.length>0&&x.length===0&&(0,N.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`No chat matches.`}),x.length>0&&(0,N.jsxs)(`div`,{className:`@container rounded-[14px] border border-line-soft bg-bg`,children:[(0,N.jsxs)(`div`,{"aria-hidden":`true`,className:`hidden grid-cols-[minmax(0,1fr)_120px_90px_150px_96px] gap-x-4 border-b border-line-soft px-6 py-2 text-[12px] font-medium text-muted @3xl:grid`,children:[(0,N.jsx)(`span`,{children:`Chat`}),(0,N.jsx)(`span`,{children:`Status`}),(0,N.jsx)(`span`,{children:`Messages`}),(0,N.jsx)(`span`,{children:`Model`}),(0,N.jsx)(`span`,{className:`text-right`,children:`Last activity`})]}),S.map(e=>(0,N.jsxs)(`section`,{"aria-labelledby":`day-${e.day}`,children:[(0,N.jsxs)(`h2`,{id:`day-${e.day}`,className:`sticky top-0 z-[1] m-0 border-b border-line-soft bg-surface-muted/95 px-6 py-1.5 text-[12px] font-semibold tracking-wide text-muted uppercase backdrop-blur`,children:[e.day,` `,(0,N.jsxs)(`span`,{className:`font-normal tabular-nums`,children:[`· `,e.chats.length]})]}),(0,N.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-1.5`,children:e.chats.map(e=>(0,N.jsx)(`li`,{children:(0,N.jsx)(R,{c:e})},e.id))})]},e.day)),x.length>v&&(0,N.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-t border-line-soft px-6 py-3 text-[13px] text-muted`,children:[(0,N.jsxs)(`span`,{children:[`Showing `,v,` of `,x.length]}),(0,N.jsxs)(s,{size:`sm`,onClick:()=>y(v+z),children:[`Show `,Math.min(z,x.length-v),` more`]})]})]})]})]})}export{P as Chat,B as Chats};
@@ -1,4 +0,0 @@
1
- import{$ as e,F as t,Jt as n,L as r,N as i,P as a,Q as o,R as s,Vt as c,Y as l,Z as u,fn as d,ht as f,it as p,kt as m,ln as h,m as g,pt as _,q as v,qt as y,r as b,t as x}from"./status-xNQO8J6U.js";import"./markdown-B1Rz6VFK.js";import{t as S}from"./file-chart-column-increasing-FSDL2nUM.js";import{t as C}from"./trash-540pMBsR.js";import{A as w,O as T,b as E,x as D}from"./index-DuYynJ55.js";var O={name:`plug-zap`,size:24,node:[[`path`,{d:`M6.3 20.3a2.4 2.4 0 0 0 3.4 0L12 18l-6-6-2.3 2.3a2.4 2.4 0 0 0 0 3.4Z`,key:`goz73y`}],[`path`,{d:`m2 22 3-3`,key:`19mgm9`}],[`path`,{d:`M7.5 13.5 10 11`,key:`7xgeeb`}],[`path`,{d:`M10.5 16.5 13 14`,key:`10btkg`}],[`path`,{d:`m18 3-4 4h6l-4 4`,key:`16psg9`}]],aliases:[`plug-zap-2`]};O.node;var k=c(O),A={name:`sprout`,size:24,node:[[`path`,{d:`M14 9.536V7a4 4 0 0 1 4-4h1.5a.5.5 0 0 1 .5.5V5a4 4 0 0 1-4 4 4 4 0 0 0-4 4c0 2 1 3 1 5a5 5 0 0 1-1 3`,key:`139s4v`}],[`path`,{d:`M4 9a5 5 0 0 1 8 4 5 5 0 0 1-8-4`,key:`1dlkgp`}],[`path`,{d:`M5 21h14`,key:`11awu3`}]]};A.node;var j=c(A),M={name:`table-2`,size:24,node:[[`path`,{d:`M3 9h18`,key:`1pudct`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`,key:`h1oib`}]]};M.node;var N=c(M),P={name:`waypoints`,size:24,node:[[`path`,{d:`m10.586 5.414-5.172 5.172`,key:`4mc350`}],[`path`,{d:`m18.586 13.414-5.172 5.172`,key:`8c96vv`}],[`path`,{d:`M6 12h12`,key:`8npq4p`}],[`circle`,{cx:`12`,cy:`20`,r:`2`,key:`144qzu`}],[`circle`,{cx:`12`,cy:`4`,r:`2`,key:`muu5ef`}],[`circle`,{cx:`20`,cy:`12`,r:`2`,key:`1xzzfp`}],[`circle`,{cx:`4`,cy:`12`,r:`2`,key:`1hvhnz`}]]};P.node;var F=c(P),I=d(h(),1),L=u(),R=[`databases`,`testdata`,`flows`],z={test:`databases`,tables:`databases`,query:`databases`,gen:`testdata`,files:`testdata`,insert:`testdata`,batches:`testdata`,clean:`testdata`,check:`flows`,trace:`flows`},B={test:[`Testing the connection`,`Tested the connection`,`waiting`],tables:[`Reading the tables`,`Read the tables`,`searching`],query:[`Running the query`,`Ran the query`,`working`],gen:[`Making a preview`,`Made a preview`,`writing`],files:[`Writing the files`,`Wrote the files`,`writing`],insert:[`Inserting test data`,`Inserted test data`,`working`],batches:[`Listing the batches`,`Listed the batches`,`searching`],clean:[`Removing a batch`,`Removed a batch`,`working`],check:[`Checking the flows`,`Checked the flows`,`working`],trace:[`Following the record`,`Followed the record`,`searching`]},V=e=>e==null?`NULL`:typeof e==`object`?JSON.stringify(e):String(e),H=e=>(e?.keys||[]).map(e=>typeof e==`object`&&e?`${e.key}×${e.times}`:String(e)).join(`, `);function U({job:t,onStop:n}){let[r,i,a]=B[t.kind]??[`Working`,`Done`,`working`],o=(0,I.useRef)(null);(0,I.useEffect)(()=>{o.current&&(o.current.scrollTop=o.current.scrollHeight)},[t.lines.length]);let s=t.exitCode===0,c=!s&&(t.kind===`check`||t.kind===`trace`)&&t.result!==void 0&&!t.result.error;return(0,L.jsxs)(`section`,{"aria-label":t.running?r:i,className:`flex flex-col gap-2 rounded-[14px] border border-line-soft p-4`,children:[(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,L.jsxs)(`span`,{className:`min-w-0 flex-1 font-medium [overflow-wrap:anywhere]`,children:[t.running?r:i,t.target?(0,L.jsxs)(`span`,{className:`font-normal text-muted`,children:[` · `,t.target]}):null]}),(0,L.jsx)(x,{tone:t.running?`running`:s?`pass`:t.exitCode===2||c?`warn`:`fail`,orb:a,children:t.running?`Working`:s?`Done`:c?`Some broken`:t.exitCode===2?`Not done`:`Failed`}),t.running&&(0,L.jsxs)(l,{onClick:n,className:`border-fail text-fail hover:bg-fail-soft`,children:[(0,L.jsx)(p,{size:14,fill:`currentColor`,"aria-hidden":`true`}),`Stop`]})]}),(0,L.jsxs)(`details`,{open:t.running||!s&&!t.result,children:[(0,L.jsxs)(`summary`,{className:`cursor-pointer text-sm text-muted`,children:[`Output (`,e(t.lines.length,`line`),`)`]}),(0,L.jsx)(`code`,{className:`mt-2 block font-mono text-[12px] text-muted [overflow-wrap:anywhere]`,children:t.command}),(0,L.jsx)(`pre`,{ref:o,className:`mt-2 max-h-[240px] overflow-auto rounded-[10px] bg-surface-muted p-3 font-mono text-[12px] leading-relaxed whitespace-pre-wrap text-ink-2`,children:t.lines.join(`
2
- `)||`Starting…`})]})]})}function W({text:e}){return(0,L.jsx)(`p`,{className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:e})}function G({columns:e,rows:t}){return(0,L.jsx)(`div`,{className:`max-h-[420px] overflow-auto rounded-[12px] border border-line-soft`,children:(0,L.jsxs)(`table`,{className:`w-full border-collapse text-[13px]`,children:[(0,L.jsx)(`thead`,{className:`sticky top-0 bg-surface-muted`,children:(0,L.jsx)(`tr`,{children:e.map(e=>(0,L.jsx)(`th`,{className:`px-3 py-2 text-left font-medium whitespace-nowrap text-muted`,children:e},e))})}),(0,L.jsx)(`tbody`,{children:t.map((e,t)=>(0,L.jsx)(`tr`,{className:`border-t border-line-soft`,children:e.map((e,t)=>(0,L.jsx)(`td`,{className:o(`max-w-[320px] px-3 py-1.5 align-top font-mono text-[12px] [overflow-wrap:anywhere]`,e===null&&`text-muted`),children:V(e)},t))},t))})]})})}function K({db:n,job:r,busy:o,act:c}){let[u,d]=(0,I.useState)(``),[p,m]=(0,I.useState)(``),[h,g]=(0,I.useState)(`200`),[v,b]=(0,I.useState)(``),[S,C]=(0,I.useState)(``),T=r&&!r.running&&r.target===n.name?r:null,E=T?.kind===`query`?T.result:void 0,D=async()=>{try{let{id:e}=await y.start(`On the ${n.name} database: ${v.trim()} Read the schema first, check the SQL with run_sql dry_run: true, then run it and show the rows. End with the final SQL in one sql code block.`,{});location.hash=s(`chats`,e)}catch(e){C(e.message)}};return(0,L.jsxs)(`section`,{"aria-labelledby":`db-h`,className:`flex min-w-0 flex-1 flex-col gap-5`,children:[(0,L.jsxs)(`div`,{className:`flex flex-wrap items-start gap-3`,children:[(0,L.jsxs)(`div`,{className:`flex min-w-0 flex-[1_1_240px] flex-col gap-1`,children:[(0,L.jsx)(`h2`,{id:`db-h`,className:`m-0 text-[22px] font-semibold tracking-[-0.01em]`,children:n.name}),(0,L.jsx)(`span`,{className:`text-sm text-muted [overflow-wrap:anywhere]`,children:[n.engine||`from its connection string`,n.where,n.auth===`password`?``:n.auth].filter(Boolean).join(` · `)}),n.description&&(0,L.jsx)(`span`,{className:`text-sm text-ink-2`,children:n.description})]}),(0,L.jsx)(x,{tone:n.writable?`warn`:`neutral`,icon:n.writable,children:n.writable?`Writable, after asking`:`Read only`})]}),(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,L.jsxs)(l,{disabled:o,onClick:()=>c(`test`,{db:n.name}),children:[(0,L.jsx)(k,{size:16,"aria-hidden":`true`}),`Test the connection`]}),(0,L.jsxs)(`form`,{className:`flex min-w-0 flex-[1_1_280px] items-center gap-2`,onSubmit:e=>{e.preventDefault(),c(`tables`,{db:n.name,...u.trim()?{search:u.trim()}:{}})},children:[(0,L.jsx)(i,{"aria-label":`Tables matching`,value:u,placeholder:`Tables matching…`,onChange:e=>d(e.target.value),className:`min-w-0 flex-1`}),(0,L.jsxs)(l,{type:`submit`,disabled:o,children:[(0,L.jsx)(N,{size:16,"aria-hidden":`true`}),`Show tables`]})]})]}),T&&(T.kind===`test`||T.kind===`tables`)&&(0,L.jsx)(`pre`,{className:`m-0 max-h-[320px] overflow-auto rounded-[12px] bg-surface-muted p-3 font-mono text-[12px] leading-relaxed whitespace-pre-wrap text-ink-2`,children:T.lines.filter(e=>!/^args |^token /.test(e)).join(`
3
- `)}),(0,L.jsxs)(`section`,{"aria-labelledby":`query-h`,className:`flex flex-col gap-3`,children:[(0,L.jsx)(`h3`,{id:`query-h`,className:`m-0 text-base font-semibold`,children:`Query`}),(0,L.jsx)(`p`,{className:`m-0 text-[13px] text-muted`,children:`One read. A change to the data goes through a chat, which asks before it writes.`}),(0,L.jsx)(`label`,{className:`sr-only`,htmlFor:`sql`,children:`SQL`}),(0,L.jsx)(t,{id:`sql`,rows:5,value:p,spellCheck:!1,placeholder:n.engine===`mongodb`?`{"find": "orders", "filter": {"status": "open"}}`:`select * from orders where created_at > now() - interval '1 day'`,onChange:e=>m(e.target.value),className:`font-mono text-[13px]`}),(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,L.jsxs)(l,{variant:`primary`,disabled:o||!p.trim(),onClick:()=>c(`query`,{db:n.name,sql:p,maxRows:Number(h)}),children:[(0,L.jsx)(_,{size:16,"aria-hidden":`true`}),`Run`]}),(0,L.jsxs)(l,{disabled:o||!p.trim(),onClick:()=>c(`query`,{db:n.name,sql:p,dryRun:!0}),children:[(0,L.jsx)(w,{size:16,"aria-hidden":`true`}),`Check only`]}),(0,L.jsxs)(`label`,{className:`flex items-center gap-2 text-sm text-muted`,children:[`Rows`,(0,L.jsx)(a,{value:h,onChange:e=>g(e.target.value),className:`w-[96px]`,children:[`50`,`200`,`1000`].map(e=>(0,L.jsx)(`option`,{children:e},e))})]})]}),E&&!E.ok&&(0,L.jsx)(W,{text:E.needs_confirmation?`Only reads run here. Ask in a chat to change data: it shows the statement and asks first.`:E.error||`The query failed.`}),E?.ok&&E.dry_run&&(0,L.jsxs)(`p`,{className:`m-0 rounded-[12px] bg-pass-soft px-3 py-2 text-sm text-pass`,children:[E.note||`The database accepts it.`,E.columns?.length?` Columns: ${E.columns.join(`, `)}`:``]}),E?.ok&&!E.dry_run&&E.columns&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(G,{columns:E.columns,rows:E.rows||[]}),(0,L.jsxs)(`span`,{className:`text-[13px] text-muted`,children:[e(E.row_count??E.rows?.length??0,`row`),E.truncated?` (more not shown)`:``,E.ms===void 0?``:` in ${E.ms} ms`]})]})]}),(0,L.jsxs)(`section`,{"aria-labelledby":`ask-h`,className:`flex flex-col gap-2`,children:[(0,L.jsx)(`h3`,{id:`ask-h`,className:`m-0 text-base font-semibold`,children:`Ask in your words`}),(0,L.jsxs)(`form`,{className:`flex flex-wrap items-center gap-2`,onSubmit:e=>{e.preventDefault(),v.trim()&&D()},children:[(0,L.jsx)(i,{"aria-label":`Your question`,value:v,maxLength:500,placeholder:`Which customers ordered more than twice last week?`,onChange:e=>b(e.target.value),className:`min-w-0 flex-[1_1_280px]`}),(0,L.jsxs)(l,{type:`submit`,disabled:!v.trim(),children:[(0,L.jsx)(f,{size:16,"aria-hidden":`true`}),`Ask in a chat`]})]}),S&&(0,L.jsx)(W,{text:S})]})]})}function q({view:e,job:t,busy:n,act:r,sub:i}){let a=e.databases.find(e=>e.name===i)||e.databases[0];return e.databases.length?(0,L.jsxs)(`div`,{className:`flex flex-col gap-6 @2xl:flex-row @2xl:items-start @2xl:gap-8`,children:[(0,L.jsxs)(`nav`,{"aria-label":`Databases`,className:`flex min-w-0 flex-col gap-1 @2xl:sticky @2xl:top-6 @2xl:w-[250px] @2xl:flex-none`,children:[(0,L.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:e.databases.map(e=>(0,L.jsx)(`li`,{children:(0,L.jsxs)(`a`,{href:s(`data`,`databases/${encodeURIComponent(e.name)}`),"aria-current":a?.name===e.name?`page`:void 0,className:o(`flex min-h-[60px] items-center gap-3 rounded-[12px] px-3 py-2 text-ink no-underline`,a?.name===e.name?`bg-surface-strong hover:text-ink`:`hover:bg-surface-muted hover:text-ink`),children:[(0,L.jsx)(m,{size:18,"aria-hidden":`true`,className:`flex-none text-muted`}),(0,L.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,L.jsx)(`span`,{className:`truncate text-[15px] font-medium`,children:e.name}),(0,L.jsx)(`span`,{className:`truncate text-[13px] text-muted`,children:[e.engine||`connection string`,e.writable?`writable`:`read only`].join(` · `)})]})]})},e.name))}),(0,L.jsx)(`a`,{href:s(`settings`,`databases`),className:`px-3 pt-1 text-[13px]`,children:`Add or change in Settings`})]}),a&&(0,L.jsx)(K,{db:a,job:t,busy:n,act:r},a.name)]}):(0,L.jsxs)(`div`,{className:`flex flex-col items-start gap-3 rounded-[18px] border border-line p-6`,children:[(0,L.jsx)(m,{size:24,"aria-hidden":`true`,className:`text-muted`}),(0,L.jsx)(`p`,{className:`m-0 max-w-[62ch] leading-relaxed text-ink-2`,children:`No databases yet. Add one in Settings: a connection string, or its host, user and password, kept in your credential store.`}),(0,L.jsx)(`a`,{href:s(`settings`,`databases`),className:`text-sm font-medium`,children:`Settings, Databases`})]})}function J({r:t}){return(0,L.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(t.order||[]).map(n=>{let r=t.preview?.[n],i=r?.sample||[],a=i.length?Object.keys(i[0]):[];return(0,L.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,L.jsxs)(`span`,{className:`text-sm`,children:[(0,L.jsx)(`span`,{className:`font-medium`,children:n}),` · `,e(t.rows?.[n]??0,`row`),r?.database_fills?.length?(0,L.jsxs)(`span`,{className:`text-muted`,children:[` · the database fills `,r.database_fills.join(`, `)]}):null,t.masked?.[n]?.length?(0,L.jsxs)(`span`,{className:`text-muted`,children:[` · masked `,t.masked[n].join(`, `)]}):null]}),a.length>0&&(0,L.jsx)(G,{columns:a,rows:i.slice(0,3).map(e=>a.map(t=>e[t]))})]},n)}),(t.warnings||[]).map((e,t)=>(0,L.jsx)(`p`,{className:`m-0 text-[13px] text-warn`,children:e},t))]})}function Y({view:e,job:t,busy:n,act:o}){let c=e.databases.filter(e=>e.writable),[u,d]=(0,I.useState)(e.specs[0]??``),[p,m]=(0,I.useState)(``),[h,g]=(0,I.useState)(``),[_,v]=(0,I.useState)(`csv`),[b,x]=(0,I.useState)(!1),[S,w]=(0,I.useState)(c[0]?.name??``),[E,D]=(0,I.useState)(``),[O,k]=(0,I.useState)(``),A={spec:u,...p?{db:p}:{},...h?{seed:h}:{}},M=t&&!t.running?t:null,N=M&&[`gen`,`files`,`insert`].includes(M.kind)&&M.target===u?M.result:void 0,P=M?.kind===`batches`?(Array.isArray(M.result)?M.result.flatMap(e=>e.batches||[]):M.result?.batches)??[]:null,F=e.databases.find(e=>e.name===p),R=async()=>{try{let{id:e}=await y.start(`Write a test data spec for this project (a YAML file with tables: under test-data/), from the database's schema. Show me the spec and a preview before you save it.`,{});location.hash=s(`chats`,e)}catch(e){k(e.message)}};return(0,L.jsxs)(`div`,{className:`flex flex-col gap-8`,children:[(0,L.jsxs)(`section`,{"aria-labelledby":`spec-h`,className:`flex flex-col gap-4`,children:[(0,L.jsxs)(`div`,{className:`flex flex-wrap items-baseline gap-2`,children:[(0,L.jsx)(`h2`,{id:`spec-h`,className:`m-0 flex-1 text-lg font-semibold`,children:`Make test data`}),(0,L.jsxs)(l,{variant:`ghost`,onClick:()=>void R(),children:[(0,L.jsx)(f,{size:16,"aria-hidden":`true`}),`Write a spec in a chat`]})]}),(0,L.jsx)(`p`,{className:`m-0 max-w-[70ch] text-sm leading-relaxed text-muted`,children:`A spec is a YAML file with tables: and what goes in each column. The same spec and seed make the same data again, so a test or a pipeline can rely on it. No model is used.`}),O&&(0,L.jsx)(W,{text:O}),e.specs.length===0?(0,L.jsx)(`p`,{className:`m-0 rounded-[12px] border border-line-soft px-4 py-3 text-sm text-muted`,children:`No specs in this project yet: a YAML file with tables: in test-data/, data/ or specs/. Write one in a chat, from a database's schema.`}):(0,L.jsxs)(`div`,{className:`flex flex-col gap-3 rounded-[14px] border border-line-soft p-4`,children:[(0,L.jsxs)(`div`,{className:`flex flex-wrap gap-3`,children:[(0,L.jsxs)(`label`,{className:`flex min-w-0 flex-[2_1_260px] flex-col gap-1.5 text-sm font-medium`,children:[`Spec`,(0,L.jsx)(a,{value:u,onChange:e=>d(e.target.value),children:e.specs.map(e=>(0,L.jsx)(`option`,{children:e},e))})]}),(0,L.jsxs)(`label`,{className:`flex min-w-0 flex-[1_1_180px] flex-col gap-1.5 text-sm font-medium`,children:[`Database`,(0,L.jsxs)(a,{value:p,onChange:e=>m(e.target.value),children:[(0,L.jsx)(`option`,{value:``,children:`The spec's own`}),e.databases.map(e=>(0,L.jsxs)(`option`,{value:e.name,children:[e.name,e.writable?``:` (read only)`]},e.name))]})]}),(0,L.jsxs)(`label`,{className:`flex w-[120px] flex-col gap-1.5 text-sm font-medium`,children:[`Seed`,(0,L.jsx)(i,{value:h,inputMode:`numeric`,placeholder:`Random`,onChange:e=>g(e.target.value.replace(/\D/g,``).slice(0,9))})]})]}),(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,L.jsxs)(l,{variant:`primary`,disabled:n||!u,onClick:()=>o(`gen`,A),children:[(0,L.jsx)(T,{size:16,"aria-hidden":`true`}),`Preview`]}),(0,L.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,L.jsx)(l,{disabled:n||!u,onClick:()=>o(`gen`,{...A,mode:`files`,format:_}),children:`Write files`}),(0,L.jsx)(a,{"aria-label":`File format`,value:_,onChange:e=>v(e.target.value),className:`w-[88px]`,children:[`csv`,`json`,`sql`].map(e=>(0,L.jsx)(`option`,{children:e},e))})]}),(0,L.jsxs)(l,{disabled:n||!u||!F?.writable,title:F?.writable?void 0:`Pick a writable database to insert into`,onClick:()=>x(!0),children:[(0,L.jsx)(j,{size:16,"aria-hidden":`true`}),`Insert into `,F?.writable?F.name:`a database`]})]}),b&&F&&(0,L.jsxs)(`div`,{role:`alertdialog`,"aria-label":`Insert test data`,className:`flex flex-col gap-3 rounded-[12px] border border-warn bg-warn-soft p-4`,children:[(0,L.jsxs)(`span`,{className:`font-medium`,children:[`Insert the rows of `,u,` into `,F.name,`?`]}),(0,L.jsx)(`span`,{className:`text-sm text-ink-2`,children:`They go in as one batch, which you can remove again below. Only on a test database.`}),(0,L.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,L.jsx)(l,{variant:`primary`,onClick:()=>{x(!1),o(`gen`,{...A,mode:`insert`,confirmed:!0})},children:`Insert`}),(0,L.jsx)(l,{onClick:()=>x(!1),children:`Don't insert`})]})]}),N&&!N.ok&&(0,L.jsx)(W,{text:N.error||`It did not make the data.`}),N?.ok&&(0,L.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[N.batch&&(0,L.jsxs)(`p`,{className:`m-0 rounded-[12px] bg-pass-soft px-3 py-2 text-sm text-pass`,children:[`Inserted as batch `,(0,L.jsx)(`span`,{className:`font-mono text-[13px]`,children:N.batch}),`.`]}),N.files?.length?(0,L.jsxs)(`p`,{className:`m-0 flex flex-wrap items-center gap-2 text-sm`,children:[`Wrote`,N.files.map(e=>(0,L.jsx)(`button`,{type:`button`,onClick:async()=>k(await r(e)),className:`cursor-pointer rounded-md border border-line-soft bg-surface-muted px-1.5 py-0.5 font-mono text-[12px] text-ink-2 hover:bg-surface-strong`,children:e},e))]}):null,(0,L.jsx)(J,{r:N})]})]})]}),(0,L.jsxs)(`section`,{"aria-labelledby":`batch-h`,className:`flex flex-col gap-3`,children:[(0,L.jsx)(`h2`,{id:`batch-h`,className:`m-0 text-lg font-semibold`,children:`Inserted batches`}),c.length===0?(0,L.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`No writable database: test data is inserted only into one marked writable in Settings, Databases.`}):(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,L.jsx)(a,{"aria-label":`Database`,value:S,onChange:e=>w(e.target.value),className:`w-[220px]`,children:c.map(e=>(0,L.jsx)(`option`,{children:e.name},e.name))}),(0,L.jsx)(l,{disabled:n||!S,onClick:()=>o(`batches`,{db:S}),children:`List batches`})]}),P&&P.length===0&&(0,L.jsxs)(`p`,{className:`m-0 text-sm text-muted`,children:[`No batches in `,M?.target,`.`]}),P&&P.length>0&&(0,L.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:P.map(e=>(0,L.jsxs)(`li`,{className:`flex flex-wrap items-center gap-3 border-t border-line-soft py-2.5 text-sm first:border-t-0`,children:[(0,L.jsxs)(`span`,{className:`flex min-w-0 flex-[1_1_240px] flex-col gap-0.5`,children:[(0,L.jsx)(`span`,{className:`font-mono text-[13px]`,children:e.batch}),(0,L.jsxs)(`span`,{className:`text-[13px] text-muted`,children:[new Date(e.created).toLocaleString([],{month:`short`,day:`numeric`,hour:`numeric`,minute:`2-digit`}),e.spec?` · ${e.spec}`:``,` ·`,` `,Object.entries(e.rows).map(([e,t])=>`${e} ${t}`).join(`, `)]})]}),E===e.batch?(0,L.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,L.jsxs)(`span`,{className:`text-[13px] text-warn`,children:[`Remove its rows from `,M?.target,`?`]}),(0,L.jsx)(l,{size:`sm`,className:`border-fail text-fail hover:bg-fail-soft`,onClick:()=>{D(``),o(`clean`,{db:M?.target,batch:e.batch,confirmed:!0})},children:`Remove`}),(0,L.jsx)(l,{size:`sm`,onClick:()=>D(``),children:`Keep`})]}):(0,L.jsxs)(l,{size:`sm`,disabled:n,onClick:()=>D(e.batch),children:[(0,L.jsx)(C,{size:14,"aria-hidden":`true`}),`Remove`]})]},e.batch))}),M?.kind===`clean`&&M.result?.ok&&(0,L.jsxs)(`p`,{className:`m-0 rounded-[12px] bg-pass-soft px-3 py-2 text-sm text-pass`,children:[`Removed:`,` `,Object.entries(M.result.removed||{}).map(([e,t])=>`${e} ${t}`).join(`, `)]})]})]})]})}function X({c:e}){let t=e=>e?.count??0;return(0,L.jsxs)(`li`,{className:`flex flex-col gap-1 border-t border-line-soft py-3 text-sm first:border-t-0`,children:[(0,L.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2`,children:[(0,L.jsx)(x,{tone:e.ok?`pass`:`fail`,children:e.ok?`Holds`:`Broken`}),(0,L.jsx)(`span`,{className:`font-medium`,children:e.flow}),(0,L.jsxs)(`span`,{className:`font-mono text-[12px] text-muted [overflow-wrap:anywhere]`,children:[e.from,` → `,e.to]})]}),e.error?(0,L.jsx)(`span`,{className:`text-fail [overflow-wrap:anywhere]`,children:e.error}):(0,L.jsxs)(`span`,{className:`text-ink-2`,children:[e.matched??0,` of `,e.source_rows??0,` arrived · `,e.late?`${t(e.late)} late (${t(e.in_flight)} in flight)`:`${t(e.missing)} missing`,` · `,e.wrong?.rows??0,` wrong · `,t(e.duplicates),` duplicated`,e.extra?` · ${t(e.extra)} with no source`:``]}),e.note&&(0,L.jsx)(`span`,{className:`text-[13px] text-muted`,children:e.note}),H(e.late??e.missing)&&(0,L.jsxs)(`span`,{className:`text-[13px] text-fail [overflow-wrap:anywhere]`,children:[`Missing: `,H(e.late??e.missing)]}),(e.wrong?.examples||[]).map((e,t)=>(0,L.jsxs)(`span`,{className:`font-mono text-[12px] text-fail [overflow-wrap:anywhere]`,children:[String(e.key),`: `,e.column,` expected `,V(e.expected),`, found `,V(e.target)]},t))]})}function Z({view:t,job:o,busy:c,act:u}){let[d,p]=(0,I.useState)([]),m=(0,I.useMemo)(()=>[...new Set(t.flows.map(e=>e.from).filter(e=>!e.startsWith(`api:`)))],[t.flows]),[h,g]=(0,I.useState)(m[0]??t.flows[0]?.name??``),[_,v]=(0,I.useState)(``),[b,C]=(0,I.useState)(``),[T,O]=(0,I.useState)(``),[k,A]=(0,I.useState)(null),[j,M]=(0,I.useState)(``),N=o&&!o.running?o:null,P=N?.kind===`check`?N.result??null:null,R=N?.kind===`trace`?N.result??null:null;return t.flowsError?(0,L.jsx)(W,{text:`${t.flowsFile} does not read: ${t.flowsError}`}):t.flows.length?(0,L.jsxs)(`div`,{className:`flex flex-col gap-8`,children:[(0,L.jsxs)(`section`,{"aria-labelledby":`flows-h`,className:`flex flex-col gap-3`,children:[(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,L.jsxs)(`h2`,{id:`flows-h`,className:`m-0 flex-1 text-lg font-semibold`,children:[`Flows `,(0,L.jsxs)(`span`,{className:`text-sm font-normal text-muted`,children:[`(`,t.flowsFile,`)`]})]}),(0,L.jsxs)(l,{variant:`primary`,disabled:c,onClick:()=>u(`check`,{flows:d}),children:[(0,L.jsx)(w,{size:16,"aria-hidden":`true`}),d.length?`Check ${e(d.length,`flow`)}`:`Check all`]}),N?.report&&(N.kind===`check`||N.kind===`trace`)&&(0,L.jsxs)(l,{onClick:async()=>M(await r(N.report)),children:[(0,L.jsx)(S,{size:16,"aria-hidden":`true`}),`Report`]})]}),(0,L.jsx)(`p`,{className:`m-0 text-[13px] text-muted`,children:`Each hop: did every record arrive, complete, correct, on time.`}),j&&(0,L.jsx)(W,{text:j}),(0,L.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:t.flows.map(t=>(0,L.jsxs)(`li`,{className:`flex items-start gap-3 border-t border-line-soft py-2.5 first:border-t-0`,children:[(0,L.jsx)(`input`,{type:`checkbox`,"aria-label":`Check ${t.name}`,checked:d.includes(t.name),onChange:e=>p(e.target.checked?[...d,t.name]:d.filter(e=>e!==t.name)),className:`mt-1 size-5 flex-none accent-accent`}),(0,L.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-0.5 text-sm`,children:[(0,L.jsx)(`span`,{className:`font-medium`,children:t.name}),(0,L.jsxs)(`span`,{className:`font-mono text-[12px] text-ink-2 [overflow-wrap:anywhere]`,children:[t.from,` → `,t.to]}),(0,L.jsxs)(`span`,{className:`text-[13px] text-muted`,children:[[t.mode,t.sla?`SLA ${t.sla}`:``,e(t.columns,`column`)].filter(Boolean).join(` · `),t.description?` · ${t.description}`:``]})]})]},t.name))}),P?.error&&(0,L.jsx)(W,{text:P.error}),P?.flows&&(0,L.jsx)(`ul`,{"aria-label":`Check results`,className:`m-0 flex list-none flex-col rounded-[14px] border border-line-soft px-4 py-1`,children:P.flows.map(e=>(0,L.jsx)(X,{c:e},e.flow))})]}),(0,L.jsxs)(`section`,{"aria-labelledby":`trace-h`,className:`flex flex-col gap-3`,children:[(0,L.jsx)(`h2`,{id:`trace-h`,className:`m-0 text-lg font-semibold`,children:`Follow one record`}),(0,L.jsxs)(`form`,{className:`flex flex-wrap items-end gap-3`,onSubmit:e=>{e.preventDefault(),h&&_.trim()&&u(`trace`,{start:h,key:_.trim(),...b?{wait:Number(b)}:{}})},children:[(0,L.jsxs)(`label`,{className:`flex min-w-0 flex-[1_1_220px] flex-col gap-1.5 text-sm font-medium`,children:[`From`,(0,L.jsxs)(a,{value:h,onChange:e=>g(e.target.value),children:[(0,L.jsx)(`optgroup`,{label:`A table`,children:m.map(e=>(0,L.jsx)(`option`,{children:e},e))}),(0,L.jsx)(`optgroup`,{label:`A flow`,children:t.flows.map(e=>(0,L.jsx)(`option`,{children:e.name},e.name))})]})]}),(0,L.jsxs)(`label`,{className:`flex w-[160px] flex-col gap-1.5 text-sm font-medium`,children:[`Its key`,(0,L.jsx)(i,{value:_,maxLength:200,placeholder:`1042`,onChange:e=>v(e.target.value)})]}),(0,L.jsxs)(`label`,{className:`flex w-[130px] flex-col gap-1.5 text-sm font-medium`,children:[`Wait up to (s)`,(0,L.jsx)(i,{value:b,inputMode:`numeric`,placeholder:`0`,onChange:e=>C(e.target.value.replace(/\D/g,``).slice(0,3))})]}),(0,L.jsxs)(l,{type:`submit`,disabled:c||!h||!_.trim(),children:[(0,L.jsx)(D,{size:16,"aria-hidden":`true`}),`Follow it`]})]}),R?.error&&(0,L.jsx)(W,{text:R.error}),R?.hops&&(0,L.jsx)(`ol`,{className:`m-0 flex list-none flex-col gap-2 border-l border-line pl-4`,children:R.hops.map((e,t)=>(0,L.jsxs)(`li`,{className:`flex flex-col gap-0.5 text-sm`,children:[(0,L.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2`,children:[(0,L.jsx)(x,{tone:e.ok?`pass`:`fail`,children:e.ok?`Arrived`:e.found_in_source===!1?`Not in the source`:e.arrived===!1?`Did not arrive`:`Differs`}),(0,L.jsx)(`span`,{className:`font-medium`,children:e.flow}),(0,L.jsxs)(`span`,{className:`font-mono text-[12px] text-muted`,children:[e.from,` → `,e.to,` · key `,V(e.key)]})]}),(e.differences||[]).map((e,t)=>(0,L.jsxs)(`span`,{className:`font-mono text-[12px] text-fail [overflow-wrap:anywhere]`,children:[e.column,`: expected `,V(e.expected),`, found `,V(e.target)]},t)),Number(e.copies)>1&&(0,L.jsxs)(`span`,{className:`text-[13px] text-warn`,children:[e.copies,` copies`]})]},t))})]}),(0,L.jsxs)(`section`,{"aria-labelledby":`impact-h`,className:`flex flex-col gap-3`,children:[(0,L.jsx)(`h2`,{id:`impact-h`,className:`m-0 text-lg font-semibold`,children:`What a change reaches`}),(0,L.jsxs)(`form`,{className:`flex flex-wrap items-center gap-2`,onSubmit:async e=>{e.preventDefault();try{A(await n.impact(T.trim())),M(``)}catch(e){M(e.message)}},children:[(0,L.jsx)(i,{"aria-label":`A table or column`,value:T,spellCheck:!1,placeholder:`shop.orders.total`,onChange:e=>O(e.target.value),className:`min-w-0 flex-[1_1_260px] font-mono text-[13px]`}),(0,L.jsxs)(l,{type:`submit`,disabled:!T.trim(),children:[(0,L.jsx)(E,{size:16,"aria-hidden":`true`}),`Show what reads it`]})]}),k&&k.length===0&&(0,L.jsxs)(`p`,{className:`m-0 text-sm text-muted`,children:[`Nothing in the flows reads `,T,`.`]}),k&&k.length>0&&(0,L.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0`,children:k.map((e,t)=>(0,L.jsxs)(`li`,{className:`font-mono text-[12px] text-ink-2 [overflow-wrap:anywhere]`,style:{paddingLeft:`${(e.depth-1)*16}px`},children:[e.from,` → `,e.to,e.columns.length?` (${e.columns.join(`, `)})`:``,` `,(0,L.jsxs)(`span`,{className:`text-muted`,children:[`[`,e.flow,`]`]})]},t))}),t.map.length>0&&(0,L.jsxs)(`details`,{children:[(0,L.jsx)(`summary`,{className:`cursor-pointer text-sm text-muted`,children:`The whole map`}),(0,L.jsx)(`pre`,{className:`mt-2 overflow-auto rounded-[12px] bg-surface-muted p-3 font-mono text-[12px] leading-relaxed text-ink-2`,children:t.map.join(`
4
- `)})]})]})]}):(0,L.jsxs)(`div`,{className:`flex flex-col items-start gap-3 rounded-[18px] border border-line p-6`,children:[(0,L.jsx)(F,{size:24,"aria-hidden":`true`,className:`text-muted`}),(0,L.jsxs)(`p`,{className:`m-0 max-w-[62ch] leading-relaxed text-ink-2`,children:[`No data flows yet. A flow says how records move from one system to another (a table, a topic or an API), by which key, and what each column becomes; `,(0,L.jsx)(`span`,{className:`font-mono text-[13px]`,children:t.flowsFile}),` holds them. ForgeQE can write them from your mapping documents.`]}),(0,L.jsxs)(l,{onClick:async()=>{try{let{id:e}=await y.start(`Write the data flows of this project into flows.yaml from our mapping documents and the databases' schemas. Show me each flow before you save it.`,{});location.hash=s(`chats`,e)}catch(e){M(e.message)}},children:[(0,L.jsx)(f,{size:16,"aria-hidden":`true`}),`Write flows in a chat`]}),j&&(0,L.jsx)(W,{text:j})]})}function Q({sub:e}){let[t,r]=(0,I.useState)(null),[i,a]=(0,I.useState)(``),[o,c]=(0,I.useState)(!1),[l,...u]=(e||``).split(`/`),d=R.includes(l)?l:`databases`,f=(0,I.useCallback)(()=>{n.view().then(e=>{r(e),a(``)},e=>a(e.message))},[]);(0,I.useEffect)(f,[f]);let p=!!t?.job?.running;(0,I.useEffect)(()=>{if(!p)return;let e=setInterval(f,1e3);return()=>clearInterval(e)},[p,f]);let h=async(e,t)=>{c(!0),a(``);try{await n.run(e,t),f()}catch(e){a(e.message)}finally{c(!1)}},_=t?.job??null,y={databases:`Databases${t?` (${t.databases.length})`:``}`,testdata:`Test data${t?` (${t.specs.length})`:``}`,flows:`Data flows${t?` (${t.flows.length})`:``}`};return(0,L.jsxs)(`div`,{className:`flex min-h-screen flex-col`,children:[(0,L.jsx)(b,{}),(0,L.jsxs)(`main`,{className:`@container mx-auto box-border flex w-full max-w-[1180px] flex-auto flex-col gap-4 px-6 pt-10 pb-10`,children:[(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,L.jsx)(v,{icon:m,size:`lg`}),(0,L.jsx)(`h1`,{className:`m-0 flex-1 text-[26px] font-semibold tracking-[-0.01em]`,children:`Data`})]}),(0,L.jsx)(`p`,{className:`m-0 max-w-[74ch] text-sm leading-relaxed text-muted`,children:`The databases the agents may read, test data made from specs and inserted as batches you can remove again, and the data flows between systems: did every record arrive, complete and correct.`}),i&&(0,L.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:i}),!t&&!i&&(0,L.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Loading…`}),t&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(g,{label:`Data`,current:d,onPick:e=>location.hash=s(`data`,e),tabs:R.map(e=>({id:e,label:y[e]}))}),_&&(_.running||z[_.kind]===d)&&(0,L.jsx)(U,{job:_,onStop:()=>void n.stop().then(f)}),(0,L.jsxs)(`div`,{role:`tabpanel`,id:`panel-${d}`,"aria-labelledby":`tab-${d}`,children:[d===`databases`&&(0,L.jsx)(q,{view:t,job:_,busy:o||p,act:h,sub:u[0]?decodeURIComponent(u[0]):void 0}),d===`testdata`&&(0,L.jsx)(Y,{view:t,job:_,busy:o||p,act:h}),d===`flows`&&(0,L.jsx)(Z,{view:t,job:_,busy:o||p,act:h})]})]})]})]})}export{Q as Data};
@@ -1 +0,0 @@
1
- import{$ as e,Bt as t,N as n,Nt as r,P as i,Q as a,R as o,Y as s,Yt as c,Z as l,fn as u,ht as d,ln as f,p,q as m,qt as h,r as g,t as _,x as v}from"./status-xNQO8J6U.js";import{t as y}from"./circle-dashed-zjN_W6rR.js";import{n as b}from"./markdown-B1Rz6VFK.js";import{b as x,v as S}from"./index-DuYynJ55.js";var C=u(f(),1),w=l(),T={ready:{label:`Ready`,tone:`pass`},partial:{label:`Ready, some parts need setup`,tone:`warn`},needs_setup:{label:`Needs setup`,tone:`neutral`}},E={models:`Models`,integrations:`Integrations`,monitor:`Monitor`,notifications:`Notifications`,agents:`Agents`,environments:`Environments`,containers:`Containers`,databases:`Databases`};async function D(e,t){try{let{id:t}=await h.start(e,{});location.hash=o(`chats`,t)}catch(e){t(e.message)}}function O({f:t,onScope:n,busy:r}){let[l,u]=(0,C.useState)(null),[f,p]=(0,C.useState)(``),[m,h]=(0,C.useState)(``);(0,C.useEffect)(()=>{c.detail(t.id).then(u,e=>p(e.message))},[t.id]);let g=t.gaps.filter(e=>!e.optional),_=t.gaps.filter(e=>e.optional);return(0,w.jsxs)(`div`,{className:`flex flex-col gap-4 py-4`,children:[[[g,`Needs`],[_,`Would do more with`]].map(([e,t])=>e.length?(0,w.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,w.jsx)(`span`,{className:`text-sm font-medium`,children:t}),(0,w.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-2 p-0`,children:e.map((e,n)=>(0,w.jsxs)(`li`,{className:`flex flex-col gap-0.5 rounded-[10px] bg-bg px-3 py-2 text-sm`,children:[(0,w.jsx)(`span`,{className:a(t===`Needs`?`text-ink`:`text-ink-2`),children:e.missing}),(0,w.jsx)(`span`,{className:`text-[13px] text-muted`,children:e.fix}),e.settings&&(0,w.jsxs)(`a`,{href:o(`settings`,e.settings),className:`inline-flex items-center gap-1 self-start text-[13px] font-medium`,children:[(0,w.jsx)(S,{size:13,"aria-hidden":`true`}),`Set it up in Settings, `,E[e.settings]||e.settings]})]},n))})]},t):null),t.inputs.length>0&&(0,w.jsxs)(`p`,{className:`m-0 text-sm text-ink-2`,children:[`From your request: `,t.inputs.join(`; `),`.`]}),f&&(0,w.jsx)(`p`,{className:`m-0 text-sm text-fail`,children:f}),l&&(0,w.jsxs)(w.Fragment,{children:[l.examples.length>0&&(0,w.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,w.jsx)(`span`,{className:`text-sm font-medium`,children:`Ask for it like this`}),(0,w.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:l.examples.slice(0,4).map(e=>(0,w.jsxs)(s,{size:`sm`,disabled:t.state===`needs_setup`,title:t.state===`needs_setup`?`Set it up first`:`Start a chat with this request`,onClick:()=>void D(e,h),className:`h-auto min-h-8 max-w-full py-1.5 text-left whitespace-normal`,children:[(0,w.jsx)(d,{size:14,"aria-hidden":`true`,className:`flex-none`}),e]},e))}),m&&(0,w.jsx)(`span`,{className:`text-[13px] text-fail`,children:m})]}),l.limits.length>0&&(0,w.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,w.jsx)(`span`,{className:`text-sm font-medium`,children:`What it does not do`}),(0,w.jsx)(`ul`,{className:`m-0 list-disc pl-5 text-sm text-ink-2`,children:l.limits.map(e=>(0,w.jsx)(`li`,{children:e},e))})]}),l.docs.length>0&&(0,w.jsxs)(`details`,{children:[(0,w.jsxs)(`summary`,{className:`cursor-pointer text-sm font-medium`,children:[`How it works (`,e(l.docs.length,`section`),`)`]}),(0,w.jsx)(`div`,{className:`mt-2 flex flex-col gap-4`,children:l.docs.map(e=>(0,w.jsxs)(`section`,{className:`rounded-[12px] bg-bg px-4 py-3`,children:[(0,w.jsx)(`h4`,{className:`m-0 mb-1 text-sm font-semibold`,children:e.heading}),(0,w.jsx)(b,{text:e.text,className:`text-sm`})]},e.heading))})]}),(0,w.jsxs)(`span`,{className:`font-mono text-[11.5px] text-muted [overflow-wrap:anywhere]`,children:[`Tools: `,l.tools.join(`, `)]})]}),(0,w.jsxs)(`label`,{className:`flex flex-wrap items-center gap-3 border-t border-line-soft pt-3 text-sm`,children:[(0,w.jsxs)(`span`,{className:`flex-[1_1_240px]`,children:[`The agent gets its tools`,(0,w.jsx)(`span`,{className:`block text-[13px] text-muted`,children:`agent.capabilities in forgeqe.yaml`})]}),(0,w.jsxs)(i,{value:t.scope,disabled:r,onChange:e=>n(e.target.value),className:`w-[240px]`,children:[(0,w.jsx)(`option`,{value:`auto`,children:`When a request is about it`}),(0,w.jsx)(`option`,{value:`always`,children:`Always`}),(0,w.jsx)(`option`,{value:`off`,children:`Never, in this project`})]})]})]})}function k(){let[e,i]=(0,C.useState)(null),[o,s]=(0,C.useState)(``),[l,u]=(0,C.useState)(``),[d,f]=(0,C.useState)(`all`),[h,b]=(0,C.useState)(``),[S,E]=(0,C.useState)(!1),D=(0,C.useCallback)(()=>c.view().then(i,e=>s(e.message)),[]);(0,C.useEffect)(()=>void D(),[D]);let k=(0,C.useMemo)(()=>{let t=h.toLowerCase().split(/\s+/).filter(Boolean);return(e?.areas||[]).map(e=>({...e,features:e.features.filter(n=>(d===`all`||(d===`ready`?n.state!==`needs_setup`:n.state!==`ready`))&&t.every(t=>`${n.title} ${n.summary} ${e.area}`.toLowerCase().includes(t)))})).filter(e=>e.features.length)},[e,d,h]),A=async(e,t)=>{E(!0);try{i(await c.scope(e,t)),s(``)}catch(e){s(e.message)}finally{E(!1)}},j=e?.counts;return(0,w.jsxs)(`div`,{className:`flex min-h-screen flex-col`,children:[(0,w.jsx)(g,{}),(0,w.jsxs)(`main`,{className:`mx-auto box-border flex w-full max-w-[920px] flex-auto flex-col gap-5 px-6 pt-10 pb-10`,children:[(0,w.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,w.jsx)(m,{icon:t,size:`lg`}),(0,w.jsx)(`h1`,{className:`m-0 flex-1 text-[26px] font-semibold tracking-[-0.01em]`,children:`What's ready`})]}),(0,w.jsx)(`p`,{className:`m-0 max-w-[70ch] text-sm leading-relaxed text-muted`,children:`Everything ForgeQE can do, and whether it works here: in this project, with these settings, on this machine. Each one says what it still needs and where to set it up, and how to ask for it.`}),o&&(0,w.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:o}),!e&&!o&&(0,w.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Loading…`}),e&&j&&(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(`div`,{className:`flex flex-wrap gap-3`,children:[(0,w.jsx)(p,{icon:t,label:`Ready`,value:String(j.ready)}),(0,w.jsx)(p,{icon:r,label:`Some parts need setup`,value:String(j.partial)}),(0,w.jsx)(p,{icon:y,label:`Need setup`,value:String(j.needs_setup)})]}),(0,w.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,w.jsx)(`div`,{role:`radiogroup`,"aria-label":`Show`,className:`flex gap-1 rounded-full bg-surface-strong p-1`,children:[[`all`,`All`],[`needs`,`Needs setup`],[`ready`,`Ready`]].map(([e,t])=>(0,w.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":d===e,onClick:()=>f(e),className:a(`min-h-8 cursor-pointer rounded-full border-0 px-3.5 text-sm font-medium`,d===e?`bg-bg text-ink shadow-sm`:`bg-transparent text-muted hover:text-ink`),children:t},e))}),(0,w.jsxs)(`div`,{className:`relative min-w-0 flex-[1_1_220px]`,children:[(0,w.jsx)(x,{size:16,"aria-hidden":`true`,className:`pointer-events-none absolute top-1/2 left-3 -translate-y-1/2 text-muted`}),(0,w.jsx)(n,{type:`search`,"aria-label":`Find a feature`,value:h,placeholder:`Find a feature`,onChange:e=>b(e.target.value),className:`pl-9`})]})]}),k.length===0&&(0,w.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`Nothing matches.`}),k.map(e=>(0,w.jsxs)(`section`,{"aria-labelledby":`area-${e.area}`,children:[(0,w.jsx)(`h2`,{id:`area-${e.area}`,className:`m-0 mb-1 text-base font-semibold`,children:e.area}),e.features.map(e=>(0,w.jsx)(v,{title:e.title,meta:(0,w.jsx)(`span`,{className:a(l!==e.id&&`line-clamp-2`),children:e.summary}),open:l===e.id,onToggle:()=>u(l===e.id?``:e.id),state:(0,w.jsxs)(`span`,{className:`flex flex-wrap items-center justify-end gap-1.5`,children:[e.scope!==`auto`&&(0,w.jsx)(_,{tone:`neutral`,icon:!1,children:e.scope===`always`?`Always given`:`Off here`}),(0,w.jsx)(_,{tone:T[e.state].tone,icon:e.state!==`needs_setup`,children:T[e.state].label})]}),children:(0,w.jsx)(O,{f:e,busy:S,onScope:t=>void A(e.id,t)})},e.id))]},e.area)),e.outOfScope.length>0&&(0,w.jsxs)(`section`,{"aria-labelledby":`oos-h`,className:`flex flex-col gap-2 rounded-[14px] border border-line-soft px-4 py-3`,children:[(0,w.jsx)(`h2`,{id:`oos-h`,className:`m-0 text-base font-semibold`,children:`Not what ForgeQE does`}),(0,w.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0 text-sm`,children:e.outOfScope.map(e=>(0,w.jsxs)(`li`,{children:[e.what,e.instead?(0,w.jsxs)(`span`,{className:`text-muted`,children:[`; instead: `,e.instead]}):null]},e.what))})]})]})]})]})}export{k as Features};
@@ -1,3 +0,0 @@
1
- import{I as e,J as t,K as n,L as r,Lt as i,N as a,P as o,Q as s,Qt as c,R as l,Vt as u,Y as d,Z as f,dt as p,fn as m,ft as h,in as g,it as _,ln as v,p as y,pt as b,q as x,r as S,t as C,wt as w}from"./status-xNQO8J6U.js";import{n as T,t as E}from"./terminal-ib42D5b6.js";import{n as D,t as O}from"./markdown-B1Rz6VFK.js";import{t as k}from"./external-link-D2pA4PJ0.js";import{t as A}from"./trash-540pMBsR.js";import{A as j,E as M,N,S as P,w as F,y as I}from"./index-DuYynJ55.js";var L={name:`calendar-plus`,size:24,node:[[`path`,{d:`M16 18h6`,key:`987eiv`}],[`path`,{d:`M16 2v3`,key:`otl347`}],[`path`,{d:`M19 15v6`,key:`10aioa`}],[`path`,{d:`M21 11.5V5a2 2 0 00-2-2H5a2 2 0 00-2 2v14a2 2 0 002 2h8.3`,key:`jgwkxf`}],[`path`,{d:`M3 9h18`,key:`1pudct`}],[`path`,{d:`M8 2v3`,key:`1ioesn`}]]};L.node;var R=u(L),z={name:`power`,size:24,node:[[`path`,{d:`M12 2v10`,key:`mnfbl`}],[`path`,{d:`M18.4 6.6a9 9 0 1 1-12.77.04`,key:`obofu9`}]]};z.node;var B=u(z),V={name:`search-check`,size:24,node:[[`path`,{d:`m8 11 2 2 4-4`,key:`1sed1v`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}],[`path`,{d:`m21 21-4.3-4.3`,key:`1qie3q`}]]};V.node;var H=u(V),U={name:`timer-off`,size:24,node:[[`path`,{d:`M10 2h4`,key:`n1abiw`}],[`path`,{d:`M4.6 11a8 8 0 0 0 1.7 8.7 8 8 0 0 0 8.7 1.7`,key:`10he05`}],[`path`,{d:`M7.4 7.4a8 8 0 0 1 10.3 1 8 8 0 0 1 .9 10.2`,key:`15f7sh`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M12 12v-2`,key:`fwoke6`}]]};U.node;var W=u(U),G=m(v(),1),K=f(),q={monitor:`Monitor`,suite:`Suite`,run:`Browser run`,heal:`Heal`,"pr-tests":`PR tests`,pack:`Pack`,pipeline:`Pipeline watch`},J={running:{label:`Running`,tone:`running`},passed:{label:`Passed`,tone:`pass`},failed:{label:`Failed`,tone:`fail`},stopped:{label:`Stopped`,tone:`neutral`},timed_out:{label:`Timed out`,tone:`fail`},interrupted:{label:`Interrupted`,tone:`warn`}},Y=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`})},X=e=>{if(!e.endedAt)return``;let t=Math.max(0,Math.round((Date.parse(e.endedAt)-Date.parse(e.startedAt))/1e3));return t<60?`${t}s`:`${Math.floor(t/60)}m ${t%60}s`};function Z(e){return e.running?J.running:e.enabled?e.last?J[e.last.status]:{label:`Not run yet`,tone:`neutral`}:{label:`Disabled`,tone:`neutral`}}var Q={pass:`bg-pass`,fail:`bg-fail`,warn:`bg-warn`,running:`bg-accent`,neutral:`bg-line`};function $({label:e,icon:t,children:n}){return(0,K.jsxs)(`div`,{className:`flex min-h-[48px] flex-wrap items-baseline gap-x-4 gap-y-1 border-t border-line-soft py-2.5`,children:[(0,K.jsxs)(`span`,{className:`flex w-[170px] flex-none items-center gap-2 text-sm text-muted`,children:[t&&(0,K.jsx)(t,{size:16,"aria-hidden":`true`,className:`flex-none`}),e]}),(0,K.jsx)(`span`,{className:`min-w-0 flex-1 text-sm [overflow-wrap:anywhere]`,children:n})]})}function ee({m:e,rounds:t}){let[n,i]=(0,G.useState)(``);return(0,K.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,K.jsxs)(`h3`,{className:`m-0 mb-1 flex items-center gap-2 text-base font-semibold`,children:[(0,K.jsx)(M,{size:18,"aria-hidden":`true`,className:`text-accent`}),`Monitor`]}),(0,K.jsx)($,{icon:F,label:`Checks`,children:e.checks.length?(0,K.jsx)(D,{text:e.checks.map(e=>`\`${e.replace(/`/g,``)}\``).join(`, `),className:`text-sm [&_p]:my-0`}):`The checks in forgeqe.yaml (monitor.checks)`}),(0,K.jsxs)($,{icon:N,label:`Alerts after`,children:[e.failAfter,` failing round`,e.failAfter===1?``:`s`,` in a row`,e.remind?`, again every ${e.remind} while it keeps failing`:``]}),(0,K.jsx)($,{icon:I,label:`Alerts go to`,children:e.alerts.length?e.alerts.join(` and `):`Nowhere yet: add Teams or email in Settings, Monitor`}),(0,K.jsxs)($,{icon:h,label:`Each round`,children:[e.parallel,` check`,e.parallel===1?``:`s`,` at once; a recorded run `,e.replay===`trust`?`is trusted`:e.replay===`off`?`is not replayed`:`is verified with one model call`]}),(0,K.jsx)($,{icon:w,label:`Rounds kept in`,children:(0,K.jsx)(O,{path:e.outDir})}),(0,K.jsx)(`p`,{className:`m-0 border-t border-line-soft py-2.5 text-sm`,children:(0,K.jsx)(`a`,{href:l(`settings`,`monitor`),children:`Change the monitor in Settings`})}),(0,K.jsx)(`h4`,{className:`m-0 mt-3 mb-1 text-sm font-semibold`,children:`Latest rounds`}),n&&(0,K.jsx)(`p`,{className:`m-0 text-[13px] text-fail`,children:n}),t.length===0?(0,K.jsx)(`p`,{className:`m-0 border-t border-line-soft py-3 text-sm text-muted`,children:`No rounds yet.`}):(0,K.jsx)(`ul`,{className:`m-0 list-none p-0`,children:t.slice(0,8).map(e=>(0,K.jsxs)(`li`,{className:`flex min-h-[48px] items-center gap-3 border-t border-line-soft py-2`,children:[(0,K.jsxs)(C,{tone:e.counts.failed?`fail`:`pass`,children:[e.counts.passed,`/`,e.counts.total,` passed`]}),(0,K.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-sm`,children:Y(e.startedAt)}),e.report&&(0,K.jsx)(d,{variant:`icon`,size:`icon`,"aria-label":`Open the report of the round of ${Y(e.startedAt)}`,onClick:async()=>i(await r(e.report)),children:(0,K.jsx)(k,{size:16,"aria-hidden":`true`})}),(0,K.jsx)(`a`,{href:l(`reports`,encodeURIComponent(e.key)),className:`text-[13px]`,children:`Details`})]},e.key))})]})}function te({jobId:e,run:t}){let[n,r]=(0,G.useState)(null),[i,a]=(0,G.useState)(``);(0,G.useEffect)(()=>{let n=!1;r(null);let i=()=>c.log(e,t.id).then(e=>!n&&r(e.lines),e=>!n&&a(e.message));i();let o=t.status===`running`?setInterval(i,2e3):void 0;return()=>{n=!0,o&&clearInterval(o)}},[e,t.id,t.status]);let o=Math.max(2,...(n||[]).map(e=>Math.max(0,...(e.match(/`+/g)||[]).map(e=>e.length)))),s="`".repeat(o+1),l=[`**${J[t.status].label}**${t.endedAt?` after ${X(t)}`:``}${t.exitCode!==void 0&&t.exitCode!==null?`, exit ${t.exitCode}`:``}. Started ${Y(t.startedAt)}, ${t.reason===`asked`?`asked for`:`on schedule`}.`,...t.investigating?[``,`_Its failures are being investigated._`]:[],...t.findings?.length?[``,`**Investigated:**`,...t.findings.map(e=>`- ${e.verdict}: ${e.tests.map(e=>`\`${e.replace(/`/g,``)}\``).join(`, `)}${e.branch?` on branch \`${e.branch.replace(/`/g,``)}\``:``}`)]:[],...t.investigationNote?[``,t.investigationNote]:[],``,`${s}text`,...n||[],s].join(`
2
- `);return(0,K.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-[12px] border border-line-soft bg-surface-muted px-4 py-3`,children:[i&&(0,K.jsx)(`p`,{className:`m-0 text-sm text-fail`,children:i}),!n&&!i?(0,K.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`Reading its output…`}):(0,K.jsx)(D,{text:l,className:`text-sm [&_pre]:max-h-[320px] [&_pre]:overflow-auto`})]})}function ne({job:e,rounds:t,busy:r,act:a}){let[o,s]=(0,G.useState)(null),[l,u]=(0,G.useState)(null),[f,m]=(0,G.useState)(!1),h=`${e.running?.id}|${e.last?.id}|${e.last?.status}`;(0,G.useEffect)(()=>{let t=!1;return c.detail(e.id).then(e=>{t||(s(e.runs),u(t=>t??e.runs[0]?.id??null))},()=>{}),()=>{t=!0}},[e.id,h]),(0,G.useEffect)(()=>{u(null),m(!1)},[e.id]);let g=Z(e),v=o?.filter(e=>e.status===`passed`).length??0,x=o?.filter(e=>e.status!==`running`).length??0;return(0,K.jsxs)(`section`,{"aria-labelledby":`job-h`,className:`flex min-w-0 flex-1 flex-col gap-5`,children:[(0,K.jsxs)(`div`,{className:`flex flex-wrap items-start gap-x-3 gap-y-3`,children:[(0,K.jsxs)(`div`,{className:`flex min-w-0 flex-[1_1_260px] flex-col gap-1`,children:[(0,K.jsx)(`h2`,{id:`job-h`,className:`m-0 text-[22px] font-semibold tracking-[-0.01em] [overflow-wrap:anywhere]`,children:e.name}),(0,K.jsxs)(`span`,{className:`text-sm text-muted`,children:[q[e.kind]||e.kind,` · `,e.schedule]})]}),(0,K.jsx)(C,{tone:g.tone,children:g.label}),e.running?(0,K.jsxs)(d,{disabled:r,onClick:()=>a(`stop`),children:[(0,K.jsx)(_,{size:14,fill:`currentColor`,"aria-hidden":`true`}),`Stop`]}):(0,K.jsxs)(d,{variant:`primary`,disabled:r,onClick:()=>a(`run`),children:[(0,K.jsx)(b,{size:16,"aria-hidden":`true`}),`Run now`]})]}),(0,K.jsxs)(`div`,{className:`flex flex-wrap gap-3`,children:[(0,K.jsx)(y,{icon:p,label:`Runs kept`,value:String(o?.length??`–`)}),(0,K.jsx)(y,{icon:j,label:`Passed`,value:x?`${Math.round(v/x*100)}%`:`–`,note:x?`${v} of ${x}`:void 0}),(0,K.jsx)(y,{icon:i,label:`Next run`,value:e.nextAt?new Date(e.nextAt).toLocaleTimeString([],{hour:`numeric`,minute:`2-digit`}):`–`,note:e.nextAt?Y(e.nextAt):e.enabled?void 0:`Disabled`})]}),(0,K.jsxs)(`div`,{className:`flex flex-col`,children:[(0,K.jsx)($,{icon:E,label:`Runs`,children:(0,K.jsx)(D,{text:`\`${e.command.replace(/`/g,``)}\``,className:`text-sm [&_p]:my-0`})}),(0,K.jsx)($,{icon:i,label:`When`,children:e.schedule}),(0,K.jsx)($,{icon:B,label:`Enabled`,children:(0,K.jsx)(n,{checked:e.enabled,disabled:r,onChange:e=>a(e?`enable`:`disable`),label:`${e.name} enabled`})}),(0,K.jsxs)($,{icon:W,label:`Stopped after`,children:[e.timeoutMs?e.timeoutMs%36e5==0?`${e.timeoutMs/36e5} hour${e.timeoutMs===36e5?``:`s`}`:`${Math.round(e.timeoutMs/6e4)} minutes`:`the service's default`,` of running`]}),(0,K.jsx)($,{icon:T,label:`Tells the team`,children:e.notify?`When it fails, recovers or ends (the notify channels that take job events)`:e.kind===`monitor`?`The monitor sends its own alerts`:`No`}),(0,K.jsx)($,{icon:H,label:`Investigates failures`,children:e.investigate?`Yes, on branches of their own`:`No`}),(0,K.jsxs)($,{icon:R,label:`Added`,children:[Y(e.createdAt),` `,e.by===`agent`?`by ForgeQE's agent, after you agreed`:`from the command line or here`]})]}),e.monitor&&(0,K.jsx)(ee,{m:e.monitor,rounds:t}),(0,K.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,K.jsx)(`h3`,{className:`m-0 mb-1 text-base font-semibold`,children:`Runs`}),o?o.length===0?(0,K.jsx)(`p`,{className:`m-0 border-t border-line-soft py-3 text-sm text-muted`,children:`No runs yet. Run now starts one.`}):(0,K.jsx)(`ul`,{className:`m-0 list-none p-0`,children:o.map(t=>(0,K.jsxs)(`li`,{className:`border-t border-line-soft`,children:[(0,K.jsxs)(`button`,{type:`button`,"aria-expanded":l===t.id,onClick:()=>u(l===t.id?null:t.id),className:`flex min-h-[52px] w-full cursor-pointer items-center gap-3 border-0 bg-transparent px-1 py-2 text-left text-ink hover:bg-surface-muted`,children:[(0,K.jsx)(C,{tone:J[t.status].tone,children:J[t.status].label}),(0,K.jsxs)(`span`,{className:`min-w-0 flex-1 truncate text-sm`,children:[Y(t.startedAt),(0,K.jsxs)(`span`,{className:`text-muted`,children:[` `,`· `,t.reason===`asked`?`asked for`:`scheduled`,X(t)?` · ${X(t)}`:``]})]}),t.summary?.length?(0,K.jsx)(`span`,{className:`hidden max-w-[40%] truncate text-[13px] text-muted sm:inline`,children:t.summary.at(-1)}):null]}),l===t.id&&(0,K.jsx)(`div`,{className:`pb-3`,children:(0,K.jsx)(te,{jobId:e.id,run:t})})]},t.id))}):(0,K.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`Loading…`})]}),(0,K.jsx)(`div`,{className:`flex flex-wrap items-center gap-2 border-t border-line-soft pt-4`,children:f?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`span`,{className:`text-sm text-ink-2`,children:[`Remove `,e.name,`? Its runs and logs go with it.`]}),(0,K.jsx)(d,{disabled:r,onClick:()=>a(`remove`),className:`border-fail text-fail hover:bg-fail-soft`,children:`Remove`}),(0,K.jsx)(d,{onClick:()=>m(!1),children:`Keep it`})]}):(0,K.jsxs)(d,{variant:`ghost`,onClick:()=>m(!0),className:`text-fail`,children:[(0,K.jsx)(A,{size:16,"aria-hidden":`true`}),`Remove this job`]})})]})}function re({open:t,onClose:r,commands:i,initial:s,onAdded:l}){let[u,f]=(0,G.useState)(``),[p,m]=(0,G.useState)(`suite`),[h,g]=(0,G.useState)(``),[_,v]=(0,G.useState)(`every`),[y,b]=(0,G.useState)(`30m`),[x,S]=(0,G.useState)(`0 2 * * 1-5`),[C,w]=(0,G.useState)(!0),[T,E]=(0,G.useState)(``),[D,O]=(0,G.useState)(!1);(0,G.useEffect)(()=>{t&&(f(s?.name??``),m(s?.command??`suite`),g(s?.args??``),v(`every`),b(s?.every??`30m`),w(s?.command!==`monitor`),E(``))},[t,s]);let k=async()=>{O(!0),E(``);try{l(await c.add({name:u.trim(),command:p,args:h,..._===`every`?{every:y}:_===`cron`?{cron:x}:{now:!0},notify:C}),u.trim())}catch(e){E(e.message)}finally{O(!1)}},A=`flex flex-col gap-1.5 py-3`;return(0,K.jsx)(e,{open:t,onClose:r,title:`Add a job`,description:`A ForgeQE command the jobs service runs on a schedule, or once now, in a process of its own; it keeps going with this page closed.`,footer:(0,K.jsxs)(K.Fragment,{children:[T&&(0,K.jsx)(`span`,{role:`alert`,className:`mr-auto self-center text-sm text-fail [overflow-wrap:anywhere]`,children:T}),(0,K.jsx)(d,{onClick:r,children:`Cancel`}),(0,K.jsx)(d,{variant:`primary`,disabled:D||!u.trim(),onClick:()=>void k(),children:D?`Adding…`:`Add job`})]}),children:(0,K.jsxs)(`div`,{className:`flex flex-col pt-3`,children:[(0,K.jsxs)(`div`,{className:A,children:[(0,K.jsx)(`label`,{htmlFor:`job-name`,className:`font-medium`,children:`Name`}),(0,K.jsx)(a,{id:`job-name`,value:u,spellCheck:!1,placeholder:`nightly-smoke`,onChange:e=>f(e.target.value)}),(0,K.jsx)(`span`,{className:`text-sm text-muted`,children:`Letters, digits and dashes.`})]}),(0,K.jsxs)(`div`,{className:A,children:[(0,K.jsx)(`label`,{htmlFor:`job-command`,className:`font-medium`,children:`Runs`}),(0,K.jsx)(o,{id:`job-command`,value:p,onChange:e=>m(e.target.value),children:i.map(e=>(0,K.jsxs)(`option`,{value:e,children:[`forgeqe `,e]},e))})]}),(0,K.jsxs)(`div`,{className:A,children:[(0,K.jsx)(`label`,{htmlFor:`job-args`,className:`font-medium`,children:`With`}),(0,K.jsx)(a,{id:`job-args`,value:h,spellCheck:!1,placeholder:p===`monitor`?`Empty: the checks in forgeqe.yaml`:`checks/smoke.yaml --parallel 2`,onChange:e=>g(e.target.value),className:`font-mono text-[13px]`}),(0,K.jsx)(`span`,{className:`text-sm text-muted`,children:`Test case sources and flags, as you would type them after the command. "…" keeps spaces in one. Nothing goes through a shell.`})]}),(0,K.jsxs)(`fieldset`,{className:`m-0 flex flex-col gap-2 border-0 p-0 py-3`,children:[(0,K.jsx)(`legend`,{className:`mb-1 font-medium`,children:`When`}),[[`every`,`Every`],[`cron`,`On a schedule (cron, this machine's time)`],[`once`,`Once, now`]].map(([e,t])=>(0,K.jsxs)(`label`,{className:`flex min-h-10 cursor-pointer items-center gap-3`,children:[(0,K.jsx)(`input`,{type:`radio`,name:`job-when`,checked:_===e,onChange:()=>v(e),className:`size-4 accent-accent`}),(0,K.jsx)(`span`,{className:`flex-none`,children:t}),e===`every`&&_===`every`&&(0,K.jsx)(a,{"aria-label":`Every`,value:y,onChange:e=>b(e.target.value),placeholder:`30m`,className:`max-w-[120px] font-mono text-[13px]`}),e===`cron`&&_===`cron`&&(0,K.jsx)(a,{"aria-label":`Cron schedule`,value:x,onChange:e=>S(e.target.value),className:`max-w-[180px] font-mono text-[13px]`})]},e))]}),(0,K.jsxs)(`div`,{className:`flex items-center gap-4 py-3`,children:[(0,K.jsxs)(`span`,{className:`flex flex-1 flex-col gap-0.5`,children:[(0,K.jsx)(`span`,{className:`font-medium`,children:`Tell the team`}),(0,K.jsx)(`span`,{className:`text-sm text-muted`,children:`When it fails, recovers or ends, on the notify channels that take job events. A monitor sends its own alerts.`})]}),(0,K.jsx)(n,{checked:C,onChange:w,label:`Tell the team`})]})]})})}function ie({sub:e}){let[n,r]=(0,G.useState)(null),[a,o]=(0,G.useState)([]),[u,f]=(0,G.useState)(``),[p,m]=(0,G.useState)(!1),[h,_]=(0,G.useState)(null),v=(0,G.useCallback)(()=>{c.list().then(e=>{r(e),f(``)},e=>f(e.message))},[]);(0,G.useEffect)(v,[v]),(0,G.useEffect)(()=>{g.list().then(e=>o(e.rows.filter(e=>e.scope===`monitor`)),()=>{})},[n?.jobs.map(e=>e.last?.id).join()]);let y=n?.jobs.some(e=>e.running);(0,G.useEffect)(()=>{let e=setInterval(v,y?3e3:2e4);return()=>clearInterval(e)},[v,y]);let b=e?decodeURIComponent(e):``,w=n?.jobs.find(e=>e.id===b)||n?.jobs[0],T=(0,G.useMemo)(()=>n?.jobs.filter(e=>e.kind===`monitor`)??[],[n]),E=(0,G.useMemo)(()=>n?.jobs.filter(e=>e.kind!==`monitor`)??[],[n]),O=async e=>{if(w){m(!0),f(``);try{r(e===`remove`?await c.remove(w.id):await c.act(w.id,e)),e===`remove`&&(location.hash=l(`jobs`))}catch(e){f(e.message)}finally{m(!1)}}},k=e=>{let n=Z(e),r=w?.id===e.id;return(0,K.jsx)(`li`,{children:(0,K.jsxs)(`a`,{href:l(`jobs`,encodeURIComponent(e.id)),"aria-current":r?`page`:void 0,className:s(`flex min-h-[60px] items-center gap-3 rounded-[12px] px-3 py-2 text-ink no-underline`,r?`bg-surface-strong hover:text-ink`:`hover:bg-surface-muted hover:text-ink`),children:[e.running?(0,K.jsx)(t,{label:n.label,px:16}):(0,K.jsx)(`span`,{"aria-label":n.label,className:s(`size-2.5 flex-none rounded-full`,Q[n.tone])}),(0,K.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,K.jsx)(`span`,{className:`truncate text-[15px] font-medium`,children:e.name}),(0,K.jsx)(`span`,{className:`truncate text-[13px] text-muted`,children:[n.label,e.schedule,e.nextAt&&e.enabled?`next ${Y(e.nextAt)}`:``].filter(Boolean).join(` · `)})]})]})},e.id)};return(0,K.jsxs)(`div`,{className:`flex min-h-screen flex-col`,children:[(0,K.jsx)(S,{}),(0,K.jsxs)(`main`,{className:`@container mx-auto box-border flex w-full max-w-[1180px] flex-auto flex-col gap-4 px-6 pt-10 pb-10`,children:[(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-2`,children:[(0,K.jsx)(x,{icon:i,size:`lg`}),(0,K.jsx)(`h1`,{className:`m-0 text-[26px] font-semibold tracking-[-0.01em]`,children:`Jobs`}),n&&(0,K.jsx)(C,{tone:n.service.running?`pass`:`neutral`,children:n.service.running?`Service running since ${Y(n.service.startedAt)}`:`Service stopped: jobs wait until it starts`}),(0,K.jsx)(`div`,{className:`flex-auto`}),(0,K.jsxs)(d,{variant:`primary`,disabled:!n,onClick:()=>_({}),children:[(0,K.jsx)(P,{size:16,"aria-hidden":`true`}),`Add a job`]})]}),(0,K.jsx)(`p`,{className:`m-0 max-w-[70ch] text-sm leading-relaxed text-muted`,children:`ForgeQE commands that run on a schedule, or once, in a service of their own, so they keep going while you work on something else or with this page closed: monitors, suites, packs and pipeline watches.`}),u&&(0,K.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:u}),!n&&!u&&(0,K.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Loading…`}),n?.monitor&&!n.monitor.scheduled&&(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-3 rounded-[14px] border border-accent-line bg-accent-soft px-4 py-3`,children:[(0,K.jsx)(M,{size:20,"aria-hidden":`true`,className:`flex-none text-accent`}),(0,K.jsxs)(`span`,{className:`flex min-w-0 flex-[1_1_300px] flex-col gap-0.5 text-sm`,children:[(0,K.jsx)(`span`,{className:`font-medium`,children:`The monitor in forgeqe.yaml is not scheduled`}),(0,K.jsxs)(`span`,{className:`text-ink-2`,children:[n.monitor.checks.length,` check`,n.monitor.checks.length===1?``:`s`,`, every `,n.monitor.every,`. As a job it runs a round each time, with this page closed.`]})]}),(0,K.jsx)(d,{onClick:()=>_({name:`monitor`,command:`monitor`,args:``,every:n.monitor.every}),children:`Schedule it`})]}),n&&(0,K.jsxs)(`div`,{className:`flex flex-col gap-6 @2xl:flex-row @2xl:items-start @2xl:gap-8`,children:[(0,K.jsxs)(`nav`,{"aria-label":`Jobs`,className:`flex min-w-0 flex-col gap-4 @2xl:sticky @2xl:top-6 @2xl:w-[250px] @2xl:flex-none`,children:[(0,K.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,K.jsxs)(`span`,{className:`flex items-center gap-2 px-3 text-[13px] font-medium text-muted`,children:[(0,K.jsx)(M,{size:14,"aria-hidden":`true`}),`Monitoring (`,T.length,`)`]}),T.length?(0,K.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:T.map(k)}):(0,K.jsx)(`p`,{className:`m-0 px-3 py-2 text-sm text-muted`,children:`No monitor jobs.`})]}),(0,K.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,K.jsxs)(`span`,{className:`flex items-center gap-2 px-3 text-[13px] font-medium text-muted`,children:[(0,K.jsx)(i,{size:14,"aria-hidden":`true`}),`Other jobs (`,E.length,`)`]}),E.length?(0,K.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:E.map(k)}):(0,K.jsx)(`p`,{className:`m-0 px-3 py-2 text-sm text-muted`,children:`None.`})]}),n.events.length>0&&(0,K.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,K.jsx)(`span`,{className:`px-3 text-[13px] font-medium text-muted`,children:`Recent activity`}),(0,K.jsx)(D,{text:n.events.slice(0,12).map(e=>`- \`${Y(e.at)}\` ${e.text.replace(/([\\`*_[\]<>#|~!])/g,`\\$1`)}`).join(`
3
- `),className:`px-3 text-[13px] text-ink-2 [&_li]:my-1 [&_ul]:my-0 [&_ul]:pl-4`})]})]}),w?(0,K.jsx)(ne,{job:w,rounds:a,busy:p,act:O}):(0,K.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col items-start gap-3 rounded-[18px] border border-line p-6`,children:[(0,K.jsx)(i,{size:24,"aria-hidden":`true`,className:`text-muted`}),(0,K.jsx)(`p`,{className:`m-0 max-w-[60ch] leading-relaxed text-ink-2`,children:`No jobs yet. Add one to run a suite every night, a monitor every 15 minutes, or watch a CI pipeline.`}),(0,K.jsx)(d,{onClick:()=>_({}),children:`Add a job`})]})]})]}),(0,K.jsx)(re,{open:!!h,onClose:()=>_(null),commands:n?.commands??[],initial:h??void 0,onAdded:(e,t)=>{r(e),_(null);let n=e.jobs.find(e=>e.name===t);n&&(location.hash=l(`jobs`,encodeURIComponent(n.id)))}})]})}export{ie as Jobs};
@@ -1 +0,0 @@
1
- import{N as e,Q as t,R as n,St as r,Vt as i,Y as a,Z as o,fn as s,ht as c,ln as l,m as u,p as d,q as f,qt as p,r as m,t as h,tn as g}from"./status-xNQO8J6U.js";import{i as _}from"./markdown-B1Rz6VFK.js";import{t as v}from"./external-link-D2pA4PJ0.js";import{A as y}from"./index-DuYynJ55.js";var b={name:`accessibility`,size:24,node:[[`circle`,{cx:`16`,cy:`4`,r:`1`,key:`1grugj`}],[`path`,{d:`m18 19 1-7-6 1`,key:`r0i19z`}],[`path`,{d:`m5 8 3-3 5.5 3-2.36 3.5`,key:`9ptxx2`}],[`path`,{d:`M4.24 14.5a5 5 0 0 0 6.88 6`,key:`10kmtu`}],[`path`,{d:`M13.76 17.5a5 5 0 0 0-6.88-6`,key:`2qq6rc`}]]};b.node;var x=i(b),S={name:`image-off`,size:24,node:[[`line`,{x1:`2`,x2:`22`,y1:`2`,y2:`22`,key:`a6p6uj`}],[`path`,{d:`M10.41 10.41a2 2 0 1 1-2.83-2.83`,key:`1bzlo9`}],[`line`,{x1:`13.5`,x2:`6`,y1:`13.5`,y2:`21`,key:`1q0aeu`}],[`line`,{x1:`18`,x2:`21`,y1:`12`,y2:`15`,key:`5mozeu`}],[`path`,{d:`M3.59 3.59A1.99 1.99 0 0 0 3 5v14a2 2 0 0 0 2 2h14c.55 0 1.052-.22 1.41-.59`,key:`mmje98`}],[`path`,{d:`M21 15V5a2 2 0 0 0-2-2H9`,key:`43el77`}]]};S.node;var C=i(S),w={name:`images`,size:24,node:[[`path`,{d:`m22 11-1.296-1.296a2.4 2.4 0 0 0-3.408 0L11 16`,key:`9kzy35`}],[`path`,{d:`M4 8a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2`,key:`1t0f0t`}],[`circle`,{cx:`13`,cy:`7`,r:`1`,fill:`currentColor`,key:`1obus6`}],[`rect`,{x:`8`,y:`2`,width:`14`,height:`14`,rx:`2`,key:`1gvhby`}]]};w.node;var T=i(w),E={name:`scan-eye`,size:24,node:[[`path`,{d:`M3 7V5a2 2 0 0 1 2-2h2`,key:`aa7l1z`}],[`path`,{d:`M17 3h2a2 2 0 0 1 2 2v2`,key:`4qcy5o`}],[`path`,{d:`M21 17v2a2 2 0 0 1-2 2h-2`,key:`6vwrx8`}],[`path`,{d:`M7 21H5a2 2 0 0 1-2-2v-2`,key:`ioqczr`}],[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`path`,{d:`M18.944 12.33a1 1 0 0 0 0-.66 7.5 7.5 0 0 0-13.888 0 1 1 0 0 0 0 .66 7.5 7.5 0 0 0 13.888 0`,key:`11ak4c`}]]};E.node;var D=i(E),O={name:`trending-down`,size:24,node:[[`path`,{d:`M16 17h6v-6`,key:`t6n2it`}],[`path`,{d:`m22 17-8.5-8.5-5 5L2 7`,key:`x473p`}]]};O.node;var k=i(O),A={name:`trending-up`,size:24,node:[[`path`,{d:`M16 7h6v6`,key:`box55l`}],[`path`,{d:`m22 7-8.5 8.5-5-5L2 17`,key:`1t1m79`}]]};A.node;var j=i(A),M=s(l(),1),N=o(),P=[`critical`,`serious`,`moderate`,`minor`],F={critical:`fail`,serious:`fail`,moderate:`warn`,minor:`neutral`},I=[{key:`lcp`,label:`LCP`,good:2500,poor:4e3,unit:`ms`},{key:`cls`,label:`CLS`,good:.1,poor:.25,unit:``},{key:`inp`,label:`INP`,good:200,poor:500,unit:`ms`},{key:`fcp`,label:`FCP`,good:1800,poor:3e3,unit:`ms`},{key:`ttfb`,label:`TTFB`,good:800,poor:1800,unit:`ms`},{key:`load`,label:`Load`,good:1/0,poor:1/0,unit:`ms`}],L={same:{label:`Same`,tone:`pass`},changed:{label:`Changed`,tone:`warn`},new:{label:`New baseline`,tone:`neutral`},no_baseline:{label:`No baseline`,tone:`neutral`}},R=e=>new Date(e).toLocaleString([],{month:`short`,day:`numeric`,hour:`numeric`,minute:`2-digit`}),z=(e,t)=>t?e>=1e3?`${(e/1e3).toFixed(1)}s`:`${Math.round(e)}ms`:e.toFixed(3).replace(/0+$/,``).replace(/\.$/,``),B=(e,t)=>`${e} ${t}${e===1?``:`s`}`,V=e=>{try{let t=new URL(e);return`${t.host}${t.pathname}${t.search}`}catch{return e}};function H(e){let t=[];return e.a11y&&t.push(e.a11y.failed?`${B(e.a11y.failed,`rule`)} failed`:`WCAG clean`),e.perf.over&&t.push(`${B(e.perf.over,`page`)} slow`),e.visual?.changed&&t.push(`${e.visual.changed} changed`),e.captured&&t.push(`not compared`),t.join(` · `)||`measured`}var U=e=>e.breaches?`bg-fail`:e.a11y?.critical||e.a11y?.serious||e.visual?.changed?`bg-warn`:`bg-pass`;function W({run:e,standard:t}){let n=e.report,[r,i]=(0,M.useState)(null);if(!n?.accessibility.pages)return(0,N.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`This run has no accessibility results: report.accessibility was off, or the run visited no page.`});let a=n.accessibility,o=n.breaches.filter(e=>e.kind===`accessibility`);return(0,N.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,N.jsxs)(`div`,{className:`flex flex-wrap gap-3`,children:[P.map(e=>(0,N.jsx)(d,{label:e.charAt(0).toUpperCase()+e.slice(1),value:String(a.byImpact[e]),note:`elements`},e)),(0,N.jsx)(d,{icon:y,label:`Rules passed`,value:String(a.passed.length),note:`${a.failed.length} failed · ${B(a.pages,`page`)}`})]}),(0,N.jsxs)(`p`,{className:`m-0 text-[13px] text-muted`,children:[t,` with `,n.engine||`axe`,`. `,n.budgets.accessibility?o.length?`${B(o.length,`budget`)} exceeded.`:`Within the budget.`:`No accessibility budget set: nothing fails on it (quality.budgets.accessibility).`]}),o.map((e,t)=>(0,N.jsxs)(`p`,{className:`m-0 rounded-[10px] bg-fail-soft px-3 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:[V(e.page),`: `,e.text]},t)),a.failed.length?(0,N.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:a.failed.map(t=>(0,N.jsx)(G,{f:t,examples:e.examples[t.rule]??[],open:r===t.rule,onToggle:()=>i(r===t.rule?null:t.rule)},t.rule))}):(0,N.jsx)(`p`,{className:`m-0 text-sm text-pass`,children:`No rule failed on the pages this run visited.`})]})}function G({f:e,examples:t,open:n,onToggle:r}){return(0,N.jsxs)(`li`,{className:`border-t border-line-soft first:border-t-0`,children:[(0,N.jsxs)(`button`,{type:`button`,"aria-expanded":n,onClick:r,className:`flex min-h-[56px] w-full cursor-pointer items-center gap-3 border-0 bg-transparent px-1 py-2 text-left text-ink hover:bg-surface-muted`,children:[(0,N.jsx)(h,{tone:F[e.impact],className:`w-[92px] flex-none justify-center`,children:e.impact}),(0,N.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,N.jsx)(`span`,{className:`text-sm [overflow-wrap:anywhere]`,children:e.help}),(0,N.jsxs)(`span`,{className:`truncate text-[12px] text-muted`,children:[e.rule,e.wcag?` · WCAG ${e.wcag}${e.level?` (${e.level})`:``}`:``,` · `,B(e.count,`element`),` on `,B(e.pages,`page`)]})]})]}),n&&(0,N.jsxs)(`div`,{className:`mb-3 ml-[104px] flex flex-col gap-2 text-sm max-sm:ml-2`,children:[t.length?t.map((e,t)=>(0,N.jsxs)(`div`,{className:`flex flex-col gap-1 rounded-[10px] bg-surface-muted p-2.5`,children:[(0,N.jsxs)(`span`,{className:`text-[12px] text-muted [overflow-wrap:anywhere]`,children:[V(e.page),e.target?` · ${e.target}`:``]}),e.html&&(0,N.jsx)(`code`,{className:`font-mono text-[12px] whitespace-pre-wrap text-ink-2 [overflow-wrap:anywhere]`,children:e.html})]},t)):(0,N.jsx)(`span`,{className:`text-muted`,children:`No elements were kept for this rule.`}),e.helpUrl&&_(e.helpUrl)===`web`&&(0,N.jsxs)(`a`,{href:e.helpUrl,target:`_blank`,rel:`noreferrer noopener`,className:`inline-flex items-center gap-1 self-start text-[13px]`,children:[`How to fix it `,(0,N.jsx)(v,{size:13,"aria-hidden":`true`})]})]})]})}function K({run:e}){let n=e.report;if(!n?.performance.pages.length)return(0,N.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`This run has no timings: the run visited no page.`});let r=(e,t)=>e>t.poor?`poor`:e>t.good?`needs improvement`:`good`,i={poor:`text-fail`,"needs improvement":`text-warn`,good:`text-pass`};return(0,N.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,N.jsxs)(`p`,{className:`m-0 text-[13px] text-muted`,children:[`Core Web Vitals per page against Google's thresholds: `,(0,N.jsx)(`span`,{className:`text-pass`,children:`good`}),`, `,(0,N.jsx)(`span`,{className:`text-warn`,children:`needs improvement`}),`, `,(0,N.jsx)(`span`,{className:`text-fail`,children:`poor`}),`.`,` `,n.budgets.performance?`Pages over the budget in quality.budgets.performance are marked.`:`No performance budget set: nothing fails on timings (quality.budgets.performance).`]}),(0,N.jsx)(`div`,{className:`overflow-x-auto`,children:(0,N.jsxs)(`table`,{className:`w-full min-w-[640px] border-collapse text-sm`,children:[(0,N.jsx)(`thead`,{children:(0,N.jsxs)(`tr`,{className:`text-left text-[12px] text-muted`,children:[(0,N.jsx)(`th`,{className:`py-2 pr-3 font-medium`,children:`Page`}),I.map(e=>(0,N.jsx)(`th`,{className:`px-2 py-2 text-right font-medium`,children:e.label},e.key)),(0,N.jsx)(`th`,{className:`py-2 pl-2 text-right font-medium`,children:`Requests`})]})}),(0,N.jsx)(`tbody`,{children:n.performance.pages.map((e,n)=>(0,N.jsxs)(`tr`,{className:`border-t border-line-soft align-top`,children:[(0,N.jsxs)(`td`,{className:`py-2 pr-3`,children:[(0,N.jsx)(`span`,{className:`block font-mono text-[12px] [overflow-wrap:anywhere]`,children:V(e.url)}),e.over.length>0&&(0,N.jsx)(`span`,{className:`text-[12px] text-fail`,children:e.over.join(`, `)})]}),I.map(n=>{let a=e[n.key];return(0,N.jsxs)(`td`,{className:t(`px-2 py-2 text-right tabular-nums`,typeof a==`number`&&n.good!==1/0?i[r(a,n)]:typeof a==`number`?`text-ink-2`:`text-muted`),children:[typeof a==`number`?z(a,n.unit):`–`,typeof a==`number`&&n.good!==1/0&&(0,N.jsxs)(`span`,{className:`sr-only`,children:[` (`,r(a,n),`)`]})]},n.key)}),(0,N.jsx)(`td`,{className:`py-2 pl-2 text-right text-muted tabular-nums`,children:e.requests?`${e.requests} · ${e.kb} KB`:`–`})]},n))})]})})]})}function q({run:e,index:t,which:n,label:r}){let[i,a]=(0,M.useState)(``),[o,s]=(0,M.useState)(!1);return(0,M.useEffect)(()=>{let r=!1;return a(``),s(!1),g.image(e,t,n).then(e=>!r&&a(e),()=>!r&&s(!0)),()=>{r=!0}},[e,t,n]),(0,N.jsxs)(`figure`,{className:`m-0 flex min-w-0 flex-col gap-1.5`,children:[(0,N.jsx)(`figcaption`,{className:`text-[12px] font-medium text-muted`,children:r}),i?(0,N.jsx)(`img`,{src:i,alt:`${r} of the page`,className:`block h-auto w-full rounded-[10px] border border-line-soft bg-surface-muted`}):(0,N.jsx)(`span`,{className:`flex h-[120px] items-center justify-center gap-2 rounded-[10px] border border-line-soft bg-surface-muted text-[12px] text-muted`,children:o?(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(C,{size:14,"aria-hidden":`true`}),` Not available`]}):`Loading…`})]})}function J({run:n,budget:r,onChange:i}){let[o,s]=(0,M.useState)(null),[c,l]=(0,M.useState)(``),[u,d]=(0,M.useState)(!1),[f,p]=(0,M.useState)(``),[m,_]=(0,M.useState)(null),v=n.visual?.pages??[],b=v.find(e=>e.status===`changed`)?.index??null;(0,M.useEffect)(()=>_(b),[n.id,b]);let x=async e=>{d(!0),p(``);try{i(await e()),s(null),l(``)}catch(e){p(e.message)}finally{d(!1)}};if(!n.visual)return n.captured?(0,N.jsxs)(`div`,{className:`flex flex-col items-start gap-3`,children:[(0,N.jsxs)(`p`,{className:`m-0 text-sm text-ink-2`,children:[`This run captured `,B(n.captured,`page`),` but they were not compared with the baselines yet.`]}),(0,N.jsxs)(a,{variant:`primary`,disabled:u,onClick:()=>x(()=>g.compare(n.id)),children:[(0,N.jsx)(D,{size:16,"aria-hidden":`true`}),`Compare with the baselines`]}),f&&(0,N.jsx)(`p`,{className:`m-0 text-sm text-fail`,children:f})]}):(0,N.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`This run has no visual captures: quality.visual.enabled was off, or the run visited no page.`});let S=v.filter(e=>e.status===`changed`);return(0,N.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,N.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,N.jsxs)(`p`,{className:`m-0 flex-1 text-[13px] text-muted`,children:[`Each page captured with animations frozen and masked regions hidden, against its approved baseline. `,r?`A page over quality.budgets.visual fails the run.`:`No visual budget set: a change does not fail the run (quality.budgets.visual).`]}),S.length>1&&(0,N.jsxs)(a,{disabled:u,onClick:()=>s(S.map(e=>e.url)),children:[`Approve all `,S.length,` changes`]})]}),o&&(0,N.jsxs)(`div`,{role:`alertdialog`,"aria-label":`Approve as baseline`,className:`flex flex-col gap-3 rounded-[12px] border border-accent-line bg-accent-soft p-4`,children:[(0,N.jsxs)(`span`,{className:`font-medium`,children:[`Make this run's capture the baseline of `,o.length===1?V(o[0]):B(o.length,`page`),`?`]}),(0,N.jsx)(`span`,{className:`text-sm text-ink-2`,children:`Later runs are compared with it. Approve only a change that was intended; one that was not is a visual defect.`}),(0,N.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm`,children:[`Why it changed (kept with the baseline)`,(0,N.jsx)(e,{value:c,maxLength:300,placeholder:`New checkout banner`,onChange:e=>l(e.target.value),className:`max-w-[480px] bg-bg`})]}),(0,N.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,N.jsxs)(a,{variant:`primary`,disabled:u,onClick:()=>x(()=>g.approve(n.id,o,c.trim()||void 0)),children:[(0,N.jsx)(y,{size:16,"aria-hidden":`true`}),`Approve`]}),(0,N.jsx)(a,{onClick:()=>s(null),children:`Cancel`})]})]}),f&&(0,N.jsx)(`p`,{className:`m-0 text-sm text-fail`,children:f}),(0,N.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:v.map(e=>(0,N.jsxs)(`li`,{className:`border-t border-line-soft first:border-t-0`,children:[(0,N.jsxs)(`button`,{type:`button`,"aria-expanded":m===e.index,onClick:()=>_(m===e.index?null:e.index),className:`flex min-h-[52px] w-full cursor-pointer items-center gap-3 border-0 bg-transparent px-1 py-2 text-left text-ink hover:bg-surface-muted`,children:[(0,N.jsx)(T,{size:16,"aria-hidden":`true`,className:`flex-none text-muted`}),(0,N.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,N.jsx)(`span`,{className:`text-sm [overflow-wrap:anywhere]`,children:e.title||V(e.url)}),(0,N.jsxs)(`span`,{className:`truncate text-[12px] text-muted`,children:[V(e.url),e.size?` · ${e.size}`:``,e.resized?` · resized ${e.resized}`:``]})]}),e.status===`changed`&&(0,N.jsxs)(`span`,{className:t(`text-sm tabular-nums`,e.over?`text-fail`:`text-warn`),children:[e.diffPercent,`%`,e.limit===void 0?``:` / ${e.limit}%`]}),(0,N.jsx)(h,{tone:e.over?`fail`:L[e.status].tone,children:e.over?`Over budget`:L[e.status].label})]}),m===e.index&&(0,N.jsxs)(`div`,{className:`mb-4 flex flex-col gap-3 px-1`,children:[(0,N.jsxs)(`div`,{className:`grid grid-cols-[repeat(auto-fit,minmax(160px,1fr))] gap-3`,children:[e.images.baseline&&(0,N.jsx)(q,{run:n.id,index:e.index,which:`baseline`,label:`Baseline`}),e.images.current&&(0,N.jsx)(q,{run:n.id,index:e.index,which:`current`,label:`This run`}),e.images.diff&&(0,N.jsx)(q,{run:n.id,index:e.index,which:`diff`,label:`Difference (in red)`})]}),e.status===`changed`&&(0,N.jsxs)(a,{className:`self-start`,disabled:u,onClick:()=>s([e.url]),children:[(0,N.jsx)(y,{size:16,"aria-hidden":`true`}),`Approve as the new baseline`]})]})]},e.index))})]})}function Y({values:e}){if(e.length<2)return null;let t=Math.max(1,...e),n=e.map((n,r)=>`${r/(e.length-1)*96+2},${22-n/t*20}`).join(` `);return(0,N.jsx)(`svg`,{width:`100`,height:`24`,viewBox:`0 0 100 24`,"aria-label":`Violations over the last ${e.length} runs: ${e.join(`, `)}`,role:`img`,className:`flex-none text-muted`,children:(0,N.jsx)(`polyline`,{points:n,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinejoin:`round`})})}function X({icon:e,className:n,lines:r}){return r.length?(0,N.jsxs)(`span`,{className:t(`flex items-start gap-1.5 text-[13px]`,n),children:[(0,N.jsx)(e,{size:14,"aria-hidden":`true`,className:`mt-0.5 flex-none`}),(0,N.jsx)(`span`,{className:`[overflow-wrap:anywhere]`,children:r.join(` · `)})]}):null}function Z({trends:e}){return e.length?(0,N.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:e.map(e=>{let t=e.a11y.latest?P.reduce((t,n)=>t+(e.a11y.latest[n]||0),0):void 0;return(0,N.jsxs)(`li`,{className:`flex flex-col gap-1.5 border-t border-line-soft py-3 first:border-t-0`,children:[(0,N.jsxs)(`span`,{className:`flex min-w-0 flex-wrap items-center gap-3`,children:[(0,N.jsx)(`span`,{className:`min-w-0 flex-[1_1_240px] font-mono text-[13px] [overflow-wrap:anywhere]`,children:e.page}),(0,N.jsx)(Y,{values:e.a11y.trail}),(0,N.jsxs)(`span`,{className:`text-[12px] text-muted`,children:[B(e.runs,`run`),t===void 0?``:` · ${B(t,`violation`)} now`]})]}),(0,N.jsx)(X,{icon:j,className:`text-fail`,lines:[...e.perf.worse.map(e=>`slower: ${e}`),...e.a11y.newRules.map(e=>`newly failing: ${e}`)]}),(0,N.jsx)(X,{icon:k,className:`text-pass`,lines:[...e.perf.better.map(e=>`faster: ${e}`),...e.a11y.fixedRules.map(e=>`fixed: ${e}`)]})]},e.page)})}):(0,N.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`No history yet: every browser run adds each page's accessibility and timings to quality-history.json in the reports folder.`})}function Q({id:e,view:t,onChanged:r}){let[i,o]=(0,M.useState)(null),[s,l]=(0,M.useState)(``),[d,f]=(0,M.useState)(`accessibility`),[m,h]=(0,M.useState)(``);if((0,M.useEffect)(()=>{let t=!1;return o(null),g.run(e).then(e=>{if(t)return;o(e),l(``);let n=e.visual?.pages.some(e=>e.status===`changed`)||!e.visual&&e.captured;f(e.report?.breaches.some(e=>e.kind===`performance`)&&!e.report.accessibility.failed.length?`performance`:n&&!e.report?.accessibility.failed.length?`visual`:e.report?.accessibility.pages?`accessibility`:e.report?.performance.pages.length?`performance`:`visual`)},e=>!t&&l(e.message)),()=>{t=!0}},[e]),s)return(0,N.jsx)(`p`,{className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail`,children:s});if(!i)return(0,N.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`Loading…`});let _=async()=>{try{let{id:e}=await p.start(`Explain the accessibility, performance and visual results of the run in ${i.dir}: call quality_report and visual_compare with run_dir ${i.dir}. Say what matters most to fix first, and why.`,{});location.hash=n(`chats`,e)}catch(e){h(e.message)}},v={accessibility:i.report?.accessibility.failed.length??0,performance:i.report?.performance.pages.filter(e=>e.over.length).length??0,visual:i.visual?.pages.filter(e=>e.status===`changed`).length??0};return(0,N.jsxs)(`section`,{"aria-labelledby":`run-h`,className:`flex min-w-0 flex-1 flex-col gap-4`,children:[(0,N.jsxs)(`div`,{className:`flex flex-wrap items-start gap-3`,children:[(0,N.jsxs)(`div`,{className:`flex min-w-0 flex-[1_1_260px] flex-col gap-1`,children:[(0,N.jsx)(`h2`,{id:`run-h`,className:`m-0 text-[22px] font-semibold tracking-[-0.01em] [overflow-wrap:anywhere]`,children:i.goal}),(0,N.jsxs)(`span`,{className:`text-sm text-muted [overflow-wrap:anywhere]`,children:[R(i.at),` · `,(0,N.jsx)(`span`,{className:`font-mono text-[12px]`,children:i.dir})]})]}),(0,N.jsxs)(a,{variant:`ghost`,onClick:()=>void _(),children:[(0,N.jsx)(c,{size:16,"aria-hidden":`true`}),`Ask in a chat`]})]}),m&&(0,N.jsx)(`p`,{className:`m-0 text-sm text-fail`,children:m}),(0,N.jsxs)(`div`,{children:[(0,N.jsx)(u,{label:`Results`,current:d,onPick:f,tabs:[{id:`accessibility`,label:`Accessibility${v.accessibility?` (${v.accessibility})`:``}`},{id:`performance`,label:`Performance${v.performance?` (${v.performance})`:``}`},{id:`visual`,label:`Visual${v.visual?` (${v.visual})`:``}`}]}),(0,N.jsxs)(`div`,{role:`tabpanel`,id:`panel-${d}`,"aria-labelledby":`tab-${d}`,children:[d===`accessibility`&&(0,N.jsx)(W,{run:i,standard:t.standard}),d===`performance`&&(0,N.jsx)(K,{run:i}),d===`visual`&&(0,N.jsx)(J,{run:i,budget:t.budgets.visual,onChange:e=>{o(e),r()}})]})]}),d===`accessibility`&&i.report?.accessibility.pages?(0,N.jsx)(`p`,{className:`m-0 text-[12px] text-muted`,children:t.disclaimer}):null]})}function $({sub:e}){let[i,a]=(0,M.useState)(null),[o,s]=(0,M.useState)(``),[c,l]=(0,M.useState)(e===`trends`?`trends`:`runs`),d=(0,M.useCallback)(()=>{g.view().then(e=>{a(e),s(``)},e=>s(e.message))},[]);(0,M.useEffect)(d,[d]);let p=e&&e!==`trends`?decodeURIComponent(e):``;(0,M.useEffect)(()=>{e===`trends`?l(`trends`):e&&l(`runs`)},[e]);let h=(0,M.useMemo)(()=>i?.runs.find(e=>e.id===p)||i?.runs[0],[i,p]),_=i?.trends.filter(e=>e.perf.worse.length||e.a11y.newRules.length).length??0;return(0,N.jsxs)(`div`,{className:`flex min-h-screen flex-col`,children:[(0,N.jsx)(m,{}),(0,N.jsxs)(`main`,{className:`@container mx-auto box-border flex w-full max-w-[1180px] flex-auto flex-col gap-4 px-6 pt-10 pb-10`,children:[(0,N.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,N.jsx)(f,{icon:r,size:`lg`}),(0,N.jsx)(`h1`,{className:`m-0 flex-1 text-[26px] font-semibold tracking-[-0.01em]`,children:`Quality`})]}),(0,N.jsxs)(`p`,{className:`m-0 max-w-[74ch] text-sm leading-relaxed text-muted`,children:[`What every browser run measures beside its steps: accessibility against `,i?.standard||`WCAG`,`, Core Web Vitals, and each page against its approved visual baseline. Budgets in forgeqe.yaml (quality.budgets) decide what fails a run.`]}),o&&(0,N.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:o}),!i&&!o&&(0,N.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Loading…`}),i&&(0,N.jsx)(u,{label:`Quality`,current:c,onPick:e=>{l(e),e===`trends`?location.hash=n(`quality`,`trends`):location.hash=h?n(`quality`,encodeURIComponent(h.id)):n(`quality`)},tabs:[{id:`runs`,label:`Runs (${i.runs.length})`},{id:`trends`,label:`Trends${_?` (${_} worse)`:``}`}]}),i&&c===`trends`&&(0,N.jsx)(`div`,{role:`tabpanel`,id:`panel-trends`,"aria-labelledby":`tab-trends`,children:(0,N.jsx)(Z,{trends:i.trends})}),i&&c===`runs`&&(i.runs.length?(0,N.jsxs)(`div`,{role:`tabpanel`,id:`panel-runs`,"aria-labelledby":`tab-runs`,className:`flex flex-col gap-6 @2xl:flex-row @2xl:items-start @2xl:gap-8`,children:[(0,N.jsx)(`nav`,{"aria-label":`Runs`,className:`flex min-w-0 flex-col gap-1 @2xl:sticky @2xl:top-6 @2xl:w-[250px] @2xl:flex-none`,children:(0,N.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:i.runs.map(e=>(0,N.jsx)(`li`,{children:(0,N.jsxs)(`a`,{href:n(`quality`,encodeURIComponent(e.id)),"aria-current":h?.id===e.id?`page`:void 0,className:t(`flex min-h-[60px] items-center gap-3 rounded-[12px] px-3 py-2 text-ink no-underline`,h?.id===e.id?`bg-surface-strong hover:text-ink`:`hover:bg-surface-muted hover:text-ink`),children:[(0,N.jsx)(`span`,{className:t(`size-2.5 flex-none rounded-full`,U(e)),"aria-label":e.breaches?`over budget`:`within budgets`}),(0,N.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,N.jsx)(`span`,{className:`truncate text-[15px] font-medium`,children:e.goal}),(0,N.jsxs)(`span`,{className:`truncate text-[13px] text-muted`,children:[R(e.at),` · `,H(e)]})]})]})},e.id))})}),h&&(0,N.jsx)(Q,{id:h.id,view:i,onChanged:d})]}):(0,N.jsxs)(`div`,{className:`flex flex-col items-start gap-3 rounded-[18px] border border-line p-6`,children:[(0,N.jsx)(x,{size:24,"aria-hidden":`true`,className:`text-muted`}),(0,N.jsx)(`p`,{className:`m-0 max-w-[62ch] leading-relaxed text-ink-2`,children:`No run has measured anything yet. Every browser run checks accessibility, timings and visual changes of the pages it visits; run a flow from a chat or the Record page, and its results show here.`})]}))]})]})}export{$ as Quality};