1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
//! Core type definitions for the Open Agent SDK.
//!
//! This module contains the fundamental data structures used throughout the SDK for
//! configuring and interacting with AI agents. The type system is organized into three
//! main categories:
//!
//! # Agent Configuration
//!
//! - [`AgentOptions`]: Main configuration struct for agent behavior, model settings,
//! and tool management
//! - [`AgentOptionsBuilder`]: Builder pattern implementation for constructing
//! [`AgentOptions`] with validation
//!
//! # Message System
//!
//! The SDK uses a flexible message system that supports multi-modal content:
//!
//! - [`Message`]: Container for conversation messages with role and content
//! - [`MessageRole`]: Enum defining who sent the message (System, User, Assistant, Tool)
//! - [`ContentBlock`]: Enum for different content types (text, tool use, tool results)
//! - [`TextBlock`]: Simple text content
//! - [`ToolUseBlock`]: Represents an AI request to execute a tool
//! - [`ToolResultBlock`]: Contains the result of a tool execution
//!
//! # Wire Formats
//!
//! [`ApiProtocol`] selects which wire format an endpoint speaks: `OpenAiChat` (the default)
//! or `Anthropic`. `OpenAIRequest` stays the single internal request representation, and the
//! translation to the Anthropic shape happens at the transport boundary.
//!
//! OpenAI chat completions:
//!
//! - [`OpenAIRequest`]: Request payload sent to the API
//! - [`OpenAIMessage`]: Message format for OpenAI API
//! - [`OpenAIChunk`]: Streaming response chunk from the API
//! - [`OpenAIToolCall`], [`OpenAIFunction`]: Tool calling format
//! - [`OpenAIDelta`], [`OpenAIToolCallDelta`]: Incremental updates in streaming
//!
//! Anthropic messages:
//!
//! - [`AnthropicRequest`], [`AnthropicMessage`]: Request payload, built with
//! [`AnthropicRequest::from_openai`]
//! - [`AnthropicEvent`]: One decoded event from the streaming vocabulary
//! - [`AnthropicBlockStart`], [`AnthropicDelta`], [`AnthropicMessageDelta`]: Content block
//! openings and incremental updates
//! - [`AnthropicErrorBody`]: A mid-stream `error` event
//! - [`anthropic_finish_reason`]: Maps Anthropic stop reasons onto [`FinishReason`]
//!
//! # Architecture Overview
//!
//! The type system is designed to:
//!
//! 1. **Separate concerns**: Internal SDK types (Message, ContentBlock) are distinct
//! from the API wire formats, allowing flexibility in provider support
//! 2. **Enable streaming**: OpenAI types support incremental delta parsing for
//! real-time responses
//! 3. **Support tool use**: First-class support for function calling with proper
//! request/response tracking
//! 4. **Provide ergonomics**: Builder pattern and convenience constructors make
//! common operations simple
//!
//! # Example
//!
//! ```no_run
//! use open_agent::{AgentOptions, Message};
//!
//! // Build agent configuration
//! let options = AgentOptions::builder()
//! .model("qwen2.5-32b-instruct")
//! .base_url("http://localhost:1234/v1")
//! .system_prompt("You are a helpful assistant")
//! .max_turns(10)
//! .auto_execute_tools(true)
//! .build()
//! .expect("Valid configuration");
//!
//! // Create a user message
//! let msg = Message::user("Hello, how are you?");
//! ```
use crateError;
use crateHooks;
use crateTool;
use ;
use Arc;
include!;
include!;
include!;
include!;
include!;
include!;
include!;
// Real submodules rather than `include!` fragments, so `cargo-mutants` — which walks `mod`
// declarations but does not expand `include!` — can mutate the logic they hold. The
// re-exports keep every public path unchanged. The remaining fragments stay fragments
// because they reach into module-private fields of types their siblings define, which real
// modules could only reach by weakening that encapsulation.
// Glob re-export: the wire types are consumed across the crate (and by unit tests) exactly
// as the `include!` fragment used to expose them, so this keeps every path identical.
pub use *;
pub use ;
pub use ;
pub use ;
pub use ApiProtocol;