Maestro cue spinout - #997
Closed
pedramamini wants to merge 57 commits into
Closed
Conversation
…r, and Encore feature flag - Register maestroCue as an Encore Feature flag (EncoreFeatureFlags, DEFAULT_ENCORE_FEATURES) - Create src/main/cue/cue-types.ts with CueEventType, CueSubscription, CueSettings, CueConfig, CueEvent, CueRunStatus, CueRunResult, CueSessionStatus, and related constants - Add 'CUE' to HistoryEntryType across shared types, global.d.ts, preload, IPC handlers, and hooks - Add cueTriggerName, cueEventType, cueSourceSession optional fields to HistoryEntry - Add 'cue' log level to MainLogLevel, LOG_LEVEL_PRIORITY, logger switch/case, and LogViewer with teal color (#06b6d4), always-enabled filter, and agent name pill - Add 10 Cue-specific template variables (CUE_EVENT_TYPE, CUE_TRIGGER_NAME, etc.) with cueOnly flag - Extend TemplateContext with cue? field and substituteTemplateVariables with Cue replacements - Update TEMPLATE_VARIABLES_GENERAL filter to exclude cueOnly variables
…ovider Implements the three core modules for the Cue event-driven automation engine: - cue-yaml-loader.ts: Discovers and parses maestro-cue.yaml files with js-yaml, validates config structure, watches for file changes via chokidar with 1-second debounce - cue-file-watcher.ts: Wraps chokidar for file.changed subscriptions with per-file debouncing (5s default), constructs CueEvent instances with full file metadata payloads - cue-engine.ts: Main coordinator class with dependency injection, manages time.interval timers (fires immediately then on interval), file watchers, agent.completed listeners with fan-in tracking, activity log ring buffer (max 500), and run lifecycle management Added js-yaml and @types/js-yaml dependencies. 57 tests across 3 test files.
…story recording Implements the Cue executor module that spawns background agent processes when Cue triggers fire, following the same spawn pattern as Auto Run's process:spawn IPC handler. Key exports: - executeCuePrompt(): Full 10-step pipeline (prompt resolution, template substitution, agent arg building, SSH wrapping, process spawn with stdout/stderr capture, timeout enforcement with SIGTERM→SIGKILL) - stopCueRun(): Graceful process termination by runId - recordCueHistoryEntry(): Constructs HistoryEntry with type 'CUE' and all Cue-specific fields (trigger name, event type, source session) - getActiveProcesses(): Monitor running Cue processes Test coverage: 31 tests in cue-executor.test.ts covering execution paths, SSH remote, timeout escalation, history entry construction, and edge cases. Full suite: 21,635 tests passing across 512 files, zero regressions.
…zation for Maestro Cue
Add CUE entry support across all History components: - HistoryFilterToggle: CUE filter button with teal (#06b6d4) color and Zap icon - HistoryEntryItem: CUE pill, success/failure badges, and trigger metadata subtitle - HistoryPanel & UnifiedHistoryTab: CUE included in default activeFilters - HistoryDetailModal: CUE pill color, icon, success/failure indicator, trigger metadata display - Comprehensive test coverage for all CUE rendering paths (205 new/updated tests pass)
…nd activity log Add the Maestro Cue dashboard modal with full Encore Feature gating: - CueModal component with sessions table, active runs list, and activity log - useCue hook for state management, event subscriptions, and 10s polling - Settings toggle in Encore tab, command palette entry, keyboard shortcut (Cmd+Shift+U) - SessionList hamburger menu entry, modal store integration, lazy loading - 30 tests covering hook behavior and modal rendering
Add CueYamlEditor component for creating and editing maestro-cue.yaml files. Features split-view layout with AI assist (left panel for description + clipboard copy) and YAML editor (right panel with line numbers, debounced validation, Tab indentation). Integrates into CueModal via Edit YAML button on each session row.
…yaml Task 1: CueHelpModal component with 7 content sections (What is Maestro Cue, Getting Started, Event Types, Template Variables, Multi-Agent Orchestration, Timeouts & Failure Handling, AI YAML Editor). Wired to CueModal ? button. Registered with layer stack at MODAL_PRIORITIES.CUE_HELP (465). Task 2: useCueAutoDiscovery hook that calls cue:refreshSession when sessions are created/restored/removed, gated by encoreFeatures.maestroCue. Full scan on feature enable, engine disable on feature off. Tests: 38 CueHelpModal tests + 10 useCueAutoDiscovery tests, all passing. Lint clean. No existing test regressions (21,778 tests pass).
… session bridging Implement agent completion event chaining in the Cue engine: - Fan-out: subscriptions dispatch prompts to multiple target sessions simultaneously - Fan-in: subscriptions wait for all source sessions to complete before firing, with timeout handling (break clears tracker, continue fires with partial data) - Session bridging: user session completions trigger Cue subscriptions via exit listener - Add AgentCompletionData type for rich completion event payloads - Add hasCompletionSubscribers() optimization to skip unneeded notifications - Wire getCueEngine/isCueEnabled into ProcessListenerDependencies
…ure gated) Add teal Zap icon next to session names in the Left Bar for sessions with active Maestro Cue subscriptions. The indicator is gated behind the maestroCue Encore Feature flag and shows a tooltip with the subscription count on hover. - Add cueSubscriptionCount prop to SessionItem with Zap icon rendering - Add lightweight Cue status fetching in SessionListInner via cue:getStatus IPC, refreshed on cue:activityUpdate events - Add cue namespace to global test setup mock - 6 unit tests + 3 integration tests; all 21,815 tests pass; lint clean
Add Maestro Cue entries across all developer documentation: - CLAUDE.md: Key Files table (4 entries), Architecture tree (cue/ dir), Standardized Vernacular (Cue + Cue Modal terms) - CLAUDE-PATTERNS.md: Encore Feature section lists maestroCue as second reference implementation alongside directorNotes - CLAUDE-IPC.md: cue namespace in Automation section, full Cue API reference with all endpoints and event documentation
…t journal - Add cue-db.ts: SQLite-backed event journal (cue_events table) and single-row heartbeat table (cue_heartbeat) using better-sqlite3 with WAL mode - Add cue-reconciler.ts: time event catch-up logic that fires exactly one reconciliation event per missed subscription (no flooding), with payload.reconciled and payload.missedCount metadata - Update cue-engine.ts: heartbeat writer (30s interval), sleep detection (2-minute gap threshold), database pruning (7 days), and clean shutdown - Update CueHelpModal: new "Sleep & Recovery" section with Moon icon - Update CueModal: amber "catch-up" badge on reconciled activity log entries - Tests: 41 new tests across cue-db (17), cue-reconciler (11), cue-sleep-wake (13)
Add filter field to CueSubscription for narrowing when subscriptions fire. Supports exact match, negation (!), numeric comparison (>/</>=/<=), glob patterns (picomatch), and boolean matching with AND logic. Filter checks integrated at all three dispatch points (file.changed, time.interval, agent.completed). Includes help modal docs, AI prompt updates, and 80 new tests (43 filter engine + 37 YAML loader).
… awareness Add pattern presets (Scheduled Task, File Enrichment, Reactive, Research Swarm, Sequential Chain, Debate) to the YAML editor as clickable cards. Enhance the AI system prompt with pattern recognition guidance. Add a Coordination Patterns section with ASCII flow diagrams to the help modal.
Add github.pull_request and github.issue event types to CueEventType union. Add repo and poll_minutes fields to CueSubscription interface. Add cue_github_seen SQLite table with 5 CRUD functions for tracking seen GitHub items (isGitHubItemSeen, markGitHubItemSeen, hasAnyGitHubSeen, pruneGitHubSeen, clearGitHubSeenForSubscription). Create cue-github-poller.ts module that polls GitHub CLI for new PRs/issues, seeds existing items on first run, and fires CueEvents for new items. Comprehensive test suite with 17 test cases covering all polling behaviors. All 264 Cue tests pass, lint clean.
…ge) to Cue patterns
Add GitHub Pull Request and GitHub Issue event type blocks with descriptions, YAML configuration examples, and seven new GitHub template variables (CUE_GH_*) to the Cue Help Modal documentation.
Address all 20 PR #488 review comments: - Fix concurrency tracking leak in cue-engine stopRun - Fix SSH silent fallback in cue-executor (error when sshStore unavailable) - Fix SIGKILL escalation using exitCode/signalCode check - Add NaN guards in cue-filter numeric comparisons - Wire real executor in onCueRun handler (was stub) - Fix shortcut conflict (maestroCue: Meta+Shift+Q) - Add projectRoot to CueSessionStatus in preload - Add timeout_minutes > 0 validation in YAML loader - Add stale response guards in CueYamlEditor and useCue - Fix file.changed payload key in CueModal - Add stopped status display in CueModal - Add immediate validation on YAML load - Tighten source_session/fan_out element typing - Add missing cleanup in github-poller test - Add NaN test cases for cue-filter Port Cue integrations to refactored component structure: - Add Cue menu item to HamburgerMenuContent - Add Cue session tracking to SessionList - Add Maestro Cue Encore toggle to EncoreTab Fix .prettierignore to exclude itself from formatting.
New trigger that polls markdown files for unchecked tasks (- [ ]) and fires events per file when content changes and pending tasks exist. Includes content hashing to avoid re-triggering, picomatch glob matching, 6 new template variables, YAML validation, and full renderer support.
The tool execution display in TerminalOutput had a growing chain of per-tool field extractors (command, pattern, file_path, query, etc.) that required manual additions for every new tool type. Replaced with a single generic summarizeToolInput function that walks all input object entries and displays strings, string arrays, array counts, and boolean/number key=value pairs automatically. TodoWrite todos array retains its special progress summary formatting. Removed dead helpers: safeStr, truncateStr. Updated tests to verify generic behavior for arbitrary tool inputs.
…layout Hide CUE filter button from History panel and Director's Notes when the Maestro Cue encore feature is disabled. In the History panel, move the activity graph to its own row when all 3 filter types are visible (CUE enabled) to prevent crowding; keep it inline when only 2 types show.
…bled Show a CUE entry type description (with Zap icon and teal badge) in the History Panel Guide modal, gated on the maestroCue encore feature flag. Describes the trigger types: file changes, time intervals, agent completions, GitHub activity, and pending tasks.
- maestro-cue.md: Overview, enabling, quick start, modal UI, shortcuts - maestro-cue-configuration.md: Full YAML schema, settings, validation - maestro-cue-events.md: All 6 event types with payloads and examples - maestro-cue-advanced.md: Fan-in/out, filtering, chaining, templates - Update encore-features.md and docs.json to wire into navigation
…ndex - Add standalone CueYamlEditor modal with lazy loading and modalStore integration - Add "Configure Maestro Cue" to session context menu and Quick Actions - Thread onConfigureCue through AppModals, SessionList, and QuickActionsModal - Fix CueHelpModal z-index to use MODAL_PRIORITIES.CUE_HELP instead of hardcoded 50 - Change Maestro Cue shortcut from Cmd+Shift+Q (conflicts with macOS quit) to Opt+Q
…nd session resume
- New docs/maestro-cue-examples.md with 8 complete workflow examples: CI pipeline, selective chaining, research swarm, PR review with follow-up, TODO task queue, multi-env deploy, issue triage, debate - Document triggeredBy, status, exitCode, durationMs as filterable payload fields on agent.completed events - Add triggeredBy filter example to advanced patterns doc - Add triggeredBy to CueHelpModal filter table and agent.completed desc - Add examples page to docs.json navigation
…letion metadata Expose 5 event payload fields as template variables that were previously only available for filter matching: CUE_FILE_CHANGE_TYPE (add/change/unlink), CUE_SOURCE_STATUS, CUE_SOURCE_EXIT_CODE, CUE_SOURCE_DURATION, and CUE_SOURCE_TRIGGERED_BY. Updated help modal, docs, and tests.
…p content - Add CueGraphView canvas component with d3-force layout showing trigger→agent relationships - Add Dashboard/Graph tab switcher to CueModal header - Add cue:getGraphData IPC pipeline (engine → handler → preload → renderer) - Standardize CueModal, UsageDashboard, and DirectorNotes modal sizes (80vw/1400/85vh/900) - Convert CueHelpModal to inline CueHelpContent that swaps within CueModal body - Show agent name in CueYamlEditor title
…and menu icons Cue blue (#06b6d4) is retained only for lightning bolt indicators in history and activity logs where it serves as a semantic color for Cue-triggered content.
…visual editor - Create src/shared/cue-pipeline-types.ts with CuePipeline, PipelineNode, PipelineEdge, TriggerNodeData, AgentNodeData types and PIPELINE_COLORS palette - Create CuePipelineEditor component with React Flow canvas, Background, Controls, MiniMap, theme-aware styling, and placeholder toolbar/drawers - Wire CuePipelineEditor into CueModal Graph tab, replacing CueGraphView - Update CueModal tests for new pipeline editor component
Create TriggerNode (pill-shaped with event-type colors and icons), AgentNode (card with accent bar, pipeline count badge, multi-pipeline color strip), and PipelineEdge (bezier with mode labels and animated dash for autorun). Update CuePipelineEditor to register custom nodeTypes/edgeTypes and compute pipelineCount and pipelineColors per agent node.
…eline editor Add collapsible TriggerDrawer (left) and AgentDrawer (right) that let users drag triggers and agents onto the React Flow canvas. Integrate drop handling, connection validation, and node repositioning into the main CuePipelineEditor component.
…lor utilities, and CRUD operations
- NodeConfigPanel: event-specific trigger config (interval, glob, repo, etc.) and agent prompt textarea with pipeline membership display - EdgeConfigPanel: mode selector (pass/debate/autorun) with debate settings (max rounds, timeout) and autorun explanation - Selection handling: node/edge click, pane click to dismiss, Delete/Backspace keyboard shortcut to remove selected elements - All config changes update pipeline state immediately (debounced text inputs)
Create pipelineToYaml.ts that converts visual pipeline graph state into CueSubscription objects and YAML strings. Handles linear chains, fan-out, fan-in, and edge mode annotations (debate/autorun). Includes 13 passing tests.
Converts CueSubscription objects back into visual CuePipeline structures, enabling round-trip fidelity between YAML config and the graph editor. Supports chain grouping, fan-out, fan-in, deduplication, and auto-layout.
…d/validation - Load existing YAML subscriptions on mount via graphSessionsToPipelines - Add Save button that converts pipelines to YAML, writes via IPC, and refreshes sessions - Add dirty state tracking with visual indicator dot on Save button - Add graph validation before save (triggers, agents, cycles, disconnected nodes) - Add Discard Changes button to reload from YAML - Add validation error banner with inline error display - Pass projectRoot from CueModal to pipeline editor sessions - Update yamlToPipeline to use minimal interface types for flexibility
Add save/load IPC handlers for persisting pipeline graph layout (node positions, viewport zoom/pan, selected pipeline) to userData JSON file. Integrates with CuePipelineEditor to load saved positions on mount, merge with live graph data, and debounce-save on node drag end.
…move YAML editor UI - Rename 'Graph' tab to 'Pipeline Editor' and make it the default tab - Replace 'Edit YAML' button with 'View in Pipeline' in Dashboard sessions table - Remove CueYamlEditor rendering (kept as commented import for future use) - Update CueHelpContent to describe visual pipeline editor workflow - Update all related tests to reflect new default tab and UI changes
- Sessions table: new "Pipelines" column with colored dots showing which pipelines each session belongs to (with tooltip on hover) - Active Runs: pipeline color dot next to each subscription name - Activity Log: pipeline color dot replaces generic Zap icon when subscription maps to a known pipeline - Added utility functions for subscription-to-pipeline name mapping - Graph data now fetched for both Dashboard and Pipeline tabs
- Keyboard shortcuts: Escape (deselect/close drawers), Cmd+S (save), TODO for Cmd+Z undo - Empty state message with directional arrows when no nodes exist - Connection validation via isValidConnection (prevent self-connections, trigger-to-trigger, duplicates) - Right-click context menu on nodes (Configure, Delete, Duplicate for triggers) - Visual feedback for running pipelines with animated dash edges - MiniMap node coloring based on event type and pipeline colors
- Fix graphSessions dependency in loadLayout effect so YAML data populates the graph (was running once on mount before async fetch) - Add fuzzy filter to TriggerDrawer (search by label, event type, description) matching AgentDrawer's existing search - Add descriptions to trigger items for better discoverability - Theme-aware drawers: both TriggerDrawer and AgentDrawer now use theme.colors instead of hardcoded dark colors - Add comprehensive tests for both drawers (21 tests)
- Add hierarchical (left-to-right layers) layout algorithm with BFS depth assignment - Add layout algorithm dropdown selector (Hierarchical, Force-Directed) - Implement click-and-drag to reposition individual nodes with position persistence - Tune force-directed layout parameters (distance, charge, iterations) - Remove Encore Feature callout from CueHelpModal (no longer relevant) - Fix CueHelpModal test mock theme to match current ThemeColors interface Claude ID: 5e831d0a-5904-4fea-8520-0a217a968071 Maestro ID: 92788326-73ad-4c8c-b593-b9711e388139
- Fix dropdown text visibility with theme-aware textColor/borderColor - Fix agent node badge clipping (overflow: visible on root container) - Add pipeline legend bar in All Pipelines view with color + name - Auto-select dropped nodes to open config panel immediately - Add PipelineSelector and AgentNode test suites (17 new tests)
Add explicit GripVertical drag handles and Settings gear icons to TriggerNode and AgentNode for clear drag/configure affordances. Restrict node dragging to handle area via React Flow dragHandle selector. Config panels now use static insets matching drawer widths (220px left, 240px right) with rounded top corners.
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (128)
📝 WalkthroughWalkthroughAdds a complete Maestro Cue automation feature: main-process engine, providers (file watcher, GitHub poller, task scanner), filtering, executor, persistence, IPC/preload APIs, renderer UI (modal, editor, graph), settings/history/log integration, extensive tests, and documentation. ChangesMaestro Cue end-to-end feature
Sequence Diagram(s)sequenceDiagram
autonumber
participant User as User (Renderer)
participant UI as CueModal/CueYamlEditor
participant Preload as window.maestro.cue
participant Main as CueEngine
participant Prov as File/GitHub/Task Providers
participant Exec as Executor
participant DB as Cue DB
User->>UI: Open Cue modal / edit YAML
UI->>Preload: getStatus()/validateYaml()/writeYaml()
Preload->>Main: IPC calls
Main-->>Preload: Status/validation result
Preload-->>UI: Update UI
Prov->>Main: Emit CueEvent
Main->>DB: recordCueEvent
Main->>Exec: executeCuePrompt(event+prompt)
Exec-->>Main: CueRunResult (completed/failed)
Main->>DB: updateCueEventStatus
Main-->>Preload: cue:activityUpdate
Preload-->>UI: Refresh dashboard
Estimated code review effort🎯 5 (Critical) | ⏱️ ~150 minutes Possibly related PRs
Poem
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
⚔️ Resolve merge conflicts
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary by CodeRabbit
Release Notes
New Features
Documentation