Skip to main content

ThreadItem

Enum ThreadItem 

Source
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

Fields

§client_id: Option<String>
§content: Vec<UserInput>
§

HookPrompt

HookPromptThreadItem

Fields

§

AgentMessage

AgentMessageThreadItem

Fields

§memory_citation: Option<MemoryCitation>
§text: String
§

Plan

PlanThreadItem

EXPERIMENTAL - proposed plan item content. The completed plan item is authoritative and may not match the concatenation of PlanDelta text.

Fields

§text: String
§

Reasoning

ReasoningThreadItem

Fields

§content: Vec<String>
§summary: Vec<String>
§

CommandExecution

CommandExecutionThreadItem

Fields

§aggregated_output: Option<String>

The command’s output, aggregated from stdout and stderr.

§command: String

The command to be executed.

§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: LegacyAppPathString

The command’s working directory.

§duration_ms: Option<i64>

The duration of the command execution in milliseconds.

§exit_code: Option<i32>

The command’s exit code.

§process_id: Option<String>

Identifier for the underlying PTY process (when available).

§

FileChange

FileChangeThreadItem

§

McpToolCall

McpToolCallThreadItem

Fields

§arguments: Value
§duration_ms: Option<i64>

The duration of the MCP tool call in milliseconds.

§mcp_app_resource_uri: Option<String>

Deprecated: use appContext.resourceUri instead.

§plugin_id: Option<String>
§server: String
§tool: String
§

DynamicToolCall

DynamicToolCallThreadItem

Fields

§arguments: Value
§duration_ms: Option<i64>

The duration of the dynamic tool call in milliseconds.

§namespace: Option<String>
§success: Option<bool>
§tool: String
§

CollabAgentToolCall

CollabAgentToolCallThreadItem

Fields

§agents_states: HashMap<String, CollabAgentState>

Last known status of the target agents, when available.

§id: String

Unique identifier for this collab tool call.

§model: Option<String>

Model requested for the spawned agent, when applicable.

§prompt: Option<String>

Prompt text sent as part of the collab tool call, 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.

§sender_thread_id: String

Thread ID of the agent issuing the collab request.

§status: CollabAgentToolCallStatus

Current status of the collab tool call.

§tool: CollabAgentTool

Name of the collab tool that was invoked.

§

SubAgentActivity

SubAgentActivityThreadItem

Fields

§agent_path: String
§agent_thread_id: String
§

WebSearch

WebSearchThreadItem

Fields

§query: String
§

ImageView

ImageViewThreadItem

§

Sleep

SleepThreadItem

Fields

§duration_ms: u64
§

ImageGeneration

ImageGenerationThreadItem

Fields

§result: String
§revised_prompt: Option<String>
§status: String
§

EnteredReviewMode

EnteredReviewModeThreadItem

Fields

§review: String
§

ExitedReviewMode

ExitedReviewModeThreadItem

Fields

§review: String
§

ContextCompaction

ContextCompactionThreadItem

Fields

Trait Implementations§

Source§

impl Clone for ThreadItem

Source§

fn clone(&self) -> ThreadItem

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ThreadItem

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for ThreadItem

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for ThreadItem

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> FromRef<T> for T
where T: Clone,

§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,