Skip to content

Conversation

@Scoteezy
Copy link
Contributor

Summary

This PR adds Gemini support to Happy CLI using the Agent Client Protocol (ACP). Users can now run happy gemini to start a Gemini-powered coding assistant with full mobile app integration.

Changes

Gemini ACP Backend

New agent architecture:

  • AgentBackend — abstract interface for AI agent backends
  • AgentRegistry — factory registry for creating agent instances
  • AcpSdkBackend — ACP protocol implementation using stdio communication

Gemini integration:

  • Full ACP protocol support via gemini --experimental-acp flag
  • Session management with start/stop/message handling
  • Tool execution with permission system (auto-approve, ask, deny)
  • MCP (Model Context Protocol) server support for external tools

Gemini CLI Commands

happy gemini                     # Start Gemini agent
happy gemini model set <model>   # Set default model
happy gemini model get           # Show current model
happy connect gemini             # OAuth authentication with Google

Supported models: gemini-2.5-pro, gemini-2.5-flash, gemini-2.5-flash-lite

Authentication Priority

Authentication sources (highest to lowest priority):

  1. Happy cloud OAuth (happy connect gemini)
  2. Local config files (~/.gemini/)
  3. GEMINI_API_KEY environment variable
  4. GOOGLE_API_KEY environment variable

Requirements

  • Gemini CLI must be installed globally. Supported versions: 0.21.2+, 0.17.1
  • Google account for OAuth authentication

@bra1nDump bra1nDump merged commit ac15dd4 into slopus:main Dec 19, 2025
4 checks passed
ahundt added a commit to ahundt/happy-cli that referenced this pull request Dec 30, 2025
Summary: Integrates PR slopus#99 (hook-based session tracking) and PR slopus#98
(Gemini/ACP integration) while preserving all offline mode and robustness
features from the feature branch, plus DRY improvements.

What changed:
- Session hook server system for reliable Claude session ID capture
- Gemini backend as alternative to Claude/Codex with ACP integration
- Fixed memory leak in session.ts (stored interval reference + cleanup())
- Added socket connection check in apiSession.ts
- Created shared offlineSessionStub.ts utility (DRY refactor)
- Added gemini to profile compatibility validation
- Preserved: offline mode, 5xx handling, profile system, tmux integration

Files affected:
- src/claude/runClaude.ts: Hook server + offline fallback integration
- src/claude/session.ts: RAII cleanup, callback system, hookSettingsPath
- src/claude/loop.ts: hookSettingsPath threading
- src/claude/claudeLocal.ts: Hook parameters
- src/claude/claudeRemote.ts: mapToClaudeMode() preserved
- src/api/api.ts: Graceful 5xx handling preserved
- src/api/apiSession.ts: Socket check restored
- src/daemon/run.ts: Gemini added to agent selection
- src/persistence.ts: Added gemini to ProfileCompatibilitySchema
- src/utils/offlineSessionStub.ts: New shared DRY utility
- src/codex/runCodex.ts: Updated to use shared offline stub
- src/gemini/runGemini.ts: Added offline mode with shared stub
- src/agent/*, src/gemini/*: New from main (no conflicts)
- scripts/session_hook_forwarder.cjs: Hook forwarder from main

Testable: npm test (266 pass, 8 fail - baseline unchanged)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants