fix(vscode): make session markdown export save/reveal work
This commit is contained in:
@@ -113,6 +113,12 @@ export const createVSCodeFilesAPI = (): FilesAPI => ({
|
||||
};
|
||||
},
|
||||
|
||||
async revealPath(path: string): Promise<{ success: boolean }> {
|
||||
const target = normalizePath(path);
|
||||
const data = await sendBridgeMessage<{ success?: boolean }>('api:fs:reveal', { path: target });
|
||||
return { success: Boolean(data?.success) };
|
||||
},
|
||||
|
||||
async execCommands(commands: string[], cwd: string): Promise<{ success: boolean; results: CommandExecResult[] }> {
|
||||
const targetCwd = normalizePath(cwd);
|
||||
const data = await sendBridgeMessageWithOptions<{ success: boolean; results?: CommandExecResult[] }>('api:fs:exec', {
|
||||
|
||||
@@ -589,6 +589,18 @@ const handleLocalApiRequest = async (url: URL, init?: RequestInit) => {
|
||||
return new Response(JSON.stringify(data), { status: 200, headers: { 'Content-Type': 'application/json' } });
|
||||
}
|
||||
|
||||
if (pathname.startsWith('/api/vscode/save-markdown') && method === 'POST') {
|
||||
const body = init?.body ? JSON.parse(init.body as string) : {};
|
||||
const fileName = typeof (body as { fileName?: unknown }).fileName === 'string'
|
||||
? (body as { fileName: string }).fileName
|
||||
: undefined;
|
||||
const content = typeof (body as { content?: unknown }).content === 'string'
|
||||
? (body as { content: string }).content
|
||||
: undefined;
|
||||
const data = await sendBridgeMessage('api:files/save-markdown', { fileName, content });
|
||||
return new Response(JSON.stringify(data), { status: 200, headers: { 'Content-Type': 'application/json' } });
|
||||
}
|
||||
|
||||
if (pathname.startsWith('/api/config/agents/')) {
|
||||
const encodedName = pathname.slice('/api/config/agents/'.length);
|
||||
const name = decodeURIComponent(encodedName);
|
||||
|
||||
Reference in New Issue
Block a user