Skip to content

API Reference parrot.cli.console

github-actions[bot] edited this page Dec 2, 2026 · 4 revisions

parrot.cli.console

View source

Shared Rich console and the modal LiveRegion discipline for the Parrot CLI (FEAT-573 M1).

Extracts the pause/resume pattern proven in parrot.cli.devloop.renderer.RunView (devloop/renderer.py:82-107): exactly one writer owns the terminal at a time.

Class LiveRegion

Managed rich.live.Live area with 'one writer at a time' discipline.

When console.is_terminal is False every update() prints the renderable once, sequentially, and modal() is a no-op — piping stays clean.

Parameter Type Default Description
console Optional[Console] None
refresh_per_second int 8
transient bool False

Attributes:

Attribute Type Description
is_terminal bool console.is_terminal of the bound console.

Method LiveRegion.start

Start the Live display (idempotent; no-op on non-terminals).

start() -> None

Method LiveRegion.stop

Stop the Live display, leaving the last frame on screen (idempotent).

stop() -> None

Method LiveRegion.pause

Live.stop() so another writer may own the terminal.

pause() -> None

Method LiveRegion.resume

Live.start() after a pause; no-op if never started.

resume() -> None

Method LiveRegion.update

Replace the region content (repainted on the next refresh tick).

update(renderable: Any) -> None

Parameter Type Default Description
renderable Any

Method LiveRegion.modal

Pause for the duration of a prompt/modal interaction, then resume.

modal() -> Iterator[None]

Returns: Iterator[None]

Function get_console

Return the process-wide shared Rich Console (created on first call).

get_console() -> Console

Returns: Console

Function reset_console

Restore lazy creation on the next get_console() call.

reset_console() -> None

Function set_console

Override (or clear, with None) the shared console. Test seam.

set_console(console: Optional[Console]) -> None

Parameter Type Default Description
console Optional[Console]

Architecture

Clients

Bots & Agents

Memory

Knowledge

Tools & Toolkits

Flows

Experts

Skills

Stores & Loaders

MCP & A2A

Server & APIs

Integrations

Outputs & A2UI

Prompts

Security

Operations

Migration

SDD Tooling

LLM Wiki

Deployment

Decisions

API Reference

Clone this wiki locally