The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
feat(threads): add thread title field to schemas and rpc models
Steven Enamakel35f996b5f23c
diff --git a/crates/openhuman-core/src/threads/ops/crud.rs b/crates/openhuman-core/src/threads/ops/crud.rsindex 3745f2f5ea..670414611f 100644--- a/crates/openhuman-core/src/threads/ops/crud.rs+++ b/crates/openhuman-core/src/threads/ops/crud.rs@@ -203,6 +203,15 @@ async fn message_append_with_config(origin: Option<&crate::agent::turn_origin::AgentTurnOrigin>,persistence_dir: &std::path::Path,) -> Result<Outcome<ApiEnvelope<ConversationMessageRecord>>, ThreadsError> {+ if request.message.sender == "user" && !request.attachments.is_empty() {+ // Typed attachments become the staging markers here, once, so the+ // rest of this function sees the same content a marker send would.+ request.message.content = crate::agent::attachments::parts::fold_into_message(+ &request.message.content,+ &request.attachments,+ )+ .map_err(|error| ThreadsError::Message(error.to_string()))?;+ }if request.message.sender == "user" {let raw_upload = request.message.content.contains("[IMAGE:")|| request.message.content.contains("[FILE:");diff --git a/crates/openhuman-core/src/threads/ops/edit.rs b/crates/openhuman-core/src/threads/ops/edit.rsindex 57dc8990ad..924d67996b 100644--- a/crates/openhuman-core/src/threads/ops/edit.rs+++ b/crates/openhuman-core/src/threads/ops/edit.rs@@ -59,6 +59,9 @@ pub struct EditMessageRequest {pub thread_id: String,pub message_id: String,pub content: String,+ /// Typed attachments sent with the replacement content.+ #[serde(default)]+ pub attachments: Vec<tinychannels_bus::ContentPart>,#[serde(default)]pub client_id: Option<String>,}@@ -87,6 +90,11 @@ pub async fn edit_message() -> Result<Outcome<Value>, ThreadsError> {let client_id = request.client_id.unwrap_or_else(|| "system".to_string());let thread_id = request.thread_id;+ // Typed attachments become upload markers before anything is cancelled or+ // truncated, so a bad attachment fails the edit without side effects.+ let content =+ crate::agent::attachments::parts::fold_into_message(&request.content, &request.attachments)+ .map_err(|e| ThreadsError::Message(e.to_string()))?;let dir = workspace_dir().await.map_err(ThreadsError::Message)?;// The request's own tenant picks the store key, so a SaaS profile edits// the transcript its turns were written to.@@ -128,7 +136,7 @@ pub async fn edit_message(ctx,&client_id,&thread_id,- &request.content,+ &content,None,None,None,diff --git a/crates/openhuman-core/src/threads/rpc_models.rs b/crates/openhuman-core/src/threads/rpc_models.rsindex e09b1265ca..c7218b4b95 100644--- a/crates/openhuman-core/src/threads/rpc_models.rs+++ b/crates/openhuman-core/src/threads/rpc_models.rs@@ -130,6 +130,11 @@ pub struct ConversationMessagesResponse {pub struct AppendConversationMessageRequest {pub thread_id: String,pub message: ConversationMessageRecord,+ /// Typed attachments for a user message, staged with it. Folded into the+ /// message content as upload markers at the RPC edge+ /// (`agent::attachments::parts`), so callers never build markers.+ #[serde(default)]+ pub attachments: Vec<tinychannels_bus::ContentPart>,}/// Request to generate or refresh a thread title after the first exchange.diff --git a/crates/openhuman-core/src/threads/schemas/schema_defs.rs b/crates/openhuman-core/src/threads/schemas/schema_defs.rsindex 99c3b9d34c..2ec6724764 100644--- a/crates/openhuman-core/src/threads/schemas/schema_defs.rs+++ b/crates/openhuman-core/src/threads/schemas/schema_defs.rs@@ -112,6 +112,12 @@ pub(crate) fn schemas(function: &str) -> ControllerSchema {comment: "Message payload to append.",required: true,},+ FieldSchema {+ name: "attachments",+ ty: TypeSchema::Option(Box::new(TypeSchema::Json)),+ comment: "Typed attachments (tinychannels ContentPart[], media with an inline data: or http(s) url) staged with the message instead of [IMAGE:]/[FILE:] markers in its content.",+ required: false,+ },],outputs: vec![FieldSchema {name: "result",@@ -488,6 +494,12 @@ pub(crate) fn schemas(function: &str) -> ControllerSchema {comment: "Replacement message content.",required: true,},+ FieldSchema {+ name: "attachments",+ ty: TypeSchema::Option(Box::new(TypeSchema::Json)),+ comment: "Typed attachments (tinychannels ContentPart[]) sent with the replacement content instead of markers.",+ required: false,+ },FieldSchema {name: "client_id",ty: TypeSchema::Option(Box::new(TypeSchema::String)),diff --git a/crates/openhuman-core/src/web_chat/schemas.rs b/crates/openhuman-core/src/web_chat/schemas.rsindex d23623a8c5..e21b41d154 100644--- a/crates/openhuman-core/src/web_chat/schemas.rs+++ b/crates/openhuman-core/src/web_chat/schemas.rs@@ -73,6 +73,12 @@ pub fn schemas(function: &str) -> ControllerSchema {required_string("client_id", "Client stream identifier."),required_string("thread_id", "Thread identifier."),required_string("message", "User message."),+ FieldSchema {+ name: "attachments",+ ty: TypeSchema::Option(Box::new(TypeSchema::Json)),+ comment: "Typed attachments (tinychannels ContentPart[]: image/video/audio/file parts whose media carries an inline data: or http(s) url). Replaces splicing [IMAGE:]/[FILE:] markers into `message`.",+ required: false,+ },optional_string("model_override", "Optional model override."),optional_f64("temperature", "Optional temperature override."),optional_string(@@ -187,6 +193,8 @@ pub fn schemas(function: &str) -> ControllerSchema {fn handle_chat(ctx: DispatchCtx, params: Map<String, Value>) -> ControllerFuture {Box::pin(async move {let p = deserialize_params::<WebChatParams>(params)?;+ let message = crate::agent::attachments::parts::fold_into_message(&p.message, &p.attachments)+ .map_err(|e| e.to_string())?;// Recorded before the turn starts so it reads the new choice.crate::agent::tinyagents::apply_requested_effort(&ctx,@@ -198,7 +206,7 @@ fn handle_chat(ctx: DispatchCtx, params: Map<String, Value>) -> ControllerFuture&ctx,&p.client_id,&p.thread_id,- &p.message,+ &message,p.model_override,p.temperature,p.locale,diff --git a/crates/openhuman-core/src/web_chat/types.rs b/crates/openhuman-core/src/web_chat/types.rsindex f7e701b4da..179a761c4e 100644--- a/crates/openhuman-core/src/web_chat/types.rs+++ b/crates/openhuman-core/src/web_chat/types.rs@@ -167,6 +167,10 @@ pub(crate) struct WebChatParams {pub(super) client_id: String,pub(super) thread_id: String,pub(super) message: String,+ /// Typed attachments sent with `message`; folded into upload markers at+ /// the RPC edge (`agent::attachments::parts`).+ #[serde(default)]+ pub(super) attachments: Vec<tinychannels_bus::ContentPart>,pub(super) model_override: Option<String>,pub(super) temperature: Option<f64>,/// BCP-47 locale of the frontend UI (e.g. `ar`, `zh-CN`). When set