mirror of
https://github.com/hanzoai/dev.git
synced 2026-10-25 03:32:32 +00:00
Merge upstream/main into merge/upstream-20250825; resolve exec_command API changes, add per-session ExecSessionManager, fix ToolsConfig bools + add new_from_params; build passes with no warnings via ./build-fast.sh
This commit is contained in:
@@ -382,7 +382,6 @@ use codex_protocol::models::ResponseInputItem;
|
||||
use codex_protocol::models::ResponseItem;
|
||||
use codex_protocol::models::ShellToolCallParams;
|
||||
use crate::openai_tools::ToolsConfig;
|
||||
use crate::openai_tools::ToolsConfigParams;
|
||||
use crate::openai_tools::get_openai_tools;
|
||||
use crate::parse_command::parse_command;
|
||||
use crate::plan_tool::handle_update_plan;
|
||||
@@ -425,6 +424,7 @@ use crate::turn_diff_tracker::TurnDiffTracker;
|
||||
use crate::user_notification::UserNotification;
|
||||
use crate::util::backoff;
|
||||
use serde_json::Value;
|
||||
use crate::exec_command::ExecSessionManager;
|
||||
|
||||
/// The high-level interface to the Codex system.
|
||||
/// It operates as a queue pair where you send submissions and receive events.
|
||||
@@ -558,6 +558,7 @@ pub(crate) struct Session {
|
||||
|
||||
/// Manager for external MCP servers/tools.
|
||||
mcp_connection_manager: McpConnectionManager,
|
||||
#[allow(dead_code)]
|
||||
session_manager: ExecSessionManager,
|
||||
|
||||
/// Configuration for available agent models
|
||||
@@ -1495,6 +1496,7 @@ async fn submission_loop(
|
||||
cwd,
|
||||
_writable_roots: writable_roots,
|
||||
mcp_connection_manager,
|
||||
session_manager: crate::exec_command::ExecSessionManager::default(),
|
||||
agents: config.agents.clone(),
|
||||
notify,
|
||||
state: Mutex::new(state),
|
||||
|
||||
@@ -17,6 +17,9 @@ pub use responses_api::create_exec_command_tool_for_responses_api;
|
||||
#[allow(unused_imports)]
|
||||
pub use responses_api::create_write_stdin_tool_for_responses_api;
|
||||
#[allow(unused_imports)]
|
||||
pub use session_manager::SESSION_MANAGER;
|
||||
#[allow(unused_imports)]
|
||||
pub use session_manager::result_into_payload;
|
||||
|
||||
// Provide a stable type alias used by the rest of the codebase.
|
||||
// Upstream removed the global SESSION_MANAGER; we now manage a per-session
|
||||
// instance. Keep the ExecSessionManager name for minimal churn.
|
||||
pub type ExecSessionManager = session_manager::SessionManager;
|
||||
|
||||
@@ -76,6 +76,7 @@ pub(crate) struct ToolsConfig {
|
||||
pub web_search_request: bool,
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub(crate) struct ToolsConfigParams<'a> {
|
||||
pub(crate) model_family: &'a ModelFamily,
|
||||
pub(crate) approval_policy: AskForApproval,
|
||||
@@ -120,11 +121,25 @@ impl ToolsConfig {
|
||||
|
||||
Self {
|
||||
shell_type,
|
||||
plan_tool: *include_plan_tool,
|
||||
plan_tool: include_plan_tool,
|
||||
apply_patch_tool_type,
|
||||
web_search_request: *include_web_search_request,
|
||||
web_search_request: include_web_search_request,
|
||||
}
|
||||
}
|
||||
|
||||
// Compatibility constructor used by some tests/upstream calls.
|
||||
#[allow(dead_code)]
|
||||
pub fn new_from_params(p: &ToolsConfigParams) -> Self {
|
||||
Self::new(
|
||||
p.model_family,
|
||||
p.approval_policy,
|
||||
p.sandbox_policy.clone(),
|
||||
p.include_plan_tool,
|
||||
p.include_apply_patch_tool,
|
||||
p.include_web_search_request,
|
||||
p.use_streamable_shell_tool,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
/// Generic JSON‑Schema subset needed for our tool definitions
|
||||
@@ -813,7 +828,7 @@ mod tests {
|
||||
#[test]
|
||||
fn test_mcp_tool_property_missing_type_defaults_to_string() {
|
||||
let model_family = find_family_for_model("o3").expect("o3 should be a valid model family");
|
||||
let config = ToolsConfig::new(&ToolsConfigParams {
|
||||
let config = ToolsConfig::new_from_params(&ToolsConfigParams {
|
||||
model_family: &model_family,
|
||||
approval_policy: AskForApproval::Never,
|
||||
sandbox_policy: SandboxPolicy::ReadOnly,
|
||||
|
||||
Reference in New Issue
Block a user