20 Commits

Author SHA1 Message Date
Bohan Jiang
c46cc23b46 Merge pull request #86 from multica-ai/feat/dock-badge-pending-permissions
feat: show pending permission requests count in dock badge (macOS)
2026-01-22 16:48:26 +08:00
Jiang Bohan
935b6c3a5c feat: show pending permission requests count in dock badge (macOS)
Add dock badge count feature to indicate pending permission requests:
- Add updateBadgeCount() method to PermissionManager
- Update badge when permission request is added/removed/times out
- Only applies on macOS (darwin platform)

This helps users know there are pending actions even when the app is minimized.

Closes #85

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-22 16:47:34 +08:00
yushen
3159842b54 fix: resolve race condition causing AI responses not to display
- Add mergeSessionUpdates helper to deduplicate updates by sequence number
- Introduce updateCurrentSession helper to synchronously update ref before async ops
- Reload session updates after async operations complete to catch missed messages
- Add unit tests for merge behavior with sequence numbers

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-22 13:22:08 +08:00
Naiyuan Qing
4c19791b77 Merge branch 'main' into feat/message-timer-and-copy-button 2026-01-21 19:01:47 +08:00
Naiyuan Qing
23d68ddad7 feat: add message timer, copy button and improve loading states
- Add message-level time tracking with endTime - startTime calculation
- Fix state synchronization: wait for all sessionUpdate promises before completing
- Create Spinner component (3x3 grid animation) and LoadingIndicator components
- Add CompletedMessageFooter with copy button and visual feedback
- Update SessionInitializing to use Spinner instead of shimmer bar
- Add prefers-reduced-motion support for animations
- Add formatDuration (2 decimal places) and formatLocalizedDatetime utils
- Add invalid date handling and comprehensive tests

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 18:59:28 +08:00
yushen
41da6f16b4 feat: add hidden files toggle and improve file tree UX
- Add eye icon toggle to show/hide hidden files (dotfiles)
- Replace emoji icons with Lucide icons in context menu
- Add "Open in Multica" context menu option for directories
- Optimize file filtering with on-demand approach
- Add aria-label/aria-pressed for accessibility
- Add unit tests for uiStore and excludeHiddenFiles

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 15:49:15 +08:00
yushen
2522dbe71e feat: add per-session input draft persistence
- Add draftStore to manage input drafts per session
- Save/restore drafts when switching between sessions
- Auto-save drafts with debounce (300ms)
- Clear drafts when session is deleted
- Add unit tests for draftStore and MessageInput draft behavior
- Update vitest config to include .tsx test files

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 14:14:24 +08:00
yushen
6d6a9c16a6 Fix Codex slash command availability 2026-01-20 18:27:28 +08:00
yushen
cea3b8d725 Merge origin/main into feat/slash-command-support
Resolved conflicts:
- AcpClientFactory.ts: Keep both AvailableCommand import and ISessionStore
- MessageInput.tsx: Combine slash command key handling with return type annotation

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-20 17:15:07 +08:00
yushen
26a03d1317 fix: resolve all ESLint warnings (252 -> 0)
- Add explicit return types to functions across main, preload, and renderer
- Replace `any` types with specific types or eslint-disable comments
- Fix unused variables by removing or prefixing with underscore
- Add eslint-disable for react-refresh/only-export-components
- Fix React hooks dependency warnings
- Add test mocks for electron-log/main and @electron-toolkit/utils

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-20 17:07:05 +08:00
yushen
3d95e19dd3 feat: add slash command support for ACP agents
- Add AvailableCommand type re-export from ACP SDK
- Handle available_commands_update events in AcpClientFactory
- Store available commands in SessionAgent state
- Add IPC channel and handler for fetching session commands
- Create commandStore for renderer state management
- Update useApp hook to fetch and listen for command updates
- Create SlashCommandMenu component with keyboard navigation
- Integrate slash command detection and validation in MessageInput
- Add unit tests for slash command utilities and store

Commands are defined by ACP agents and sent as plain text for
the agent to parse and execute. The client provides autocomplete
and validation based on the available commands list.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-20 17:02:47 +08:00
yushen
bbf4979cb9 feat: integrate electron-log and improve error message parsing
- Add electron-log for production logging (writes to ~/Library/Logs/Multica/)
- Development mode logs to console only, no file writes
- Improve parseAcpError() with more specific error handling:
  - Connection errors (ECONNREFUSED, ECONNRESET)
  - Timeout errors (ETIMEDOUT, timeout)
  - Process exit errors
  - Authentication errors (401, API key)
  - Rate limit errors (429)
- Fallback now shows actual error message (truncated to 150 chars)
  instead of generic "Agent encountered an error"
- Add comprehensive tests for new error types

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-20 16:28:41 +08:00
yushen
fcda7f6d9b feat: display git branch info in session sidebar
- Add gitBranch field to Session type
- Create git utility to get current branch name
- Update IPC handlers to fetch git branch when loading sessions
- Display branch name in sidebar with subtle styling (main · 36m ago format)
- Add unit tests for git branch utility

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-20 16:05:07 +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
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
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