From 76bd8ccb2d133c177d55cc4c4d0f9f8af2c45379 Mon Sep 17 00:00:00 2001 From: Valeriy Selitskiy <239034+iamwavecut@users.noreply.github.com> Date: Sat, 10 Oct 2026 14:44:02 +0200 Subject: [PATCH] fix(dialog): expose reaction allowlist in tool schema --- crates/openplotva-dialog/src/lib.rs | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/crates/openplotva-dialog/src/lib.rs b/crates/openplotva-dialog/src/lib.rs index 5bc4b1b3..b38af3da 100644 --- a/crates/openplotva-dialog/src/lib.rs +++ b/crates/openplotva-dialog/src/lib.rs @@ -1251,6 +1251,9 @@ fn tool_argument_schema(arg: &ToolArgSpec) -> Value { } } match arg.name { + "emoji" => { + schema.insert("enum".to_owned(), json!(SESSION_REACTION_ALLOWED_EMOJI)); + } "scope" => { schema.insert("enum".to_owned(), json!(["thread", "chat"])); } @@ -5590,6 +5593,26 @@ mod tests { ); } + #[test] + fn reaction_schema_rejects_unsupported_and_lifecycle_emoji() { + let schema = tool_parameters_schema(&SESSION_REACT_TO_MESSAGE_SPEC); + let emoji = &schema["properties"]["emoji"]; + assert_eq!(emoji["type"], "string"); + let choices = emoji["enum"].as_array().expect("bounded emoji choices"); + for allowed in ["🤣", "😁", "👍", "❤"] { + assert!(choices.contains(&json!(allowed))); + } + for rejected in ["😂", "🤫", "😄", "👀", "✍", "🤔"] { + assert!(!choices.contains(&json!(rejected))); + } + assert!( + schema["required"] + .as_array() + .expect("required arguments") + .contains(&json!("emoji")) + ); + } + #[test] fn tool_catalog_preserves_existing_tools_and_exposes_agent_context() { let names = alternative_dialog_tool_names();