Files
vscode/src/vs/platform/sandbox/node/sandboxHelper.ts
dileepyavan c9b8ed1bcf Agent sandboxing: detect missing dependencies before execution and offer installation (#305898)
* updating tests

* sandbox dependencies check for linux

* sandbox dependencies check for linux

* review comment

* Injecting sandboxhelperservice for web
2026-03-28 20:56:52 +00:00

35 lines
1.3 KiB
TypeScript

/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { isLinux } from '../../../base/common/platform.js';
import { findExecutable } from '../../../base/node/processes.js';
import { ISandboxDependencyStatus, ISandboxHelperService } from '../common/sandboxHelperService.js';
type FindCommand = (command: string) => Promise<string | undefined>;
export class SandboxHelperService implements ISandboxHelperService {
declare readonly _serviceBrand: undefined;
static async checkSandboxDependenciesWith(findCommand: FindCommand, linux: boolean = isLinux): Promise<ISandboxDependencyStatus | undefined> {
if (!linux) {
return undefined;
}
const [bubblewrapPath, socatPath] = await Promise.all([
findCommand('bwrap'),
findCommand('socat'),
]);
return {
bubblewrapInstalled: !!bubblewrapPath,
socatInstalled: !!socatPath,
};
}
checkSandboxDependencies(): Promise<ISandboxDependencyStatus | undefined> {
return SandboxHelperService.checkSandboxDependenciesWith(findExecutable);
}
}