Skip to content

terminals

Class info

Classes

Name Children Inherits
CancelTerminalRequest
aclientp.schema.v2.terminals
Parameters of ``terminal/cancel``: cancel one terminal.
    CancelTerminalResponse
    aclientp.schema.v2.terminals
    Response from cancelling a terminal.
      TerminalCancelCapabilities
      aclientp.schema.v2.terminals
      Capability to cancel a terminal with ``terminal/cancel``.
        TerminalCapabilities
        aclientp.schema.v2.terminals
        Client-initiated controls a terminal currently supports.
          TerminalExitStatus
          aclientp.schema.v2.terminals
          Exit information for an agent-owned terminal.
            TerminalOutput
            aclientp.schema.v2.terminals
            An authoritative replacement snapshot of terminal output bytes.
              TerminalOutputChunk
              aclientp.schema.v2.terminals
              A chunk of bytes appended to an agent-owned terminal's output.
                TerminalSize
                aclientp.schema.v2.terminals
                The size of an agent-owned terminal in character cells.
                  TerminalUpdate
                  aclientp.schema.v2.terminals
                  An upsert of an agent-owned terminal's state, keyed by ``terminal_id``.

                    🛈 DocStrings

                    v2 agent-owned, display-only terminals.

                    Agents run commands themselves; terminals only display them. Tool calls reference a terminal by terminalId (Terminal content); terminal_update upserts carry command, cwd, replay snapshots and exit status, and terminal_output_chunk appends independently base64-encoded bytes. Clients cannot execute or control processes, except cancelling terminals that allow it.

                    CancelTerminalRequest

                    Bases: AnnotatedObject

                    Parameters of terminal/cancel: cancel one terminal.

                    Only for terminals that currently advertise capabilities.cancel.

                    Source code in src/aclientp/schema/v2/terminals.py
                    class CancelTerminalRequest(AnnotatedObject):
                        """Parameters of ``terminal/cancel``: cancel one terminal.
                    
                        Only for terminals that currently advertise ``capabilities.cancel``.
                        """
                    
                        session_id: SessionId
                        """The ID of the session that owns the terminal."""
                    
                        terminal_id: TerminalId
                        """The ID of the terminal to cancel."""
                    

                    session_id instance-attribute

                    session_id: SessionId
                    

                    The ID of the session that owns the terminal.

                    terminal_id instance-attribute

                    terminal_id: TerminalId
                    

                    The ID of the terminal to cancel.

                    CancelTerminalResponse

                    Bases: AnnotatedObject

                    Response from cancelling a terminal.

                    Source code in src/aclientp/schema/v2/terminals.py
                    class CancelTerminalResponse(AnnotatedObject):
                        """Response from cancelling a terminal."""
                    

                    TerminalCancelCapabilities

                    Bases: AnnotatedObject

                    Capability to cancel a terminal with terminal/cancel.

                    Source code in src/aclientp/schema/v2/terminals.py
                    class TerminalCancelCapabilities(AnnotatedObject):
                        """Capability to cancel a terminal with ``terminal/cancel``."""
                    

                    TerminalCapabilities

                    Bases: AnnotatedObject

                    Client-initiated controls a terminal currently supports.

                    Source code in src/aclientp/schema/v2/terminals.py
                    class TerminalCapabilities(AnnotatedObject):
                        """Client-initiated controls a terminal currently supports."""
                    
                        cancel: TerminalCancelCapabilities | MISSING | None = MISSING
                        """Permits the Client to cancel this terminal with ``terminal/cancel``."""
                    

                    cancel class-attribute instance-attribute

                    cancel: TerminalCancelCapabilities | MISSING | None = MISSING
                    

                    Permits the Client to cancel this terminal with terminal/cancel.

                    TerminalExitStatus

                    Bases: AnnotatedObject

                    Exit information for an agent-owned terminal.

                    Its presence marks the terminal as exited, even when neither code nor signal is known.

                    Source code in src/aclientp/schema/v2/terminals.py
                    class TerminalExitStatus(AnnotatedObject):
                        """Exit information for an agent-owned terminal.
                    
                        Its presence marks the terminal as exited, even when neither code nor signal is known.
                        """
                    
                        exit_code: int | MISSING | None = MISSING
                        """Process exit code as the platform reports it; negative values are allowed."""
                    
                        signal: str | MISSING | None = MISSING
                        """Signal that terminated the process, when known."""
                    

                    exit_code class-attribute instance-attribute

                    exit_code: int | MISSING | None = MISSING
                    

                    Process exit code as the platform reports it; negative values are allowed.

                    signal class-attribute instance-attribute

                    signal: str | MISSING | None = MISSING
                    

                    Signal that terminated the process, when known.

                    TerminalOutput

                    Bases: AnnotatedObject

                    An authoritative replacement snapshot of terminal output bytes.

                    Source code in src/aclientp/schema/v2/terminals.py
                    class TerminalOutput(AnnotatedObject):
                        """An authoritative replacement snapshot of terminal output bytes."""
                    
                        data: str
                        """Base64-encoded replacement terminal output bytes."""
                    
                        @classmethod
                        def from_bytes(cls, data: bytes) -> Self:
                            """Create a snapshot from raw output bytes."""
                            return cls(data=base64.b64encode(data).decode("ascii"))
                    
                        def decode(self) -> bytes:
                            """The raw output bytes."""
                            return base64.b64decode(self.data)
                    

                    data instance-attribute

                    data: str
                    

                    Base64-encoded replacement terminal output bytes.

                    decode

                    decode() -> bytes
                    

                    The raw output bytes.

                    Source code in src/aclientp/schema/v2/terminals.py
                    def decode(self) -> bytes:
                        """The raw output bytes."""
                        return base64.b64decode(self.data)
                    

                    from_bytes classmethod

                    from_bytes(data: bytes) -> Self
                    

                    Create a snapshot from raw output bytes.

                    Source code in src/aclientp/schema/v2/terminals.py
                    @classmethod
                    def from_bytes(cls, data: bytes) -> Self:
                        """Create a snapshot from raw output bytes."""
                        return cls(data=base64.b64encode(data).decode("ascii"))
                    

                    TerminalOutputChunk

                    Bases: AnnotatedObject

                    A chunk of bytes appended to an agent-owned terminal's output.

                    Source code in src/aclientp/schema/v2/terminals.py
                    class TerminalOutputChunk(AnnotatedObject):
                        """A chunk of bytes appended to an agent-owned terminal's output."""
                    
                        session_update: Literal["terminal_output_chunk"] = Field(
                            default="terminal_output_chunk", init=False
                        )
                    
                        terminal_id: TerminalId
                        """The terminal receiving these bytes."""
                    
                        data: str
                        """Independently base64-encoded terminal output bytes."""
                    
                        @classmethod
                        def from_bytes(cls, terminal_id: TerminalId, data: bytes) -> Self:
                            """Create a chunk from raw output bytes."""
                            return cls(terminal_id=terminal_id, data=base64.b64encode(data).decode("ascii"))
                    
                        def decode(self) -> bytes:
                            """The raw output bytes."""
                            return base64.b64decode(self.data)
                    

                    data instance-attribute

                    data: str
                    

                    Independently base64-encoded terminal output bytes.

                    terminal_id instance-attribute

                    terminal_id: TerminalId
                    

                    The terminal receiving these bytes.

                    decode

                    decode() -> bytes
                    

                    The raw output bytes.

                    Source code in src/aclientp/schema/v2/terminals.py
                    def decode(self) -> bytes:
                        """The raw output bytes."""
                        return base64.b64decode(self.data)
                    

                    from_bytes classmethod

                    from_bytes(terminal_id: TerminalId, data: bytes) -> Self
                    

                    Create a chunk from raw output bytes.

                    Source code in src/aclientp/schema/v2/terminals.py
                    @classmethod
                    def from_bytes(cls, terminal_id: TerminalId, data: bytes) -> Self:
                        """Create a chunk from raw output bytes."""
                        return cls(terminal_id=terminal_id, data=base64.b64encode(data).decode("ascii"))
                    

                    TerminalSize

                    Bases: AnnotatedObject

                    The size of an agent-owned terminal in character cells.

                    Source code in src/aclientp/schema/v2/terminals.py
                    class TerminalSize(AnnotatedObject):
                        """The size of an agent-owned terminal in character cells."""
                    
                        cols: int = Field(ge=1, le=65535)
                        """Number of columns."""
                    
                        rows: int = Field(ge=1, le=65535)
                        """Number of rows."""
                    

                    cols class-attribute instance-attribute

                    cols: int = Field(ge=1, le=65535)
                    

                    Number of columns.

                    rows class-attribute instance-attribute

                    rows: int = Field(ge=1, le=65535)
                    

                    Number of rows.

                    TerminalUpdate

                    Bases: AnnotatedObject

                    An upsert of an agent-owned terminal's state, keyed by terminal_id.

                    Other fields are patches: omitted leaves the stored value unchanged, None clears it.

                    Source code in src/aclientp/schema/v2/terminals.py
                    class TerminalUpdate(AnnotatedObject):
                        """An upsert of an agent-owned terminal's state, keyed by ``terminal_id``.
                    
                        Other fields are patches: omitted leaves the stored value unchanged, ``None``
                        clears it.
                        """
                    
                        session_update: Literal["terminal_update"] = Field(default="terminal_update", init=False)
                    
                        terminal_id: TerminalId
                        """Unique identifier for this terminal within the session."""
                    
                        command: str | MISSING | None = MISSING
                        """The command being run."""
                    
                        cwd: AbsolutePath | MISSING | None = MISSING
                        """The absolute working directory of the command."""
                    
                        output: TerminalOutput | MISSING | None = MISSING
                        """An authoritative replacement snapshot of terminal output bytes."""
                    
                        exit_status: TerminalExitStatus | MISSING | None = MISSING
                        """Exit information. A concrete object marks the terminal as exited."""
                    
                        size: TerminalSize | MISSING | None = MISSING
                        """The terminal size the command runs with, when known."""
                    
                        capabilities: TerminalCapabilities | MISSING | None = MISSING
                        """Client-initiated controls this terminal currently supports, such as cancellation."""
                    

                    capabilities class-attribute instance-attribute

                    capabilities: TerminalCapabilities | MISSING | None = MISSING
                    

                    Client-initiated controls this terminal currently supports, such as cancellation.

                    command class-attribute instance-attribute

                    command: str | MISSING | None = MISSING
                    

                    The command being run.

                    cwd class-attribute instance-attribute

                    cwd: AbsolutePath | MISSING | None = MISSING
                    

                    The absolute working directory of the command.

                    exit_status class-attribute instance-attribute

                    exit_status: TerminalExitStatus | MISSING | None = MISSING
                    

                    Exit information. A concrete object marks the terminal as exited.

                    output class-attribute instance-attribute

                    output: TerminalOutput | MISSING | None = MISSING
                    

                    An authoritative replacement snapshot of terminal output bytes.

                    size class-attribute instance-attribute

                    size: TerminalSize | MISSING | None = MISSING
                    

                    The terminal size the command runs with, when known.

                    terminal_id instance-attribute

                    terminal_id: TerminalId
                    

                    Unique identifier for this terminal within the session.