Skip to content

SubagentScreen

Base classes

Name Children Inherits
Screen
textual.screen
The base class for screens.

⋔ Inheritance diagram

graph TD
  107846722481408["session.SubagentScreen"]
  107846717858048["screen.Screen"]
  107846685555472["typing.Generic"]
  137699722799616["builtins.object"]
  107846718477920["widget.Widget"]
  107846718489888["dom.DOMNode"]
  107846718374032["message_pump.MessagePump"]
  107846717858048 --> 107846722481408
  107846685555472 --> 107846717858048
  137699722799616 --> 107846685555472
  107846718477920 --> 107846717858048
  107846718489888 --> 107846718477920
  107846718374032 --> 107846718489888
  137699722799616 --> 107846718374032

🛈 DocStrings

Bases: Screen[None]

The conversation of a subagent session (read-only).

Source code in src/acptui/ui/screens/session.py
class SubagentScreen(Screen[None]):
    """The conversation of a subagent session (read-only)."""

    BINDINGS: ClassVar = [
        Binding("escape", "close", "Back"),
        Binding("x", "cancel_subagent", "Cancel subagent"),
    ]

    DEFAULT_CSS = """
    SubagentScreen { #subagent-title { height: 1; background: $panel; padding: 0 1; } }
    """

    def __init__(self, parent: SessionScreen, state: SessionState, title: str) -> None:
        super().__init__()
        self.parent_screen = parent
        self.state = state
        self.title_text = title

    def compose(self) -> ComposeResult:
        yield Static(
            Content.assemble(("subagent: ", "$text-muted"), (self.title_text, "bold")),
            id="subagent-title",
        )
        yield ConversationView(
            self.parent_screen.agent_log,
            diff_mode=self.parent_screen.diff_mode,
            expand_thoughts=self.parent_screen.expand_thoughts,
        )
        yield Footer(compact=True)

    @property
    def conversation(self) -> ConversationView:
        """The child's conversation."""
        return self.query_one(ConversationView)

    def on_mount(self) -> None:
        self.conversation.show(self.state)

    def action_close(self) -> None:
        """Back to the parent session."""
        self.dismiss(None)

    def action_cancel_subagent(self) -> None:
        """Cancel the subagent's work (if the parent allows it)."""
        self.parent_screen.cancel_subagent(self.state.session_id)

conversation property

conversation: ConversationView

The child's conversation.

action_cancel_subagent

action_cancel_subagent() -> None

Cancel the subagent's work (if the parent allows it).

Source code in src/acptui/ui/screens/session.py
def action_cancel_subagent(self) -> None:
    """Cancel the subagent's work (if the parent allows it)."""
    self.parent_screen.cancel_subagent(self.state.session_id)

action_close

action_close() -> None

Back to the parent session.

Source code in src/acptui/ui/screens/session.py
def action_close(self) -> None:
    """Back to the parent session."""
    self.dismiss(None)

:fa-brands-github: Show source on GitHub