Elffuss BraidHub

kikocis/continue public

Merge pull request #6276 from uinstinct/remote-ripgprep

fix: skip ripgrep if workspace is remote
Changeset7605f2052544a474ccd7b75430d79d814859cd30758e22f080ba6c8e1c37eae0
AuthorPatrick Erichsen <patrick.a.erichsen@gmail.com> · 2025-06-25 11:19 -07:00
CommitterGitHub <noreply@github.com> · 2025-06-25 11:19 -07:00
Parents354acc983ff4, a7b738cad2c7

Browse the files at this changeset

10 files changed

modified core/config/yaml/loadYaml.ts +2 −2
@@ -39,7 +39,7 @@
3939 import { modifyAnyConfigWithSharedConfig } from "../sharedConfig";
4040
4141 import { getControlPlaneEnvSync } from "../../control-plane/env";
42-import { baseToolDefinitions } from "../../tools";
42+import { getToolsForIde } from "../../tools";
4343 import { getCleanUriPath } from "../../util/uri";
4444 import { getAllDotContinueDefinitionFiles } from "../loadLocalAssistants";
4545 import { LocalPlatformClient } from "./LocalPlatformClient";
@@ -187,7 +187,7 @@
187187
188188 const continueConfig: ContinueConfig = {
189189 slashCommands: [],
190- tools: [...baseToolDefinitions],
190+ tools: await getToolsForIde(ide),
191191 mcpServerStatuses: [],
192192 contextProviders: [],
193193 modelsByRole: {
modified core/index.d.ts +2 −0
@@ -731,6 +731,8 @@
731731
732732 isTelemetryEnabled(): Promise<boolean>;
733733
734+ isWorkspaceRemote(): Promise<boolean>;
735+
734736 getUniqueId(): Promise<string>;
735737
736738 getTerminalContents(): Promise<string>;
modified core/protocol/ide.ts +1 −0
@@ -70,6 +70,7 @@
7070 ];
7171 getAvailableThreads: [undefined, Thread[]];
7272 isTelemetryEnabled: [undefined, boolean];
73+ isWorkspaceRemote: [undefined, boolean];
7374 getUniqueId: [undefined, string];
7475 getTags: [string, IndexTag[]];
7576 readSecrets: [{ keys: string[] }, Record<string, string>];
modified core/protocol/messenger/messageIde.ts +4 −0
@@ -106,6 +106,10 @@
106106 return this.request("isTelemetryEnabled", undefined);
107107 }
108108
109+ isWorkspaceRemote(): Promise<boolean> {
110+ return this.request("isWorkspaceRemote", undefined);
111+ }
112+
109113 getUniqueId(): Promise<string> {
110114 return this.request("getUniqueId", undefined);
111115 }
modified core/tools/index.ts +9 −2
@@ -1,4 +1,4 @@
1-import { ConfigDependentToolParams, Tool } from "..";
1+import { ConfigDependentToolParams, IDE, Tool } from "..";
22 import { createNewFileTool } from "./definitions/createNewFile";
33 import { createRuleBlock } from "./definitions/createRuleBlock";
44 import { editFileTool } from "./definitions/editFile";
@@ -13,12 +13,14 @@
1313 import { searchWebTool } from "./definitions/searchWeb";
1414 import { viewDiffTool } from "./definitions/viewDiff";
1515
16+// missing support for remote os calls: https://github.com/microsoft/vscode/issues/252269
17+export const localOnlyToolDefinitions = [grepSearchTool];
18+
1619 export const baseToolDefinitions = [
1720 readFileTool,
1821 editFileTool,
1922 createNewFileTool,
2023 runTerminalCommandTool,
21- grepSearchTool,
2224 globSearchTool,
2325 searchWebTool,
2426 viewDiffTool,
@@ -34,3 +36,8 @@
3436 export const getConfigDependentToolDefinitions = (
3537 params: ConfigDependentToolParams,
3638 ): Tool[] => [requestRuleTool(params)];
39+
40+export const getToolsForIde = async (ide: IDE) =>
41+ (await ide.isWorkspaceRemote())
42+ ? baseToolDefinitions
43+ : [...baseToolDefinitions, ...localOnlyToolDefinitions];
modified core/util/filesystem.ts +4 −0
@@ -48,6 +48,10 @@
4848 return;
4949 }
5050
51+ isWorkspaceRemote(): Promise<boolean> {
52+ return Promise.resolve(false);
53+ }
54+
5155 async getIdeSettings(): Promise<IdeSettings> {
5256 return {
5357 remoteConfigServerUrl: undefined,
modified extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/IntelliJIde.kt +4 −0
@@ -126,6 +126,10 @@
126126 return true
127127 }
128128
129+ override suspend fun isWorkspaceRemote(): Boolean {
130+ return this.getIdeInfo().remoteName != "local"
131+ }
132+
129133 override suspend fun getUniqueId(): String {
130134 return getMachineUniqueID()
131135 }
modified extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/types.kt +2 −0
@@ -102,6 +102,8 @@
102102
103103 suspend fun isTelemetryEnabled(): Boolean
104104
105+ suspend fun isWorkspaceRemote(): Boolean
106+
105107 suspend fun getUniqueId(): String
106108
107109 suspend fun getTerminalContents(): String
modified extensions/vscode/src/VsCodeIde.ts +4 −0
@@ -200,6 +200,10 @@
200200 return globalEnabled && continueEnabled;
201201 }
202202
203+ isWorkspaceRemote(): Promise<boolean> {
204+ return Promise.resolve(vscode.env.remoteName !== undefined);
205+ }
206+
203207 getUniqueId(): Promise<string> {
204208 return Promise.resolve(vscode.env.machineId);
205209 }
added scripts/create-docker-ssh-container.sh +35 −0
@@ -0,0 +1,35 @@
1+# create the docker file
2+
3+cat > Dockerfile << 'EOF'
4+FROM ubuntu:latest
5+ENV DEBIAN_FRONTEND=noninteractive
6+# Install SSH server
7+RUN apt-get update && apt-get install -y openssh-server
8+# Configure SSH
9+RUN mkdir /var/run/sshd
10+RUN echo 'root:my_password' | chpasswd
11+# Allow root login
12+RUN sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config
13+# SSH login fix
14+RUN sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd
15+EXPOSE 22
16+CMD ["/usr/sbin/sshd", "-D"]
17+EOF
18+
19+docker build -t continue-ubuntu-ssh . # build the image
20+
21+rm Dockerfile # remove the created Dockerfile
22+
23+container_name="continue-ssh-container"
24+
25+docker run -d -p 2222:22 --name $container_name continue-ubuntu-ssh # run the container
26+
27+echo "docker container ${container_name} running on port 2222"
28+
29+# add the instructions
30+bold=$(tput bold)
31+normal=$(tput sgr0)
32+
33+echo "\n--------------------------------------"
34+echo "now ssh into vscode (using remote explorer) with the following command: ${bold}ssh root@localhost -p 2222${normal}"
35+echo "use the following password - \"${bold}my_password${normal}\""