PromptRunner.Control.Subscriber (PromptRunnerSDK v0.10.0)

Copy Markdown View Source

Follows a run's event stream and forwards it to a subscribing process.

Started by PromptRunner.Control.subscribe/3; callers do not start this directly. It tails control/events.jsonl rather than attaching to the session, so a subscriber cannot slow, block, or crash the run it is watching, and works identically whether it shares a VM with the runner or not.

Messages sent to the subscriber:

  • {:prompt_runner_event, ref, event} — one canonical event, exactly as it was written, so a map with string keys
  • {:prompt_runner_control, ref, {:run_finished, status}} — the run reached a terminal status and the stream has been drained

The subscriber process monitors its target and stops when the target dies, so a dashboard crashing does not leave a poller behind.

Summary

Functions

Returns a specification to start this module under a supervisor.

Types

opts()

@type opts() :: [
  packet_dir: String.t(),
  run_id: String.t(),
  target: pid(),
  ref: reference(),
  from: :start | :current,
  interval_ms: pos_integer()
]

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

start_link(opts)

@spec start_link(opts()) :: GenServer.on_start()

stop(pid)

@spec stop(pid()) :: :ok