244
.filter(line => line.length > 0);
245
}
247
>
export interface IComposeAgentHostBootstrapScriptArgs {
248
>
readonly serverDataFolderName: string;
249
>
readonly quality: string;
250
>
readonly commit: string | undefined;
251
>
readonly os: string;
252
>
readonly arch: string;
253
>
/** Dev override; when set, returned verbatim and all CLI bootstrap is skipped. */
254
>
readonly remoteAgentHostCommand?: string;
255
>
}
256
>
257
>
/**
258
>
* Compose the bash one-liner passed to `wsl.exe -d <distro> -e bash -lc`.
259
>
*
260
>
* Reuses the same install layout helpers as Remote-SSH
261
>
* ({@link getRemoteCLIBin}, {@link buildCLIDownloadUrl},
262
>
* {@link buildCleanupOldCLIsCommand}, {@link buildAgentHostBaseCommand}) so
263
>
* a WSL-installed CLI and an SSH-installed CLI share the same
264
>
* `~/<serverDataFolderName>/...` files inside the distro.
265
>
*
266
>
* SSH composes the same operations across multiple sequential `exec` calls
267
>
* (so it can branch on lockfile reuse and CLI-install failures); WSL does
268
>
* not have a control channel back to the host between commands and so
269
>
* collapses the install+launch into one script per spawn. The shared layout
270
>
* lives in the helper functions above, not in the composition itself.
271
>
*/
272
>
export function composeAgentHostBootstrapScript(args: IComposeAgentHostBootstrapScriptArgs): string {
273
if (args.remoteAgentHostCommand) {
274
return args.remoteAgentHostCommand;