fix: open external links in VS Code runtime
Route shared URL opening through VS Code host instead of webview window APIs Add a VS Code runtime URL-open API and bridge handler using vscode.env.openExternal Keep shared URL helper behavior unchanged for desktop and web
This commit is contained in:
@@ -138,6 +138,10 @@ export async function executeVSCodeCommand(command: string, args?: unknown[]): P
|
||||
return sendBridgeMessage<{ result?: unknown }>('vscode:command', { command, args });
|
||||
}
|
||||
|
||||
export async function openVSCodeExternalUrl(url: string): Promise<void> {
|
||||
await sendBridgeMessage('vscode:openExternalUrl', { url });
|
||||
}
|
||||
|
||||
type CommandHandler = (payload: unknown) => void;
|
||||
const commandHandlers = new Map<string, CommandHandler>();
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { VSCodeAPI } from '@openchamber/ui/lib/api/types';
|
||||
import { executeVSCodeCommand } from './bridge';
|
||||
import { executeVSCodeCommand, openVSCodeExternalUrl } from './bridge';
|
||||
|
||||
export const createVSCodeActionsAPI = (): VSCodeAPI => ({
|
||||
async executeCommand(command: string, ...args: unknown[]): Promise<unknown> {
|
||||
@@ -10,4 +10,8 @@ export const createVSCodeActionsAPI = (): VSCodeAPI => ({
|
||||
async openAgentManager(): Promise<void> {
|
||||
await executeVSCodeCommand('openchamber.openAgentManager');
|
||||
},
|
||||
|
||||
async openExternalUrl(url: string): Promise<void> {
|
||||
await openVSCodeExternalUrl(url);
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user