CI / UI Checks (pull_request) Successful in 8s
CI / Rust Checks (pull_request) Successful in 27m22s
CI / Rust Feature Validation (pull_request) Skipped
CI / Frontend E2E (pull_request) Skipped
CI / Community Image Smoke (pull_request) Skipped
CI / Required Checks (pull_request) Successful in 1s
CI / Deploy (pull_request) Skipped
32 lines
1.2 KiB
Rust
32 lines
1.2 KiB
Rust
//! Lossless projection of legacy cancellation targets through the pinned SDK.
|
|
|
|
use rmcp::model::CancelledNotificationParam;
|
|
use serde_json::{Map, Value};
|
|
|
|
pub(super) fn decode_cancelled_request_id(params: &Value) -> Option<Value> {
|
|
let mut projection = Map::new();
|
|
let original_id = params.get("requestId");
|
|
if let Some(id) = original_id {
|
|
// SDK IDs use i64; the temporary string never reaches the in-flight lookup.
|
|
let projected = match id {
|
|
Value::Number(number) if number.as_i64().is_none() => Value::String(number.to_string()),
|
|
_ => id.clone(),
|
|
};
|
|
projection.insert("requestId".to_owned(), projected);
|
|
}
|
|
// Only requestId names a target; reason, _meta and extensions retain their ignore semantics.
|
|
let decoded =
|
|
serde_json::from_value::<CancelledNotificationParam>(Value::Object(projection)).ok()?;
|
|
#[cfg(test)]
|
|
super::dispatch_observer::sdk_cancelled_params_decoded();
|
|
let id = decoded.request_id?;
|
|
Some(match original_id {
|
|
Some(Value::Number(number)) => Value::Number(number.clone()),
|
|
_ => id.into_json_value(),
|
|
})
|
|
}
|
|
|
|
#[cfg(test)]
|
|
#[path = "rmcp_progress_cancel_tests.rs"]
|
|
mod tests;
|