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.tsis the one theme object:createTheme(tokens, breakpoints,otherfor the layout constants) pluscomponents:defaults through the Styles API (everyTableis dense throughtheme.components.Table.classNames;Badge,Progress,Kbd,NavLink,AppShellcarry their defaults there). The palette is still fleetcore's: the CSS-variables resolver points Mantine's variables at/theme.cssand 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.cssbeside 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-mantineforrem(),light-dark()and@mixin hover;postcss-simple-varsfor breakpoint variables in media queries). One-line layout roles aresrc/styles/utils.module.css(nowrap,preWrap,flexFill,tileLink,embed, …).src/styles.cssis base rules only. No inlinestyle={{…}}objects: the onlystyleprops 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 adata-*attribute the module styles, never a class string the page assembles. - Widgets are Mantine components. Status pills are
Badge, meters areProgress, health dots areColorSwatch+VisuallyHidden, key caps areKbd, and charts are@mantine/charts(BarCharton Recharts) with the console's series roles asvar(--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 oneh1;Sectionis anh2. The shell turns that name into the tab title, the route announcement and the palette's recent list, so no page setsdocument.title. - Everything the mouse does has a keyboard path. A list goes through
DataTable, whose headers are buttons reportingaria-sortand whose rows carry a link or take focus. Enter belongs to the focused control;GlobalKeysopens 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.
Loadkeeps 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;ErrorBoundaryholds a page that throws. A new page gets all of this by usingLoad. - 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 thebasename), point at files withasset()fromapi/backend.ts, and never write a bare/pathinto anhreforsrc. - 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/fleetcorethrough 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.shfrom_data/profile.ymlsites:); the title, who the site is by and what the desktop shows come from the site document.to.home()andto.desktop()(lib/links.ts) say where each is in this build, so no page writes/or/desktopfor either, and no site's name is written insrc/(../test_pages.pyholds that; docs/CONSOLE-PAGES.md). - The bundle carries no inline script, so the console's
script-src 'self'policy holds.