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
fix: correct module reference in canonicalize_types doc comment
Steven Enamakeldec5276dcfea
diff --git a/crates/openhuman-core/src/memory/tree/tree/canonicalize_types.rs b/crates/openhuman-core/src/memory/tree/tree/canonicalize_types.rsindex b6e78cc98c..a56b98a950 100644--- a/crates/openhuman-core/src/memory/tree/tree/canonicalize_types.rs+++ b/crates/openhuman-core/src/memory/tree/tree/canonicalize_types.rs@@ -2,8 +2,9 @@//! they came home from `tinycortex::memory::ingest::canonicalize` (#5560),//! plus the `invalid_payload_message` formatter their handlers share.//!-//! Split out of `rpc_part_01.rs` purely for the file-layout gate; every name-//! is re-exported from there, so no import path changed. The serde behaviour+//! Split out of `rpc.rs` purely for the file-layout gate; every name is+//! re-exported through `rpc/ingest.rs`, so no import path changed. The serde+//! behaviour//! in here is wire contract: the timestamp leniency, the provider default,//! and the epoch-ms/RFC-3339 dual parse are what deployed producers already//! send.@@ -30,7 +31,7 @@ use tinymemory_api::chunks::SourceKind;// asking `tinymemory-api` to carry a payload that never crosses the bus. What// pins the *shape* is the wire, not the type: the driver's reconstruction is// documented field-for-field on [`email_items`] and [`chat_items`], and-// `rpc_tests_part_01_tests` pins the serde tolerances. Change a field name+// `rpc_ingest_and_chunk_tests` pins the serde tolerances. Change a field name// here and the round trip breaks in exactly the way those tests describe —// which is the same exposure the import had, since a rename upstream would// have reshaped this RPC's published request body without anything herediff --git a/crates/openhuman-core/src/platform/socket/ws_loop_dispatch.rs b/crates/openhuman-core/src/platform/socket/ws_loop_dispatch.rsnew file mode 100644index 0000000000..b668a407d9--- /dev/null+++ b/crates/openhuman-core/src/platform/socket/ws_loop_dispatch.rs@@ -0,0 +1,145 @@+//! Incoming-message dispatch: Engine.IO framing and Socket.IO packet/ack+//! parsing.++use std::sync::Arc;++use tokio::sync::mpsc;++use crate::util::utf8_safe_prefix_at_byte_boundary;++use super::event_handlers::{handle_sio_event, parse_sio_event};+use super::manager::SharedState;++/// Handle an incoming Engine.IO text message by its type prefix.+pub(super) fn handle_eio_message(+ text: &str,+ emit_tx: &mpsc::UnboundedSender<String>,+ shared: &Arc<SharedState>,+) {+ if text.is_empty() {+ return;+ }++ match text.as_bytes()[0] {+ b'2' => {+ // Engine.IO PING → respond with PONG+ let _ = emit_tx.send("3".to_string());+ }+ b'3' => {+ // Engine.IO PONG — ignore (server responding to our ping)+ }+ b'4' => {+ // Engine.IO MESSAGE → contains Socket.IO packet+ if text.len() > 1 {+ handle_sio_packet(&text[1..], emit_tx, shared);+ }+ }+ b'1' => {+ log::info!("[socket] Engine.IO CLOSE from server");+ }+ b'6' => {+ // Engine.IO NOOP+ }+ _ => {+ log::debug!(+ "[socket] Unknown EIO packet: {}",+ utf8_safe_prefix_at_byte_boundary(text, 30)+ );+ }+ }+}++/// Handle a Socket.IO packet (after stripping the Engine.IO '4' prefix).+fn handle_sio_packet(+ text: &str,+ emit_tx: &mpsc::UnboundedSender<String>,+ shared: &Arc<SharedState>,+) {+ if text.is_empty() {+ return;+ }++ match text.as_bytes()[0] {+ b'2' => {+ // Socket.IO EVENT: 2["eventName", data]+ if let Some((event_name, data)) = parse_sio_event(&text[1..]) {+ handle_sio_event(&event_name, data, emit_tx, shared);+ } else {+ log::warn!(+ "[socket] Failed to parse SIO EVENT: {}",+ utf8_safe_prefix_at_byte_boundary(text, 80)+ );+ }+ }+ b'3' => {+ // Socket.IO ACK: 3<ackId>[ackPayload]+ if let Some((ack_id, data)) = parse_sio_ack(&text[1..]) {+ if shared.ack_registry.resolve(ack_id, data) {+ log::debug!("[socket] SIO ACK resolved ack_id={ack_id}");+ } else {+ log::warn!("[socket] SIO ACK had no pending waiter ack_id={ack_id}");+ }+ } else {+ log::warn!(+ "[socket] Failed to parse SIO ACK: {}",+ utf8_safe_prefix_at_byte_boundary(text, 80)+ );+ }+ }+ b'0' => {+ // Socket.IO CONNECT (re-ack during reconnection) — update sid+ log::debug!("[socket] SIO CONNECT re-ack");+ if text.len() > 1 {+ if let Ok(data) = serde_json::from_str::<serde_json::Value>(&text[1..]) {+ if let Some(sid) = data.get("sid").and_then(|v| v.as_str()) {+ *shared.socket_id.write() = Some(sid.to_string());+ emit_state_change(shared);+ }+ }+ }+ }+ b'1' => {+ // Socket.IO DISCONNECT+ log::info!("[socket] SIO DISCONNECT from server");+ super::medulla::workflows::end_connection_generation();+ *shared.status.write() = ConnectionStatus::Disconnected;+ *shared.socket_id.write() = None;+ emit_state_change(shared);+ }+ b'4' => {+ // Socket.IO CONNECT_ERROR+ let error_str = if text.len() > 1 {+ &text[1..]+ } else {+ "unknown"+ };+ log::error!("[socket] SIO CONNECT_ERROR: {}", error_str);+ }+ _ => {+ log::debug!(+ "[socket] Unknown SIO packet type: {}",+ utf8_safe_prefix_at_byte_boundary(text, 30)+ );+ }+ }+}++fn parse_sio_ack(text: &str) -> Option<(u64, serde_json::Value)> {+ let json_start = text.find('[')?;+ if json_start == 0 {+ return None;+ }+ let ack_id = text[..json_start].parse::<u64>().ok()?;+ let mut args: Vec<serde_json::Value> = serde_json::from_str(&text[json_start..]).ok()?;+ let data = if args.len() == 1 {+ args.pop().unwrap_or(serde_json::Value::Null)+ } else {+ serde_json::Value::Array(args)+ };+ Some((ack_id, data))+}++// ---------------------------------------------------------------------------+// Redirect-following connect+// ---------------------------------------------------------------------------+