Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

refactor(flows): rename tinyflows module to state

Steven Enamakel1e08e64abd9a
diff --git a/crates/openhuman-core/src/flows/tinyflows/state.rs b/crates/openhuman-core/src/flows/tinyflows/state.rs
index 482257958d..024909f934 100644
--- a/crates/openhuman-core/src/flows/tinyflows/state.rs
+++ b/crates/openhuman-core/src/flows/tinyflows/state.rs
@@ -2,12 +2,11 @@
//!
//! The engine reads and writes it through `StateStore` during a run, and the
//! dedup settlement (`flows::bus::dedup_commit`) reads it back through
-//! `DedupKv` after the run, so both must name the same records. Without a
-//! storage backend that is `tinyflows_sqlite::flows::SqliteStateStore` over
-//! `flows/flows.db`; with one it is
-//! `tinyflows_drivers::catalog::FlowStateDocuments` in the acting agent's
-//! scope. When the scope cannot be resolved (SaaS mode with no acting agent)
-//! every call fails instead of falling back to the local file.
+//! `DedupKv` after the run, so both must name the same records. They are
+//! `tinyflows_drivers::catalog::FlowStateDocuments` in the acting agent's scope
+//! of the flow catalog's storage (`flows::store`). When the scope cannot be
+//! resolved (SaaS mode with no acting agent) every call fails instead of
+//! falling back to a shared bucket.
use std::sync::Arc;
@@ -17,16 +16,13 @@ use tinyflows::caps::StateStore;
use tinyflows::error::{EngineError, Result as EngineResult};
use tinyflows::nodes::control_flow::dedup_settle::DedupKv;
use tinyflows_drivers::catalog::FlowStateDocuments;
-use tinyflows_sqlite::flows::SqliteStateStore;
use crate::config::Config;
/// One flow's state namespace on the store this call resolves to.
#[derive(Debug, Clone)]
pub enum FlowState {
- /// `flows/flows.db` (no storage backend).
- Sqlite(SqliteStateStore),
- /// The storage backend's catalog.
+ /// The flow catalog's storage.
Documents(FlowStateDocuments),
/// The storage scope could not be resolved; every call fails with this.
Unavailable(String),
@@ -37,11 +33,7 @@ impl FlowState {
pub fn open(config: &Config, namespace: impl Into<String>) -> Self {
let namespace = namespace.into();
match crate::flows::store::documents(config) {
- Ok(Some(catalog)) => Self::Documents(FlowStateDocuments::new(catalog, namespace)),
- Ok(None) => Self::Sqlite(SqliteStateStore::new(
- crate::flows::store::dir(config),
- namespace,
- )),
+ Ok(catalog) => Self::Documents(FlowStateDocuments::new(catalog, namespace)),
Err(error) => {
tracing::warn!(
target: "flows",
@@ -67,7 +59,6 @@ impl FlowState {
impl StateStore for FlowState {
async fn load(&self, key: &str) -> EngineResult<Option<Value>> {
match self {
- Self::Sqlite(store) => store.load(key).await,
Self::Documents(store) => store.load(key).await,
Self::Unavailable(reason) => Err(EngineError::Capability(Self::unavailable(reason))),
}
@@ -75,7 +66,6 @@ impl StateStore for FlowState {
async fn store(&self, key: &str, value: Value) -> EngineResult<()> {
match self {
- Self::Sqlite(store) => store.store(key, value).await,
Self::Documents(store) => store.store(key, value).await,
Self::Unavailable(reason) => Err(EngineError::Capability(Self::unavailable(reason))),
}
@@ -85,7 +75,6 @@ impl StateStore for FlowState {
impl DedupKv for FlowState {
fn kv_get(&self, key: &str) -> std::result::Result<Option<Value>, String> {
match self {
- Self::Sqlite(store) => store.kv_get(key),
Self::Documents(store) => store.kv_get(key),
Self::Unavailable(reason) => Err(Self::unavailable(reason)),
}
@@ -93,7 +82,6 @@ impl DedupKv for FlowState {
fn kv_set(&self, key: &str, value: &Value) -> std::result::Result<(), String> {
match self {
- Self::Sqlite(store) => store.kv_set(key, value),
Self::Documents(store) => store.kv_set(key, value),
Self::Unavailable(reason) => Err(Self::unavailable(reason)),
}
@@ -101,7 +89,6 @@ impl DedupKv for FlowState {
fn kv_delete(&self, key: &str) -> std::result::Result<(), String> {
match self {
- Self::Sqlite(store) => store.kv_delete(key),
Self::Documents(store) => store.kv_delete(key),
Self::Unavailable(reason) => Err(Self::unavailable(reason)),
}