Commit Graph

2202 Commits

Author SHA1 Message Date
Pedram Amini
a7f5ebf824 - Added main-process GitHub document fetching to bypass pesky CORS limits 🚀
- Exposed `fetchDocumentContent` through preload + typed Maestro API bridge 🔌
- Symphony issue docs now auto-preview first attachment when selected 
- Replaced document tabs with a cleaner dropdown document selector 🧭
- Added Cmd/Ctrl+Shift+[ / ] shortcuts to cycle preview documents ⌨️
- Markdown previews now use centralized prose styling + custom components 📝
- External links in markdown open safely via system browser integration 🌐
- Improved Symphony UI theming: consistent backgrounds, borders, and scroll layout 🎨
- Updated Marketplace left sidebar width to match Symphony layout guidance 📐
- Registry refreshed: Maestro now “AI agents” focused and recategorized 🏷️
2026-01-22 12:29:02 -06:00
Pedram Amini
5da6247fae - Auto Run docs now support repo paths *and* GitHub attachment links 📎
- Introduced `DocumentReference` objects with name, path, and external flag 🧩
- Smarter issue parsing extracts markdown `.md` links into downloadable docs 🔍
- Dedupes documents by filename, preferring external attachments when present 🧠
- Added 1MB issue-body parsing cap to prevent performance blowups 🚧
- Path traversal checks now apply only to repo-relative document references 🛡️
- Auto Run Docs setup can download external files directly via `fetch` 🌐
- Switched runner file ops to Node `fs`, replacing shell `cp/rm` usage 🧰
- Runner now configures git user.name/email to ensure commits always work 🪪
- Failure paths now clean up local repos automatically to reduce clutter 🧹
- History virtualization now measures elements directly for more accurate sizing 📏
- Marketplace and Symphony modals widened for a roomier workflow view 🖥️
2026-01-22 12:28:57 -06:00
Pedram Amini
7bd1c51c05 fix(symphony): Address security and error handling issues from PR review
- Add path traversal prevention: sanitize repo names, validate document paths
- Add GitHub URL validation (HTTPS only, github.com only)
- Add repository slug format validation
- Add gh CLI authentication check before PR operations
- Add default branch detection instead of hardcoded 'main'
- Add remote branch cleanup on PR creation failure
- Fix ReDoS vulnerability in document path regex patterns
- Improve error logging throughout handlers
2026-01-22 12:28:35 -06:00
Pedram Amini
0423a26e66 MAESTRO: Complete Symphony Phase 6 - Registry & GitHub Integration
Add Symphony registry documentation and contribution runner service:
- docs/SYMPHONY_REGISTRY.md: Registry documentation explaining how maintainers register repos
- docs/SYMPHONY_ISSUES.md: Guide for creating Symphony issues with Auto Run documents
- src/main/services/symphony-runner.ts: Service orchestrating contributions with draft PR claiming
- symphony-registry.json: Sample registry with Maestro as the first registered project

The runner service handles the full contribution flow: clone, branch, push, draft PR creation, Auto Run setup, finalization, and cancellation.
2026-01-22 12:28:35 -06:00
Pedram Amini
c75f6f1551 MAESTRO: Complete Symphony Phase 5 - App Integration & Entry Points
Implements all Symphony modal entry points and app integration:

- Add keyboard shortcut ⌘⇧Y to open Symphony modal (shortcuts.ts)
- Add handler in useMainKeyboardHandler.ts using ModalContext pattern
- Integrate SymphonyModal into App.tsx with contribution started handler
- Add Symphony to Cmd+K command palette (QuickActionsModal.tsx)
- Add Symphony to hamburger menu (SessionList.tsx)
- Add symphonyMetadata to Session type for contribution tracking
- Add IPC handlers: symphony:cloneRepo and symphony:startContribution
- Add preload bindings and TypeScript types for Symphony session API
- Wire up contribution event listener to update session state with PR info

The optional Symphony session group feature was skipped - sessions work
without a dedicated group and can be organized manually if needed.
2026-01-22 12:28:35 -06:00
Pedram Amini
6b7f605aff MAESTRO: Add Symphony UI components for Phase 4 implementation
- Create SymphonyModal.tsx with Projects, Active, History, Stats tabs
- Create AgentCreationDialog.tsx for AI provider selection
- Add SYMPHONY and SYMPHONY_AGENT_CREATION modal priorities
2026-01-22 12:26:43 -06:00
Pedram Amini
89a72ffa3f MAESTRO: Add Symphony React hooks for Phase 3 implementation
- useSymphony: Primary hook for registry, issues, and contribution management
- useContribution: Single contribution state and action management
- useContributorStats: Stats and achievements tracking with formatted display
- index.ts: Central exports for all Symphony hooks

Hooks follow established patterns from useMarketplace and Usage Dashboard,
including debounced real-time updates, proper undefined handling for IPC
responses, and type-safe integration with the symphony IPC handlers.
2026-01-22 12:26:24 -06:00
Pedram Amini
0e8c6cd2df MAESTRO: Add Symphony IPC handlers for token donation feature
Implements Phase 2 of Symphony feature with:
- New symphony.ts handler file with registry fetching, issue management,
  contribution lifecycle (start/update/complete/cancel), and caching
- Handler registration in index.ts
- Preload API exposure for renderer access
- TypeScript declarations in global.d.ts

Handlers include:
- symphony:getRegistry - Fetch/cache Symphony registry
- symphony:getIssues - Fetch GitHub issues with runmaestro.ai label
- symphony:getState/getActive/getCompleted/getStats - State queries
- symphony:start/updateStatus/complete/cancel - Contribution lifecycle
- symphony:clearCache - Cache management
- symphony:updated - Real-time event broadcasting
2026-01-22 12:26:24 -06:00
Kayvan Sylvan
2667cbdd77 Developer Experience Improvements (multi-worktree simultaneous development) (#209)
* docs: add git hash display and configurable dev server port

## CHANGES

- Add `VITE_PORT` env variable to configure dev server port
- Display git commit hash in About modal next to version
- Add `__GIT_HASH__` build-time constant to both Vite configs
- Document running multiple Maestro instances with git worktrees
- Update CONTRIBUTING.md with parallel development instructions

* feat: add configurable ports for dev servers

- Allow VITE_PORT to configure main dev server port
- Update main window to load from configurable port
- Enable VITE_WEB_PORT for web interface dev server
- Add note in CONTRIBUTING.md about port configuration
- Log port usage in development mode

* docs: update CONTRIBUTING.md section and fix React DevTools script initialization

## CHANGES

- Rename "Linting" section to "Linting & Pre-commit Hooks" in table of contents
- Move script variable declaration outside conditional block
- Fix React DevTools script initialization order in index.html

* chore: update `.vscode/settings.json` with new markdownlint config

* fix: disable biome linting. Project uses ESLint

* chore: Update baseline-browser-mapping (>2 months old, warning message on "npm run build:web")

* chore: add .vscode/ to gitignore

* chore: fix gitignore to ignore .cscode/* files properly

* fix

* chore: stop tracking .vscode/ files, respect gitignore

Co-Authored-By: Claude Sonnet 4.5 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 4.5 (1M context) <noreply@anthropic.com>
2026-01-22 12:14:48 -06:00
Kayvan Sylvan
5778a5b34b feat: add local playbook support for marketplace import and display (#216)
- Add merged manifest lookup for local playbook imports
- Read local manifest and merge with official during import
- Display "Local" badge for custom playbooks in marketplace UI
- Add source badge in playbook detail view sidebar
- Support filesystem paths (absolute and tilde) for local playbooks
- Add comprehensive tests for local playbook import scenarios
- Add tests for merged manifest lookup and source tagging
- Fix mock file reads to handle local manifest ENOENT cases
2026-01-22 10:32:03 -06:00
Pedram Amini
30868daa0d - Added per-session daily stats aggregation for richer usage analytics 📊
- Agent Usage chart now tracks Maestro sessions, not providers 🎯
- Map session IDs to friendly names in charts and legends 🏷️
- Limit Agent Usage chart to top 10 sessions by queries 🔟
- Toggle Agent Usage chart between query counts and time metrics ⏱️
- Auto Run queries now record stats with accurate `source: auto` 🤖
- Interactive queries detect Auto Run state to tag stats correctly 🧠
- Smarter cumulative token normalization avoids inflated first-event context % 🛡️
- About modal shows dev commit hash alongside app version 🔍
- Group chat history summaries now strip markdown for cleaner reading 🧹
2026-01-22 10:24:25 -06:00
Raza Rauf
8a6faf7836 Merge pull request #224 from pedramamini/code-refactor
refactor: modularize preload.ts into domain-specific modules with tests
2026-01-22 10:02:09 -06:00
Raza Rauf
57940c28f2 fix: address PR review feedback for preload refactoring
- Replace any[] with proper types in settings.ts (StoredSession, Group).
- Replace console.log with logger service in process.ts.
- Add consistent debug logging across remote IPC handlers.
2026-01-22 20:57:21 +05:00
Raza Rauf
1c2a8101ee refactor: modularize preload.ts into domain-specific modules with tests 2026-01-22 20:33:55 +05:00
Raza Rauf
7749fa5251 Merge pull request #222 from pedramamini/code-refactor
refactor: extract leaderboard and notification handlers from main/index.ts
2026-01-21 12:48:39 -06:00
Raza Rauf
888b53c718 fix: harden TTS and leaderboard handlers against security vulnerabilities
Security fixes:
- Add TTS command whitelist validation to prevent command injection
- Change spawn() to use shell: false for TTS execution
- Add 30-second fetch timeout to all leaderboard API calls
- Add TTS queue size limit (max 10) to prevent memory exhaustion

Test coverage:
- 25+ security tests for TTS command validation
- Timeout tests for all 6 leaderboard handlers
- Queue size limit tests
2026-01-21 23:37:16 +05:00
Raza Rauf
26a2af2182 fix: address PR review feedback for notification handlers
- Remove all console.log/console.error statements in favor of logger
- Fix potential race condition in TTS queue by setting isTtsProcessing
  flag before checking queue length
- Add comprehensive JSDoc comment explaining TTS_MIN_DELAY_MS (15s) rationale
- Fix type guard for stdin error handling with proper type checks
2026-01-21 23:15:25 +05:00
Raza Rauf
8ef8bba615 refactor: extract leaderboard and notification handlers from main/index.ts 2026-01-21 23:04:30 +05:00
Raza Rauf
a7b0f9af20 Merge pull request #220 from pedramamini/code-refactor
refactor: extract filesystem, attachments, and web handlers from main/index.ts
2026-01-21 20:05:35 +05:00
Raza Rauf
233863aa7f docs: document why registerWebHandlers is called separately
Add JSDoc comment explaining that web handlers require access to
module-level webServer state with getter/setter functions for proper
lifecycle management, which is why they are registered separately
in main/index.ts rather than through registerAllHandlers().

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 04:33:13 +05:00
Raza Rauf
ec5726aab5 fix: address PR review feedback
- Add path traversal protection in attachments handlers using path.basename()
- Extract IMAGE_EXTENSIONS constant in filesystem.ts to avoid duplication
- Extract SERVER_STARTUP_TIMEOUT_MS and SERVER_STARTUP_POLL_INTERVAL_MS constants in web.ts
- Add proper AITabData type for aiTabs parameter in web:broadcastTabsChange handler
2026-01-21 04:12:44 +05:00
Raza Rauf
3a8155368a chore: add debug logging to web:broadcastUserInput handler
Add debug logging to help diagnose web broadcast issues. Logs webServer
existence and client count when broadcastUserInput is called.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 03:36:18 +05:00
Raza Rauf
b1b8736e04 refactor: extract filesystem, attachments, and web handlers from main/index.ts
Phase 2 of main process refactoring - extract IPC handlers to dedicated modules.

Extracted handlers:
- handlers/filesystem.ts: 10 handlers (fs:homeDir, fs:readDir, fs:readFile,
  fs:stat, fs:directorySize, fs:writeFile, fs:rename, fs:delete, fs:countItems,
  fs:fetchImageAsBase64)
- handlers/attachments.ts: 5 handlers (attachments:save, attachments:load,
  attachments:delete, attachments:list, attachments:getPath)
- handlers/web.ts: 14 handlers (web:broadcastUserInput, web:broadcastAutoRunState,
  web:broadcastTabsChange, web:broadcastSessionState, live:toggle, live:getStatus,
  live:getDashboardUrl, live:getLiveSessions, live:broadcastActiveSession,
  live:startServer, live:stopServer, live:disableAll, webserver:getUrl,
  webserver:getConnectedClients)

Changes:
- All handler logic preserved exactly as-is (no functional changes)
- All IPC channel names and signatures unchanged
- Dependency injection used for web handlers (getWebServer, setWebServer, createWebServer)
- Filesystem handlers use stores directly (no dependencies needed)
- Attachments handlers receive app dependency for userData path

Tests added:
- 23 tests for filesystem handlers
- 13 tests for attachments handlers
- 25 tests for web handlers (including edge cases for server startup timeout)

Removed ~677 lines from main/index.ts, added ~805 lines across new modules.
2026-01-21 01:23:58 +05:00
Raza Rauf
bc5f03364b Merge pull request #219 from pedramamini/code-refactor
fix: address PR feedback for stores module
2026-01-21 00:26:45 +05:00
Raza Rauf
58f170df6d fix: improve path validation security in getCustomSyncPath
Addresses PR review feedback on path traversal detection:

1. Fixed false positive issue - now checks for literal ".." path segments BEFORE normalization, allowing valid paths like "/Users/test/my..project" while still blocking traversal attacks like "/Users/../../../etc"

2. Added null byte check - prevents Unix security vulnerability

3. Added Windows reserved names check (CON, PRN, AUX, NUL, COM1-9, LPT1-9)

4. Improved Windows sensitive path detection - now checks across all drive letters (not just C:) and added more system directories

5. Added tests for:
   - Valid paths with ".." in directory names
   - Null byte rejection
   - More specific traversal error assertion

All 102 stores module tests pass. Lint passes.
2026-01-21 00:17:40 +05:00
Raza Rauf
efac035718 fix: address PR feedback for stores module
1. Type Safety: Added StoredSession interface with required fields (id, name, toolType, cwd, projectRoot) and index signature. Changed SessionsData.sessions from any[] to StoredSession[]. Changed GroupsData.groups from any[] to Group[].

2. Test Mock Cleanup: Refactored instances.test.ts to use vi.hoisted() for proper mock scoping, avoiding potential test interference.

3. Path Validation Security: Added isValidSyncPath() to getCustomSyncPath() that rejects relative paths, traversal sequences, paths that are too short, and paths in sensitive system directories.

Added 7 new path validation tests. All 15,311 tests pass.
2026-01-21 00:05:44 +05:00
Raza Rauf
681aa637e0 Merge pull request #218 from pedramamini/code-refactor
refactor: extract stores module from main/index.ts with comprehensive…
2026-01-20 23:53:10 +05:00
Raza Rauf
edde5d7a8f refactor: extract stores module from main/index.ts with comprehensive tests
Split monolithic store code from index.ts into dedicated src/main/stores/ module
following single responsibility principle:

- types.ts (112 lines) - Centralized type definitions
- defaults.ts (86 lines) - Default values and getDefaultShell()
- instances.ts (175 lines) - Store instance lifecycle management
- getters.ts (118 lines) - Public store accessor functions
- utils.ts (94 lines) - Utility functions (getCustomSyncPath, getEarlySettings)
- index.ts (72 lines) - Public API re-exports
2026-01-20 23:47:34 +05:00
Raza Rauf
ff176e4dcb Merge pull request #215 from pedramamini/format-codebase
chore: format entire codebase with prettier
2026-01-19 15:44:51 -06:00
Raza Rauf
231fe2fd88 chore: format entire codebase with prettier
Run `npm run format` across all TypeScript/TSX files
for consistent code formatting throughout the project.
2026-01-20 02:21:36 +05:00
Raza Rauf
6041b62b0b Merge pull request #214 from pedramamini/code-refactor
perf: optimize hot path performance in main process
2026-01-19 15:16:02 -06:00
Raza Rauf
d1056664ff fix: moved beforeEach import to top 2026-01-20 02:12:06 +05:00
Raza Rauf
c7a3b4a0df fix + test: address PR recommendations + add comprehensive tests for performance optimizations 2026-01-20 02:01:53 +05:00
Raza Rauf
557066babb perf: optimize hot path performance in main process
- Pre-compile regex patterns at module level to avoid repeated compilation in data handlers that fire hundreds of times per second
- Add conditional debugLog() function to skip logging overhead in production (can be enabled via DEBUG_GROUP_CHAT=1 env var)
- Optimize group chat buffer from O(n²) string concatenation to O(n) array-based buffering with single join on read
- Consolidate MaestroSettings interface to single source of truth in persistence.ts to fix type incompatibility errors
2026-01-20 01:38:47 +05:00
Raza Rauf
83cc8da4eb Merge pull request #213 from pedramamini/code-refactor
Added pre-commit husky hooks that to enforce project standards
2026-01-19 13:15:15 -06:00
Raza Rauf
491cef67fa chore: address PR review feedback
- Add troubleshooting section for pre-commit hooks in CONTRIBUTING.md
- Make prepare script resilient for CI/Docker: husky || true
- Update .prettierignore to exclude coverage/ and *.min.js
2026-01-20 00:11:22 +05:00
Raza Rauf
5773691dbe docs: add pre-commit hooks documentation to CONTRIBUTING.md 2026-01-19 23:09:40 +05:00
Raza Rauf
dd04429482 Add pre-commit hooks with husky and lint staged 2026-01-19 22:58:29 +05:00
Raza Rauf
cea3818e42 Merge pull request #212 from pedramamini/code-refactor
eslint-config-prettier added along with necessary editor config files for standardized formatting
2026-01-19 11:23:57 -06:00
Raza Rauf
f90892115e added eslint-config-prettier along with necessary config files for streamlined formatting 2026-01-19 22:15:39 +05:00
Raza Rauf
eeb482baa3 Merge pull request #200 from pedramamini/code-refactor
refactor: src/main/process-manager.ts from monolithic file to modular scalable directory structure
2026-01-19 05:17:14 -06:00
Raza Rauf
2702a7c63a Merge branch 'main' into code-refactor 2026-01-19 16:08:48 +05:00
Pedram Amini
a0ebf02e4a ## CHANGES
- Added per-agent per-day stats breakdown powering richer provider charts 📊
- Upgraded AgentUsageChart to multi-provider lines with query/time toggle 📈
- Normalized cumulative usage events into per-turn deltas for Claude/Codex 🧮
- Fixed context token display to use agent-specific calculation pipeline 🧠
- Reworked session aggregation: distinct session counts plus closed-session averages 🗃️
- Hardened tool execution rendering to ignore non-string inputs safely 🛡️
- Added comprehensive tests preventing React error #31 from tool metadata 🧪
- Refreshed summary cards into cleaner 2×3 grid layout across breakpoints 🧩
- Improved metric card readability by wrapping long agent names instead 📝
- Updated types and IPC contracts to include new `byAgentByDay` payload 🔌
2026-01-18 15:58:49 -06:00
Pedram Amini
ead7b7d538 ## CHANGES
- Split Git status into file, branch, and detail hooks for cleaner UI wiring 🧩
- Supercharged panel resizing by updating state only on mouseup 
- Added explicit tests ensuring resize drags avoid excessive rerenders 🧪
- Refreshed dashboard wording: “Agent Comparison” is now “Provider Comparison” 🔁
- Renamed “Source Distribution” chart to clearer “Session Type” labeling 🏷️
- Updated chart accessibility labels and headings to match new terminology 
- Improved mobile timestamps: time-only for today, date+time for older 🕰️
- Added robust MessageHistory tests covering today vs older date formatting 📅
2026-01-18 14:06:55 -06:00
Pedram Amini
fe77591d42 ## CHANGES
- Eliminated mobile session ref initialization race with immediate saved defaults 🚀
- Made active tab ref mirror URL/saved tab instantly for reliable callbacks 🧭
- Simplified hook test by removing unnecessary async waiting on refs 🧪
2026-01-18 13:14:42 -06:00
Pedram Amini
bcc15a486e MAESTRO: Phase 03 - Integrate props hooks into App.tsx
- Import useMainPanelProps, useSessionListProps, useRightPanelProps hooks
- Create memoized wizard handlers (handleWizardComplete, handleWizardLetsGo, handleToggleWizardShowThinking)
- Integrate all three props hooks with comprehensive dependency objects
- Update MainPanel, SessionList, and RightPanel JSX to use spread props pattern
- Fix type mismatches:
  - BatchRunState null vs undefined
  - AITab type for activeTab
  - DocumentGenerationCallbacks function signature
  - mergeSourceName/mergeTargetName string | undefined
  - lastGraphFocusFilePath string | undefined

This optimization prevents React from re-evaluating 50-100+ props on every state change in MaestroConsoleInner by memoizing props objects that only change when their dependencies change.
2026-01-18 13:05:30 -06:00
Pedram Amini
51aa4b9ff0 ## CHANGES
- Removed OpenSpec prompt injection quick actions and related modal wiring 🧹
- QuickActionsModal no longer fetches or exposes OpenSpec command helpers 🔌
- Added brand-new Agent Usage Over Time dual-axis chart (sessions + time) 📈
- Integrated Agent Usage section into Agents dashboard with keyboard navigation 🧭
- Renamed “Agent Comparison” UI to “Provider Comparison” for clarity 🏷️
- Updated “Session Statistics” panels to “Agent Statistics” across dashboard 📊
- Rebranded “Source Distribution” chart to “Session Type” for better meaning 🗂️
- Improved accessibility labels to match new provider/session terminology 
- Fixed batch processor ref syncing to prevent “0 of N completed” regressions 🛠️
2026-01-18 12:44:17 -06:00
Pedram Amini
3b9abec5a5 MAESTRO: Phase 04 - Tab memoization & split GitStatusContext
Tab memoization:
- Add tabId prop to Tab component to avoid inline closures
- Create stable callback wrappers in TabBarInner
- Convert all Tab event handlers to use useCallback with tabId dependency
- Eliminates ~16k unnecessary re-renders per commit

Split GitStatusContext into focused sub-contexts:
- GitBranchContext: branch, remote, ahead/behind (rarely changes)
- GitFileStatusContext: getFileCount, hasChanges (changes on file ops)
- GitDetailContext: getFileDetails, refreshGitStatus (active session only)

Update consumers to use only needed context:
- SessionList: useGitFileStatus (file counts only)
- MainPanel: useGitBranch + useGitFileStatus + useGitDetail
- GitStatusWidget: useGitFileStatus + useGitDetail

Preserve legacy useGitStatus for backwards compatibility.
2026-01-18 12:09:37 -06:00
Pedram Amini
2e1dd4c74f MAESTRO: Phase 03 - Props hooks for major components
Create memoized props hooks for MainPanel, SessionList, and RightPanel to
prevent React from re-evaluating 50-100 props on every state change in
MaestroConsoleInner.

Key changes:
- Add useMainPanelProps hook (~100 props memoized)
- Add useSessionListProps hook (~80 props memoized)
- Add useRightPanelProps hook (~60 props memoized)
- Create props module with index.ts exports
- Update hooks index to re-export props module

Optimization: Uses primitive values in dependency arrays (e.g., activeSession?.id
instead of activeSession) to minimize re-renders.
2026-01-18 11:51:16 -06:00
Pedram Amini
576d71c9c0 MAESTRO: Phase 02 - useDeferredValue for input responsiveness
Add React's useDeferredValue to prioritize input field responsiveness
while allowing expensive components to defer their updates. InputArea
uses the immediate inputValue for responsive typing, while the prompt
composer uses deferredInputValue to avoid blocking keystrokes.
2026-01-18 11:41:53 -06:00