Skip to main content

vtcode_config/core/agent/
open_responses.rs

1//! Open Responses specification compliance configuration.
2
3use serde::{Deserialize, Serialize};
4
5/// Open Responses specification compliance configuration
6///
7/// Enables vendor-neutral LLM API format per the Open Responses specification
8/// (<https://www.openresponses.org/>). When enabled, VT Code emits semantic
9/// streaming events and uses standardized response/item structures.
10#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
11#[derive(Debug, Clone, Deserialize, Serialize)]
12pub struct OpenResponsesConfig {
13    /// Enable Open Responses specification compliance layer
14    /// When true, VT Code emits semantic streaming events alongside internal events
15    /// Default: false (opt-in feature)
16    #[serde(default)]
17    pub enabled: bool,
18
19    /// Emit Open Responses events to the event sink
20    /// When true, streaming events follow Open Responses format
21    /// (response.created, response.output_item.added, response.output_text.delta, etc.)
22    #[serde(default = "default_open_responses_emit_events")]
23    pub emit_events: bool,
24
25    /// Include VT Code extension items (vtcode:file_change, vtcode:web_search, etc.)
26    /// When false, extension items are omitted from the Open Responses output
27    #[serde(default = "default_open_responses_include_extensions")]
28    pub include_extensions: bool,
29
30    /// Map internal tool calls to Open Responses function_call items
31    /// When true, command executions and MCP tool calls are represented as function_call items
32    #[serde(default = "default_open_responses_map_tool_calls")]
33    pub map_tool_calls: bool,
34
35    /// Include reasoning items in Open Responses output
36    /// When true, model reasoning/thinking is exposed as reasoning items
37    #[serde(default = "default_open_responses_include_reasoning")]
38    pub include_reasoning: bool,
39}
40
41impl Default for OpenResponsesConfig {
42    fn default() -> Self {
43        Self {
44            enabled: false, // Opt-in by default
45            emit_events: default_open_responses_emit_events(),
46            include_extensions: default_open_responses_include_extensions(),
47            map_tool_calls: default_open_responses_map_tool_calls(),
48            include_reasoning: default_open_responses_include_reasoning(),
49        }
50    }
51}
52
53#[inline]
54const fn default_open_responses_emit_events() -> bool {
55    true // When enabled, emit events by default
56}
57
58#[inline]
59const fn default_open_responses_include_extensions() -> bool {
60    true // Include VT Code-specific extensions by default
61}
62
63#[inline]
64const fn default_open_responses_map_tool_calls() -> bool {
65    true // Map tool calls to function_call items by default
66}
67
68#[inline]
69const fn default_open_responses_include_reasoning() -> bool {
70    true // Include reasoning items by default
71}