Commit Graph

2229 Commits

Author SHA1 Message Date
Salman Muin Kayser Chishti
3c9823d742 Upgrade GitHub Actions for Node 24 compatibility
Signed-off-by: Salman Muin Kayser Chishti <13schishti@gmail.com>
2026-02-02 09:19:50 +00:00
github-actions[bot]
9cf1b05655 docs: sync release notes for v0.15.0-rc 2026-02-01 03:54:01 +00:00
github-actions[bot]
fedf98436c docs: sync release notes for v0.15.0 2026-02-01 03:03:44 +00:00
Raza Mair
6d3e149211 Merge pull request #255 from pedramamini/code-refactor
perf: reduce typing lag with multiple agents on large repos
2026-01-31 01:51:35 +05:00
Raza Rauf
f1ae032173 fix: address code review feedback with tests and timing clarity
- Explicitly set gitSessionCountRef in the polling restart effect to
  make the data-flow self-documenting (ref is already current from
  render-phase assignment, but being explicit eliminates ambiguity)
- Expand EARLY_EXIT_EXACT_MATCH_THRESHOLD comment explaining why 50
  was chosen (3x margin over MAX_SUGGESTION_RESULTS, exact matches
  get +50 bonus in fuzzyMatchWithScore)
- Export getScaledPollInterval for direct unit testing
- Add test coverage for all new optimizations:
  - File tree traversal cap (60k node tree capped at 50k)
  - Empty filter fast path (skips fuzzy matching, returns sorted)
  - Early exit behavior with exact substring matches
  - Git polling interval scaling across all thresholds
  - Custom interval bypass (user-configured intervals not scaled)
  - Tab completion file tree cap

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 01:27:23 +05:00
Raza Rauf
212c31db67 perf: reduce typing lag with multiple agents on large repos
Addresses input lag when many AI agents are active simultaneously
on repositories spanning 100k+ files by reducing unnecessary React re-renders,
capping file tree traversal, and scaling git polling with session count.

- Add anyChanged guard in useBatchedSessionUpdates flush to preserve
  referential identity when no sessions were actually modified, avoiding
  ~7 unnecessary re-renders/sec during agent streaming
- Cap file tree traversal at 50k entries in useAtMentionCompletion and
  useTabCompletion to prevent main thread blocking on huge repos
- Skip fuzzy matching entirely for empty @mention filter (just typed @),
  and add early exit after 50 exact substring matches to avoid exhaustive
  search through 100k+ files
- Scale git polling interval dynamically based on git session count
  (30s for 1-3, 45s for 4-7, 60s for 8-12, 90s for 13+) to reduce
  sustained CPU/IO load from parallel git status processes
2026-01-30 23:46:59 +05:00
Raza Mair
7db8e11389 Merge pull request #252 from pedramamini/code-refactor
refactor: decompose stats-db into focused modules
2026-01-30 20:37:15 +05:00
Raza Rauf
dbcbda1324 refactor: decompose stats-db into focused modules
Break the 1,870-line monolithic stats-db.ts into 13 focused modules under
src/main/stats/, following the same pattern used in the agents module refactor.

Key improvements:
- StatementCache for prepared statement reuse across CRUD operations
- DB guard accessor (get database()) replaces 18 repeated null checks
- Transaction-wrapped clearOldData for atomic multi-table cleanup
- _meta table replaces external file for vacuum timestamp storage
- Row mapper functions centralize snake_case-to-camelCase conversion
- runStatements() helper eliminates repeated split-by-semicolon patterns
- Migration functions accept db param instead of relying on class context
- CSV export adds isRemote column and RFC 4180 compliant escaping
- Statement caches properly cleared on database close

Split the 6,400-line monolithic test file into 8 focused test files under
src/__tests__/main/stats/ matching the source module structure.
2026-01-30 20:10:56 +05:00
Raza Mair
25f6749e8b Merge pull request #247 from pedramamini/code-refactor
refactor: consolidate agents module and reorganize test structure
2026-01-30 02:16:44 +05:00
Raza Rauf
a64b201834 refactor: extract common path builders in path-prober to reduce duplication
Addresses code review suggestion to reduce repeated path patterns across
binary definitions by extracting shared builders (npmGlobal, localBin,
homebrew, wingetLinks, etc.) as closures within each platform function.
2026-01-30 02:10:47 +05:00
Raza Rauf
7a934376f9 fix: address code review feedback with type safety and performance improvements
Type Safety (Medium Priority):
- Replace `any` types in AgentConfigOption with discriminated union
- Four specific types: CheckboxConfigOption, TextConfigOption,
  NumberConfigOption, SelectConfigOption
- Update agent-args.ts to handle new types with proper assertions

Error Handling (Medium Priority):
- Add try/catch wrapper around runModelDiscovery to gracefully
  handle exceptions and return empty array on failure

Performance (Medium Priority):
- Implement parallel path probing using Promise.allSettled
- Previously: sequential checks (6-10 paths, one after another)
- Now: all paths checked concurrently, first success returned
- Maintains priority order while reducing detection time
- Significant improvement on slow file systems/network drives

Configuration (Low Priority):
- Make model cache TTL configurable via constructor parameter
- Default remains 5 minutes, but can be customized for testing

Logging (Low Priority):
- Add debug logging for silent error swallowing in checkCustomPath

Documentation (Low Priority):
- Enhanced module-level JSDoc for detector.ts and path-prober.ts
- Document detection strategy and caching behavior

Testing:
- Add cache TTL expiration test using fake timers
- Add constructor TTL configuration test
2026-01-29 22:54:41 +05:00
Raza Rauf
454cdefd44 refactor: consolidate agents module and reorganize test structure
Create src/main/agents/ directory with barrel exports:
- Move agent-detector.ts → agents/detector.ts
- Move agent-definitions.ts → agents/definitions.ts
- Move agent-capabilities.ts → agents/capabilities.ts
- Move agent-session-storage.ts → agents/session-storage.ts
- Move path-prober.ts → agents/path-prober.ts
- Add index.ts with centralized re-exports

Reorganize tests to mirror source structure:
- Move agent tests to __tests__/main/agents/
- Move process-listeners inline tests to __tests__/main/process-listeners/
- Move debug-package inline tests to __tests__/main/debug-package/

Add new tests for coverage gaps:
- storage/claude-session-storage.test.ts (32 tests)
- web-server/managers/CallbackRegistry.test.ts (29 tests)
- web-server/managers/LiveSessionManager.test.ts (39 tests)

Update all imports across codebase to use new agents/ module path.

Test count: 16,201 → 16,301 (+100 tests)
2026-01-29 22:20:58 +05:00
Raza Rauf
e95ef0c369 refactor: decompose agent-detector into focused modules
- Extract agent-definitions.ts (221 lines) with AGENT_DEFINITIONS and types
- Extract path-prober.ts (489 lines) with platform-specific binary detection
- Reduce agent-detector.ts from 865 to 283 lines (67% reduction)
- Add helper functions: getAgentDefinition, getAgentIds, getVisibleAgentDefinitions
- Maintain API compatibility via re-exports
- Add 49 new tests (26 for definitions, 23 for path-prober)
2026-01-29 20:01:56 +05:00
Raza Mair
106243ffe6 Merge pull request #244 from pedramamini/code-refactor
refactor: restructure web-server module with security and memory leak…
2026-01-29 02:05:26 +05:00
Raza Rauf
9b9cf1f74c refactor: extract LiveSessionManager and CallbackRegistry from WebServer
- Extract LiveSessionManager (178 lines) for live session and AutoRun state tracking
- Extract CallbackRegistry (208 lines) for centralized callback management
- Reduce WebServer.ts from 778 to 582 lines (25% reduction)
- Add managers/ directory with proper exports
- Maintain consistent public API (no breaking changes)
2026-01-29 02:01:34 +05:00
Raza Rauf
b37b8fb91b refactor: restructure web-server module with security and memory leak fixes
- Move WebServer class to dedicated file and add module index
- Extract shared types to centralized types.ts
- Fix XSS vulnerability by sanitizing sessionId/tabId in URL parameters
- Fix IPC listener memory leak with proper cleanup on timeout
- Add autoRunStates cleanup when sessions go offline
- Refactor message handlers with send() and sendError() helpers
- Add XSS sanitization tests and e2e test configuration
2026-01-29 01:19:56 +05:00
Raza Mair
edb260f1bb Merge pull request #240 from pedramamini/code-refactor
refactor: extracted process listeners from main/index.ts
2026-01-27 01:04:38 +05:00
Raza Rauf
31f2a93fea fix: address code review feedback - retry logic and import order
- Add retry logic with exponential backoff for stats DB insertions
  (100ms, 200ms, 400ms delays, max 3 attempts)
- Fix import order in types.ts (move constant after imports)
- Update stats-listener tests for async retry behavior
- Add new test for retry success on transient failure

Addresses review recommendations:
- High: Stats database error handling with retry logic
- Low: Import order consistency
2026-01-27 00:59:08 +05:00
Raza Rauf
8c56831ccc refactor: extract agent error handlers and centralize GROUP_CHAT_PREFIX
- Extract agent:clearError and agent:retryAfterError handlers from
  main/index.ts to dedicated handlers/agent-error.ts module
- Add comprehensive test coverage for agent error handlers (29 tests)
- Centralize GROUP_CHAT_PREFIX constant in process-listeners/types.ts
  to eliminate duplication across 4 listener files
- Remove unused ipcMain import from main/index.ts (all IPC handlers
  now registered through handlers module)
2026-01-27 00:48:22 +05:00
Raza Rauf
84ed2d4b56 fix: address PR review feedback and add DB caching optimization
PR Review Fixes:
- Fix race condition in exit-listener by moving markAndMaybeSynthesize
  to explicit code paths instead of finally() block
- Add buffer size limits (MAX_BUFFER_SIZE 10MB) with warning logs
- Add REGEX_BATCH_SESSION and REGEX_SYNOPSIS_SESSION for proper filtering
- Fix type safety using canonical ToolExecution and UsageStats imports
- Fix usage-listener indentation bug where safeSend was inside wrong block

Performance Optimizations:
- Add GROUP_CHAT_PREFIX constant for fast string prefix checks
- Skip expensive regex matching for non-group-chat sessions
- Eliminate redundant loadGroupChat calls by using updateParticipant
  return value directly (DB caching)
- Add MSG_ID_RANDOM_LENGTH constant for web broadcast deduplication

Test Coverage:
- Add 4 new test files (exit, data, usage, session-id listeners)
- Total 93 tests covering edge cases, DB caching, and performance
- Verify exact participants data flow from updateParticipant
- Test optional emitter handling and empty participants arrays
2026-01-27 00:21:47 +05:00
Raza Rauf
6921bda30f refactor: extracted process listeners from main/index.ts
- types.ts: ProcessListenerDependencies interface and type re-exports.
- data-listener.ts: Process output streaming with group chat buffering.
- exit-listener.ts: Process exit handling with routing, recovery, synthesis.
- session-id-listener.ts: Agent session ID tracking for group chat.
- usage-listener.ts: Token/cost statistics for participants and moderator.
- error-listener.ts: Agent error logging and forwarding.
- stats-listener.ts: Query-complete events for stats database.
- forwarding-listeners.ts: Simple IPC forwarding (slash-commands, etc.).

This reduces main/index.ts by ~600 lines (1270 → 670) and adds 15 new tests covering forwarding, error, and stats listeners.
2026-01-26 17:51:42 +05:00
github-actions[bot]
1f938021fb docs: sync release notes for v0.14.5 2026-01-24 11:15:48 +00:00
Kayvan Sylvan
965a049400 fix: make dev server port configurable via VITE_PORT environment variable (#234)
## CHANGES

- Extract dev server port and URL into separate variables
- Add radix parameter to `parseInt` for proper number parsing
- Sync port configuration between Vite config and main process
- Use consistent port parsing with explicit base 10 radix
2026-01-24 05:03:09 -06:00
Raza Mair
93cf4c71ff Merge pull request #230 from pedramamini/code-refactor
refactor: extract app lifecycle modules from main/index.ts
2026-01-23 16:01:18 -06:00
Raza Rauf
64d990ca3f fix: address code review feedback for Phase 4 refactor
- Use module-level flag instead of try-catch for IPC handler registration
- Improve error logging to capture full context with stack traces
- Add race condition protection for quit confirmation flow
2026-01-24 01:46:32 +05:00
Raza Rauf
434ee29bfb Merge branch 'main' into code-refactor 2026-01-24 00:02:13 +05:00
Pedram Amini
8be8a8eb6a fix: add Python 3.11 setup for Windows build (distutils removed in 3.12+) 2026-01-23 12:36:59 -06:00
github-actions[bot]
f87971f680 docs: sync release notes for v0.14.5 2026-01-23 13:41:20 +00:00
Pedram Amini
90fd6c3179 sentry.io sourced bug fixes 2026-01-22 16:37:53 -06:00
Raza Rauf
69ef490897 refactor: extract app lifecycle modules from main/index.ts
Extract app lifecycle functionality into dedicated modules with dependency
injection pattern for improved testability and maintainability:

- error-handlers.ts: Global uncaught exception and unhandled rejection handlers
- cli-watcher.ts: CLI activity file watcher with start/stop lifecycle
- window-manager.ts: Window creation with state persistence and auto-updater
- quit-handler.ts: Quit confirmation flow and cleanup orchestration

This reduces main/index.ts by ~200 lines and adds 48 new tests covering
all extracted functionality.
2026-01-23 03:08:46 +05:00
Raza Rauf
7878d29663 Merge pull request #226 from pedramamini/code-refactor
refactor: extract modules from main/index.ts
2026-01-22 15:31:32 -06:00
Raza Rauf
0916960f25 fix: address code review feedback for Phase 1 & 2 refactor
- Add MAX_GROUP_CHAT_BUFFER_SIZE (10MB) to prevent memory exhaustion
- Add buffer truncation with marker when exceeding limit
- Add isGroupChatBufferTruncated() to check truncation status
- Add debugLogLazy() for lazy evaluation of expensive string operations
- Use proper TypeScript types (StoredSession, Group) in web-server-factory
- Add 15 new tests for buffer limits and lazy logging
2026-01-23 02:26:53 +05:00
Raza Rauf
37356c6822 refactor: extract modules from main/index.ts
1 - Pure function extractions:
- constants.ts: Add regex patterns and debugLog for group chat
- group-chat/session-parser.ts: parseParticipantSessionId
- group-chat/output-parser.ts: Text extraction from agent JSONL output
- group-chat/output-buffer.ts: Streaming output buffer management

2 - Dependency injection factories:
- utils/safe-send.ts: createSafeSend for safe IPC messaging
- web-server/web-server-factory.ts: createWebServerFactory for web server

Added 133 new unit tests across 6 test files for full coverage of
extracted modules.
2026-01-23 01:52:54 +05:00
Pedram Amini
8f77c84617 ## CHANGES
- Fixed context token math by excluding cumulative cacheReadInputTokens entirely 🧠
- Updated Claude context rules: count input plus cache-creation only 📏
- Updated Codex context rules: combine input with output, skip cache-read 🔀
- Prevented impossible context utilization percentages exceeding 100% 🚫
- Added high-cache-read regression test to guard against session-total spikes 🧪
- Expanded tests to validate agent-specific context semantics clearly 🧩
- Improved inline docs explaining Claude’s cumulative token reporting nuance 📚
2026-01-22 13:42:00 -06:00
Pedram Amini
a4213b8f66 ## CHANGES
- Synopsis parsing now strips conversational filler to surface real summaries 🔍
- Added robust filler phrase detection across many variants and punctuation 🧹
- Synopsis fallback now skips filler-only outputs, returning “Task completed” 🛟
- Renderer short-summary generator ignores filler sentences before summarizing 🧠
- Autorun synopsis prompt updated to enforce scientific, verb-first logging 📓
- Expanded test suite to verify filler filtering and fallback behavior 🧪
2026-01-22 13:25:49 -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