Refactor subagent and workflow domain models; migrate access tiers and events to domain module
- Moved `AccessTier` and `SubagentEvent` enums to `zesdex_domain::subagent`. - Consolidated workflow-related types into `zesdex_domain::workflow`. - Updated references across the codebase to use the new domain models. - Refactored tool execution logic to utilize a new `ToolExecutor` trait. - Enhanced `AgentTurnService` to handle tool calls and events more effectively. - Adjusted API handlers and state management to align with new domain structure.
This commit is contained in:
@@ -4,7 +4,7 @@ use std::sync::atomic::Ordering;
|
||||
use tracing::info;
|
||||
|
||||
use zesdex_domain::core::ChatMessage;
|
||||
use zesdex_infrastructure::agent::{spawn_agent_turn as backend_spawn_agent_turn, AgentTurnParams};
|
||||
use zesdex_domain::agent::AgentTurnParams;
|
||||
use crate::state::AppStateRest;
|
||||
|
||||
/// Spawn an agent turn on a background thread by delegating to `zesdex-infrastructure`.
|
||||
@@ -63,15 +63,43 @@ pub fn spawn_agent_turn(state: &mut AppStateRest, text: String) {
|
||||
|
||||
let params = AgentTurnParams {
|
||||
messages,
|
||||
session_dir,
|
||||
workspace_roots,
|
||||
turn_events,
|
||||
in_flight,
|
||||
abort,
|
||||
session_dir: session_dir.clone(),
|
||||
workspace_roots: workspace_roots.clone(),
|
||||
turn_events: turn_events.clone(),
|
||||
in_flight: in_flight.clone(),
|
||||
abort: abort.clone(),
|
||||
api_key: api_key.clone(),
|
||||
model: model.clone(),
|
||||
api_base: api_base.clone(),
|
||||
};
|
||||
|
||||
let client = std::sync::Arc::new(zesdex_infrastructure::llm::provider::LlmClient::new(
|
||||
api_key,
|
||||
model,
|
||||
api_base,
|
||||
};
|
||||
));
|
||||
|
||||
backend_spawn_agent_turn(params);
|
||||
let tool_ctx = zesdex_infrastructure::tools::ToolCtx::builder()
|
||||
.session_dir(session_dir)
|
||||
.workspaces(workspace_roots)
|
||||
.turn_events(turn_events)
|
||||
.build();
|
||||
|
||||
let tool_executor = std::sync::Arc::new(
|
||||
zesdex_infrastructure::tools::executor::InfrastructureToolExecutor::new(tool_ctx),
|
||||
);
|
||||
|
||||
let tools = zesdex_infrastructure::tools::all_tools();
|
||||
let defs = zesdex_infrastructure::tools::tool_defs(&tools);
|
||||
|
||||
let turn_service = zesdex_application::agent::turn_service::AgentTurnServiceImpl::new(
|
||||
client,
|
||||
tool_executor,
|
||||
defs,
|
||||
);
|
||||
|
||||
use zesdex_application::agent::AgentTurnService;
|
||||
tokio::spawn(async move {
|
||||
let _ = turn_service.run_turn(params).await;
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user