storkit: merge 343_refactor_abstract_agent_runtime_to_support_non_claude_code_backends
This commit is contained in:
@@ -117,6 +117,11 @@ pub struct AgentConfig {
|
||||
/// and marked as Failed. Default: 300 (5 minutes). Set to 0 to disable.
|
||||
#[serde(default = "default_inactivity_timeout_secs")]
|
||||
pub inactivity_timeout_secs: u64,
|
||||
/// Agent runtime backend. Controls how the agent process is spawned and
|
||||
/// how events are streamed. Default: `"claude-code"` (spawns the `claude`
|
||||
/// CLI in a PTY). Future values: `"openai"`, `"gemini"`.
|
||||
#[serde(default)]
|
||||
pub runtime: Option<String>,
|
||||
}
|
||||
|
||||
fn default_path() -> String {
|
||||
@@ -178,6 +183,7 @@ impl Default for ProjectConfig {
|
||||
system_prompt: None,
|
||||
stage: None,
|
||||
inactivity_timeout_secs: default_inactivity_timeout_secs(),
|
||||
runtime: None,
|
||||
}],
|
||||
watcher: WatcherConfig::default(),
|
||||
default_qa: default_qa(),
|
||||
@@ -370,6 +376,17 @@ fn validate_agents(agents: &[AgentConfig]) -> Result<(), String> {
|
||||
agent.name
|
||||
));
|
||||
}
|
||||
if let Some(ref runtime) = agent.runtime {
|
||||
match runtime.as_str() {
|
||||
"claude-code" => {}
|
||||
other => {
|
||||
return Err(format!(
|
||||
"Agent '{}': unknown runtime '{other}'. Supported: 'claude-code'",
|
||||
agent.name
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
@@ -792,6 +809,43 @@ name = "coder-1"
|
||||
assert_eq!(config.max_coders, Some(3));
|
||||
}
|
||||
|
||||
// ── runtime config ────────────────────────────────────────────────
|
||||
|
||||
#[test]
|
||||
fn runtime_defaults_to_none() {
|
||||
let toml_str = r#"
|
||||
[[agent]]
|
||||
name = "coder"
|
||||
"#;
|
||||
let config = ProjectConfig::parse(toml_str).unwrap();
|
||||
assert_eq!(config.agent[0].runtime, None);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn runtime_claude_code_accepted() {
|
||||
let toml_str = r#"
|
||||
[[agent]]
|
||||
name = "coder"
|
||||
runtime = "claude-code"
|
||||
"#;
|
||||
let config = ProjectConfig::parse(toml_str).unwrap();
|
||||
assert_eq!(
|
||||
config.agent[0].runtime,
|
||||
Some("claude-code".to_string())
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn runtime_unknown_rejected() {
|
||||
let toml_str = r#"
|
||||
[[agent]]
|
||||
name = "coder"
|
||||
runtime = "openai"
|
||||
"#;
|
||||
let err = ProjectConfig::parse(toml_str).unwrap_err();
|
||||
assert!(err.contains("unknown runtime 'openai'"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn project_toml_has_three_sonnet_coders() {
|
||||
let manifest_dir = std::path::Path::new(env!("CARGO_MANIFEST_DIR"));
|
||||
|
||||
Reference in New Issue
Block a user