Skip to main content

Module types

Module types 

Source
Expand description

Helper functions for common operations on yoagent types.

All message types are used directly from yoagent::types.

Enums§

AgentMessage
Content
Message

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). kind identifies 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.