Vibe mcp apps (#6569)
Co-authored-by: Douwe Osinga <douwe@squareup.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: Michael Neale <michael.neale@gmail.com>
This commit is contained in:
@@ -171,6 +171,8 @@ pub enum SystemNotificationType {
|
||||
pub struct SystemNotificationContent {
|
||||
pub notification_type: SystemNotificationType,
|
||||
pub msg: String,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub data: Option<serde_json::Value>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, ToSchema)]
|
||||
@@ -369,6 +371,19 @@ impl MessageContent {
|
||||
MessageContent::SystemNotification(SystemNotificationContent {
|
||||
notification_type,
|
||||
msg: msg.into(),
|
||||
data: None,
|
||||
})
|
||||
}
|
||||
|
||||
pub fn system_notification_with_data<S: Into<String>>(
|
||||
notification_type: SystemNotificationType,
|
||||
msg: S,
|
||||
data: serde_json::Value,
|
||||
) -> Self {
|
||||
MessageContent::SystemNotification(SystemNotificationContent {
|
||||
notification_type,
|
||||
msg: msg.into(),
|
||||
data: Some(data),
|
||||
})
|
||||
}
|
||||
|
||||
@@ -816,39 +831,47 @@ impl Message {
|
||||
.with_metadata(MessageMetadata::user_only())
|
||||
}
|
||||
|
||||
/// Set the visibility metadata for the message
|
||||
pub fn with_system_notification_with_data<S: Into<String>>(
|
||||
self,
|
||||
notification_type: SystemNotificationType,
|
||||
msg: S,
|
||||
data: serde_json::Value,
|
||||
) -> Self {
|
||||
self.with_content(MessageContent::system_notification_with_data(
|
||||
notification_type,
|
||||
msg,
|
||||
data,
|
||||
))
|
||||
.with_metadata(MessageMetadata::user_only())
|
||||
}
|
||||
|
||||
pub fn with_visibility(mut self, user_visible: bool, agent_visible: bool) -> Self {
|
||||
self.metadata.user_visible = user_visible;
|
||||
self.metadata.agent_visible = agent_visible;
|
||||
self
|
||||
}
|
||||
|
||||
/// Set the entire metadata for the message
|
||||
pub fn with_metadata(mut self, metadata: MessageMetadata) -> Self {
|
||||
self.metadata = metadata;
|
||||
self
|
||||
}
|
||||
|
||||
/// Mark the message as only visible to the user (not the agent)
|
||||
pub fn user_only(mut self) -> Self {
|
||||
self.metadata.user_visible = true;
|
||||
self.metadata.agent_visible = false;
|
||||
self
|
||||
}
|
||||
|
||||
/// Mark the message as only visible to the agent (not the user)
|
||||
pub fn agent_only(mut self) -> Self {
|
||||
self.metadata.user_visible = false;
|
||||
self.metadata.agent_visible = true;
|
||||
self
|
||||
}
|
||||
|
||||
/// Check if the message is visible to the user
|
||||
pub fn is_user_visible(&self) -> bool {
|
||||
self.metadata.user_visible
|
||||
}
|
||||
|
||||
/// Check if the message is visible to the agent
|
||||
pub fn is_agent_visible(&self) -> bool {
|
||||
self.metadata.agent_visible
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user