Commit Graph

278 Commits

Author SHA1 Message Date
Pedram Amini
5595157bb8 MAESTRO: Create separate Vite config for web interface build
- Add vite.config.web.mts with dedicated web interface configuration
- Configure build output to dist/web/ directory
- Set up code splitting with React in separate chunk
- Enable source maps for development debugging
- Add dev server proxy for API and WebSocket connections
- Create index.html entry point with mobile-optimized meta tags
- Create main.tsx with device detection for mobile/desktop routing
- Add index.css with Tailwind, CSS custom properties, and animations
- Create placeholder mobile/desktop App components for Phase 1/2
- Update tailwind.config.mjs to include src/web files
2025-11-27 03:30:46 -06:00
Pedram Amini
1c21f7b8bb MAESTRO: Create useSessions hook for real-time session state management
Implements a useSessions hook that wraps useWebSocket to provide:
- Real-time session list management with add/remove/update handlers
- Active session tracking and selection
- Session interaction methods (sendCommand, interrupt, switchMode)
- Sessions grouped by tool type
- Client-side state tracking (isSending, lastError) preserved across updates
- Auto-connect option and refresh capability
2025-11-27 03:27:23 -06:00
Pedram Amini
8d04274ed9 MAESTRO: Create useWebSocket hook for web interface connection management
Add a comprehensive useWebSocket hook that handles:
- WebSocket connection lifecycle (connect, disconnect, reconnect)
- Authentication flow (token-based auth via query param or message)
- Real-time message handling for sessions, themes, and state changes
- Automatic reconnection with configurable attempts and delays
- Heartbeat/ping functionality for connection health
- Full TypeScript support with typed message interfaces
2025-11-27 03:25:25 -06:00
Pedram Amini
736e0ae7d4 MAESTRO: Create reusable Card component for web interface
Add Card component with support for multiple variants (default, elevated,
outlined, filled, ghost), padding options, and interactive states.

Includes:
- CardHeader subcomponent for consistent headers with title/subtitle/actions
- CardBody subcomponent for main content with padding control
- CardFooter subcomponent for footer actions with optional border
- SessionCard convenience component for session list items

Supports interactive states (clickable, selected, disabled) with keyboard
navigation and accessibility attributes.
2025-11-27 03:22:24 -06:00
Pedram Amini
ed1b063f10 MAESTRO: Create reusable Badge component for web interface status indicators
Add Badge component with multiple variants for session states:
- success (green): Ready/idle sessions
- warning (yellow): Agent thinking/busy
- error (red): No connection/error
- connecting (orange with pulse): Connecting state
- info (accent color): Informational badges
- default: Neutral styling

Includes three badge styles (solid, outline, subtle, dot) and
convenience components StatusDot and ModeBadge for common use cases.
2025-11-27 03:20:32 -06:00
Pedram Amini
6f82354005 MAESTRO: Create reusable Input and TextArea components for web interface
Add Input, TextArea, and InputGroup components following the same patterns
as the Button component with theme support via useTheme() hook. Features:
- Three variants: default, filled, ghost
- Three sizes: sm, md, lg
- Error state support with visual feedback
- Icon support (left/right) for Input component
- Auto-resize capability for TextArea
- InputGroup wrapper for label, helper text, and error display
2025-11-27 03:18:35 -06:00
Pedram Amini
b2bdd0b07b MAESTRO: Create reusable Button component for web interface
Add Button and IconButton components with theme support:
- Multiple variants: primary, secondary, ghost, danger, success
- Three sizes: sm, md, lg
- Loading state with spinner animation
- Support for left/right icons
- Full width option
- IconButton variant for icon-only buttons
- Uses theme colors via useTheme hook
2025-11-27 03:16:10 -06:00
Pedram Amini
da95e0c92e MAESTRO: Create CSS custom properties generator for web interface theme system
Add utility module that converts theme colors to CSS custom properties:
- generateCSSProperties(): Creates property map from theme
- generateCSSString(): Outputs CSS with :root selector
- injectCSSProperties(): Adds/updates style element in document head
- removeCSSProperties(): Cleans up injected styles
- setElementCSSProperties(): Applies to specific elements
- cssVar(): Helper for inline style usage

CSS variables use --maestro-* prefix with kebab-case naming
(e.g., theme.colors.bgMain -> --maestro-bg-main).

ThemeProvider now automatically injects CSS properties when theme
changes, enabling CSS-based theming alongside React context.
2025-11-27 03:13:38 -06:00
Pedram Amini
2ce759d8a0 MAESTRO: Create ThemeProvider component for web interface
- Add src/web/components/ThemeProvider.tsx with React context for theming
- Provide useTheme and useThemeColors hooks for child components
- Include default theme (Dracula) for initial render before WebSocket connection
- Update tsconfig.json to include src/web and src/shared directories
2025-11-27 03:11:02 -06:00
Pedram Amini
98aebe06f3 MAESTRO: Extract theme types to shared location for web interface
- Create src/shared/theme-types.ts with Theme, ThemeId, ThemeMode, ThemeColors types
- Add isValidThemeId type guard utility function
- Update renderer types to re-export from shared location
- Update main process themes.ts to use shared types
- Update web-server.ts to import Theme from shared instead of defining WebTheme
- This enables the web interface build to access theme types without duplicating code
2025-11-27 03:08:15 -06:00
Pedram Amini
72b847840a MAESTRO: Implement /api/theme GET endpoint for current theme configuration
Added a new REST API endpoint at /api/theme that returns the currently
configured theme. The endpoint:
- Is protected by token-based authentication (if enabled)
- Is rate limited using GET rate limit config
- Returns the theme object with all color values
- Returns 503 if theme service not configured
- Returns 404 if no theme is currently set
2025-11-27 03:05:38 -06:00
Pedram Amini
b3f1ba660c MAESTRO: Implement /api/session/:id/interrupt POST endpoint for session interruption
Add REST API endpoint to send SIGINT/Ctrl+C signal to sessions via the web interface.
This allows mobile and desktop web clients to gracefully interrupt running AI agents
or terminal processes.

- Add InterruptSessionCallback type for session interrupt operations
- Add setInterruptSessionCallback method to WebServer class
- Create /api/session/:id/interrupt POST endpoint with authentication and rate limiting
- Wire up callback in main process to use ProcessManager.interrupt()
2025-11-27 03:04:10 -06:00
Pedram Amini
90cc71ee49 MAESTRO: Implement /api/session/:id/send POST endpoint for sending commands
Add POST endpoint to send commands to active sessions via the web API:
- Add WriteToSessionCallback type for session input
- Implement /api/session/:id/send endpoint with rate limiting (POST limits)
- Validate command presence and type before processing
- Check session exists before attempting to write
- Wire up callback in index.ts using processManager.write()
2025-11-27 03:01:57 -06:00
Pedram Amini
65ca472230 MAESTRO: Implement /api/session/:id endpoint for detailed session data
- Add SessionDetail interface with extended session fields (aiLogs, shellLogs, usageStats, claudeSessionId, isGitRepo)
- Add GetSessionDetailCallback type and setGetSessionDetailCallback method
- Implement /api/session/:id endpoint with authentication and rate limiting
- Returns 404 for non-existent sessions, 503 if callback not configured
- Wire up callback in index.ts to fetch session data from sessions store
- Update header comments to reflect current implementation status
2025-11-27 02:59:49 -06:00
Pedram Amini
e7e037fe64 MAESTRO: Implement /api/sessions endpoint to return actual session data
Updated the /api/sessions endpoint to use the getSessionsCallback
to return real session data instead of an empty array placeholder.
Added authentication and rate limiting to the endpoint.
2025-11-27 02:57:24 -06:00
Pedram Amini
138ba5aeb4 MAESTRO: Add rate limiting for web interface endpoints
- Install @fastify/rate-limit package
- Configure rate limiting with sensible defaults:
  - 100 requests/minute for GET endpoints
  - 30 requests/minute for POST endpoints (more restrictive)
- Add RateLimitConfig interface for configuration
- Apply rate limiting to all /web/* routes
- Add /web/api/rate-limit endpoint to check current limits
- Skip rate limiting for /health endpoint
- Custom error response with retry-after information
- Support for X-Forwarded-For header for proxied requests
2025-11-27 02:55:51 -06:00
Pedram Amini
55761ee5db MAESTRO: Broadcast theme changes to connected web clients
Added broadcastThemeChange method to WebServer class and integrated
it with the settings:set IPC handler to automatically notify all
connected web clients when the user switches themes in the desktop app.
2025-11-27 02:52:22 -06:00
Pedram Amini
14ff05d36f MAESTRO: Send current theme on initial WebSocket connection
- Add WebTheme type and GetThemeCallback to web-server.ts
- Add setGetThemeCallback method to WebServer class
- Send theme after sessions list on initial connection
- Send theme after auth success for authenticated clients
- Create src/main/themes.ts with all theme definitions for main process
- Wire up theme callback in index.ts using getThemeById helper
2025-11-27 02:50:29 -06:00
Pedram Amini
d40d36a43b MAESTRO: Broadcast session state changes to connected web clients
Added real-time session state broadcasting to the web interface:

- Added broadcastSessionStateChange() method to broadcast when session state,
  name, or input mode changes
- Added broadcastSessionAdded() and broadcastSessionRemoved() methods for
  tracking session lifecycle
- Added broadcastSessionsList() method for bulk session sync
- Modified sessions:setAll IPC handler to detect session changes and broadcast
  them to all authenticated web clients
- Added setGetSessionsCallback() to allow web server to fetch current sessions
- Send initial sessions_list to newly connected/authenticated web clients
- Only broadcast to authenticated clients for security

WebSocket message types added:
- session_state_change: { type, sessionId, state, name?, toolType?, inputMode?, cwd?, timestamp }
- session_added: { type, session, timestamp }
- session_removed: { type, sessionId, timestamp }
- sessions_list: { type, sessions, timestamp }
2025-11-27 02:46:14 -06:00
Pedram Amini
f541b3f198 MAESTRO: Add optional PIN/token authentication for web interface
- Add WebAuthConfig type and auth state management in WebServer
- Generate 6-character alphanumeric PINs (excludes confusing chars)
- Support authentication via:
  - WebSocket query string (?token=XXX)
  - WebSocket auth message { type: 'auth', token: '<token>' }
  - REST API headers (Authorization: Bearer or X-Auth-Token)
- Add IPC handlers for auth management:
  - webserver:getAuthConfig
  - webserver:setAuthEnabled (auto-generates token if needed)
  - webserver:generateNewToken
  - webserver:setAuthToken
  - webserver:getConnectedClients
- Persist auth settings in electron-store
- Add /web/api/auth/status and /web/api/auth/verify endpoints
2025-11-27 02:41:29 -06:00
Pedram Amini
c95380f8cb MAESTRO: Add WebSocket upgrade handler for web clients at /ws/web
- Added new WebSocket endpoint at /ws/web for web interface clients
- Implemented client connection tracking with unique client IDs
- Added connection/disconnection event handling with logging
- Added message handling for ping/pong, subscribe, and echo
- Added broadcastToWebClients() method for real-time updates
- Added getWebClientCount() method for monitoring connected clients
- Imported WebSocket from 'ws' for readyState checks
- Added WebClient and WebClientMessage type definitions
2025-11-27 02:37:53 -06:00
Pedram Amini
06318eef4f MAESTRO: Add /web/* route namespace for web interface
Created dedicated web interface route namespace in WebServer class:
- /web - Root endpoint returning available interfaces info
- /web/desktop - Desktop web interface entry point (placeholder)
- /web/desktop/* - Wildcard for client-side routing
- /web/mobile - Mobile web interface entry point (placeholder)
- /web/mobile/* - Wildcard for client-side routing
- /web/api - Web API namespace root with endpoint discovery

This establishes the foundation for the new web interface that will
provide both desktop (collaborative) and mobile (remote control)
access to Maestro sessions.
2025-11-27 02:33:44 -06:00
Pedram Amini
7488dc25b2 feat: Improve AI command display and add message delivery tracking
- Add delivery checkmark for user messages when AI responds
- Display AI commands with styled header showing command name and description
- Show full interpolated prompt below the command header
- Fix template variable substitution to happen before prompt display
- Improve hover states for copy/speak buttons

Claude ID: 24a6cdd6-27a7-41e0-af30-679cc2ffe66b
Maestro ID: 5a166b38-b7e9-47f0-a8ff-0113c65f2682
2025-11-27 02:19:55 -06:00
Pedram Amini
da21f4a1f8 feat: Improve History panel graph and session pill UX
- History activity graph now uses sliding time window that adjusts as
  you scroll, showing activity relative to the visible entries rather
  than always anchored to "now"
- Session ID pill now opens on hover instead of click for faster access
- Added hover timeout and invisible bridge for smooth tooltip behavior

Claude ID: 24a6cdd6-27a7-41e0-af30-679cc2ffe66b
Maestro ID: 5a166b38-b7e9-47f0-a8ff-0113c65f2682
2025-11-27 02:08:02 -06:00
Pedram Amini
0835672ce0 feat: Add session naming with search and improve macOS code signing
- Add user-defined session names stored with Claude session origins
- Display session names in AgentSessionsBrowser with tag icon
- Add "Named only" filter to quickly find named sessions
- Include session names in search across title and content modes
- Sync session names when renaming sessions in the sidebar
- Fix macOS code signing with ad-hoc signatures in release workflow
- Fix electron-builder CLI syntax (--config.extraMetadata)
- Improve lightbox navigation with context-aware image arrays
- Fix GitLogViewer search input focus handling
- Improve AI command prompt display with multi-line clamp

Claude ID: 24a6cdd6-27a7-41e0-af30-679cc2ffe66b
Maestro ID: 5a166b38-b7e9-47f0-a8ff-0113c65f2682
2025-11-27 01:59:49 -06:00
Pedram Amini
17b929d430 feat: Add template variables for custom AI commands
- Add template variable system with substitution for session, project,
  date/time, and git context (e.g., {{SESSION_NAME}}, {{GIT_BRANCH}})
- Display collapsible template variables documentation in AI Commands panel
- Update default /commit command to include {{CLAUDE_SESSION_ID}} for traceability
- Add tag icon indicator for sessions with custom (user-defined) names
- Improve Git Log Viewer date formatting (time for today, full date for older)
- Improve Git Log search UX with better focus handling
- Change Agent Sessions Browser default search mode to 'all'
- Update README with custom AI commands documentation
- Add template variable file reference to CLAUDE.md

Session: 35b88ae2-fc1a-44de-a1a1-4b0f0f5a14f9
2025-11-27 01:30:31 -06:00
Pedram Amini
d2ab6db88c feat: Add session bookmarks and improve release workflow
- Add bookmark feature to sessions (star icon on hover, dedicated
  Bookmarks section at top of Left Bar when bookmarks exist)
- Improve GitHub release workflow to handle partial build failures
  gracefully (continue-on-error for each platform)
- Fix input placeholder spacing ("Ask Claude about" instead of
  "askClaudeAbout")
- Update README to document bookmark functionality
2025-11-27 01:18:43 -06:00
Pedram Amini
9aa9982feb build fix 2025-11-27 00:57:26 -06:00
Pedram Amini
b8a32e2de3 MAESTRO: Fix history entry deletion bug - missing unique ID
The addHistoryEntry helper function was not generating a unique ID for
history entries. This caused all USER-type entries to have undefined IDs,
which meant when the delete handler filtered by entry.id !== entryId, all
entries with undefined IDs would match and be deleted together.

Added generateId() call to ensure each history entry has a unique ID.
2025-11-27 00:56:21 -06:00
Pedram Amini
b65355181f MAESTRO: Display Auto Mode Running indicator across all right sidebar tabs
Moved the batch run progress indicator from Scratchpad to RightPanel,
so it now persists at the bottom of all three tabs (Files, History,
Scratchpad) when auto mode is active.
2025-11-27 00:50:12 -06:00
Pedram Amini
109f32dbd8 MAESTRO: Add token/context tracking to auto-run task history details
- Add elapsedTimeMs field to HistoryEntry interface to track task duration
- Update useBatchProcessor to capture and pass usage stats (tokens, context,
  cost) and elapsed time when adding history entries for auto-run tasks
- Enhance HistoryDetailModal with a comprehensive stats panel that shows:
  - Context window progress bar with percentage
  - Token breakdown (input/output/cache tokens)
  - Elapsed time in human-readable format
  - Cost per task
- Update main process HistoryEntry interface to match renderer types

This enables users to track resource usage for each auto-run task iteration
in the history details view.
2025-11-27 00:47:46 -06:00
Pedram Amini
641cb81f83 MAESTRO: Move parallel batch processing doc to tmp/ 2025-11-27 00:41:33 -06:00
Pedram Amini
db5737c46b MAESTRO: Add design doc for parallel batch processing with git worktrees
Documents the implementation plan for adding parallel task execution
to the Auto Runner feature. Key concepts:

- Git worktrees for isolated working directories per task
- Configurable concurrency (default: 3 workers)
- UI toggle for serial vs parallel mode
- Merge strategies and conflict handling
- Resource considerations and cleanup

This enables significant speedup when batch tasks are independent,
reducing total execution time from N*T to approximately T (where N
is task count and T is average task duration).
2025-11-27 00:38:12 -06:00
Pedram Amini
8288ab73db MAESTRO: Fix batch task session ID overwriting interactive session
The batch processor was incorrectly overwriting the main session's
claudeSessionId when batch tasks completed. This caused the main panel
to display the batch task's session ID instead of the interactive
session's ID.

Fix: Remove claudeSessionId from the setSessions update when batch tasks
exit. The batch task's claudeSessionId is still returned via the Promise
resolve for tracking/history purposes, but it no longer contaminates
the interactive session state.
2025-11-27 00:36:38 -06:00
Pedram Amini
0b47daa47e MAESTRO: Add session origin tracking to distinguish Maestro vs CLI sessions
- Added new store (maestro-claude-session-origins) to track which Claude
  sessions were created via Maestro and whether they were user-initiated
  or auto-batch sessions
- Added IPC handlers for registering and retrieving session origins
- Updated App.tsx to register user-initiated sessions when receiving
  Claude session IDs (non-batch sessions)
- Updated useBatchProcessor.ts to register auto/batch sessions
- Updated claude:listSessions to include origin type in returned data
- Updated AgentSessionsBrowser.tsx to display colored origin pills:
  - MAESTRO (accent color): user-initiated through Maestro
  - AUTO (warning color): batch/auto sessions through Maestro
  - CLI (dim): sessions created via Claude Code command line
2025-11-27 00:33:47 -06:00
Pedram Amini
7cd4a11bd4 MAESTRO: Add session stats panel to Claude session details view
When viewing a Claude session's details, users now see a comprehensive
stats panel showing:
- Cost (with 4 decimal precision)
- Duration (calculated from first to last message timestamps)
- Total tokens with context window percentage (based on 200k)
- Message count
- Token breakdown: input, output, cache read, cache write
- File size and session start time

Extended ClaudeSession interface with token details (inputTokens,
outputTokens, cacheReadTokens, cacheCreationTokens) and durationSeconds.
Backend now calculates duration by parsing first and last timestamps
from the session file.
2025-11-27 00:28:57 -06:00
Pedram Amini
e0d3b6eb7f MAESTRO: Add star/bookmark functionality to Claude Sessions Browser
- Added Star icon import and starredSessions state
- Load starred sessions from settings on component mount
- Added toggleStar function to toggle and persist star status
- Modified filteredSessions to sort starred sessions to the top
- Added star button UI to each session in the list
- Starred sessions are persisted per-project in settings

This matches the functionality already in AgentSessionsModal.tsx
2025-11-27 00:26:14 -06:00
Pedram Amini
3e1e2484a6 added session management from main panel 2025-11-26 23:55:41 -06:00
Pedram Amini
0a09e19b0c sync version number to tag/release 2025-11-26 23:31:07 -06:00
Pedram Amini
091996e181 fix: Handle carriage returns in terminal output and add stream-json usage stats
- Add processCarriageReturns() to handle terminal line overwrites (fixes
  Claude Code status line "In: X  Out: Y" not updating in real-time)
- Apply carriage return processing to both AI and terminal mode output
- Add usage stats extraction for stream-json mode (when images are used)
- The carriage return fix ensures status lines that use \r for in-place
  updates display only the final state, not all intermediate updates
2025-11-26 23:06:14 -06:00
Pedram Amini
ed443a2a37 feat: Add session favorites, recent sessions quick access, and window state persistence
- Add starred/favorite sessions in Agent Sessions modal (persisted per-project)
- Add recent Claude sessions hover tooltip on Agent Sessions button for quick access
- Remember window size, position, and maximized/fullscreen state across restarts
- Fix light theme text colors for user message bubbles in chat views
- Fix auto-scroll to pause when user has expanded log entries
- Move history graph tooltip below the graph to avoid overlap
- Adjust warning colors in vibe mode themes for better contrast
2025-11-26 23:00:43 -06:00
Pedram Amini
94c9bc90a4 fix: Resolve macOS and Linux build failures in release workflow
- Use Python 3.11 for macOS builds (Python 3.12+ removed distutils module needed by node-gyp)
- Add author email to package.json (required for Linux .deb package maintainer field)
2025-11-26 22:38:52 -06:00
Pedram Amini
826c364557 feat: Replace globe tooltip with live agents table
- Shows all agents with active tunnels in a scrollable list
- Each entry displays agent name and group name
- Click agent name to jump to that session
- Click localhost link to open local server
- Click ngrok link (if available) to open public tunnel URL
2025-11-26 22:32:04 -06:00
Pedram Amini
840b8a03f0 feat: Add Vibe Mode themes section with new color schemes
- Move Pedurple and Maestro's Choice to new Vibe Mode section
- Change Pedurple's third color from orange to pinkish violet (#da70d6)
- Redesign Maestro's Choice: elegant dark theme with gold accents
- Add Dre Synth: 80s synthwave with hot pink, cyan, and deep purple
- Add InQuest: stark black/red/white security aesthetic
- Themes panel now shows Dark Mode, Light Mode, and Vibe Mode sections
2025-11-26 22:30:37 -06:00
Pedram Amini
6addd11ce6 feat: Improve history graph tooltip with time range and counts
- Show actual time range (e.g., '2PM - 3PM') instead of 'X hours ago'
- Display Auto and User counts on separate lines for clarity
- Better visual formatting with labels and values aligned
2025-11-26 22:27:35 -06:00
Pedram Amini
21babd5b20 fix: Align activity graph with filter buttons in History panel
- Change container to items-start for top alignment
- Add small top margin to graph to align bordered box with button text
2025-11-26 22:26:49 -06:00
Pedram Amini
80ea42a1b7 fix: Show cost and time widgets by default in header
- Initialize panelWidth to Infinity so widgets show before ResizeObserver fires
- Get initial width immediately on mount
- Widgets were hidden because initial state was 0, failing the > 500/600 checks
2025-11-26 22:25:44 -06:00
Pedram Amini
4a7e03d1f9 feat: Add 'Made in Austin, TX' to About modal 2025-11-26 22:24:58 -06:00
Pedram Amini
70af470983 fix: Fix blinking buttons and scroll jumping in terminal output
- Optimize atBottomStateChange to only update state when value changes
- Disable auto-scroll when user has expanded log entries
- Memoize toggleExpanded, toggleLocalFilter, and setLocalFilterQuery callbacks
- Reduces unnecessary re-renders that caused button blinking
2025-11-26 22:24:14 -06:00
Pedram Amini
630e1911ec fix: Remove ^C log entry when interrupting Claude 2025-11-26 22:22:20 -06:00