diff --git a/cli/README.md b/cli/README.md index d2e550ca..776a2b3f 100644 --- a/cli/README.md +++ b/cli/README.md @@ -81,11 +81,6 @@ See `src/configuration.ts` for all options. - `HAPI_DAEMON_HEARTBEAT_INTERVAL` - Heartbeat interval in ms (default: 60000). - `HAPI_DAEMON_HTTP_TIMEOUT` - HTTP timeout for daemon control in ms (default: 10000). -### Gemini/Agent - -- `HAPPY_GEMINI_COMMAND` - Gemini executable command (default: gemini). -- `HAPPY_GEMINI_ARGS` - Gemini arguments (default: --experimental-acp). - ## Storage Data is stored in `~/.hapi/` (or `$HAPI_HOME`): diff --git a/cli/src/agent/runners/gemini.ts b/cli/src/agent/runners/gemini.ts index 760d902d..9d0c0af5 100644 --- a/cli/src/agent/runners/gemini.ts +++ b/cli/src/agent/runners/gemini.ts @@ -1,12 +1,6 @@ import { AgentRegistry } from '@/agent/AgentRegistry'; import { AcpSdkBackend } from '@/agent/backends/acp'; -function parseArgs(value?: string): string[] | null { - if (!value) return null; - const parts = value.split(' ').map((part) => part.trim()).filter(Boolean); - return parts.length > 0 ? parts : null; -} - function buildEnv(): Record { return Object.keys(process.env).reduce((acc, key) => { const value = process.env[key]; @@ -17,16 +11,13 @@ function buildEnv(): Record { }, {} as Record); } -const command = process.env.HAPPY_GEMINI_COMMAND - || process.env.GEMINI_ACP_COMMAND - || 'gemini'; +export function registerGeminiAgent(yolo: boolean): void { + const args = ['--experimental-acp']; + if (yolo) args.push('--yolo'); -const args = parseArgs(process.env.HAPPY_GEMINI_ARGS) - ?? parseArgs(process.env.GEMINI_ACP_ARGS) - ?? ['--experimental-acp']; - -AgentRegistry.register('gemini', () => new AcpSdkBackend({ - command, - args, - env: buildEnv() -})); + AgentRegistry.register('gemini', () => new AcpSdkBackend({ + command: 'gemini', + args, + env: buildEnv() + })); +} diff --git a/cli/src/index.ts b/cli/src/index.ts index 0a838ec8..8dca17eb 100755 --- a/cli/src/index.ts +++ b/cli/src/index.ts @@ -157,18 +157,9 @@ import { getCliArgs } from './utils/cliArgs' } } - if (yolo) { - const existingArgs = process.env.HAPPY_GEMINI_ARGS ?? process.env.GEMINI_ACP_ARGS ?? ''; - if (!existingArgs.includes('--yolo')) { - const nextArgs = existingArgs.trim().length > 0 - ? `${existingArgs} --yolo` - : '--yolo'; - process.env.HAPPY_GEMINI_ARGS = nextArgs; - } - } - - await import('./agent/runners/gemini'); + const { registerGeminiAgent } = await import('./agent/runners/gemini'); const { runAgentSession } = await import('./agent/runners/runAgentSession'); + registerGeminiAgent(yolo); await initializeToken(); await authAndSetupMachineIfNeeded();