feat: finalise ticket99 - implémentation agent model configuration v2
- agent/lifecycle.rs: lifecycle management per profile
- agent/provider_catalogue.rs: provider registration with model support
- agent/usecases.rs: usecases for profile-based agent invocation
- agent/mod.rs: expose agent capabilities via AgentManager
- backend/dto.rs: AgentModelConfig, AgentProviderConfig DTOs
- domain/profile.rs: extend Profile avec agent capabilities
- domain/permission.rs: permission checks pour agent access
- infrastructure/assistant/mod.rs: agent integration
- infrastructure/permission/{claude,codex}.rs: permission handlers
- web-server/lib.rs: agent endpoints
- commands.rs: agent commands
- frontend/adapters/{http,profile,mock,domain}.ts: adapters
- frontend/first-run/FirstRunWizard.{test.tsx,tsx}: first-run flow
This commit is contained in:
@ -235,6 +235,7 @@ impl TicketAssistantEnvironmentPreparer {
|
||||
&declaration,
|
||||
cwd.as_str(),
|
||||
project.root.as_str(),
|
||||
profile.model.as_deref(),
|
||||
);
|
||||
self.write_file(&path, rendered.as_bytes()).await?;
|
||||
env.push((home_env.clone(), parent_dir(cwd, target)));
|
||||
@ -511,12 +512,13 @@ fn codex_config_toml(
|
||||
mcp_declaration: &str,
|
||||
run_dir: &str,
|
||||
project_root: &str,
|
||||
model: Option<&str>,
|
||||
) -> String {
|
||||
let mut text = replace_toml_table_block(
|
||||
existing.unwrap_or_default(),
|
||||
"mcp_servers.idea",
|
||||
mcp_declaration.trim_end(),
|
||||
);
|
||||
let mut text = existing.unwrap_or_default().to_owned();
|
||||
if let Some(model) = model {
|
||||
text = set_top_level_toml_value(&text, "model", model);
|
||||
}
|
||||
text = replace_toml_table_block(&text, "mcp_servers.idea", mcp_declaration.trim_end());
|
||||
text = ensure_codex_project_trust(&text, run_dir);
|
||||
text = ensure_codex_project_trust(&text, project_root);
|
||||
if !text.ends_with('\n') {
|
||||
@ -525,6 +527,33 @@ fn codex_config_toml(
|
||||
text
|
||||
}
|
||||
|
||||
fn set_top_level_toml_value(input: &str, key: &str, value: &str) -> String {
|
||||
let line = format!("{key} = {}", toml_quoted(value));
|
||||
set_top_level_toml_line(input, key, &line)
|
||||
}
|
||||
|
||||
fn set_top_level_toml_line(input: &str, key: &str, replacement: &str) -> String {
|
||||
let needle = format!("{key} =");
|
||||
let mut out = Vec::new();
|
||||
let mut replaced = false;
|
||||
for line in input.lines() {
|
||||
let trimmed = line.trim_start();
|
||||
if !replaced && trimmed.starts_with(&needle) {
|
||||
out.push(replacement.to_owned());
|
||||
replaced = true;
|
||||
} else {
|
||||
out.push(line.to_owned());
|
||||
}
|
||||
}
|
||||
if !replaced {
|
||||
if !out.is_empty() && !out.first().is_some_and(|line| line.trim().starts_with('[')) {
|
||||
out.push(String::new());
|
||||
}
|
||||
out.insert(0, replacement.to_owned());
|
||||
}
|
||||
out.join("\n")
|
||||
}
|
||||
|
||||
fn replace_toml_table_block(existing: &str, table: &str, replacement: &str) -> String {
|
||||
let header = format!("[{table}]");
|
||||
let mut out = Vec::new();
|
||||
|
||||
Reference in New Issue
Block a user