Skip to content

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

chore: files changed crates/openhuman-core/src/flows/tinyflows/caps/mod.rs,crates/openhuman-core/src

Steven Enamakelaf006a346da7
diff --git a/crates/openhuman-core/src/flows/tinyflows/caps/mod.rs b/crates/openhuman-core/src/flows/tinyflows/caps/mod.rs
index 081899d7df..205caa0366 100644
--- a/crates/openhuman-core/src/flows/tinyflows/caps/mod.rs
+++ b/crates/openhuman-core/src/flows/tinyflows/caps/mod.rs
@@ -11,7 +11,6 @@ mod llm;
mod ops;
mod prompt;
mod resolver;
-mod state;
mod tier;
pub(crate) mod tools;
@@ -27,7 +26,6 @@ pub(crate) use llm::*;
pub use ops::*;
pub(crate) use prompt::*;
pub(crate) use resolver::*;
-pub(crate) use state::*;
pub(crate) use tier::*;
pub(crate) use tinyflows::caps::mock_schema_aware::*;
pub(crate) use tools::NATIVE_TOOL_PREFIX;
diff --git a/crates/openhuman-core/src/flows/tinyflows/caps/ops.rs b/crates/openhuman-core/src/flows/tinyflows/caps/ops.rs
index d0945daee3..023a873c48 100644
--- a/crates/openhuman-core/src/flows/tinyflows/caps/ops.rs
+++ b/crates/openhuman-core/src/flows/tinyflows/caps/ops.rs
@@ -602,7 +602,7 @@ impl ToolInvoker for OpenHumanTools {
/// and [`super::memory_adapter::OpenHumanMemory`] for `memory`, for its
/// contract).
///
-/// `state_namespace` scopes the [`FlowStateStore`] KV so two saved flows that
+/// `state_namespace` scopes the [`tinyflows_sqlite::flows::SqliteStateStore`] KV so two saved flows that
/// use the same state key never read or overwrite each other — callers pass a
/// per-flow namespace (e.g. `"flow:<id>"`). Note this is **not** the same
/// namespace `OpenHumanMemory` writes flow-scoped memory under — that one is
@@ -635,10 +635,10 @@ pub fn build_capabilities(config: Arc<Config>, state_namespace: impl Into<String
config: config.clone(),
security: security.clone(),
}),
- state: Arc::new(FlowStateStore {
- config: config.clone(),
- namespace: state_namespace.into(),
- }),
+ state: Arc::new(tinyflows_sqlite::flows::SqliteStateStore::new(
+ crate::flows::store::dir(&config),
+ state_namespace,
+ )),
agent: Some(Arc::new(OpenHumanAgentRunner {
config: config.clone(),
})),
diff --git a/crates/openhuman-core/src/flows/tinyflows/caps/state.rs b/crates/openhuman-core/src/flows/tinyflows/caps/state.rs
deleted file mode 100644
index 4cae31de00..0000000000
--- a/crates/openhuman-core/src/flows/tinyflows/caps/state.rs
+++ /dev/null
@@ -1,45 +0,0 @@
-//! The `StateStore` capability, backed by the flows KV table.
-//!
-//! Namespaced per flow, so one flow's state cannot collide with another's.
-
-#![allow(unused_imports)]
-
-use std::sync::Arc;
-
-use async_trait::async_trait;
-use serde_json::{json, Value};
-use tinyflows::caps::*;
-use tinyflows::error::{EngineError, Result};
-
-use super::*;
-use crate::config::Config;
-use crate::flows;
-
-/// [`StateStore`] adapter over the `flows::` domain's `flow_state` KV table.
-pub struct FlowStateStore {
- pub config: Arc<Config>,
- pub namespace: String,
-}
-
-#[async_trait]
-impl StateStore for FlowStateStore {
- async fn load(&self, key: &str) -> Result<Option<Value>> {
- let config = self.config.clone();
- let namespace = self.namespace.clone();
- let key = key.to_string();
- tokio::task::spawn_blocking(move || flows::kv_get(&config, &namespace, &key))
- .await
- .map_err(|e| EngineError::Capability(format!("flow state load task failed: {e}")))?
- .map_err(|e| EngineError::Capability(e.to_string()))
- }
-
- async fn store(&self, key: &str, value: Value) -> Result<()> {
- let config = self.config.clone();
- let namespace = self.namespace.clone();
- let key = key.to_string();
- tokio::task::spawn_blocking(move || flows::kv_set(&config, &namespace, &key, &value))
- .await
- .map_err(|e| EngineError::Capability(format!("flow state store task failed: {e}")))?
- .map_err(|e| EngineError::Capability(e.to_string()))
- }
-}
diff --git a/crates/openhuman-core/src/flows/tinyflows/tinyflows_capabilities_tests.rs b/crates/openhuman-core/src/flows/tinyflows/tinyflows_capabilities_tests.rs
index 819197c64e..44326e7834 100644
--- a/crates/openhuman-core/src/flows/tinyflows/tinyflows_capabilities_tests.rs
+++ b/crates/openhuman-core/src/flows/tinyflows/tinyflows_capabilities_tests.rs
@@ -48,35 +48,6 @@ async fn http_adapter_rejects_host_outside_strict_allowlist() {
);
}
-// ── StateStore adapter ───────────────────────────────────────────────────
-
-#[tokio::test]
-async fn flow_state_store_round_trips_and_is_namespace_scoped() {
- let tmp = TempDir::new().unwrap();
- let config = test_config(&tmp);
-
- let ns1 = FlowStateStore {
- config: config.clone(),
- namespace: "ns1".to_string(),
- };
- let ns2 = FlowStateStore {
- config: config.clone(),
- namespace: "ns2".to_string(),
- };
-
- assert!(ns1.load("k").await.unwrap().is_none());
-
- ns1.store("k", json!({ "v": 1 })).await.unwrap();
- assert_eq!(ns1.load("k").await.unwrap(), Some(json!({ "v": 1 })));
-
- // A different namespace never sees ns1's value.
- assert!(ns2.load("k").await.unwrap().is_none());
-
- // Overwrite.
- ns1.store("k", json!(2)).await.unwrap();
- assert_eq!(ns1.load("k").await.unwrap(), Some(json!(2)));
-}
-
// ── Engine smoke: real seam end to end ───────────────────────────────────
#[tokio::test]
diff --git a/crates/openhuman-core/src/flows/tinyflows/tinyflows_tests.rs b/crates/openhuman-core/src/flows/tinyflows/tinyflows_tests.rs
index b63168ff49..fbb334d604 100644
--- a/crates/openhuman-core/src/flows/tinyflows/tinyflows_tests.rs
+++ b/crates/openhuman-core/src/flows/tinyflows/tinyflows_tests.rs
@@ -30,7 +30,7 @@ use crate::config::Config;
use crate::security::SecurityPolicy;
use super::build_capabilities;
-use super::caps::{FlowStateStore, OpenHumanCode, OpenHumanHttp, OpenHumanTools};
+use super::caps::{OpenHumanCode, OpenHumanHttp, OpenHumanTools};
fn test_config(tmp: &TempDir) -> Arc<Config> {
let config = Config {