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 ) -> Result<String, String> {
22 AppService::run(self, code, code_file, ctx).await
23 }
24
25 async fn advice(
26 &self,
27 strategy: &str,
28 task: Option<String>,
29 opts: Option<serde_json::Value>,
30 ) -> Result<String, String> {
31 AppService::advice(self, strategy, task, opts).await
32 }
33
34 async fn continue_single(
35 &self,
36 session_id: &str,
37 response: String,
38 query_id: Option<&str>,
39 usage: Option<algocline_core::TokenUsage>,
40 ) -> Result<String, String> {
41 AppService::continue_single(self, session_id, response, query_id, usage).await
42 }
43
44 async fn continue_batch(
45 &self,
46 session_id: &str,
47 responses: Vec<QueryResponse>,
48 ) -> Result<String, String> {
49 AppService::continue_batch(self, session_id, responses).await
50 }
51
52 async fn status(&self, session_id: Option<&str>) -> Result<String, String> {
55 AppService::status(self, session_id).await
56 }
57
58 async fn eval(
61 &self,
62 scenario: Option<String>,
63 scenario_file: Option<String>,
64 scenario_name: Option<String>,
65 strategy: &str,
66 strategy_opts: Option<serde_json::Value>,
67 ) -> Result<String, String> {
68 AppService::eval(
69 self,
70 scenario,
71 scenario_file,
72 scenario_name,
73 strategy,
74 strategy_opts,
75 )
76 .await
77 }
78
79 async fn eval_history(&self, strategy: Option<&str>, limit: usize) -> Result<String, String> {
80 AppService::eval_history(self, strategy, limit)
81 }
82
83 async fn eval_detail(&self, eval_id: &str) -> Result<String, String> {
84 AppService::eval_detail(self, eval_id)
85 }
86
87 async fn eval_compare(&self, eval_id_a: &str, eval_id_b: &str) -> Result<String, String> {
88 AppService::eval_compare(self, eval_id_a, eval_id_b).await
89 }
90
91 async fn scenario_list(&self) -> Result<String, String> {
94 AppService::scenario_list(self)
95 }
96
97 async fn scenario_show(&self, name: &str) -> Result<String, String> {
98 AppService::scenario_show(self, name)
99 }
100
101 async fn scenario_install(&self, url: String) -> Result<String, String> {
102 AppService::scenario_install(self, url).await
103 }
104
105 async fn pkg_list(&self) -> Result<String, String> {
108 AppService::pkg_list(self).await
109 }
110
111 async fn pkg_install(&self, url: String, name: Option<String>) -> Result<String, String> {
112 AppService::pkg_install(self, url, name).await
113 }
114
115 async fn pkg_remove(&self, name: &str) -> Result<String, String> {
116 AppService::pkg_remove(self, name).await
117 }
118
119 async fn add_note(
122 &self,
123 session_id: &str,
124 content: &str,
125 title: Option<&str>,
126 ) -> Result<String, String> {
127 AppService::add_note(self, session_id, content, title).await
128 }
129
130 async fn log_view(
131 &self,
132 session_id: Option<&str>,
133 limit: Option<usize>,
134 max_chars: Option<usize>,
135 ) -> Result<String, String> {
136 AppService::log_view(self, session_id, limit, max_chars).await
137 }
138
139 async fn stats(
140 &self,
141 strategy_filter: Option<&str>,
142 days: Option<u64>,
143 ) -> Result<String, String> {
144 AppService::stats(self, strategy_filter, days)
145 }
146
147 async fn info(&self) -> String {
150 AppService::info(self)
151 }
152}