-
Notifications
You must be signed in to change notification settings - Fork 0
[WIP] Add browser mode for Cletus with react client #158
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Co-authored-by: ClickerMonkey <421233+ClickerMonkey@users.noreply.github.com>
Co-authored-by: ClickerMonkey <421233+ClickerMonkey@users.noreply.github.com>
Co-authored-by: ClickerMonkey <421233+ClickerMonkey@users.noreply.github.com>
Co-authored-by: ClickerMonkey <421233+ClickerMonkey@users.noreply.github.com>
Co-authored-by: ClickerMonkey <421233+ClickerMonkey@users.noreply.github.com>
Replaces legacy UI components with new modular components under 'ui', removes unused components, and introduces Tailwind CSS for styling. Adds Tailwind and related dependencies, updates build configs, and refactors browser app structure to support new operations and improved UI. Cleans up and reorganizes code for maintainability and scalability.
Introduces new React components for chat UI, including selectors for agent mode, assistant, model, and mode, as well as modals for chat settings, commands, and todos. Updates ChatInput and MessageItem to support richer metadata and message content, and improves UI consistency. Adds a migration script for chat message format and updates utility UI components for better accessibility and appearance.
Introduces an OperationApprovalPanel React component for approving or rejecting operations in chat messages. Updates the WebSocket server and protocol to handle operation approval, including new 'handle_operations' message types and backend logic for updating message operations. Refactors message and operation handling in ChatPage and related components, improves type safety, and cleans up unused props. Adds a browser-specific tsconfig for improved TypeScript support.
Adds folder picker for working directory in chat settings, improves chat title editing and message clearing confirmation in ChatPage, and synchronizes working directory (cwd) between client and server. Refactors BaseOperationDisplay to render JSON data in a more user-friendly HTML/table format. Updates websocket types and dba operation to support these changes.
Introduces UI and logic for approving/rejecting assistant operations, including bulk and per-operation controls. Refactors operation renderer components to support approval props and concise summaries, and centralizes operation renderer prop types. Updates ChatInput, MessageList, and ChatPage to handle operation approval state and actions.
Introduces a new QuestionsModal component for collecting user answers to dynamic questions. Integrates the modal into ChatPage, handling submission and cancellation, and updates chat metadata accordingly.
Introduces a new ToolsetSelector component for selecting toolsets in the chat UI and integrates it into ChatPage. Refactors the question answering flow: question answers are now submitted as structured data to the server, which formats and adds messages, clears questions, and triggers the orchestrator. Updates websocket types and server logic to support the new 'submit_question_answers' message. Cleans up ChatInput and AgentModeSelector UI for clarity.
Introduces a ProfileModal component for editing user settings in the browser UI, with support for updating user config via WebSocket. Adds persistent tool tracking in the chat agent context to keep recently used tools visible. Refactors toolset initialization and registration, and improves typing indicator UI. Also updates schemas, config, and WebSocket types to support user updates, and fixes minor UI and logic issues.
Replaces the main chat UI with a new UnifiedLayout component, consolidating chat, sidebar, and settings into a single layout. Refactors operation renderer files to use a new createRenderer utility for consistent display and summary logic, and improves summary details for file, shell, and type operations. Removes unused display settings from the profile modal and updates operation renderer type signatures for stricter typing.
31f45c7 to
4c83e03
Compare
Extracted chat orchestration logic into a reusable runChat function in server.ts to reduce code duplication and improve maintainability. Simplified OperationDisplay in index.tsx to directly use operation-specific renderers and moved the OperationDisplayProps interface to render.tsx.
Adds visual feedback and disables buttons during operation processing in ChatInput and BaseOperationDisplay. Introduces a 'hasOperationsProcessing' prop to ChatInput and updates UnifiedLayout to track and pass this state. Also adds a Cache (JSON) tab to operation details and removes the unused ChatPage component.
ChatSidebar header updated from 'Chats' to 'Cletus'. In server.ts, added process-level error and warning handlers to prevent silent crashes. Enhanced chat message persistence by saving or updating pending and complete messages immediately, ensuring no data loss on errors or cancellations. Improved fireAndForget utility to accept async functions, and ensured partial progress is saved on orchestrator errors.
Removed MainPage and ChatList components, consolidating chat selection and creation logic into UnifiedLayout and ChatSidebar. Improved message loading feedback and temporary message handling for a more responsive UI. Updated server-side WebSocket handling to support interruptible operations and more robust operation execution feedback. Added 'processing' state to client-server protocol for better UI state management.
Introduces a WebSocketContext and provider to manage WebSocket connections and state across the app. Refactors app and main page components to use the new context, improving code organization and connection lifecycle management. Updates websocket-types to support message handler unsubscription and connection state checks. Renames UnifiedLayout to MainPage for clarity.
Replaces useRef with useState for managing the WebSocket instance in WebSocketProvider. Updates context initialization and useWebSocket hook to improve type safety and error handling.
Refactors message creation to ensure consistent 'created' timestamps and corrects temporary message logic in MainPage. Improves chat state clearing on chat selection and prevents duplicate messages. Also updates renderer function signatures for better type safety.
Introduces an ImageViewer component for zooming, panning, and downloading images, and updates image rendering in MessageItem and artist operations to use ClickableImage. Adds a /file route to the browser server for serving local files, enabling secure access to images and other assets. Also increases summary display height in BaseOperationDisplay for improved readability.
Introduces ChatOperationManager and BroadcastManager to manage per-chat operation state and broadcast server events to all clients watching a chat. Adds ConnectionRegistry for tracking client subscriptions to chats, enabling real-time multi-client synchronization. Refactors WebSocket server and client logic to support chat subscription, operation state sync, and robust cancellation, and updates message types and handlers for chat-scoped events. Also improves chat creation UX and tool type safety.
Deleted obsolete components: ChatFooter, ChatHeader, CommandsPanel, and OperationApprovalPanel. Refactored operation display logic by moving and renaming BaseOperationDisplay to OperationDisplay, consolidating status helpers, and updating props usage. Improved operation approval handling and streamlined message operation status updates.
Expanded documentation for the cletus agent to include browser architecture, stricter TypeScript guidelines, and detailed instructions for adding and implementing tools and operations. Clarifies operation execution, code reuse, and rendering practices for both CLI and web environments.
ClickerMonkey
approved these changes
Dec 20, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Browser Mode Implementation - Complete ✅
Successfully implemented
--browsermode for Cletus with a React-based web UI!Features Implemented
--browserand--portCLI argumentsany/unknownusageArchitecture
Server (
src/browser/server.ts):Client (
src/browser/client/):Screenshots
Initialization Page (when no config exists):
Usage
Technical Notes
dist-browser/directoryBuild Process
esbuild.config.cjs→dist/index.jsesbuild.browser.cjs→dist-browser/npm run buildSecurity
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.