This page summarizes the main public APIs exported fromDocumentation Index
Fetch the complete documentation index at: https://docs.m4trix.dev/llms.txt
Use this file to discover all available pages before exploring further.
@m4trix/tracing and @m4trix/trace-viewer.
Tracer
UseTracer.from(...) to create a callback handler backed by a TraceStore.
handleChainStart,handleChainEnd,handleChainErrorhandleLLMStart,handleLLMEnd,handleLLMErrorhandleChatModelStarthandleToolStart,handleToolEnd,handleToolErrorhandleRetrieverStart,handleRetrieverEnd,handleRetrieverError
flush() waits for in-flight callback writes, writes pending runs in a batch, and upserts pending trace summaries.
TraceStore
UseTraceStore.of(...) to compose structure and payload adapters.
upsertTrace(trace)upsertRun(run)upsertRunBatch(runs)getTrace(traceId)listTraces(query?)putJsonPayload(path, value)getPayload(ref)putPayloadStream(path, body)getPayloadStream(ref)
putStream and getStream.
Filesystem Adapters
Use the built-in adapters for local traces:FsStructureStoreAdapter writes:
traces/<traceId>/trace.jsontraces/<traceId>/runs.ndjson
FsPayloadStoreAdapter writes JSON and stream payloads inside the configured root and rejects absolute paths or parent-directory refs.
TraceViewerApi
UseTraceViewerApi.from(...) to read traces for a UI or API layer.
listTraces(query?)getTrace(traceId)getTraceTree(traceId)getPayload(ref)
getTraceTree(...) returns { trace, root }, where root is a TraceRunNode with recursive children.
Data Types
Trace fields:
schemaVersiontraceIdrootRunIdprojectIdnamestatusstartTime,endTime,latencyMstokens,costUsdrunCountmetadata
TraceRun fields:
schemaVersiontraceIdrunIdparentRunIdtypenamestatusstartTime,endTime,latencyMstokens,costUsd,errorinputRef,outputRef,eventsRefmetadata,extra
Custom Adapters
ImplementStructureStoreAdapter for trace and run records:
PayloadStoreAdapter for JSON payloads and optional streams:
Trace Viewer Package
@m4trix/trace-viewer exports:
createFsTraceViewerApi(traceRootPath)startTraceViewerServer({ traceViewerApi, port, host? })appRouterparseCliArgs(argv)cliHelpText(program)DEFAULT_PORTDEFAULT_FS_RELATIVE_PATH