Skip to main content

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