mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-05-03 16:34:31 -07:00
fix(core): enhance sandbox usability and fix build error (#24460)
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
This commit is contained in:
@@ -57,6 +57,7 @@ export interface SandboxModeConfig {
|
||||
network?: boolean;
|
||||
approvedTools?: string[];
|
||||
allowOverrides?: boolean;
|
||||
yolo?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -140,6 +141,11 @@ export interface SandboxManager {
|
||||
* Parses the output of a command to detect sandbox denials.
|
||||
*/
|
||||
parseDenials(result: ShellExecutionResult): ParsedSandboxDenial | undefined;
|
||||
|
||||
/**
|
||||
* Returns the primary workspace directory for this sandbox.
|
||||
*/
|
||||
getWorkspace(): string;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -238,6 +244,8 @@ export async function findSecretFiles(
|
||||
* through while applying environment sanitization.
|
||||
*/
|
||||
export class NoopSandboxManager implements SandboxManager {
|
||||
constructor(private options?: GlobalSandboxOptions) {}
|
||||
|
||||
/**
|
||||
* Prepares a command by sanitizing the environment and passing through
|
||||
* the original program and arguments.
|
||||
@@ -271,12 +279,18 @@ export class NoopSandboxManager implements SandboxManager {
|
||||
parseDenials(): undefined {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
getWorkspace(): string {
|
||||
return this.options?.workspace ?? process.cwd();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A SandboxManager implementation that just runs locally (no sandboxing yet).
|
||||
*/
|
||||
export class LocalSandboxManager implements SandboxManager {
|
||||
constructor(private options?: GlobalSandboxOptions) {}
|
||||
|
||||
async prepareCommand(_req: SandboxRequest): Promise<SandboxedCommand> {
|
||||
throw new Error('Tool sandboxing is not yet implemented.');
|
||||
}
|
||||
@@ -292,6 +306,10 @@ export class LocalSandboxManager implements SandboxManager {
|
||||
parseDenials(): undefined {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
getWorkspace(): string {
|
||||
return this.options?.workspace ?? process.cwd();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user