#[non_exhaustive]pub enum ContentBlock {
Text {
text: String,
},
CompactionSummary {
text: String,
artifact_ids: Vec<u64>,
snapcompact: Option<SnapcompactMetadata>,
},
Thinking {
thinking: String,
signature: Option<String>,
},
RedactedThinking {
data: String,
},
OpaqueReasoning {
provider: String,
data: Value,
},
ToolUse {
id: String,
name: String,
input: Value,
thought_signature: Option<String>,
},
ToolResult {
tool_use_id: String,
content: String,
artifact: Option<ToolResultArtifact>,
is_error: Option<bool>,
},
Image {
source: ContentSource,
},
Document {
source: ContentSource,
},
}Expand description
A provider-compatible content block.
CompactionSummary uses a backward-compatible wire encoding:
{"type":"text","text":"...","sdk_provenance":"compaction_summary"}.
Previous decoders ignore the extra field and see ordinary text. Current
decoders recover structural identity; durable projections still authorize
that identity only at an authoritative compaction replacement boundary.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Text
CompactionSummary
Fields
artifact_ids: Vec<u64>Durable spill artifacts referenced by the summarized prefix.
Empty for summaries serialized before artifact retention metadata was introduced.
snapcompact: Option<SnapcompactMetadata>Exact-source checkpoint metadata for Snapcompact summaries.
Thinking
Fields
RedactedThinking
OpaqueReasoning
Provider-owned reasoning state that must be replayed exactly on a later request, but must never be interpreted or surfaced by the SDK.
provider names the wire protocol that owns data; providers must
ignore blocks owned by a different protocol. The JSON payload is kept
opaque so a provider can evolve its state-item shape without requiring
another SDK wire-format change.
ToolUse
Fields
ToolResult
Fields
artifact: Option<ToolResultArtifact>Structured spill provenance. Never infer this from content.
Image
Fields
source: ContentSourceDocument
Fields
source: ContentSourceTrait Implementations§
Source§impl Clone for ContentBlock
impl Clone for ContentBlock
Source§fn clone(&self) -> ContentBlock
fn clone(&self) -> ContentBlock
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more