Expand description
Helper functions for common operations on yoagent types.
All message types are used directly from yoagent::types.
Enums§
Functions§
- assistant_
message - Create a simple Assistant AgentMessage with text content.
- base_
model_ config - Create a base ModelConfig for the opencode-go provider. Sets the standard context_window (1M) and max_tokens (393216) for DeepSeek v4 models. Callers override if needed.
- content_
tool_ calls - Extract all tool calls from a
Vec<Content>. - extension_
message - Create an Extension message (pi-compatible custom_message).
kindidentifies the type (“info”, “error”, “system_stop”, etc.). - extension_
message_ with_ details - Create an Extension message with structured details.
- message_
dedup_ key - Compute a dedup key for a message, distinguishing messages that
message_text()alone would conflate (e.g. two assistant messages with empty text but different tool calls). - message_
error - Extract the error_message from an Assistant message, if present.
- message_
extension_ kind - Get the kind/customType from an Extension message.
- message_
extension_ text - Get the text content from an Extension message’s data field.
- message_
is_ assistant - Check if an AgentMessage is an Assistant message.
- message_
is_ error - Check if an AgentMessage is a tool result with an error.
- message_
is_ extension - Check if an AgentMessage is an Extension message.
- message_
is_ system_ stop - Check if an AgentMessage is a system-generated stop notification
(e.g. execution limit reached, max tokens exceeded).
The agent loop injects these as user messages starting with
[Agent stopped:. - message_
is_ tool_ result - Check if an AgentMessage is a ToolResult message.
- message_
is_ user - Check if an AgentMessage is a User message.
- message_
text - Get the text content of an AgentMessage (all text parts joined).
- message_
tool_ call_ count - Count how many tool calls are in an AgentMessage.
- message_
tool_ call_ id - Get the tool_call_id from a ToolResult message.
- message_
usage - Get the usage from an Assistant message.
- tool_
result_ message - Create a ToolResult AgentMessage.
- user_
message - Create a simple User AgentMessage with text content.