- request-scoped lifecycle одного tools/call: валидированный `_meta.progressToken` (строковый/числовой, 1..=128 байт) и bounded очередь реальных этапов (tool_resolved → authorization_resolved → execution_dispatched) в собственный SSE-stream запроса; без token или без stream-carrier результат не меняется; - сериализация `notifications/progress` по pinned схеме обеих revisions (progressToken/progress/message, total не изобретается); - отмена по revision: 2025-11-25 — `notifications/cancelled` через bounded in-flight таблицу (владение = session + platform credential, не progress token); 2026-07-28 — закрытие response stream; в обоих случаях drop будущего вызова = кооперативная остановка, terminal-сообщение не отправляется; - streamed ответ сохраняет проекцию Story 3.18: closed `notifications/message` перед финальным кадром (перенос logging-scope в тело стрима); - ATDD: 12 end-to-end тестов на реальном endpoint/каталоге/counted upstream (обе revisions, malformed/oversized/reused token, owner/foreign/late cancel, disconnect, ambiguous outbound, representative client smoke) + 7 unit-тестов границ lifecycle; entry в scripts/ci-story-checks.sh.
41 lines
1.6 KiB
Rust
41 lines
1.6 KiB
Rust
use serde::{Deserialize, Serialize};
|
|
use serde_json::Value;
|
|
|
|
#[derive(Debug, Serialize, Deserialize)]
|
|
pub(super) struct InitializeParams {
|
|
#[serde(rename = "protocolVersion")]
|
|
pub(super) protocol_version: String,
|
|
#[serde(default)]
|
|
pub(super) capabilities: Value,
|
|
}
|
|
|
|
#[derive(Debug, Serialize, Deserialize)]
|
|
pub(super) struct ToolCallParams {
|
|
pub(super) name: String,
|
|
#[serde(default, deserialize_with = "deserialize_arguments_object")]
|
|
pub(super) arguments: Option<Value>,
|
|
/// Story 3.4: the pinned `RequestMetaObject` of this request. Only the validated
|
|
/// `progressToken` of it is read, and only to decide whether the client asked for out-of-band
|
|
/// progress; a malformed or foreign `_meta` never fails the call.
|
|
#[serde(default, rename = "_meta")]
|
|
pub(super) meta: Option<Value>,
|
|
}
|
|
|
|
/// The pinned `CallToolRequest.params.arguments` is an **optional object**. Omitting it stays valid
|
|
/// (and keeps its previous behaviour), while an explicit `null`, array or scalar is invalid params — so
|
|
/// the two cases must not collapse into one another during deserialization. The object shape check
|
|
/// itself is shared with the `call_tool` proxy's nested `arguments` (`protocol::deserialize_object_only`).
|
|
fn deserialize_arguments_object<'de, D>(deserializer: D) -> Result<Option<Value>, D::Error>
|
|
where
|
|
D: serde::Deserializer<'de>,
|
|
{
|
|
crate::protocol::deserialize_object_only(deserializer).map(Some)
|
|
}
|
|
|
|
#[derive(Debug, Deserialize)]
|
|
pub(super) struct ApprovalDecisionPayload {
|
|
pub(super) approve: String,
|
|
#[serde(default)]
|
|
pub(super) note: Option<String>,
|
|
}
|