Install copilot agent from command line

I am copy pasting from this thread because this is exactly the issue that is relevant for me: Install Copilot extension from the command line?

I have R-Studio Server running in a Docker container as part of a Kubernetes-based JupyterHub deployment. It's working well and the new Copilot integration looks good!

The docs here describe how to install and activate Copilot. This works, but Step 3 ("Download and install the Copilot Agent components") is done manually through the UI, which means users need to install the extension every time they start a new session (because the Docker image on the JupyterHub is destroyed when they shutdown, such that new packages installed outside of HOME are lost).

Is there a way to install the Copilot extension as part of my Docker build, so users just have to sign in (rather than repeating the whole setup every time)?

I can see that R-Studio is downloading the extension from

https://rstudio.org/links/github-copilot

so I can get these files easily in Docker, but I can't find any documentation on where to put them/how to install them so they are recognised by R-Studio. Looking at the contents of the download, it seems the R-Studio extension is somehow related to copilot.vim?

Any tips would be great. Thank you!