154
},
155
}
156
157
-/// Internal helper that mirrors all wire representations of SessionSourceType
158
-/// (both legacy and new) so we don't recursively call SessionSourceType's
159
-/// custom Deserialize impl.
157
+/// Mirrors the legacy unit-variant form and the new struct-variant form so
158
+/// the custom `Deserialize` impl can accept both shapes.
159
#[derive(Deserialize)]
160
#[serde(untagged)]
161
enum SessionSourceTypeWire {
163
- /// Legacy representation: "User" or "AmbientAgent".
162
+ /// Legacy representation: bare `"User"` or `"AmbientAgent"`.
163
Legacy(LegacySessionSourceType),
165
- /// New representation: externally tagged AmbientAgent with fields, e.g.
166
- /// { "AmbientAgent": { "task_id": "..." } }.
164
+ /// New representation: externally tagged `AmbientAgent` with fields, e.g.
165
+ /// `{ "AmbientAgent": { "task_id": "..." } }`.
166
New {
167
#[serde(rename = "AmbientAgent")]
168
ambient_agent: AmbientAgentFields,
262
#[serde(default)]
263
pub source_type: SessionSourceType,
264
265
+ /// Optional orchestrator `task_id` carried alongside `source_type`.
266
+ /// Set when the sharer wants downstream orchestration discovery to find
267
+ /// this share's children regardless of variant kind. Sidecar so the
268
+ /// `User` variant can stay a unit and old viewers ignore it.
269
+ #[serde(default)]
270
+ pub source_task_id: Option<String>,
271
+
272
/// Client feature support declaration.
273
#[serde(default)]
274
pub feature_support: FeatureSupport,
480
}
481
482
/// The possible messages sent from client (sharer) to server.
483
+// `Initialize(InitPayload)` is much larger than the other variants because
484
+// `InitPayload` carries scrollback and feature-support data. Boxing it would
485
+// be wire-compatible but churn every call site; suppress the lint instead.
486
+#[allow(clippy::large_enum_variant)]
487
#[derive(Debug, Deserialize, Serialize)]
488
pub enum UpstreamMessage {
489
/// The client sends this message to start a shared session.