Compare commits

...
Author SHA1 Message Date
celestial-vault fed3c96c6a fix link by calling grpc 2025-06-24 11:17:05 -07:00
3 changed files with 30 additions and 9 deletions
+3
View File
@@ -265,4 +265,7 @@ service UiService {
// Returns the HTML for the webview index page. This is only used by external clients, not by the vscode webview.
rpc getWebviewHtml(EmptyRequest) returns (String);
// Opens a URL in the default browser
rpc openUrl(StringRequest) returns (Empty);
}
+20
View File
@@ -0,0 +1,20 @@
import type { Controller } from "../index"
import type { StringRequest } from "../../../shared/proto/common"
import { Empty } from "../../../shared/proto/common"
import { openUrlInBrowser } from "../../../utils/github-url-utils"
/**
* Opens a URL in the default browser
* @param controller The controller instance
* @param request The URL to open
* @returns Empty response
*/
export async function openUrl(controller: Controller, request: StringRequest): Promise<Empty> {
try {
await openUrlInBrowser(request.value)
return Empty.create({})
} catch (error) {
console.error(`Failed to open URL: ${error}`)
throw error
}
}
+7 -9
View File
@@ -17,7 +17,7 @@ import McpResponseDisplay from "@/components/mcp/chat-display/McpResponseDisplay
import McpResourceRow from "@/components/mcp/configuration/tabs/installed/server-row/McpResourceRow"
import McpToolRow from "@/components/mcp/configuration/tabs/installed/server-row/McpToolRow"
import { useExtensionState } from "@/context/ExtensionStateContext"
import { FileServiceClient, TaskServiceClient } from "@/services/grpc-client"
import { FileServiceClient, TaskServiceClient, UiServiceClient } from "@/services/grpc-client"
import { findMatchingResourceOrTemplate, getMcpServerDisplayName } from "@/utils/mcp"
import { vscode } from "@/utils/vscode"
import {
@@ -697,15 +697,13 @@ export const ChatRowContent = ({
msUserSelect: "none",
}}
onClick={() => {
// Attempt to open the URL in the default browser
// Open the URL in the default browser using gRPC
if (tool.path) {
// Assuming 'openUrl' is a valid action the extension can handle.
// If not, this might need adjustment based on how other external link openings are handled.
vscode.postMessage({
type: "action", // This should be a valid MessageType from WebviewMessage
action: "openUrl", // This should be a valid WebviewAction from WebviewMessage
url: tool.path,
} as any) // Using 'as any' for now if 'openUrl' isn't strictly typed yet
UiServiceClient.openUrl(StringRequest.create({ value: tool.path }))
.catch((err) => {
console.error("Failed to open URL:", err)
})
}
}}>
<span