Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
4663e9e
feat: implement redesigned MCP permission request system
zerob13 Jul 12, 2025
483b7fc
feat: complete MCP permission system with UI integration
zerob13 Jul 12, 2025
e01b969
fix: resolve permission system type errors and runtime issues
zerob13 Jul 12, 2025
4a6f782
fix: improve permission request UI and tool call status handling
zerob13 Jul 12, 2025
c13f251
Update README.md
zerob13 Jul 12, 2025
9086abf
Merge branch 'dev' into feature/add-permission-check
zerob13 Jul 12, 2025
c88a440
Merge branch 'feature/add-permission-check' of github.com:ThinkInAIXY…
zerob13 Jul 12, 2025
83becd4
fix: properly handle message state during permission requests
zerob13 Jul 12, 2025
46bc533
fix: improve permission system with detailed logging and proper flow
zerob13 Jul 12, 2025
5429b5d
chore: update claude md
zerob13 Jul 12, 2025
de703f0
feat: implement comprehensive MCP tool permission system
zerob13 Jul 12, 2025
04801f4
fix: resolve permission caching and UI optimization
zerob13 Jul 12, 2025
255ce8d
refactor: redesign permission system based on message data
zerob13 Jul 12, 2025
0d66070
fix: resolve permission timing issue with MCP service restart
zerob13 Jul 12, 2025
f707435
fix: add Variant support
zerob13 Jul 12, 2025
f636a9f
fix: rebuild conversation context properly for tool call continuation
zerob13 Jul 12, 2025
b0765b8
fix: resolve TypeScript compilation errors in thread presenter
zerob13 Jul 12, 2025
65b6e6b
feat: fix toolcall permission request
zerob13 Jul 12, 2025
1897e96
feat: better styles for block
zerob13 Jul 12, 2025
abd1d31
fix: remove useless func,and fix icon
zerob13 Jul 12, 2025
143cb5a
chore: add i18n for permission desc
zerob13 Jul 14, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 37 additions & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ DeepChat is a feature-rich open-source AI chat platform built with Electron + Vu
## Development Commands

### Package Management

Use `pnpm` as the package manager (required Node.js >= 20.12.2, pnpm >= 10.11.0):

```bash
Expand All @@ -20,6 +21,7 @@ pnpm run installRuntime
```

### Development

```bash
# Start development server
pnpm run dev
Expand All @@ -32,6 +34,7 @@ pnpm run dev:linux
```

### Code Quality

```bash
# Lint with OxLint
pnpm run lint
Expand All @@ -47,6 +50,7 @@ pnpm run typecheck:web # Renderer process
```

### Testing

```bash
# Run all tests
pnpm run test
Expand All @@ -66,6 +70,7 @@ pnpm run test:renderer # Renderer process tests
```

### Building

```bash
# Build for development preview
pnpm run build
Expand All @@ -85,6 +90,7 @@ pnpm run build:linux:arm64
```

### Internationalization

```bash
# Check i18n completeness (Chinese as source)
pnpm run i18n
Expand All @@ -96,14 +102,17 @@ pnpm run i18n:en
## Architecture Overview

### Multi-Process Architecture

- **Main Process**: Core business logic, system integration, window management
- **Renderer Process**: UI components, user interactions, frontend state management
- **Preload Scripts**: Secure IPC bridge between main and renderer processes

### Key Architectural Patterns

#### Presenter Pattern

Each functional domain has a dedicated Presenter class in `src/main/presenter/`:

- **WindowPresenter**: BrowserWindow lifecycle management
- **TabPresenter**: WebContentsView management with cross-window tab dragging
- **ThreadPresenter**: Conversation session management and LLM coordination
Expand All @@ -112,16 +121,19 @@ Each functional domain has a dedicated Presenter class in `src/main/presenter/`:
- **LLMProviderPresenter**: LLM provider abstraction with Agent Loop architecture

#### Multi-Window Multi-Tab Architecture

- **Window Shell** (`src/renderer/shell/`): Lightweight tab bar UI management
- **Tab Content** (`src/renderer/src/`): Complete application functionality
- **Independent Vue Instances**: Separation of concerns for better performance

#### Event-Driven Communication

- **EventBus** (`src/main/eventbus.ts`): Decoupled inter-process communication
- **Standard Event Patterns**: Consistent naming and responsibility separation
- **IPC Integration**: EventBus bridges main process events to renderer via IPC

### LLM Provider Architecture

The LLM system follows a two-layer architecture:

1. **Agent Loop Layer** (`llmProviderPresenter/index.ts`):
Expand All @@ -136,6 +148,7 @@ The LLM system follows a two-layer architecture:
- Supports both native and prompt-wrapped tool calling

### MCP Integration

- **Server Management**: Lifecycle management of MCP servers
- **Tool Execution**: Seamless integration with LLM providers
- **Format Conversion**: Bridges MCP tools with various LLM provider formats
Expand All @@ -144,40 +157,47 @@ The LLM system follows a two-layer architecture:
## Code Structure

### Main Process (`src/main/`)

- `presenter/`: Core business logic organized by functional domain
- `eventbus.ts`: Central event coordination system
- `index.ts`: Application entry point and lifecycle management

### Renderer Process (`src/renderer/`)

- `src/`: Main application UI (Vue 3 + Composition API)
- `shell/`: Tab management UI shell
- `floating/`: Floating button interface

### Shared Code (`src/shared/`)

- Type definitions shared between main and renderer processes
- Common utilities and constants
- IPC contract definitions

## Development Guidelines

### Code Standards

- **Language**: Use English for logs and comments
- **TypeScript**: Strict type checking enabled
- **Vue 3**: Use Composition API for all components
- **State Management**: Pinia for frontend state
- **Styling**: Tailwind CSS with scoped styles

### IPC Communication

- **Renderer to Main**: Use `usePresenter.ts` composable for direct presenter method calls
- **Main to Renderer**: Use EventBus to broadcast events via `mainWindow.webContents.send()`
- **Security**: Context isolation enabled with preload scripts

### Testing

- **Framework**: Vitest for unit and integration tests
- **Test Files**: Place in `test/` directory with corresponding structure
- **Coverage**: Run tests with coverage reporting

### File Organization

- **Presenters**: One presenter per functional domain
- **Components**: Organize by feature in `src/renderer/src/`
- **Types**: Shared types in `src/shared/`
Expand All @@ -186,23 +206,27 @@ The LLM system follows a two-layer architecture:
## Common Development Tasks

### Adding New LLM Provider

1. Create provider file in `src/main/presenter/llmProviderPresenter/providers/`
2. Implement `coreStream` method following standardized event interface
3. Add provider configuration in `configPresenter/providers.ts`
4. Update UI in renderer provider settings

### Adding New MCP Tool

1. Implement tool in `src/main/presenter/mcpPresenter/inMemoryServers/`
2. Register in `mcpPresenter/index.ts`
3. Add tool configuration UI if needed

### Creating New UI Components

1. Follow existing component patterns in `src/renderer/src/`
2. Use Composition API with proper TypeScript typing
3. Implement responsive design with Tailwind CSS
4. Add proper error handling and loading states

### Debugging

- **Main Process**: Use VSCode debugger with breakpoints
- **Renderer Process**: Chrome DevTools (F12)
- **MCP Tools**: Built-in MCP debugging window
Expand All @@ -211,26 +235,31 @@ The LLM system follows a two-layer architecture:
## Key Dependencies

### Core Framework

- **Electron**: Desktop application framework
- **Vue 3**: Progressive web framework
- **TypeScript**: Type-safe JavaScript
- **Vite**: Fast build tool via electron-vite

### State & Routing

- **Pinia**: Vue state management
- **Vue Router**: SPA routing

### UI & Styling

- **Tailwind CSS**: Utility-first CSS
- **Radix Vue**: Accessible UI components
- **Monaco Editor**: Code editor integration

### LLM Integration

- **Multiple SDK**: OpenAI, Anthropic, Google AI, etc.
- **Ollama**: Local model support
- **MCP SDK**: Model Context Protocol support

### Development Tools

- **OxLint**: Fast linting
- **Prettier**: Code formatting
- **Vitest**: Testing framework
Expand All @@ -255,13 +284,20 @@ The LLM system follows a two-layer architecture:
## Platform-Specific Notes

### Windows

- Enable Developer Mode or use admin account for symlink creation
- Install Visual Studio Build Tools for native dependencies

### macOS

- Code signing configuration in `scripts/notarize.js`
- Platform-specific build configurations

### Linux

- AppImage and deb package support
- Sandbox considerations for development
- Sandbox considerations for development

## Git Commit

- Do not include author information other than human authors in the Commit, such as Co-Authored-By related information
Loading