Skip to content

permissions

Class info

Classes

Name Children Inherits
CancelledPermissionOutcome
aclientp.schema.v2.permissions
No option was selected, e.g. because the session's work was cancelled.
    CommandPermissionSubject
    aclientp.schema.v2.permissions
    Permission is requested before running a command.
      PermissionOption
      aclientp.schema.v2.permissions
      An option offered to the user.
        RequestPermissionRequest
        aclientp.schema.v2.permissions
        Parameters of ``session/request_permission``.
          RequestPermissionResponse
          aclientp.schema.v2.permissions
          Response to ``session/request_permission``.
            SelectedPermissionOutcome
            aclientp.schema.v2.permissions
            The user selected one of the offered options.
              ToolCallPermissionSubject
              aclientp.schema.v2.permissions
              Permission is requested before executing a tool call.
                UnknownPermissionOutcome
                aclientp.schema.v2.permissions
                A custom or future outcome; values starting with ``_`` are extensions.
                  UnknownPermissionSubject
                  aclientp.schema.v2.permissions
                  A custom or future subject; ``type`` values starting with ``_`` are extensions.

                    🛈 DocStrings

                    v2 session/request_permission: asking the user before a sensitive operation.

                    v2 permission requests carry a required title and an optional subject: a tool call (with the same payload as a tool_call_update) or a command.

                    PermissionOptionKind module-attribute

                    PermissionOptionKind = Literal['allow_once', 'allow_always', 'reject_once', 'reject_always'] | str
                    

                    Nature of a permission option, for icons and UI. Values starting with _ are extensions.

                    RequestPermissionOutcome module-attribute

                    RequestPermissionOutcome = Annotated[
                        Annotated[CancelledPermissionOutcome, Tag("cancelled")]
                        | Annotated[SelectedPermissionOutcome, Tag("selected")]
                        | Annotated[UnknownPermissionOutcome, Tag(OTHER_TAG)],
                        Discriminator(open_discriminator("outcome", frozenset({"cancelled", "selected"}))),
                    ]
                    

                    The user's decision on a permission request.

                    RequestPermissionSubject module-attribute

                    RequestPermissionSubject = Annotated[
                        Annotated[ToolCallPermissionSubject, Tag("tool_call")]
                        | Annotated[CommandPermissionSubject, Tag("command")]
                        | Annotated[UnknownPermissionSubject, Tag(OTHER_TAG)],
                        Discriminator(open_discriminator("type", frozenset({"tool_call", "command"}))),
                    ]
                    

                    The operation that requires permission.

                    CancelledPermissionOutcome

                    Bases: AnnotatedObject

                    No option was selected, e.g. because the session's work was cancelled.

                    Source code in src/aclientp/schema/v2/permissions.py
                    class CancelledPermissionOutcome(AnnotatedObject):
                        """No option was selected, e.g. because the session's work was cancelled."""
                    
                        outcome: Literal["cancelled"] = Field(default="cancelled", init=False)
                    

                    CommandPermissionSubject

                    Bases: AnnotatedObject

                    Permission is requested before running a command.

                    Source code in src/aclientp/schema/v2/permissions.py
                    class CommandPermissionSubject(AnnotatedObject):
                        """Permission is requested before running a command."""
                    
                        type: Literal["command"] = Field(default="command", init=False)
                    
                        command: str
                        """The command that runs if permission is granted."""
                    
                        cwd: AbsolutePath
                        """Absolute working directory of the command."""
                    
                        tool_call_id: ToolCallId | MISSING | None = MISSING
                        """The associated tool call, when known."""
                    
                        terminal_id: TerminalId | MISSING | None = MISSING
                        """The associated terminal, when already known."""
                    

                    command instance-attribute

                    command: str
                    

                    The command that runs if permission is granted.

                    cwd instance-attribute

                    Absolute working directory of the command.

                    terminal_id class-attribute instance-attribute

                    terminal_id: TerminalId | MISSING | None = MISSING
                    

                    The associated terminal, when already known.

                    tool_call_id class-attribute instance-attribute

                    tool_call_id: ToolCallId | MISSING | None = MISSING
                    

                    The associated tool call, when known.

                    PermissionOption

                    Bases: AnnotatedObject

                    An option offered to the user.

                    Source code in src/aclientp/schema/v2/permissions.py
                    class PermissionOption(AnnotatedObject):
                        """An option offered to the user."""
                    
                        option_id: PermissionOptionId
                        """Identifier of the option; unique within the request."""
                    
                        name: str
                        """Label shown to the user."""
                    
                        kind: PermissionOptionKind
                        """Hint about the nature of the option."""
                    

                    kind instance-attribute

                    Hint about the nature of the option.

                    name instance-attribute

                    name: str
                    

                    Label shown to the user.

                    option_id instance-attribute

                    option_id: PermissionOptionId
                    

                    Identifier of the option; unique within the request.

                    RequestPermissionRequest

                    Bases: AnnotatedObject

                    Parameters of session/request_permission.

                    Source code in src/aclientp/schema/v2/permissions.py
                    class RequestPermissionRequest(AnnotatedObject):
                        """Parameters of ``session/request_permission``."""
                    
                        session_id: SessionId
                        """The session asking."""
                    
                        title: str
                        """Title of the permission prompt (not the title of a tool call)."""
                    
                        description: str | MISSING | None = MISSING
                        """Why permission is needed."""
                    
                        subject: RequestPermissionSubject | MISSING | None = MISSING
                        """Structured context about the operation."""
                    
                        options: Sequence[PermissionOption] = Field(min_length=1)
                        """The options the user can choose from; at least one."""
                    

                    description class-attribute instance-attribute

                    description: str | MISSING | None = MISSING
                    

                    Why permission is needed.

                    options class-attribute instance-attribute

                    options: Sequence[PermissionOption] = Field(min_length=1)
                    

                    The options the user can choose from; at least one.

                    session_id instance-attribute

                    session_id: SessionId
                    

                    The session asking.

                    subject class-attribute instance-attribute

                    subject: RequestPermissionSubject | MISSING | None = MISSING
                    

                    Structured context about the operation.

                    title instance-attribute

                    title: str
                    

                    Title of the permission prompt (not the title of a tool call).

                    RequestPermissionResponse

                    Bases: AnnotatedObject

                    Response to session/request_permission.

                    Source code in src/aclientp/schema/v2/permissions.py
                    class RequestPermissionResponse(AnnotatedObject):
                        """Response to ``session/request_permission``."""
                    
                        outcome: RequestPermissionOutcome
                        """The user's decision."""
                    

                    outcome instance-attribute

                    The user's decision.

                    SelectedPermissionOutcome

                    Bases: AnnotatedObject

                    The user selected one of the offered options.

                    An option_id that matches no offered option counts as rejection.

                    Source code in src/aclientp/schema/v2/permissions.py
                    class SelectedPermissionOutcome(AnnotatedObject):
                        """The user selected one of the offered options.
                    
                        An ``option_id`` that matches no offered option counts as rejection.
                        """
                    
                        outcome: Literal["selected"] = Field(default="selected", init=False)
                    
                        option_id: PermissionOptionId
                        """The selected option."""
                    

                    option_id instance-attribute

                    option_id: PermissionOptionId
                    

                    The selected option.

                    ToolCallPermissionSubject

                    Bases: AnnotatedObject

                    Permission is requested before executing a tool call.

                    Source code in src/aclientp/schema/v2/permissions.py
                    class ToolCallPermissionSubject(AnnotatedObject):
                        """Permission is requested before executing a tool call."""
                    
                        type: Literal["tool_call"] = Field(default="tool_call", init=False)
                    
                        tool_call: ToolCallUpdate
                        """The tool call; clients apply it to their stored tool call like a ``tool_call_update``."""
                    

                    tool_call instance-attribute

                    tool_call: ToolCallUpdate
                    

                    The tool call; clients apply it to their stored tool call like a tool_call_update.

                    UnknownPermissionOutcome

                    Bases: Unknown

                    A custom or future outcome; values starting with _ are extensions.

                    Source code in src/aclientp/schema/v2/permissions.py
                    class UnknownPermissionOutcome(Unknown):
                        """A custom or future outcome; values starting with ``_`` are extensions."""
                    
                        outcome: str
                        """The outcome kind."""
                    

                    outcome instance-attribute

                    outcome: str
                    

                    The outcome kind.

                    UnknownPermissionSubject

                    Bases: Unknown

                    A custom or future subject; type values starting with _ are extensions.

                    Source code in src/aclientp/schema/v2/permissions.py
                    class UnknownPermissionSubject(Unknown):
                        """A custom or future subject; ``type`` values starting with ``_`` are extensions."""
                    
                        type: str
                        """The subject kind."""
                    

                    type instance-attribute

                    type: str
                    

                    The subject kind.