GenServer managing a persistent Claude streaming session.
Real sessions run on ClaudeAgentSDK.Runtime.CLI, which itself runs on the
shared core session API. The in-memory mock mode remains local so tests can
drive streaming behavior deterministically without a subprocess.
Summary
Functions
Returns a specification to start this module under a supervisor.
Closes the session.
Returns the current Claude session id if one has been observed.
Sends a message to the session and returns a lazy event stream.
Starts a new streaming session.
Types
@type state() :: %ClaudeAgentSDK.Streaming.Session{ accumulated_text: String.t(), active_subscriber: reference() | nil, message_buffer: String.t(), mode: :runtime | :mock, options: ClaudeAgentSDK.Options.t(), runtime_event_tag: atom() | nil, runtime_projection_state: ClaudeAgentSDK.Runtime.CLI.ProjectionState.t() | nil, runtime_ref: reference() | nil, runtime_session: pid() | nil, runtime_session_monitor_ref: reference() | nil, runtime_transport: pid() | nil, runtime_transport_monitor_ref: reference() | nil, session_id: String.t() | nil, stderr_buffer: String.t(), stop_reason: String.t() | nil, subscriber_monitors: %{optional(reference()) => reference()}, subscriber_queue: [{reference(), String.t()}], subscribers: %{optional(reference()) => pid()} }
@type subscriber_pid() :: pid()
@type subscriber_ref() :: reference()
Functions
Returns a specification to start this module under a supervisor.
See Supervisor.
@spec close(pid()) :: :ok
Closes the session.
Returns the current Claude session id if one has been observed.
@spec send_message(pid(), String.t()) :: Enumerable.t()
Sends a message to the session and returns a lazy event stream.
@spec start_link(ClaudeAgentSDK.Options.t() | nil) :: GenServer.on_start()
Starts a new streaming session.