pages.reactive.stream

Page actions AI-ready formats and sharing
Open LLM text
Share with AI
Ask Claude Ask ChatGPT Ask Gemini Ask Copilot

Reactive SSE stream that auto-pushes re-rendered blocks.

Reactive SSE stream that auto-pushes re-rendered blocks.

pages.reactive.stream

Name Type Default Description
type
qualified_name
element_type
description
source_file
line_number
is_autodoc
autodoc_element
_autodoc_template
_autodoc_url_path
_autodoc_page_type
title
doc_content_hash

Symbols on this page

_context_builder_arity
function
def _context_builder_arity(fn: _ContextBuilder) -> int

Detect whether context_builder accepts a positional changed_paths arg.

Parameters

Name Type Default Description
fn _ContextBuilder
reactive_stream
function
def reactive_stream(bus: ReactiveBus, *, scope: str, index: DependencyIndex, context_builder: _ContextBuilder, origin: str | None = None, connection: ConnectionInfo | None = None, on_disconnect: Callable[[str, ConnectionInfo | None], None] | None = None, kida_env: Any = None) -> EventStream

Create an SSE EventStream that auto-pushes re-rendered blocks.

Subscribes to theReactiveBusfor the given scope. When a ChangeEventarrives, looks up affected blocks in the DependencyIndex and yields them as Fragmentobjects. The chirp SSE layer handles rendering via the app's kida env.

Parameters

Name Type Default Description
bus ReactiveBus The reactive event bus to subscribe to.
scope str Scope key (e.g., document ID).
index DependencyIndex Dependency index mapping paths to blocks.
context_builder _ContextBuilder Callable that returns the current context dict. May accept zero arguments (original API) or one argument (``frozenset[str]`` of changed paths for selective queries).
origin str | None None Identity of this connection (e.g., user/session ID). Events whose ``origin`` matches are skipped — the client that caused the change doesn't need to be notified of it. ``None`` disables origin filtering.
connection ConnectionInfo | None None Optional subscriber identity. Enables audience filtering and presence tracking on the bus.
on_disconnect Callable[[str, ConnectionInfo | None], None] | None None Optional callback invoked when this subscriber exits. Receives ``(scope, connection)``.
kida_env Any None Deprecated — rendering is handled by the SSE response layer. Accepted for backwards compatibility.

View source · /home/runner/work/chirp/chirp/site/../src/chirp/pages/reactive/stream.py:1