npm.io
1.0.4 • Published 20h ago

@vitest-agent/ui

Licence
MIT
Version
1.0.4
Deps
2
Size
161 kB
Vulns
0
Weekly
0
Stars
2

@vitest-agent/ui

npm License: MIT TypeScript 6.0

Part of the vitest-agent ecosystem. Most users want @vitest-agent/plugin, which pulls this package in automatically. Install @vitest-agent/ui directly 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) => state fold over the RunEvent discriminated union; reduceRenderStateAll for one-shot replay
  • Dispatcher matrixdispatch and dispatchInk route a DispatchInputs to the matching (RunShape, RunOutcome) cell; classifyRunShape and classifyOutcome derive the coordinates
  • Ink componentsStreamApp and the supporting primitives (ModuleHeader, TestRow, CoverageBlock, TrendLine, FailureSection, etc.) for live stream-mode frames
  • PubSub channelRunEventChannel Effect tag and helpers (accumulateUntilFinished, forEachRenderState, renderStateStream) for live event transport
  • SynthesizerssynthesizeRunEvents from live Vitest modules; synthesizeFromAgentReport from a stored AgentReport
  • Footer builderbuildFooter assembles the L1 MCP-tool-pointer footer; dominantClassification picks the most actionable failure class

Install

npm install @vitest-agent/ui
# or
pnpm add @vitest-agent/ui

React and Ink are required peers:

npm install react ink

Quick 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 run

Documentation

Package reference at vitest-agent.dev/ui.

License

MIT