π OpenHands: AI-Driven Development
Feat vscode startup (#7518)
tofarrb9af0188fe3b
diff --git a/openhands/runtime/plugins/vscode/__init__.py b/openhands/runtime/plugins/vscode/__init__.pyindex 0a93d6b3e9..efa7036a1b 100644--- a/openhands/runtime/plugins/vscode/__init__.py+++ b/openhands/runtime/plugins/vscode/__init__.py@@ -37,10 +37,10 @@ class VSCodePlugin(Plugin):f"su - {username} -s /bin/bash << 'EOF'\n"f'sudo chown -R {username}:{username} /openhands/.openvscode-server\n''cd /workspace\n'- f'exec /openhands/.openvscode-server/bin/openvscode-server --host 0.0.0.0 --connection-token {self.vscode_connection_token} --port {self.vscode_port}\n'+ f'exec /openhands/.openvscode-server/bin/openvscode-server --host 0.0.0.0 --connection-token {self.vscode_connection_token} --port {self.vscode_port} --disable-workspace-trust\n''EOF')- print(cmd)+self.gateway_process = subprocess.Popen(cmd,stderr=subprocess.STDOUT,diff --git a/openhands/runtime/plugins/vscode/settings.json b/openhands/runtime/plugins/vscode/settings.jsonnew file mode 100644index 0000000000..77c19483b7--- /dev/null+++ b/openhands/runtime/plugins/vscode/settings.json@@ -0,0 +1,4 @@+{+ "workbench.colorTheme": "Default Dark Modern",+ "workbench.startupEditor": "none"+}\ No newline at end of filediff --git a/openhands/runtime/utils/runtime_templates/Dockerfile.j2 b/openhands/runtime/utils/runtime_templates/Dockerfile.j2index bde8d45f70..f7b95cde4a 100644--- a/openhands/runtime/utils/runtime_templates/Dockerfile.j2+++ b/openhands/runtime/utils/runtime_templates/Dockerfile.j2@@ -135,6 +135,9 @@ RUN \COPY ./code/pyproject.toml ./code/poetry.lock /openhands/code/+COPY ./code/openhands/runtime/plugins/vscode/settings.json /workspace/.vscode/settings.json+RUN chmod -R a+rwx /workspace/.vscode/settings.json+{{ install_dependencies() }}# ================================================================@@ -147,6 +150,10 @@ COPY ./code/pyproject.toml ./code/poetry.lock /openhands/code/# ================================================================RUN if [ -d /openhands/code/openhands ]; then rm -rf /openhands/code/openhands; fiCOPY ./code/pyproject.toml ./code/poetry.lock /openhands/code/++COPY ./code/openhands/runtime/plugins/vscode/settings.json /workspace/.vscode/settings.json+RUN chmod -R a+rwx /workspace/.vscode/settings.json+COPY ./code/openhands /openhands/code/openhandsRUN chmod a+rwx /openhands/code/openhands/__init__.pydiff --git a/openhands/server/file_config.py b/openhands/server/file_config.pyindex 29d1c2bf61..1e4d6c5314 100644--- a/openhands/server/file_config.py+++ b/openhands/server/file_config.py@@ -5,7 +5,14 @@ from openhands.core.config import AppConfigfrom openhands.core.logger import openhands_logger as loggerfrom openhands.server.shared import config as shared_config-FILES_TO_IGNORE = ['.git/', '.DS_Store', 'node_modules/', '__pycache__/', 'lost+found/']+FILES_TO_IGNORE = [+ '.git/',+ '.DS_Store',+ 'node_modules/',+ '__pycache__/',+ 'lost+found/',+ '.vscode/',+]def sanitize_filename(filename):