devflow_core/agents/
opencode.rs1use super::{AgentAdapter, AgentDriver};
6use crate::phase_id::PhaseId;
7
8pub struct OpenCodeDriver;
11
12impl super::AgentDriver for OpenCodeDriver {
13 fn name(&self) -> &'static str {
14 "OpenCode"
15 }
16
17 fn render_prompt(&self, intent: &crate::prompt::StageIntent) -> String {
18 crate::prompt::render_claude_style(intent)
19 }
20
21 fn build_command(
22 &self,
23 _phase: PhaseId,
24 prompt: &str,
25 _extra_writable_roots: &[std::path::PathBuf],
26 ) -> (&'static str, Vec<String>) {
27 ("opencode", vec!["run".into(), prompt.to_string()])
28 }
29}
30
31pub struct OpenCodeAgent;
32
33impl AgentAdapter for OpenCodeAgent {
34 fn name(&self) -> &'static str {
35 "OpenCode"
36 }
37
38 fn exec_command(
39 &self,
40 phase: PhaseId,
41 prompt: &str,
42 extra_writable_roots: &[std::path::PathBuf],
43 ) -> (&'static str, Vec<String>) {
44 OpenCodeDriver.build_command(phase, prompt, extra_writable_roots)
45 }
46
47 fn completion_signal_detected(&self, _output: &str) -> bool {
48 false
49 }
50
51 fn render_prompt(&self, intent: &crate::prompt::StageIntent) -> String {
52 crate::prompt::render_claude_style(intent)
53 }
54}