This commit is contained in:
jimmyfraiture
2025-09-29 14:09:40 +01:00
parent 4562946b3b
commit 36298cf734
7 changed files with 38 additions and 2956 deletions

View File

@@ -1,16 +0,0 @@
use async_trait::async_trait;
use codex_protocol::protocol::Event;
use codex_protocol::protocol::Op;
use codex_protocol::protocol::Submission;
/// Minimal async interface for interacting with an agent runtime.
#[async_trait]
pub trait AgentRuntime: Send + Sync {
type Error: std::error::Error + Send + Sync + 'static;
async fn submit(&self, op: Op) -> Result<String, Self::Error>;
async fn submit_with_id(&self, submission: Submission) -> Result<(), Self::Error>;
async fn next_event(&self) -> Result<Event, Self::Error>;
}

View File

@@ -1,5 +1,21 @@
pub mod session;
use async_trait::async_trait;
use codex_protocol::protocol::Event;
use codex_protocol::protocol::Op;
use codex_protocol::protocol::Submission;
pub use session::Session;
pub use session::TurnContext;
pub use session::ConfigureSession;
pub mod turn;
pub use turn::ProcessedResponseItem;
pub use turn::TurnRunResult;
/// Minimal async interface for interacting with an agent runtime.
#[async_trait]
pub trait AgentRuntime: Send + Sync {
type Error: std::error::Error + Send + Sync + 'static;
async fn submit(&self, op: Op) -> Result<String, Self::Error>;
async fn submit_with_id(&self, submission: Submission) -> Result<(), Self::Error>;
async fn next_event(&self) -> Result<Event, Self::Error>;
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,15 @@
use codex_protocol::models::ResponseInputItem;
use codex_protocol::models::ResponseItem;
use codex_protocol::protocol::TokenUsage;
#[derive(Debug, Clone)]
pub struct ProcessedResponseItem {
pub item: ResponseItem,
pub response: Option<ResponseInputItem>,
}
#[derive(Debug, Clone)]
pub struct TurnRunResult {
pub processed_items: Vec<ProcessedResponseItem>,
pub total_token_usage: Option<TokenUsage>,
}

View File

@@ -1,5 +1,5 @@
use crate::tooling::ApplyPatchToolType;
use crate::model_family::ModelFamily;
use crate::tooling::ApplyPatchToolType;
#[derive(Debug, Clone)]
pub enum ConfigShellToolType {
@@ -69,4 +69,3 @@ impl ToolsConfig {
}
}
}

View File

@@ -139,6 +139,8 @@ use codex_agent::apply_patch::InternalApplyPatchInvocation;
use codex_agent::apply_patch::apply_patch;
use codex_agent::apply_patch::convert_apply_patch_to_protocol;
use codex_agent::model_client::ModelClientAdapter;
use codex_agent::runtime::ProcessedResponseItem;
use codex_agent::runtime::TurnRunResult;
use codex_agent::services::ApprovalCoordinator;
use codex_agent::session_services::SessionServices;
use codex_protocol::config_types::ReasoningEffort as ReasoningEffortConfig;
@@ -2040,18 +2042,6 @@ async fn run_turn(
/// events map to a `ResponseItem`. A `ResponseItem` may need to be
/// "handled" such that it produces a `ResponseInputItem` that needs to be
/// sent back to the model on the next turn.
#[derive(Debug)]
struct ProcessedResponseItem {
item: ResponseItem,
response: Option<ResponseInputItem>,
}
#[derive(Debug)]
struct TurnRunResult {
processed_items: Vec<ProcessedResponseItem>,
total_token_usage: Option<TokenUsage>,
}
async fn try_run_turn(
sess: &Session,
turn_context: &TurnContext,

View File

@@ -5,7 +5,6 @@ use serde_json::json;
use std::collections::BTreeMap;
use std::collections::HashMap;
use crate::model_family::ModelFamily;
use crate::plan_tool::PLAN_TOOL;
use crate::tool_apply_patch::ApplyPatchToolType;
use crate::tool_apply_patch::create_apply_patch_freeform_tool;