AgentSessionManager.Rendering (AgentSessionManager v0.8.0)

Copy Markdown View Source

Renders agent session event streams through a pluggable renderer and sink pipeline.

This module is the main entry point for rendering. It wires a renderer (which formats events into text) to one or more sinks (which write text to destinations).

Usage

# Render to terminal with compact format
Rendering.stream(event_stream,
  renderer: {Renderers.Compact, []},
  sinks: [{Sinks.TTY, []}]
)

# Render to terminal + log file + JSONL
Rendering.stream(event_stream,
  renderer: {Renderers.Verbose, []},
  sinks: [
    {Sinks.TTY, []},
    {Sinks.File, [path: "session.log"]},
    {Sinks.JSONL, [path: "events.jsonl"]}
  ]
)

# Programmatic: forward events via callback
Rendering.stream(event_stream,
  renderer: {Renderers.Passthrough, []},
  sinks: [{Sinks.Callback, [callback: &handle_event/1]}]
)

Summary

Functions

Consume an event stream, rendering each event and writing to all sinks.

Types

opts()

@type opts() :: [renderer: renderer_spec(), sinks: [sink_spec()]]

renderer_spec()

@type renderer_spec() :: {module(), AgentSessionManager.Rendering.Renderer.opts()}

sink_spec()

@type sink_spec() :: {module(), AgentSessionManager.Rendering.Sink.opts()}

Functions

stream(event_stream, opts)

@spec stream(Enumerable.t(), opts()) :: :ok | {:error, term()}

Consume an event stream, rendering each event and writing to all sinks.

Returns :ok on success or {:error, reason} on failure.