Skip to content

Commit 0a6067c

Browse files
authored
refactor: rename ACP "provider" to "runtime" across the codebase (#783)
1 parent 056b87d commit 0a6067c

69 files changed

Lines changed: 1255 additions & 747 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎crates/sprout-cli/src/commands/pack.rs‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,11 @@ pub fn cmd_inspect(path: &str) -> Result<(), CliError> {
7474
println!(" Display: {}", persona.display_name);
7575
println!(" Description: {}", persona.description);
7676

77-
if let Some(ref provider) = persona.provider {
77+
if let Some(ref llm_provider) = persona.llm_provider {
7878
if let Some(ref model) = persona.model {
79-
println!(" Model: {provider}:{model}");
79+
println!(" Model: {llm_provider}:{model}");
8080
} else {
81-
println!(" Provider: {provider}");
81+
println!(" Provider: {llm_provider}");
8282
}
8383
} else if let Some(ref model) = persona.model {
8484
println!(" Model: {model}");

‎crates/sprout-persona/src/pack.rs‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,8 @@ pub struct LoadedPersona {
8585
pub description: String,
8686
pub avatar: Option<String>,
8787
pub model: Option<String>,
88+
/// Preferred ACP runtime ID from the persona config (e.g., 'goose', 'claude').
89+
pub runtime: Option<String>,
8890
pub temperature: Option<f64>,
8991
pub max_context_tokens: Option<u64>,
9092
pub subscribe: Vec<String>,
@@ -440,6 +442,7 @@ fn parse_persona_file(
440442
description: pc.description,
441443
avatar: pc.avatar,
442444
model: resolved.model,
445+
runtime: pc.runtime.clone(),
443446
temperature: resolved.temperature,
444447
max_context_tokens: resolved.max_context_tokens,
445448
subscribe: resolved.subscribe.unwrap_or_default(),
@@ -634,6 +637,7 @@ You are Berry, a fast and direct worker.
634637
description: String::new(),
635638
avatar: None,
636639
model: None,
640+
runtime: None,
637641
temperature: None,
638642
max_context_tokens: None,
639643
subscribe: vec![],

‎crates/sprout-persona/src/persona.rs‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,11 @@ pub struct PersonaConfig {
154154
#[serde(skip_serializing_if = "Option::is_none")]
155155
pub model: Option<String>,
156156

157+
/// Preferred ACP runtime ID (e.g., 'goose', 'claude'). Maps to PersonaRecord.runtime during
158+
/// pack import.
159+
#[serde(skip_serializing_if = "Option::is_none")]
160+
pub runtime: Option<String>,
161+
157162
#[serde(skip_serializing_if = "Option::is_none")]
158163
pub temperature: Option<f64>,
159164

@@ -200,6 +205,7 @@ struct Frontmatter {
200205
#[serde(alias = "respond_to")]
201206
triggers: Option<RespondTo>,
202207
model: Option<String>,
208+
runtime: Option<String>,
203209
temperature: Option<f64>,
204210
max_context_tokens: Option<u64>,
205211
thread_replies: Option<bool>,
@@ -260,6 +266,7 @@ pub fn parse_persona_md(content: &str) -> Result<PersonaConfig, PersonaError> {
260266
subscribe: fm.subscribe,
261267
triggers: fm.triggers,
262268
model: fm.model,
269+
runtime: fm.runtime,
263270
temperature: fm.temperature,
264271
max_context_tokens: fm.max_context_tokens,
265272
thread_replies: fm.thread_replies,

‎crates/sprout-persona/src/resolve.rs‎

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,12 @@ pub struct ResolvedPersona {
3535

3636
// → Config.model (plain model ID, post-split)
3737
pub model: Option<String>,
38-
// → PersonaRecord.provider (for desktop display / GOOSE_PROVIDER env)
39-
pub provider: Option<String>,
38+
/// LLM inference provider extracted from the model string colon prefix (e.g., 'databricks'
39+
/// from 'databricks:model-id'). Flows into harness-specific env vars (GOOSE_PROVIDER) only.
40+
pub llm_provider: Option<String>,
41+
/// Preferred ACP runtime ID from the persona config (e.g., 'goose', 'claude'). Maps to
42+
/// PersonaRecord.runtime during pack import.
43+
pub runtime: Option<String>,
4044
pub temperature: Option<f64>,
4145
pub max_context_tokens: Option<u64>,
4246

@@ -200,7 +204,7 @@ fn resolve_one_persona(
200204
let system_prompt = compose_prompt(&lp.prompt, pack_instructions);
201205

202206
// Split "provider:model-id" into separate fields (V3 contract).
203-
let (provider, model) = match lp.model.as_deref() {
207+
let (llm_provider, model) = match lp.model.as_deref() {
204208
Some(s) if !s.trim().is_empty() => {
205209
let (prov, id) = split_model(s);
206210
(
@@ -231,7 +235,8 @@ fn resolve_one_persona(
231235
version,
232236
system_prompt,
233237
model,
234-
provider,
238+
llm_provider,
239+
runtime: lp.runtime.clone(),
235240
temperature: lp.temperature,
236241
max_context_tokens: lp.max_context_tokens,
237242
subscribe: lp.subscribe.clone(),
@@ -642,7 +647,7 @@ mod tests {
642647
assert_eq!(p.name, "bot");
643648
assert_eq!(p.system_prompt, "You are Bot.\n");
644649
assert!(p.model.is_none());
645-
assert!(p.provider.is_none());
650+
assert!(p.llm_provider.is_none());
646651
assert!(p.triggers.mentions); // built-in default
647652
assert!(p.mcp_servers.is_empty());
648653
assert!(p.goose_env_vars.is_empty());
@@ -685,7 +690,7 @@ mod tests {
685690

686691
// Model split into separate fields (V3 contract)
687692
assert_eq!(p.model.as_deref(), Some("claude-sonnet-4-20250514"));
688-
assert_eq!(p.provider.as_deref(), Some("anthropic"));
693+
assert_eq!(p.llm_provider.as_deref(), Some("anthropic"));
689694

690695
// Env vars projected
691696
let env_map: HashMap<&str, &str> = p
@@ -740,10 +745,10 @@ mod tests {
740745

741746
// pip overrides model
742747
assert_eq!(pip.model.as_deref(), Some("claude-4-opus-20250514"));
743-
assert_eq!(pip.provider.as_deref(), Some("anthropic"));
748+
assert_eq!(pip.llm_provider.as_deref(), Some("anthropic"));
744749
// lep inherits model from defaults
745750
assert_eq!(lep.model.as_deref(), Some("claude-sonnet-4-20250514"));
746-
assert_eq!(lep.provider.as_deref(), Some("anthropic"));
751+
assert_eq!(lep.llm_provider.as_deref(), Some("anthropic"));
747752

748753
// pip inherits temperature from defaults
749754
assert_eq!(pip.temperature, Some(0.7));
@@ -835,7 +840,7 @@ mod tests {
835840
let pack = resolve_pack(dir).unwrap();
836841
let p = &pack.personas[0];
837842
assert_eq!(p.model.as_deref(), Some("gpt-4o"));
838-
assert_eq!(p.provider.as_deref(), Some("openai"));
843+
assert_eq!(p.llm_provider.as_deref(), Some("openai"));
839844
}
840845

841846
#[test]
@@ -859,7 +864,7 @@ mod tests {
859864
let pack = resolve_pack(dir).unwrap();
860865
let p = &pack.personas[0];
861866
assert_eq!(p.model.as_deref(), Some("gpt-4o"));
862-
assert!(p.provider.is_none());
867+
assert!(p.llm_provider.is_none());
863868
}
864869

865870
// ── Test helpers ──────────────────────────────────────────────────────
@@ -876,6 +881,7 @@ mod tests {
876881
description: "A test persona.".into(),
877882
avatar: None,
878883
model: model.map(str::to_owned),
884+
runtime: None,
879885
temperature,
880886
max_context_tokens,
881887
subscribe: vec![],

‎crates/sprout-persona/tests/integration.rs‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -426,12 +426,12 @@ fn resolve_full_pipeline() {
426426
assert_eq!(pip.description, "Orchestration agent");
427427
assert_eq!(pip.version, "1.0.0"); // defaults to pack version
428428

429-
// Model split: "anthropic:claude-4-opus-20250514" → provider + model
430-
assert_eq!(pip.provider.as_deref(), Some("anthropic"));
429+
// Model split: "anthropic:claude-4-opus-20250514" → llm_provider + model
430+
assert_eq!(pip.llm_provider.as_deref(), Some("anthropic"));
431431
assert_eq!(pip.model.as_deref(), Some("claude-4-opus-20250514"));
432432

433433
// Lep inherits pack default model
434-
assert_eq!(lep.provider.as_deref(), Some("anthropic"));
434+
assert_eq!(lep.llm_provider.as_deref(), Some("anthropic"));
435435
assert_eq!(lep.model.as_deref(), Some("claude-sonnet-4-20250514"));
436436

437437
// System prompt composed: persona body + pack instructions
@@ -544,12 +544,12 @@ fn resolve_multi_persona_pack() {
544544
.unwrap();
545545

546546
// Alpha overrides model and temperature
547-
assert_eq!(alpha.provider.as_deref(), Some("anthropic"));
547+
assert_eq!(alpha.llm_provider.as_deref(), Some("anthropic"));
548548
assert_eq!(alpha.model.as_deref(), Some("claude-sonnet-4-20250514"));
549549
assert_eq!(alpha.temperature, Some(0.9));
550550

551551
// Beta inherits all defaults
552-
assert_eq!(beta.provider.as_deref(), Some("openai"));
552+
assert_eq!(beta.llm_provider.as_deref(), Some("openai"));
553553
assert_eq!(beta.model.as_deref(), Some("gpt-4o"));
554554
assert_eq!(beta.temperature, Some(0.5));
555555
assert!(beta.thread_replies);

‎desktop/scripts/check-file-sizes.mjs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ const overrides = new Map([
3636
["src/shared/api/tauri.ts", 1196],
3737
["src-tauri/src/nostr_convert.rs", 1116],
3838
["src/shared/api/relayClientSession.ts", 1022],
39-
["src-tauri/src/migration.rs", 1005],
39+
["src-tauri/src/migration.rs", 1130],
4040
]);
4141

4242
await runFileSizeCheck({

‎desktop/src-tauri/src/commands/agent_discovery.rs‎

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use tauri::State;
44
use crate::{
55
app_state::AppState,
66
managed_agents::{
7-
command_availability, AcpProviderCatalogEntry, DiscoverManagedAgentPrereqsRequest,
7+
command_availability, AcpRuntimeCatalogEntry, DiscoverManagedAgentPrereqsRequest,
88
InstallRuntimeResult, InstallStepResult, ManagedAgentPrereqsInfo, RelayAgentInfo,
99
DEFAULT_ACP_COMMAND,
1010
},
@@ -20,29 +20,29 @@ fn active_installs() -> &'static std::sync::Mutex<std::collections::HashSet<Stri
2020
}
2121

2222
#[tauri::command]
23-
pub fn discover_acp_providers() -> Vec<AcpProviderCatalogEntry> {
23+
pub fn discover_acp_providers() -> Vec<AcpRuntimeCatalogEntry> {
2424
crate::managed_agents::clear_resolve_cache();
25-
crate::managed_agents::discover_acp_providers()
25+
crate::managed_agents::discover_acp_runtimes()
2626
}
2727

2828
#[tauri::command]
29-
pub async fn install_acp_runtime(provider_id: String) -> Result<InstallRuntimeResult, String> {
30-
tokio::task::spawn_blocking(move || install_acp_runtime_blocking(&provider_id))
29+
pub async fn install_acp_runtime(runtime_id: String) -> Result<InstallRuntimeResult, String> {
30+
tokio::task::spawn_blocking(move || install_acp_runtime_blocking(&runtime_id))
3131
.await
3232
.map_err(|e| format!("install task panicked: {e}"))?
3333
}
3434

3535
/// Err(_) = infrastructure failure (panic, concurrency guard).
3636
/// Ok({success: false}) = an install step failed (stderr captured in steps).
37-
fn install_acp_runtime_blocking(provider_id: &str) -> Result<InstallRuntimeResult, String> {
38-
// Prevent concurrent installs for the same provider.
37+
fn install_acp_runtime_blocking(runtime_id: &str) -> Result<InstallRuntimeResult, String> {
38+
// Prevent concurrent installs for the same runtime.
3939
{
4040
let mut set = active_installs()
4141
.lock()
4242
.map_err(|_| "install lock poisoned".to_string())?;
43-
if !set.insert(provider_id.to_string()) {
43+
if !set.insert(runtime_id.to_string()) {
4444
return Err(format!(
45-
"an install is already in progress for {provider_id}"
45+
"an install is already in progress for {runtime_id}"
4646
));
4747
}
4848
}
@@ -55,17 +55,17 @@ fn install_acp_runtime_blocking(provider_id: &str) -> Result<InstallRuntimeResul
5555
}
5656
}
5757
}
58-
let _guard = Guard(provider_id.to_string());
58+
let _guard = Guard(runtime_id.to_string());
5959

60-
let provider = crate::managed_agents::known_acp_provider_exact(provider_id)
61-
.ok_or_else(|| format!("unknown provider: {provider_id}"))?;
60+
let runtime = crate::managed_agents::known_acp_runtime_exact(runtime_id)
61+
.ok_or_else(|| format!("unknown runtime: {runtime_id}"))?;
6262

6363
let mut steps = Vec::new();
6464

6565
// Phase 1: Install CLI if missing and commands are available.
66-
if let Some(cli) = provider.underlying_cli {
66+
if let Some(cli) = runtime.underlying_cli {
6767
if crate::managed_agents::resolve_command(cli).is_none() {
68-
for cmd in provider.cli_install_commands {
68+
for cmd in runtime.cli_install_commands {
6969
let result = run_install_command("cli", cmd);
7070
let success = result.success;
7171
steps.push(result);
@@ -80,12 +80,12 @@ fn install_acp_runtime_blocking(provider_id: &str) -> Result<InstallRuntimeResul
8080
}
8181

8282
// Phase 2: Install adapter if missing and commands are available.
83-
let adapter_found = provider
83+
let adapter_found = runtime
8484
.commands
8585
.iter()
8686
.any(|cmd| crate::managed_agents::resolve_command(cmd).is_some());
8787
if !adapter_found {
88-
for cmd in provider.adapter_install_commands {
88+
for cmd in runtime.adapter_install_commands {
8989
let result = run_install_command("adapter", cmd);
9090
let success = result.success;
9191
steps.push(result);

‎desktop/src-tauri/src/commands/agent_models.rs‎

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use crate::{
77
app_state::AppState,
88
managed_agents::{
99
build_managed_agent_summary, default_agent_workdir, find_managed_agent_mut,
10-
load_managed_agents, managed_agent_avatar_url, missing_command_message,
10+
known_acp_runtime, load_managed_agents, managed_agent_avatar_url, missing_command_message,
1111
normalize_agent_args, resolve_command, save_managed_agents, sync_managed_agent_processes,
1212
try_regenerate_nest, AgentModelInfo, AgentModelsResponse, UpdateManagedAgentRequest,
1313
UpdateManagedAgentResponse,
@@ -84,11 +84,14 @@ pub async fn get_agent_models(
8484
cmd.arg("models")
8585
.arg("--json")
8686
.env("SPROUT_ACP_AGENT_COMMAND", &agent_command)
87-
.env("SPROUT_ACP_AGENT_ARGS", agent_args.join(","))
88-
.env(
89-
"GOOSE_MODE",
90-
std::env::var("GOOSE_MODE").unwrap_or_else(|_| "auto".into()),
91-
);
87+
.env("SPROUT_ACP_AGENT_ARGS", agent_args.join(","));
88+
if let Some(meta) = known_acp_runtime(&agent_command) {
89+
for (key, value) in meta.default_env {
90+
if std::env::var(key).is_err() {
91+
cmd.env(key, value);
92+
}
93+
}
94+
}
9295
// User env layering — written LAST so it overrides any Sprout-set env above.
9396
for (k, v) in &merged_env {
9497
cmd.env(k, v);

‎desktop/src-tauri/src/commands/agents.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@ pub async fn create_managed_agent(
407407
.filter(|value| !value.is_empty())
408408
.map(str::to_string)
409409
.unwrap_or_else(
410-
|| match crate::managed_agents::known_acp_provider(&agent_command) {
410+
|| match crate::managed_agents::known_acp_runtime(&agent_command) {
411411
Some(p) => p.mcp_command.unwrap_or("").to_string(),
412412
None => String::new(),
413413
},

‎desktop/src-tauri/src/commands/personas.rs‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ pub fn create_persona(
5151
let display_name = trim_required(&input.display_name, "Display name")?;
5252
let system_prompt = trim_required(&input.system_prompt, "System prompt")?;
5353
let avatar_url = trim_optional(input.avatar_url);
54-
let provider = trim_optional(input.provider);
54+
let runtime = trim_optional(input.runtime);
5555
let model = trim_optional(input.model);
5656
let now = now_iso();
5757

@@ -72,7 +72,7 @@ pub fn create_persona(
7272
display_name,
7373
avatar_url,
7474
system_prompt,
75-
provider,
75+
runtime,
7676
model,
7777
name_pool,
7878
is_builtin: false,
@@ -98,7 +98,7 @@ pub fn update_persona(
9898
let display_name = trim_required(&input.display_name, "Display name")?;
9999
let system_prompt = trim_required(&input.system_prompt, "System prompt")?;
100100
let avatar_url = trim_optional(input.avatar_url);
101-
let provider = trim_optional(input.provider);
101+
let runtime = trim_optional(input.runtime);
102102
let model = trim_optional(input.model);
103103

104104
let _store_guard = state
@@ -117,7 +117,7 @@ pub fn update_persona(
117117
persona.display_name = display_name;
118118
persona.avatar_url = avatar_url;
119119
persona.system_prompt = system_prompt;
120-
persona.provider = provider;
120+
persona.runtime = runtime;
121121
persona.model = model;
122122
persona.name_pool = input
123123
.name_pool
@@ -335,7 +335,7 @@ pub async fn export_persona_to_json(
335335
// forked, distributed), and bundling API keys / credentials in them
336336
// would be a significant footgun. Users who import a card and need
337337
// credentials must supply them post-import via the persona dialog.
338-
let (display_name, system_prompt, avatar_url, provider, model, name_pool) = {
338+
let (display_name, system_prompt, avatar_url, runtime, model, name_pool) = {
339339
let _store_guard = state
340340
.managed_agents_store_lock
341341
.lock()
@@ -349,7 +349,7 @@ pub async fn export_persona_to_json(
349349
persona.display_name.clone(),
350350
persona.system_prompt.clone(),
351351
persona.avatar_url.clone(),
352-
persona.provider.clone(),
352+
persona.runtime.clone(),
353353
persona.model.clone(),
354354
persona.name_pool.clone(),
355355
)
@@ -359,7 +359,7 @@ pub async fn export_persona_to_json(
359359
&display_name,
360360
&system_prompt,
361361
avatar_url.as_deref(),
362-
provider.as_deref(),
362+
runtime.as_deref(),
363363
model.as_deref(),
364364
&name_pool,
365365
)?;

0 commit comments

Comments
 (0)