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:
@@ -1,3 +1,4 @@
|
||||
use crate::agents::apps_extension;
|
||||
use crate::agents::chatrecall_extension;
|
||||
use crate::agents::code_execution_extension;
|
||||
use crate::agents::extension_manager_extension;
|
||||
@@ -54,6 +55,17 @@ pub static PLATFORM_EXTENSIONS: Lazy<HashMap<&'static str, PlatformExtensionDef>
|
||||
},
|
||||
);
|
||||
|
||||
map.insert(
|
||||
apps_extension::EXTENSION_NAME,
|
||||
PlatformExtensionDef {
|
||||
name: apps_extension::EXTENSION_NAME,
|
||||
description:
|
||||
"Create and manage custom Goose apps through chat. Apps are HTML/CSS/JavaScript and run in sandboxed windows.",
|
||||
default_enabled: true,
|
||||
client_factory: |ctx| Box::new(apps_extension::AppsManagerClient::new(ctx).unwrap()),
|
||||
},
|
||||
);
|
||||
|
||||
map.insert(
|
||||
chatrecall_extension::EXTENSION_NAME,
|
||||
PlatformExtensionDef {
|
||||
@@ -111,6 +123,38 @@ pub struct PlatformExtensionContext {
|
||||
pub session_manager: std::sync::Arc<crate::session::SessionManager>,
|
||||
}
|
||||
|
||||
impl PlatformExtensionContext {
|
||||
pub fn result_with_platform_notification(
|
||||
&self,
|
||||
mut result: rmcp::model::CallToolResult,
|
||||
extension_name: impl Into<String>,
|
||||
event_type: impl Into<String>,
|
||||
mut additional_params: serde_json::Map<String, serde_json::Value>,
|
||||
) -> rmcp::model::CallToolResult {
|
||||
additional_params.insert("extension".to_string(), extension_name.into().into());
|
||||
additional_params.insert("event_type".to_string(), event_type.into().into());
|
||||
|
||||
let meta_value = serde_json::json!({
|
||||
"platform_notification": {
|
||||
"method": "platform_event",
|
||||
"params": additional_params
|
||||
}
|
||||
});
|
||||
|
||||
if let Some(ref mut meta) = result.meta {
|
||||
if let Some(obj) = meta_value.as_object() {
|
||||
for (k, v) in obj {
|
||||
meta.0.insert(k.clone(), v.clone());
|
||||
}
|
||||
}
|
||||
} else {
|
||||
result.meta = Some(rmcp::model::Meta(meta_value.as_object().unwrap().clone()));
|
||||
}
|
||||
|
||||
result
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct PlatformExtensionDef {
|
||||
pub name: &'static str,
|
||||
|
||||
Reference in New Issue
Block a user