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
18 lines
584 B
TypeScript
18 lines
584 B
TypeScript
import type { VSCodeAPI } from '@openchamber/ui/lib/api/types';
|
|
import { executeVSCodeCommand, openVSCodeExternalUrl } from './bridge';
|
|
|
|
export const createVSCodeActionsAPI = (): VSCodeAPI => ({
|
|
async executeCommand(command: string, ...args: unknown[]): Promise<unknown> {
|
|
const result = await executeVSCodeCommand(command, args);
|
|
return result.result;
|
|
},
|
|
|
|
async openAgentManager(): Promise<void> {
|
|
await executeVSCodeCommand('openchamber.openAgentManager');
|
|
},
|
|
|
|
async openExternalUrl(url: string): Promise<void> {
|
|
await openVSCodeExternalUrl(url);
|
|
},
|
|
});
|