ClaudeCode.Message.SystemMessage.FilesPersisted (ClaudeCode v0.36.3)

View Source

Represents a files persisted event from the Claude CLI.

Emitted when files have been persisted during a session, containing metadata about each file that was saved.

Fields

  • :files - List of maps with :filename and :file_id keys
  • :failed - List of maps with :filename and :error keys for files that failed to persist
  • :processed_at - ISO 8601 timestamp when files were processed
  • :uuid - Message UUID
  • :session_id - Session identifier

JSON Format

{
  "type": "system",
  "subtype": "files_persisted",
  "files": [
    {"filename": "example.ex", "file_id": "file-abc123"}
  ],
  "uuid": "...",
  "session_id": "..."
}

Summary

Functions

Type guard to check if a value is a FilesPersisted.

Creates a new FilesPersisted from JSON data.

Types

failed_entry()

@type failed_entry() :: %{filename: String.t(), error: String.t()}

file_entry()

@type file_entry() :: %{filename: String.t(), file_id: String.t()}

t()

@type t() :: %ClaudeCode.Message.SystemMessage.FilesPersisted{
  failed: [failed_entry()],
  files: [file_entry()],
  processed_at: String.t() | nil,
  session_id: String.t(),
  subtype: :files_persisted,
  type: :system,
  uuid: String.t() | nil
}

Functions

files_persisted?(arg1)

@spec files_persisted?(any()) :: boolean()

Type guard to check if a value is a FilesPersisted.

new(json)

@spec new(map()) :: {:ok, t()} | {:error, atom()}

Creates a new FilesPersisted from JSON data.

Examples

iex> FilesPersisted.new(%{
...>   "type" => "system",
...>   "subtype" => "files_persisted",
...>   "files" => [%{"filename" => "test.ex", "file_id" => "file-1"}],
...>   "session_id" => "session-1"
...> })
{:ok, %FilesPersisted{type: :system, subtype: :files_persisted, ...}}

iex> FilesPersisted.new(%{"type" => "assistant"})
{:error, :invalid_message_type}