Skip to content

Harness Console — the page

The browser front end of the Harness Console. It is a React + TypeScript app on Mantine (app shell, Spotlight palette, modals, notifications), TanStack Query and React Router, with xterm.js for the Terminal page. Vite builds it into dist/, which ../app.py serves at every non-API path.

npm install && npm run build   # dist/ — what the console serves (run.sh does this on start)
../build-pages.sh              # dist-pages/ — the public site: base /bamr87/, VITE_STATIC=1, plus the snapshot
CONSOLE_SITE=bash-365 ../build-pages.sh   # another site of the same console: its title, mark and front door from _data/profile.yml `sites:`
npm run dev                    # :5173 with hot reload, proxied to a console on :4001 (CONSOLE_URL to change)
npm run typecheck

Dependencies are always-latest (*), and .npmrc sets package-lock=false, so no lockfile is ever written (fleet policy, docs/DEPENDENCIES.md).

How it is put together

Path Role
src/main.tsx Providers and the route table
src/nav.ts The information architecture: nine sections of pages, the profile first and then the console. keys v1's 1–9 and ] / [ follow it
src/theme.ts The one theme object: createTheme tokens + components: defaults, and the CSS-variables resolver that points Mantine at the bashOS palette from /theme.css (tools/fleetcore/theme.py) and declares the console's own roles per colour scheme
src/styles.css Base rules only (body background, link colour); everything else is a CSS module
src/styles/ Table.module.css (every table, via the theme) and utils.module.css (one-line layout roles)
postcss.config.cjs Mantine's standard PostCSS setup: postcss-preset-mantine + breakpoint variables
src/api/ client.ts (the one api() every page calls, + the one-prompt console token), backend.ts (which backend answers: the console, the published snapshot, or a remote console; the browser-held GitHub token), static.ts (an /api path → the snapshot file ../snapshot.py wrote), ghdirect.ts (the console's GitHub routes and workflow dispatch, answered from the browser against api.github.com), types.ts, hooks.ts (one Query hook per document)
src/lib/ format.ts, ansi.ts (SGR → HTML for job logs), links.ts (every internal route and GitHub link, in one place), prefs.ts (what this browser remembers: open sidebar sections, recent pages)
src/components/ the shell (Shell, ShellNav: the folding sidebar and its live counts; pageTitle: a page names itself once; ErrorBoundary: a page that throws costs that page), DataTable (sortable, linkable rows with keys v1 navigation), the palette, the global keymap, Charts (Mantine Progress meters + the lazily loaded Columns bar chart on @mantine/charts), Viz (the Overview's story pieces in the console's roles: segmented bar, bullet, inline-SVG sparkline, delta, weekday × hour heat strip, freshness timeline — identity never colour alone, a tooltip on every mark), small UI pieces (ui.tsx: Badge pills, ColorSwatch dots, Progress meters, tiles)
src/jobs/ JobRunner (the confirm gate, submit, the live-log drawer), OpForm, RunButton, JobLog
src/github/ the GitHub surface: ConnectPanel (OAuth App setup, device / browser flows), RepoManager (issues, PRs, runs, workflows), useGhAction (every write: say, ask, POST with confirm, log)
src/assist/ the docked assistant (ADR 0013): AssistDock (the panel in the shell's aside: the mode control, the thread of messages with each session's steps, the Allow/Deny prompt, the composer, pairing), session (the dock's state outside React: this tab's page-bridge session and its long poll, the mode, the prompts, the conversation) and pageBridge (the page's half of ../page_bridge.py: the snapshot, the eight actions, and the rules no session can lift — refs only, never inside a modal dialog, never a secret field)
src/pages/ one file per page, plus the drill-downs (ProjectPage, ContentSite, loop, job and operation pages); the profile (Home, Profile — pages and posts, Portfolio), the registries (Registries: roadmap, features, engagements, toolbox), the bashOS desktop (Desktop: the OS shell drawn from the vendored reducer in src/vendor/bashos/, each window hosting Apps' AppPane), the app portal (Apps: the launcher grid and the framed workspace, styled by Apps.module.css), the generated repo app (RepoApp: what a repo with no frontend in the shell opens as, on the Apps page and in a Desktop window), the Work board (Work, with WorkBoard — lanes, cards and drag and drop, WorkItem — the drawer, WorkFlow — throughput, workPlan — the staged plan), the harness refinement (Refine: surface, plans, review queue, evidence, library), the assistant (Assist, with jobs/AssistAnswer — a job's question and answer), GitHub Projects (GhProjects: owners, a project picker, items as a table or a board by Status; console-only, read-only), the voice model editor (Voices: defaults, site profiles, personas and assignment rules as forms, preview, dry run, draft PR) and Connect

Rules the code keeps:

  • Theme and layout come from Mantine, not from hand-written CSS. src/theme.ts is the one theme object: createTheme (tokens, breakpoints, other for the layout constants) plus components: defaults through the Styles API (every Table is dense through theme.components.Table.classNames; Badge, Progress, Kbd, NavLink, AppShell carry their defaults there). The palette is still fleetcore's: the CSS-variables resolver points Mantine's variables at /theme.css and declares the console's own roles (chart series, meter tracks, ANSI log colours) per colour scheme. No stylesheet carries a palette.
  • Styling is CSS modules + style props. Component styles live in a *.module.css beside the component (DataTable.module.css, Charts.module.css, JobLog.module.css, pages/TerminalPage.module.css, …), processed by Mantine's standard PostCSS setup (postcss.config.cjs: postcss-preset-mantine for rem(), light-dark() and @mixin hover; postcss-simple-vars for breakpoint variables in media queries). One-line layout roles are src/styles/utils.module.css (nowrap, preWrap, flexFill, tileLink, embed, …). src/styles.css is base rules only. No inline style={{…}} objects: the only style props left set a CSS custom property whose value is data (--tick, --term-bg), which is Mantine's own pattern for dynamic values. State on a row is a data-* attribute the module styles, never a class string the page assembles.
  • Widgets are Mantine components. Status pills are Badge, meters are Progress, health dots are ColorSwatch + VisuallyHidden, key caps are Kbd, and charts are @mantine/charts (BarChart on Recharts) with the console's series roles as var(--series-*) colours. Status is always an icon plus a label (Status), never colour alone, and every chart keeps a table view.
  • A page names itself in its PageHeader, which is its one h1; Section is an h2. The shell turns that name into the tab title, the route announcement and the palette's recent list, so no page sets document.title.
  • Everything the mouse does has a keyboard path. A list goes through DataTable, whose headers are buttons reporting aria-sort and whose rows carry a link or take focus. Enter belongs to the focused control; GlobalKeys opens the selected row only when nothing is focused. An open menu or list keeps its own arrows and Escape.
  • A failure stays the size of what failed. Load keeps a query's last answer on screen when a refresh fails and offers Try again when there is nothing to show; a 4xx is not retried; ErrorBoundary holds a page that throws. A new page gets all of this by using Load.
  • Every entity links to its page through lib/links.ts, so a repo name or operation opens the same drill-down everywhere.
  • The public build lives under /bamr87/: navigate through React Router (it carries the basename), point at files with asset() from api/backend.ts, and never write a bare /path into an href or src.
  • A page never asks which backend it is on to fetch data — only to decide what to offer (hasConsole()): a lever that needs a console says so (LocalOnly, runnableHere) instead of failing.
  • A view, key or colour the terminal dash shows too comes from tools/fleetcore through the API (/api/fleet, /api/keys, /theme.css, /api/theme) and is never copied here.
  • A site's identity is a setting. What / is (FRONT_DOOR) and the mark (MARK) come from the build (api/backend.ts, set by ../build-pages.sh from _data/profile.yml sites:); the title, who the site is by and what the desktop shows come from the site document. to.home() and to.desktop() (lib/links.ts) say where each is in this build, so no page writes / or /desktop for either, and no site's name is written in src/ (../test_pages.py holds that; docs/CONSOLE-PAGES.md).
  • The bundle carries no inline script, so the console's script-src 'self' policy holds.