EnergyVenom commited on
Commit
a73107f
·
verified ·
1 Parent(s): f9c7101

Deploy Patch Testing Co-worker

Browse files
docs/design/UI-REVIEW-1.md ADDED
@@ -0,0 +1,228 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # UI review 1: steps 1 and 2 of UI-REDESIGN.md
2
+
3
+ Reviewed: commits `c155a92` (step 1, tokens and shell) and `d1035cc` (step 2, run workspace and side panel), against
4
+ `docs/design/UI-REDESIGN.md`. Basis: the developer's screenshots (`shots/step1/*`, `shots/step2/*` at 1440x900, 1100x800 and 390x844,
5
+ light and dark) and the code in `web/src/components/shell/*`, `pages/RunWorkspace.tsx`, `pages/RunStage.tsx`, `pages/AssistantPage.tsx`
6
+ and `styles.css`. I did not edit product code.
7
+
8
+ Overall: the structure matches the spec. Shell, runs-as-conversations sidebar, env switcher, stage card with `run-guide`, team strip,
9
+ composer with Team note, the five-tab panel, detail views and the "All details" menu are all in place. The desktop light theme reads
10
+ calm and clear. What remains is mostly **dark-mode primary buttons**, **top-bar height on phone and laptop**, and **what the panel shows
11
+ for quick simulations**.
12
+
13
+ Priorities: **must-fix** blocks sign-off of step 2. **Should-fix** goes in before step 3 starts. **Nice** can go in any later step.
14
+
15
+ ---
16
+
17
+ ## Must-fix
18
+
19
+ ### M1. Primary (filled ink) buttons are dark on dark in the dark theme
20
+
21
+ - **Where:** every Mantine `Button variant="filled"` in dark mode. Examples:
22
+ - `readiness-laptop-dark`: top-bar "New test run", "Open your review".
23
+ - `ws-judge-desktop-dark`: "Submit my decision".
24
+ - `ws-result-phone-dark`: "Open the report and sign off".
25
+ - `ws-result-desktop-dark`: "Open the report and sign off".
26
+ The custom sidebar "New test run" is correct (light pill). The bug was already in the old app, but step 1 owns the tokens.
27
+ - **Wrong vs spec:** section 4.1 says `--fpt-ink` is `#eef2f0` with `--fpt-ink-text` `#111111` in dark, so primary buttons are light pills.
28
+ The overrides in `styles.css` (`[data-mantine-color-scheme='dark'] { --mantine-color-ink-filled: #eef2f0; ... }`) lose to the
29
+ variables MantineProvider injects under `:root[data-mantine-color-scheme="dark"]`, which has higher specificity.
30
+ - **Fix:**
31
+ - Change the selector of the dark block that sets the `--mantine-color-ink-*` and `--mantine-color-body` overrides to
32
+ `:root[data-mantine-color-scheme='dark']`. Keep the other `--fpt-*` tokens where they are, or move them too.
33
+ - Apply the same selector change to the `.mantine-Button-root[data-variant='filled'] … --button-color: #111111` rule and to the
34
+ Checkbox/Radio icon rules.
35
+ - Check with the 5 screenshots above that every filled button is a light pill with dark text in dark mode, and that the result is
36
+ >= 4.5:1.
37
+
38
+ ### M2. Phone run top bar is about 160px high and the sub-line collides
39
+
40
+ - **Where:** `ws-approve-phone-light`, `ws-result-phone-dark`, `ws-judge-phone-*`.
41
+ - **What happens:** five lines stack before the conversation starts:
42
+ 1. title;
43
+ 2. environment pill;
44
+ 3. "Mock app, not Oracle Fusion" + "Quick simulation (no browser)" on a wrapped line;
45
+ 4. `ref` on its own line;
46
+ 5. an actions row, then the state chip on yet another row.
47
+
48
+ In the dark result screenshot a horizontal rule is drawn through "Quick simulation (no browser)" (the sub-line overflows its box).
49
+ The conversation gets less than half of the 844px height.
50
+ - **Wrong vs spec:** section 2.2/2.5 asks for a 48px phone top bar: title plus one sub-line. The developer's stated deviation ("phone run
51
+ top bar taller than 48px") is accepted only up to **2 rows, max 76px**. See the verdicts.
52
+ - **Fix (phone, < 768px, run routes):**
53
+ - **Row 1 (32px):** the title (one line, ellipsis), then the 36px "Panel" icon button, then a 36px "More" icon button
54
+ (`IconDots`, aria-label "More actions for this test run"). The More button opens a `Menu` with:
55
+ - the full "All details" item list;
56
+ - "Copy reference id";
57
+ - "Cancel test run" / "Resume" (with the same `run.control` checks);
58
+ - "What do these words mean?".
59
+ - **Row 2 (28px, `overflow-x: auto`, no wrap):**
60
+ - the **state chip**;
61
+ - a single merged honesty pill "Practice environment · Mock app, not Oracle Fusion" (Fusion runs: "Oracle Fusion pod · <name>");
62
+ - the `ref` pill (`data-testid="run-id"`, kept in the DOM).
63
+
64
+ Drop the separate "Quick simulation (no browser)" text on phone. The panel and the Live tab already say it.
65
+ - **Remove the "Ask" button from the phone top bar.** The bottom bar owns Ask. This corrects my own spec, which said "tablet/phone":
66
+ it should say **tablet only**.
67
+ - The glossary icon goes into the More menu on phone.
68
+ - `data-testid="all-details"` stays on the desktop/tablet button. The phone More menu uses `data-testid="all-details-phone"`. e2e runs
69
+ on desktop.
70
+
71
+ ### M3. For quick simulations the panel opens on an empty Live tab, also on finished runs
72
+
73
+ - **Where:** every quick-simulation screenshot: `ws-approve-*`, `ws-judge-*`, `ws-result-desktop-light` (Report has a red dot but Live is
74
+ shown), `*-sheet-phone-*`.
75
+ - **Wrong vs spec:** the auto-switch rules in section 2.6 only fire on a transition, so a run opened after it finished keeps the persisted
76
+ tab (Live). That gap is in my spec. The result is that 440px of every quick-simulation screen says "nothing to watch".
77
+ - **Fix (add to `RunWorkspace` / `SidePanel`): an initial tab rule on opening a run.** When the run id changes, and only if the URL does
78
+ not name a tab (`/live`, `/proof`, `/script`) and the person has not chosen a tab in this run before, pick the tab by state:
79
+ - `completed` → **Report**.
80
+ - `waiting_review` → **Screens** filtered to failed for browser runs, otherwise **Steps** with the first pending failure's `case_id`
81
+ as `?scenario`.
82
+ - `waiting_approval` → **Steps** with the first AI-written pending scenario, otherwise the first changed one. If neither exists,
83
+ **Excel**.
84
+ - `queued` / `running` → **Live** for browser runs with live view, otherwise **Excel**.
85
+ - stopped → **Report** (it shows its "appears when finished" empty state) for quick simulations, **Screens** for browser runs.
86
+
87
+ Remember "chose a tab in this run" in memory only (per run id, for the session). Do not persist it. The saved `panel.tab` stays
88
+ the fallback for routes that are not runs.
89
+
90
+ ### M4. "See the failed screen" is offered for quick simulations, which have no screen
91
+
92
+ - **Where:** `ws-judge-desktop-dark`, `ws-judge-phone-*`. A quick-simulation failure shows the "See the failed screen" link under We
93
+ expected / What happened.
94
+ - **Wrong vs spec:** section 3.1.2 point 5 and 3.4. For quick simulations the screen column shows the empty state "Quick simulations don't
95
+ open a browser, so there is no screen". It must never be a link to nothing.
96
+ - **Fix:** render the link only when `r.playwright_mode !== 'stub'`. For stub runs show nothing in that spot. The Steps link is still
97
+ useful: replace it with "Show the steps" (sets `?scenario`, opens Steps).
98
+
99
+ ---
100
+
101
+ ## Should-fix
102
+
103
+ ### S1. Desktop and laptop run top bar has 3 rows (about 90px, laptop about 115px)
104
+
105
+ - **Where:** `ws-*-desktop-*` (title / sub-line / chip+actions), `ws-approve-laptop-light` (`ref` wraps onto a 4th line).
106
+ - **Spec:** 52px, three zones on one row.
107
+ - **Fix, accepting two rows:** max **64px** desktop, **68px** laptop.
108
+ - **Row 1:** the title, then the **state chip and decision badges inline right after the title** (same baseline). The actions
109
+ (glossary, All details, Cancel/Resume, panel toggle) are right-aligned on this row.
110
+ - **Row 2:** the sub-line (env pill · run type · `ref`) with `flex-wrap: nowrap`. The run-type text gets
111
+ `min-width: 0; overflow: hidden; text-overflow: ellipsis`, so `ref` never wraps.
112
+ - Update UI-REDESIGN 2.5 to say "52px for single-line pages, up to 64px for run pages".
113
+
114
+ ### S2. The detail-view sub-header uses two rows and repeats the view name
115
+
116
+ - **Where:** `ws-detail-activity-*`. Row 1 has "← Conversation Activity log"; row 2 has the switcher with "More: Activity log".
117
+ - **Spec:** section 3.1.3 asks for one 40px row with `[<- Conversation]` and the view switcher.
118
+ - **Fix:** one row with `[<- Conversation]` on the left and the pill switcher on the right. Remove the separate "Activity log" title: the
119
+ active pill ("More: Activity log") already names it. Below 768px the switcher scrolls horizontally on the same row.
120
+
121
+ ### S3. The Mantine focus ring is near-black, not `--fpt-focus`
122
+
123
+ - **Where:** `ws-approve-desktop-light`, `ws-approve-laptop-light`. The programmatically focused "Approve all 79" button shows a thick
124
+ black double ring on page load.
125
+ - **Cause:** Mantine's `.mantine-focus-auto:focus-visible` uses `--mantine-primary-color-filled` (ink). It wins over our `:focus-visible`.
126
+ - **Fix:**
127
+
128
+ ```css
129
+ .mantine-focus-auto:focus-visible, .mantine-focus-always:focus { outline: 2px solid var(--fpt-focus); outline-offset: 2px; }
130
+ ```
131
+
132
+ Keep the stage-change focus behaviour. It matches the spec: focus moves on a stage change when focus was on `body`/thread.
133
+
134
+ Also do not move focus on the **first render of an already-waiting run**. Only move it on a real stage *change* seen while the page
135
+ is open. Opening a run should leave focus at the top (skip link / title), so screen-reader users start from the title.
136
+
137
+ ### S4. Phone composer: the Command / Team note toggle squeezes the input to about 170px
138
+
139
+ - **Where:** `ws-*-phone-*`. The placeholder is cut to "Tell the co-worker wh".
140
+ - **Fix:** below 768px replace the segmented control with a 36px icon button to the left of the input:
141
+ - `IconTerminal2` means Command, `IconNote` means Team note;
142
+ - aria-label "Switch to team note" / "Switch to command";
143
+ - it shows a tooltip and changes the placeholder to "Note for the team (saved to the audit log)".
144
+
145
+ The input then gets the full width.
146
+
147
+ ### S5. `/runs/new` opens the panel on "Nothing to watch yet"
148
+
149
+ - **Where:** `ws-new-desktop-*`.
150
+ - **Fix:** on `/runs/new` render the panel collapsed to its 44px strip **without saving that state**. If the person opens it, show the
151
+ Steps tab empty state with text that explains the panel: "Your test run's evidence appears here: the live browser, each scenario's
152
+ screens, the report and the Excel files." The person's saved preference applies again on `/runs/:id`.
153
+
154
+ ### S6. Phone bottom sheet uses Mantine's default dark surface (#242424), not our tokens
155
+
156
+ - **Where:** `*-sheet-phone-dark`.
157
+ - **Fix:** set `--fpt-surface` as the Drawer content background, `--fpt-text` as its colour and `--fpt-border` as the tab rule. Either
158
+ use the Drawer `classNames` with `.fpt-sheet { background: var(--fpt-surface); color: var(--fpt-text); }`, or theme `Drawer.styles`.
159
+ Same check for the tablet drawer and the sidebar drawer.
160
+
161
+ ### S7. Brand name breaks at the hyphen: "Patch Testing Co- / worker"
162
+
163
+ - **Where:** every desktop screenshot.
164
+ - **Fix:** render the product name with a non-breaking hyphen (replace `-` with U+2011 in the display string only), so it wraps as
165
+ "Patch Testing / Co-worker". Or allow one line with ellipsis and the full name in `title`.
166
+
167
+ ### S8. The Activity detail view's "Agent team" list uses engineering names
168
+
169
+ - **Where:** `ws-detail-activity-*`, right column. It lists "Test generator", "Approval gate", "Data executor", "Executor", "Triage",
170
+ "Human review", "Ticket", while the team strip and the board use "Test designer", "Approval", "Data", "Test runner", "Failure
171
+ analysis", "Your review", "Tickets". Feed timestamps read "10/17/2026, 12:02:05 PM" while everything else reads "17 Oct 12:02".
172
+ - **Fix:**
173
+ - name agents with `STEP_WORDS[node][0]` in `GraphView` compact mode and in `FeedCard`;
174
+ - show `shortWhen()` plus seconds ("17 Oct 12:02:05") in the feed;
175
+ - keep the technical node id in each item's `title` tooltip for engineers.
176
+
177
+ ### S9. Run type uses two wordings
178
+
179
+ - **Where:** the top bar says "Quick simulation (no browser)" / "Full browser run", while the user bubble says "quick simulation".
180
+ - **Fix:** use "Quick simulation" / "Full browser run" everywhere. Add "(no browser)" only where a missing screen would be expected
181
+ (panel Live and Screens tabs, Judge screen column).
182
+
183
+ ---
184
+
185
+ ## Nice
186
+
187
+ - **N1.** `ws-result-desktop-dark`: "See the screens" appears twice, in the Result card and in the What next chips. Keep the one in the
188
+ Result card. The chips become "Test another business area" and "Open the team board".
189
+ - **N2.** Sidebar Recent rows all read "Procure-to-Pay", and the sub-line truncates to "26C · 17 Oct 13:11 · Pra…". Shorten the env word
190
+ in the sub-line to a 14px icon (amber shield for practice, blue cloud for Fusion) with an `aria-label`. The time then stays readable.
191
+ - **N3.** The team strip folds finished agents to "4 done". Make that chip a button that expands "Show every step" (the same action as
192
+ the link below it), so the summary is clickable.
193
+ - **N4.** The `<380px` panel "Results so far" disclosure (deviation 9). Do it with step 3 or later.
194
+ - **N5.** Readiness phone (`readiness-phone-light`): the two selects take a full row. Put "Test environment" and "Patch" side by side at
195
+ 50% each, and remove the duplicate "Ask" button (bottom bar), the same as M2.
196
+ - **N6.** `runs-phone-dark`: "Getting started" fills the first screen. On phone collapse it to one line, "Getting started · 3 of 4
197
+ done", with a chevron.
198
+
199
+ ---
200
+
201
+ ## Verdicts on the stated deviations
202
+
203
+ | # | Deviation | Verdict | Note |
204
+ |---|---|---|---|
205
+ | 1 | "Scheduled runs" link admin-only | **Accept for now** | The schedules API and page are admin-only today. Revisit in step 7: show the link to everyone with a read-only list if `GET /api/schedules` is opened to non-admins. Otherwise keep it admin-only. |
206
+ | 2 | In rail mode the mock text moves to the top bar on every page | **Accept** | Better than my spec (run pages only): the honesty cue is never lost. On phone merge it with the env pill into one pill (M2). |
207
+ | 3 | Sidebar status aria-labels reworded (old ones broke an e2e `getByLabel`) | **Accept** | Correct call. Add the new label pattern to UI-REDESIGN section 10, so later steps do not collide with labels the e2e uses ("Password", "Reason", "API key", "scenario review"). The `side-run-<id>` test ids are fine. |
208
+ | 4 | Intake asks "Where should I test?" before "How should I run it?" | **Accept** | Environment before run type is the natural order (the run type depends on whether a browser can run there). |
209
+ | 5 | Team strip folds finished agents into "N done" when more than 3 | **Accept** | Make the folded chip clickable (N3). |
210
+ | 6 | Panel PDF / Excel buttons use `panel-pdf-link` / `panel-results-excel` | **Accept** | Keeps `pdf-link` and `excel-script` unique for e2e. Add both ids to section 10. |
211
+ | 7 | Opening the panel closes the Ask dock when the dock squeezed the panel | **Accept, with a condition** | Only when the center would drop under its minimum (560px desktop / 520px laptop). When the panel is closed again, reopen the dock automatically if the app closed it, so the person's chat is never lost by surprise. A one-line toast "The question panel is hidden while the run details are open" (with an "Ask" action) is enough. |
212
+ | 8 | Phone run top bar taller than 48px | **Change** | Max 2 rows and 76px. Exact layout in M2. |
213
+ | 9 | `<380px` "Results so far" disclosure not done | **Accept (deferred)** | Nice item N4. |
214
+
215
+ ---
216
+
217
+ ## Checks that passed (no action)
218
+
219
+ - `run-guide` + `data-stage` is unique in the thread and follows `guideStage`. The stage kicker and 4-segment progress read correctly
220
+ (judge shows an amber current segment).
221
+ - The sidebar groups Needs you / Running / Recent with amber "Review" / "Decide" badges and red/grey dots. The rail shows dots and
222
+ the count badge. The env switcher keeps "Mock app, not Oracle Fusion" visible.
223
+ - The panel has five tabs, the Screens count badge, the Report decision dot, a resize handle and a collapse strip.
224
+ `?scenario` and "Show steps" on proof cards work. The Screens filter (All / Failed / Passed) and the honesty line are present.
225
+ - Detail views keep `next-step`. "All details" is in the top bar.
226
+ - The composer has suggestions, Team note mode and the Ask hint.
227
+ - Light-theme contrast of dim text on the sidebar tint looks right. The `--fpt-dim` change is applied.
228
+ - `/assistant` and `/assistant/:id` redirect. The intake offers "Use the full form".
web/src/agents.ts CHANGED
@@ -52,3 +52,25 @@ export const MODULE_NAMES: Record<string, string> = {
52
  HCM: 'Human Capital', P2M: 'Plan-to-Make', PPM: 'Project Portfolio', SCM: 'Supply Chain', SCP: 'Supply Planning', CX: 'Customer Experience',
53
  };
54
  export const MODULE_COLORS = ['#f08c3a', '#3f8f7f', '#6258c4', '#d6336c', '#1c7ed6', '#e8a400', '#2f9e44', '#ae3ec9', '#0b7285', '#c2255c', '#5c7cfa'];
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
52
  HCM: 'Human Capital', P2M: 'Plan-to-Make', PPM: 'Project Portfolio', SCM: 'Supply Chain', SCP: 'Supply Planning', CX: 'Customer Experience',
53
  };
54
  export const MODULE_COLORS = ['#f08c3a', '#3f8f7f', '#6258c4', '#d6336c', '#1c7ed6', '#e8a400', '#2f9e44', '#ae3ec9', '#0b7285', '#c2255c', '#5c7cfa'];
55
+
56
+ // What each step of the workflow did, in a consultant's words (the step names come from the run's own event log).
57
+ export const STEP_WORDS: Record<string, [string, string]> = {
58
+ scout: ['Scout', 'Read the test environment'],
59
+ research_module: ['Research', 'Read what this patch changes'],
60
+ synthesizer: ['Synthesizer', 'Ranked what matters most to test'],
61
+ test_generator: ['Test designer', 'Chose the scenarios'],
62
+ approval_gate: ['Approval', 'Asked for your approval'],
63
+ data_planner: ['Data planner', 'Planned the test data'],
64
+ data_executor: ['Data', 'Prepared the test data'],
65
+ script_builder: ['Script builder', 'Prepared the test scripts'],
66
+ executor: ['Test runner', 'Runs the scenarios'],
67
+ self_heal: ['Self-heal', 'Repaired a screen element that moved'],
68
+ triage: ['Failure analysis', 'Worked out why scenarios failed'],
69
+ human_review: ['Your review', 'Asked for your decision on failures'],
70
+ ticket: ['Tickets', 'Raised tickets for confirmed defects'],
71
+ reporter: ['Reporter', 'Applied the readiness rule and wrote the report'],
72
+ learner: ['Memory', 'Saved what was learned for next time'],
73
+ };
74
+
75
+ /** The consultant name of an agent ("Test designer"), falling back to the engineering name. */
76
+ export const stepName = (node?: string | null) => (node ? STEP_WORDS[node]?.[0] ?? agentName(node) : 'Coordinator');
web/src/api/hooks.ts CHANGED
@@ -177,7 +177,7 @@ export const useReadiness = (podId: number | null | undefined, patch: string | n
177
  export const useRunReadiness = (id: string, enabled = true) => useRunView<ReadinessView>(id, 'readiness', { refetchInterval: 5000, enabled: enabled && !!id });
178
  export const useLive = (id: string, enabled: boolean) => useRunView<LiveStatus>(id, 'live', { enabled, refetchInterval: 2000 });
179
  export const useRunScenarios = (id: string) => useRunView<{ scenarios: Scenario[]; deferred: { id: string; reason: string }[] }>(id, 'scenarios', { enabled: !!id });
180
- export const useRunFailures = (id: string) => useRunView<Failure[]>(id, 'failures', { refetchInterval: 5000 });
181
  export const useScenarioLibrary = (q: { module?: string; step?: string; priority?: string; q?: string; limit: number; offset: number }) =>
182
  useQuery({
183
  queryKey: ['scenarios', q],
 
177
  export const useRunReadiness = (id: string, enabled = true) => useRunView<ReadinessView>(id, 'readiness', { refetchInterval: 5000, enabled: enabled && !!id });
178
  export const useLive = (id: string, enabled: boolean) => useRunView<LiveStatus>(id, 'live', { enabled, refetchInterval: 2000 });
179
  export const useRunScenarios = (id: string) => useRunView<{ scenarios: Scenario[]; deferred: { id: string; reason: string }[] }>(id, 'scenarios', { enabled: !!id });
180
+ export const useRunFailures = (id: string, enabled = true) => useRunView<Failure[]>(id, 'failures', { refetchInterval: 5000, enabled: enabled && !!id });
181
  export const useScenarioLibrary = (q: { module?: string; step?: string; priority?: string; q?: string; limit: number; offset: number }) =>
182
  useQuery({
183
  queryKey: ['scenarios', q],
web/src/components/GraphView.tsx CHANGED
@@ -1,5 +1,5 @@
1
  import { Text } from '@mantine/core';
2
- import { AGENT_BY_NODE, ENGINE_LABEL, ENGINE_TONE } from '../agents';
3
  import type { NodeState } from '../hooks/useRunStream';
4
  import { Pill } from './common';
5
 
@@ -34,7 +34,7 @@ export function GraphView({ states, compact = false }: { states?: States; compac
34
  <div style={{ display: 'flex', alignItems: 'center', gap: 8, justifyContent: 'space-between' }}>
35
  <span style={{ display: 'flex', alignItems: 'center', gap: 8, minWidth: 0 }}>
36
  <span className="fpt-dot" style={{ background: `var(--pill-${a?.tone ?? 'neutral'}-fg)` }} aria-hidden />
37
- <Text size="sm" fw={500} truncate>{a?.name ?? n}</Text>
38
  {s.count > 1 && <Pill tone="lav">x{s.count}</Pill>}
39
  </span>
40
  {states ? <Pill tone={STATE_TONE[s.state]}>{STATE_LABEL[s.state]}</Pill>
 
1
  import { Text } from '@mantine/core';
2
+ import { AGENT_BY_NODE, ENGINE_LABEL, ENGINE_TONE, stepName } from '../agents';
3
  import type { NodeState } from '../hooks/useRunStream';
4
  import { Pill } from './common';
5
 
 
34
  <div style={{ display: 'flex', alignItems: 'center', gap: 8, justifyContent: 'space-between' }}>
35
  <span style={{ display: 'flex', alignItems: 'center', gap: 8, minWidth: 0 }}>
36
  <span className="fpt-dot" style={{ background: `var(--pill-${a?.tone ?? 'neutral'}-fg)` }} aria-hidden />
37
+ <Text size="sm" fw={500} truncate title={`graph node: ${n}`}>{compact ? stepName(n) : a?.name ?? n}</Text>
38
  {s.count > 1 && <Pill tone="lav">x{s.count}</Pill>}
39
  </span>
40
  {states ? <Pill tone={STATE_TONE[s.state]}>{STATE_LABEL[s.state]}</Pill>
web/src/components/common.tsx CHANGED
@@ -89,6 +89,26 @@ export function Term({ children, k }: { children: ReactNode; k?: string }) {
89
  );
90
  }
91
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
92
  export function GlossaryButton() {
93
  return (
94
  <Popover width={420} position="bottom-end" withArrow shadow="md">
@@ -97,18 +117,7 @@ export function GlossaryButton() {
97
  </Popover.Target>
98
  <Popover.Dropdown>
99
  <Text fw={600} size="sm" mb={6}>Words used in this app</Text>
100
- <dl style={{ margin: 0, display: 'grid', gridTemplateColumns: 'auto 1fr', gap: '6px 10px', fontSize: 12 }}>
101
- {GLOSSARY.map((g) => (
102
- <div key={g.term} style={{ display: 'contents' }}>
103
- <dt style={{ fontWeight: 600 }}>{g.term}</dt>
104
- <dd style={{ margin: 0 }}>{g.means} <span style={{ color: 'var(--fpt-dim)' }}>({g.technical})</span></dd>
105
- </div>
106
- ))}
107
- </dl>
108
- <Text size="xs" c="dimmed" mt={10} style={{ borderTop: '1px solid var(--fpt-border)', paddingTop: 8 }}>
109
- Keys: <kbd className="fpt-kbd">N</kbd> new test run · <kbd className="fpt-kbd">Ctrl K</kbd> ask a question · on a test run <kbd className="fpt-kbd">Alt 1</kbd> conversation,{' '}
110
- <kbd className="fpt-kbd">Alt 2</kbd> message box, <kbd className="fpt-kbd">Alt 3</kbd> side panel, <kbd className="fpt-kbd">Ctrl \</kbd> show or hide the side panel.
111
- </Text>
112
  </Popover.Dropdown>
113
  </Popover>
114
  );
 
89
  );
90
  }
91
 
92
+ /** The words of the app with their meaning and technical name, plus the keyboard keys. */
93
+ export function GlossaryList() {
94
+ return (
95
+ <>
96
+ <dl style={{ margin: 0, display: 'grid', gridTemplateColumns: 'auto 1fr', gap: '6px 10px', fontSize: 12 }}>
97
+ {GLOSSARY.map((g) => (
98
+ <div key={g.term} style={{ display: 'contents' }}>
99
+ <dt style={{ fontWeight: 600 }}>{g.term}</dt>
100
+ <dd style={{ margin: 0 }}>{g.means} <span style={{ color: 'var(--fpt-dim)' }}>({g.technical})</span></dd>
101
+ </div>
102
+ ))}
103
+ </dl>
104
+ <Text size="xs" c="dimmed" mt={10} style={{ borderTop: '1px solid var(--fpt-border)', paddingTop: 8 }}>
105
+ Keys: <kbd className="fpt-kbd">N</kbd> new test run · <kbd className="fpt-kbd">Ctrl K</kbd> ask a question · on a test run <kbd className="fpt-kbd">Alt 1</kbd> conversation,{' '}
106
+ <kbd className="fpt-kbd">Alt 2</kbd> message box, <kbd className="fpt-kbd">Alt 3</kbd> side panel, <kbd className="fpt-kbd">Ctrl \</kbd> show or hide the side panel.
107
+ </Text>
108
+ </>
109
+ );
110
+ }
111
+
112
  export function GlossaryButton() {
113
  return (
114
  <Popover width={420} position="bottom-end" withArrow shadow="md">
 
117
  </Popover.Target>
118
  <Popover.Dropdown>
119
  <Text fw={600} size="sm" mb={6}>Words used in this app</Text>
120
+ <GlossaryList />
 
 
 
 
 
 
 
 
 
 
 
121
  </Popover.Dropdown>
122
  </Popover>
123
  );
web/src/components/shell/AppSidebar.tsx CHANGED
@@ -129,7 +129,7 @@ export function AppSidebar({ mode, onNavigate, onCollapse, onExpand }: {
129
  <div className="fpt-sb-brand" data-testid="brand">
130
  <span className="fpt-mark" aria-hidden>{initials(brand.data?.product_name)}</span>
131
  {!rail && (
132
- <span className="fpt-sb-brand-name">{brand.data?.product_name ?? 'Patch Testing Co-worker'}{brand.data?.org_name ? <small>{brand.data.org_name}</small> : null}</span>
133
  )}
134
  {rail && <span className="fpt-sr-only">{brand.data?.product_name ?? 'Patch Testing Co-worker'}</span>}
135
  {!rail && onCollapse && (
 
129
  <div className="fpt-sb-brand" data-testid="brand">
130
  <span className="fpt-mark" aria-hidden>{initials(brand.data?.product_name)}</span>
131
  {!rail && (
132
+ <span className="fpt-sb-brand-name" title={brand.data?.product_name ?? 'Patch Testing Co-worker'}>{(brand.data?.product_name ?? 'Patch Testing Co-worker').replace(/-/g, '\u2011')}{brand.data?.org_name ? <small>{brand.data.org_name}</small> : null}</span>
133
  )}
134
  {rail && <span className="fpt-sr-only">{brand.data?.product_name ?? 'Patch Testing Co-worker'}</span>}
135
  {!rail && onCollapse && (
web/src/components/shell/SidePanel.tsx CHANGED
@@ -2,6 +2,7 @@ import { Drawer, Tabs, Tooltip } from '@mantine/core';
2
  import { useViewportSize } from '@mantine/hooks';
3
  import { IconBroadcast, IconFileReport, IconFileSpreadsheet, IconLayoutSidebarRightCollapse, IconListNumbers, IconPhoto, IconX } from '@tabler/icons-react';
4
  import { createContext, useCallback, useContext, useEffect, useMemo, useRef, useState, type KeyboardEvent as ReactKeyboardEvent, type ReactNode } from 'react';
 
5
  import { useSearchParams } from 'react-router-dom';
6
  import { useShell, useUiPrefs, type PanelTab } from './prefs';
7
 
@@ -14,7 +15,7 @@ const PANEL_ICON: Record<PanelTab, ReactNode> = {
14
  const STRIP = 44;
15
  const SIDEBAR = { expanded: 264, rail: 64 };
16
  const DOCK = 380;
17
- const CENTER_MIN = 560;
18
  const UNTOUCHED_MS = 60_000;
19
 
20
  export interface SidePanelApi {
@@ -36,8 +37,15 @@ export interface SidePanelApi {
36
  resetWidth: () => void;
37
  /** Switch tab for a run event, unless the person chose a tab in the last minute. Never opens or closes the panel. */
38
  autoShow: (tab: PanelTab) => void;
 
 
 
 
39
  }
40
 
 
 
 
41
  const Ctx = createContext<SidePanelApi | null>(null);
42
  export const useSidePanel = () => {
43
  const v = useContext(Ctx);
@@ -47,7 +55,7 @@ export const useSidePanel = () => {
47
  /** The panel, when the current screen has one (run workspace); null elsewhere. */
48
  export const useSidePanelOptional = () => useContext(Ctx);
49
 
50
- export function SidePanelProvider({ tabs, children }: { tabs: PanelTab[]; children: ReactNode }) {
51
  const { size, chat } = useShell();
52
  const { prefs, set } = useUiPrefs();
53
  const vp = useViewportSize();
@@ -55,15 +63,24 @@ export function SidePanelProvider({ tabs, children }: { tabs: PanelTab[]; childr
55
  const [sheet, setSheet] = useState(false);
56
  const [liveWidth, setLiveWidth] = useState<number | null>(null);
57
  const touchedAt = useRef(0);
 
 
 
 
 
 
58
  const inline = size === 'desktop' || size === 'laptop';
59
  const vw = vp.width || (typeof window !== 'undefined' ? window.innerWidth : 1440);
60
  const [min, max, def] = size === 'laptop' ? [340, 560, 380] : [360, Math.max(360, Math.min(720, Math.round(vw / 2))), 440];
61
  const clamp = useCallback((n: number) => Math.min(max, Math.max(min, Math.round(n))), [min, max]);
62
  const width = clamp(liveWidth ?? prefs.panel.width ?? def);
63
- const tab: PanelTab = tabs.includes(prefs.panel.tab) ? prefs.panel.tab : tabs[0];
 
 
64
  const sidebarW = size === 'desktop' ? SIDEBAR[prefs.sidebar] : SIDEBAR.rail;
65
- const forcedStrip = inline && !!chat?.open && (size === 'laptop' || vw - sidebarW - DOCK - width < CENTER_MIN);
66
- const open = inline ? prefs.panel.open && !forcedStrip : sheet;
 
67
  const scenario = params.get('scenario');
68
 
69
  const setScenario = useCallback((sid?: string) => {
@@ -71,15 +88,32 @@ export function SidePanelProvider({ tabs, children }: { tabs: PanelTab[]; childr
71
  setParams((p) => { const n = new URLSearchParams(p); n.set('scenario', sid); return n; }, { replace: true });
72
  }, [setParams]);
73
  const show = useCallback((t: PanelTab, opts?: { scenario?: string }) => {
74
- touchedAt.current = Date.now();
 
75
  setScenario(opts?.scenario);
76
- set({ panel: { open: true, tab: t } });
77
  if (!inline) setSheet(true);
78
- if (inline && chat?.open && forcedStrip) chat.setOpen(false); // the person asked for the panel: give it the room
79
- }, [set, inline, setScenario, chat, forcedStrip]);
80
- const hide = useCallback(() => { if (inline) set({ panel: { open: false } }); else setSheet(false); }, [inline, set]);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
81
  const toggle = useCallback(() => { if (open) hide(); else show(tab); }, [open, hide, show, tab]);
82
- const setTab = useCallback((t: PanelTab) => { touchedAt.current = Date.now(); set({ panel: { tab: t } }); }, [set]);
83
  const setWidth = useCallback((px: number, save = true) => {
84
  const w = clamp(px);
85
  if (save) { setLiveWidth(null); set({ panel: { width: w } }); } else setLiveWidth(w);
@@ -87,8 +121,14 @@ export function SidePanelProvider({ tabs, children }: { tabs: PanelTab[]; childr
87
  const resetWidth = useCallback(() => { setLiveWidth(null); set({ panel: { width: null } }); }, [set]);
88
  const autoShow = useCallback((t: PanelTab) => {
89
  if (Date.now() - touchedAt.current < UNTOUCHED_MS || !tabs.includes(t)) return;
90
- set({ panel: { tab: t } });
91
- }, [set, tabs]);
 
 
 
 
 
 
92
 
93
  // Ctrl+\ toggles the panel
94
  useEffect(() => {
@@ -97,9 +137,10 @@ export function SidePanelProvider({ tabs, children }: { tabs: PanelTab[]; childr
97
  return () => window.removeEventListener('keydown', onKey);
98
  }, [toggle]);
99
  useEffect(() => { if (inline) setSheet(false); }, [inline]);
 
100
 
101
- const value = useMemo<SidePanelApi>(() => ({ open, tab, width, min, max, inline, forcedStrip, scenario, show, hide, toggle, setTab, setWidth, resetWidth, autoShow }),
102
- [open, tab, width, min, max, inline, forcedStrip, scenario, show, hide, toggle, setTab, setWidth, resetWidth, autoShow]);
103
  return <Ctx.Provider value={value}>{children}</Ctx.Provider>;
104
  }
105
 
 
2
  import { useViewportSize } from '@mantine/hooks';
3
  import { IconBroadcast, IconFileReport, IconFileSpreadsheet, IconLayoutSidebarRightCollapse, IconListNumbers, IconPhoto, IconX } from '@tabler/icons-react';
4
  import { createContext, useCallback, useContext, useEffect, useMemo, useRef, useState, type KeyboardEvent as ReactKeyboardEvent, type ReactNode } from 'react';
5
+ import { notifications } from '@mantine/notifications';
6
  import { useSearchParams } from 'react-router-dom';
7
  import { useShell, useUiPrefs, type PanelTab } from './prefs';
8
 
 
15
  const STRIP = 44;
16
  const SIDEBAR = { expanded: 264, rail: 64 };
17
  const DOCK = 380;
18
+ const CENTER_MIN = { desktop: 560, laptop: 520 };
19
  const UNTOUCHED_MS = 60_000;
20
 
21
  export interface SidePanelApi {
 
37
  resetWidth: () => void;
38
  /** Switch tab for a run event, unless the person chose a tab in the last minute. Never opens or closes the panel. */
39
  autoShow: (tab: PanelTab) => void;
40
+ /** Choose the tab for a run the person just opened (not saved; never opens or closes the panel). */
41
+ pick: (tab: PanelTab, opts?: { scenario?: string }) => void;
42
+ /** The person picked a panel tab in this run during this session. */
43
+ chosenInRun: () => boolean;
44
  }
45
 
46
+ // Runs in which the person picked a panel tab themselves, this session only (never saved).
47
+ const chosenRuns = new Set<string>();
48
+
49
  const Ctx = createContext<SidePanelApi | null>(null);
50
  export const useSidePanel = () => {
51
  const v = useContext(Ctx);
 
55
  /** The panel, when the current screen has one (run workspace); null elsewhere. */
56
  export const useSidePanelOptional = () => useContext(Ctx);
57
 
58
+ export function SidePanelProvider({ tabs, runId, children }: { tabs: PanelTab[]; runId?: string; children: ReactNode }) {
59
  const { size, chat } = useShell();
60
  const { prefs, set } = useUiPrefs();
61
  const vp = useViewportSize();
 
63
  const [sheet, setSheet] = useState(false);
64
  const [liveWidth, setLiveWidth] = useState<number | null>(null);
65
  const touchedAt = useRef(0);
66
+ // The tab chosen for the open run (by the person, by the run's state, or by a run event). The saved tab is only the fallback.
67
+ const [override, setOverride] = useState<{ run?: string; tab: PanelTab } | null>(null);
68
+ // /runs/new: the panel starts folded and its open state is not saved
69
+ const [newOpen, setNewOpen] = useState(false);
70
+ // the panel closed the Ask dock to make room: reopen it when the panel closes
71
+ const closedDock = useRef(false);
72
  const inline = size === 'desktop' || size === 'laptop';
73
  const vw = vp.width || (typeof window !== 'undefined' ? window.innerWidth : 1440);
74
  const [min, max, def] = size === 'laptop' ? [340, 560, 380] : [360, Math.max(360, Math.min(720, Math.round(vw / 2))), 440];
75
  const clamp = useCallback((n: number) => Math.min(max, Math.max(min, Math.round(n))), [min, max]);
76
  const width = clamp(liveWidth ?? prefs.panel.width ?? def);
77
+ const wanted = override && override.run === runId ? override.tab : runId ? prefs.panel.tab : 'steps';
78
+ const tab: PanelTab = tabs.includes(wanted) ? wanted : tabs[0];
79
+ const mark = useCallback(() => { touchedAt.current = Date.now(); if (runId) chosenRuns.add(runId); }, [runId]);
80
  const sidebarW = size === 'desktop' ? SIDEBAR[prefs.sidebar] : SIDEBAR.rail;
81
+ const centerMin = size === 'laptop' ? CENTER_MIN.laptop : CENTER_MIN.desktop;
82
+ const forcedStrip = inline && !!chat?.open && vw - sidebarW - DOCK - width < centerMin;
83
+ const open = inline ? (runId ? prefs.panel.open : newOpen) && !forcedStrip : sheet;
84
  const scenario = params.get('scenario');
85
 
86
  const setScenario = useCallback((sid?: string) => {
 
88
  setParams((p) => { const n = new URLSearchParams(p); n.set('scenario', sid); return n; }, { replace: true });
89
  }, [setParams]);
90
  const show = useCallback((t: PanelTab, opts?: { scenario?: string }) => {
91
+ mark();
92
+ setOverride({ run: runId, tab: t });
93
  setScenario(opts?.scenario);
94
+ if (runId) set({ panel: { open: true, tab: t } }); else setNewOpen(true);
95
  if (!inline) setSheet(true);
96
+ if (inline && chat?.open && forcedStrip) {
97
+ // the person asked for the panel and the center would fall below its minimum: give it the room, say so, undo it later
98
+ chat.setOpen(false);
99
+ closedDock.current = true;
100
+ const nid = 'fpt-dock-hidden';
101
+ notifications.show({
102
+ id: nid, autoClose: 6000, withCloseButton: true,
103
+ message: (
104
+ <span>The question panel is hidden while the run details are open.{' '}
105
+ <button type="button" className="fpt-linkbtn" onClick={() => { notifications.hide(nid); chat.focusInput(); }}>Ask</button>
106
+ </span>
107
+ ),
108
+ });
109
+ }
110
+ }, [set, inline, setScenario, chat, forcedStrip, mark, runId]);
111
+ const hide = useCallback(() => {
112
+ if (inline) { if (runId) set({ panel: { open: false } }); else setNewOpen(false); } else setSheet(false);
113
+ if (closedDock.current && chat && !chat.open) { closedDock.current = false; chat.setOpen(true); }
114
+ }, [inline, set, runId, chat]);
115
  const toggle = useCallback(() => { if (open) hide(); else show(tab); }, [open, hide, show, tab]);
116
+ const setTab = useCallback((t: PanelTab) => { mark(); setOverride({ run: runId, tab: t }); set({ panel: { tab: t } }); }, [set, mark, runId]);
117
  const setWidth = useCallback((px: number, save = true) => {
118
  const w = clamp(px);
119
  if (save) { setLiveWidth(null); set({ panel: { width: w } }); } else setLiveWidth(w);
 
121
  const resetWidth = useCallback(() => { setLiveWidth(null); set({ panel: { width: null } }); }, [set]);
122
  const autoShow = useCallback((t: PanelTab) => {
123
  if (Date.now() - touchedAt.current < UNTOUCHED_MS || !tabs.includes(t)) return;
124
+ setOverride({ run: runId, tab: t });
125
+ }, [tabs, runId]);
126
+ const pick = useCallback((t: PanelTab, opts?: { scenario?: string }) => {
127
+ if (!tabs.includes(t)) return;
128
+ setScenario(opts?.scenario);
129
+ setOverride({ run: runId, tab: t });
130
+ }, [tabs, runId, setScenario]);
131
+ const chosenInRun = useCallback(() => !!runId && chosenRuns.has(runId), [runId]);
132
 
133
  // Ctrl+\ toggles the panel
134
  useEffect(() => {
 
137
  return () => window.removeEventListener('keydown', onKey);
138
  }, [toggle]);
139
  useEffect(() => { if (inline) setSheet(false); }, [inline]);
140
+ useEffect(() => { if (chat?.open) closedDock.current = false; }, [chat?.open]); // the person reopened it themselves
141
 
142
+ const value = useMemo<SidePanelApi>(() => ({ open, tab, width, min, max, inline, forcedStrip, scenario, show, hide, toggle, setTab, setWidth, resetWidth, autoShow, pick, chosenInRun }),
143
+ [open, tab, width, min, max, inline, forcedStrip, scenario, show, hide, toggle, setTab, setWidth, resetWidth, autoShow, pick, chosenInRun]);
144
  return <Ctx.Provider value={value}>{children}</Ctx.Provider>;
145
  }
146
 
web/src/components/shell/TopBar.tsx CHANGED
@@ -12,7 +12,7 @@ export function TopBar({ title, sub, middle, actions, titleTestId, honesty = tru
12
  }) {
13
  const { size, sidebarExpanded, openNav, chat } = useShell();
14
  const { pod } = useChosenEnv();
15
- const narrow = size === 'tablet' || size === 'phone';
16
  const cue = honesty && !sidebarExpanded && pod && envKind(pod.kind) === 'mock'
17
  ? <span className="fpt-topbar-cue"><EnvBadge kind="mock" /> <span>{MOCK_TEXT}</span></span> : null;
18
  return (
@@ -21,10 +21,12 @@ export function TopBar({ title, sub, middle, actions, titleTestId, honesty = tru
21
  <button type="button" className="fpt-iconbtn fpt-topbar-menu" aria-label="Open the menu" onClick={openNav}><IconMenu2 size={16} /></button>
22
  )}
23
  <div className="fpt-topbar-left">
24
- <h1 className="fpt-title" data-testid={titleTestId}>{title}</h1>
 
 
 
25
  {(sub || cue) && <div className="fpt-topbar-sub">{sub}{sub && cue ? <span aria-hidden className="fpt-topbar-dotsep">·</span> : null}{cue}</div>}
26
  </div>
27
- {middle && <div className="fpt-topbar-mid">{middle}</div>}
28
  {(actions || (narrow && chat)) && (
29
  <div className="fpt-topbar-actions">
30
  {actions}
 
12
  }) {
13
  const { size, sidebarExpanded, openNav, chat } = useShell();
14
  const { pod } = useChosenEnv();
15
+ const narrow = size === 'tablet'; // phones have Ask in the bottom bar
16
  const cue = honesty && !sidebarExpanded && pod && envKind(pod.kind) === 'mock'
17
  ? <span className="fpt-topbar-cue"><EnvBadge kind="mock" /> <span>{MOCK_TEXT}</span></span> : null;
18
  return (
 
21
  <button type="button" className="fpt-iconbtn fpt-topbar-menu" aria-label="Open the menu" onClick={openNav}><IconMenu2 size={16} /></button>
22
  )}
23
  <div className="fpt-topbar-left">
24
+ <div className="fpt-topbar-row1">
25
+ <h1 className="fpt-title" data-testid={titleTestId}>{title}</h1>
26
+ {middle && <div className="fpt-topbar-mid">{middle}</div>}
27
+ </div>
28
  {(sub || cue) && <div className="fpt-topbar-sub">{sub}{sub && cue ? <span aria-hidden className="fpt-topbar-dotsep">·</span> : null}{cue}</div>}
29
  </div>
 
30
  {(actions || (narrow && chat)) && (
31
  <div className="fpt-topbar-actions">
32
  {actions}
web/src/pages/AgentTeamPage.tsx CHANGED
@@ -1,4 +1,4 @@
1
- import { Button, Group, Stack, Table, Tabs, Text, UnstyledButton } from '@mantine/core';
2
  import { IconArrowRight, IconRobot, IconSettings, IconStar } from '@tabler/icons-react';
3
  import { useQuery } from '@tanstack/react-query';
4
  import { useState } from 'react';
@@ -8,6 +8,7 @@ import { getJson } from '../api/client';
8
  import { useAutonomy, useConfig, useHealth, useKill, usePatchWatch, useSchedules } from '../api/hooks';
9
  import { ErrorAlert, PageHeader, Pill } from '../components/common';
10
  import { GraphView } from '../components/GraphView';
 
11
 
12
  interface Ready { ready: boolean; checks: Record<string, boolean>; orchestrator: string; scheduler: string; version: string }
13
  const useReady = () => useQuery({ queryKey: ['ready'], queryFn: () => getJson<Ready>('/api/ready'), refetchInterval: 10_000, retry: false });
@@ -58,7 +59,7 @@ export function AgentTeamPage() {
58
 
59
  <div className="fpt-cols">
60
  {/* left: coordinator + agents */}
61
- <div className="fpt-side" style={{ flex: '0 0 250px', width: 250 }}>
62
  <div className="fpt-card" style={{ overflow: 'hidden' }}>
63
  <div style={{ background: 'var(--fpt-band)', height: 46 }} />
64
  <div style={{ textAlign: 'center', padding: '0 14px 14px', marginTop: -22 }}>
@@ -76,13 +77,11 @@ export function AgentTeamPage() {
76
  {GROUPS.map((g) => (
77
  <div key={g} style={{ marginBottom: 6 }}>
78
  <Text size="xs" c="dimmed" px={6} mb={2}>{g}</Text>
79
- {AGENTS.filter((a) => a.group === g).map((a) => (
80
- <UnstyledButton key={a.node} className="fpt-tree-item" data-active={sel.node === a.node} onClick={() => setSel(a)} aria-pressed={sel.node === a.node}>
81
- <span className="fpt-dot" style={{ background: `var(--pill-${a.tone}-fg)` }} aria-hidden />
82
- <span style={{ flex: 1 }}>{a.name}</span>
83
- <Pill tone={ENGINE_TONE[a.engine]}>{ENGINE_LABEL[a.engine].replace(' LLM', '')}</Pill>
84
- </UnstyledButton>
85
- ))}
86
  </div>
87
  ))}
88
  </div>
 
1
+ import { Button, Group, Stack, Table, Tabs, Text } from '@mantine/core';
2
  import { IconArrowRight, IconRobot, IconSettings, IconStar } from '@tabler/icons-react';
3
  import { useQuery } from '@tanstack/react-query';
4
  import { useState } from 'react';
 
8
  import { useAutonomy, useConfig, useHealth, useKill, usePatchWatch, useSchedules } from '../api/hooks';
9
  import { ErrorAlert, PageHeader, Pill } from '../components/common';
10
  import { GraphView } from '../components/GraphView';
11
+ import { AgentCard } from './TeamBoard';
12
 
13
  interface Ready { ready: boolean; checks: Record<string, boolean>; orchestrator: string; scheduler: string; version: string }
14
  const useReady = () => useQuery({ queryKey: ['ready'], queryFn: () => getJson<Ready>('/api/ready'), refetchInterval: 10_000, retry: false });
 
59
 
60
  <div className="fpt-cols">
61
  {/* left: coordinator + agents */}
62
+ <div className="fpt-side" style={{ flex: '0 0 280px', width: 280 }}>
63
  <div className="fpt-card" style={{ overflow: 'hidden' }}>
64
  <div style={{ background: 'var(--fpt-band)', height: 46 }} />
65
  <div style={{ textAlign: 'center', padding: '0 14px 14px', marginTop: -22 }}>
 
77
  {GROUPS.map((g) => (
78
  <div key={g} style={{ marginBottom: 6 }}>
79
  <Text size="xs" c="dimmed" px={6} mb={2}>{g}</Text>
80
+ <div role="list" aria-label={g} className="fpt-agent-list">
81
+ {AGENTS.filter((a) => a.group === g).map((a) => (
82
+ <AgentCard key={a.node} agent={a} state="pending" staticMode pressed={sel.node === a.node} onOpen={() => setSel(a)} testId={`agent-${a.node}`} />
83
+ ))}
84
+ </div>
 
 
85
  </div>
86
  ))}
87
  </div>
web/src/pages/AssistantPage.tsx CHANGED
@@ -1,9 +1,9 @@
1
- import { ActionIcon, Anchor, Button, Group, Modal, SegmentedControl, Text, TextInput } from '@mantine/core';
2
- import { IconArrowDown, IconCircleCheck, IconEye, IconLoader2, IconPhoto, IconSend, IconUserCheck } from '@tabler/icons-react';
3
  import { useMutation, useQueryClient } from '@tanstack/react-query';
4
  import { useCallback, useEffect, useMemo, useRef, useState, type FormEvent, type ReactNode } from 'react';
5
  import { Link, Navigate, useNavigate, useParams, useSearchParams } from 'react-router-dom';
6
- import { agentName, MODULE_NAMES } from '../agents';
7
  import { api, unwrap } from '../api/client';
8
  import { useApproveCases, useBrand, useGate, usePodProfile, usePods, useRun, useRunAction, useRunReadiness, useStartRun } from '../api/hooks';
9
  import type { ApproveGate } from '../api/types';
@@ -27,24 +27,8 @@ type Note = { who: 'you' | 'bot'; body: ReactNode; key: number };
27
  type Status = { suggest: string[] };
28
  type ViewProps = { notes: Note[]; say: (who: Note['who'], body: ReactNode) => void; setStatus: (s: Status) => void };
29
 
30
- // What each step of the workflow did, in a consultant's words (the step names come from the run's own event log).
31
- export const STEP_WORDS: Record<string, [string, string]> = {
32
- scout: ['Scout', 'Read the test environment'],
33
- research_module: ['Research', 'Read what this patch changes'],
34
- synthesizer: ['Synthesizer', 'Ranked what matters most to test'],
35
- test_generator: ['Test designer', 'Chose the scenarios'],
36
- approval_gate: ['Approval', 'Asked for your approval'],
37
- data_planner: ['Data planner', 'Planned the test data'],
38
- data_executor: ['Data', 'Prepared the test data'],
39
- script_builder: ['Script builder', 'Prepared the test scripts'],
40
- executor: ['Test runner', 'Runs the scenarios'],
41
- self_heal: ['Self-heal', 'Repaired a screen element that moved'],
42
- triage: ['Failure analysis', 'Worked out why scenarios failed'],
43
- human_review: ['Your review', 'Asked for your decision on failures'],
44
- ticket: ['Tickets', 'Raised tickets for confirmed defects'],
45
- reporter: ['Reporter', 'Applied the readiness rule and wrote the report'],
46
- learner: ['Memory', 'Saved what was learned for next time'],
47
- };
48
 
49
  export function Msg({ who, children, wide }: { who: 'you' | 'bot'; children: ReactNode; wide?: boolean }) {
50
  return (
@@ -195,6 +179,7 @@ export function Conversation({ id, notes, say, setStatus, clear }: ViewProps & {
195
  const status = r?.status;
196
  const decision = r ? r.decision ?? Object.values(r.decisions ?? {})[0] ?? null : null;
197
  const [announce, setAnnounce] = useState('');
 
198
  useEffect(() => clear(), [stage]); // eslint-disable-line react-hooks/exhaustive-deps -- typed notes belong to the step they were typed in
199
  useEffect(() => {
200
  setStatus({ suggest: { prepare: ['Status', 'Cancel'], approve: ['Approve all', 'Status', 'Cancel'], testing: ['Status', 'Cancel'], judge: ['Status'],
@@ -203,8 +188,10 @@ export function Conversation({ id, notes, say, setStatus, clear }: ViewProps & {
203
  // say each new stage once for screen readers, and bring the stage's main button into reach (never stealing focus from typing)
204
  useEffect(() => {
205
  if (!r) return;
 
 
206
  setAnnounce(ANNOUNCE[stage](scenarios, decisionWords(decision)));
207
- if (stage !== 'approve' && stage !== 'judge') return;
208
  const t = window.setTimeout(() => {
209
  const a = document.activeElement;
210
  const thread = document.querySelector('[data-testid="assistant-thread"]');
@@ -254,7 +241,7 @@ export function Conversation({ id, notes, say, setStatus, clear }: ViewProps & {
254
  return (
255
  <>
256
  <div className="fpt-sr-only" role="status">{announce}</div>
257
- <Msg who="you">Test {areas} · {browserRun ? 'full browser run' : 'quick simulation'} · {fusion ? 'Oracle Fusion pod' : 'Practice environment'}</Msg>
258
  <Msg who="bot">
259
  <Text size="sm" mb={10}>On it. This is test run <Link to={`/runs/${id}`}>{runTitle(r)}</Link>. The team:</Text>
260
  <TeamStrip runId={id} finished={done} events={events} />
@@ -291,7 +278,10 @@ export function Conversation({ id, notes, say, setStatus, clear }: ViewProps & {
291
  <>
292
  <Phase>Your decision</Phase>
293
  <Msg who="bot" wide>
294
- <StageCard stage="judge"><Judge r={r} onShowScreen={panel ? (c) => panel.show('screens', { scenario: c }) : undefined} /></StageCard>
 
 
 
295
  </Msg>
296
  </>
297
  )}
@@ -332,7 +322,7 @@ export function useChatInput(fn: (text: string) => void) {
332
  /** The run conversation (or the intake when there is no run yet) with its composer: commands, and team notes. */
333
  export function ConversationPane({ id }: { id?: string }) {
334
  const { can } = useAuth();
335
- const { chat } = useShell();
336
  const qc = useQueryClient();
337
  const [notes, setNotes] = useState<Note[]>([]);
338
  const [text, setText] = useState('');
@@ -395,7 +385,7 @@ export function ConversationPane({ id }: { id?: string }) {
395
  };
396
  const submit = (e: FormEvent) => { e.preventDefault(); send(text); setText(''); };
397
  const placeholder = !id ? 'Type a business area, for example Procure-to-Pay'
398
- : mode === 'note' ? 'Add a note for the team (saved to the audit log)…' : 'Tell the co-worker what to do, for example “status”';
399
 
400
  return (
401
  <>
@@ -414,7 +404,15 @@ export function ConversationPane({ id }: { id?: string }) {
414
  </div>
415
  )}
416
  <div className="fpt-compose-row">
417
- {canNote && (
 
 
 
 
 
 
 
 
418
  <SegmentedControl size="xs" radius="xl" value={mode} onChange={(v) => setMode(v as 'command' | 'note')} aria-label="What you are typing"
419
  data={[{ value: 'command', label: 'Command' }, { value: 'note', label: 'Team note' }]} />
420
  )}
 
1
+ import { ActionIcon, Anchor, Button, Group, Modal, SegmentedControl, Text, TextInput, Tooltip } from '@mantine/core';
2
+ import { IconArrowDown, IconCircleCheck, IconEye, IconLoader2, IconNote, IconPhoto, IconSend, IconTerminal2, IconUserCheck } from '@tabler/icons-react';
3
  import { useMutation, useQueryClient } from '@tanstack/react-query';
4
  import { useCallback, useEffect, useMemo, useRef, useState, type FormEvent, type ReactNode } from 'react';
5
  import { Link, Navigate, useNavigate, useParams, useSearchParams } from 'react-router-dom';
6
+ import { agentName, MODULE_NAMES, STEP_WORDS } from '../agents';
7
  import { api, unwrap } from '../api/client';
8
  import { useApproveCases, useBrand, useGate, usePodProfile, usePods, useRun, useRunAction, useRunReadiness, useStartRun } from '../api/hooks';
9
  import type { ApproveGate } from '../api/types';
 
27
  type Status = { suggest: string[] };
28
  type ViewProps = { notes: Note[]; say: (who: Note['who'], body: ReactNode) => void; setStatus: (s: Status) => void };
29
 
30
+ // STEP_WORDS lives in agents.ts (shared by the team strip, the board and the activity log); re-exported here.
31
+ export { STEP_WORDS } from '../agents';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
32
 
33
  export function Msg({ who, children, wide }: { who: 'you' | 'bot'; children: ReactNode; wide?: boolean }) {
34
  return (
 
179
  const status = r?.status;
180
  const decision = r ? r.decision ?? Object.values(r.decisions ?? {})[0] ?? null : null;
181
  const [announce, setAnnounce] = useState('');
182
+ const seenStage = useRef<string | null>(null);
183
  useEffect(() => clear(), [stage]); // eslint-disable-line react-hooks/exhaustive-deps -- typed notes belong to the step they were typed in
184
  useEffect(() => {
185
  setStatus({ suggest: { prepare: ['Status', 'Cancel'], approve: ['Approve all', 'Status', 'Cancel'], testing: ['Status', 'Cancel'], judge: ['Status'],
 
188
  // say each new stage once for screen readers, and bring the stage's main button into reach (never stealing focus from typing)
189
  useEffect(() => {
190
  if (!r) return;
191
+ const first = seenStage.current === null; // the run was just opened: leave focus at the top
192
+ seenStage.current = stage;
193
  setAnnounce(ANNOUNCE[stage](scenarios, decisionWords(decision)));
194
+ if (first || (stage !== 'approve' && stage !== 'judge')) return;
195
  const t = window.setTimeout(() => {
196
  const a = document.activeElement;
197
  const thread = document.querySelector('[data-testid="assistant-thread"]');
 
241
  return (
242
  <>
243
  <div className="fpt-sr-only" role="status">{announce}</div>
244
+ <Msg who="you">Test {areas} · {browserRun ? 'Full browser run' : 'Quick simulation'} · {fusion ? 'Oracle Fusion pod' : 'Practice environment'}</Msg>
245
  <Msg who="bot">
246
  <Text size="sm" mb={10}>On it. This is test run <Link to={`/runs/${id}`}>{runTitle(r)}</Link>. The team:</Text>
247
  <TeamStrip runId={id} finished={done} events={events} />
 
278
  <>
279
  <Phase>Your decision</Phase>
280
  <Msg who="bot" wide>
281
+ <StageCard stage="judge">
282
+ <Judge r={r} onShowScreen={panel && browserRun ? (c) => panel.show('screens', { scenario: c }) : undefined}
283
+ onShowSteps={panel && !browserRun ? (c) => panel.show('steps', { scenario: c }) : undefined} />
284
+ </StageCard>
285
  </Msg>
286
  </>
287
  )}
 
322
  /** The run conversation (or the intake when there is no run yet) with its composer: commands, and team notes. */
323
  export function ConversationPane({ id }: { id?: string }) {
324
  const { can } = useAuth();
325
+ const { chat, size } = useShell();
326
  const qc = useQueryClient();
327
  const [notes, setNotes] = useState<Note[]>([]);
328
  const [text, setText] = useState('');
 
385
  };
386
  const submit = (e: FormEvent) => { e.preventDefault(); send(text); setText(''); };
387
  const placeholder = !id ? 'Type a business area, for example Procure-to-Pay'
388
+ : mode === 'note' ? (size === 'phone' ? 'Note for the team (saved to the audit log)' : 'Add a note for the team (saved to the audit log)…') : 'Tell the co-worker what to do, for example “status”';
389
 
390
  return (
391
  <>
 
404
  </div>
405
  )}
406
  <div className="fpt-compose-row">
407
+ {canNote && size === 'phone' && (
408
+ <Tooltip label={mode === 'note' ? 'Writing a team note. Switch to command' : 'Writing a command. Switch to team note'}>
409
+ <ActionIcon variant={mode === 'note' ? 'filled' : 'default'} size={36} radius="xl" aria-label={mode === 'note' ? 'Switch to command' : 'Switch to team note'}
410
+ onClick={() => setMode((m) => (m === 'note' ? 'command' : 'note'))}>
411
+ {mode === 'note' ? <IconNote size={17} /> : <IconTerminal2 size={17} />}
412
+ </ActionIcon>
413
+ </Tooltip>
414
+ )}
415
+ {canNote && size !== 'phone' && (
416
  <SegmentedControl size="xs" radius="xl" value={mode} onChange={(v) => setMode(v as 'command' | 'note')} aria-label="What you are typing"
417
  data={[{ value: 'command', label: 'Command' }, { value: 'note', label: 'Team note' }]} />
418
  )}
web/src/pages/RunGuide.tsx CHANGED
@@ -128,7 +128,7 @@ const CHOICES: { value: FailureChoice; title: string; body: string }[] = [
128
  ];
129
 
130
  /** Failures one at a time: what we expected, what happened, our suggestion, and three plain choices. */
131
- export function Judge({ r, onShowScreen }: { r: Run; onShowScreen?: (caseId: string) => void }) {
132
  const q = useRunFailures(r.run_id);
133
  const submit = useHumanReview(r.run_id);
134
  const pending = (q.data ?? []).filter((f) => f.pending);
@@ -169,7 +169,8 @@ export function Judge({ r, onShowScreen }: { r: Run; onShowScreen?: (caseId: str
169
  <div className="fpt-card" style={{ padding: 10, background: 'var(--fpt-surface-2)' }}><Text size="xs" c="dimmed">We expected</Text><Text size="sm">{f.expected ?? 'the step to complete'}</Text></div>
170
  <div className="fpt-card" style={{ padding: 10, background: 'var(--pill-red-bg)', borderColor: 'transparent' }}><Text size="xs" c="dimmed">What happened</Text><Text size="sm">{f.actual ?? 'it did not complete'}</Text></div>
171
  </div>
172
- {onShowScreen && <Button variant="subtle" size="compact-xs" mt={6} onClick={() => onShowScreen(f.case_id)}>See the failed screen</Button>}
 
173
  <Text size="sm" mt="sm"><b>Our suggestion:</b> {f.suggestion}</Text>
174
  <Text size="sm" fw={500} mt="md" mb={6}>Is this a real problem?</Text>
175
  <Stack gap={8} role="radiogroup" aria-label="Is this a real problem?">
 
128
  ];
129
 
130
  /** Failures one at a time: what we expected, what happened, our suggestion, and three plain choices. */
131
+ export function Judge({ r, onShowScreen, onShowSteps }: { r: Run; onShowScreen?: (caseId: string) => void; onShowSteps?: (caseId: string) => void }) {
132
  const q = useRunFailures(r.run_id);
133
  const submit = useHumanReview(r.run_id);
134
  const pending = (q.data ?? []).filter((f) => f.pending);
 
169
  <div className="fpt-card" style={{ padding: 10, background: 'var(--fpt-surface-2)' }}><Text size="xs" c="dimmed">We expected</Text><Text size="sm">{f.expected ?? 'the step to complete'}</Text></div>
170
  <div className="fpt-card" style={{ padding: 10, background: 'var(--pill-red-bg)', borderColor: 'transparent' }}><Text size="xs" c="dimmed">What happened</Text><Text size="sm">{f.actual ?? 'it did not complete'}</Text></div>
171
  </div>
172
+ {onShowScreen && r.playwright_mode !== 'stub' && <Button variant="subtle" size="compact-xs" mt={6} onClick={() => onShowScreen(f.case_id)}>See the failed screen</Button>}
173
+ {onShowSteps && <Button variant="subtle" size="compact-xs" mt={6} onClick={() => onShowSteps(f.case_id)}>Show the steps</Button>}
174
  <Text size="sm" mt="sm"><b>Our suggestion:</b> {f.suggestion}</Text>
175
  <Text size="sm" fw={500} mt="md" mb={6}>Is this a real problem?</Text>
176
  <Stack gap={8} role="radiogroup" aria-label="Is this a real problem?">
web/src/pages/RunPage.tsx CHANGED
@@ -3,7 +3,8 @@ import { IconExternalLink, IconFileTypePdf, IconHandStop, IconMessage, IconRobot
3
  import { useMutation, useQueryClient } from '@tanstack/react-query';
4
  import { useMemo, useState } from 'react';
5
  import { Link } from 'react-router-dom';
6
- import { AGENT_BY_NODE, agentName } from '../agents';
 
7
  import { api, unwrap } from '../api/client';
8
  import { useGraphSpec, useReport, useRun, useRunReadiness, useTemporal } from '../api/hooks';
9
  import { decisionWords } from '../glossary';
@@ -44,7 +45,7 @@ export function FeedCard({ e }: { e: RunEvent }) {
44
  if (e.kind === 'note') {
45
  return (
46
  <div className="fpt-card fpt-feed-item" style={{ background: 'var(--fpt-surface-2)' }}>
47
- <div className="fpt-feed-meta"><IconMessage size={12} /><b>{String(e.summary.by ?? 'someone')}</b><span>· note · {fmtTs(e.ts)}</span></div>
48
  <Text size="sm" mt={4} style={{ whiteSpace: 'pre-wrap' }}>{String(e.summary.text ?? '')}</Text>
49
  </div>
50
  );
@@ -53,7 +54,7 @@ export function FeedCard({ e }: { e: RunEvent }) {
53
  return (
54
  <div className="fpt-feed-meta" style={{ padding: '2px 4px' }}>
55
  <span className="fpt-dot" style={{ background: 'var(--fpt-line)', width: 7, height: 7, flex: '0 0 7px' }} aria-hidden />
56
- <span>Coordinator · {e.kind}{typeof e.summary?.status === 'string' ? `: ${String(e.summary.status).replace('_', ' ')}` : ''}{typeof e.summary?.message === 'string' ? ` · ${e.summary.message}` : ''} · {fmtTs(e.ts)}</span>
57
  </div>
58
  );
59
  }
@@ -61,8 +62,8 @@ export function FeedCard({ e }: { e: RunEvent }) {
61
  return (
62
  <div className="fpt-card fpt-feed-item" data-kind={e.kind}>
63
  <div className="fpt-feed-meta">
64
- <Pill tone={tone}>{agentName(e.node)}{typeof e.summary?.module === 'string' ? ` · ${e.summary.module}` : ''}</Pill>
65
- <span>run by Coordinator · {verb} · {fmtTs(e.ts)}</span>
66
  </div>
67
  <SummaryPills summary={e.summary} />
68
  </div>
@@ -126,7 +127,7 @@ export function Activity({ id }: { id: string }) {
126
  {r.pending_gate && !feed.some((e) => e.kind === 'interrupted') && <GateCard id={id} gate={r.pending_gate} />}
127
  {running.map((n) => (
128
  <div key={n} className="fpt-card fpt-feed-item fpt-live">
129
- <div className="fpt-feed-meta"><Pill tone="blue">{agentName(n)}</Pill><span>working…</span></div>
130
  </div>
131
  ))}
132
  <NoteBox id={id} />
 
3
  import { useMutation, useQueryClient } from '@tanstack/react-query';
4
  import { useMemo, useState } from 'react';
5
  import { Link } from 'react-router-dom';
6
+ import { AGENT_BY_NODE, stepName } from '../agents';
7
+ import { shortWhenSec } from '../runName';
8
  import { api, unwrap } from '../api/client';
9
  import { useGraphSpec, useReport, useRun, useRunReadiness, useTemporal } from '../api/hooks';
10
  import { decisionWords } from '../glossary';
 
45
  if (e.kind === 'note') {
46
  return (
47
  <div className="fpt-card fpt-feed-item" style={{ background: 'var(--fpt-surface-2)' }}>
48
+ <div className="fpt-feed-meta"><IconMessage size={12} /><b>{String(e.summary.by ?? 'someone')}</b><span title={fmtTs(e.ts)}>· note · {shortWhenSec(e.ts)}</span></div>
49
  <Text size="sm" mt={4} style={{ whiteSpace: 'pre-wrap' }}>{String(e.summary.text ?? '')}</Text>
50
  </div>
51
  );
 
54
  return (
55
  <div className="fpt-feed-meta" style={{ padding: '2px 4px' }}>
56
  <span className="fpt-dot" style={{ background: 'var(--fpt-line)', width: 7, height: 7, flex: '0 0 7px' }} aria-hidden />
57
+ <span>Coordinator · {e.kind}{typeof e.summary?.status === 'string' ? `: ${String(e.summary.status).replace('_', ' ')}` : ''}{typeof e.summary?.message === 'string' ? ` · ${e.summary.message}` : ''} · {shortWhenSec(e.ts)}</span>
58
  </div>
59
  );
60
  }
 
62
  return (
63
  <div className="fpt-card fpt-feed-item" data-kind={e.kind}>
64
  <div className="fpt-feed-meta">
65
+ <Pill tone={tone} title={`graph node: ${e.node}`}>{stepName(e.node)}{typeof e.summary?.module === 'string' ? ` · ${e.summary.module}` : ''}</Pill>
66
+ <span title={fmtTs(e.ts)}>run by Coordinator · {verb} · {shortWhenSec(e.ts)}</span>
67
  </div>
68
  <SummaryPills summary={e.summary} />
69
  </div>
 
127
  {r.pending_gate && !feed.some((e) => e.kind === 'interrupted') && <GateCard id={id} gate={r.pending_gate} />}
128
  {running.map((n) => (
129
  <div key={n} className="fpt-card fpt-feed-item fpt-live">
130
+ <div className="fpt-feed-meta"><Pill tone="blue" title={`graph node: ${n}`}>{stepName(n)}</Pill><span>working…</span></div>
131
  </div>
132
  ))}
133
  <NoteBox id={id} />
web/src/pages/RunWorkflow.tsx CHANGED
@@ -1,66 +1,6 @@
1
- import { Text } from '@mantine/core';
2
- import { IconArrowRight, IconCircleCheck, IconCircleDashed, IconCircleX, IconLoader2, IconRepeat, IconUserCheck } from '@tabler/icons-react';
3
- import { Fragment } from 'react';
4
- import { LAYOUT } from '../components/GraphView';
5
- import { nodeStates, useRunStream, type NodeState } from '../hooks/useRunStream';
6
- import { STEP_WORDS } from './AssistantPage';
7
 
8
- const PHASE_WORDS: Record<string, string> = { Research: 'Understand', Design: 'Choose', 'Data + scripts': 'Prepare', Execute: 'Test', Triage: 'Analyse', Report: 'Report' };
9
- const HUMAN = new Set(['approval_gate', 'human_review']);
10
- const STATE_WORDS: Record<NodeState, string> = { pending: 'Not started', running: 'Working now', done: 'Done', error: 'Failed', waiting: 'Waiting for you', skipped: 'Not needed' };
11
-
12
- function StateIcon({ s }: { s: NodeState }) {
13
- if (s === 'running') return <IconLoader2 size={16} className="fpt-spin" />;
14
- if (s === 'done') return <IconCircleCheck size={16} color="var(--pill-green-fg)" />;
15
- if (s === 'waiting') return <IconUserCheck size={16} color="var(--pill-amber-fg)" />;
16
- if (s === 'error') return <IconCircleX size={16} color="var(--pill-red-fg)" />;
17
- return <IconCircleDashed size={16} color="var(--fpt-dim)" />;
18
- }
19
-
20
- /** The workflow of this test run, left to right, with the live state of every step. */
21
- export function RunWorkflow({ id, status }: { id: string; status: string }) {
22
- const { events } = useRunStream(id);
23
- const nodes = LAYOUT.flatMap((p) => p.nodes);
24
- const finished = !['queued', 'running', 'waiting'].includes(status);
25
- const st = nodeStates(events, nodes, finished);
26
- const phaseState = (ns: string[]): NodeState => {
27
- const s = ns.map((n) => st[n]?.state ?? 'pending');
28
- if (s.includes('error')) return 'error';
29
- if (s.includes('waiting')) return 'waiting';
30
- if (s.includes('running')) return 'running';
31
- if (s.every((x) => x === 'done' || x === 'skipped') && s.includes('done')) return 'done';
32
- return s.includes('done') ? 'running' : s.every((x) => x === 'skipped') ? 'skipped' : 'pending';
33
- };
34
- return (
35
- <div data-testid="run-workflow">
36
- <Text size="sm" c="dimmed" mb="sm">How this test run flows, from reading the environment to the report. Each step shows its state now. The two steps marked “you” stop and wait for a person.</Text>
37
- <div className="fpt-flow" role="list" aria-label="Workflow of this test run">
38
- {LAYOUT.map((p, i) => {
39
- const ps = phaseState(p.nodes);
40
- return (
41
- <Fragment key={p.phase}>
42
- {i > 0 && <IconArrowRight className="fpt-flow-arrow" size={20} aria-hidden />}
43
- <section className="fpt-flow-phase" data-state={ps} role="listitem" aria-label={`${PHASE_WORDS[p.phase] ?? p.phase}: ${STATE_WORDS[ps]}`}>
44
- <header><span className="fpt-flow-num">{i + 1}</span><b>{PHASE_WORDS[p.phase] ?? p.phase}</b></header>
45
- {p.nodes.map((n) => {
46
- const s = st[n]?.state ?? 'pending';
47
- const [name, words] = STEP_WORDS[n] ?? [n.replace(/_/g, ' '), ''];
48
- return (
49
- <div key={n} className="fpt-flow-node" data-state={s} data-testid={`flow-${n}`} title={STATE_WORDS[s]}>
50
- <StateIcon s={s} />
51
- <div><b>{name}{HUMAN.has(n) && <span className="fpt-flow-you">you</span>}</b><span>{s === 'waiting' ? 'Waiting for you' : words}</span></div>
52
- </div>
53
- );
54
- })}
55
- {p.phase === 'Execute' && <div className="fpt-flow-note"><IconRepeat size={13} />A failed scenario is tried once more</div>}
56
- </section>
57
- </Fragment>
58
- );
59
- })}
60
- </div>
61
- <div className="fpt-flow-legend" aria-label="Legend">
62
- {(['done', 'running', 'waiting', 'pending', 'error'] as NodeState[]).map((s) => <span key={s}><StateIcon s={s} />{STATE_WORDS[s]}</span>)}
63
- </div>
64
- </div>
65
- );
66
  }
 
1
+ import { TeamBoard } from './TeamBoard';
 
 
 
 
 
2
 
3
+ /** The workflow of a test run, shown as the team board (kept as RunWorkflow for callers). */
4
+ export function RunWorkflow({ id, status, gate, error, quick }: { id: string; status: string; gate?: string | null; error?: string | null; quick?: boolean }) {
5
+ return <TeamBoard runId={id} status={status} gate={gate} error={error} quick={quick} />;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6
  }
web/src/pages/RunWorkspace.tsx CHANGED
@@ -1,11 +1,12 @@
1
- import { Alert, Button, CopyButton, Group, Menu, Skeleton, Tabs, Text, Tooltip } from '@mantine/core';
2
- import { IconAlertTriangle, IconArrowLeft, IconChevronDown, IconLayoutSidebarRight, IconLayoutSidebarRightCollapse, IconPlayerPlay } from '@tabler/icons-react';
3
  import { useEffect, useRef, useState, type ReactNode } from 'react';
4
- import { Link, useNavigate, useParams } from 'react-router-dom';
5
  import { MODULE_NAMES } from '../agents';
6
- import { useEvidence, useLive, usePods, useRun, useRunAction, useRunReadiness } from '../api/hooks';
 
7
  import { useAuth } from '../auth/AuthContext';
8
- import { Can, DecisionBadge, ErrorAlert, GlossaryButton, MOCK_TEXT } from '../components/common';
9
  import { EmptyState } from '../components/shell/EmptyState';
10
  import { EnvBadge, envKind, useChosenEnv } from '../components/shell/EnvSwitcher';
11
  import { ExcelPanel, ReportSummary, ScenarioSteps } from '../components/shell/panelTabs';
@@ -45,7 +46,7 @@ const CHIP_WORDS = (r: { status: string; pending_gate?: string | null }) =>
45
  * Owns /runs/new, /runs/:id and /runs/:id/:tab. */
46
  export function RunWorkspace() {
47
  return (
48
- <SidePanelProvider tabs={PANEL_TABS}>
49
  <Workspace />
50
  </SidePanelProvider>
51
  );
@@ -75,6 +76,41 @@ function Workspace() {
75
  const pod = r ? pods.find((p) => p.id === r.pod_id) : chosen;
76
  const fusion = envKind(pod?.kind) === 'fusion';
77
  const [proofFilter, setProofFilter] = useState<ProofFilter>('all');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
78
 
79
  // /runs/:id/live, /proof, /script open the panel on that tab
80
  useEffect(() => { if (tab && PANEL_ROUTE[tab]) panel.show(PANEL_ROUTE[tab]); }, [id, tab]); // eslint-disable-line react-hooks/exhaustive-deps -- on navigation only
@@ -111,13 +147,13 @@ function Workspace() {
111
  report: decided.length ? <span className="fpt-sdot" data-state={runState(r!)} aria-hidden /> : undefined,
112
  steps: panel.scenario ? <span className="fpt-panel-count">{panel.scenario}</span> : undefined,
113
  };
114
- const none = (title: string) => <EmptyState title={title} body="Start a test run: it opens here, with its evidence beside the conversation." />;
115
  const render: Partial<Record<PanelTab, () => ReactNode>> = {
116
- live: () => (r ? <LiveView id={r.run_id} status={r.status} gate={r.pending_gate} reasonQuick={!browserRun} compact /> : none('Nothing to watch yet')),
117
- screens: () => (r ? <RunProof key={proofFilter} id={r.run_id} quick={!browserRun} oneColumn fusionPod={fusion ? r.pod_name ?? pod?.name ?? '' : null} filter={proofFilter} /> : none('No screens yet')),
118
- report: () => (r ? <ReportSummary runId={r.run_id} /> : none('No report yet')),
119
- excel: () => (r ? <ExcelPanel runId={r.run_id} finished={r.status === 'completed'} /> : none('No test script yet')),
120
- steps: () => <ScenarioSteps runId={r?.run_id} scenarioId={panel.scenario} />,
121
  };
122
 
123
  // ------------------------------------------------------------------ top bar
@@ -135,19 +171,72 @@ function Workspace() {
135
  top = <TopBar title="Test run" honesty={false} middle={run.isLoading ? <Skeleton height={22} width={150} radius="xl" /> : undefined} actions={panelToggle} />;
136
  } else {
137
  const menuGo = (v: string) => nav(`/runs/${r.run_id}/${v}`);
138
- top = (
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
139
  <TopBar
140
  title={runTitle(r)} titleTestId="run-title" honesty={false}
141
  sub={<>
142
  <EnvBadge kind={fusion ? 'fusion' : 'mock'} name={r.pod_name ?? pod?.name} />
143
- {!fusion && !sidebarExpanded && <span className="fpt-topbar-mock">{MOCK_TEXT}</span>}
144
- <span>{browserRun ? 'Full browser run' : 'Quick simulation (no browser)'}</span>
145
- {r.modules.length > 1 && <span>{r.modules.map((m) => MODULE_NAMES[m] ?? m).join(', ')}</span>}
146
- <CopyButton value={r.run_id}>{({ copied, copy }) => (
147
- <Tooltip label={copied ? 'Copied' : `Reference id ${r.run_id} (click to copy)`}>
148
- <button type="button" className="fpt-pill fpt-idpill" onClick={copy} data-testid="run-id" aria-label={`Copy the reference id ${r.run_id}`}>{copied ? 'copied' : 'ref'}</button>
149
- </Tooltip>
150
- )}</CopyButton>
151
  </>}
152
  middle={<>
153
  <span className="fpt-statechip" data-state={runState(r)}>
@@ -162,18 +251,7 @@ function Workspace() {
162
  <GlossaryButton />
163
  <Menu position="bottom-end" withArrow>
164
  <Menu.Target><Button variant="subtle" color="gray" size="compact-sm" rightSection={<IconChevronDown size={12} />} data-testid="all-details">All details</Button></Menu.Target>
165
- <Menu.Dropdown>
166
- {browserRun && <Menu.Item onClick={() => menuGo('live')}>Watch the test live</Menu.Item>}
167
- <Menu.Item onClick={() => menuGo('proof')}>Screens</Menu.Item>
168
- <Menu.Item onClick={() => menuGo('scenarios')}>Scenarios</Menu.Item>
169
- <Menu.Item onClick={() => menuGo('failures')}>Failures</Menu.Item>
170
- <Menu.Item onClick={() => menuGo('workflow')}>Team board</Menu.Item>
171
- <Menu.Item onClick={() => menuGo('report')}>Report and sign-off</Menu.Item>
172
- <Menu.Item onClick={() => menuGo('script')}>Excel test script</Menu.Item>
173
- {Object.entries(MORE_ALL).map(([v, label]) => <Menu.Item key={v} onClick={() => menuGo(v)}>{label}</Menu.Item>)}
174
- {can('admin') && <Menu.Label>Engineering views (admin)</Menu.Label>}
175
- {can('admin') && Object.entries(MORE_ADMIN).map(([v, label]) => <Menu.Item key={v} onClick={() => menuGo(v)}>{label}</Menu.Item>)}
176
- </Menu.Dropdown>
177
  </Menu>
178
  <Can perm="run.control">
179
  {['interrupted', 'failed'].includes(r.status) && <Button onClick={() => action.mutate({ id: r.run_id, action: 'resume' })} rightSection={<IconPlayerPlay size={12} />}>Resume</Button>}
@@ -196,6 +274,7 @@ function Workspace() {
196
  : <ConversationPane id={id} />}
197
  </div>
198
  <SidePanel tabs={PANEL_TABS} runId={id} scenarioId={panel.scenario} render={render} badges={badges} />
 
199
  </div>
200
  );
201
  }
@@ -211,7 +290,7 @@ function DetailView({ id, tab, r, watching, browserRun, fusionPod }: { id: strin
211
  const body: Record<string, () => ReactNode> = {
212
  scenarios: () => <ScenarioReview id={id} waiting={r.pending_gate === 'approve_cases'} />,
213
  failures: () => <FailureReview id={id} waiting={r.pending_gate === 'human_review'} />,
214
- workflow: () => <RunWorkflow id={id} status={r.status} />,
215
  report: () => <SignOffReport id={id} />,
216
  process: () => <Overview id={id} quick={!browserRun} status={r.status} gate={r.pending_gate} />,
217
  changes: () => <RunChanges id={id} />,
@@ -225,8 +304,7 @@ function DetailView({ id, tab, r, watching, browserRun, fusionPod }: { id: strin
225
  return (
226
  <div className="fpt-ws-scroll" tabIndex={-1}>
227
  <div className="fpt-detail-head">
228
- <Button component={Link} to={`/runs/${id}`} variant="subtle" color="gray" size="compact-sm" leftSection={<IconArrowLeft size={14} />}>Conversation</Button>
229
- <Text fw={600} size="sm" className="fpt-detail-title">{VIEW_TITLE[tab]}{your(tab)}</Text>
230
  <Tabs value={tab} onChange={(v) => v && nav(`/runs/${id}/${v}`)} variant="pills" radius="xl" className="fpt-detail-switch" keepMounted={false}>
231
  <Tabs.List>
232
  <Tabs.Tab value="scenarios">Scenarios{your('scenarios')}</Tabs.Tab>
 
1
+ import { ActionIcon, Alert, Button, CopyButton, Group, Menu, Modal, Skeleton, Tabs, Text, Tooltip } from '@mantine/core';
2
+ import { IconAlertTriangle, IconArrowLeft, IconChevronDown, IconDots, IconLayoutSidebarRight, IconLayoutSidebarRightCollapse, IconPlayerPlay, IconShieldLock } from '@tabler/icons-react';
3
  import { useEffect, useRef, useState, type ReactNode } from 'react';
4
+ import { Link, useNavigate, useParams, useSearchParams } from 'react-router-dom';
5
  import { MODULE_NAMES } from '../agents';
6
+ import { useEvidence, useGate, useLive, usePods, useRun, useRunAction, useRunFailures, useRunReadiness } from '../api/hooks';
7
+ import type { ApproveGate } from '../api/types';
8
  import { useAuth } from '../auth/AuthContext';
9
+ import { Can, DecisionBadge, ErrorAlert, GlossaryButton, GlossaryList, MOCK_TEXT } from '../components/common';
10
  import { EmptyState } from '../components/shell/EmptyState';
11
  import { EnvBadge, envKind, useChosenEnv } from '../components/shell/EnvSwitcher';
12
  import { ExcelPanel, ReportSummary, ScenarioSteps } from '../components/shell/panelTabs';
 
46
  * Owns /runs/new, /runs/:id and /runs/:id/:tab. */
47
  export function RunWorkspace() {
48
  return (
49
+ <SidePanelProvider tabs={PANEL_TABS} runId={useParams().id}>
50
  <Workspace />
51
  </SidePanelProvider>
52
  );
 
76
  const pod = r ? pods.find((p) => p.id === r.pod_id) : chosen;
77
  const fusion = envKind(pod?.kind) === 'fusion';
78
  const [proofFilter, setProofFilter] = useState<ProofFilter>('all');
79
+ const [params] = useSearchParams();
80
+ const [glossary, setGlossary] = useState(false);
81
+ const phone = size === 'phone';
82
+ const gate = useGate(id ?? '', !!id && r?.pending_gate === 'approve_cases');
83
+ const failures = useRunFailures(id ?? '', !!id && r?.status === 'waiting_review' && !browserRun);
84
+
85
+ // Opening a run: pick the panel tab from the run's state, unless the URL names a tab or the person chose one in this run.
86
+ const initFor = useRef<string | null>(null);
87
+ useEffect(() => {
88
+ if (!id || !r || initFor.current === id) return;
89
+ if ((tab && PANEL_ROUTE[tab]) || panel.chosenInRun()) { initFor.current = id; return; }
90
+ if (params.get('scenario')) { initFor.current = id; panel.pick('steps'); return; }
91
+ const STOPPED = ['failed', 'killed', 'cancelled', 'interrupted'];
92
+ let choice: { tab: PanelTab; scenario?: string; filter?: ProofFilter } | null = null;
93
+ if (r.status === 'completed') choice = { tab: 'report' };
94
+ else if (r.status === 'waiting_review' || r.pending_gate === 'human_review') {
95
+ if (browserRun) choice = { tab: 'screens', filter: 'failed' };
96
+ else if (failures.data) {
97
+ const f = failures.data.find((x) => x.pending) ?? failures.data[0];
98
+ choice = f ? { tab: 'steps', scenario: f.case_id } : { tab: 'report' };
99
+ }
100
+ } else if (r.status === 'waiting_approval' || r.pending_gate === 'approve_cases') {
101
+ if (gate.data !== undefined) {
102
+ const pend = gate.data?.gate === 'approve_cases' ? (gate.data as ApproveGate).pending : [];
103
+ const p = pend.find((x) => x.origin === 'ai') ?? pend.find((x) => x.changed_by_patch || x.new_or_changed);
104
+ choice = p ? { tab: 'steps', scenario: p.id } : { tab: 'excel' };
105
+ }
106
+ } else if (['queued', 'running'].includes(r.status)) choice = { tab: browserRun && r.live_view ? 'live' : 'excel' };
107
+ else if (STOPPED.includes(r.status)) choice = { tab: browserRun ? 'screens' : 'report' };
108
+ else choice = { tab: 'excel' };
109
+ if (!choice) return; // waiting for the gate or the failures to load
110
+ initFor.current = id;
111
+ if (choice.filter) setProofFilter(choice.filter);
112
+ panel.pick(choice.tab, { scenario: choice.scenario });
113
+ }, [id, r?.status, r?.pending_gate, gate.data, failures.data]); // eslint-disable-line react-hooks/exhaustive-deps
114
 
115
  // /runs/:id/live, /proof, /script open the panel on that tab
116
  useEffect(() => { if (tab && PANEL_ROUTE[tab]) panel.show(PANEL_ROUTE[tab]); }, [id, tab]); // eslint-disable-line react-hooks/exhaustive-deps -- on navigation only
 
147
  report: decided.length ? <span className="fpt-sdot" data-state={runState(r!)} aria-hidden /> : undefined,
148
  steps: panel.scenario ? <span className="fpt-panel-count">{panel.scenario}</span> : undefined,
149
  };
150
+ const none = () => <EmptyState title="Nothing here yet" body="Your test run's evidence appears here: the live browser, each scenario's screens, the report and the Excel files." />;
151
  const render: Partial<Record<PanelTab, () => ReactNode>> = {
152
+ live: () => (r ? <LiveView id={r.run_id} status={r.status} gate={r.pending_gate} reasonQuick={!browserRun} compact /> : none()),
153
+ screens: () => (r ? <RunProof key={proofFilter} id={r.run_id} quick={!browserRun} oneColumn fusionPod={fusion ? r.pod_name ?? pod?.name ?? '' : null} filter={proofFilter} /> : none()),
154
+ report: () => (r ? <ReportSummary runId={r.run_id} /> : none()),
155
+ excel: () => (r ? <ExcelPanel runId={r.run_id} finished={r.status === 'completed'} /> : none()),
156
+ steps: () => (id ? <ScenarioSteps runId={r?.run_id} scenarioId={panel.scenario} /> : none()),
157
  };
158
 
159
  // ------------------------------------------------------------------ top bar
 
171
  top = <TopBar title="Test run" honesty={false} middle={run.isLoading ? <Skeleton height={22} width={150} radius="xl" /> : undefined} actions={panelToggle} />;
172
  } else {
173
  const menuGo = (v: string) => nav(`/runs/${r.run_id}/${v}`);
174
+ const detailItems = (
175
+ <>
176
+ {browserRun && <Menu.Item onClick={() => menuGo('live')}>Watch the test live</Menu.Item>}
177
+ <Menu.Item onClick={() => menuGo('proof')}>Screens</Menu.Item>
178
+ <Menu.Item onClick={() => menuGo('scenarios')}>Scenarios</Menu.Item>
179
+ <Menu.Item onClick={() => menuGo('failures')}>Failures</Menu.Item>
180
+ <Menu.Item onClick={() => menuGo('workflow')}>Team board</Menu.Item>
181
+ <Menu.Item onClick={() => menuGo('report')}>Report and sign-off</Menu.Item>
182
+ <Menu.Item onClick={() => menuGo('script')}>Excel test script</Menu.Item>
183
+ {Object.entries(MORE_ALL).map(([v, label]) => <Menu.Item key={v} onClick={() => menuGo(v)}>{label}</Menu.Item>)}
184
+ {can('admin') && <Menu.Label>Engineering views (admin)</Menu.Label>}
185
+ {can('admin') && Object.entries(MORE_ADMIN).map(([v, label]) => <Menu.Item key={v} onClick={() => menuGo(v)}>{label}</Menu.Item>)}
186
+ </>
187
+ );
188
+ const refPill = (
189
+ <CopyButton value={r.run_id}>{({ copied, copy }) => (
190
+ <Tooltip label={copied ? 'Copied' : `Reference id ${r.run_id} (click to copy)`}>
191
+ <button type="button" className="fpt-pill fpt-idpill" onClick={copy} data-testid="run-id" aria-label={`Copy the reference id ${r.run_id}`}>{copied ? 'copied' : 'ref'}</button>
192
+ </Tooltip>
193
+ )}</CopyButton>
194
+ );
195
+ const chip = (
196
+ <span className="fpt-statechip" data-state={runState(r)}>
197
+ <StatusDot state={runState(r)} label={CHIP_WORDS(r)} decorative />{CHIP_WORDS(r)}
198
+ </span>
199
+ );
200
+ if (phone) {
201
+ top = (
202
+ <TopBar title={runTitle(r)} titleTestId="run-title" honesty={false}
203
+ sub={<>
204
+ {chip}
205
+ {Object.values(r.decisions ?? {}).map((d, i) => <DecisionBadge key={i} decision={d} size="sm" />)}
206
+ {fusion
207
+ ? <EnvBadge kind="fusion" name={r.pod_name ?? pod?.name} />
208
+ : <span className="fpt-pill" data-tone="amber"><IconShieldLock size={11} aria-hidden />Practice environment · {MOCK_TEXT}</span>}
209
+ {refPill}
210
+ </>}
211
+ actions={<>
212
+ {panelToggle}
213
+ <Menu position="bottom-end" withArrow>
214
+ <Menu.Target>
215
+ <ActionIcon variant="default" size={36} radius="md" aria-label="More actions for this test run" data-testid="all-details-phone"><IconDots size={18} /></ActionIcon>
216
+ </Menu.Target>
217
+ <Menu.Dropdown>
218
+ <Menu.Label>All details</Menu.Label>
219
+ {detailItems}
220
+ <Menu.Divider />
221
+ <CopyButton value={r.run_id}>{({ copy }) => <Menu.Item onClick={copy}>Copy reference id</Menu.Item>}</CopyButton>
222
+ <Can perm="run.control">
223
+ {['interrupted', 'failed'].includes(r.status) && <Menu.Item onClick={() => action.mutate({ id: r.run_id, action: 'resume' })}>Resume</Menu.Item>}
224
+ {!TERMINAL.includes(r.status) && <Menu.Item color="red" onClick={() => action.mutate({ id: r.run_id, action: 'cancel', reason: 'cancelled from the run page' })}>Cancel test run</Menu.Item>}
225
+ </Can>
226
+ <Menu.Item onClick={() => setGlossary(true)}>What do these words mean?</Menu.Item>
227
+ </Menu.Dropdown>
228
+ </Menu>
229
+ </>}
230
+ />
231
+ );
232
+ } else top = (
233
  <TopBar
234
  title={runTitle(r)} titleTestId="run-title" honesty={false}
235
  sub={<>
236
  <EnvBadge kind={fusion ? 'fusion' : 'mock'} name={r.pod_name ?? pod?.name} />
237
+ {!fusion && !sidebarExpanded && <span className="fpt-topbar-mock fpt-topbar-trunc">{MOCK_TEXT}</span>}
238
+ <span className="fpt-topbar-trunc">{browserRun ? 'Full browser run' : 'Quick simulation'}{r.modules.length > 1 ? ` · ${r.modules.map((m) => MODULE_NAMES[m] ?? m).join(', ')}` : ''}</span>
239
+ {refPill}
 
 
 
 
 
240
  </>}
241
  middle={<>
242
  <span className="fpt-statechip" data-state={runState(r)}>
 
251
  <GlossaryButton />
252
  <Menu position="bottom-end" withArrow>
253
  <Menu.Target><Button variant="subtle" color="gray" size="compact-sm" rightSection={<IconChevronDown size={12} />} data-testid="all-details">All details</Button></Menu.Target>
254
+ <Menu.Dropdown>{detailItems}</Menu.Dropdown>
 
 
 
 
 
 
 
 
 
 
 
255
  </Menu>
256
  <Can perm="run.control">
257
  {['interrupted', 'failed'].includes(r.status) && <Button onClick={() => action.mutate({ id: r.run_id, action: 'resume' })} rightSection={<IconPlayerPlay size={12} />}>Resume</Button>}
 
274
  : <ConversationPane id={id} />}
275
  </div>
276
  <SidePanel tabs={PANEL_TABS} runId={id} scenarioId={panel.scenario} render={render} badges={badges} />
277
+ <Modal opened={glossary} onClose={() => setGlossary(false)} title="Words used in this app" size="lg"><GlossaryList /></Modal>
278
  </div>
279
  );
280
  }
 
290
  const body: Record<string, () => ReactNode> = {
291
  scenarios: () => <ScenarioReview id={id} waiting={r.pending_gate === 'approve_cases'} />,
292
  failures: () => <FailureReview id={id} waiting={r.pending_gate === 'human_review'} />,
293
+ workflow: () => <RunWorkflow id={id} status={r.status} gate={r.pending_gate} error={r.error} quick={!browserRun} />,
294
  report: () => <SignOffReport id={id} />,
295
  process: () => <Overview id={id} quick={!browserRun} status={r.status} gate={r.pending_gate} />,
296
  changes: () => <RunChanges id={id} />,
 
304
  return (
305
  <div className="fpt-ws-scroll" tabIndex={-1}>
306
  <div className="fpt-detail-head">
307
+ <Button component={Link} to={`/runs/${id}`} variant="subtle" color="gray" size="compact-sm" leftSection={<IconArrowLeft size={14} />} style={{ flex: '0 0 auto' }}>Conversation</Button>
 
308
  <Tabs value={tab} onChange={(v) => v && nav(`/runs/${id}/${v}`)} variant="pills" radius="xl" className="fpt-detail-switch" keepMounted={false}>
309
  <Tabs.List>
310
  <Tabs.Tab value="scenarios">Scenarios{your('scenarios')}</Tabs.Tab>
web/src/pages/TeamBoard.test.tsx ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { act, screen } from '@testing-library/react';
2
+ import { afterEach, describe, expect, it, vi } from 'vitest';
3
+ import type { RunEvent } from '../hooks/useRunStream';
4
+ import { jsonResponse, renderUi } from '../test/utils';
5
+ import { agentFacts, didWords, duration, TeamBoardView } from './TeamBoard';
6
+
7
+ const T0 = new Date('2026-10-17T10:00:00Z').getTime();
8
+ const at = (s: number) => new Date(T0 + s * 1000).toISOString();
9
+ const ev = (seq: number, s: number, node: string | null, kind: string, summary: Record<string, unknown> = {}): RunEvent => ({ seq, ts: at(s), node, kind, summary });
10
+
11
+ describe('team board', () => {
12
+ afterEach(() => { vi.useRealTimers(); vi.restoreAllMocks(); });
13
+
14
+ it('folds events into what each agent did and how long it took', () => {
15
+ const events = [ev(1, 0, 'scout', 'started'), ev(2, 12, 'scout', 'finished', { ms: 12000 }), ev(3, 12, 'test_generator', 'started'),
16
+ ev(4, 13, 'test_generator', 'finished', { n_test_cases: 79, ms: 900 }), ev(5, 14, 'executor', 'started'), ev(6, 20, 'executor', 'error', { error: 'browser crashed' })];
17
+ const f = agentFacts(events);
18
+ expect(f.scout).toMatchObject({ startedAt: at(0), finishedAt: at(12), ms: 12000 });
19
+ expect(f.executor.error).toBe('browser crashed');
20
+ expect(didWords('test_generator', f.test_generator.last)).toBe('Chose 79 scenarios');
21
+ expect(didWords('scout', f.scout.last)).toBe('Read the test environment');
22
+ expect(duration(12000)).toBe('12 s');
23
+ expect(duration(252000)).toBe('4 min 12 s');
24
+ });
25
+
26
+ it('shows every agent card, the Coordinator, and flags an agent that went quiet after the threshold', async () => {
27
+ vi.spyOn(globalThis, 'fetch').mockImplementation(async () => jsonResponse({ detail: 'not signed in' }, 401));
28
+ vi.useFakeTimers({ toFake: ['setInterval', 'clearInterval', 'Date'] });
29
+ vi.setSystemTime(T0 + 30_000);
30
+ const events = [ev(1, 0, 'scout', 'started'), ev(2, 12, 'scout', 'finished', { ms: 12000 }), ev(3, 12, 'research_module', 'started', { module: 'P2P' })];
31
+ renderUi(<TeamBoardView runId="r1" status="running" events={events} quick={false} />, { auth: true });
32
+ expect(screen.getByTestId('run-workflow')).toBeInTheDocument();
33
+ for (const n of ['scout', 'research_module', 'approval_gate', 'executor', 'reporter', 'learner']) expect(screen.getByTestId(`flow-${n}`)).toBeInTheDocument();
34
+ expect(screen.getByTestId('flow-scout')).toHaveAttribute('aria-label', 'Scout: Done');
35
+ expect(screen.getByTestId('flow-research_module')).toHaveAttribute('aria-label', 'Research: Working now');
36
+ expect(screen.getByTestId('flow-test_generator')).toHaveTextContent('Chooses the scenarios');
37
+ // 3 minutes without a new event from the stream
38
+ await act(async () => { vi.advanceTimersByTime(3 * 60_000); });
39
+ expect(screen.getByTestId('flow-research_module')).toHaveAttribute('aria-label', 'Research: No news for 3 min');
40
+ expect(screen.getByRole('status')).toHaveTextContent('Research has been quiet for 3 min. It may be waiting on the test environment.');
41
+ });
42
+
43
+ it('shows a failed agent with its error and the run-level stop', () => {
44
+ vi.spyOn(globalThis, 'fetch').mockImplementation(async () => jsonResponse({ detail: 'not signed in' }, 401));
45
+ const events = [ev(1, 0, 'executor', 'started'), ev(2, 5, 'executor', 'error', { error: 'Playwright produced no JSON report' })];
46
+ renderUi(<TeamBoardView runId="r1" status="failed" error="node executor failed" events={events} quick={false} />, { auth: true });
47
+ expect(screen.getByTestId('flow-executor')).toHaveAttribute('data-state', 'error');
48
+ expect(screen.getByTestId('flow-executor')).toHaveAttribute('aria-label', 'Test runner: Failed');
49
+ expect(screen.getByTestId('flow-executor')).toHaveTextContent('Playwright produced no JSON report');
50
+ expect(screen.getByRole('status')).toHaveTextContent('This test run stopped: node executor failed.');
51
+ expect(screen.getByRole('listitem', { name: 'Test: Failed' })).toBeInTheDocument();
52
+ });
53
+
54
+ it('uses the shorter quiet threshold for quick simulations and none once the run has finished', async () => {
55
+ vi.spyOn(globalThis, 'fetch').mockImplementation(async () => jsonResponse({ detail: 'not signed in' }, 401));
56
+ vi.useFakeTimers({ toFake: ['setInterval', 'clearInterval', 'Date'] });
57
+ vi.setSystemTime(T0 + 5_000);
58
+ const events = [ev(1, 0, 'scout', 'started')];
59
+ const { unmount } = renderUi(<TeamBoardView runId="r1" status="running" events={events} quick />, { auth: true });
60
+ await act(async () => { vi.advanceTimersByTime(60_000); });
61
+ expect(screen.getByTestId('flow-scout')).toHaveAttribute('aria-label', 'Scout: No news for 1 min');
62
+ unmount();
63
+ renderUi(<TeamBoardView runId="r1" status="cancelled" events={events} quick />, { auth: true });
64
+ await act(async () => { vi.advanceTimersByTime(60_000); });
65
+ expect(screen.queryByText(/has been quiet/)).not.toBeInTheDocument();
66
+ expect(screen.getByRole('status')).toHaveTextContent('This test run stopped');
67
+ // the agent that was working is "Stopped here"; agents that never ran stay "Not started" (only a completed run makes them "Not needed")
68
+ expect(screen.getByTestId('flow-scout')).toHaveAttribute('aria-label', 'Scout: Stopped here');
69
+ expect(screen.getByTestId('flow-reporter')).toHaveAttribute('aria-label', 'Reporter: Not started');
70
+ });
71
+ });
web/src/pages/TeamBoard.tsx ADDED
@@ -0,0 +1,296 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { Button, Drawer, Group, Popover, Skeleton, Stack, Text, UnstyledButton } from '@mantine/core';
2
+ import {
3
+ IconAlertTriangle, IconCircleCheck, IconCircleDashed, IconCircleMinus, IconCircleX, IconLoader2, IconPlayerPlay, IconRepeat, IconRobot, IconUserCheck,
4
+ } from '@tabler/icons-react';
5
+ import { useEffect, useMemo, useState, type ReactNode } from 'react';
6
+ import { Link } from 'react-router-dom';
7
+ import { AGENT_BY_NODE, STEP_WORDS, stepName, type AgentDef, type Engine } from '../agents';
8
+ import { useGraphSpec, useRunAction } from '../api/hooks';
9
+ import { Can, ErrorAlert } from '../components/common';
10
+ import { LAYOUT } from '../components/GraphView';
11
+ import { useShell } from '../components/shell/prefs';
12
+ import { decisionWords } from '../glossary';
13
+ import { nodeStates, useRunStream, type NodeState, type RunEvent } from '../hooks/useRunStream';
14
+ import { FeedCard } from './RunPage';
15
+
16
+ export const PHASE_WORDS: Record<string, string> = { Research: 'Understand', Design: 'Choose', 'Data + scripts': 'Prepare', Execute: 'Test', Triage: 'Analyse', Report: 'Report' };
17
+ export const STATE_WORDS: Record<NodeState, string> = { pending: 'Not started', running: 'Working now', done: 'Done', error: 'Failed', waiting: 'Waiting for you', skipped: 'Not needed' };
18
+ const HUMAN = new Set(['approval_gate', 'human_review']);
19
+ // What each agent does, in the present tense, for agents that have not finished yet.
20
+ const NOW_WORDS: Record<string, string> = {
21
+ scout: 'Reads the test environment', research_module: 'Reads what this patch changes', synthesizer: 'Ranks what matters most to test',
22
+ test_generator: 'Chooses the scenarios', approval_gate: 'Asks for your approval', data_planner: 'Plans the test data', data_executor: 'Prepares the test data',
23
+ script_builder: 'Prepares the test scripts', executor: 'Runs the scenarios', self_heal: 'Repairs a screen element that moved',
24
+ triage: 'Works out why scenarios failed', human_review: 'Asks for your decision on failures', ticket: 'Raises tickets for confirmed defects',
25
+ reporter: 'Applies the readiness rule and writes the report', learner: 'Saves what was learned for next time',
26
+ };
27
+ const ENGINE_WORDS: Record<Engine, string> = { deterministic: 'Built-in rules', local: 'Local AI model', frontier: 'External AI model', human: 'You' };
28
+ const ENGINE_TONE: Record<Engine, string> = { deterministic: 'mint', local: 'blue', frontier: 'lav', human: 'amber' };
29
+ /** No event for this long while an agent works: it may be stuck (client-side only; never acts on its own). */
30
+ export const SILENT_MS = { browser: 3 * 60_000, quick: 60_000 };
31
+ const TERMINAL = ['completed', 'failed', 'killed', 'cancelled', 'interrupted'];
32
+
33
+ const two = (n: number) => String(n).padStart(2, '0');
34
+ const hhmm = (iso?: string) => { if (!iso) return ''; const d = new Date(iso); return Number.isNaN(d.getTime()) ? '' : `${two(d.getHours())}:${two(d.getMinutes())}`; };
35
+ export const duration = (ms: number) => {
36
+ if (ms < 1000) return `${Math.max(0, Math.round(ms))} ms`;
37
+ const s = Math.round(ms / 1000);
38
+ if (s < 60) return `${s} s`;
39
+ const m = Math.floor(s / 60);
40
+ return m < 60 ? `${m} min ${s % 60} s` : `${Math.floor(m / 60)} h ${m % 60} min`;
41
+ };
42
+ const plural = (n: number, one: string, many = `${one}s`) => `${n} ${n === 1 ? one : many}`;
43
+
44
+ export interface AgentFacts { startedAt?: string; finishedAt?: string; ms: number; last?: RunEvent; error?: string; events: RunEvent[] }
45
+
46
+ /** Per agent: first start, last finish, total time and its last event, folded from the run's event log. Pure. */
47
+ export function agentFacts(events: RunEvent[]): Record<string, AgentFacts> {
48
+ const out: Record<string, AgentFacts> = {};
49
+ for (const e of events) {
50
+ if (!e.node) continue;
51
+ const f = (out[e.node] ??= { ms: 0, events: [] });
52
+ f.events.push(e);
53
+ if (e.kind === 'started' && !f.startedAt) f.startedAt = e.ts;
54
+ if (e.kind === 'finished' || e.kind === 'interrupted') { f.finishedAt = e.ts; if (typeof e.summary?.ms === 'number') f.ms += e.summary.ms; }
55
+ if (e.kind === 'error' || e.kind === 'killed') {
56
+ const msg = e.summary?.error ?? e.summary?.message ?? e.summary?.detail;
57
+ f.error = (typeof msg === 'string' ? msg : 'This step stopped with an error.').slice(0, 200);
58
+ }
59
+ if (e.kind !== 'started') f.last = e;
60
+ }
61
+ return out;
62
+ }
63
+
64
+ /** "Chose 79 scenarios": what an agent did, from its last finished event; falls back to the step's sentence. */
65
+ export function didWords(node: string, last?: RunEvent): string {
66
+ const base = STEP_WORDS[node]?.[1] ?? 'Did its part';
67
+ const s = last?.kind === 'finished' ? last.summary ?? {} : null;
68
+ if (!s) return base;
69
+ const n = (k: string) => (typeof s[k] === 'number' ? (s[k] as number) : null);
70
+ const len = (k: string) => (Array.isArray(s[k]) ? (s[k] as unknown[]).length : null);
71
+ switch (node) {
72
+ case 'test_generator': return n('n_test_cases') !== null ? `Chose ${plural(n('n_test_cases')!, 'scenario')}` : base;
73
+ case 'approval_gate': return n('n_test_cases') !== null ? `${plural(n('n_test_cases')!, 'scenario')} approved` : 'Your approval was recorded';
74
+ case 'executor': return len('failures') !== null ? `Ran the scenarios · ${len('failures')} failing` : 'Ran the scenarios';
75
+ case 'self_heal': return n('n_heal_proposals') ? `Proposed ${plural(n('n_heal_proposals')!, 'repair')}` : 'Nothing needed repairing';
76
+ case 'triage': return n('n_review_items') !== null ? `Analysed ${plural(n('n_review_items')!, 'failure')}` : base;
77
+ case 'human_review': return 'Your decisions were recorded';
78
+ case 'ticket': return n('n_tickets') !== null ? `Raised ${plural(n('n_tickets')!, 'ticket')}` : base;
79
+ case 'reporter': return typeof s.decision === 'string' ? `Wrote the report: ${decisionWords(s.decision)}` : base;
80
+ case 'research_module': return n('n_research') !== null ? `Read what this patch changes (${plural(n('n_research')!, 'area')})` : base;
81
+ default: return base;
82
+ }
83
+ }
84
+
85
+ const initials = (name: string) => name.split(/[\s-]+/).filter(Boolean).slice(0, 2).map((w, i) => (i === 0 ? w[0].toUpperCase() : w[0].toLowerCase())).join('') || name.slice(0, 2);
86
+ // Two words make an "XY" pair (Test designer -> TD); one word keeps its first two letters (Scout -> Sc).
87
+ const avatarText = (name: string) => { const w = name.split(/\s+/).filter(Boolean); return w.length > 1 ? `${w[0][0]}${w[1][0]}`.toUpperCase() : initials(name).slice(0, 1) + name.slice(1, 2); };
88
+
89
+ function StateIcon({ s, silent }: { s: NodeState; silent?: boolean }) {
90
+ if (silent) return <IconAlertTriangle size={15} color="var(--pill-amber-fg)" aria-hidden />;
91
+ if (s === 'running') return <IconLoader2 size={15} className="fpt-spin" aria-hidden />;
92
+ if (s === 'done') return <IconCircleCheck size={15} color="var(--pill-green-fg)" aria-hidden />;
93
+ if (s === 'waiting') return <IconUserCheck size={15} color="var(--pill-amber-fg)" aria-hidden />;
94
+ if (s === 'error') return <IconCircleX size={15} color="var(--pill-red-fg)" aria-hidden />;
95
+ if (s === 'skipped') return <IconCircleMinus size={15} color="var(--fpt-dim)" aria-hidden />;
96
+ return <IconCircleDashed size={15} color="var(--fpt-dim)" aria-hidden />;
97
+ }
98
+
99
+ /** One teammate: avatar on its engine tone, name, what it did, state, time taken, engine in plain words. */
100
+ export function AgentCard({ agent, state, lastEvent, startedAt, finishedAt, ms, errorText, silentForMs, human, action, onOpen, testId, staticMode, pressed, stoppedHere }: {
101
+ agent: AgentDef; state: NodeState; lastEvent?: RunEvent; startedAt?: string; finishedAt?: string; ms?: number; errorText?: string;
102
+ silentForMs?: number; human?: boolean; action?: ReactNode; onOpen?: () => void; testId: string; staticMode?: boolean; pressed?: boolean;
103
+ /** It was working when the test run stopped (not an error of its own). */
104
+ stoppedHere?: boolean;
105
+ }) {
106
+ const name = stepName(agent.node);
107
+ const silent = !!silentForMs;
108
+ const words = silent ? `No news for ${Math.max(1, Math.round(silentForMs! / 60_000))} min` : stoppedHere ? 'Stopped here' : STATE_WORDS[state];
109
+ const line = staticMode ? agent.job : state === 'done' || state === 'skipped' ? (state === 'done' ? didWords(agent.node, lastEvent) : 'Not needed in this test run')
110
+ : state === 'error' ? errorText ?? (stoppedHere ? 'It was working when the test run stopped.' : 'This step stopped with an error.') : NOW_WORDS[agent.node] ?? agent.job;
111
+ const foot = staticMode ? null
112
+ : state === 'done' && finishedAt ? `took ${duration(ms ?? 0)} · finished ${hhmm(finishedAt)}`
113
+ : state === 'running' && startedAt ? `started ${hhmm(startedAt)}`
114
+ : state === 'waiting' && startedAt ? `since ${hhmm(startedAt)}` : null;
115
+ const body = (
116
+ <>
117
+ <div className="fpt-agent-top">
118
+ <span className="fpt-agent-avatar" data-tone={ENGINE_TONE[agent.engine]} aria-hidden>{avatarText(name)}</span>
119
+ <span className="fpt-agent-name">{name}{human && <span className="fpt-flow-you">you</span>}</span>
120
+ </div>
121
+ <div className="fpt-agent-line">{line}</div>
122
+ {!staticMode && (
123
+ <span className="fpt-agent-state" data-state={silent ? 'silent' : state}><StateIcon s={state} silent={silent} />{words}</span>
124
+ )}
125
+ <div className="fpt-agent-foot">{foot ? `${foot} · ` : ''}{ENGINE_WORDS[agent.engine]}</div>
126
+ </>
127
+ );
128
+ return (
129
+ <div className="fpt-agent" role="listitem" data-testid={testId} data-state={silent ? 'silent' : state} aria-label={`${name}: ${staticMode ? ENGINE_WORDS[agent.engine] : words}`}>
130
+ <UnstyledButton className="fpt-agent-btn" onClick={onOpen} aria-pressed={pressed} aria-haspopup={staticMode ? undefined : 'dialog'}
131
+ aria-label={staticMode ? `${name}, ${ENGINE_WORDS[agent.engine]}` : `${name}: ${words}. Show what it did`}>
132
+ {body}
133
+ </UnstyledButton>
134
+ {action && <div className="fpt-agent-action">{action}</div>}
135
+ </div>
136
+ );
137
+ }
138
+
139
+ /** The team lead: overall progress, what it is waiting on, and the run-level actions. */
140
+ export function CoordinatorCard({ runId, states, status, gate, error, silent, startedAt, endedAt, total, quick }: {
141
+ runId: string; states: Record<string, { state: NodeState }>; status: string; gate?: string | null; error?: string | null;
142
+ silent?: { node: string; ms: number } | null; startedAt?: string; endedAt?: string; total: number; quick: boolean;
143
+ }) {
144
+ const action = useRunAction();
145
+ const all = Object.values(states);
146
+ const done = all.filter((s) => s.state === 'done').length;
147
+ const waiting = all.filter((s) => s.state === 'waiting').length;
148
+ const stopped = all.filter((s) => s.state === 'error').length;
149
+ const started = all.some((s) => s.state !== 'pending');
150
+ let tone = 'neutral'; let line: ReactNode;
151
+ let act: ReactNode = null;
152
+ if (status === 'completed') {
153
+ tone = 'green';
154
+ const ms = startedAt && endedAt ? new Date(endedAt).getTime() - new Date(startedAt).getTime() : 0;
155
+ line = `All steps finished${ms > 0 ? ` in ${duration(ms)}` : ''}.`;
156
+ } else if (TERMINAL.includes(status)) {
157
+ tone = 'red';
158
+ line = `This test run stopped: ${error ?? (status === 'cancelled' ? 'it was cancelled' : status === 'killed' ? 'the emergency stop was used' : status === 'interrupted' ? 'it was paused' : 'an error')}.`;
159
+ if (['failed', 'interrupted'].includes(status)) act = <Can perm="run.control"><Button size="xs" leftSection={<IconPlayerPlay size={12} />} loading={action.isPending} onClick={() => action.mutate({ id: runId, action: 'resume' })}>Resume</Button></Can>;
160
+ } else if (gate === 'approve_cases' || gate === 'human_review') {
161
+ tone = 'amber';
162
+ line = gate === 'approve_cases' ? 'Waiting for you: approve the scenarios.' : 'Waiting for you: decide on the failed scenarios.';
163
+ act = gate === 'approve_cases'
164
+ ? <Can perm="gate.approve_cases"><Button size="xs" component={Link} to={`/runs/${runId}/scenarios`}>Open scenario review</Button></Can>
165
+ : <Can perm="gate.human_review"><Button size="xs" component={Link} to={`/runs/${runId}/failures`}>Open failure review</Button></Can>;
166
+ } else if (silent) {
167
+ tone = 'amber';
168
+ line = `${stepName(silent.node)} has been quiet for ${Math.max(1, Math.round(silent.ms / 60_000))} min. ${quick ? 'A quick simulation usually moves faster.' : 'It may be waiting on the test environment.'}`;
169
+ act = <Can perm="run.control"><Button size="xs" color="red" variant="light" loading={action.isPending} onClick={() => action.mutate({ id: runId, action: 'cancel', reason: 'cancelled from the team board (an agent went quiet)' })}>Cancel test run</Button></Can>;
170
+ } else {
171
+ tone = 'blue';
172
+ line = started ? 'The team is working. You will be asked when your review is needed.' : 'Starting the agents…';
173
+ }
174
+ return (
175
+ <section className="fpt-coord" data-tone={tone} aria-label="Coordinator">
176
+ <span className="fpt-agent-avatar" data-tone="neutral" aria-hidden><IconRobot size={16} /></span>
177
+ <div style={{ flex: '1 1 260px', minWidth: 0 }}>
178
+ <Group justify="space-between" gap={8} wrap="wrap">
179
+ <Text fw={600} size="sm">Coordinator · leads the team</Text>
180
+ <Text size="xs" c="dimmed" className="fpt-num">{done} of {total} done · {waiting} waiting for you · {stopped} stopped</Text>
181
+ </Group>
182
+ <Text size="sm" mt={2} role="status">{line}</Text>
183
+ <ErrorAlert error={action.error} />
184
+ </div>
185
+ {act && <div style={{ flex: '0 0 auto' }}>{act}</div>}
186
+ </section>
187
+ );
188
+ }
189
+
190
+ /** Re-renders every `ms` so time-based flags (quiet agents) appear without new data. */
191
+ export function useNow(ms = 10_000) {
192
+ const [now, setNow] = useState(() => Date.now());
193
+ useEffect(() => { const t = window.setInterval(() => setNow(Date.now()), ms); return () => window.clearInterval(t); }, [ms]);
194
+ return now;
195
+ }
196
+
197
+ /** The team board for a list of events: presentational, testable without a stream. */
198
+ export function TeamBoardView({ runId, status, gate, error, events, quick, loading }: {
199
+ runId: string; status: string; gate?: string | null; error?: string | null; events: RunEvent[]; quick: boolean; loading?: boolean;
200
+ }) {
201
+ const { size } = useShell();
202
+ const now = useNow(5_000);
203
+ const [open, setOpen] = useState<string | null>(null);
204
+ const nodes = LAYOUT.flatMap((p) => p.nodes);
205
+ const finished = TERMINAL.includes(status);
206
+ // only a completed run makes the agents that never ran "Not needed"; a stopped run leaves them "Not started"
207
+ const raw = nodeStates(events, nodes, status === 'completed');
208
+ const stoppedAt = new Set(finished ? nodes.filter((n) => raw[n]?.state === 'running') : []);
209
+ const st = Object.fromEntries(Object.entries(raw).map(([n, v]) => [n, stoppedAt.has(n) ? { ...v, state: 'error' as NodeState } : v]));
210
+ const facts = useMemo(() => agentFacts(events), [events]);
211
+ const lastTs = events.length ? events[events.length - 1].ts : undefined;
212
+ const quiet = lastTs && !finished ? now - new Date(lastTs).getTime() : 0;
213
+ const threshold = quick ? SILENT_MS.quick : SILENT_MS.browser;
214
+ const runningNode = nodes.find((n) => st[n]?.state === 'running');
215
+ const silent = runningNode && quiet >= threshold ? { node: runningNode, ms: quiet } : null;
216
+ const phaseState = (ns: string[]): NodeState => {
217
+ const s = ns.map((n) => (silent?.node === n ? 'running' : st[n]?.state ?? 'pending'));
218
+ if (s.includes('error')) return 'error';
219
+ if (s.includes('waiting')) return 'waiting';
220
+ if (s.includes('running')) return 'running';
221
+ if (s.every((x) => x === 'done' || x === 'skipped') && s.includes('done')) return 'done';
222
+ return s.includes('done') ? 'running' : s.every((x) => x === 'skipped') ? 'skipped' : 'pending';
223
+ };
224
+ const what = (n: string) => {
225
+ const evs = facts[n]?.events.filter((e) => e.kind !== 'started') ?? [];
226
+ return (
227
+ <Stack gap={8} className="fpt-agent-pop">
228
+ <Text fw={600} size="sm" id={`agent-pop-${n}`}>What {stepName(n)} did</Text>
229
+ {evs.length === 0 ? <Text size="sm" c="dimmed">Nothing yet in this test run.</Text> : evs.map((e) => <FeedCard key={e.seq} e={e} />)}
230
+ <Text fw={600} size="sm" mt={4}>What this agent does</Text>
231
+ <Text size="sm">{AGENT_BY_NODE[n]?.job}</Text>
232
+ </Stack>
233
+ );
234
+ };
235
+ const humanAction = (n: string) => {
236
+ if (st[n]?.state !== 'waiting') return null;
237
+ if (n === 'approval_gate') return <Can perm="gate.approve_cases"><Button size="compact-xs" component={Link} to={`/runs/${runId}/scenarios`}>Open scenario review</Button></Can>;
238
+ if (n === 'human_review') return <Can perm="gate.human_review"><Button size="compact-xs" component={Link} to={`/runs/${runId}/failures`}>Open failure review</Button></Can>;
239
+ return null;
240
+ };
241
+ const phone = size === 'phone';
242
+ const card = (n: string) => {
243
+ const a = AGENT_BY_NODE[n] ?? { node: n, name: n, group: '', engine: 'deterministic' as Engine, job: '', tone: 'neutral' };
244
+ const f = facts[n];
245
+ const c = (
246
+ <AgentCard agent={a} state={st[n]?.state ?? 'pending'} lastEvent={f?.last} startedAt={f?.startedAt} finishedAt={f?.finishedAt} ms={f?.ms}
247
+ errorText={f?.error} stoppedHere={stoppedAt.has(n)} silentForMs={silent?.node === n ? silent.ms : undefined} human={HUMAN.has(n)} action={humanAction(n)}
248
+ onOpen={() => setOpen((o) => (o === n ? null : n))} testId={`flow-${n}`} />
249
+ );
250
+ if (phone) return <div key={n}>{c}</div>;
251
+ return (
252
+ <Popover key={n} opened={open === n} onChange={(o) => !o && setOpen(null)} width={340} position="bottom" withArrow shadow="md" trapFocus returnFocus>
253
+ <Popover.Target><div>{c}</div></Popover.Target>
254
+ <Popover.Dropdown role="dialog" aria-labelledby={`agent-pop-${n}`} style={{ maxHeight: 420, overflowY: 'auto' }}>{what(n)}</Popover.Dropdown>
255
+ </Popover>
256
+ );
257
+ };
258
+ const first = events.find((e) => e.kind === 'started')?.ts;
259
+ return (
260
+ <div data-testid="run-workflow" className="fpt-teamboard">
261
+ <CoordinatorCard runId={runId} states={st} status={status} gate={gate} error={error} silent={silent} startedAt={first} endedAt={lastTs} total={nodes.length} quick={quick} />
262
+ {loading ? (
263
+ <div className="fpt-board" aria-busy="true">{LAYOUT.map((p) => <Skeleton key={p.phase} height={220} radius="md" />)}</div>
264
+ ) : (
265
+ <div className="fpt-board" role="list" aria-label="The team, phase by phase">
266
+ {LAYOUT.map((p, i) => {
267
+ const ps = phaseState(p.nodes);
268
+ return (
269
+ <section key={p.phase} className="fpt-board-phase" data-state={ps} role="listitem" aria-label={`${PHASE_WORDS[p.phase] ?? p.phase}: ${STATE_WORDS[ps]}`}>
270
+ <header><span className="fpt-flow-num">{i + 1}</span><b>{PHASE_WORDS[p.phase] ?? p.phase}</b></header>
271
+ <div role="list" aria-label={`Agents in ${PHASE_WORDS[p.phase] ?? p.phase}`} className="fpt-board-cards">{p.nodes.map(card)}</div>
272
+ {p.phase === 'Execute' && <div className="fpt-flow-note"><IconRepeat size={13} aria-hidden />A failed scenario is tried once more</div>}
273
+ </section>
274
+ );
275
+ })}
276
+ </div>
277
+ )}
278
+ <div className="fpt-flow-legend" aria-label="Legend">
279
+ {(['done', 'running', 'waiting', 'pending', 'error', 'skipped'] as NodeState[]).map((s) => <span key={s}><StateIcon s={s} />{STATE_WORDS[s]}</span>)}
280
+ <span><StateIcon s="running" silent />No news for {quick ? '1' : '3'} min</span>
281
+ </div>
282
+ {phone && (
283
+ <Drawer opened={!!open} onClose={() => setOpen(null)} position="bottom" size="80dvh" title={open ? `What ${stepName(open)} did` : ''}>
284
+ {open && what(open)}
285
+ </Drawer>
286
+ )}
287
+ </div>
288
+ );
289
+ }
290
+
291
+ /** Team board of a test run: the Coordinator and the 15 agents with live state, from the run's event stream. */
292
+ export function TeamBoard({ runId, status, gate, error, quick = false }: { runId: string; status: string; gate?: string | null; error?: string | null; quick?: boolean }) {
293
+ const { events } = useRunStream(runId);
294
+ const spec = useGraphSpec();
295
+ return <TeamBoardView runId={runId} status={status} gate={gate} error={error} events={events} quick={quick} loading={spec.isLoading} />;
296
+ }
web/src/runName.ts CHANGED
@@ -13,6 +13,14 @@ export function shortWhen(iso?: string | null): string {
13
 
14
  export interface RunLike { run_id: string; modules?: string[] | null; patch_id?: string | null; created_at?: string | null }
15
 
 
 
 
 
 
 
 
 
16
  /** Business area(s) of a test run: "Procure-to-Pay", "Procure-to-Pay + 2 more", "All areas". */
17
  export function runAreas(r: RunLike): string {
18
  const mods = r.modules ?? [];
 
13
 
14
  export interface RunLike { run_id: string; modules?: string[] | null; patch_id?: string | null; created_at?: string | null }
15
 
16
+ /** "17 Oct 12:02:05": shortWhen with seconds, for event logs. */
17
+ export function shortWhenSec(iso?: string | null): string {
18
+ if (!iso) return '';
19
+ const d = new Date(iso);
20
+ if (Number.isNaN(d.getTime())) return '';
21
+ return `${shortWhen(iso)}:${two(d.getSeconds())}`;
22
+ }
23
+
24
  /** Business area(s) of a test run: "Procure-to-Pay", "Procure-to-Pay + 2 more", "All areas". */
25
  export function runAreas(r: RunLike): string {
26
  const mods = r.modules ?? [];
web/src/styles.css CHANGED
@@ -37,7 +37,8 @@
37
  --pill-green-bg: #d9f2df; --pill-green-fg: #1c5c2c;
38
  --pill-blue-bg: #dfeafb; --pill-blue-fg: #1f4c8f;
39
  }
40
- [data-mantine-color-scheme='dark'] {
 
41
  --fpt-page: #0c1110;
42
  --fpt-sidebar: #101615;
43
  --fpt-focus: #8fa8f0;
@@ -77,9 +78,12 @@
77
  --mantine-color-ink-text: #e3e9e7;
78
  --mantine-color-body: #151b1a;
79
  }
80
- [data-mantine-color-scheme='dark'] .mantine-Button-root[data-variant='filled'][style*='--mantine-color-ink-filled'] { --button-color: #111111 !important; }
81
- [data-mantine-color-scheme='dark'] .mantine-Checkbox-root { --checkbox-icon-color: #111111; }
82
- [data-mantine-color-scheme='dark'] .mantine-Radio-root { --radio-icon-color: #111111; }
 
 
 
83
 
84
  html, body, #root { height: 100%; }
85
  body { background: var(--fpt-surface); color: var(--fpt-text); line-height: 1.5; }
@@ -412,7 +416,7 @@ a { color: inherit; }
412
  .fpt-topbar-sub:has(.fpt-topbar-cue) { flex-wrap: wrap; }
413
  .fpt-topbar-cue { order: -1; flex: 1 1 100%; }
414
  .fpt-topbar-actions { flex: 0 1 auto; max-width: 100%; margin-left: auto; padding-bottom: 2px; }
415
- .fpt-topbar-mid { order: 3; flex: 1 1 100%; }
416
  .fpt-sticky-bar { bottom: calc(56px + env(safe-area-inset-bottom)); }
417
  }
418
  @media (prefers-reduced-motion: reduce) { .fpt-sidebar { transition: none; } }
@@ -520,20 +524,88 @@ a { color: inherit; }
520
  .fpt-compose-row { flex-wrap: wrap; }
521
  .fpt-stage { padding: 14px 14px 16px; }
522
  .fpt-stage [data-testid='guide-approve-all'] { width: 100%; }
523
- .fpt-detail-switch { margin-left: 0; width: 100%; }
524
  .fpt-topbar-mid .fpt-statechip { font-size: 11.5px; }
525
  }
526
- .fpt-ws-center { container-type: inline-size; container-name: fpt-center; }
527
  .fpt-topbar-mid { overflow: hidden; }
528
  .fpt-statechip { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
529
- @container fpt-center (max-width: 820px) {
530
- .fpt-ws .fpt-topbar { flex-wrap: wrap; row-gap: 4px; }
531
- .fpt-ws .fpt-topbar-left { flex: 1 1 100%; }
532
- .fpt-ws .fpt-topbar-mid { flex: 1 1 auto; }
533
- .fpt-ws .fpt-topbar-actions { margin-left: auto; }
534
- }
535
  .fpt-panel-tablist .mantine-Tabs-tab { border-radius: 0; }
536
  @media (max-width: 767px) {
537
- .fpt-ws .fpt-topbar-sub { flex-wrap: wrap; white-space: normal; row-gap: 2px; }
538
- .fpt-ws .fpt-topbar-actions { gap: 6px; }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
539
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
37
  --pill-green-bg: #d9f2df; --pill-green-fg: #1c5c2c;
38
  --pill-blue-bg: #dfeafb; --pill-blue-fg: #1f4c8f;
39
  }
40
+ /* html:root[...] (higher specificity) so these win over the variables MantineProvider injects for the dark scheme */
41
+ html:root[data-mantine-color-scheme='dark'] {
42
  --fpt-page: #0c1110;
43
  --fpt-sidebar: #101615;
44
  --fpt-focus: #8fa8f0;
 
78
  --mantine-color-ink-text: #e3e9e7;
79
  --mantine-color-body: #151b1a;
80
  }
81
+ /* primary (ink) filled controls are light pills in dark mode: dark text on them (coloured ones set their own --button-bg) */
82
+ :root[data-mantine-color-scheme='dark'] .mantine-Button-root:is(:not([data-variant]), [data-variant='filled']):not([style*='--button-bg']) { --button-color: #111111 !important; }
83
+ :root[data-mantine-color-scheme='dark'] .mantine-ActionIcon-root[data-variant='filled']:not([style*='--ai-bg']) { --ai-color: #111111 !important; }
84
+ :root[data-mantine-color-scheme='dark'] .mantine-Tabs-tab[data-variant='pills'][data-active] { color: #111111; }
85
+ :root[data-mantine-color-scheme='dark'] .mantine-Checkbox-root { --checkbox-icon-color: #111111; }
86
+ :root[data-mantine-color-scheme='dark'] .mantine-Radio-root { --radio-icon-color: #111111; }
87
 
88
  html, body, #root { height: 100%; }
89
  body { background: var(--fpt-surface); color: var(--fpt-text); line-height: 1.5; }
 
416
  .fpt-topbar-sub:has(.fpt-topbar-cue) { flex-wrap: wrap; }
417
  .fpt-topbar-cue { order: -1; flex: 1 1 100%; }
418
  .fpt-topbar-actions { flex: 0 1 auto; max-width: 100%; margin-left: auto; padding-bottom: 2px; }
419
+
420
  .fpt-sticky-bar { bottom: calc(56px + env(safe-area-inset-bottom)); }
421
  }
422
  @media (prefers-reduced-motion: reduce) { .fpt-sidebar { transition: none; } }
 
524
  .fpt-compose-row { flex-wrap: wrap; }
525
  .fpt-stage { padding: 14px 14px 16px; }
526
  .fpt-stage [data-testid='guide-approve-all'] { width: 100%; }
 
527
  .fpt-topbar-mid .fpt-statechip { font-size: 11.5px; }
528
  }
 
529
  .fpt-topbar-mid { overflow: hidden; }
530
  .fpt-statechip { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
 
 
 
 
 
 
531
  .fpt-panel-tablist .mantine-Tabs-tab { border-radius: 0; }
532
  @media (max-width: 767px) {
533
+ /* phone run top bar: two rows, max 76px (title + Panel + More; then chip, honesty pill, ref) */
534
+ .fpt-ws .fpt-topbar { flex-wrap: nowrap; max-height: 76px; min-height: 0; padding: 4px 12px 4px; align-items: flex-start; }
535
+ .fpt-ws .fpt-topbar-left { flex: 1 1 auto; }
536
+ .fpt-ws .fpt-title { font-size: 15px; line-height: 36px; }
537
+ .fpt-ws .fpt-topbar-sub { flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; white-space: nowrap; height: 28px; margin-top: 0; scrollbar-width: none; }
538
+ .fpt-ws .fpt-topbar-sub::-webkit-scrollbar { display: none; }
539
+ .fpt-ws .fpt-topbar-sub > * { flex: 0 0 auto; }
540
+ .fpt-ws .fpt-topbar-actions { gap: 6px; flex-wrap: nowrap; margin-left: 0; padding-bottom: 0; }
541
+ }
542
+ .fpt-ws[data-size='phone'] .fpt-iconbtn-md { width: 36px; height: 36px; }
543
+
544
+ /* ---- review 1 ---- */
545
+ /* S1: run top bar = 2 rows: title + state chip (+ actions on the right), then the sub-line on one line */
546
+ .fpt-topbar-row1 { display: flex; align-items: center; gap: 10px; min-width: 0; }
547
+ .fpt-topbar-row1 .fpt-title { flex: 0 1 auto; min-width: 0; }
548
+ .fpt-topbar-row1 .fpt-topbar-mid { flex: 0 1 auto; }
549
+ @media (min-width: 768px) {
550
+ .fpt-ws .fpt-topbar { align-items: flex-start; max-height: 64px; padding-top: 6px; padding-bottom: 6px; }
551
+ .fpt-ws .fpt-title { line-height: 28px; }
552
+ .fpt-ws .fpt-topbar-sub { flex-wrap: nowrap; overflow: hidden; white-space: nowrap; }
553
+ .fpt-ws .fpt-topbar-sub > * { flex: 0 0 auto; }
554
+ .fpt-ws .fpt-topbar-sub > .fpt-topbar-trunc { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
555
+ .fpt-ws .fpt-topbar-actions { flex-wrap: nowrap; min-height: 28px; }
556
  }
557
+ @media (min-width: 768px) and (max-width: 1279px) { .fpt-ws .fpt-topbar { max-height: 68px; } }
558
+ /* S2: detail sub-header in one row */
559
+ .fpt-detail-head { flex-wrap: nowrap; }
560
+ .fpt-detail-switch { min-width: 0; overflow-x: auto; scrollbar-width: none; }
561
+ .fpt-detail-switch::-webkit-scrollbar { display: none; }
562
+ /* S3: Mantine's focus ring uses our focus colour */
563
+ .mantine-focus-auto:focus-visible, .mantine-focus-always:focus { outline: 2px solid var(--fpt-focus); outline-offset: 2px; }
564
+ .fpt-linkbtn { border: 0; padding: 0; background: none; color: inherit; font: inherit; font-weight: 600; text-decoration: underline; cursor: pointer; }
565
+ .fpt-topbar-row1 .fpt-topbar-mid { display: flex; align-items: center; gap: 6px; }
566
+ .fpt-topbar-row1 .fpt-topbar-mid > :not(.fpt-statechip) { flex: 0 0 auto; }
567
+ .fpt-topbar-row1 .fpt-topbar-mid > .fpt-statechip { flex: 0 1 auto; }
568
+ .fpt-topbar-row1 .fpt-title { min-width: 120px; }
569
+
570
+ /* ======================================================================== team board (step 3) */
571
+ .fpt-teamboard { display: flex; flex-direction: column; gap: 12px; }
572
+ .fpt-coord { display: flex; align-items: flex-start; gap: 12px; flex-wrap: wrap; padding: 12px 14px; border: 1px solid var(--fpt-border); border-left-width: 3px; border-radius: 12px; background: var(--fpt-surface); }
573
+ .fpt-coord[data-tone='green'] { border-left-color: var(--fpt-status-done); }
574
+ .fpt-coord[data-tone='red'] { border-left-color: var(--fpt-status-failed); }
575
+ .fpt-coord[data-tone='amber'] { border-left-color: var(--fpt-status-waiting); background: var(--pill-amber-bg); color: var(--pill-amber-fg); }
576
+ .fpt-coord[data-tone='blue'] { border-left-color: var(--fpt-status-running); }
577
+ .fpt-board { display: grid; grid-template-columns: repeat(6, minmax(150px, 1fr)); gap: 10px; overflow-x: auto; padding-bottom: 4px; }
578
+ .fpt-board-phase { display: flex; flex-direction: column; gap: 8px; min-width: 0; padding: 10px; border: 1px solid var(--fpt-border); border-top-width: 3px; border-radius: 12px; background: var(--fpt-surface-2); }
579
+ .fpt-board-phase[data-state='done'] { border-top-color: var(--fpt-status-done); }
580
+ .fpt-board-phase[data-state='running'] { border-top-color: var(--fpt-status-running); }
581
+ .fpt-board-phase[data-state='waiting'] { border-top-color: var(--fpt-status-waiting); }
582
+ .fpt-board-phase[data-state='error'] { border-top-color: var(--fpt-status-failed); }
583
+ .fpt-board-phase > header { display: flex; align-items: center; gap: 8px; font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; }
584
+ .fpt-board-cards { display: flex; flex-direction: column; gap: 8px; }
585
+ .fpt-agent { position: relative; border: 1px solid var(--fpt-border); border-radius: 10px; background: var(--fpt-surface); transition: box-shadow var(--fpt-dur-1) var(--fpt-ease); }
586
+ .fpt-agent:hover { box-shadow: var(--fpt-shadow-1); }
587
+ .fpt-agent[data-state='running'] { border-color: var(--fpt-status-running); }
588
+ .fpt-agent[data-state='waiting'], .fpt-agent[data-state='silent'] { border-color: var(--fpt-status-waiting); }
589
+ .fpt-agent[data-state='error'] { border-top: 3px solid var(--fpt-status-failed); }
590
+ .fpt-agent[data-state='pending'], .fpt-agent[data-state='skipped'] { opacity: 0.75; }
591
+ .fpt-agent-btn { display: flex; flex-direction: column; gap: 5px; width: 100%; padding: 9px 10px; text-align: left; border-radius: 10px; color: var(--fpt-text); }
592
+ .fpt-agent-btn[aria-pressed='true'] { box-shadow: inset 0 0 0 2px var(--fpt-ink); }
593
+ .fpt-agent-top { display: flex; align-items: center; gap: 8px; min-width: 0; }
594
+ .fpt-agent-avatar { flex: 0 0 26px; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: 10.5px; font-weight: 600; background: var(--pill-neutral-bg); color: var(--pill-neutral-fg); }
595
+ .fpt-agent-avatar[data-tone='mint'] { background: var(--pill-mint-bg); color: var(--pill-mint-fg); }
596
+ .fpt-agent-avatar[data-tone='blue'] { background: var(--pill-blue-bg); color: var(--pill-blue-fg); }
597
+ .fpt-agent-avatar[data-tone='lav'] { background: var(--pill-lav-bg); color: var(--pill-lav-fg); }
598
+ .fpt-agent-avatar[data-tone='amber'] { background: var(--pill-amber-bg); color: var(--pill-amber-fg); }
599
+ .fpt-agent-name { font-size: 13px; font-weight: 600; min-width: 0; line-height: 1.3; overflow-wrap: anywhere; }
600
+ .fpt-agent-line { font-size: 12px; line-height: 1.4; color: var(--fpt-text); overflow-wrap: anywhere; }
601
+ .fpt-agent-state { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 500; }
602
+ .fpt-agent-state[data-state='waiting'], .fpt-agent-state[data-state='silent'] { color: var(--pill-amber-fg); }
603
+ .fpt-agent-state[data-state='error'] { color: var(--pill-red-fg); }
604
+ .fpt-agent-state[data-state='running'] { color: var(--pill-blue-fg); }
605
+ .fpt-agent-foot { font-size: 11px; color: var(--fpt-dim); }
606
+ .fpt-agent-action { padding: 0 10px 9px; }
607
+ .fpt-agent-pop { font-size: 13px; }
608
+ .fpt-agent-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 4px; }
609
+ @media (min-width: 768px) and (max-width: 1279px) { .fpt-board { grid-template-columns: repeat(3, minmax(0, 1fr)); overflow-x: visible; } }
610
+ @media (max-width: 767px) { .fpt-board { grid-template-columns: 1fr; overflow-x: visible; } }
611
+ @media (prefers-reduced-motion: reduce) { .fpt-agent { transition: none; } }
web/src/theme.ts CHANGED
@@ -31,7 +31,10 @@ export const theme = createTheme({
31
  Tabs: { defaultProps: { radius: 'md' } },
32
  Table: { defaultProps: { verticalSpacing: 6, fz: 'sm' } },
33
  Tooltip: { defaultProps: { radius: 'sm' } },
34
- Drawer: { defaultProps: { radius: 'lg', overlayProps: { backgroundOpacity: 0.35 } } },
 
 
 
35
  Menu: { defaultProps: { radius: 'md', shadow: 'md' } },
36
  },
37
  });
 
31
  Tabs: { defaultProps: { radius: 'md' } },
32
  Table: { defaultProps: { verticalSpacing: 6, fz: 'sm' } },
33
  Tooltip: { defaultProps: { radius: 'sm' } },
34
+ Drawer: {
35
+ defaultProps: { radius: 'lg', overlayProps: { backgroundOpacity: 0.35 } },
36
+ styles: { content: { background: 'var(--fpt-surface)', color: 'var(--fpt-text)' }, header: { background: 'var(--fpt-surface)', color: 'var(--fpt-text)' } },
37
+ },
38
  Menu: { defaultProps: { radius: 'md', shadow: 'md' } },
39
  },
40
  });