AGENTS.md
apps/web/src/components/Theater/AGENTS.mdAGENTS.md
Quality
72/100
Scores the file, not the repository.Length
853 words
5 headings · 0 code blocksRepository
83k
— · pushed 0 days agoLast changed
3 days ago
First indexed 3 days ago.1# `apps/web/src/components/Theater/` (Critique Theater, web side)23Module map agents enter when they need to change the visual surface of4the Design Jury feature. The directory keeps the internal **Theater**5name; the user-facing label "Design Jury" comes from a single i18n key,6`critiqueTheater.userFacingName`, so the product name can be renamed7without code churn.89## Layout1011| File | Responsibility |12|---|---|13| `state/reducer.ts` | Pure state machine. Driven by `PanelEvent` from the contracts package plus a synthetic `__reset__` action the hooks dispatch on context changes. |14| `state/sse.ts` | SSE channel manager + `sseToPanelEvent` which lifts the wire shape back to a `PanelEvent`. Runs per-variant validation so a malformed frame cannot reach the reducer. |15| `hooks/useCritiqueStream.ts` | Subscribes to the project SSE stream and feeds the reducer. Tears down on `enabled=false` and on `projectId` change, dispatching `__reset__` so a prior project's state cannot bleed in. |16| `hooks/useCritiqueReplay.ts` | Drives the same reducer from a recorded `.ndjson(.gz)` transcript. Parse + pace are split into two effects so pause / resume preserves the cursor. |17| `CritiqueTheaterMount.tsx` | Drop-in mount the project view uses. Owns the kill-request handshake (`POST /api/projects/:id/critique/:runId/interrupt`) and the phase-aware swap from live stage to collapsed badge. |18| `TheaterStage.tsx` | Live-debate container. Mounts five `PanelistLane`s + `ScoreTicker` + `RoundDivider` rail + `InterruptButton`. |19| `PanelistLane.tsx` | One row per panelist. Keyed by `data-role` for CSS tinting; no hex literals in source. |20| `ScoreTicker.tsx` | Composite trajectory with a threshold marker. |21| `RoundDivider.tsx` | Round-by-round separator carrying composite vs threshold. |22| `InterruptButton.tsx` | Click + Esc binding. Esc scopes itself to non-text-input focus so the prompt textarea is safe. |23| `TheaterDegraded.tsx` | Single chip surface for runs the orchestrator could not score. `useId()` for the heading id so multiple chips on one page do not collide. |24| `TheaterCollapsed.tsx` | Post-run summary: shipped, interrupted, failed. The interrupted branch uses `interruptedSummary`, not `shippedSummary`. |25| `TheaterTranscript.tsx` | Read-only replay surface bound to `useCritiqueReplay`. |26| `hooks/useCritiqueTheaterEnabled.ts` | Reads the Settings toggle from `open-design:config` localStorage and stays in sync with cross-tab `storage` events plus the same-tab `open-design:critique-theater-toggle` CustomEvent. Pairs with the `setCritiqueTheaterEnabled` setter so a Settings save reflects in every mounted hook without a reload. |27| `index.ts` | Public barrel. Exports the mount, the four surface components plus the `InterruptButton`, the three hooks (`useCritiqueStream`, `useCritiqueReplay`, `useCritiqueTheaterEnabled`), the imperative setter (`setCritiqueTheaterEnabled`), and the reducer-derived contract types. Everything else stays internal. |2829## Invariants3031- **Reducer is pure.** All state lives in `useReducer`; no `useState`32 for run state inside the components. The reducer's actions are the33 contract-level `PanelEvent` union plus the host-synthesized34 `{ type: '__reset__' }`.35- **Role-keyed tinting via `data-role`.** Components carry the role as36 a data attribute; CSS picks the right hue via `color-mix` over an37 existing semantic token (`var(--accent)`, `var(--amber)`,38 `var(--purple)`, `var(--green)`, `var(--blue)`). No hex literals39 inside this directory.40- **All strings go through the i18n registry.** Every visible string is41 a `t(...)` call against the `critiqueTheater.*` key namespace.42 Hardcoded English will fail review; the locale alignment test43 enforces every locale carries the same keyset.44- **Terminal phases are sticky.** Once the reducer is in `shipped`,45 `degraded`, `interrupted`, or `failed`, only a `run_started` for a46 new runId or a host-dispatched `__reset__` can leave that phase.47 Late `parser_warning` events are accepted because they are48 informational, not lifecycle.49- **Interrupt is double-action.** Click or Esc dispatches the50 optimistic local `interrupted` action AND issues `POST51 /api/projects/:id/critique/:runId/interrupt`. A failed fetch is52 swallowed with a dev-mode warning so the UI still moves to the53 collapsed badge.54- **Designer weight is frozen at 0.0 until v2 cast config lands.**55 Mirror of the same invariant in56 [`apps/daemon/src/critique/AGENTS.md`](../../../../daemon/src/critique/AGENTS.md):57 the v1 weight distribution (designer 0 / critic 0.4 / brand 0.2 /58 a11y 0.2 / copy 0.2) is wire-shape, not a tuning knob. The web59 side reflects that by treating composite weights as read-only:60 `ScoreTicker` and `TheaterCollapsed` read `composite` straight off61 the wire and never recompute it from per-panelist scores. V262 lands per-skill cast configuration as a Settings surface63 (`apps/web/src/components/SettingsDialog.tsx`) that writes to the project's64 settings row; the daemon resolver reads that row and feeds the65 per-run weight map into the composite computation, so the web66 layer continues to render whatever number the daemon produces. Do67 not add a `weights` prop to any component in this directory and68 do not recompute the composite client-side until the contracts69 package carries the v2 cast type.7071## When you change anything here72731. Update `packages/contracts/src/critique.ts` first if the wire shape74 changes. The web reducer keys off `PanelEvent`; the SSE manager75 keys off `CRITIQUE_SSE_EVENT_NAMES`. Both live in that one file.762. Add an i18n key to `apps/web/src/i18n/types.ts`, then define it in77 all 19 files under `apps/web/src/i18n/locales/`. The locale files78 carry complete dictionaries rather than inheriting missing keys from79 English.803. Run `pnpm --filter @open-design/web exec vitest run tests/components/Theater`81 before pushing. The suite has 100+ cases pinning the reducer82 shape, SSE validation, host lifecycle, and component renders.834. Visual regression: run `pnpm --filter @open-design/e2e test:ui:extended`84 with `--update-snapshots` after any CSS change in85 `apps/web/src/styles/viewer/theater.css`'s `.theater-*` block.8687## Related8889- Spec: `specs/current/critique-theater.md`90- Plan: `specs/current/critique-theater-plan.md`91- User docs: `docs/critique-theater.md`92- Daemon counterpart: `apps/daemon/src/critique/AGENTS.md`93
Also in nexu-io/open-design
Diff this repo’s formatsOne repository carrying more than one format is the comparison this product exists for: does anyone actually write different content in each file, or is one a copy of the other?
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| nexu-io/open-designplugins/AGENTS.md · 83k | AGENTS.md | stylearchsecuritydo-not | 68/100 | 3 days ago | |
| nexu-io/open-design.github/AGENTS.md · 83k | AGENTS.md | stylearchgitapi+3 | 83/100 | 3 days ago | |
| nexu-io/open-designAGENTS.md · 83k | AGENTS.md | setupteststylearch+9 | 74/100 | 3 days ago | |
| nexu-io/open-designapps/AGENTS.md · 83k | AGENTS.md | testarchmonorepo | 90/100 | 3 days ago | |
| nexu-io/open-designapps/daemon/AGENTS.md · 83k | AGENTS.md | teststylearchtesting-strategy+4 | 86/100 | 3 days ago | |
| nexu-io/open-designapps/daemon/src/critique/AGENTS.md · 83k | AGENTS.md | archtesting-strategymonorepo | 52/100 | 3 days ago | |
| nexu-io/open-designapps/landing-page/AGENTS.md · 83k | AGENTS.md | apideploymentmonorepo | 82/100 | 3 days ago | |
| nexu-io/open-designapps/packaged/AGENTS.md · 83k | AGENTS.md | monorepodo-not | 54/100 | 3 days ago | |
| nexu-io/open-designdesign-systems/_schema/AGENTS.md · 83k | AGENTS.md | archtesting-strategyapi | 58/100 | 3 days ago | |
| nexu-io/open-designdesign-templates/AGENTS.md · 83k | AGENTS.md | apiui | 43/100 | 3 days ago | |
| nexu-io/open-designe2e/AGENTS.md · 83k | AGENTS.md | teststylearchtesting-strategy+3 | 93/100 | 3 days ago | |
| nexu-io/open-designpackages/AGENTS.md · 83k | AGENTS.md | archdependenciesmonorepo | 86/100 | 3 days ago | |
| nexu-io/open-designskills/AGENTS.md · 83k | AGENTS.md | no sections | 39/100 | 3 days ago | |
| nexu-io/open-designtools/AGENTS.md · 83k | AGENTS.md | testing-strategy | 82/100 | 3 days ago | |
| nexu-io/open-designtools/pack/AGENTS.md · 83k | AGENTS.md | styletesting-strategyperformancedeployment+1 | 85/100 | 3 days ago | |
| nexu-io/open-designtools/serve/AGENTS.md · 83k | AGENTS.md | do-not | 32/100 | 3 days ago |
Diff against plugins/AGENTS.md Diff against .github/AGENTS.md Diff against AGENTS.md Diff against apps/AGENTS.md Diff against apps/daemon/AGENTS.md Diff against apps/daemon/src/critique/AGENTS.md Diff against apps/landing-page/AGENTS.md Diff against apps/packaged/AGENTS.md Diff against design-systems/_schema/AGENTS.md Diff against design-templates/AGENTS.md Diff against e2e/AGENTS.md Diff against packages/AGENTS.md Diff against skills/AGENTS.md Diff against tools/AGENTS.md Diff against tools/pack/AGENTS.md Diff against tools/serve/AGENTS.md
Similar configs
Same format, overlapping stack, ranked by quality.
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| n8n-io/n8npackages/@n8n/agents/AGENTS.md · 199k | AGENTS.md | buildteststylearch+3 | 100/100 | 3 days ago | |
| TryGhost/Ghoste2e/AGENTS.md · 55k | AGENTS.md | setupteststylearch+2 | 100/100 | 3 days ago | |
| SkeneTechnologies/skene-cookbookAGENTS.md · 51 | AGENTS.md | setupbuildtestlint-format+7 | 100/100 | 2 days ago | |
| mui/material-uiAGENTS.md · 99k | AGENTS.md | setupbuildtestlint-format+9 | 100/100 | 3 days ago | |
| aaif-goose/gooseAGENTS.md · 52k | AGENTS.md | setupbuildtestlint-format+6 | 100/100 | 3 days ago | |
| duckduckgo/content-scope-scriptsspecial-pages/AGENTS.md · 70 | AGENTS.md | buildteststylearch+3 | 100/100 | 3 days ago | |
| trick77/agents-md-syncAGENTS.md · 2 | AGENTS.md | setupbuildteststyle+5 | 100/100 | 3 days ago | |
| code-yeongyu/oh-my-openagentpackages/web/AGENTS.md · 67k | AGENTS.md | setupbuildtestlint-format+6 | 100/100 | 2 days ago |
