Skip to content

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

chore(todos): align type names and remove timestamp normalization

Steven Enamakeleaaf76d9b3ce
diff --git a/crates/openhuman-core/src/agent/todos/README.md b/crates/openhuman-core/src/agent/todos/README.md
index 5e43463c8c..7d5260d569 100644
--- a/crates/openhuman-core/src/agent/todos/README.md
+++ b/crates/openhuman-core/src/agent/todos/README.md
@@ -1,12 +1,13 @@
# Agent todos
TinyAgents owns todo types, persistence, normalization, status transitions,
-claims, dispatch, and markdown rendering. This directory contains only
-OpenHuman agent-runtime adapters:
+and markdown rendering (`tinyagents_graph::todos`). This directory contains
+only OpenHuman agent-runtime adapters:
-- `ops.rs`: maps OpenHuman execution locations onto TinyAgents stores.
-- `tools.rs`: exposes the model-facing todo tools.
-- `types.rs`: re-exports TinyAgents types and normalizes timestamps at the
- OpenHuman transcript boundary.
+- `ops.rs`: maps OpenHuman execution scopes (agent session, scratch) onto the
+ one in-process TinyAgents store.
+- `types.rs`: re-exports the TinyAgents types.
-There is no frontend task board and no `openhuman.todos_*` JSON-RPC API.
+The model-facing `todo` tool lives in `crate::agent::tools::todo`. The list
+reaches the frontend through the `todo` tool call in the turn's progress
+events; there is no `openhuman.todos_*` JSON-RPC API.
diff --git a/crates/openhuman-core/src/agent/todos/mod.rs b/crates/openhuman-core/src/agent/todos/mod.rs
index e77fa56b8c..226f98a7eb 100644
--- a/crates/openhuman-core/src/agent/todos/mod.rs
+++ b/crates/openhuman-core/src/agent/todos/mod.rs
@@ -1,11 +1,11 @@
//! OpenHuman adapters around the TinyAgents todo store.
//!
//! Design notes:
-//! - **Per-thread scoped.** The list belongs to the conversation thread the
-//! turn runs in; there is no cross-thread or app-wide board.
-//! - **In-memory scratch.** When no thread context is available the
+//! - **Per-session scoped.** The list belongs to the agent session the turn
+//! runs in; there is no cross-session or app-wide list.
+//! - **In-memory scratch.** When no session context is available the
//! process-global scratch store is used (tool invocations outside a chat
-//! thread, tests).
+//! session, tests).
//! - **Markdown output.** Tool results include a rendered representation for
//! the agent transcript.
diff --git a/crates/openhuman-core/src/agent/todos/ops.rs b/crates/openhuman-core/src/agent/todos/ops.rs
index 22859aa3bd..148dac1002 100644
--- a/crates/openhuman-core/src/agent/todos/ops.rs
+++ b/crates/openhuman-core/src/agent/todos/ops.rs
@@ -10,8 +10,7 @@ use serde::{Deserialize, Serialize};
use tinyagents_graph::todos::store as todos;
use crate::agent::tinyagents::todos::{session_todos_store, SCRATCH_SESSION_ID};
-use crate::agent::todos::types::normalize_cards_for_wire;
-pub use crate::agent::todos::types::{TaskBoardCard, TaskCardStatus};
+pub use crate::agent::todos::types::{TodoItem, TodoStatus};
pub use tinyagents_graph::todos::{parse_status, render_markdown};
@@ -19,7 +18,7 @@ pub use tinyagents_graph::todos::{parse_status, render_markdown};
#[serde(rename_all = "camelCase")]
pub struct TodosSnapshot {
pub session_id: Option<String>,
- pub cards: Vec<TaskBoardCard>,
+ pub items: Vec<TodoItem>,
pub markdown: String,
}
@@ -45,7 +44,7 @@ impl TodoScope {
fn snapshot(scope: &TodoScope, value: tinyagents_graph::todos::TodosSnapshot) -> TodosSnapshot {
TodosSnapshot {
session_id: scope.session_id().map(str::to_owned),
- cards: value.cards,
+ items: value.items,
markdown: value.markdown,
}
}
@@ -54,14 +53,14 @@ fn finish(
scope: &TodoScope,
result: tinyagents_harness::error::Result<tinyagents_graph::todos::TodosSnapshot>,
) -> Result<TodosSnapshot, String> {
- let mut value = result.map_err(|error| error.to_string())?;
- normalize_cards_for_wire(&mut value.cards);
- Ok(snapshot(scope, value))
+ result
+ .map(|value| snapshot(scope, value))
+ .map_err(|error| error.to_string())
}
-pub async fn replace(scope: &TodoScope, cards: Vec<TaskBoardCard>) -> Result<TodosSnapshot, String> {
+pub async fn replace(scope: &TodoScope, items: Vec<TodoItem>) -> Result<TodosSnapshot, String> {
let store = session_todos_store();
- finish(scope, todos::replace(&store, scope.key(), cards).await)
+ finish(scope, todos::replace(&store, scope.key(), items).await)
}
pub async fn clear(scope: &TodoScope) -> Result<TodosSnapshot, String> {
@@ -71,10 +70,7 @@ pub async fn clear(scope: &TodoScope) -> Result<TodosSnapshot, String> {
pub async fn list(scope: &TodoScope) -> Result<TodosSnapshot, String> {
let store = session_todos_store();
- todos::list(&store, scope.key())
- .await
- .map(|value| snapshot(scope, value))
- .map_err(|error| error.to_string())
+ finish(scope, todos::list(&store, scope.key()).await)
}
#[cfg(test)]
diff --git a/crates/openhuman-core/src/agent/todos/types.rs b/crates/openhuman-core/src/agent/todos/types.rs
index 42284a5250..28eba6af56 100644
--- a/crates/openhuman-core/src/agent/todos/types.rs
+++ b/crates/openhuman-core/src/agent/todos/types.rs
@@ -1,24 +1,3 @@
-//! TinyAgents todo types and OpenHuman wire-format normalization.
+//! TinyAgents todo types, re-exported at the OpenHuman transcript boundary.
-use chrono::{TimeZone, Utc};
-
-pub use tinyagents_graph::todos::{TaskApprovalMode, TaskBoard, TaskBoardCard, TaskCardStatus};
-
-pub(crate) fn normalize_timestamp_for_wire(value: &str) -> String {
- if chrono::DateTime::parse_from_rfc3339(value).is_ok() {
- return value.to_owned();
- }
- if let Ok(updated_at_ms) = value.parse::<i64>() {
- if let Some(updated_at) = Utc.timestamp_millis_opt(updated_at_ms).single() {
- return updated_at.to_rfc3339();
- }
- }
- tracing::warn!(updated_at = %value, "invalid todo timestamp; using current time");
- Utc::now().to_rfc3339()
-}
-
-pub(crate) fn normalize_cards_for_wire(cards: &mut [TaskBoardCard]) {
- for card in cards {
- card.updated_at = normalize_timestamp_for_wire(&card.updated_at);
- }
-}
+pub use tinyagents_graph::todos::{TodoItem, TodoList, TodoStatus};