pokey / command-server

Secure VSCode communication channel designed for voice coding
MIT License
16 stars 9 forks source link

Provide an option to override request and response JSON files #28

Open sashkachan opened 2 months ago

sashkachan commented 2 months ago

Currently both python and ts rely on the function to get temporary folder location from os. https://github.com/pokey/command-server/blob/b49e02b2bbbf91c9dacd038c2ff02a615d32b58d/src/paths.ts#L4C1-L12C2

and

https://github.com/talonhub/community/blob/0a4af444e661aa4441263175bd44e76d98d9bf94/apps/vscode/command_client/command_client.py#L213 (I understand this is from talon community and probably needs a relevant issue created)

However, there are extensions in VSCode (eg direnv) that may override the TMP folder location (think project specific shells).

Because the python code runs outside of that context, the location of {request,response}.json will be different than the one from vscode extension, which will render all talon vscode commands inoperable.

When I open a project with .envrc file and in the terminal TMP folder is changed:

echo $TMP
/var/folders/6n/qycjrd7s6x95t6nq5tgb4np00000gn/T/nix-shell.9c46CY

When I speak a command, I can see the request.json file is created elsewhere:

fd '^request.json' /
/System/Volumes/Data/private/var/folders/6n/qycjrd7s6x95t6nq5tgb4np00000gn/T/vscode-command-server-501/request.json

And there's no request.json file in the location expected by the extension:

ls  /var/folders/6n/qycjrd7s6x95t6nq5tgb4np00000gn/T/nix-shell.9c46CY/vscode-command-server-501/
response.json

The following error shows up in VS Code:

A system error occurred (EEXIST: file already exists, open '/var/folders/6n/qycjrd7s6x95t6nq5tgb4np00000gn/T/nix-shell.9c46CY/vscode-command-server-501/response.json')

I think it's a red herring, as the extension cannot find request.json file.

A way to circumvent that could be to allow overriding the expected location of request and response files.

EDIT: This is also covered in: https://talon.wiki/Quickstart/Non-standard%20Usage/nix#nix-with-the-community-vscode-command-server