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/agent/README.md,crates/openhuman-core/src/agent/sessi

Steven Enamakel63abe62b4063
diff --git a/crates/openhuman-core/src/agent/README.md b/crates/openhuman-core/src/agent/README.md
index 5a2d78e1da..88cccd6a0b 100644
--- a/crates/openhuman-core/src/agent/README.md
+++ b/crates/openhuman-core/src/agent/README.md
@@ -295,7 +295,7 @@ Delegation and coordination:
| `subagent_host/` | Runs a child agent: definition, model and tool narrowing, prompt, checkpoints, progress ([README](subagent_host/README.md)) |
| `orchestration/` | Spawn/steer/wait tools and background delivery ([README](orchestration/README.md)) |
| `triage/` | Classifies `TriggerEnvelope`s and escalates ([README](triage/README.md)) |
-| `goals/` | Host adapters around `tinyagents_graph::goals` and the `goal_*` tools ([README](goals/README.md)) |
+| `goals/` | Context-scoped TinyAgents goal store adapter and the existing thread-goal domain events |
| `todos/` | Session-scoped todo list over the TinyAgents todo store ([README](todos/README.md)) |
| [`../plan_review/`](../plan_review/) | `request_plan_review` gate that parks a web-chat turn until the user decides |
| [`tools.rs`](./tools.rs), `tools/` | Loop control tools: `plan_exit`, `todo`, `run_workflow`/`await_workflow` (with `skills`) ([README](tools/README.md)) |
diff --git a/crates/openhuman-core/src/agent/session_host/runtime_session_tests.rs b/crates/openhuman-core/src/agent/session_host/runtime_session_tests.rs
index 0c6ef5d775..fd1d329616 100644
--- a/crates/openhuman-core/src/agent/session_host/runtime_session_tests.rs
+++ b/crates/openhuman-core/src/agent/session_host/runtime_session_tests.rs
@@ -2,7 +2,7 @@
use std::sync::Arc;
-use tinyagents_runtime::ToolSnapshot;
+use tinyagents_harness::tool::ToolSnapshot;
use tinytools::ToolSpec;
#[path = "runtime_session_terminal_tests.rs"]
diff --git a/crates/openhuman-core/src/agent/tinyagents/README.md b/crates/openhuman-core/src/agent/tinyagents/README.md
index 9900e83cf7..54226e61db 100644
--- a/crates/openhuman-core/src/agent/tinyagents/README.md
+++ b/crates/openhuman-core/src/agent/tinyagents/README.md
@@ -45,7 +45,7 @@ The adapter seam between OpenHuman and the vendored [`tinyagents`](../../../../.
| [`steering_forwarder.rs`](./steering_forwarder.rs) | Host adapter over `tinyagents_harness::run_queue::SteeringForwarderGuard` (forwards `RunQueue` steer/collect messages into the harness `SteeringHandle`; abort-on-drop so drop-based cancellation always deregisters it, issue #4456): `QueuedMessage for QueuedTurn`, the `RunQueue*` domain-event sink and the steering-registry cleanup hook. |
| `summarize.rs` | `ModelSummarizer` / `FaultTolerantCachingSummarizer` plus a context-window-aware `SummarizationPolicy` driving the crate's `ContextCompressionMiddleware`. |
| [`embeddings.rs`](./embeddings.rs) | `ProviderEmbeddingModel`: cost-recording binding over the host-built `tinyinference_embeddings::EmbeddingModel`. |
-| [`todos.rs`](./todos.rs) | `todos_store` / `scratch_todos_store` (the crate `Store` behind per-thread agent todos, `tinyagents_graph::todos`). |
+| [`todos.rs`](./todos.rs) | `todos_store` / `scratch_todos_store` (the crate `Store` behind per-thread agent todos, `tinyagents_harness_tools::todos`). |
| [`config.rs`](./config.rs) | Maps OpenHuman's `Config` (including model pins) onto `tinyagents_harness::config` structs. |
| `*_tests.rs` | Sibling test suites for each file/part group above. |
diff --git a/crates/openhuman-core/src/agent/tools/README.md b/crates/openhuman-core/src/agent/tools/README.md
index c478109ebb..3be6a5dc03 100644
--- a/crates/openhuman-core/src/agent/tools/README.md
+++ b/crates/openhuman-core/src/agent/tools/README.md
@@ -50,7 +50,7 @@ instead of registering them as disabled.
- `crate::agent::orchestration` for the sub-agent spawn tools, which sit next
to these conceptually but live separately because they carry more
lifecycle state.
-- `tinyagents_graph::todos` for the todo store and tool behavior.
+- `tinyagents_harness_tools::todos` for the todo store and tool behavior.
## Further reading
diff --git a/crates/openhuman-core/src/agent/tools/plan_exit.rs b/crates/openhuman-core/src/agent/tools/plan_exit.rs
index 0238930736..a1400a8945 100644
--- a/crates/openhuman-core/src/agent/tools/plan_exit.rs
+++ b/crates/openhuman-core/src/agent/tools/plan_exit.rs
@@ -1,32 +1,99 @@
//! OpenHuman's tenant-aware adapter for the harness-owned `plan_exit` tool.
+use std::hash::{Hash, Hasher};
use std::sync::Arc;
use async_trait::async_trait;
use serde_json::Value;
use tinyagents_harness::middleware::RunModeHandle;
+use tinyagents_harness_tools::run_mode::RunModeStore;
+use tinyagents_harness_tools::{ParkedPlanReviewLookup, PlanExitHost};
use tinytools::{PermissionLevel, Tool, ToolCallOptions, ToolResult, ToolRunContext};
-/// Resolve the live thread mode only when no plan review is still pending.
-fn mode_lookup(context: &dyn ToolRunContext) -> Option<RunModeHandle> {
- let thread_id = context.thread_id()?;
- let dispatch_ctx =
- crate::agent::tinyagents::host::run_context::dispatch_ctx_for_tool(Some(context));
- let tenant = dispatch_ctx.tenant().ok()?;
- if crate::plan_review::gate::global()
- .parked_review_for_thread(&tenant, thread_id)
- .is_some()
- {
- return None;
+#[derive(Clone)]
+struct PlanExitScope {
+ context: crate::core::runtime::DispatchCtx,
+ tenant: crate::core::runtime::Tenant,
+ valid: bool,
+}
+
+impl PartialEq for PlanExitScope {
+ fn eq(&self, other: &Self) -> bool {
+ self.valid == other.valid && self.tenant == other.tenant
+ }
+}
+
+impl Eq for PlanExitScope {}
+
+impl Hash for PlanExitScope {
+ fn hash<H: Hasher>(&self, state: &mut H) {
+ self.valid.hash(state);
+ self.tenant.hash(state);
+ }
+}
+
+struct OpenHumanPlanExitHost;
+
+impl PlanExitHost for OpenHumanPlanExitHost {
+ type Scope = PlanExitScope;
+
+ fn scope_and_thread(&self, context: &dyn ToolRunContext) -> (Self::Scope, String) {
+ let dispatch =
+ crate::agent::tinyagents::host::run_context::dispatch_ctx_for_tool(Some(context));
+ let tenant = dispatch.tenant();
+ let (tenant, valid) = match tenant {
+ Ok(tenant) => (tenant, true),
+ Err(_) => (crate::core::runtime::Tenant::default(), false),
+ };
+ let scope = PlanExitScope {
+ context: dispatch,
+ tenant,
+ valid,
+ };
+ (scope, context.thread_id().unwrap_or_default().to_owned())
+ }
+}
+
+struct OpenHumanRunModes;
+
+impl RunModeStore<PlanExitScope> for OpenHumanRunModes {
+ fn handle_for_thread(&self, scope: &PlanExitScope, thread_id: &str) -> RunModeHandle {
+ crate::threads::run_mode::handle_for_thread(&scope.context, thread_id)
+ }
+
+ fn get_mode(&self, scope: &PlanExitScope, thread_id: &str) -> tinyagents_harness::middleware::RunMode {
+ crate::threads::run_mode::get_mode(&scope.context, thread_id)
+ }
+
+ fn set_mode(
+ &self,
+ scope: &PlanExitScope,
+ thread_id: &str,
+ mode: tinyagents_harness::middleware::RunMode,
+ ) {
+ if scope.valid && !thread_id.is_empty() {
+ crate::threads::run_mode::set_mode(&scope.context, thread_id, mode);
+ }
+ }
+}
+
+struct OpenHumanParkedReviews;
+
+impl ParkedPlanReviewLookup<PlanExitScope> for OpenHumanParkedReviews {
+ fn has_parked_review(&self, scope: &PlanExitScope, thread_id: &str) -> bool {
+ scope.valid
+ && crate::plan_review::gate::global()
+ .parked_review_for_thread(&scope.tenant, thread_id)
+ .is_some()
}
- Some(crate::threads::run_mode::handle_for_thread(
- &dispatch_ctx,
- thread_id,
- ))
}
-fn owner_tool() -> tinyagents_harness::tool::plan_exit::PlanExitTool {
- tinyagents_harness::tool::plan_exit::PlanExitTool::new(Arc::new(mode_lookup))
+fn owner_tool() -> tinyagents_harness_tools::PlanExitTool<PlanExitScope> {
+ tinyagents_harness_tools::PlanExitTool::new(
+ Arc::new(OpenHumanPlanExitHost),
+ Arc::new(OpenHumanRunModes),
+ Some(Arc::new(OpenHumanParkedReviews)),
+ )
}
/// Public unit-shaped compatibility adapter around TinyAgents' tool engine.
@@ -47,11 +114,11 @@ impl Default for PlanExitTool {
#[async_trait]
impl Tool for PlanExitTool {
fn name(&self) -> &str {
- tinyagents_harness::tool::plan_exit::PlanExitTool::NAME
+ tinyagents_harness_tools::PlanExitTool::<PlanExitScope>::NAME
}
fn description(&self) -> &str {
- tinyagents_harness::tool::plan_exit::PlanExitTool::DESCRIPTION
+ tinyagents_harness_tools::PlanExitTool::<PlanExitScope>::DESCRIPTION
}
fn parameters_schema(&self) -> Value {
diff --git a/crates/openhuman-core/src/agent/tools/todo.rs b/crates/openhuman-core/src/agent/tools/todo.rs
index be670b7553..a96b9d9665 100644
--- a/crates/openhuman-core/src/agent/tools/todo.rs
+++ b/crates/openhuman-core/src/agent/tools/todo.rs
@@ -21,13 +21,13 @@ use crate::agent::harness::fork_context::ParentExecutionContext;
use async_trait::async_trait;
use std::path::PathBuf;
use std::sync::Arc;
-use tinyagents_graph::todos::{self as graph_todos, store as todos_store};
+use tinyagents_harness_tools::todos::{self as harness_todos, store as todos_store};
use tinyagents_harness::context::RunContext;
use tinyagents_harness::tool::{ToolDispatch, ToolExecutionContext};
use tinytools::{PermissionLevel, Tool, ToolCallOptions, ToolResult, ToolRunContext};
pub struct TodoTool {
- inner: graph_todos::TodoTool,
+ inner: harness_todos::TodoTool,
workspace_dir: PathBuf,
}
@@ -123,7 +123,7 @@ impl ToolDispatch<(), crate::agent::tinyagents::host::OpenHumanRunContext> for T
impl TodoTool {
pub fn new(workspace_dir: PathBuf) -> Self {
Self {
- inner: graph_todos::TodoTool::new(
+ inner: harness_todos::TodoTool::new(
crate::storage::sessions::stores_or_ephemeral(&workspace_dir).kv,
),
workspace_dir,
diff --git a/crates/openhuman-core/src/agent/tools/todo_tests.rs b/crates/openhuman-core/src/agent/tools/todo_tests.rs
index 208096300a..b1dbf45ca2 100644
--- a/crates/openhuman-core/src/agent/tools/todo_tests.rs
+++ b/crates/openhuman-core/src/agent/tools/todo_tests.rs
@@ -1,6 +1,6 @@
use super::*;
use serde_json::{json, Value};
-use tinyagents_graph::todos::{TodoItem, TodoStatus};
+use tinyagents_harness_tools::todos::{TodoItem, TodoStatus};
/// Serialize tests that share the process-global scratch store. Same lock
/// process-global scratch store.
@@ -30,7 +30,7 @@ fn test_workspace() -> std::path::PathBuf {
}
async fn reset_scratch(workspace_dir: &std::path::Path) {
- tinyagents_graph::todos::store::clear(&todo_store(workspace_dir), "_scratch_")
+ tinyagents_harness_tools::todos::store::clear(&todo_store(workspace_dir), "_scratch_")
.await
.expect("clear scratch");
}
@@ -228,7 +228,7 @@ async fn a_legacy_session_keyed_list_is_migrated_forward_once() {
id: parent.session_id.clone(),
};
let item = TodoItem::with_status("carried over", TodoStatus::InProgress);
- tinyagents_graph::todos::store::replace(
+ tinyagents_harness_tools::todos::store::replace(
&todo_store(&workspace_dir),
legacy_scope.key(),
vec![item],
@@ -255,7 +255,7 @@ async fn a_legacy_session_keyed_list_is_migrated_forward_once() {
id: "thread-legacy".into(),
};
let migrated =
- tinyagents_graph::todos::store::list(&todo_store(&workspace_dir), thread_scope.key())
+ tinyagents_harness_tools::todos::store::list(&todo_store(&workspace_dir), thread_scope.key())
.await
.unwrap();
assert_eq!(migrated.items.len(), 1);
@@ -270,19 +270,19 @@ async fn sessions_do_not_see_each_other_and_a_list_survives_across_turns() {
let b = TodoScope::Session {
id: "sess-b".into(),
};
- tinyagents_graph::todos::store::clear(&todo_store(&workspace_dir), a.key())
+ tinyagents_harness_tools::todos::store::clear(&todo_store(&workspace_dir), a.key())
.await
.unwrap();
- tinyagents_graph::todos::store::clear(&todo_store(&workspace_dir), b.key())
+ tinyagents_harness_tools::todos::store::clear(&todo_store(&workspace_dir), b.key())
.await
.unwrap();
let item = TodoItem::with_status("only in a", TodoStatus::InProgress);
- tinyagents_graph::todos::store::replace(&todo_store(&workspace_dir), a.key(), vec![item])
+ tinyagents_harness_tools::todos::store::replace(&todo_store(&workspace_dir), a.key(), vec![item])
.await
.unwrap();
- let a_again = tinyagents_graph::todos::store::list(&todo_store(&workspace_dir), a.key())
+ let a_again = tinyagents_harness_tools::todos::store::list(&todo_store(&workspace_dir), a.key())
.await
.unwrap();
assert_eq!(
@@ -292,7 +292,7 @@ async fn sessions_do_not_see_each_other_and_a_list_survives_across_turns() {
);
assert_eq!(a_again.thread_id, "sess-a");
assert!(
- tinyagents_graph::todos::store::list(&todo_store(&workspace_dir), b.key())
+ tinyagents_harness_tools::todos::store::list(&todo_store(&workspace_dir), b.key())
.await
.unwrap()
.items
diff --git a/crates/openhuman-core/src/skills/search.rs b/crates/openhuman-core/src/skills/search.rs
index 4a7c6e2d2e..eee9b0fbc7 100644
--- a/crates/openhuman-core/src/skills/search.rs
+++ b/crates/openhuman-core/src/skills/search.rs
@@ -51,7 +51,7 @@ pub const SKILL_SEARCH_NAME: &str = "skill_search";
/// Compact per-result projection, via the module's capped projection with the
/// host's `sanitize_for_llm` supplied as the sanitiser.
fn project(workflow: &Workflow) -> tinyskills::SkillHit {
- tinyskills::project(workflow, tinytools_std::sanitize::sanitize_for_llm)
+ tinyskills::project(workflow, tinytools::sanitize::sanitize_for_llm)
}
/// Search installed skills by capability.
diff --git a/crates/openhuman-core/src/threads/ops/live_state_tests.rs b/crates/openhuman-core/src/threads/ops/live_state_tests.rs
index fdacf4f6e9..ca2b443070 100644
--- a/crates/openhuman-core/src/threads/ops/live_state_tests.rs
+++ b/crates/openhuman-core/src/threads/ops/live_state_tests.rs
@@ -8,7 +8,7 @@
use super::*;
use crate::config::TEST_ENV_LOCK;
-use tinyagents_graph::todos::{TodoItem, TodoStatus};
+use tinyagents_harness_tools::todos::{TodoItem, TodoStatus};
#[test]
fn thread_live_state_request_parses_thread_id() {
@@ -102,7 +102,7 @@ async fn todos_get_reads_back_what_the_todo_tool_wrote() {
assert!(empty_json["data"]["todos"].as_array().unwrap().is_empty());
let store = crate::storage::sessions::stores_or_ephemeral(&dir).kv;
- tinyagents_graph::todos::store::replace(
+ tinyagents_harness_tools::todos::store::replace(
&store,
"thread-todos-live",
vec![TodoItem::with_status("write tests", TodoStatus::InProgress)],