Extract duplicate version acknowledgment logic from apiMachine and
apiSession into a reusable applyVersionedAck utility. This handles
success, version-mismatch, and error responses consistently with
customizable parsing and error handling via options object.
Restructure CLI entry point and RPC handler registration to improve maintainability:
- Introduce command registry pattern with CommandDefinition interface for consistent command structure
- Extract individual command modules (claude, codex, daemon, doctor, gemini, auth, connect, etc.)
- Move RPC handlers into separate feature modules (bash, files, git, directories, ripgrep, difftastic, slashCommands)
- Create shared RPC types and response helpers (rpcTypes.ts, rpcResponses.ts)
- Move SpawnSessionOptions and SpawnSessionResult to rpcTypes for proper type organization
- Simplify index.ts to minimal entrypoint using command registry
- Update imports in apiMachine.ts and daemon/run.ts to use rpcTypes module
This enables:
- Better code organization by feature/command
- Easier testing of individual commands
- Safer RPC handler registration without side effects
- Clearer separation of concerns between routing and business logic
- Added /health endpoint to server for readiness checks (no auth required)
- Created autoStartServer module that auto-starts server when:
- HAPI_SERVER_URL not set (using default localhost:3006)
- cliApiToken exists in settings (server previously used)
- Port 3006 is not currently listening
- Server runs as child process (not daemon) and exits when CLI exits
- Integrated maybeAutoStartServer() into hapi, codex, and gemini commands
Implement namespace support across sessions, machines, and users for multi-user server deployments. Add access control with specific error reasons (namespace-missing, access-denied, not-found) and database schema updates with namespace columns and indexes.
- Add LICENSE file to root and cli/ directories with LGPL-3.0-or-later text
- Create cli/NOTICE file with MIT attribution for happy-cli derived code
- Update license field in cli/, server/, and web/ package.json to "LGPL-3.0-or-later"
- Add NOTICE to cli/package.json files array for npm publishing
Update the regex in getProjectPath to replace all non-alphanumeric characters
with dashes instead of only specific ones. This provides more robust handling
of edge cases in working directory paths.
Simplify environment handling by removing the getCleanEnv() function that was
filtering out local node_modules/.bin paths. Running from home directory is
sufficient to avoid local cwd side effects.
When HAPI_WORKTREE_* environment variables are not set, fall back to
probing git to detect if running inside a worktree. This enables
worktree features to work automatically without explicit env vars.
Implements bidirectional sync of permission/model modes between CLI sessions and web app. Adds Codex-specific permission modes (read-only, safe-yolo, yolo) alongside Claude's modes. Web can now control CLI session state via RPC set-session-config handler, while CLI broadcasts state changes through keep-alive payloads. UI controls are flavor-aware, showing appropriate modes for Claude vs Codex vs Gemini. Type centralization in api/types eliminates circular dependencies.
Implements full-stack slash command autocomplete with agent-specific built-in commands and user-defined command discovery. Includes React Strict Mode fix for suggestion handling.
Implement comprehensive worktree session support allowing users to spawn sessions in temporary git worktrees. Includes backend worktree management, full-stack integration, and refined UI for session type selection.
Backend:
- Add worktree creation/removal utilities with branch management
- Track worktree metadata (basePath, branch, name, path) in session metadata
- Automatic cleanup of worktrees when sessions fail or exit
- Enhanced error handling with stderr tail logging
UI improvements:
- Redesign session type toggle with improved alignment and spacing
- Move worktree description inline with label for cleaner layout
- Add branch name input field that appears when worktree mode selected
- Auto-focus on worktree input when switching modes
- Reduce gap between radio options from gap-3 to gap-1.5
- Update descriptive text and placeholders for clarity
Integration:
- Thread worktree parameters through API client, RPC handlers, and daemon
- Add worktreeEnv utility to read worktree info from environment
- Update session spawning to support both simple and worktree modes
Remove unnecessary Promise wrapper and move args building outside try block
so cleanupMcpConfig becomes const with proper type inference instead of never
Remove HAPPY_GEMINI_ARGS and HAPPY_GEMINI_COMMAND environment variables.
Refactor gemini.ts to export registerGeminiAgent(yolo) function that
directly configures args instead of reading from environment.
Fixes regression introduced in 1a23bfa430.
- Add restoreTerminalState helper to disable kitty keyboard protocol and
CSI u key release reporting when switching modes or cleaning up
- Improve claudeLocal abort handling with SIGINT → SIGTERM → SIGKILL
escalation timeouts for graceful process termination
- Fix useSwitchControls to properly handle CSI u space sequences (0x20)
and key.name/key.sequence detection for space key presses
- Fix typo: exutFuture → exitFuture in claudeLocalLauncher