mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-05-12 21:03:05 -07:00
feat(offload): restore and enhance iTerm2 auto-launch UI
This commit is contained in:
@@ -24,6 +24,11 @@ export interface WorkerProvider {
|
||||
*/
|
||||
setup(options: SetupOptions): Promise<number>;
|
||||
|
||||
/**
|
||||
* Returns the raw command string that would be used to execute a command.
|
||||
*/
|
||||
getRunCommand(command: string, options?: ExecOptions): string;
|
||||
|
||||
/**
|
||||
* Executes a command on the worker.
|
||||
*/
|
||||
|
||||
@@ -38,9 +38,13 @@ export class GceConnectionManager {
|
||||
];
|
||||
}
|
||||
|
||||
run(command: string, options: { interactive?: boolean; stdio?: 'pipe' | 'inherit' } = {}): { status: number; stdout: string; stderr: string } {
|
||||
getRunCommand(command: string, options: { interactive?: boolean } = {}): string {
|
||||
const fullRemote = this.getMagicRemote();
|
||||
const sshCmd = `ssh ${this.getCommonArgs().join(' ')} ${options.interactive ? '-t' : ''} ${fullRemote} ${this.quote(command)}`;
|
||||
return `ssh ${this.getCommonArgs().join(' ')} ${options.interactive ? '-t' : ''} ${fullRemote} ${this.quote(command)}`;
|
||||
}
|
||||
|
||||
run(command: string, options: { interactive?: boolean; stdio?: 'pipe' | 'inherit' } = {}): { status: number; stdout: string; stderr: string } {
|
||||
const sshCmd = this.getRunCommand(command, options);
|
||||
|
||||
// 1. Try Direct Path
|
||||
const directRes = spawnSync(sshCmd, { stdio: options.stdio || 'pipe', shell: true });
|
||||
|
||||
@@ -137,6 +137,14 @@ Host ${this.sshAlias}
|
||||
return 0;
|
||||
}
|
||||
|
||||
getRunCommand(command: string, options: ExecOptions = {}): string {
|
||||
let finalCmd = command;
|
||||
if (options.wrapContainer) {
|
||||
finalCmd = `docker exec ${options.interactive ? '-it' : ''} ${options.cwd ? `-w ${options.cwd}` : ''} ${options.wrapContainer} sh -c ${this.quote(command)}`;
|
||||
}
|
||||
return this.conn.getRunCommand(finalCmd, { interactive: options.interactive });
|
||||
}
|
||||
|
||||
async exec(command: string, options: ExecOptions = {}): Promise<number> {
|
||||
const res = await this.getExecOutput(command, options);
|
||||
return res.status;
|
||||
|
||||
Reference in New Issue
Block a user