runtime_provision: migrate provider_alias_for to v0.8.3 families
Auto-provision (and every other build_team caller) hit 'dangling_reference: claude_cli is not a known provider family' because provider_alias_for still returned v0.7.x aliases — claude_cli.default / claude_cli.glm / claude_cli.glm5 / kimi_cli.default — all deleted upstream when providers.models schema was restructured. Now the mapping resolves to real configured aliases: - 'claude'* prefix → anthropic.default - 'gemini'* prefix → gemini.default - 'llama'* / 'groq' → groq.default - glm* + kimi* → anthropic.default (fallback until glm.default / moonshot.default provider tables land in the runtime template) - unknown → anthropic.default Covers the model picker's full roster (claude-sonnet-5 / opus-4-8 / haiku-4-5 / sonnet-4-6 / glm-4.6 / glm-5.2 / kimi-k2 / gemini-2.0-flash / llama-3.3-70b-versatile) plus every legacy shorthand. Tests updated to assert the new mappings including the model picker's ids.
This commit is contained in:
@@ -18,16 +18,37 @@ pub fn claw_alias(claw_id: Uuid) -> String {
|
|||||||
format!("claw_{}", claw_id.simple())
|
format!("claw_{}", claw_id.simple())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Map a claw's chosen model to an EXISTING runtime provider alias (no new
|
/// Map a claw's chosen model to a configured provider alias.
|
||||||
/// provider provisioning for v1). Unknown → Claude default.
|
///
|
||||||
|
/// v0.8.3 fold: `claude_cli.*` and `kimi_cli.*` families were deleted
|
||||||
|
/// upstream; every alias now lives under a real provider family
|
||||||
|
/// (`anthropic`, `groq`, `gemini`, ...). Our compose currently
|
||||||
|
/// configures `anthropic.default`, `anthropic.door`, `groq.default`,
|
||||||
|
/// and `gemini.default`, so unknown models resolve to
|
||||||
|
/// `anthropic.default` — the workspace's high-quality baseline.
|
||||||
pub fn provider_alias_for(model: &str) -> &'static str {
|
pub fn provider_alias_for(model: &str) -> &'static str {
|
||||||
match model.trim().to_ascii_lowercase().as_str() {
|
let m = model.trim().to_ascii_lowercase();
|
||||||
"glm" | "glm-4.7" | "glm4.7" => "claude_cli.glm",
|
// Prefix families first (covers claude-sonnet-5, claude-opus-4-8,
|
||||||
"glm-5.2" | "glm5.2" | "glm5" => "claude_cli.glm5",
|
// claude-haiku-4-5-*, etc.) then explicit aliases.
|
||||||
"kimi" | "kimi-for-coding" => "kimi_cli.default",
|
if m.starts_with("claude") {
|
||||||
"gemini" | "gemini-2.5-flash" => "gemini.default",
|
return "anthropic.default";
|
||||||
"groq" | "llama" => "groq.default",
|
}
|
||||||
_ => "claude_cli.default", // "claude" / unknown
|
if m.starts_with("gemini") {
|
||||||
|
return "gemini.default";
|
||||||
|
}
|
||||||
|
if m.starts_with("llama") || m.starts_with("groq") {
|
||||||
|
return "groq.default";
|
||||||
|
}
|
||||||
|
match m.as_str() {
|
||||||
|
// GLM + Kimi families fall back to anthropic today because we
|
||||||
|
// haven't stood up `glm.default` / `moonshot.default` provider
|
||||||
|
// rows in the runtime template. Swap to their own family aliases
|
||||||
|
// once the compose env carries the corresponding provider config.
|
||||||
|
"glm" | "glm-4.6" | "glm4.6" | "glm-4.7" | "glm4.7" | "glm-5.2" | "glm5.2" | "glm5" => {
|
||||||
|
"anthropic.default"
|
||||||
|
}
|
||||||
|
"kimi" | "kimi-k2" | "kimi-for-coding" => "anthropic.default",
|
||||||
|
_ => "anthropic.default",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -195,10 +216,20 @@ mod tests {
|
|||||||
#[test]
|
#[test]
|
||||||
fn provider_alias_mapping() {
|
fn provider_alias_mapping() {
|
||||||
assert_eq!(provider_alias_for("gemini"), "gemini.default");
|
assert_eq!(provider_alias_for("gemini"), "gemini.default");
|
||||||
assert_eq!(provider_alias_for("GLM-4.7"), "claude_cli.glm");
|
assert_eq!(provider_alias_for("gemini-2.0-flash"), "gemini.default");
|
||||||
assert_eq!(provider_alias_for("kimi"), "kimi_cli.default");
|
// v0.8.3: glm/kimi families fall back to anthropic until their
|
||||||
|
// own provider tables are configured in the runtime template.
|
||||||
|
assert_eq!(provider_alias_for("GLM-4.7"), "anthropic.default");
|
||||||
|
assert_eq!(provider_alias_for("kimi"), "anthropic.default");
|
||||||
assert_eq!(provider_alias_for("groq"), "groq.default");
|
assert_eq!(provider_alias_for("groq"), "groq.default");
|
||||||
assert_eq!(provider_alias_for("anything-else"), "claude_cli.default");
|
assert_eq!(
|
||||||
|
provider_alias_for("llama-3.3-70b-versatile"),
|
||||||
|
"groq.default"
|
||||||
|
);
|
||||||
|
assert_eq!(provider_alias_for("claude"), "anthropic.default");
|
||||||
|
assert_eq!(provider_alias_for("claude-sonnet-5"), "anthropic.default");
|
||||||
|
assert_eq!(provider_alias_for("claude-opus-4-8"), "anthropic.default");
|
||||||
|
assert_eq!(provider_alias_for("anything-else"), "anthropic.default");
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|||||||
Reference in New Issue
Block a user