Vibe.Gateway.StreamConsumer (vibe v0.2.2)

Copy Markdown View Source

Converts streamed assistant text into throttled gateway message edits.

The consumer is platform-neutral. It receives semantic text deltas and uses an Vibe.Gateway.Adapter implementation to send the first visible message, edit it as content grows, and finalize it without a cursor. Telegram is the first target, but the rules are intentionally generic and BEAM-native.

Summary

Functions

Returns a specification to start this module under a supervisor.

Removes gateway-internal directives that should never be shown to users.

Types

option()

@type option() ::
  {:adapter, module()}
  | {:chat_id, String.t()}
  | {:adapter_opts, keyword()}
  | {:edit_interval_ms, pos_integer()}
  | {:buffer_threshold, pos_integer()}
  | {:cursor, String.t()}
  | {:max_message_length, pos_integer()}
  | {:reply_to, String.t() | nil}

t()

@type t() :: %Vibe.Gateway.StreamConsumer{
  accumulated: term(),
  adapter: term(),
  adapter_opts: term(),
  buffer_threshold: term(),
  chat_id: term(),
  cursor: term(),
  done?: term(),
  edit_interval_ms: term(),
  last_edit_ms: term(),
  max_message_length: term(),
  message_id: term(),
  reply_to: term(),
  timer: term(),
  visible_text: term()
}

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

delta(pid, text)

@spec delta(pid(), String.t()) :: :ok

filter_display_text(text)

@spec filter_display_text(String.t()) :: String.t()

Removes gateway-internal directives that should never be shown to users.

finish(pid)

@spec finish(pid()) :: :ok

segment_break(pid)

@spec segment_break(pid()) :: :ok

start_link(opts)

@spec start_link([option()]) :: GenServer.on_start()