@vitest-agent/ui
v1.0.0
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.
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), a PubSub channel for live event transport, 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 —
dispatchanddispatchInkroute aDispatchInputsto the matching(RunShape, RunOutcome)cell;classifyRunShapeandclassifyOutcomederive the coordinates - Ink components —
StreamAppand the supporting primitives (ModuleHeader,TestRow,CoverageBlock,TrendLine,FailureSection, etc.) for livestream-mode frames - PubSub channel —
RunEventChannelEffect tag and helpers (accumulateUntilFinished,forEachRenderState,renderStateStream) for live event transport - 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 required peers:
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.
