This commit is contained in:
2026-08-05 00:56:55 -05:00
parent b0ad07f6f2
commit c321e17708
44 changed files with 2005 additions and 598 deletions
+12
View File
@@ -0,0 +1,12 @@
use galaxy_agent_core::RuntimeActivity;
const SERVER_MESSAGE_DATA_PREFIX: &str = "galaxy:runtime-activity:v1:";
pub(crate) fn encode(activity: &RuntimeActivity) -> Result<String, serde_json::Error> {
serde_json::to_string(activity).map(|json| format!("{SERVER_MESSAGE_DATA_PREFIX}{json}"))
}
pub(crate) fn decode(server_message_data: &str) -> Option<RuntimeActivity> {
let json = server_message_data.strip_prefix(SERVER_MESSAGE_DATA_PREFIX)?;
serde_json::from_str(json).ok()
}