@sisu-ai/mw-trace-viewer
v10.0.0
Published
Export run traces as JSON + HTML with one middleware.
Maintainers
Readme
@sisu-ai/mw-trace-viewer
Export run traces as JSON + HTML with one middleware.
Setup
npm i @sisu-ai/mw-trace-viewerUsage
import { traceViewer } from '@sisu-ai/mw-trace-viewer';
const app = new Agent()
.use(traceViewer({ style: 'dark' }))
// ...rest of your pipelineOptions
enable?: boolean— force on/off (default: enabled when--traceorTRACE_JSON=1/TRACE_HTML=1present)path?: string— output target;.htmlwrites HTML only,.jsonwrites JSON + HTML sidecar (default:trace.json)html?: boolean— write HTML (defaulttrue, or controlled byTRACE_HTML=1env var)json?: boolean— write JSON (defaulttrue, or controlled byTRACE_JSON=1env var)style?: 'light'|'dark'— built‑in themes (defaultlight)template?: (doc, style) => string— custom HTML rendererdir?: string— directory for traces when no explicit path given (default:traces)
CLI / Env
--traceor--trace=run.json|run.html— enable tracing with optional output path--trace-style=light|dark— set theme via CLITRACE_JSON=1— enable tracing and control JSON output (only JSON if set alone)TRACE_HTML=1— enable tracing and control HTML output (only HTML if set alone)TRACE_STYLE=dark— set theme via env var
Priority: Options passed to traceViewer() always take precedence over env vars. If neither are set, both HTML and JSON are written by default.
What’s captured
input,finalmessage text- Full
messagesarray eventsfrom the tracing logger (wrapsctx.logunder the hood)
Community & Support
Discover what you can do through examples or documentation. Check it out at https://github.com/finger-gun/sisu. Example projects live under examples/ in the repo.
