pub enum ThreadItem {
Show 18 variants
UserMessage {
client_id: Option<String>,
content: Vec<UserInput>,
id: String,
},
HookPrompt {
fragments: Vec<HookPromptFragment>,
id: String,
},
AgentMessage {
id: String,
memory_citation: Option<MemoryCitation>,
phase: Option<MessagePhase>,
text: String,
},
Plan {
id: String,
text: String,
},
Reasoning {
content: Vec<String>,
id: String,
summary: Vec<String>,
},
CommandExecution {
aggregated_output: Option<String>,
command: String,
command_actions: Vec<CommandAction>,
cwd: LegacyAppPathString,
duration_ms: Option<i64>,
exit_code: Option<i32>,
id: String,
process_id: Option<String>,
source: CommandExecutionSource,
status: CommandExecutionStatus,
},
FileChange {
changes: Vec<FileUpdateChange>,
id: String,
status: PatchApplyStatus,
},
McpToolCall {
app_context: Option<McpToolCallAppContext>,
arguments: Value,
duration_ms: Option<i64>,
error: Option<McpToolCallError>,
id: String,
mcp_app_resource_uri: Option<String>,
plugin_id: Option<String>,
result: Option<McpToolCallResult>,
server: String,
status: McpToolCallStatus,
tool: String,
},
DynamicToolCall {
arguments: Value,
content_items: Option<Vec<DynamicToolCallOutputContentItem>>,
duration_ms: Option<i64>,
id: String,
namespace: Option<String>,
status: DynamicToolCallStatus,
success: Option<bool>,
tool: String,
},
CollabAgentToolCall {
agents_states: HashMap<String, CollabAgentState>,
id: String,
model: Option<String>,
prompt: Option<String>,
reasoning_effort: Option<ReasoningEffort>,
receiver_thread_ids: Vec<String>,
sender_thread_id: String,
status: CollabAgentToolCallStatus,
tool: CollabAgentTool,
},
SubAgentActivity {
agent_path: String,
agent_thread_id: String,
id: String,
kind: SubAgentActivityKind,
},
WebSearch {
action: Option<WebSearchAction>,
id: String,
query: String,
},
ImageView {
id: String,
path: LegacyAppPathString,
},
Sleep {
duration_ms: u64,
id: String,
},
ImageGeneration {
id: String,
result: String,
revised_prompt: Option<String>,
saved_path: Option<AbsolutePathBuf>,
status: String,
},
EnteredReviewMode {
id: String,
review: String,
},
ExitedReviewMode {
id: String,
review: String,
},
ContextCompaction {
id: String,
},
}Expand description
ThreadItem
JSON schema
{
"oneOf": [
{
"title": "UserMessageThreadItem",
"type": "object",
"required": [
"content",
"id",
"type"
],
"properties": {
"clientId": {
"type": [
"string",
"null"
]
},
"content": {
"type": "array",
"items": {
"$ref": "#/definitions/UserInput"
}
},
"id": {
"type": "string"
},
"type": {
"title": "UserMessageThreadItemType",
"type": "string",
"enum": [
"userMessage"
]
}
}
},
{
"title": "HookPromptThreadItem",
"type": "object",
"required": [
"fragments",
"id",
"type"
],
"properties": {
"fragments": {
"type": "array",
"items": {
"$ref": "#/definitions/HookPromptFragment"
}
},
"id": {
"type": "string"
},
"type": {
"title": "HookPromptThreadItemType",
"type": "string",
"enum": [
"hookPrompt"
]
}
}
},
{
"title": "AgentMessageThreadItem",
"type": "object",
"required": [
"id",
"text",
"type"
],
"properties": {
"id": {
"type": "string"
},
"memoryCitation": {
"default": null,
"anyOf": [
{
"$ref": "#/definitions/MemoryCitation"
},
{
"type": "null"
}
]
},
"phase": {
"default": null,
"anyOf": [
{
"$ref": "#/definitions/MessagePhase"
},
{
"type": "null"
}
]
},
"text": {
"type": "string"
},
"type": {
"title": "AgentMessageThreadItemType",
"type": "string",
"enum": [
"agentMessage"
]
}
}
},
{
"title": "PlanThreadItem",
"description": "EXPERIMENTAL - proposed plan item content. The completed plan item is authoritative and may not match the concatenation of `PlanDelta` text.",
"type": "object",
"required": [
"id",
"text",
"type"
],
"properties": {
"id": {
"type": "string"
},
"text": {
"type": "string"
},
"type": {
"title": "PlanThreadItemType",
"type": "string",
"enum": [
"plan"
]
}
}
},
{
"title": "ReasoningThreadItem",
"type": "object",
"required": [
"id",
"type"
],
"properties": {
"content": {
"default": [],
"type": "array",
"items": {
"type": "string"
}
},
"id": {
"type": "string"
},
"summary": {
"default": [],
"type": "array",
"items": {
"type": "string"
}
},
"type": {
"title": "ReasoningThreadItemType",
"type": "string",
"enum": [
"reasoning"
]
}
}
},
{
"title": "CommandExecutionThreadItem",
"type": "object",
"required": [
"command",
"commandActions",
"cwd",
"id",
"status",
"type"
],
"properties": {
"aggregatedOutput": {
"description": "The command's output, aggregated from stdout and stderr.",
"type": [
"string",
"null"
]
},
"command": {
"description": "The command to be executed.",
"type": "string"
},
"commandActions": {
"description": "A best-effort parsing of the command to understand the action(s) it will perform. This returns a list of CommandAction objects because a single shell command may be composed of many commands piped together.",
"type": "array",
"items": {
"$ref": "#/definitions/CommandAction"
}
},
"cwd": {
"description": "The command's working directory.",
"allOf": [
{
"$ref": "#/definitions/LegacyAppPathString"
}
]
},
"durationMs": {
"description": "The duration of the command execution in milliseconds.",
"type": [
"integer",
"null"
],
"format": "int64"
},
"exitCode": {
"description": "The command's exit code.",
"type": [
"integer",
"null"
],
"format": "int32"
},
"id": {
"type": "string"
},
"processId": {
"description": "Identifier for the underlying PTY process (when available).",
"type": [
"string",
"null"
]
},
"source": {
"default": "agent",
"allOf": [
{
"$ref": "#/definitions/CommandExecutionSource"
}
]
},
"status": {
"$ref": "#/definitions/CommandExecutionStatus"
},
"type": {
"title": "CommandExecutionThreadItemType",
"type": "string",
"enum": [
"commandExecution"
]
}
}
},
{
"title": "FileChangeThreadItem",
"type": "object",
"required": [
"changes",
"id",
"status",
"type"
],
"properties": {
"changes": {
"type": "array",
"items": {
"$ref": "#/definitions/FileUpdateChange"
}
},
"id": {
"type": "string"
},
"status": {
"$ref": "#/definitions/PatchApplyStatus"
},
"type": {
"title": "FileChangeThreadItemType",
"type": "string",
"enum": [
"fileChange"
]
}
}
},
{
"title": "McpToolCallThreadItem",
"type": "object",
"required": [
"arguments",
"id",
"server",
"status",
"tool",
"type"
],
"properties": {
"appContext": {
"anyOf": [
{
"$ref": "#/definitions/McpToolCallAppContext"
},
{
"type": "null"
}
]
},
"arguments": true,
"durationMs": {
"description": "The duration of the MCP tool call in milliseconds.",
"type": [
"integer",
"null"
],
"format": "int64"
},
"error": {
"anyOf": [
{
"$ref": "#/definitions/McpToolCallError"
},
{
"type": "null"
}
]
},
"id": {
"type": "string"
},
"mcpAppResourceUri": {
"description": "Deprecated: use `appContext.resourceUri` instead.",
"type": [
"string",
"null"
]
},
"pluginId": {
"type": [
"string",
"null"
]
},
"result": {
"anyOf": [
{
"$ref": "#/definitions/McpToolCallResult"
},
{
"type": "null"
}
]
},
"server": {
"type": "string"
},
"status": {
"$ref": "#/definitions/McpToolCallStatus"
},
"tool": {
"type": "string"
},
"type": {
"title": "McpToolCallThreadItemType",
"type": "string",
"enum": [
"mcpToolCall"
]
}
}
},
{
"title": "DynamicToolCallThreadItem",
"type": "object",
"required": [
"arguments",
"id",
"status",
"tool",
"type"
],
"properties": {
"arguments": true,
"contentItems": {
"type": [
"array",
"null"
],
"items": {
"$ref": "#/definitions/DynamicToolCallOutputContentItem"
}
},
"durationMs": {
"description": "The duration of the dynamic tool call in milliseconds.",
"type": [
"integer",
"null"
],
"format": "int64"
},
"id": {
"type": "string"
},
"namespace": {
"type": [
"string",
"null"
]
},
"status": {
"$ref": "#/definitions/DynamicToolCallStatus"
},
"success": {
"type": [
"boolean",
"null"
]
},
"tool": {
"type": "string"
},
"type": {
"title": "DynamicToolCallThreadItemType",
"type": "string",
"enum": [
"dynamicToolCall"
]
}
}
},
{
"title": "CollabAgentToolCallThreadItem",
"type": "object",
"required": [
"agentsStates",
"id",
"receiverThreadIds",
"senderThreadId",
"status",
"tool",
"type"
],
"properties": {
"agentsStates": {
"description": "Last known status of the target agents, when available.",
"type": "object",
"additionalProperties": {
"$ref": "#/definitions/CollabAgentState"
}
},
"id": {
"description": "Unique identifier for this collab tool call.",
"type": "string"
},
"model": {
"description": "Model requested for the spawned agent, when applicable.",
"type": [
"string",
"null"
]
},
"prompt": {
"description": "Prompt text sent as part of the collab tool call, when available.",
"type": [
"string",
"null"
]
},
"reasoningEffort": {
"description": "Reasoning effort requested for the spawned agent, when applicable.",
"anyOf": [
{
"$ref": "#/definitions/ReasoningEffort"
},
{
"type": "null"
}
]
},
"receiverThreadIds": {
"description": "Thread ID of the receiving agent, when applicable. In case of spawn operation, this corresponds to the newly spawned agent.",
"type": "array",
"items": {
"type": "string"
}
},
"senderThreadId": {
"description": "Thread ID of the agent issuing the collab request.",
"type": "string"
},
"status": {
"description": "Current status of the collab tool call.",
"allOf": [
{
"$ref": "#/definitions/CollabAgentToolCallStatus"
}
]
},
"tool": {
"description": "Name of the collab tool that was invoked.",
"allOf": [
{
"$ref": "#/definitions/CollabAgentTool"
}
]
},
"type": {
"title": "CollabAgentToolCallThreadItemType",
"type": "string",
"enum": [
"collabAgentToolCall"
]
}
}
},
{
"title": "SubAgentActivityThreadItem",
"type": "object",
"required": [
"agentPath",
"agentThreadId",
"id",
"kind",
"type"
],
"properties": {
"agentPath": {
"type": "string"
},
"agentThreadId": {
"type": "string"
},
"id": {
"type": "string"
},
"kind": {
"$ref": "#/definitions/SubAgentActivityKind"
},
"type": {
"title": "SubAgentActivityThreadItemType",
"type": "string",
"enum": [
"subAgentActivity"
]
}
}
},
{
"title": "WebSearchThreadItem",
"type": "object",
"required": [
"id",
"query",
"type"
],
"properties": {
"action": {
"anyOf": [
{
"$ref": "#/definitions/WebSearchAction"
},
{
"type": "null"
}
]
},
"id": {
"type": "string"
},
"query": {
"type": "string"
},
"type": {
"title": "WebSearchThreadItemType",
"type": "string",
"enum": [
"webSearch"
]
}
}
},
{
"title": "ImageViewThreadItem",
"type": "object",
"required": [
"id",
"path",
"type"
],
"properties": {
"id": {
"type": "string"
},
"path": {
"$ref": "#/definitions/LegacyAppPathString"
},
"type": {
"title": "ImageViewThreadItemType",
"type": "string",
"enum": [
"imageView"
]
}
}
},
{
"title": "SleepThreadItem",
"type": "object",
"required": [
"durationMs",
"id",
"type"
],
"properties": {
"durationMs": {
"type": "integer",
"format": "uint64",
"minimum": 0.0
},
"id": {
"type": "string"
},
"type": {
"title": "SleepThreadItemType",
"type": "string",
"enum": [
"sleep"
]
}
}
},
{
"title": "ImageGenerationThreadItem",
"type": "object",
"required": [
"id",
"result",
"status",
"type"
],
"properties": {
"id": {
"type": "string"
},
"result": {
"type": "string"
},
"revisedPrompt": {
"type": [
"string",
"null"
]
},
"savedPath": {
"anyOf": [
{
"$ref": "#/definitions/AbsolutePathBuf"
},
{
"type": "null"
}
]
},
"status": {
"type": "string"
},
"type": {
"title": "ImageGenerationThreadItemType",
"type": "string",
"enum": [
"imageGeneration"
]
}
}
},
{
"title": "EnteredReviewModeThreadItem",
"type": "object",
"required": [
"id",
"review",
"type"
],
"properties": {
"id": {
"type": "string"
},
"review": {
"type": "string"
},
"type": {
"title": "EnteredReviewModeThreadItemType",
"type": "string",
"enum": [
"enteredReviewMode"
]
}
}
},
{
"title": "ExitedReviewModeThreadItem",
"type": "object",
"required": [
"id",
"review",
"type"
],
"properties": {
"id": {
"type": "string"
},
"review": {
"type": "string"
},
"type": {
"title": "ExitedReviewModeThreadItemType",
"type": "string",
"enum": [
"exitedReviewMode"
]
}
}
},
{
"title": "ContextCompactionThreadItem",
"type": "object",
"required": [
"id",
"type"
],
"properties": {
"id": {
"type": "string"
},
"type": {
"title": "ContextCompactionThreadItemType",
"type": "string",
"enum": [
"contextCompaction"
]
}
}
}
]
}Variants§
UserMessage
UserMessageThreadItem
HookPrompt
HookPromptThreadItem
AgentMessage
AgentMessageThreadItem
Plan
PlanThreadItem
EXPERIMENTAL - proposed plan item content. The completed plan item is authoritative and may not match the concatenation of PlanDelta text.
Reasoning
ReasoningThreadItem
CommandExecution
CommandExecutionThreadItem
Fields
command_actions: Vec<CommandAction>A best-effort parsing of the command to understand the action(s) it will perform. This returns a list of CommandAction objects because a single shell command may be composed of many commands piped together.
cwd: LegacyAppPathStringThe command’s working directory.
source: CommandExecutionSourcestatus: CommandExecutionStatusFileChange
FileChangeThreadItem
McpToolCall
McpToolCallThreadItem
Fields
app_context: Option<McpToolCallAppContext>error: Option<McpToolCallError>result: Option<McpToolCallResult>status: McpToolCallStatusDynamicToolCall
DynamicToolCallThreadItem
CollabAgentToolCall
CollabAgentToolCallThreadItem
Fields
agents_states: HashMap<String, CollabAgentState>Last known status of the target agents, when available.
reasoning_effort: Option<ReasoningEffort>Reasoning effort requested for the spawned agent, when applicable.
receiver_thread_ids: Vec<String>Thread ID of the receiving agent, when applicable. In case of spawn operation, this corresponds to the newly spawned agent.
status: CollabAgentToolCallStatusCurrent status of the collab tool call.
tool: CollabAgentToolName of the collab tool that was invoked.
SubAgentActivity
SubAgentActivityThreadItem
WebSearch
WebSearchThreadItem
ImageView
ImageViewThreadItem
Sleep
SleepThreadItem
ImageGeneration
ImageGenerationThreadItem
Fields
saved_path: Option<AbsolutePathBuf>EnteredReviewMode
EnteredReviewModeThreadItem
ExitedReviewMode
ExitedReviewModeThreadItem
ContextCompaction
ContextCompactionThreadItem
Trait Implementations§
Source§impl Clone for ThreadItem
impl Clone for ThreadItem
Source§fn clone(&self) -> ThreadItem
fn clone(&self) -> ThreadItem
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more