Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
85 changes: 85 additions & 0 deletions DEVTOOLS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
# Redux DevTools Remote Integration

This project uses Redux DevTools Remote to debug Zustand stores during development.

## Quick Start

### 1. Start the Redux DevTools Server

In one terminal:

```bash
npm run devtools
```

This will:
- Start the remote devtools server on `http://localhost:8080`
- Automatically open the DevTools UI in your browser

### 2. Start the Electron App

In another terminal:

```bash
npm run dev
```

The Electron app will automatically connect to the remote devtools server when running in development mode.

## Features

All Zustand stores are connected to Redux DevTools:
- **AuthStore** - Authentication state
- **ChatStore** - Chat session and messages
- **ConversationStore** - Conversation history
- **ModelsStore** - LLM providers and models
- **ToolsStore** - Available tools
- **WorkspaceStore** - Workspace management

## What You Can Do

- **Time-travel debugging** - Navigate through state changes
- **Action inspection** - See what actions are dispatched
- **State diff** - View differences between state snapshots
- **Action filtering** - Filter by store or action type
- **Export/Import** - Save and restore state

## Architecture

- **Port**: 8080 (configurable in `package.json`)
- **Middleware**: Zustand's built-in `devtools` middleware
- **Action naming**: All actions follow the pattern `{store}/{action}`
- Example: `chat/send`, `auth/login`, `workspace/load`
- **Configuration**: `src/renderer/stores/devtools.config.ts`

## Troubleshooting

### DevTools server won't start
- Check if port 8080 is already in use
- Try a different port: `redux-devtools --port=9090`

### Stores not appearing in DevTools
- Ensure you're running in development mode (`NODE_ENV=development`)
- Check that the devtools server is running before starting the Electron app
- Look for connection errors in the Electron console

### Actions not showing
- Devtools are disabled in production mode by design
- Check `devtools.config.ts` for configuration

## Manual Setup

If you need to change the port or customize:

1. Edit `package.json`:
```json
"devtools": "redux-devtools --hostname=localhost --port=YOUR_PORT --open"
```

2. No additional configuration needed - the stores will connect automatically in development mode.

## Resources

- [Redux DevTools Extension](https://github.com/reduxjs/redux-devtools)
- [Zustand DevTools Middleware](https://zustand.docs.pmnd.rs/middlewares/devtools)
- [@redux-devtools/cli](https://www.npmjs.com/package/@redux-devtools/cli)
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ Agentage Desktop is the **visual interface** for the Agentage ecosystem — disc
| **Desktop** | Electron | 33+ |
| **UI** | React | 18+ |
| **Language** | TypeScript | 5.9+ (strict) |
| **State** | Zustand | 5+ (Redux DevTools) |
| **Bundler** | Vite | 6+ |
| **Validation** | Zod | 4.3+ |
| **Styling** | Tailwind CSS | 4+ |
Expand Down Expand Up @@ -139,6 +140,10 @@ npm run dev

# Alternative: Build once and run Electron (no hot reload)
npm run dev:electron

# Debug with Redux DevTools (optional)
# In a separate terminal:
npm run devtools
```

**Note:** `npm run dev` uses `vite-plugin-electron` which automatically:
Expand All @@ -149,6 +154,8 @@ npm run dev:electron

The app will wait for the Vite dev server to be ready before loading, preventing common connection issues.

**Redux DevTools:** For debugging Zustand stores, start the remote devtools server with `npm run devtools` in a separate terminal. See [DEVTOOLS.md](DEVTOOLS.md) for details.

### Build & Package

```bash
Expand All @@ -172,6 +179,7 @@ npm run package:win
| ----------------------- | --------------------------------------------------- |
| `npm run dev` | Start Vite + Electron with hot reload |
| `npm run dev:electron` | Build and run Electron (no hot reload) |
| `npm run devtools` | Start Redux DevTools server (port 8080) |
| `npm run build` | Production build |
| `npm run type-check` | TypeScript validation |
| `npm run lint` | ESLint check |
Expand Down
Loading