feat: centralize default constants and refactor overlay enter handling in TUI
This commit is contained in:
@@ -109,7 +109,7 @@ pub fn spawn_background_review(
|
||||
// 3. Resolve LLM credentials
|
||||
let base_url = api_base.unwrap_or_else(|| {
|
||||
std::env::var("OPENAI_API_BASE")
|
||||
.unwrap_or_else(|_| "https://opencode.ai/zen/v1".to_string())
|
||||
.unwrap_or_else(|_| zesdex_domain::agent::defaults::DEFAULT_API_BASE.to_string())
|
||||
});
|
||||
|
||||
let client = LlmClient::new(api_key, model, Some(base_url));
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
//! Subagent event types — events emitted during subagent execution.
|
||||
|
||||
pub use zesdex_domain::subagent::SubagentEvent;
|
||||
@@ -1,23 +0,0 @@
|
||||
//! Subagent gating — decide whether to run review/test/arch agents based
|
||||
//! on the current context.
|
||||
|
||||
use tracing::instrument;
|
||||
|
||||
/// Determine whether an auto-review should be triggered after an edit.
|
||||
///
|
||||
/// Gating logic:
|
||||
/// - Returns `false` if there are no edits (`edit_count == 0`).
|
||||
/// - Returns `false` if `consecutive_empty_reviews >= max_skip` (too many
|
||||
/// consecutive reviews produced no findings, so skip further reviews).
|
||||
/// - Otherwise returns `true`.
|
||||
#[instrument]
|
||||
pub fn should_review(edit_count: u32, consecutive_empty_reviews: u32, max_skip: u32) -> bool {
|
||||
if edit_count == 0 {
|
||||
return false;
|
||||
}
|
||||
// Skip review if we've had several consecutive empty reviews
|
||||
if consecutive_empty_reviews >= max_skip {
|
||||
return false;
|
||||
}
|
||||
true
|
||||
}
|
||||
@@ -5,9 +5,5 @@ pub mod auto;
|
||||
pub mod context;
|
||||
pub mod division;
|
||||
pub mod engine;
|
||||
pub mod event;
|
||||
pub mod gating;
|
||||
pub mod provider;
|
||||
pub mod spawn;
|
||||
pub mod tools;
|
||||
pub mod workspace;
|
||||
|
||||
@@ -67,7 +67,7 @@ impl SubagentProvider {
|
||||
///
|
||||
/// Flow: reads `settings.provider` and `settings.model` → if model is empty,
|
||||
/// falls back to the provider config's `default_model` → if that is also
|
||||
/// empty, uses `"deepseek-v4-flash-free"` as the ultimate default.
|
||||
/// empty, uses the domain default model constant.
|
||||
#[instrument]
|
||||
pub fn resolve_subagent_provider(
|
||||
settings: &zesdex_domain::cms::Settings,
|
||||
@@ -82,7 +82,7 @@ pub fn resolve_subagent_provider(
|
||||
.providers
|
||||
.get(&provider)
|
||||
.and_then(|p| p.default_model.clone())
|
||||
.unwrap_or_else(|| "deepseek-v4-flash-free".to_string())
|
||||
.unwrap_or_else(|| zesdex_domain::agent::defaults::DEFAULT_MODEL.to_string())
|
||||
} else {
|
||||
model
|
||||
};
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
//! Subagent tool helpers — wrap tool execution for subagent use.
|
||||
|
||||
use anyhow::Result;
|
||||
use tracing::instrument;
|
||||
|
||||
use crate::tools::{Tool, ToolCtx};
|
||||
|
||||
/// Execute a single tool call within a subagent context.
|
||||
///
|
||||
/// Delegates directly to the tool's `run` method with the given context and
|
||||
/// JSON arguments.
|
||||
#[instrument(skip(tool, ctx, args))]
|
||||
pub fn execute_tool_call(
|
||||
tool: &dyn Tool,
|
||||
ctx: &ToolCtx,
|
||||
args: &serde_json::Value,
|
||||
) -> Result<String> {
|
||||
tool.run(ctx, args)
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
//! Subagent workspace management — create isolated workspaces for subagents.
|
||||
|
||||
use std::path::{Path, PathBuf};
|
||||
|
||||
use tracing::instrument;
|
||||
|
||||
/// Create an isolated workspace directory for a subagent.
|
||||
///
|
||||
/// Creates `{base_dir}/subagent-workspaces/{agent_id}` and all parent
|
||||
/// directories if they do not already exist.
|
||||
#[instrument]
|
||||
pub fn create_subagent_workspace(base_dir: &Path, agent_id: &str) -> anyhow::Result<PathBuf> {
|
||||
let ws = base_dir.join("subagent-workspaces").join(agent_id);
|
||||
std::fs::create_dir_all(&ws)?;
|
||||
Ok(ws)
|
||||
}
|
||||
Reference in New Issue
Block a user