Environment:AIPexStudio AIPex React Runtime
| Knowledge Sources | |
|---|---|
| Domains | Frontend, React, UI |
| Last Updated | 2026-10-24 12:00 GMT |
Overview
React 18/19 browser DOM runtime for the `@aipexstudio/aipex-react` UI toolkit — provides chat adapters, hooks, and components for building AIPex-powered chat experiences.
Description
This environment defines the React-based browser DOM runtime for the `@aipexstudio/aipex-react` package. It is a UI library providing React components, hooks, and adapters that depend only on `@aipexstudio/aipex-core` (not `@browser-runtime`). The package includes the `ChatAdapter` for translating agent event streams into UI messages, the `VADDetector` for voice activity detection using Web Audio API, and a full chatbot component library with Radix UI primitives, Tailwind CSS, and Framer Motion animations.
Usage
Use this environment for any Chat UI rendering, Event Stream Adaptation, Voice Input Processing, or Agent Hook usage in a browser context. It is the mandatory prerequisite for running the `ChatAdapter` (event-to-UI message transformation) and the `VADDetector` (microphone-based voice activity detection).
System Requirements
| Category | Requirement | Notes |
|---|---|---|
| Browser | Modern browser with DOM API | Chrome, Firefox, Safari, Edge |
| Hardware | Microphone (for voice features) | `navigator.mediaDevices.getUserMedia` required |
| Disk | ~50MB node_modules | React + Radix + Framer Motion + Three.js |
Dependencies
Core Peer Dependencies
- `react` >= 18.0.0 or >= 19.0.0
- `react-dom` >= 18.0.0 or >= 19.0.0
NPM Packages
- `@aipexstudio/aipex-core` (workspace)
- `@ricky0123/vad-web` >= 0.0.27
- `ai` >= 6.0.116
- `framer-motion` >= 12.35.1
- `three` >= 0.183.2
- `tokenlens` >= 1.3.1
- Radix UI primitives (avatar, collapsible, dialog, dropdown-menu, hover-card, label, progress, scroll-area, select, slot, tabs, tooltip)
- `class-variance-authority`, `clsx`, `tailwind-merge`
- `cmdk`, `embla-carousel-react`, `lucide-react`
- `markdown-to-jsx`, `remark-gfm`, `streamdown`
- `react-syntax-highlighter`, `use-stick-to-bottom`
Credentials
No environment variables required. The React runtime operates in the browser DOM; API keys are managed by the host application.
Quick Install
# Install the React UI toolkit
cd packages/aipex-react && npm install
# Build the package
npm run build
# Or consume as a dependency in your app:
npm install @aipexstudio/aipex-react
Code Evidence
React peer dependency specification from `packages/aipex-react/package.json:161-164`:
"peerDependencies": {
"react": "^18.0.0 || ^19.0.0",
"react-dom": "^18.0.0 || ^19.0.0"
}
VADDetector using Web Audio API for microphone access from `packages/aipex-react/src/lib/voice/vad-detector.ts:6-18`:
import { MicVAD } from "@ricky0123/vad-web";
export interface VADConfig {
positiveSpeechThreshold?: number;
negativeSpeechThreshold?: number;
minSpeechMs?: number;
preSpeechPadMs?: number;
redemptionMs?: number;
}
Microphone permission request from `packages/aipex-react/src/lib/voice/vad-detector.ts:52-59`:
const stream = await navigator.mediaDevices.getUserMedia({
audio: {
echoCancellation: true,
noiseSuppression: true,
autoGainControl: true,
},
});
ChatAdapter importing from core (not browser-runtime) from `packages/aipex-react/src/adapters/chat-adapter.ts`:
// ChatAdapter translates AgentEvent streams into UIMessage[] for React rendering.
// Depends on @aipexstudio/aipex-core types only, NOT @browser-runtime.
Common Errors
| Error Message | Cause | Solution |
|---|---|---|
| `Permission denied for microphone` | User denied `audioCapture` permission | Request microphone access in a user gesture context |
| `AudioContext not available` | Running in a non-browser context | Ensure the React component renders in a browser DOM environment |
| `React is not defined` | React peer dependency not installed | Install `react` and `react-dom` in the host application |
Compatibility Notes
- React 16/17: Not supported; minimum React 18 required for concurrent features and hooks.
- SSR (Next.js/Remix): Components using `navigator.mediaDevices` or `AudioContext` must be client-side only.
- Browser Extension: The `@aipexstudio/aipex-react` package is safe to use inside Chrome extensions as it does NOT depend on `@browser-runtime` (per architecture rules in CLAUDE.md).
- Bundle Size: The `three` dependency (for particle system animations) adds significant weight; tree-shake if unused.