Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
86 commits
Select commit Hold shift + click to select a range
2a95281
refactor: chat hooks
Mine77 Jul 21, 2025
d89f72d
refactor: reorganize error handling by moving error classes and handl…
Mine77 Jul 21, 2025
6b85eeb
refactor: update suggested actions
Mine77 Jul 22, 2025
0018ba2
refactor: update CapData type
Mine77 Jul 23, 2025
6797950
refactor: remove artifact feature
Mine77 Jul 23, 2025
fceb4b3
refactor: remove the layout component; create the sidebar components
Mine77 Jul 23, 2025
a585c88
refacotr: organize code
Mine77 Jul 23, 2025
63ec560
refactor: remove memory and files
Mine77 Jul 24, 2025
0807d91
refactor: sidebar and settings
Mine77 Jul 24, 2025
8b3230c
refactor: model selector
Mine77 Jul 25, 2025
4403633
refactor: rename the use cap hook
Mine77 Jul 25, 2025
a2bd5f1
refactor
Mine77 Jul 25, 2025
95c276c
refactor
Mine77 Jul 25, 2025
2d4b685
refactor
Mine77 Jul 25, 2025
e80f7d9
refactor
Mine77 Jul 25, 2025
b194d57
refactor
Mine77 Jul 25, 2025
b4145f1
cap-dev init
Mine77 Jul 25, 2025
5e758bd
update
Mine77 Jul 27, 2025
1036d3f
rename
Mine77 Jul 27, 2025
96da477
update cap dev
Mine77 Jul 27, 2025
27acfd2
update
Mine77 Jul 28, 2025
431fd15
update
Mine77 Jul 28, 2025
4907e50
update
Mine77 Jul 28, 2025
24fa104
update
Mine77 Jul 28, 2025
c822140
update
Mine77 Jul 28, 2025
a2084fc
add hotkey
Mine77 Jul 28, 2025
8359b62
update mcp panel
Mine77 Jul 29, 2025
a15ce19
feat: add current cap store
Mine77 Jul 30, 2025
f427684
feat: update the mcp tool url
Mine77 Jul 30, 2025
169f0b5
update the cap card
Mine77 Jul 30, 2025
c88ec63
feat: add model selector to the multimodal input
Mine77 Jul 30, 2025
29da49c
refacor: update chat header
Mine77 Jul 30, 2025
f9ff545
update cap edit tags and cap submit form
Mine77 Aug 2, 2025
c8b37fc
feat: add back button to mcp-tools
Mine77 Aug 2, 2025
bf7e2c8
update prompt variables
Mine77 Aug 2, 2025
d0cbecc
update cap mcp type
Mine77 Aug 2, 2025
e049c59
update cap-resolve
Mine77 Aug 2, 2025
56a2b10
feat: add global mcp manager to manage mcp connections and get tools
Mine77 Aug 2, 2025
fccc3b1
remove the date variabls from cap prompt editor
Mine77 Aug 2, 2025
dc1498d
feat: update tool call and tool result UI
Mine77 Aug 2, 2025
08b7d15
feat: add the account page
Mine77 Aug 2, 2025
b8aafe4
update chat history in the sidebar
Mine77 Aug 2, 2025
e036b63
refacor: settings page
Mine77 Aug 2, 2025
540989f
refactor: rename account to wallet
Mine77 Aug 3, 2025
e9d04b2
feat: add appkit integration
Mine77 Aug 3, 2025
3fc9e8c
upgrade zustand
Mine77 Aug 3, 2025
b095373
feat: add cap-kit
Mine77 Aug 3, 2025
02a352d
disable cap-kit and wait for a fix
Mine77 Aug 3, 2025
0bdd91a
feat: add wallet store with mock balance and transactions
Mine77 Aug 3, 2025
e7b345f
fix: button type
Mine77 Aug 4, 2025
6f83fe2
fix: cap card UI
Mine77 Aug 4, 2025
d6d5226
refactor: add prompt suggestions to the base type of cap
Mine77 Aug 4, 2025
52bc6a0
fix: add default current cap to avoid an empty current cap
Mine77 Aug 4, 2025
97315e1
feat: add persistent storage for cap studio store
Mine77 Aug 4, 2025
185c4a8
fix: store and storage
Mine77 Aug 4, 2025
aeaa076
feat: cap submit
Mine77 Aug 4, 2025
fdaedd0
refactor: cap types
Mine77 Aug 4, 2025
2262c93
update locales
Mine77 Aug 4, 2025
6722ead
fix: use suggestd actions
Mine77 Aug 5, 2025
db05a51
fix: cap resolve
Mine77 Aug 5, 2025
63665c4
fix: cap type compatibility
Mine77 Aug 5, 2025
1384549
fix: mcp server error handling
Mine77 Aug 5, 2025
3da7859
fix: refactor cap types with zod and filter invalid cap types
Mine77 Aug 5, 2025
89a5f15
feat: optimize UX
Mine77 Aug 5, 2025
ac63a42
reafactor: use sonner toast directly
Mine77 Aug 5, 2025
5cb1f69
refactor: update the submit form
Mine77 Aug 5, 2025
5508b5a
feat: add thumbnail render
Mine77 Aug 5, 2025
8a2e719
update tool call ui with a loader
Mine77 Aug 5, 2025
ed52478
imp: UI
Mine77 Aug 5, 2025
ddc74f8
UI Improvements
Mine77 Aug 5, 2025
0b1d0e1
update logo and login page
Mine77 Aug 5, 2025
6fd32f6
update logo and login page
Mine77 Aug 5, 2025
031ea13
Update UI
Mine77 Aug 5, 2025
c155482
Merge branch 'ui-imp' into dev
Mine77 Aug 5, 2025
0822519
fix: fix the cap thumbnail size
Mine77 Aug 6, 2025
2c965ad
feat: enhance auth flow with store rehydration and logout navigation
Mine77 Aug 6, 2025
85d4307
feat: enhance UI
Mine77 Aug 6, 2025
fdcbd6f
minor UI updates
Mine77 Aug 7, 2025
08e1622
refactor: update the Cap type
Mine77 Aug 7, 2025
b9c380c
feat: add more logo variants
Mine77 Aug 7, 2025
e3901b1
update sidebar style
Mine77 Aug 7, 2025
ff7d61c
refactor: remove the author field from cap type and enrich the thumbn…
Mine77 Aug 7, 2025
0148c27
feat: enhance CapCard and MyCaps components with tabs for draft and p…
Mine77 Aug 7, 2025
8e9e1e6
feat: implement remote caps management in CapStore, enhance CapCard a…
Mine77 Aug 7, 2025
4dfc12e
feat: add support inputs display in ModelDetails component and clean …
Mine77 Aug 8, 2025
acedf64
fix: build errors
Mine77 Aug 8, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
8 changes: 7 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,10 @@ playwright-report/
test-results/

# cap
public/caps.json
public/caps.json

# claude
.claude

# cursor
.cursor
133 changes: 133 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
# CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

## Package Management & Scripts

This project uses **pnpm** for package management. Common commands:

```bash
# Development
pnpm dev # Start development server
pnpm build # Build for production
pnpm preview # Preview production build

# Code Quality
pnpm lint # Lint with Biome
pnpm lint:fix # Fix linting issues
pnpm format # Check formatting
pnpm format:fix # Fix formatting
pnpm check # Run all checks
pnpm check:fix # Fix all issues
```

**Important**: Always use `pnpm` commands. The project uses Biome (not ESLint/Prettier) for linting and formatting.

## Application Architecture

**Nuwa Client** is a React 19 + TypeScript + Vite application for AI chat with CAP (Conversational AI Programs) creation capabilities, Web3 wallet integration, and decentralized identity.

### Core Technology Stack

- **Frontend**: React 19, TypeScript, Vite, React Router v7
- **Styling**: Tailwind CSS + Radix UI components
- **State**: Zustand with persistence middleware
- **Storage**: Dexie (IndexedDB) for structured data
- **AI**: AI SDK (@ai-sdk/react), OpenRouter, LiteLLM providers
- **Web3**: Reown AppKit, Wagmi, Viem
- **Identity**: @nuwa-ai/identity-kit (decentralized identity)
- **Code Quality**: Biome for linting/formatting

### Feature-Based Architecture

The codebase uses a feature-based structure under `src/features/`:

- **`auth/`** - Authentication and authorization
- **`chat/`** - Core chat functionality with AI models
- **`cap-studio/`** - CAP creation/editing interface (like an IDE)
- **`cap-store/`** - CAP marketplace and discovery
- **`settings/`** - User preferences and configuration
- **`sidebar/`** - Navigation and chat history
- **`wallet/`** - Web3 wallet integration and payments

Each feature follows this structure:
```
feature/
├── components/ # React components
├── hooks/ # Custom React hooks
├── stores.ts # Zustand state stores
├── services.ts # Business logic
├── types.ts # TypeScript definitions
└── utils.ts # Utility functions
```

### Key Architectural Concepts

**CAPs (Conversational AI Programs)**: User-configurable AI assistants with custom prompts, models, and MCP (Model Context Protocol) tool integrations. Users can create, edit, and share CAPs.

**MCP Integration**: The app connects to MCP servers to provide tools and capabilities to AI models. Managed by `GlobalMCPManager` singleton.

**Decentralized Identity**: All user data is scoped to their DID (Decentralized Identifier) for privacy and portability.

**Multi-Layer Storage**:
- Zustand stores (in-memory state)
- localStorage (user preferences)
- IndexedDB via Dexie (structured data: chats, CAPs, settings)

### Core Services

**Global Services** (in `src/shared/services/`):
- **`global-mcp-manager.ts`** - Manages MCP server connections and tool registration
- **`identity-kit.ts`** - Decentralized identity management
- **`mcp-client.ts`** - Model Context Protocol client
- **`authorized-fetch.ts`** - Authenticated HTTP requests

**Key Data Entities**:
- **ChatSession** - Chat conversations with message history
- **Cap** - AI assistant configuration (prompt, model, MCP servers)
- **Settings** - User preferences and app configuration

### UI Components

**Shared Components** (in `src/shared/components/ui/`):
- Based on Radix UI primitives with Tailwind styling
- Do not modify files in `ui/` folder - they are generated components
- For custom components, create in feature-specific `components/` folders

### Development Patterns

**State Management**:
- Use Zustand stores with persistence middleware
- Store files typically export both store and selectors
- User data automatically scoped by DID

**Data Fetching**:
- Use SWR for server state management
- Custom hooks in feature `hooks/` folders
- Services handle business logic and API calls

**Routing**:
- React Router v7 with nested layouts
- Route components in `src/pages/`
- Layout components in `src/layout/`

**Styling**:
- Tailwind CSS with custom design system
- Radix UI for accessible primitives
- Theme support via next-themes

### Important Files

- **`src/main.tsx`** - Application entry point
- **`src/router.tsx`** - Route configuration
- **`src/layout/main-layout.tsx`** - Main application layout
- **`biome.json`** - Biome configuration for linting/formatting
- **`tailwind.config.ts`** - Tailwind CSS configuration

### Development Notes

- The app supports both light and dark themes
- All user interfaces are internationalized (i18n support)
- Web3 functionality uses Reown AppKit for wallet connections
- AI model switching is supported via the model selector
- MCP servers can be dynamically added/removed per CAP
15 changes: 11 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
"scripts": {
"dev": "vite",
"build": "tsc -b && vite build",
"prebuild": "tsx src/caps/build.ts",
"preview": "vite preview",
"lint": "biome lint src/",
"lint:fix": "biome lint --apply src/",
Expand All @@ -30,8 +29,9 @@
"@hookform/resolvers": "^5.1.1",
"@lobehub/icons": "^2.9.0",
"@modelcontextprotocol/sdk": "^1.13.2",
"@nuwa-ai/identity-kit": "^0.2.2",
"@nuwa-ai/identity-kit-web": "^0.2.2",
"@nuwa-ai/cap-kit": "^0.3.5",
"@nuwa-ai/identity-kit": "^0.3.4",
"@nuwa-ai/identity-kit-web": "^0.3.5",
"@openrouter/ai-sdk-provider": "^0.7.2",
"@radix-ui/react-accordion": "^1.2.11",
"@radix-ui/react-alert-dialog": "^1.1.14",
Expand Down Expand Up @@ -59,11 +59,16 @@
"@radix-ui/react-toggle": "^1.1.9",
"@radix-ui/react-toggle-group": "^1.1.10",
"@radix-ui/react-tooltip": "^1.2.7",
"@reown/appkit": "^1.7.17",
"@reown/appkit-adapter-wagmi": "^1.7.17",
"@reown/appkit-pay": "^1.7.17",
"@rjsf/core": "^5.24.12",
"@rjsf/validator-ajv8": "^5.24.12",
"@tailwindcss/typography": "^0.5.16",
"@tanstack/react-query": "^5.84.1",
"@uiw/react-markdown-preview": "^5.1.4",
"@vercel/functions": "^2.2.2",
"@web3icons/react": "^4.0.19",
"@xenova/transformers": "^2.17.2",
"ai": "^4.3.16",
"class-variance-authority": "^0.7.1",
Expand Down Expand Up @@ -113,8 +118,10 @@
"url-metadata": "^5.2.1",
"usehooks-ts": "^3.1.1",
"vaul": "^1.1.2",
"viem": "^2.33.2",
"wagmi": "^2.16.1",
"zod": "^3.25.67",
"zustand": "^5.0.5"
"zustand": "^5.0.7"
},
"devDependencies": {
"@biomejs/biome": "^2.0.5",
Expand Down
Loading