greentic_runner_host/engine/
api.rs

1use super::error::GResult;
2use greentic_types::TenantCtx;
3use serde::{Deserialize, Serialize};
4
5#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
6pub struct FlowSummary {
7    pub pack_id: String,
8    pub id: String,
9    pub name: String,
10    pub version: String,
11    pub description: Option<String>,
12}
13
14#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
15pub struct FlowSchema {
16    pub pack_id: String,
17    pub id: String,
18    pub schema_json: serde_json::Value,
19}
20
21#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
22pub struct RunFlowRequest {
23    pub tenant: TenantCtx,
24    pub pack_id: String,
25    pub flow_id: String,
26    pub input: serde_json::Value,
27    pub session_hint: Option<String>,
28}
29
30#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
31pub struct RunFlowResult {
32    /// Outcome is expressed using standard greentic-types semantics (Done/Pending/Error).
33    pub outcome: serde_json::Value,
34}
35
36#[async_trait::async_trait]
37pub trait RunnerApi: Send + Sync {
38    async fn list_flows(&self, tenant: &TenantCtx) -> GResult<Vec<FlowSummary>>;
39    async fn get_flow_schema(
40        &self,
41        tenant: &TenantCtx,
42        pack_id: &str,
43        flow_id: &str,
44    ) -> GResult<FlowSchema>;
45    async fn run_flow(&self, req: RunFlowRequest) -> GResult<RunFlowResult>;
46}