Active TraceWriter to emit events to
Trace ID of the enclosing scope, or null for root scopes
Human-readable scope label (e.g. "pool", "tool:search")
Optionalmeta: Record<string, unknown>Optional key-value metadata attached to the scope:open event
Object with the allocated traceId and a close callback
Create matched
scope:open/scope:closepairs for building the trace treeOpens a named scope immediately and returns a handle to close it later. The close callback emits a
scope:closeevent with the elapsed duration and flushes the writer, ensuring scope boundaries are always persisted.Used throughout the runtime to bracket agent pools, tool dispatches, shared-root regions, and generation passes.