feat: use the same permission flow for enable extensions (#2302)
This commit is contained in:
@@ -59,14 +59,6 @@ pub struct ToolConfirmationRequest {
|
||||
pub prompt: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct ExtensionRequest {
|
||||
pub id: String,
|
||||
pub extension_name: String,
|
||||
pub tool_name: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
|
||||
pub struct ThinkingContent {
|
||||
pub thinking: String,
|
||||
@@ -95,7 +87,6 @@ pub enum MessageContent {
|
||||
ToolRequest(ToolRequest),
|
||||
ToolResponse(ToolResponse),
|
||||
ToolConfirmationRequest(ToolConfirmationRequest),
|
||||
ExtensionRequest(ExtensionRequest),
|
||||
FrontendToolRequest(FrontendToolRequest),
|
||||
Thinking(ThinkingContent),
|
||||
RedactedThinking(RedactedThinkingContent),
|
||||
@@ -145,18 +136,6 @@ impl MessageContent {
|
||||
})
|
||||
}
|
||||
|
||||
pub fn extension_request<S: Into<String>>(
|
||||
id: S,
|
||||
extension_name: String,
|
||||
tool_name: String,
|
||||
) -> Self {
|
||||
MessageContent::ExtensionRequest(ExtensionRequest {
|
||||
id: id.into(),
|
||||
extension_name,
|
||||
tool_name,
|
||||
})
|
||||
}
|
||||
|
||||
pub fn thinking<S1: Into<String>, S2: Into<String>>(thinking: S1, signature: S2) -> Self {
|
||||
MessageContent::Thinking(ThinkingContent {
|
||||
thinking: thinking.into(),
|
||||
@@ -198,14 +177,6 @@ impl MessageContent {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn as_extension_request(&self) -> Option<&ExtensionRequest> {
|
||||
if let MessageContent::ExtensionRequest(ref extension_request) = self {
|
||||
Some(extension_request)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
pub fn as_tool_response_text(&self) -> Option<String> {
|
||||
if let Some(tool_response) = self.as_tool_response() {
|
||||
if let Ok(contents) = &tool_response.tool_result {
|
||||
@@ -365,19 +336,6 @@ impl Message {
|
||||
))
|
||||
}
|
||||
|
||||
pub fn with_extension_request<S: Into<String>>(
|
||||
self,
|
||||
id: S,
|
||||
extension_name: String,
|
||||
tool_name: String,
|
||||
) -> Self {
|
||||
self.with_content(MessageContent::extension_request(
|
||||
id,
|
||||
extension_name,
|
||||
tool_name,
|
||||
))
|
||||
}
|
||||
|
||||
pub fn with_frontend_tool_request<S: Into<String>>(
|
||||
self,
|
||||
id: S,
|
||||
|
||||
Reference in New Issue
Block a user