gpt_live_stream

Live, multi-message delivery for Codex-backed Stargazer replies.

class gpt_live_stream.LiveReplyWriter(platform, channel_id, *, stream_id, require_durable, flush_interval=1.0, chunk_length=1800, answer_transform=None, manifest_store=None, manifest_ttl_seconds=7776000)

Bases: object

Coalesce provider deltas into editable, uncapped platform messages.

Provider callbacks only mutate in-memory buffers and wake a background flusher. They never wait for Discord or Gateway I/O, so a slow edit cannot stall the Codex event stream. Every lane may grow into as many messages as required; final reconciliation replaces the answer lane in place.

Parameters:
  • platform (Any)

  • channel_id (str)

  • stream_id (str)

  • require_durable (bool)

  • flush_interval (float)

  • chunk_length (int)

  • answer_transform (Callable[[str], str] | None)

  • manifest_store (Any)

  • manifest_ttl_seconds (int)

property answer_message_ids: list[str]
property all_message_ids: list[str]
property published: bool
property failed: bool
start()
Return type:

LiveReplyWriter

callback(event)

Accept one decoded Codex event without performing network I/O.

Return type:

None

Parameters:

event (Any)

begin_attempt()

Start a provider revision while keeping the old answer until replacement begins.

Return type:

None

async reconcile_final(final_text)

Replace the live answer with the exact postprocessed final response.

Return type:

list[str]

Parameters:

final_text (str)

async discard_answer()

Remove live answer slots when the final reply must use another renderer.

Return type:

None

async close()
Return type:

None

async abort()

Remove unfinalized live posts and stop the editor task.

Return type:

None

gpt_live_stream.stream_edit_identity(stream_id, lane, chunk_index, content)

Return a stable content-addressed suffix for a retry-safe edit.

Return type:

str

Parameters:
  • stream_id (str)

  • lane (str)

  • chunk_index (int)

  • content (str)