Skip to content

ThoughtView

Base classes

Name Children Inherits
Collapsible
textual.widgets._collapsible
A collapsible container.

β‹” Inheritance diagram

graph TD
  107846722128752["blocks.ThoughtView"]
  107846721214528["_collapsible.Collapsible"]
  107846718477920["widget.Widget"]
  107846718489888["dom.DOMNode"]
  107846718374032["message_pump.MessagePump"]
  137699722799616["builtins.object"]
  107846721214528 --> 107846722128752
  107846718477920 --> 107846721214528
  107846718489888 --> 107846718477920
  107846718374032 --> 107846718489888
  137699722799616 --> 107846718374032

πŸ›ˆ DocStrings

Bases: Collapsible

The agent's reasoning, collapsible.

Source code in src/acptui/ui/widgets/blocks.py
class ThoughtView(Collapsible):
    """The agent's reasoning, collapsible."""

    DEFAULT_CSS = """
    ThoughtView {
        height: auto;
        background: transparent;
        border: none;
        padding: 0;
        margin: 0 0 1 0;
        CollapsibleTitle { color: $text-muted; text-style: italic; padding: 0 1; }
        Contents { padding: 0 0 0 2; }
        Markdown { color: $text-muted; background: transparent; margin: 0; padding: 0; }
    }
    """

    def __init__(self, entry: MessageEntry, cwd: str, *, expanded: bool) -> None:
        self.entry = entry
        self.cwd = cwd
        self.markdown = StreamingMarkdown(_content_markdown(entry.blocks, cwd))
        super().__init__(self.markdown, title="Thinking…", collapsed=not expanded)

    async def refresh_entry(self) -> None:
        """Show the entry's current content (streaming what was appended)."""
        await self.markdown.sync(_content_markdown(self.entry.blocks, self.cwd))

    async def finish(self) -> None:
        """Flush streamed text; the title then says the thinking is done."""
        await self.markdown.finish()
        self.title = "Thought"

finish async

finish() -> None

Flush streamed text; the title then says the thinking is done.

Source code in src/acptui/ui/widgets/blocks.py
async def finish(self) -> None:
    """Flush streamed text; the title then says the thinking is done."""
    await self.markdown.finish()
    self.title = "Thought"

refresh_entry async

refresh_entry() -> None

Show the entry's current content (streaming what was appended).

Source code in src/acptui/ui/widgets/blocks.py
async def refresh_entry(self) -> None:
    """Show the entry's current content (streaming what was appended)."""
    await self.markdown.sync(_content_markdown(self.entry.blocks, self.cwd))

:fa-brands-github: Show source on GitHub