Commit Graph

2564 Commits

Author SHA1 Message Date
Pedram Amini
2fd83bdc4a feat(toggleMode): restore file preview tab when returning from terminal
When pressing cmd+j to switch between AI/terminal mode, the previously
active file preview tab is now saved and restored. This allows users
to view a file, switch to terminal, run commands, then switch back and
have the same file preview re-opened automatically.

Added preTerminalFileTabIdRef to UILayoutContext to track the active
file tab before switching to terminal mode. Updated toggleInputMode
to save/restore this state.
2026-02-02 20:46:25 -06:00
github-actions[bot]
4b2f7e046d docs: sync release notes for v0.15.0-RC 2026-02-03 02:06:32 +00:00
Pedram Amini
7c7f3be9fb ## CHANGES
- Switching to Terminal now clears file preview, avoiding confusing leftovers 🧹
- Cmd+J toggle works from file preview straight into Terminal view ⌨️
- Keyboard handler now whitelists toggleMode even with modals open, improving flow 🔓
2026-02-02 19:53:10 -06:00
Pedram Amini
d9a27c9a3f fix(FilePreview): memoize props to prevent image flickering
The FilePreview component was receiving new object/function references on
every render of MainPanel, causing unnecessary re-renders that made images
flicker. This happened because:

1. The `file` prop was an inline object literal created each render
2. All callback props (onClose, onSave, etc.) were inline arrow functions
3. The `cwd` prop used an IIFE that recalculated each render
4. The `sshRemoteId` prop used inline ternary logic

Fixed by:
- Memoizing the file object with useMemo (keyed on actual values)
- Memoizing all callbacks with useCallback
- Memoizing cwd and sshRemoteId with useMemo
- Using stable references for all FilePreview props

This ensures FilePreview only re-renders when actual data changes, not on
every parent render cycle.
2026-02-02 19:49:26 -06:00
Pedram Amini
78a93cdf24 fix(tests): ensure SaveMarkdownModal tests wait for async state updates
The tests were causing unhandled rejection errors because they weren't
waiting for the `finally` block's `setSaving(false)` to complete after
error handling. Updated waitFor assertions to also check that the save
button text returns to "Save" (from "Saving..."), ensuring all async
state updates are complete before the test ends and the component unmounts.
2026-02-02 19:44:38 -06:00
Pedram Amini
02eed05dae added AGENTS.md symlink to CLAUDE.md 2026-02-02 19:43:41 -06:00
Pedram Amini
2e114451fd Merge pull request #282 from pedramamini/0.15.0-rc
0.15.0 rc
2026-02-02 19:41:34 -06:00
Pedram Amini
616c041626 fix(tabs): scroll file preview tabs into view when selected
The TabBar scroll-into-view effect only triggered for AI tabs. Added
activeFileTabId to the useEffect dependencies so file preview tabs
are also scrolled into view when opened.
2026-02-02 19:21:47 -06:00
Pedram Amini
fc3872ea73 fix(tabs): restore file preview tabs with Cmd+Shift+T
handleCloseCurrentTab was duplicating file tab close logic inline
but not adding closed tabs to unifiedClosedTabHistory, causing
Cmd+Shift+T to restore a different tab instead of the most recently
closed one. Now uses closeFileTabHelper which properly tracks history.
2026-02-02 19:19:21 -06:00
Pedram Amini
72debe1049 refactor: remove unused legacy file preview navigation code
- App.tsx: Remove unused import (reopenClosedTab), legacy navigation
  variables (backHistory, forwardHistory, filePreviewHistory,
  filePreviewHistoryIndex), legacy callbacks (setFilePreviewHistory,
  setFilePreviewHistoryIndex), unused async handler (handleOpenFileTabAsync),
  and legacy navigation handlers (handleNavigateBack, handleNavigateForward,
  handleNavigateToIndex) - all superseded by per-tab navigation system
- MainPanel.tsx: Prefix unused destructured props with underscore
- contextUsage.ts: Remove unused UsageStats import

This removes ~250 lines of dead code from the legacy session-level
file preview navigation system, which has been replaced by the per-tab
breadcrumb navigation in the unified tab system.
2026-02-02 18:34:38 -06:00
Pedram Amini
27cb4fbb86 fix(tests): update tests for agent count, ToolType changes, and file tab system
- detector.test.ts: Update agent count from 7 to 8 (aider was added)
- session-storage.test.ts: Fix import paths for factory-droid storage
- agents.test.ts: Add AGENT_DEFINITIONS to mock for handler tests
- stats.test.ts: Remove tests for non-existent initialization handlers
- usage-aggregator.test.ts: Update DEFAULT_CONTEXT_WINDOWS test for actual ToolType values
- MainPanel.test.tsx: Migrate from previewFile prop to activeFileTabId/activeFileTab system
- contextUsage.test.ts: Update tests for current ToolType values (removed 'claude', 'aider')
- SessionStatusBanner.test.tsx: Update test for null return when tokens exceed context
- usage-listener.test.ts: Fix expected contextUsage (falls back to 200k default)
2026-02-02 18:28:38 -06:00
Pedram Amini
88e04d2f8e Merge main into 0.15.0-rc: fix context window calculation
Key changes:
- Accept main's fix for context usage calculation (returns null for
  accumulated multi-tool turn values instead of capping at 100%)
- Adopt main's refactored structure:
  - agent-detector.ts → agents/detector.ts + definitions.ts + capabilities.ts
  - stats-db.ts → stats/*.ts modules
  - agent-session-storage types → agents/index.ts
- Port factory-droid agent to new agents/definitions.ts structure
- Remove obsolete shared/contextUsage.ts (logic now in renderer/utils)
- Update all import paths to reference new module locations
- Preserve all RC features: Symphony, File Preview Tabs, TabNaming, etc.

The context window fix is critical: main's approach correctly handles
when Claude Code reports accumulated token values from multi-tool turns
by returning null, causing the UI to preserve the last valid percentage.
RC's approach masked this by capping at 100%, hiding the issue.
2026-02-02 18:03:05 -06:00
Pedram Amini
898262af4a fix(tests): fix FilePreview click-outside tests by tracking dual useClickOutside hooks
The tests were failing because FilePreview uses useClickOutside twice (once for
container dismiss, once for TOC dismiss) and the mock was only capturing the
last call. Updated the mock to track both calls separately and added proper
act() wrapping for React state updates.
2026-02-02 17:37:25 -06:00
Pedram Amini
ace8e2beaa fix(docs): standardize image paths to use ./screenshots/ format
All image references now consistently use relative ./screenshots/ paths
instead of mixed formats (some were /screenshots/ or screenshots/).
2026-02-02 17:32:12 -06:00
Pedram Amini
11721c4b95 Merge pull request #281 from pedramamini/in-tab-file-preview
In-Tab File Preview
2026-02-02 17:31:31 -06:00
Pedram Amini
d5b75092d4 MAESTRO: Fix file preview save not persisting content
After saving a file in the file preview tab, the UI was reverting to the
original content despite showing "Saved". This occurred because:
- editContent was cleared to undefined after save
- The base content field was never updated to the saved value
- UI fell back to stale original content

Added savedContent parameter to handleFileTabEditContentChange to update
the tab's base content alongside clearing editContent after save.
2026-02-02 17:30:05 -06:00
Pedram Amini
bf528bc629 fixed image path 2026-02-02 17:29:18 -06:00
Pedram Amini
d1e499e9f5 MAESTRO: Add per-tab breadcrumb navigation for file preview
- Added FilePreviewHistoryEntry type to track navigation history per tab
- Extended FilePreviewTab with navigationHistory and navigationIndex fields
- Updated handleOpenFileTab to build navigation history when replacing content
- Added handleFileTabNavigateBack/Forward/ToIndex handlers for per-tab nav
- Wired navigation props through MainPanel to FilePreview component
- Each file tab maintains its own independent navigation history
2026-02-02 17:25:10 -06:00
Raza Rauf
5373a5faa4 Merge pull request #280 from pedramamini/code-refactor
fix: correct context usage calculation to include cacheRead tokens an…
2026-02-02 17:20:27 -06:00
Pedram Amini
a7117f3d41 MAESTRO: Fix ToC blocking file content scroll
Replace backdrop-based click-outside detection with useClickOutside hook.
The previous fixed backdrop div intercepted all pointer events including
wheel events, preventing file content from scrolling while ToC was open.
Now wheel events over file content scroll the content, while wheel events
over the ToC scroll the ToC list.
2026-02-02 17:17:41 -06:00
Pedram Amini
2aa3cc701e MAESTRO: Implement file link navigation behavior
Regular click on file links replaces current tab content, while
Cmd/Ctrl+Click opens a new tab adjacent to the current tab.
2026-02-02 17:13:37 -06:00
Raza Rauf
fa4eb745ab fix: correct context usage calculation to include cacheRead tokens and handle accumulated values
The context formula was excluding cacheReadInputTokens, causing the gauge to
drastically underestimate usage (e.g., 3% when reality was 23%). During
multi-tool turns, accumulated token totals could exceed the context window,
producing false 100% readings and premature compact warnings.

- Include cacheReadInputTokens in the formula (input + cacheRead + cacheCreation)
- Detect accumulated values (total > window) and return null to preserve last valid %
- Skip context updates during accumulated turns instead of displaying inflated values
- Fix MainPanel tooltip deriving from raw tab stats instead of preserved session percentage
- Handle group chat participant/moderator accumulated values with -1 sentinel
2026-02-03 04:12:19 +05:00
Pedram Amini
cca63c3741 MAESTRO: Isolate ToC scroll from file preview content scroll
Added overscrollBehavior: 'contain' to both the main content
container and the TOC overlay's scrollable entries section. Also
added onWheel stopPropagation to the TOC entries div to fully
prevent scroll events from leaking between the ToC overlay and
the main file preview content. This prevents scroll chaining that
could cause scrollbar flickering.
2026-02-02 17:05:33 -06:00
Pedram Amini
94364a5fe0 MAESTRO: Fix markdown image flickering with global cache
Added global image cache to MarkdownImage component to prevent
re-fetching images on re-renders, which was causing scrollbar
flickering. Key changes:

- Global imageCache Map stores loaded images with TTL (10 min)
- Images are cached by resolved path, including dimensions
- Loading placeholder has min-height/min-width to reduce layout shift
- Loaded images use aspectRatio from cached dimensions
- onLoad handler captures and caches natural dimensions

This eliminates the flickering/scrollbar jumping when viewing
markdown files with embedded images.
2026-02-02 16:56:54 -06:00
Pedram Amini
362c08f713 MAESTRO: Include Cmd+Shift+T (reopen closed tab) in overlay allowlist
Extended isTabManagementShortcut to include Cmd+Shift+T for reopening
closed tabs when overlays are open. The closeFileTab helper already
adds file tabs to unifiedClosedTabHistory, and reopenUnifiedClosedTab
handles restoring both AI and file tabs. This ensures Cmd+Shift+T works
from file preview and other overlay contexts.
2026-02-02 16:51:29 -06:00
Pedram Amini
4c6976da2f MAESTRO: Isolate ToC scroll from file preview content scroll
Add onWheel stopPropagation to TOC overlay container so mouse wheel
events over the ToC scroll only the ToC, not the underlying file
content. Also update tests to reflect the previous change where ToC
stays open when clicking items (dismiss via click outside or Escape).
2026-02-02 16:46:56 -06:00
Pedram Amini
1b42636d9d MAESTRO: Allow tab switcher shortcut (Alt+Cmd+T) from file preview
Added isTabSwitcherShortcut to the overlay allowlist so users can
open the tab switcher modal while viewing a file preview tab.
2026-02-02 16:44:51 -06:00
Pedram Amini
21486e3a79 MAESTRO: File preview tabs don't close on Escape and skip layer registration
Tab behavior changes:
- Escape key no longer closes file tabs (only closes internal UI like
  search and TOC overlay). Use Cmd+W or close button to close tabs.
- File preview in tab mode skips layer stack registration entirely
  since tabs are main content, not overlays. This prevents tabs from
  intercepting keyboard shortcuts or participating in overlay logic.

Updated tests to verify tab-mode Escape behavior.
2026-02-02 16:43:12 -06:00
Pedram Amini
3981111a31 MAESTRO: Allow Cmd+T/W tab shortcuts from file preview
Tab management shortcuts (Cmd+T new tab, Cmd+W close tab) now work
when viewing a file preview tab. Previously these shortcuts were
blocked because file preview registers as an overlay in the layer
stack. Added these to the allowlist of shortcuts that work when
overlays (but not modals) are open.
2026-02-02 16:31:12 -06:00
Pedram Amini
dccc25663f MAESTRO: Improve Mermaid diagram theming for better visual hierarchy
Use theme colors to create vibrant, readable diagrams instead of washed-out
defaults. Nodes now have tinted backgrounds with prominent accent-colored
borders, and different node types use distinct colors (accent, success,
warning) for visual variety.

- Add blendColors() and transparentize() helpers for color mixing
- Use accent color for primary nodes, success for secondary, warning for tertiary
- Connection lines use accent color instead of dim text
- Enhanced styling for flowcharts, sequence diagrams, Gantt charts, pie charts,
  ER diagrams, git graphs, quadrant charts, and Sankey diagrams
- Better edge label backgrounds for readability
- Extended pie chart palette to 12 distinct colors
2026-02-02 16:23:58 -06:00
Pedram Amini
623436f5fd MAESTRO: Fix file preview tabs closing prematurely on click away
The issue was caused by legacy overlay behavior in FilePreview component:
- useClickOutside hook was calling onClose when clicking outside the preview
- Layer registration was blocking lower layers and capturing focus

Added isTabMode prop to FilePreview to distinguish tab-based rendering:
- When isTabMode=true: disable click-outside-to-close behavior
- When isTabMode=true: don't block lower layers or aggressively capture focus
- When isTabMode=true: set focusTrap to 'none' and allowClickOutside to true

File preview tabs now persist until explicitly closed by:
- Clicking the X button on the tab
- Using Cmd+W keyboard shortcut
- Middle-clicking the tab
- Using context menu "Close Tab"

Updated tests to verify click-outside is disabled in tab mode.
2026-02-02 16:19:05 -06:00
Pedram Amini
d4b6c8748e MAESTRO: Move System Log Level setting from Display to General tab
Relocate the log level setting to be more appropriately placed in General
settings, positioned above the GitHub CLI Path setting.
2026-02-02 16:19:05 -06:00
Pedram Amini
9c4268cfe6 MAESTRO: Fix file tab system issues and UI cleanup
- Fix new tab creation (Cmd+T) not appearing in unified tab bar by
  adding new AI tabs to unifiedTabOrder in createTab()
- Fix new AI tab not being displayed when file tab was active by
  clearing activeFileTabId in createTab()
- Fix AI tab isActive check to handle undefined activeFileTabId
  (use !activeFileTabId instead of === null)
- Remove redundant filename/path header from file tab context menu
  (info already shown in tab and file preview subheading)
- Use JavaScript toUpperCase() for extension badges instead of CSS
  text-transform to ensure DOM content matches displayed text
- Update tests to use 'Copy File Path' selector instead of removed
  file-text-icon for identifying file tab overlays
2026-02-02 16:19:05 -06:00
Pedram Amini
8061757fb9 MAESTRO: Fix file tab UI issues - border, styling, and active state
- Fix dual border issue where both AI tab and file tab showed active
  styling when file tab was selected. AI tabs now only show border when
  activeFileTabId is null.
- Update extension badge styling: remove leading dot, uppercase letters,
  smaller font (9px), reduced padding for minimal height impact.
- Update tests to expect new uppercase extension badge format (e.g.,
  'TS' instead of '.ts').
2026-02-02 16:19:05 -06:00
Pedram Amini
de1cedbd5a MAESTRO: Add file tab overlay menu with hover actions
Implements file-specific overlay menu for FileTab component:
- Add shell:showItemInFolder IPC handler for "Reveal in Finder" action
- Add showItemInFolder to shell preload API and global.d.ts types
- Extend FileTabProps with position and close action callbacks
- Implement full overlay menu with file actions:
  - Copy File Path/Name to clipboard
  - Open in Default App via file:// URL
  - Reveal in Finder via new showItemInFolder API
  - Move to First/Last Position
  - Close Tab/Other/Left/Right actions
- Add 10 tests for file tab overlay menu
- Add 3 tests for shell:showItemInFolder handler
2026-02-02 16:19:05 -06:00
Pedram Amini
74c865978e feat(tabNaming): add spinning indicator while generating tab name
- Add isGeneratingName property to AITab interface
- Show Loader2 spinner in tab while name generation is in progress
- Set isGeneratingName true before API call, false on completion/error
- Spinner only shows when automatic tab naming is enabled
2026-02-02 16:19:04 -06:00
Pedram Amini
28ce7f10c9 MAESTRO: Add unit tests for file tab close actions (Close Other, Close Left/Right) 2026-02-02 16:19:04 -06:00
Pedram Amini
454b92b22a MAESTRO: Add performance unit tests for many file tabs (10+)
Added 7 comprehensive performance-focused unit tests for the file tab system:
- Renders 15 file tabs without performance issues
- Renders 30 file tabs with mixed AI tabs (interleaved)
- Selects file tab correctly among many tabs
- Closes file tab correctly among many tabs
- Supports drag and drop reorder with many file tabs
- Renders file tabs with different extensions correctly
- Maintains active tab styling among many tabs

Verified existing performance optimizations:
- React.memo() wrapping on Tab and FileTab components
- useMemo() for computed values (display names, styles, extension colors)
- useCallback() for all event handlers
- Large file content truncation (100KB limit for syntax highlighting)
2026-02-02 16:19:04 -06:00
Pedram Amini
bc036c32de MAESTRO: Add File Preview Tab System documentation
- Add comprehensive "File Preview Tab System" section to ARCHITECTURE.md
  documenting features, interfaces, unified tab system, session fields,
  behavior, extension color mapping, and key files
- Update CLAUDE-SESSION.md with FilePreviewTab interface and session fields
- Add file preview tab modification entry to CLAUDE.md Key Files table
2026-02-02 16:19:04 -06:00
Pedram Amini
4d66cae30c MAESTRO: Add colorblind-safe extension badge colors for file tabs
Use Wong's colorblind-safe palette for file extension badges when
colorBlindMode is enabled. Colors are distinguishable across
protanopia, deuteranopia, and tritanopia color vision deficiencies.

- Add COLORBLIND_EXTENSION_PALETTE to colorblindPalettes.ts
- Update getExtensionColor() in TabBar and TabSwitcherModal
- Pass colorBlindMode through App → MainPanel → TabBar
- Add 11 unit tests for colorblind extension badge colors
2026-02-02 16:19:04 -06:00
Pedram Amini
58c6331176 MAESTRO: Add visual polish for file tab styling and theme-aware extension badges
- Fix max-width truncation inconsistency: file tabs now use max-w-[120px] to match AI tabs
- Add theme-aware hover background: dark mode (rgba(255,255,255,0.08)), light mode (rgba(0,0,0,0.06))
- Enhance getExtensionColor() with theme-aware colors for both light and dark modes:
  - TypeScript/JavaScript, Markdown, JSON, CSS, HTML with contrast-appropriate colors
  - Add support for Python (teal), Rust (red), Go (cyan), Shell (gray)
  - Unknown extensions fall back to theme border/textDim colors
- Add 10 unit tests verifying extension badge colors across themes
2026-02-02 16:19:04 -06:00
Pedram Amini
32e7d88cf9 MAESTRO: Add unit tests for same file open in multiple sessions
Verify that the file tab system correctly allows the same file to be
open in multiple sessions simultaneously. Each session maintains its
own independent file tab state (scroll position, search query, edit
mode) even when viewing the same file path.

Tests added:
- allows the same file path to be open in different sessions simultaneously
- each session maintains independent state for the same file
- sessions can have different number of tabs for the same files
2026-02-02 16:19:04 -06:00
Pedram Amini
01aa75f972 MAESTRO: Add unit tests for session switching with file tabs
- Created comprehensive SessionContext.test.tsx with 15 unit tests
- Verifies each session maintains independent file preview tabs
- Tests session switching updates visible file tabs correctly
- Verifies switching back restores scroll position, search query, edit mode
- Tests active file tab ID is tracked per-session
- Verifies rapid session switching preserves state
2026-02-02 16:19:04 -06:00
Pedram Amini
a66e10e3ba MAESTRO: Add unit tests for file preview tab persistence
Added 15 comprehensive tests to verify file preview tabs are properly
persisted with all their state including:
- Full file tab state (path, content, scrollTop, searchQuery)
- Scroll positions up to 150,000 pixels
- Search queries in file tabs
- Edit mode and unsaved content
- activeFileTabId preservation
- Multiple file tabs per session
- File tabs across multiple sessions
- Unified tab order with mixed AI and file tabs
- Edge cases: empty arrays, undefined tabs, SSH remote metadata
2026-02-02 16:19:03 -06:00
Pedram Amini
6632665cc8 MAESTRO: Add unit tests for SSH file loading spinner in MainPanel
Verify that file preview loading state works for SSH remote files:
- Loading spinner displays when file tab has isLoading: true
- FilePreview renders correctly when isLoading: false
- Loading state works for local files (brief loading states)
- Loading state not shown when AI tab is active

Tests confirm the implementation shows "Loading {filename}" with
"Fetching from remote server..." subtitle while SSH files load.
2026-02-02 16:19:03 -06:00
Pedram Amini
33443a9861 MAESTRO: Remove X close button from FilePreview control panel
The file tab system now handles closing via the tab's X button,
making the close button in the FilePreview header redundant.

- Removed X icon import (no longer needed)
- Removed showCloseButton prop from FilePreviewProps interface
- Removed close button JSX from FilePreview header
- Removed showCloseButton={false} prop from MainPanel.tsx
- Updated FilePreview tests (removed close button tests)

Note: onClose prop remains for Escape key handling and unsaved
changes modal confirmation.
2026-02-02 16:19:03 -06:00
Pedram Amini
7055bec2b2 MAESTRO: Remove legacy previewFile state - file preview now uses tab system
The previewFile state was a legacy mechanism for the file preview overlay.
Now that files open in tabs (session.filePreviewTabs), this state is dead
code. This commit removes it and all its references:

- Removed previewFile/setPreviewFile from UILayoutContext
- Updated App.tsx to use activeSession.activeFileTabId/activeFileTab
- Removed legacy file preview rendering block from MainPanel.tsx
- Updated useAppHandlers.ts to remove legacy overlay code path
- Updated props hooks (useMainPanelProps, useRightPanelProps)
- Updated FileExplorerPanel to use activeFileTabId for selection
- Updated keyboard handler to check activeFileTabId instead
- Updated/removed tests for legacy previewFile behavior
2026-02-02 16:19:03 -06:00
Pedram Amini
7b4c149430 MAESTRO: Update FileExplorerPanel to highlight files open in tabs
The file selection highlighting in FileExplorerPanel now correctly shows
files that are open in file preview tabs, not just the legacy previewFile
overlay. This ensures the file tree highlights the currently active file
when using the new tab-based file preview system.
2026-02-02 16:19:03 -06:00
Pedram Amini
1711ceb6c3 MAESTRO: Update DocumentGraph file node clicks to open tabs
Migrated the onDocumentOpen callback in DocumentGraphView from the
legacy setPreviewFile overlay system to use handleOpenFileTab for
tab-based file preview. The implementation now:

1. Fetches content and stat in parallel for efficiency
2. Opens file in a tab (or selects existing tab if already open)
3. Provides lastModified timestamp for file info display
4. Properly handles SSH remote execution

All 615 DocumentGraph tests and 370 tab-related tests pass.
2026-02-02 16:19:03 -06:00
Pedram Amini
1228c6391d MAESTRO: Update file preview history navigation to use file tabs
Update handleNavigateBack, handleNavigateForward, and handleNavigateToIndex
handlers to use handleOpenFileTab instead of the legacy setPreviewFile overlay.

Each handler now:
- Updates the filePreviewHistoryIndex for state tracking
- Calls handleOpenFileTab which selects an existing tab or creates a new one
- Has proper dependency array including handleOpenFileTab
2026-02-02 16:19:03 -06:00