Skip to content

ClaudeUserEntry

Base classes

Name Children Inherits
ClaudeMessageEntryBase
clawd_code_sdk.storage.models
Base for user/assistant message entries with message payload.

⋔ Inheritance diagram

graph TD
  3591294908["models.ClaudeUserEntry"]
  3921133358["models.ClaudeMessageEntryBase"]
  3306911705["models.ClaudeEntryBase"]
  746985124["models.ClaudeStorageModel"]
  2604142835["base.ClaudeCodeBaseModel"]
  3879467795["main.BaseModel"]
  2751680898["builtins.object"]
  3921133358 --> 3591294908
  3306911705 --> 3921133358
  746985124 --> 3306911705
  2604142835 --> 746985124
  3879467795 --> 2604142835
  2751680898 --> 3879467795

🛈 DocStrings

Bases: ClaudeMessageEntryBase

User message entry.

Source code in src/clawd_code_sdk/storage/models.py
class ClaudeUserEntry(ClaudeMessageEntryBase):
    """User message entry."""

    type: Literal["user"]
    message: ClaudeUserMessage
    tool_use_result: (
        list[ToolUseResult | dict[str, Any]] | ToolUseResult | dict[str, Any] | str | None
    ) = None
    source_tool_assistant_uuid: str | None = Field(default=None, alias="sourceToolAssistantUUID")
    """For tool results: uuid of the assistant entry holding the ``tool_use`` this answers."""
    source_tool_use_id: str | None = Field(default=None, alias="sourceToolUseID")
    """ID of the tool use that produced this message (e.g. skill or command expansions)."""
    permission_mode: str | None = None
    """Permission mode active when the prompt was sent."""
    permission_decision: dict[str, Any] | None = None
    """How the tool call this result answers was permitted (decision, source, reason)."""
    tool_denial_kind: str | None = None
    """Why the tool call was denied (``user-rejected``, ``permission-rule``, ...)."""
    sandboxed: bool | None = None
    """Whether the tool call ran in the sandbox."""
    prompt_source: str | None = None
    """Where the prompt came from (``typed``, ``sdk``, ``queued``, ``system``)."""
    turn_origin: str | None = None
    """What started the turn (``human``, ``sdk``, ``task_notification``, ``peer``, ...)."""
    origin: dict[str, Any] | None = None
    """Origin of the message, keyed by ``kind``."""
    turn_position: dict[str, int] | None = None
    """``turnIndex`` / ``promptIndex`` of the prompt within the session."""
    interrupted_message_id: str | None = None
    is_visible_in_transcript_only: bool | None = None
    is_virtual: bool | None = None
    image_paste_ids: list[int] | None = None
    mcp_meta: dict[str, Any] | None = None
    """``_meta`` / ``structuredContent`` of an MCP tool result."""

    @property
    def is_tool_result(self) -> bool:
        """Whether this is a synthetic tool_result entry (vs. an actual user prompt)."""
        if isinstance(self.message.content, str):
            return False
        return all(b.type == "tool_result" for b in self.message.content)

is_tool_result property

is_tool_result: bool

Whether this is a synthetic tool_result entry (vs. an actual user prompt).

mcp_meta class-attribute instance-attribute

mcp_meta: dict[str, Any] | None = None

_meta / structuredContent of an MCP tool result.

origin class-attribute instance-attribute

origin: dict[str, Any] | None = None

Origin of the message, keyed by kind.

permission_decision class-attribute instance-attribute

permission_decision: dict[str, Any] | None = None

How the tool call this result answers was permitted (decision, source, reason).

permission_mode class-attribute instance-attribute

permission_mode: str | None = None

Permission mode active when the prompt was sent.

prompt_source class-attribute instance-attribute

prompt_source: str | None = None

Where the prompt came from (typed, sdk, queued, system).

sandboxed class-attribute instance-attribute

sandboxed: bool | None = None

Whether the tool call ran in the sandbox.

source_tool_assistant_uuid class-attribute instance-attribute

source_tool_assistant_uuid: str | None = Field(default=None, alias='sourceToolAssistantUUID')

For tool results: uuid of the assistant entry holding the tool_use this answers.

source_tool_use_id class-attribute instance-attribute

source_tool_use_id: str | None = Field(default=None, alias='sourceToolUseID')

ID of the tool use that produced this message (e.g. skill or command expansions).

tool_denial_kind class-attribute instance-attribute

tool_denial_kind: str | None = None

Why the tool call was denied (user-rejected, permission-rule, ...).

turn_origin class-attribute instance-attribute

turn_origin: str | None = None

What started the turn (human, sdk, task_notification, peer, ...).

turn_position class-attribute instance-attribute

turn_position: dict[str, int] | None = None

turnIndex / promptIndex of the prompt within the session.

:fa-brands-github: Show source on GitHub