Skip to main content

par_term_acp/protocol/
content.rs

1//! Content block types for ACP prompts and responses.
2
3use serde::{Deserialize, Serialize};
4
5/// A typed content block used in prompts and responses.
6#[derive(Debug, Clone, Serialize, Deserialize)]
7#[serde(tag = "type", rename_all = "snake_case")]
8pub enum ContentBlock {
9    /// Plain text content.
10    Text { text: String },
11    /// An embedded resource (file content, blob, etc.).
12    Resource { resource: ResourceContent },
13}
14
15/// The payload of a `Resource` content block.
16#[derive(Debug, Clone, Serialize, Deserialize)]
17#[serde(rename_all = "camelCase")]
18pub struct ResourceContent {
19    pub uri: String,
20    #[serde(skip_serializing_if = "Option::is_none")]
21    pub text: Option<String>,
22    #[serde(skip_serializing_if = "Option::is_none")]
23    pub blob: Option<String>,
24    #[serde(skip_serializing_if = "Option::is_none")]
25    pub mime_type: Option<String>,
26}