10 Commits

Author SHA1 Message Date
yushen
ddc67a0105 feat: add dynamic session mode and model selection
Add support for dynamically switching session modes and models through
the ACP protocol. This enables users to change the AI model or operating
mode during an active session.

Changes:
- Add ModeSelector and ModelSelector dropdown components
- Extend ACP client to handle mode/model update notifications
- Add IPC channels for mode/model state management
- Update Conductor and SessionLifecycle for dynamic switching
- Add max-height constraint to dropdowns for better UX

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-20 14:31:03 +08:00
Jiayuan
1129158333 refactor(conductor): split monolithic Conductor into focused modules
Split 773-line Conductor class into 4 modular components using dependency injection:
- SessionLifecycle: Session CRUD operations
- AgentProcessManager: Agent process lifecycle management
- PromptHandler: Prompt sending with history replay and G-3 support
- G3Workaround: AskUserQuestion answer injection mechanism

Added comprehensive unit tests for all new modules (56 new tests), bringing total test coverage to 167 tests. Maintained backward compatibility - all callers continue using identical APIs. TypeScript compilation passes with no errors.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-01-19 13:11:23 +08:00
Naiyuan Qing
3fcbaf3825 fix: handle missing directory - show warning and allow delete only
- Add directoryExists runtime check for sessions
- Show warning banner when directory not found
- Disable input and only allow session deletion
- Add withDirectoryExists helper to reduce code duplication
- Validate directory on app focus to detect deleted folders

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-16 17:46:02 +08:00
Jiang Bohan
b29b8b77d0 test: update Conductor tests for lazy agent start 2026-01-16 14:23:58 +08:00
yushen
ea959e577b Fix polling detection to check all agent components
- Change `installed` check from primary command only to all required commands
- Agents with multiple components (e.g., claude-code requiring both CLI and ACP)
  are now only marked as installed when all components are present
- This fixes the issue where polling would stop prematurely when only the
  primary command (e.g., `claude`) was detected but `claude-code-acp` was not
- Also includes related changes for terminal-based installation flow

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-16 13:15:55 +08:00
LinYushen
ddad9ef21d Revert "Fix npm global install permission error by using user-level prefix" 2026-01-16 12:36:25 +08:00
yushen
7d37bbc172 Fix npm global install permission error by using user-level prefix
- Add ~/.npm-global/bin to enhanced PATH in path.ts
- Add getNpmUserPrefix() function for user-level npm directory
- Modify installClaudeCodeACP, installCodexCLI, installCodexACP to use
  --prefix ~/.npm-global for installation without sudo
- Update formatInstallError to provide actionable fix for permission errors
- Add unit tests for agent-install module

This fixes EACCES permission errors when installing agents via npm install -g
by redirecting installations to the user's home directory.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-16 11:54:19 +08:00
Jiayuan
b10b3ff709 Add AI code safety defense system: tests, pre-commit hooks, and CI
Implemented three-layer defense mechanism to prevent AI-generated code from breaking the codebase:
- Layer 1: AGENTS.md with universal AI agent instructions
- Layer 2: Husky pre-commit hooks with test file checking
- Layer 3: GitHub Actions CI with TypeScript, ESLint, tests, and coverage

Includes design document, test infrastructure, and coverage thresholds.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-01-16 00:22:33 +08:00
Jiayuan
ce068a8a55 fix: support new MessageContent format in history replay
Added extractUserMessageText() helper to handle both new (MessageContent[])
and old ({ text: string }) user message formats. This fixes history replay
for resumed sessions after commit 913cccc changed the message storage format
without updating the extraction logic. Also updated integration test to use
the new MessageContent format.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-01-15 23:41:35 +08:00
Jiayuan
cb67f5d340 feat: add comprehensive test suite with Vitest
Add unit and integration tests covering core business logic:
- SessionStore: 18 tests for session persistence and management
- Conductor: 13 tests for session orchestration and agent lifecycle
- IPC Handlers: 19 tests for main-renderer communication
- Agent check: 10 tests for agent detection utilities

Tests achieve 31.74% overall coverage with focus on critical paths. Includes Vitest configuration, mock setup, and test utilities.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-01-15 04:11:56 +08:00