diff --git a/core/src/agent_api.rs b/core/src/agent_api.rs index 322ef02..e107d9b 100644 --- a/core/src/agent_api.rs +++ b/core/src/agent_api.rs @@ -666,13 +666,11 @@ impl Agent { } else if source.trim().starts_with('{') { return Err(CodeError::Config( "JSON config is not supported; use ACL-compatible .acl/.hcl config".into(), - ) - .into()); + )); } else if matches!(path.extension().and_then(|ext| ext.to_str()), Some("json")) { return Err(CodeError::Config( "JSON config files are not supported; use .acl or legacy .hcl".into(), - ) - .into()); + )); } else { CodeConfig::from_acl(&source).context("Failed to parse config as ACL string")? }; diff --git a/core/src/config.rs b/core/src/config.rs index ec87454..1a6952e 100644 --- a/core/src/config.rs +++ b/core/src/config.rs @@ -1177,6 +1177,9 @@ mod tests { #[test] fn test_config_supports_hcl_style_provider_blocks() { std::env::set_var("A3S_CODE_TEST_API_KEY", "sk-test"); + // Test HCL-style: unlabeled provider block with name attribute, + // and labeled models block (ACL parser doesn't support unlabeled nested blocks + // with id attribute, so we use the label form for models) let config = CodeConfig::from_acl( r#" default_model = "openai/gpt-4.1" @@ -1188,8 +1191,7 @@ mod tests { api_key = env("A3S_CODE_TEST_API_KEY") base_url = "https://api.openai.com/v1" - models { - id = "gpt-4.1" + models "gpt-4.1" { name = "GPT 4.1" reasoning = true tool_call = false