Elffuss BraidHub

kikocis/continue public

08dbbc23cfc7 · 3.1 KiBRawPermalink
1import type {
2 ContinueRcJson,
3 DiffLine,
4 FileStatsMap,
5 FileType,
6 IDE,
7 IdeInfo,
8 IdeSettings,
9 IndexTag,
10 Location,
11 Problem,
12 Range,
13 RangeInFile,
14 TerminalOptions,
15 Thread,
16} from "../";
17import { ControlPlaneSessionInfo } from "../control-plane/AuthTypes";
18
19export interface GetGhTokenArgs {
20 force?: boolean;
21}
22
23export type ToIdeFromWebviewOrCoreProtocol = {
24 // Methods from IDE type
25 getIdeInfo: [undefined, IdeInfo];
26 getWorkspaceDirs: [undefined, string[]];
27 writeFile: [{ path: string; contents: string }, void];
28 showVirtualFile: [{ name: string; content: string }, void];
29 openFile: [{ path: string }, void];
30 openUrl: [string, void];
31 runCommand: [{ command: string; options?: TerminalOptions }, void];
32 getSearchResults: [{ query: string }, string];
33 getFileResults: [{ pattern: string }, string[]];
34 subprocess: [{ command: string; cwd?: string }, [string, string]];
35 saveFile: [{ filepath: string }, void];
36 fileExists: [{ filepath: string }, boolean];
37 readFile: [{ filepath: string }, string];
38 diffLine: [
39 {
40 diffLine: DiffLine;
41 filepath: string;
42 startLine: number;
43 endLine: number;
44 },
45 void,
46 ];
47 getProblems: [{ filepath: string }, Problem[]];
48 getOpenFiles: [undefined, string[]];
49 getCurrentFile: [
50 undefined,
51 (
52 | undefined
53 | {
54 isUntitled: boolean;
55 path: string;
56 contents: string;
57 }
58 ),
59 ];
60 getPinnedFiles: [undefined, string[]];
61 showLines: [{ filepath: string; startLine: number; endLine: number }, void];
62 readRangeInFile: [{ filepath: string; range: Range }, string];
63 getDiff: [{ includeUnstaged: boolean }, string[]];
64 getWorkspaceConfigs: [undefined, ContinueRcJson[]];
65 getTerminalContents: [undefined, string];
66 getDebugLocals: [{ threadIndex: number }, string];
67 getTopLevelCallStackSources: [
68 { threadIndex: number; stackDepth: number },
69 string[],
70 ];
71 getAvailableThreads: [undefined, Thread[]];
72 isTelemetryEnabled: [undefined, boolean];
73 getUniqueId: [undefined, string];
74 getTags: [string, IndexTag[]];
75 readSecrets: [{ keys: string[] }, Record<string, string>];
76 writeSecrets: [{ secrets: Record<string, string> }, void];
77 // end methods from IDE type
78
79 getIdeSettings: [undefined, IdeSettings];
80
81 // Git
82 getBranch: [{ dir: string }, string];
83 getRepoName: [{ dir: string }, string | undefined];
84
85 showToast: [
86 Parameters<IDE["showToast"]>,
87 Awaited<ReturnType<IDE["showToast"]>>,
88 ];
89 getGitRootPath: [{ dir: string }, string | undefined];
90 listDir: [{ dir: string }, [string, FileType][]];
91 getFileStats: [{ files: string[] }, FileStatsMap];
92
93 gotoDefinition: [{ location: Location }, RangeInFile[]];
94
95 getGitHubAuthToken: [GetGhTokenArgs, string | undefined];
96 getControlPlaneSessionInfo: [
97 { silent: boolean; useOnboarding: boolean },
98 ControlPlaneSessionInfo | undefined,
99 ];
100 logoutOfControlPlane: [undefined, void];
101 reportError: [any, void];
102 closeSidebar: [undefined, void];
103};
104
105export type ToWebviewOrCoreFromIdeProtocol = {
106 didChangeActiveTextEditor: [{ filepath: string }, void];
107};