56
}
57
}
59
>
/**
60
>
* Install root for the VS Code CLI on the remote machine. Shared with
61
>
* Remote-SSH's exec-server installer so the two features can reuse each
62
>
* other's installations. Also the parent of the agent host lockfile dir.
63
>
*/
64
>
export function getRemoteCLIInstallRoot(serverDataFolderName: string): string {
65
const d = validateShellToken(serverDataFolderName, 'server data folder name');
66
return `~/${d}`;
67
}
69
>
/**
70
>
* Per-machine launcher data dir for `code agent host` (and the embedded
71
>
* CLI machinery it inherits). Passed as `--cli-data-dir` so the CLI's
72
>
* downloads cache, unpacked server installs, supervisor logs, and other
73
>
* launcher state land under the same root Remote-SSH's `command-shell`
74
>
* uses (e.g. `~/.vscode-server/cli`). Without this flag the CLI would
75
>
* default to `~/.vscode-cli{,-<quality>}/` and split state across two
76
>
* roots.
77
>
*
78
>
* The lockfile is unaffected: the Rust CLI anchors it on
79
>
* `serverDataFolderName` regardless of `--cli-data-dir` (see
80
>
* `cli/src/state.rs::agent_host_root`).
81
>
*/
82
>
export function getRemoteCLIDataDir(serverDataFolderName: string): string {
83
return `${getRemoteCLIInstallRoot(serverDataFolderName)}/cli`;
84
}
86
>
/**
87
>
* Full path to the installed CLI binary on the remote.
88
>
*
89
>
* When `commit` is provided, the path is keyed on commit (e.g.
90
>
* `~/.vscode-server/code-insiders-<40hex>`) so we can install the CLI
91
>
* matching the current desktop without disturbing other installs. This
92
>
* mirrors Remote-SSH's exec-server layout.
93
>
*
94
>
* When `commit` is undefined (dev/OSS builds with no commit in product
95
>
* metadata), the path is just `<root>/<archive>` — a single, non-keyed
96
>
* filename. Caller code should keep the loose `--version`-based reuse
97
>
* check in that case.
98
>
*/
99
>
export function getRemoteCLIBin(serverDataFolderName: string, quality: string, commit?: string): string {
100
const archive = getRemoteCLIArchiveName(quality);
101
const root = getRemoteCLIInstallRoot(serverDataFolderName);