mirror of
https://github.com/vxcontrol/pentagi.git
synced 2026-11-17 03:10:25 +00:00
Previously DataTableFilter (and InputSearch) layered four cells holding
the same logical value — `localValue` (sync useState), `debouncedValue`
(async useState inside `useDebouncedValue`), `lastEmittedReference`
(ref), and the parent's `query` prop (async round-trip) — and stitched
them together with two opposing useEffect's. The async `debouncedValue`
cell could be read out of phase from any other effect, which leaked
through as four distinct races: X clear after debounce flush (URL/state
snap back ~50–80 ms), X clear *before* debounce flush (pending timer
fires after clear), external `query` change mid-debounce (pending
typed value clobbers external), and tail-end character loss on fast
typing across the round-trip boundary.
Drop the extra storage cell. The debounce is now an imperative
`pendingTimerReference` mutated only by `handleChange`,
`cancelPendingEmit`, and the external-sync effect. All outbound
emission goes through one `emit(next)` function that synchronously
cancels any pending timer before sending. `handleClear` → `emit('')`.
External `query` change → cancel pending + accept. Unmount → cancel.
`onQueryChange` lives behind `useLatestRef` so effect deps stay
stable across parent re-renders.
Four regression tests in data-table.test.tsx pin all four scenarios.
Verified by rolling back the fix temporarily — the X-clear race test
fails with the exact `emitted = ['', 'alpha', '']` from the original
browser repro. With the fix in place all four pass.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
PentAGI Frontend
A chat application built with React, TypeScript, and GraphQL that enables intelligent conversations with AI agents.
Features
- 💬 Real-time chat interface with AI agents
- 🤖 Multiple AI agent support and management
- 📊 Real-time terminal output monitoring
- 🎯 Task and subtask tracking system
- 🔍 Integrated search capabilities
- 📚 Vector store for knowledge base management
- 📸 Screenshot capture and management
- 🌓 Dark/Light theme support
- 📱 Responsive design (mobile, tablet, desktop)
- 🔐 Authentication system with multiple providers
- 🔄 Real-time updates via GraphQL subscriptions
- ⚡ High-performance React components
Tech Stack
- Framework: React 18 with TypeScript
- Build Tool: Vite
- Styling: Tailwind CSS
- UI Components:
- shadcn/ui
- Radix UI primitives
- Lucide icons
- State Management:
- React Context
- Custom Hooks
- API Integration:
- GraphQL
- Apollo Client
- WebSocket subscriptions
- Type Safety: TypeScript
- Authentication: Multiple provider support
- Code Quality:
- ESLint
- Prettier
- TypeScript strict mode
Project Structure
src/ ├── components/ # Shared UI components │ ├── ui/ # Base UI components │ └── icons/ # SVG icons and logo ├── features/ # Feature-based modules │ ├── chat/ # Chat related components │ ├── authentication/ # Auth related components ├── hooks/ # Custom React hooks ├── lib/ # Utilities and configurations ├── graphql/ # GraphQL operations and types ├── models/ # TypeScript interfaces └── pages/ # Application routes
Key Components
Chat Interface
- Split view with messages and tools panels
- Resizable panels for desktop
- Mobile-optimized view with tabs
- Real-time message updates
Task System
- Real-time task tracking
- Subtask management
- Progress monitoring
- Status updates
Terminal
- Command output display
- Real-time updates
- Scrollable history
- Syntax highlighting
Vector Store
- Knowledge base integration
- Search capabilities
- Data management
Agent System
- Multi-agent support
- Agent status monitoring
- Agent communication logs
Development
Prerequisites
- Node.js 18+
- pnpm 10+
Installation
- Clone the repository
- Install dependencies: pnpm install
- Start the development server: pnpm run dev
Building for Production
pnpm run build
Environment Variables
Create a .env file in the root directory:
VITE_API_URL=your_api_url
Contributing
- Fork the repository
- Create your feature branch (git checkout -b feature/amazing-feature)
- Commit your changes (git commit -m 'Add some amazing feature')
- Push to the branch (git push origin feature/amazing-feature)
- Open a Pull Request