continue-custom/core/protocol/ideWebview.ts
Fred Bricon 71a0a1cd7d feat: expose legacy /share command to VS Code UI
The legacy `/share` slash command is no longer available when using config.yaml.
While the feature could be replaced by a custom prompt command + a tools-supporting model,
it's fairly slow/buggy when relying on local models.

Instead, we're exposing the feature to the VS Code UI
- as a button on each conversation in the history view
- as a VS Code command `Share Current Chat Session as Markdown`

Unfortunately, because the IDE requires special handling for the destination folder selection,
the gui code needs to check if it's running on jetbrains in order to disable this new feature

Signed-off-by: Fred Bricon <fbricon@gmail.com>
2025-08-18 16:12:06 +02:00

81 lines
2.7 KiB
TypeScript

import { ToIdeFromWebviewOrCoreProtocol } from "./ide";
import { ToWebviewFromIdeOrCoreProtocol } from "./webview";
import {
AcceptOrRejectDiffPayload,
ApplyState,
ApplyToFilePayload,
HighlightedCodePayload,
MessageContent,
RangeInFileWithContents,
SetCodeToEditPayload,
ShowFilePayload,
} from "../";
export type ToIdeFromWebviewProtocol = ToIdeFromWebviewOrCoreProtocol & {
openUrl: [string, void];
applyToFile: [ApplyToFilePayload, void];
overwriteFile: [{ filepath: string; prevFileContent: string | null }, void];
showTutorial: [undefined, void];
showFile: [ShowFilePayload, void];
toggleDevTools: [undefined, void];
reloadWindow: [undefined, void];
focusEditor: [undefined, void];
toggleFullScreen: [{ newWindow?: boolean } | undefined, void];
insertAtCursor: [{ text: string }, void];
copyText: [{ text: string }, void];
"jetbrains/isOSREnabled": [undefined, boolean];
"jetbrains/onLoad": [
undefined,
{
windowId: string;
serverUrl: string;
workspacePaths: string[];
vscMachineId: string;
vscMediaUrl: string;
},
];
"jetbrains/getColors": [undefined, Record<string, string | null | undefined>];
"vscode/openMoveRightMarkdown": [undefined, void];
acceptDiff: [AcceptOrRejectDiffPayload, void];
rejectDiff: [AcceptOrRejectDiffPayload, void];
"edit/sendPrompt": [
{
prompt: MessageContent;
range: RangeInFileWithContents;
},
string | undefined,
];
"edit/addCurrentSelection": [undefined, void];
"edit/clearDecorations": [undefined, void];
"session/share": [{ sessionId: string }, void];
};
export type ToWebviewFromIdeProtocol = ToWebviewFromIdeOrCoreProtocol & {
setInactive: [undefined, void];
newSessionWithPrompt: [{ prompt: string }, void];
userInput: [{ input: string }, void];
focusContinueInput: [undefined, void];
focusContinueInputWithoutClear: [undefined, void];
focusContinueInputWithNewSession: [undefined, void];
highlightedCode: [HighlightedCodePayload, void];
setCodeToEdit: [SetCodeToEditPayload, void];
navigateTo: [{ path: string; toggle?: boolean }, void];
addModel: [undefined, void];
focusContinueSessionId: [{ sessionId: string | undefined }, void];
newSession: [undefined, void];
setTheme: [{ theme: any }, void];
setColors: [{ [key: string]: string }, void];
"jetbrains/editorInsetRefresh": [undefined, void];
"jetbrains/isOSREnabled": [boolean, void];
setupApiKey: [undefined, void];
setupLocalConfig: [undefined, void];
incrementFtc: [undefined, void];
openOnboardingCard: [undefined, void];
applyCodeFromChat: [undefined, void];
updateApplyState: [ApplyState, void];
exitEditMode: [undefined, void];
focusEdit: [undefined, void];
generateRule: [undefined, void];
};