1use algocline_core::{EngineApi, QueryResponse};
2use async_trait::async_trait;
3
4use super::AppService;
5
6#[async_trait]
13impl EngineApi for AppService {
14 async fn run(
17 &self,
18 code: Option<String>,
19 code_file: Option<String>,
20 ctx: Option<serde_json::Value>,
21 project_root: Option<String>,
22 ) -> Result<String, String> {
23 AppService::run(self, code, code_file, ctx, project_root).await
24 }
25
26 async fn advice(
27 &self,
28 strategy: &str,
29 task: Option<String>,
30 opts: Option<serde_json::Value>,
31 project_root: Option<String>,
32 ) -> Result<String, String> {
33 AppService::advice(self, strategy, task, opts, project_root).await
34 }
35
36 async fn continue_single(
37 &self,
38 session_id: &str,
39 response: String,
40 query_id: Option<&str>,
41 usage: Option<algocline_core::TokenUsage>,
42 ) -> Result<String, String> {
43 AppService::continue_single(self, session_id, response, query_id, usage).await
44 }
45
46 async fn continue_batch(
47 &self,
48 session_id: &str,
49 responses: Vec<QueryResponse>,
50 ) -> Result<String, String> {
51 AppService::continue_batch(self, session_id, responses).await
52 }
53
54 async fn status(&self, session_id: Option<&str>) -> Result<String, String> {
57 AppService::status(self, session_id).await
58 }
59
60 async fn eval(
63 &self,
64 scenario: Option<String>,
65 scenario_file: Option<String>,
66 scenario_name: Option<String>,
67 strategy: &str,
68 strategy_opts: Option<serde_json::Value>,
69 ) -> Result<String, String> {
70 AppService::eval(
71 self,
72 scenario,
73 scenario_file,
74 scenario_name,
75 strategy,
76 strategy_opts,
77 )
78 .await
79 }
80
81 async fn eval_history(&self, strategy: Option<&str>, limit: usize) -> Result<String, String> {
82 AppService::eval_history(self, strategy, limit)
83 }
84
85 async fn eval_detail(&self, eval_id: &str) -> Result<String, String> {
86 AppService::eval_detail(self, eval_id)
87 }
88
89 async fn eval_compare(&self, eval_id_a: &str, eval_id_b: &str) -> Result<String, String> {
90 AppService::eval_compare(self, eval_id_a, eval_id_b).await
91 }
92
93 async fn scenario_list(&self) -> Result<String, String> {
96 AppService::scenario_list(self)
97 }
98
99 async fn scenario_show(&self, name: &str) -> Result<String, String> {
100 AppService::scenario_show(self, name)
101 }
102
103 async fn scenario_install(&self, url: String) -> Result<String, String> {
104 AppService::scenario_install(self, url).await
105 }
106
107 async fn pkg_link(
110 &self,
111 path: String,
112 name: Option<String>,
113 force: Option<bool>,
114 ) -> Result<String, String> {
115 AppService::pkg_link(self, path, name, force).await
116 }
117
118 async fn pkg_unlink(&self, name: String) -> Result<String, String> {
119 AppService::pkg_unlink(self, name).await
120 }
121
122 async fn pkg_list(&self, project_root: Option<String>) -> Result<String, String> {
123 AppService::pkg_list(self, project_root).await
124 }
125
126 async fn pkg_install(&self, url: String, name: Option<String>) -> Result<String, String> {
127 AppService::pkg_install(self, url, name).await
128 }
129
130 async fn pkg_remove(
131 &self,
132 name: &str,
133 project_root: Option<String>,
134 version: Option<String>,
135 ) -> Result<String, String> {
136 AppService::pkg_remove(self, name, project_root, version).await
137 }
138
139 async fn add_note(
142 &self,
143 session_id: &str,
144 content: &str,
145 title: Option<&str>,
146 ) -> Result<String, String> {
147 AppService::add_note(self, session_id, content, title).await
148 }
149
150 async fn log_view(
151 &self,
152 session_id: Option<&str>,
153 limit: Option<usize>,
154 max_chars: Option<usize>,
155 ) -> Result<String, String> {
156 AppService::log_view(self, session_id, limit, max_chars).await
157 }
158
159 async fn stats(
160 &self,
161 strategy_filter: Option<&str>,
162 days: Option<u64>,
163 ) -> Result<String, String> {
164 AppService::stats(self, strategy_filter, days)
165 }
166
167 async fn init(&self, project_root: Option<String>) -> Result<String, String> {
170 AppService::init(self, project_root).await
171 }
172
173 async fn update(&self, project_root: Option<String>) -> Result<String, String> {
174 AppService::update(self, project_root).await
175 }
176
177 async fn migrate(&self, project_root: Option<String>) -> Result<String, String> {
178 AppService::migrate(self, project_root).await
179 }
180
181 async fn info(&self) -> String {
184 AppService::info(self)
185 }
186}