@vitest-agent/ui
v5.0.4
Published
Shared event-sourced renderer for vitest-agent. React Ink view for humans, plain-string view for agents, both fed by the same reducer over a RunEvent stream.
Downloads
7,540
Maintainers
Readme
@vitest-agent/ui
Part of the vitest-agent ecosystem. Most users want @vitest-agent/plugin, which pulls this package in automatically. Install
@vitest-agent/uidirectly only if you build custom rendering on the primitives.
Pure rendering primitives for vitest-agent. Owns the RunEvent reducer, the shape-tailored 12-cell dispatcher matrix, two render paths (agent string and React Ink tree), and the synthesizers that bridge live Vitest data and stored reports into the event taxonomy. React and Ink are required peer dependencies.
Features
- Reducer — pure
(state, event) => statefold over theRunEventdiscriminated union;reduceRenderStateAllfor one-shot replay - Dispatcher matrix —
dispatchroutes aDispatchInputsto the matching(RunShape, RunOutcome)cell;classifyRunShapeandclassifyOutcomederive the coordinates - Ink components (
@vitest-agent/ui/ink) —StreamAppand the supporting primitives (ModuleHeader,TestRow,CoverageBlock,TrendLine,FailureSection, etc.) for livestream-mode frames, plusdispatchInk/inkDispatcherTable, the Ink half of the matrix. The package root never loads React or Ink; only this subpath does - Synthesizers —
synthesizeRunEventsfrom live Vitest modules;synthesizeFromAgentReportfrom a storedAgentReport - Footer builder —
buildFooterassembles the L1 MCP-tool-pointer footer;dominantClassificationpicks the most actionable failure class
Install
npm install @vitest-agent/ui
# or
pnpm add @vitest-agent/uiReact and Ink are optional peers, needed only for the @vitest-agent/ui/ink subpath:
npm install react inkQuick start
import { reduceRenderStateAll } from "@vitest-agent/ui";
import { dispatch } from "@vitest-agent/ui";
const state = reduceRenderStateAll(events);
// state is a fully reduced RenderState
const agentString = dispatch(buildDispatchInputs(state, input), opts);
// agentString is the markdown-flavored final-frame string for the runDocumentation
Package reference at vitest-agent.dev/ui.
