Commit Graph

2489 Commits

Author SHA1 Message Date
Pedram Amini
19e55218a5 MAESTRO: Extend Cmd+Shift+T to reopen both AI and file tabs
Add unified closed tab history system that tracks both AI and file
preview tabs, enabling Cmd+Shift+T to restore any recently closed tab:

- Add ClosedTabEntry discriminated union type for AI/file tabs
- Add unifiedClosedTabHistory to Session (runtime-only, not persisted)
- Add closeFileTab() function with unified history support
- Add addAiTabToUnifiedHistory() for AI tab close tracking
- Add reopenUnifiedClosedTab() with duplicate detection for both types
- Update closeTab() to also update unifiedTabOrder
- Update forceCloseFileTab() to use helper and add to history
- Update performTabClose() to track AI tabs in unified history
- Add comprehensive test coverage (12 new tests)
2026-02-02 16:19:02 -06:00
Pedram Amini
7014c8df66 MAESTRO: Add unified tab navigation for Cmd+1-9 shortcuts
Update keyboard shortcuts to navigate through unified tab order
(both AI and file tabs) instead of just AI tabs:

- Add navigateToUnifiedTabByIndex() for Cmd+1-9 tab jumping
- Add navigateToLastUnifiedTab() for Cmd+0 (last tab)
- Functions handle AI tabs (clear activeFileTabId) and file tabs
  (preserve activeTabId for easy switching back)
- Update useMainKeyboardHandler to use new unified functions
- Add comprehensive test coverage (18 new tests)
2026-02-02 16:19:02 -06:00
Pedram Amini
92fca4114f MAESTRO: Add search state persistence for file tabs
- Add initialSearchQuery and onSearchQueryChange props to FilePreview
- Auto-open search panel when initialSearchQuery is provided and non-empty
- Add handleFileTabSearchQueryChange handler in App.tsx
- Wire search state through useMainPanelProps and MainPanel
- Add 4 tests for search state persistence in FilePreview.test.tsx
2026-02-02 16:19:01 -06:00
Pedram Amini
f6dd4776d2 MAESTRO: Add scroll position persistence for file tabs
- Added initialScrollTop and onScrollPositionChange props to FilePreview
- Implemented throttled scroll position reporting (200ms) in content scroll handler
- Added scroll position restoration with requestAnimationFrame for DOM readiness
- Created handleFileTabScrollPositionChange handler in App.tsx
- Wired handler through useMainPanelProps to MainPanel
- Added 4 tests for scroll position persistence behavior
2026-02-02 16:19:01 -06:00
Pedram Amini
dff28cdfbb MAESTRO: Add unsaved changes warning for file tab close
- Renamed handleCloseFileTab to forceCloseFileTab (performs unconditional close)
- Added new handleCloseFileTab wrapper that checks for unsaved changes
- When tab.editContent !== undefined, shows confirmation modal before closing
- Uses existing showConfirmation pattern with setConfirmModal* state
- Modal displays: "<filename>" has unsaved changes. Are you sure you want to close it?
- On confirm, calls forceCloseFileTab to perform actual close
2026-02-02 16:19:01 -06:00
Pedram Amini
2b3c8745bc MAESTRO: Add file tab content refresh with mtime tracking
- Add `lastModified: number` field to FilePreviewTab interface to track
  when content was loaded from disk
- Add `fileTabAutoRefreshEnabled` setting (default: disabled) to control
  whether file tabs auto-refresh when switched to
- Update handleOpenFileTab to accept and store lastModified
- Update handleOpenFileTabAsync to fetch file stat and set lastModified
  from the file's actual modification time
- Modify handleSelectFileTab to check if file changed on disk when
  auto-refresh is enabled:
  - Compares current file mtime with stored lastModified
  - Refreshes content if file was modified since last load
  - Skips refresh if tab has unsaved edits to prevent data loss
- Update all FilePreviewTab test fixtures with lastModified field
2026-02-02 16:19:01 -06:00
Pedram Amini
fd9f419251 MAESTRO: Add file tab content management with SSH loading state support
- Fix MainPanel to use activeFileTab.content as source (was using empty editContent)
- Add sshRemoteId and isLoading fields to FilePreviewTab interface
- Update handleOpenFileTab to accept optional sshRemoteId parameter
- Add handleOpenFileTabAsync for SSH files with async loading:
  - Creates tab immediately with loading state
  - Fetches content asynchronously
  - Updates tab when content loaded (or removes on error)
- Add loading state UI in MainPanel for file tabs
- Add tests for file tab content storage and SSH loading support

This enables proper file content management for the unified tab system,
with support for SSH remote files that need async loading.
2026-02-02 16:19:01 -06:00
Pedram Amini
833e1e11cb MAESTRO: Add content field to FilePreviewTab for direct file storage
Store file content directly on FilePreviewTab (Option A) for simplicity.
File previews are typically small, and we already store larger AI logs.
Updated handleOpenFileTab to populate content when opening file tabs.
2026-02-02 16:19:01 -06:00
Pedram Amini
93d041a7f0 MAESTRO: Integrate unified tab system into MainPanel
Connect FilePreviewTab rendering to the unified tab system:
- Add unified tab props to MainPanel (unifiedTabs, activeFileTabId, etc.)
- Remove !previewFile condition so TabBar always renders in AI mode
- Update content area to prioritize activeFileTabId over legacy previewFile
- Add showCloseButton prop to FilePreview (false when rendered as tab)
- Add activeFileTab computation in App.tsx
- Connect handlers through useMainPanelProps hook
2026-02-02 16:19:01 -06:00
Pedram Amini
e7960ad3b2 MAESTRO: Add comprehensive middle-click tests for file tabs
- Verified FileTab's handleMouseDown correctly handles button === 1 (middle-click)
- Added test: left-click does NOT close file tab
- Added test: right-click does NOT close file tab
- Added test: middle-click on AI tab still works in unified mode
- All 115 TabBar tests pass
2026-02-02 16:19:00 -06:00
Pedram Amini
f414bf4dd9 MAESTRO: Add tests for unified tab active styling consistency
Verify that both AI tabs and file tabs use identical active indicator
styling (bright background connecting to content area). The visual
difference is correctly the extension badge, not the active state.

Added 3 tests:
- applies same active styling to both AI tabs and file tabs
- applies same inactive styling to both AI tabs and file tabs
- file tab displays extension badge with file extension text
2026-02-02 16:19:00 -06:00
Pedram Amini
8e9aae9e57 MAESTRO: Add unified tabs drag-and-drop tests
Add 12 comprehensive tests for unified tabs drag-and-drop reordering:
- AI tab to file tab drag-and-drop calls onUnifiedTabReorder
- File tab to AI tab drag-and-drop calls onUnifiedTabReorder
- File tab to file tab drag-and-drop works correctly
- Dropping on same tab does not trigger reorder
- Drag over visual feedback (ring-2 class) on target tab
- Falls back to legacy onTabReorder when unifiedTabs not provided
- Move to First/Last shown for file tabs not at edges
- Move to First hidden for first tab
- Move to Last hidden for last tab
- Move to First click calls onUnifiedTabReorder
- Move to Last click calls onUnifiedTabReorder
- Middle-click closes file tabs
2026-02-02 16:19:00 -06:00
Pedram Amini
53aeda4920 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:00 -06:00
Pedram Amini
495ed0f60f MAESTRO: Update TabBar render loop to iterate over unified tabs
- Add displayedUnifiedTabs computed value with unread filter support
- Update render loop to conditionally render from unified tabs when provided
- Check unified tab type to render either Tab (AI) or FileTab (file)
- Update handleDrop, handleMoveToFirst, handleMoveToLast for unified tabs
- Update overflow check and empty state to consider unified tabs
- Maintain backwards compatibility with legacy AI-only tab rendering
2026-02-02 16:18:39 -06:00
Pedram Amini
d7004d6101 MAESTRO: Add note for future FileTab extension badge tests
Verified that the FileTab extension badge implementation is complete:
- Positioned after filename
- 10px font size (text-[10px])
- Rounded corners (rounded class)
- Color-coding by file type via getExtensionColor() helper
- Tests to be added after Task 4 (unified tab rendering) is complete
2026-02-02 16:18:39 -06:00
Pedram Amini
61a978b774 MAESTRO: Add FileTab sub-component for file preview tabs
- Create FileTabProps interface with file tab specific props
- Implement FileTab memoized component with:
  - Filename without extension as label
  - Color-coded extension badge (blue for TS/JS, green for MD, etc.)
  - Unsaved edits indicator (pencil icon)
  - Middle-click to close support
  - Drag and drop handlers
  - Same active/inactive styling as AI tabs
- Add getExtensionColor() helper for extension badge coloring
2026-02-02 16:18:39 -06:00
Pedram Amini
c533e8826c MAESTRO: Add unified tab system props to TabBar interface
- Add UnifiedTab discriminated union type to types/index.ts
- Add new props to TabBarProps: unifiedTabs, activeFileTabId,
  onFileTabSelect, onFileTabClose
- Props are optional for backwards compatibility during transition
- Phase 3 of file preview tabs implementation
2026-02-02 16:18:38 -06:00
Pedram Amini
3c6cf91ffa MAESTRO: Add handleCloseCurrentTab function for Cmd+W with unified tab support
Implements handleCloseCurrentTab that:
- Determines which tab is active (file tab via activeFileTabId first, then AI tab via activeTabId)
- Closes file tabs immediately without wizard confirmation
- For AI tabs, returns info to allow keyboard handler to show wizard confirmation
- Prevents closing the last AI tab (keeps at least one AI tab)

Updated keyboard handler (Cmd+W) to use handleCloseCurrentTab for unified tab support.
2026-02-02 16:18:38 -06:00
Pedram Amini
43518623fe MAESTRO: Update bulk close tab handlers to work with unified tabs
Updated handleCloseOtherTabs, handleCloseTabsLeft, and handleCloseTabsRight
to support both AI and file preview tabs based on unifiedTabOrder position:

- Determine active tab from activeFileTabId or activeTabId
- Use unifiedTabOrder to determine which tabs are left/right/other
- Close AI tabs using closeTab helper (with wizard history handling)
- Close file tabs by removing from filePreviewTabs and unifiedTabOrder
2026-02-02 16:18:38 -06:00
Pedram Amini
7c06afa405 MAESTRO: Add handleUnifiedTabReorder function for unified tab reordering
Implements unified tab reorder functionality that operates on the
unifiedTabOrder array, allowing both AI and file preview tabs to be
reordered relative to each other. This supplements the existing
handleTabReorder (AI-only) for the unified tab system.

Changes:
- Added handleUnifiedTabReorder in App.tsx with index validation
- Propagated through useMainPanelProps.ts, MainPanel.tsx, TabBar.tsx
2026-02-02 16:18:38 -06:00
Pedram Amini
115d9a042b MAESTRO: Clear activeFileTabId when selecting an AI tab
Modify setActiveTab function to deselect any active file preview tab
when an AI tab is selected. This ensures only one tab type (AI or file)
is active at a time. Updated early-return condition to also check if
activeFileTabId is null before returning unchanged session.
2026-02-02 16:18:38 -06:00
Pedram Amini
850cfdd109 MAESTRO: Add handleSelectFileTab function for file preview tabs
Adds handleSelectFileTab handler that sets the activeFileTabId to select a file preview tab. The activeTabId is preserved (not nullified) following the established pattern from handleOpenFileTab, which tracks the last active AI tab for when the user switches back.
2026-02-02 16:18:38 -06:00
Pedram Amini
72c60d911a MAESTRO: Add handleCloseFileTab function for closing file preview tabs 2026-02-02 16:18:38 -06:00
Pedram Amini
1856bd4557 MAESTRO: Add handleOpenFileTab function for file preview tabs
Implements the handler to open file preview tabs in the unified tab system:
- Checks if a tab with the same file path already exists and selects it
- Creates new FilePreviewTab with proper extension parsing
- Adds tab to both filePreviewTabs and unifiedTabOrder arrays
- Sets activeFileTabId to activate the new file tab
2026-02-02 16:18:37 -06:00
Pedram Amini
6f472a4de1 MAESTRO: Add unifiedTabs useMemo for unified tab system
Creates a memoized unifiedTabs array that combines aiTabs and
filePreviewTabs according to the session's unifiedTabOrder. Uses
a discriminated union type to allow components to render the
appropriate content for each tab type (AI or file preview).
2026-02-02 16:18:37 -06:00
Pedram Amini
942a9c0568 MAESTRO: Add FilePreviewTab type and unified tab system foundation
Phase 1 of file preview tabs feature:
- Add FilePreviewTab interface with id, path, name, extension, scrollTop,
  searchQuery, editMode, editContent, and createdAt fields
- Add UnifiedTabRef type for tab ordering across types
- Add filePreviewTabs, activeFileTabId, and unifiedTabOrder to Session
- Update all 13 session creation locations with new fields
- Update session restoration to hydrate new fields from persistence

This establishes the data model for coexisting AI tabs, file preview tabs,
and future terminal tabs in a unified tab bar.
2026-02-02 16:18:37 -06:00
Pedram Amini
04843b89f6 fix(symphony): make PR link clickable in claimed issue cards
Changed IssueCard from <button disabled> to <div role="button"> to allow
nested PR link button to receive click events. Disabled buttons block all
pointer events on children, even with pointerEvents: 'auto' style.

- Outer container is now a div with role="button" and manual keyboard handling
- PR link is now a proper <button> that can receive clicks independently
- Maintains same visual styling (opacity-60 for unavailable issues)
- Keyboard navigation preserved via tabIndex and onKeyDown
2026-02-02 08:18:50 -06:00
Pedram Amini
56ab021b33 ## CHANGES
- Moderator @mentions now normalize names (spaces→hyphens) for reliability 🧭
- Participant and available-session lists now show mention-ready normalized handles 👥
- Header responsiveness tuned for AUTO mode’s extra button width 📐
- Session name now hides on ultra-narrow panels to save space 🪟
- Git branch icon won’t shrink; branch text truncates cleanly ✂️
- Symphony issue PR link upgraded from span to proper button 🧷
- PR link click handling simplified; keyboard hacks removed for cleaner UX ⌨️
- Batch TTS settings now use refs to avoid stale closures mid-run 🎙️
- Audio feedback toggles take effect immediately during batch processing 
- Batch processor deps slimmed since audio settings are ref-driven 🧼
2026-02-02 08:03:39 -06:00
Pedram Amini
a7ca32f8c7 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 03:11:19 -06:00
Pedram Amini
38925cc627 feat(settings): move font/terminal/log settings to Display panel
Moved additional visual/output settings from General to Display:
- Interface font family and size
- Terminal width (columns)
- System log level and max buffer

Updated tests and docs to reflect new Display tab location.
2026-02-02 03:04:59 -06:00
Pedram Amini
dbf87ca760 feat(batchRunner): add unsaved changes confirmation on close
When closing the Auto Run Configuration modal, show a confirmation
dialog if there are unsaved changes to:
- Document list (documents added or removed)
- Loop settings (enabled/disabled, max loops)
- Agent prompt (edited from initial value)

If no changes were made, the modal closes immediately without
confirmation.

This prevents accidental loss of configuration when users press
Escape, click Cancel, or click the X button.
2026-02-02 02:55:55 -06:00
Pedram Amini
341fe0fdd6 test(modalPriorities): add tests for modal priority hierarchy
Add comprehensive test suite to verify modal priority ordering:
- Child modals must have higher priority than parents (30 test cases)
- Ensures DocumentSelectorModal closes before BatchRunner
- Ensures MarketplaceModal closes before BatchRunner/AutoRunExpanded
- Verifies confirmation dialogs are 1000+, overlays are lower priority
- Tests priority ranges match documented conventions

These tests will catch future regressions where child modals have
incorrect priorities, causing Escape to close parent modals first.
2026-02-02 02:52:07 -06:00
Pedram Amini
6a913b9b04 feat(settings): add Display panel for output/visual settings
Split General settings panel by creating new Display tab containing:
- Max output lines per response
- Document graph settings (external links, max nodes)
- Context window warnings (thresholds)

Updated docs to reflect new panel location.
2026-02-02 02:49:15 -06:00
Pedram Amini
dd340da30f feat(tabs): add automatic tab naming based on first message
When a new session starts and the first message is sent, Maestro now
automatically generates a descriptive tab name based on the user's
request. This runs in parallel with the main prompt processing and
uses the same AI agent (honoring SSH remote configurations).

Implementation:
- Add tab naming prompt at src/prompts/tab-naming.md
- Add IPC handler (tabNaming:generateTabName) that spawns ephemeral
  session to generate names with 30s timeout
- Integrate with onSessionId callback to trigger naming for new tabs
- Only update name if tab is still in UUID format (user hasn't renamed)
- Add automaticTabNamingEnabled setting (default: true)
- Add Settings UI checkbox under General section

Tab names are 2-5 words, Title Case, and capture the specific intent
rather than generic descriptions. Examples:
- "Help me implement JWT auth" → "JWT Auth Implementation"
- "Fix the checkout bug" → "Checkout Bug Fix"

Tests: 22 new tests covering IPC handler, settings, and edge cases
Docs: Updated general-usage.md, features.md, and configuration.md
2026-02-02 02:40:13 -06:00
Pedram Amini
2f945ec032 fix(ui): truncate document paths from left to show filename
Apply RTL text direction with LTR text isolation to show the rightmost
(filename) portion of document paths when truncated, while maintaining
full path on hover via title attribute.

Updated components:
- DocumentsPanel: Auto Run document list entries
- RightPanel: Auto Run progress indicator (single and multi-doc views)
2026-02-02 02:34:10 -06:00
Pedram Amini
a23cb425c3 fix(lightbox): sync lightboxImages state when deleting staged images
When opening the lightbox from staged images, a snapshot of stagedImages
was saved to lightboxImages. The LightboxModal used this snapshot for
navigation. When deleting an image, only stagedImages was updated but
lightboxImages remained stale, causing the deleted image to still appear.

Fix: Update both stagedImages AND lightboxImages in handleDeleteLightboxImage.

Added regression tests that simulate the parent state synchronization
pattern and verify both states are updated on deletion.
2026-02-02 02:29:18 -06:00
Pedram Amini
9c30233549 fix(ui): hamburger menu scrolls when insufficient vertical height
Add overflow-y-auto and max-h-[calc(100vh-120px)] to hamburger menu
dropdown containers so content can scroll when the viewport doesn't
have enough vertical space to display all menu items.

Applied to both expanded and collapsed sidebar menu overlays.
2026-02-02 01:59:21 -06:00
Pedram Amini
44c31627a4 ## CHANGES
- Stabilized group-chat integration tests by mocking Electron `app.getPath()` 🧪
- Added preload filesystem support to write files on SSH remotes 🚀
- Expanded `fs:writeFile` IPC signature to include optional remote identifier 🔌
2026-02-02 01:07:26 -06:00
Pedram Amini
51ab205d9b fix(tests): clear mock between tests in slash commands suite
The useInputProcessing test for "preserves multi-word arguments with
spaces" was failing because mockProcessQueuedItemRef.current accumulated
calls across tests in the nested describe block. Added a beforeEach to
explicitly clear the mock, ensuring mock.calls[0] always references the
current test's call.
2026-02-02 01:02:00 -06:00
Pedram Amini
8f6dd60386 feat(prompts): add response completeness guidance to system prompt
Adds a "Response Completeness" section to the Maestro system prompt
instructing agents to make each response self-contained with clear
summaries, relevant context, and key details. This ensures users can
understand responses even when only seeing the most recent message.
2026-02-02 00:32:42 -06:00
Pedram Amini
11a35c60cf Revert "feat(prompts): emphasize last message completeness in all agent prompts"
This reverts commit ba5641c19e.
2026-02-02 00:31:36 -06:00
Pedram Amini
ba5641c19e feat(prompts): emphasize last message completeness in all agent prompts
Updated all agent prompts to explicitly state that only the LAST
message is captured by the system. This ensures agents produce
complete, self-contained responses with all relevant information.

Prompts updated:
- context-grooming.md, context-summarize.md, context-transfer.md
- autorun-default.md, autorun-synopsis.md
- group-chat-participant.md, group-chat-participant-request.md
- group-chat-moderator-system.md, group-chat-moderator-synthesis.md
- maestro-system-prompt.md (new "Response Completeness" section)
2026-02-02 00:29:54 -06:00
Pedram Amini
bf86974290 feat(save-markdown): add SSH remote filesystem support
Enable saving markdown content directly to remote filesystems
when connected via SSH. The fs:writeFile IPC handler now accepts
an optional sshRemoteId parameter and uses writeFileRemote for
SSH transport.
2026-02-01 23:48:10 -06:00
Pedram Amini
7c19aec1ce test(save-markdown-modal): add comprehensive test suite
34 test cases covering:
- Basic rendering and form elements
- SSH remote session behavior (folder browse button visibility)
- Folder browser dialog interactions
- Form validation (disabled state, required fields)
- Save functionality (path construction, .md extension handling)
- Keyboard interaction (Enter to save)
- Error handling and error clearing
- Focus behavior on mount
2026-02-01 23:39:23 -06:00
Pedram Amini
988db778a7 fix(save-markdown-modal): hide folder browse button for SSH sessions
The native folder dialog can only browse local filesystems, so hide the
browse button when the session is running over SSH (where the default
path would be a remote path). Users can still manually type a path.
2026-02-01 23:37:19 -06:00
Pedram Amini
2c2fa91d1f fix(main-panel): open ORIGIN link in system browser
Changed the git info popup's remote URL link to use
window.maestro.shell.openExternal() instead of window.open()
so it opens in the user's default system browser.
2026-02-01 23:21:53 -06:00
Pedram Amini
25b6545ab8 fix(quick-actions): improve Open Repository in Browser error handling
- Add await to shell.openExternal call to ensure proper async handling
- Show toast notification when no remote URL is found for the repository
- Add error handling with toast feedback for any failures
- Update tests to verify toast notifications are shown on error

Fixes issue where the command didn't provide feedback when failing.
2026-02-01 23:19:04 -06:00
Pedram Amini
65af8a23c7 fix(notifications): skip custom notification for synopsis messages
Custom notification commands (e.g., TTS, fabric pipelines) should only
run for regular AI conversation flow toasts, not for synopsis messages.

Added skipCustomNotification flag to Toast interface and set it to true
for synopsis toasts. This prevents the notification command from being
executed when a synopsis completes, while still showing OS notifications
and toast UI.
2026-02-01 23:09:04 -06:00
Pedram Amini
13f68c15a7 fix(document-graph): truncate long text lines in document nodes
Document nodes with long unbroken text (like separator lines with ====)
were bleeding outside their boundaries. Fixed by:
- Setting fixed width (280px) on container instead of just maxWidth
- Using break-all word breaking for description text
- Adding webkit line clamping to limit description to 3 lines
- Using text-overflow: ellipsis with overflow: hidden
2026-02-01 22:59:23 -06:00
Pedram Amini
9dbb2419b6 feat(left-bar): add drop zone for ungrouping when all sessions are in groups
- Shows "Drop here to ungroup" zone when dragging a session and no ungrouped sessions exist
- Allows users to drag sessions out of groups even when Ungrouped Agents folder is hidden
- Added tests for drop zone visibility and drop handler
2026-02-01 22:46:01 -06:00