ClaudeCode.History.SessionMessage (ClaudeCode v0.36.3)

View Source

A message from a session's conversation history, built via parentUuid chain walking.

Matches the Python SDK's SessionMessage type. Contains chain metadata (uuid, session_id) alongside the parsed message content.

The :message field contains parsed content — for assistant messages this includes TextBlock, ToolUseBlock, etc. structs; for user messages it contains either a string or a list of content blocks.

Fields

  • :type - Message type: :user or :assistant
  • :uuid - UUID of this entry in the conversation chain
  • :session_id - Session UUID this message belongs to
  • :message - Parsed message content (see ClaudeCode.Message.AssistantMessage and ClaudeCode.Message.UserMessage for content structure)
  • :parent_tool_use_id - Tool use ID that triggered this message, if any

Summary

Functions

Creates a SessionMessage from a raw JSONL transcript entry.

Types

parsed_message()

t()

@type t() :: %ClaudeCode.History.SessionMessage{
  message: parsed_message(),
  parent_tool_use_id: String.t() | nil,
  session_id: String.t(),
  type: :user | :assistant,
  uuid: String.t()
}

Functions

from_entry(entry)

@spec from_entry(map()) :: t()

Creates a SessionMessage from a raw JSONL transcript entry.

Parses the inner message content into SDK structs (content blocks, usage, etc.) when possible. Falls back to the raw message map if parsing fails.