Content
Category: Acp
Source: content.dart
ACP content block types — the polymorphic shape that carries text, images, audio, file references, and (for tool results) diffs or terminal handles.
Used by:
agent_message_chunk.content— assistant text/thinkingtool_call_update.content[]— tool execution outputsession/prompt.prompt[]— client→agent input blocks
See https://agentclientprotocol.com/ § ContentBlock.
Classes
sealed AcpContentBlock
A single content block — sealed for exhaustive switch handling.
Constructor
const AcpContentBlock()factory AcpContentBlock.fromJson(Map<String, Object?> json)Parse an inbound content block from the wire shape. Returns [AcpUnknownBlock] for shapes we don't yet recognise so unknown types round-trip without losing data.
Properties
| Property | Type | Description |
|---|---|---|
text | String | |
mimeType | String | e.g. image/png, image/jpeg. |
data | String | Base64-encoded image bytes. |
uri | String? | Optional source URL (e.g. the screenshot's page URL). |
Methods
static AcpContentBlock fromContentPart(ContentPart part)
Convert a glue_core [ContentPart] to an ACP block.
const AcpTextBlock(this.text)
const AcpImageBlock({required this.mimeType, required this.data, this.uri})
List<int> decodedBytes()
Decoded image bytes. May be expensive; use sparingly.
AcpTextBlock
Constructor
const AcpTextBlock(this.text)Properties
| Property | Type | Description |
|---|---|---|
text | String |
AcpImageBlock
Constructor
const AcpImageBlock({required this.mimeType, required this.data, this.uri})Properties
| Property | Type | Description |
|---|---|---|
mimeType | String | e.g. image/png, image/jpeg. |
data | String | Base64-encoded image bytes. |
uri | String? | Optional source URL (e.g. the screenshot's page URL). |
mimeType | String | |
data | String | |
uri | String | |
name | String? | |
description | String? | |
mimeType | String? | |
raw | Map<String, Object?> | |
block | AcpContentBlock | |
path | String | |
oldText | String | |
newText | String | |
terminalId | String |
Methods
List<int> decodedBytes()
Decoded image bytes. May be expensive; use sparingly.
const AcpAudioBlock({required this.mimeType, required this.data})
`const AcpResourceLinkBlock({
required this.uri,
this.name,
this.description,
this.mimeType,
})`
const AcpUnknownBlock(this.raw)
const AcpToolCallContent()
const AcpToolCallContentValue(this.block)
`const AcpToolCallDiff({
required this.path,
required this.oldText,
required this.newText,
})`
const AcpToolCallTerminal(this.terminalId)
AcpAudioBlock
Constructor
const AcpAudioBlock({required this.mimeType, required this.data})Properties
| Property | Type | Description |
|---|---|---|
mimeType | String | |
data | String |
AcpResourceLinkBlock
Constructor
const AcpResourceLinkBlock({
required this.uri,
this.name,
this.description,
this.mimeType,
})Properties
| Property | Type | Description |
|---|---|---|
uri | String | |
name | String? | |
description | String? | |
mimeType | String? |
AcpUnknownBlock
Fallback for blocks we don't know about. Preserves the original wire shape so it can be passed through verbatim.
Constructor
const AcpUnknownBlock(this.raw)Properties
| Property | Type | Description |
|---|---|---|
raw | Map<String, Object?> |
sealed AcpToolCallContent
Constructor
const AcpToolCallContent()AcpToolCallContentValue
{type: 'content', content: ContentBlock} — the common case for text/image tool output.
Constructor
const AcpToolCallContentValue(this.block)Properties
| Property | Type | Description |
|---|---|---|
block | AcpContentBlock |
AcpToolCallDiff
{type: 'diff', path, oldText, newText} — for write_file / edit_file.
Constructor
const AcpToolCallDiff({
required this.path,
required this.oldText,
required this.newText,
})Properties
| Property | Type | Description |
|---|---|---|
path | String | |
oldText | String | |
newText | String |
AcpToolCallTerminal
{type: 'terminal', terminalId} — references a live terminal handle the client opened via the terminal/* capability set.
Constructor
const AcpToolCallTerminal(this.terminalId)Properties
| Property | Type | Description |
|---|---|---|
terminalId | String |