use async_trait::async_trait;
use crate::error::FlowcatError;
pub use crate::types::{Finalize, ResolvedCall, ToolDecl, UploadTarget, Usage};
#[async_trait]
pub trait SessionSource: Send + Sync {
async fn resolve(&self, run_id: i64, token: &str) -> Result<ResolvedCall, FlowcatError>;
async fn complete(&self, run_id: i64, token: &str, fin: Finalize) -> Result<(), FlowcatError>;
async fn artifact_upload_url(
&self,
run_id: i64,
token: &str,
kind: &str,
) -> Result<UploadTarget, FlowcatError>;
async fn put_bytes(
&self,
url: &str,
bytes: Vec<u8>,
content_type: &str,
) -> Result<(), FlowcatError>;
async fn node_tools(
&self,
run_id: i64,
token: &str,
node_id: &str,
) -> Result<Vec<ToolDecl>, FlowcatError>;
async fn tool_call(
&self,
run_id: i64,
token: &str,
node_id: &str,
tool_name: &str,
args: &serde_json::Value,
) -> Result<String, FlowcatError>;
}