feat: v0.7.0 — configuration post-install : bloc config: par agent (env_map + fichiers), adaptateurs TOML/YAML/JSON/key=value, édition douce, jamais de token en clair (api_key = @secret) (closes #91)
- Nouveau module src/agent_config.rs : apply_post_install (écriture fichiers), apply_env_map (env injectée au start/run), provider_pref (provider > config.provider_default > default_provider) - am install écrit les fichiers de config de l'agent avec le provider/modèle résolus ; --no-config / install.configurable:false / --dry-run respectés ; agent sans adaptateur → message clair, install réussit - Catalogue : blocs config: pour claude-code, codex, agentty (+ provider_default)
This commit is contained in:
@@ -157,6 +157,14 @@ pub fn run(
|
||||
}
|
||||
}
|
||||
|
||||
// Post-install provider configuration (issue #91): write the agent
|
||||
// config files with the resolved provider/model. Skipped on --no-config
|
||||
// and on agents declaring install.configurable: false; never reached in
|
||||
// dry-run (returns earlier).
|
||||
if !no_config && spec.configurable {
|
||||
crate::agent_config::apply_post_install(app, agent, &resolved)?;
|
||||
}
|
||||
|
||||
let entry = installers::make_entry(agent, method, &outcome, app);
|
||||
let version = entry.version.clone().unwrap_or_else(|| "unknown".to_string());
|
||||
app.state.set(&entry)?;
|
||||
@@ -207,7 +215,7 @@ fn resolve_provider_config(
|
||||
flag_model: Option<&str>,
|
||||
) -> Result<Option<(String, Option<String>)>> {
|
||||
let flag_p = flag_provider.filter(|p| !p.is_empty());
|
||||
let agent_p = agent.provider.as_deref().filter(|p| !p.is_empty());
|
||||
let agent_p = crate::agent_config::provider_pref(agent).filter(|p| !p.is_empty());
|
||||
|
||||
// Explicit provider requested but not registered: hard error.
|
||||
if let Some(p) = flag_p {
|
||||
@@ -241,7 +249,7 @@ fn resolve_provider_config(
|
||||
|
||||
let Some((pname, def, model)) = crate::providers::resolve_for(
|
||||
&app.config,
|
||||
agent.provider.as_deref(),
|
||||
crate::agent_config::provider_pref(agent),
|
||||
agent.model.as_deref(),
|
||||
flag_provider,
|
||||
flag_model,
|
||||
|
||||
+4
-3
@@ -317,14 +317,15 @@ pub fn resolve_exec(
|
||||
args.extend(agent.args.iter().cloned());
|
||||
args.extend(extra_args.iter().cloned());
|
||||
let mut env = agent.env.clone();
|
||||
// Issue #91: the `config.env_map` block, resolved against the agent's
|
||||
// provider — api_key stays the @secret reference (resolved below).
|
||||
crate::agent_config::apply_env_map(&mut env, agent, &app.config);
|
||||
env.extend(extra_env.clone());
|
||||
let warnings =
|
||||
crate::secrets::resolve_env_secrets(
|
||||
&crate::secrets::store(),
|
||||
&agent.name,
|
||||
agent
|
||||
.provider
|
||||
.as_deref()
|
||||
crate::agent_config::provider_pref(agent)
|
||||
.or_else(|| crate::providers::default_name(&app.config)),
|
||||
&mut env,
|
||||
);
|
||||
|
||||
@@ -198,6 +198,7 @@ mod tests {
|
||||
model_arg: None,
|
||||
provider: None,
|
||||
model: None,
|
||||
config: None,
|
||||
tags: tags.iter().map(|s| s.to_string()).collect(),
|
||||
installable: false,
|
||||
note: None,
|
||||
|
||||
Reference in New Issue
Block a user