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/web_chat/schemas.rs,crates/openhuman-core/src/web_cha

Steven Enamakelf813ab4273d5
diff --git a/crates/openhuman-core/src/web_chat/schemas.rs b/crates/openhuman-core/src/web_chat/schemas.rs
index 5700c2a4ec..587c1e4bfc 100644
--- a/crates/openhuman-core/src/web_chat/schemas.rs
+++ b/crates/openhuman-core/src/web_chat/schemas.rs
@@ -76,7 +76,7 @@ pub fn schemas(function: &str) -> ControllerSchema {
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`.",
+ comment: "Typed attachments (tinychannels ContentPart[]). VoiceNote parts carry an opaque id for audio already stored by channel.web_voice_note_store; the core validates and binds it to the user row without adding audio markers to model text.",
required: false,
},
optional_string("model_override", "Optional model override."),
diff --git a/crates/openhuman-core/src/web_chat/types.rs b/crates/openhuman-core/src/web_chat/types.rs
index ee481fc06e..c60fc2a4da 100644
--- a/crates/openhuman-core/src/web_chat/types.rs
+++ b/crates/openhuman-core/src/web_chat/types.rs
@@ -78,8 +78,9 @@ 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`).
+ /// Typed attachments sent with `message`; ordinary media is folded into
+ /// upload markers at the RPC edge, while voice notes retain their typed
+ /// opaque reference and stay out of model-visible text.
#[serde(default)]
pub(super) attachments: Vec<tinychannels_bus::ContentPart>,
pub(super) model_override: Option<String>,
diff --git a/crates/openhuman-core/src/web_chat/voice_notes_tests.rs b/crates/openhuman-core/src/web_chat/voice_notes_tests.rs
index e6393746b3..b3935607d2 100644
--- a/crates/openhuman-core/src/web_chat/voice_notes_tests.rs
+++ b/crates/openhuman-core/src/web_chat/voice_notes_tests.rs
@@ -99,25 +99,19 @@ fn rpc_round_trip_and_bad_base64() {
#[test]
fn typed_voice_media_must_match_its_durable_note_reference() {
- use base64::Engine as _;
-
let tmp = tempfile::tempdir().unwrap();
store_note(tmp.path(), "note-typed", "audio/wav", &[0, 1, 2]).unwrap();
- let media = |note_id: &str, bytes: &[u8]| tinychannels_bus::MediaReference {
+ let media = |note_id: &str, content_type: &str| tinychannels_bus::MediaReference {
opaque_id: Some(note_id.into()),
- url: Some(format!(
- "data:audio/wav;base64,{}",
- base64::engine::general_purpose::STANDARD.encode(bytes)
- )),
- content_type: Some("audio/wav".into()),
+ content_type: Some(content_type.into()),
kind: tinychannels_bus::MediaKind::Audio,
..Default::default()
};
- assert!(validate_typed_media(tmp.path(), "note-typed", &media("note-typed", &[0, 1, 2])).is_ok());
- assert!(validate_typed_media(tmp.path(), "note-typed", &media("other-note", &[0, 1, 2])).is_err());
- assert!(validate_typed_media(tmp.path(), "note-typed", &media("note-typed", &[9])).is_err());
- assert!(validate_typed_media(tmp.path(), "missing", &media("missing", &[0])).is_err());
+ assert!(validate_typed_media(tmp.path(), "note-typed", &media("note-typed", "audio/wav")).is_ok());
+ assert!(validate_typed_media(tmp.path(), "note-typed", &media("other-note", "audio/wav")).is_err());
+ assert!(validate_typed_media(tmp.path(), "note-typed", &media("note-typed", "audio/mpeg")).is_err());
+ assert!(validate_typed_media(tmp.path(), "missing", &media("missing", "audio/wav")).is_err());
}
#[test]
diff --git a/scripts/debug/web-scripts/chat-voice-note-replay.mjs b/scripts/debug/web-scripts/chat-voice-note-replay.mjs
index 5ff9a72f22..b5f21a415c 100644
--- a/scripts/debug/web-scripts/chat-voice-note-replay.mjs
+++ b/scripts/debug/web-scripts/chat-voice-note-replay.mjs
@@ -50,7 +50,7 @@ export default async function voiceNoteReplay({ page, mock, log, screenshot }) {
(part) =>
part.kind === "voice_note" &&
part.voiceNote?.media?.opaqueId &&
- part.voiceNote?.media?.url?.startsWith("data:audio/wav;base64,") &&
+ !part.voiceNote?.media?.url &&
part.voiceNote?.durationMs > 0,
);
log(`voice-note chat RPC carried typed media: ${typedVoiceNoteSent}`);