Skip to content

Conversation

@phodal
Copy link
Member

@phodal phodal commented Dec 2, 2025

Summary

This PR includes multiple improvements and new features for the mpp-idea module and related components.

Key Changes

Live Terminal Support

  • Add async live terminal support for shell tools
  • Add live terminal output streaming in IDEA
  • Add cancel button to live terminal bubble
  • Add process management tools for shell sessions
  • Fix PTY output collection and cross-platform compatibility
  • Add user cancellation tracking and ANSI stripping for terminal output

MCP Config Dialog

  • Add IdeaMcpConfigDialog with DialogWrapper for proper centering
  • Enhance UI to match ToolConfigDialog
  • Implement prompt enhancement functionality
  • Add IdeaToolConfigService for tool config state management

File Search Popup

  • Add file search popup with proper PopupMenu pattern
  • Fix folder selection and improve search UI

Input Area Improvements

  • Redesign IdeaDevInInputArea layout with unified border
  • Move IdeaDevInInputArea to separate file

Actions and Renderers

  • Add IdeaCodeActions for code operations
  • Add IdeaDiffActions for diff/patch operations
  • Add IdeaPlanActions and IdeaPlanRenderer
  • Add IdeaTerminalActions and IdeaTerminalRenderer
  • Add IdeaDiagramActions and enhanced IdeaMermaidRenderer

Bug Fixes

  • Fix memory leak in DevInsProgramRunner
  • Replace ClsFileImpl with PsiCompiledFile interface
  • Remove synchronized for WASM/JS compatibility
  • Add pluggable DevInsCompilerService for switchable compiler core

CI/CD

  • Free disk space in build workflow

Other

  • Add platform-specific UTF-8 font support
  • Update plugin name, vendor email, and description

Pull Request opened by Augment Code with guidance from the PR author

Summary by CodeRabbit

  • New Features

    • Added live terminal execution with background process support and real-time output streaming.
    • Implemented process management capabilities (read, wait, and terminate sessions).
    • Added file search and context management system for organizing related files.
    • Introduced prompt optimization feature to enhance user inputs.
    • Added process cancellation support with detailed feedback.
    • Enhanced MCP configuration dialog with improved UI controls and validation.
  • Chores

    • Optimized GitHub Actions workflow for improved build performance.

✏️ Tip: You can customize this high-level summary in your review settings.

phodal added 30 commits December 2, 2025 00:00
Renamed plugin to "AutoDev Next", updated vendor email, and revised description for clarity.
Introduce getUtf8FontFamily() for proper CJK/UTF-8 rendering on WASM using Noto Sans SC, while other platforms use system defaults. Also exclude heavy dependencies and large font assets from the IntelliJ plugin build to reduce size.
- Add DevInsCompilerService interface in mpp-core with global instance management
- Add DefaultDevInsCompilerService using mpp-core's AST-based compiler
- Add IdeaDevInsCompilerService in mpp-idea using devins-lang's PSI-based compiler
- Modify KoogLLMService to accept optional compiler service injection
- Update IdeaAgentViewModel to inject IDEA compiler for full IDE feature support
- Add unit tests for DevInsCompilerService

This enables mpp-idea to use the full-featured PSI-based DevInsCompiler
with IDE capabilities (Symbol resolution, Refactor, Database, etc.)
while CLI/Desktop continues using the cross-platform AST-based compiler.
- Create IdeaDiffActions.kt to encapsulate diff business logic
- Reuse core module's PatchProcessor, DiffRepair, showSingleDiff()
- Add action buttons to IdeaDiffRenderer (Accept/Reject/View Diff/Repair)
- Update IdeaSketchRenderer to pass project parameter
- Fix IdeaAnalysisComponents to use named parameters

Related to #25
- Create IdeaCodeActions.kt with copy/insert/save methods
- Update IdeaCodeBlockRenderer.kt with toolbar (Copy/Insert/Save buttons)
- Pass project parameter to IdeaCodeBlockRenderer for action buttons

Phase 2 of #25
- Create IdeaPlanActions.kt with parsePlan/copyToClipboard/pinToToolWindow methods
- Create IdeaPlanRenderer.kt with plan sections, steps, status indicators
- Add plan language support to IdeaSketchRenderer
- Reuses core module's MarkdownPlanParser, AgentStateService

Phase 3 of #25
- Create IdeaTerminalActions.kt with checkDangerousCommand/executeCommand methods
- Create IdeaTerminalRenderer.kt with command display, execute button, output panel
- Add bash/shell/sh/zsh language support to IdeaSketchRenderer
- Reuses core module's ShellSafetyCheck, ProcessExecutor

Phase 4 of #25
- Create IdeaDiagramActions.kt with copySourceToClipboard/saveDiagramToFile/validate methods
- Create IdeaMermaidRenderer.kt with toolbar (copy/show code), validation warnings
- Update IdeaSketchRenderer to use enhanced IdeaMermaidRenderer
- Note: PlantUML excluded from mpp-idea due to size (~20MB)

Phase 5 of #25
Introduce async shell execution with live terminal sessions. Shell commands now return a Pending result immediately, and session completion is monitored in the background. Renderers are updated to handle live terminal status and await session results.
Enable real-time shell command output in the IDEA timeline using live process monitoring. Adds a new UI bubble for live terminal sessions and updates shell execution to support async streaming and status reporting.
Adds a cancel button to terminate running shell processes in the live terminal timeline bubble. Also refines timeline logic to prevent duplicate shell command bubbles.
Introduce read-process, wait-process, and kill-process tools to manage long-running shell commands. ShellTool now supports background execution with session IDs, enabling users to read output, wait for completion, or terminate processes asynchronously.
Add support for capturing and sending the current output log to the AI when a live terminal process is cancelled by the user. This includes a new CancelEvent data class and updates to the cancellation flow in the UI and view model.
Problem:
- When user clicks Cancel on LiveTerminal, the output was empty
- This was because PtyShellExecutor.waitForSession was reading from
  the same inputStream as ProcessOutputCollector, causing conflicts

Root Cause:
- Two readers competing for the same PTY inputStream
- ProcessOutputCollector in UI layer and waitForSession in core layer

Solution:
1. Modified PtyShellExecutor.waitForSession to NOT read output
   - Only waits for process completion, no output reading
   - Avoids conflict with UI-layer output collectors

2. Enhanced ProcessOutputCollector to sync output to ShellSessionManager
   - Added sessionId parameter to ProcessOutputCollector
   - Syncs output chunks to ManagedSession.appendOutput()
   - Cancel event now gets actual output from collector buffer

3. Updated IdeaLiveTerminalBubble to use collector.getCurrentOutput()
   - More reliable than state-based output for cancel events

4. CLI renderer (CodingCli) already reads output independently
   - Not affected by waitForSession changes
Problem:
- ShellSessionManager.kt in commonMain used JVM-specific Process class
- This caused WASM build to fail with 'Unresolved reference: Process'

Solution:
1. Changed LiveShellSession from data class to regular class
2. Added isAliveChecker and killHandler callback parameters to LiveShellSession
3. Updated ManagedSession to use callback-based process handlers
4. PtyShellExecutor now passes platform-specific handlers when creating session
5. ShellTool sets handlers on ManagedSession after registration

This allows the shell session management to work across all platforms
(JVM, JS, WASM) while still supporting platform-specific process operations.
…ring

Problem:
- When shell process completes, ToolOrchestrator.startSessionMonitoring
  was getting output from LiveShellSession.getStdout() which was empty
- This is because PtyShellExecutor.waitForSession no longer reads output
  (to avoid conflict with UI's ProcessOutputCollector)

Solution:
- Get output from ShellSessionManager.getSession().getOutput() first
- This output is synced by UI's ProcessOutputCollector in real-time
- Fall back to LiveShellSession.getStdout() if not available

Now when a shell command completes (or is cancelled), the output
collected by the UI will be properly sent to the AI.
Problem:
- PTY process was not configured properly, causing output stream to close
  prematurely or not be readable by ProcessOutputCollector
- Missing critical PTY configuration options

Solution:
- Add setInitialColumns(240) and setInitialRows(80) for proper terminal size
- Add setUnixOpenTtyToPreserveOutputAfterTermination(true) to keep output
  stream open after process completes
- This matches the configuration used in ProcessExecutor.createInteractiveProcess

Now the ProcessOutputCollector should be able to read output from PTY process.
Problem:
- ProcessOutputCollector was trying to read both inputStream and errorStream
- PTY processes combine stdout and stderr into a single stream (inputStream)
- Reading both streams simultaneously caused race conditions and missing output
- errorStream for PTY is empty/EOF, causing stderrJob to exit immediately

Solution:
- Remove separate stderr reader - only read from process.inputStream
- PTY combines all output into inputStream, matching PtyShellExecutor behavior
- Remove isError parameter from readStream() since PTY doesn't separate streams

This matches the pattern used in PtyShellExecutor.executeWithPty() which only
reads inputStream and sets stderr to empty string.
… terminal output

- Add cancelledByUser flag to ManagedSession for tracking user-initiated cancellations
- Add markSessionCancelledByUser() method to ShellSessionManager for non-suspend context
- Register sessions to ShellSessionManager in ToolOrchestrator for cancel event handling
- Sync output to ManagedSession in PtyShellExecutor.waitForSession()
- Add AnsiStripper utility to clean ANSI escape sequences from terminal output
- Strip ANSI codes before sending output to AI for cleaner, readable text
- Update CodingAgentRenderer interface with cancelledByUser parameter
- Update all renderer implementations (JewelRenderer, ComposeRenderer, CodingCliRenderer)
- Include captured output in error messages when commands timeout or fail
…commands

- Skip AnalysisAgent for cancelled commands in CodingAgentExecutor
- Skip error rendering for user-cancelled scenarios
- Preserve metadata in ToolExecutionResult.failure() for cancelled flag propagation
- Apply same fix to DocumentAgentExecutor

When user cancels a command (e.g., bootRun), the flow now:
1. Skips triggering AnalysisAgent for the cancelled output
2. Skips displaying extra 'Tool execution failed' error message
3. Only shows the concise cancellation confirmation

This eliminates unnecessary double-messaging (Summary + Error) for intentional cancellations.
- Fix thread-safety in ShellSessionManager.markSessionCancelledByUser() with synchronized block
- Fix condition ordering in JewelRenderer: check cancelledByUser before exitCode == 0
- Add execution_time_ms to awaitManagedSession for metadata consistency
- Extract buildCancelledMessage helper to reduce code duplication
- Simplify statusMessage logic in CodingCli (remove redundant when branches)
- Add errorType to ComposeRenderer for cancelled results
- Fix spacing in AnsiStripper ('(' , ')' -> '(', ')')
- Remove duplicate inputStream reader in PtyShellExecutor to fix data race
synchronized is JVM-only. Direct access is safe because:
- JS/WASM are single-threaded
- On JVM, boolean assignment is atomic and cancelledByUser is only written once
- Add IdeaFileSearchPopup for adding files to context
  - Support searching project files using FilenameIndex
  - Prioritize recently opened files using EditorHistoryManager
  - Multi-select files with checkbox UI
  - Filter binary and ignored files

- Update IdeaTopToolbar with file selection functionality
  - Add project parameter for file search
  - Add onFilesSelected callback for selected files
  - Show file search popup on Add File button click

- Fix IdeaBottomToolbar right-side config button
  - Change from model config to MCP config dialog
  - MCP config dialog now opens directly from settings button

- Update IdeaDevInInputArea in IdeaAgentApp
  - Add IdeaTopToolbar to input area
  - Manage selected files state
  - Append file paths to message on send (/file:path format)
- Fix EDT violation: move searchAllItems to background thread using Dispatchers.IO
- Remove unused onMcpConfigClick parameter from IdeaBottomToolbar
- Add History icon to IdeaComposeIcons for recently opened files menu
- Restructure IdeaFileSearchPopup to use Box container with trigger button
- Add IdeaContextManager for context state management
- Simplify popup content with search field at top
- Add recent files display and file/folder search
- Add new icons: CheckBox, CheckBoxOutlineBlank, Remove
- Update IdeaTopToolbar to use new popup API
- Add isDirectory field to SelectedFileItem
- Use /dir: command for directories, /file: for files
- Add Search icon to IdeaComposeIcons
- Improve search field UI with icon and better padding
- Update placeholder text to 'Search files and folders...'
- Use PsiCompiledFile interface instead of ClsFileImpl implementation class
- This fixes NoClassDefFoundError in some IDE configurations
- Remove unnecessary null check for content
Extract IdeaDevInInputArea composable from IdeaAgentApp.kt into its own file for better modularity and code organization. No functional changes.
- Add unified border around IdeaDevInInputArea for cohesive look
- IdeaTopToolbar now supports horizontal scroll in collapsed mode
- Add expand/collapse button to toggle between horizontal and vertical file list
- FileChipExpanded shows full path in expanded mode
- Use animateContentSize for smooth expand/collapse animation
- Remove duplicate ExpandLess/ExpandMore icon definitions
…ement

1. Restyle IdeaMcpConfigDialog to match IdeaModelConfigDialog pattern:
   - Use styled Box container with rounded corners and proper background
   - Add proper tab selector with visual feedback
   - Improve spacing and visual hierarchy
   - Add Escape key handling for dialog dismissal
   - Extract IdeaMcpConfigDialogContent for reusability

2. Implement prompt enhancement feature:
   - Create IdeaPromptEnhancer service for AI-powered prompt optimization
   - Load domain dictionary from project's .autodev/domain.csv
   - Load README for project context
   - Use LLM to enhance prompts with domain-specific vocabulary
   - Add loading state indicator on enhancement button
   - Integrate with IdeaBottomToolbar and IdeaDevInInputArea
1. Add replaceText() method to IdeaDevInInput for setting text content
   - Renamed from setText() to avoid conflict with EditorTextField.setText()
   - Uses WriteCommandAction for proper document modification

2. Fix prompt enhancement in IdeaDevInInputArea:
   - Use IntelliJ Logger instead of KLogger (not available in mpp-idea)
   - Move logger to file-level to avoid Composable context issues
   - Use Dispatchers.IO for LLM calls
   - Use ApplicationManager.invokeLater for EDT updates
   - Add proper logging for debugging

3. Add logging to IdeaPromptEnhancer:
   - Log enhancement progress and results
   - Log model configuration and LLM response details
   - Log errors with stack traces
…n IDE

- Create IdeaMcpConfigDialogWrapper using IntelliJ's DialogWrapper
- Dialog now appears centered in the IDE window like IdeaModelConfigDialog
- Proper z-index handling when used with SwingPanel components
- Update IdeaBottomToolbar to use IdeaMcpConfigDialogWrapper.show()
- Mark old IdeaMcpConfigDialog as deprecated
Add step to maximize available disk space in GitHub Actions by using jlumbroso/free-disk-space before fetching sources.
1. IdeaPromptEnhancer:
   - Log only metadata (length) instead of user prompt content to avoid sensitive info leakage
   - Fix domain dictionary fallback logic to properly check both paths
   - Add debug logging for file loading failures
   - Fix regex to handle code blocks without trailing newline

2. IdeaMcpConfigDialog:
   - Add proper @deprecated annotation with ReplaceWith suggestion

3. IdeaBottomToolbar:
   - Remove unused kotlinx.coroutines.launch import

4. IdeaDevInInputArea:
   - Extract duplicate send logic into buildAndSendMessage helper function
   - Use isProcessingRef to fix stale closure issue in SwingPanel listener
   - Remove redundant withContext(Dispatchers.Main) + invokeLater combination
1. McpServersTab improvements:
   - Add header row with title and real-time JSON validation status
   - Show validation status indicator (Loading/Invalid JSON/Valid JSON)
   - Add styled error container with icon for error details
   - Add border around JSON editor with error state styling
   - Add footer with example hint and Save & Reload button with icon
   - Use CircularProgressIndicator for loading states

2. Fix Icon component usage:
   - Change 'key =' to 'imageVector =' for all Icon components
   - Replace IdeaComposeIcons.Schedule with IdeaComposeIcons.History

3. UI consistency:
   - Match the design patterns from ToolConfigDialog.kt
   - Use consistent spacing, colors, and typography
…ement

1. Create IdeaToolConfigService:
   - Project-level service for managing tool configuration state
   - Provides StateFlow for observing config changes
   - Uses configVersion counter to trigger UI recomposition
   - Centralized save/load with notification to listeners

2. Update IdeaToolLoadingStatusBar:
   - Add project parameter
   - Observe configVersion from IdeaToolConfigService
   - Recompute toolStatus when config version changes

3. Update IdeaAgentViewModel:
   - Use IdeaToolConfigService for loading tool config
   - Get fresh config from service in getToolLoadingStatus()

4. Update IdeaMcpConfigDialog:
   - Add project parameter to IdeaMcpConfigDialogContent
   - Use IdeaToolConfigService.saveAndUpdateConfig() for auto-save
   - Notify listeners when tools are toggled

5. Register service in plugin.xml

This ensures the status bar updates when MCP tools are enabled/disabled
in the configuration dialog.
Problem:
DevInsProgramRunner was implementing Disposable and registering a
MessageBusConnection with 'this' as parent, but the runner itself
was never properly disposed, causing memory leak warnings.

Solution:
- Remove Disposable interface from DevInsProgramRunner
- Connect to project's message bus instead of application's
- Register the connection with the project as parent disposable
- This ensures proper cleanup when the project is closed

The connection is now tied to the project lifecycle instead of
the runner's lifecycle, which is the correct pattern for
ProgramRunner implementations.
@coderabbitai
Copy link

coderabbitai bot commented Dec 2, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

This PR introduces asynchronous shell execution with live terminal rendering, a compiler service abstraction layer, and comprehensive IDE UI enhancements including context management, prompt optimization, and interactive renderers for diffs, plans, and diagrams.

Changes

Cohort / File(s) Summary
GitHub Actions Workflow
.github/workflows/build.yml
Added "Maximize Build Space" step to Build and Test jobs using jlumbroso/free-disk-space action before fetching sources.
Compiler Service Abstraction
mpp-core/src/commonMain/kotlin/cc/unitmesh/devins/compiler/service/DevInsCompilerService.kt, DefaultDevInsCompilerService.kt
mpp-idea/src/main/kotlin/cc/unitmesh/devins/idea/compiler/IdeaDevInsCompilerService.kt
Introduced DevInsCompilerService interface with singleton instance management; added cross-platform DefaultDevInsCompilerService and IDEA-specific IdeaDevInsCompilerService with variable support and IDE feature detection.
Async Shell Execution Core
mpp-core/src/commonMain/kotlin/cc/unitmesh/agent/executor/CodingAgentExecutor.kt, CodingAgentRenderer.kt
mpp-core/src/commonMain/kotlin/cc/unitmesh/agent/orchestrator/ToolExecutionResult.kt, ToolOrchestrator.kt
Added AsyncShellConfig for timeout configuration; introduced isPending state on ToolExecutionResult with pending factory; extended ToolOrchestrator with async execution mode; added renderer methods for live terminal lifecycle (addLiveTerminal, updateLiveTerminalStatus, awaitSessionResult).
Tool Result Pending State
mpp-core/src/commonMain/kotlin/cc/unitmesh/agent/tool/Tool.kt
Introduced ToolResult.Pending data class to represent asynchronous execution; extended result accessors (getOutput, getError, extractMetadata, isPending).
Process Management Tools
mpp-core/src/commonMain/kotlin/cc/unitmesh/agent/tool/impl/ProcessManagementTools.kt
Introduced three new tools: ReadProcessTool, WaitProcessTool, KillProcessTool for session-based process interaction with schemas and metadata construction.
Shell Tool Async Support
mpp-core/src/commonMain/kotlin/cc/unitmesh/agent/tool/impl/ShellTool.kt
Extended ShellParams with wait flag and timeoutMs; added background execution, timed-wait, and synchronous paths; updated schema with new properties and example usage.
Session Management
mpp-core/src/commonMain/kotlin/cc/unitmesh/agent/tool/shell/ShellSessionManager.kt, LiveShellSession.kt, AnsiStripper.kt
Introduced ShellSessionManager singleton for centralized session tracking; refactored LiveShellSession to regular class with lifecycle hooks; added AnsiStripper utility for terminal output cleaning.
JVM Shell Execution
mpp-core/src/jvmMain/kotlin/cc/unitmesh/agent/tool/shell/DefaultShellExecutor.jvm.kt, PtyShellExecutor.kt
Implemented LiveShellExecutor interface on DefaultShellExecutor; updated PTY executor with lifecycle callbacks and session management integration.
Executor & Orchestrator Refinement
mpp-core/src/commonMain/kotlin/cc/unitmesh/agent/executor/DocumentAgentExecutor.kt, CodingAgent.kt
mpp-core/src/commonMain/kotlin/cc/unitmesh/devti/language/run/DevInsProgramRunner.kt
Added cancellation checks in long-content handling; increased contentThreshold to 15000; refactored DevInsProgramRunner to use project-scoped message bus instead of application-level.
Result Formatting & JS Export
mpp-core/src/commonMain/kotlin/cc/unitmesh/agent/tool/schema/ToolResultFormatter.kt
mpp-core/src/jsMain/kotlin/cc/unitmesh/llm/JsExports.kt
Updated result formatter to handle pending state with session metadata; added pending variant handling in JS exports.
LLM Service Compiler Integration
mpp-core/src/commonMain/kotlin/cc/unitmesh/llm/KoogLLMService.kt
Integrated DevInsCompilerService with optional parameter; compiler selection and logging added to compilePrompt flow.
IDE Context & File Management
mpp-idea/src/main/kotlin/cc/unitmesh/devins/idea/editor/IdeaContextManager.kt, IdeaFileSearchPopup.kt
Introduced IdeaContextManager service for context file state management with rules and related files; added IdeaFileSearchPopup composable with recent files and search results.
IDE Prompt & Config Services
mpp-idea/src/main/kotlin/cc/unitmesh/devins/idea/editor/IdeaPromptEnhancer.kt
mpp-idea/src/main/kotlin/cc/unitmesh/devins/idea/services/IdeaToolConfigService.kt
Introduced IdeaPromptEnhancer for LLM-based prompt optimization with dictionary and README context; added IdeaToolConfigService for tool configuration state tracking and versioning.
IDE Toolbar & Input Components
mpp-idea/src/main/kotlin/cc/unitmesh/devins/idea/editor/IdeaBottomToolbar.kt, IdeaTopToolbar.kt
mpp-idea/src/main/kotlin/cc/unitmesh/devins/idea/toolwindow/IdeaDevInInputArea.kt
Updated bottom toolbar with project context and prompt optimization; enhanced top toolbar with file search and context management; added advanced IdeaDevInInputArea composable with file selection and prompt enhancement.
IDE Sketch Renderers
mpp-idea/src/main/kotlin/cc/unitmesh/devins/idea/renderer/sketch/IdeaCodeBlockRenderer.kt, IdeaDiffRenderer.kt, IdeaPlanRenderer.kt, IdeaMermaidRenderer.kt, IdeaTerminalRenderer.kt, IdeaSketchRenderer.kt
Introduced/enhanced renderers with toolbars for code actions (copy, insert, save), diff operations (accept, reject, repair), plan management, Mermaid validation, and terminal execution; unified render pipeline with project context.
IDE Renderer Actions
mpp-idea/src/main/kotlin/cc/unitmesh/devins/idea/renderer/sketch/actions/IdeaCodeActions.kt, IdeaDiagramActions.kt, IdeaDiffActions.kt, IdeaPlanActions.kt, IdeaTerminalActions.kt
Introduced action utilities for code operations (clipboard, cursor insertion, file save), diagram handling (copy, save, validation), patch management, plan operations, and terminal execution with safety checks.
IDE MCP Config Dialog Rework
mpp-idea/src/main/kotlin/cc/unitmesh/devins/idea/editor/IdeaMcpConfigDialog.kt
Refactored to DialogWrapper pattern; introduced IdeaMcpConfigDialogContent with new tab components (McpToolsTab, McpServersTab); added JSON validation, tool toggles, and server configuration UI.
IDE Timeline & Live Terminal
mpp-idea/src/main/kotlin/cc/unitmesh/devins/idea/components/timeline/IdeaLiveTerminalBubble.kt, IdeaTimelineContent.kt
Introduced IdeaLiveTerminalBubble composable with ProcessOutputCollector for live output; added onProcessCancel callback threading through timeline.
IDE App & View Model
mpp-idea/src/main/kotlin/cc/unitmesh/devins/idea/toolwindow/IdeaAgentApp.kt, IdeaAgentViewModel.kt
mpp-idea/src/main/kotlin/cc/unitmesh/devins/idea/components/status/IdeaToolLoadingStatusBar.kt
Integrated IDE compiler service; switched to IdeaToolConfigService for config management; added handleProcessCancel handler; wired process cancellation through timeline; updated status bar with config versioning.
UI & Infrastructure
mpp-idea/src/main/kotlin/cc/unitmesh/devins/idea/toolwindow/IdeaComposeIcons.kt
mpp-ui/src/commonMain/kotlin/cc/unitmesh/devins/ui/compose/agent/ComposeRenderer.kt
mpp-ui/src/jvmMain/kotlin/cc/unitmesh/server/cli/CodingCli.kt
Added new Compose icons (History, CheckBox, Remove, Search); extended ComposeRenderer with live terminal session lifecycle; introduced session tracking and async result handling in CodingCliRenderer.
Tests & Config
mpp-core/src/jvmTest/kotlin/cc/unitmesh/devins/compiler/service/DevInsCompilerServiceTest.kt
mpp-idea/src/main/resources/META-INF/plugin.xml
mpp-idea/src/main/kotlin/cc/unitmesh/devins/idea/editor/IdeaDevInInput.kt
exts/devins-lang/src/main/kotlin/cc/unitmesh/devti/language/compiler/exec/file/FileInsCommand.kt
Added compiler service tests; registered IdeaToolConfigService in plugin.xml; added replaceText method to input; refactored file content retrieval in FileInsCommand.

Sequence Diagram(s)

sequenceDiagram
    participant Client as User/LLM
    participant CodingAgent as CodingAgentExecutor
    participant ToolOrch as ToolOrchestrator
    participant ShellExec as LiveShellExecutor
    participant SessionMgr as ShellSessionManager
    participant Renderer as CodingAgentRenderer
    participant Monitor as Session Monitor<br/>(background)

    Client->>CodingAgent: Execute tool call (shell cmd)
    CodingAgent->>ToolOrch: Execute shell tool
    
    alt Async Mode (wait=false)
        ToolOrch->>ShellExec: startLiveExecution()
        ShellExec->>SessionMgr: registerSession()
        SessionMgr-->>ShellExec: ManagedSession
        ShellExec-->>ToolOrch: LiveShellSession
        ToolOrch-->>CodingAgent: ToolResult.Pending
        ToolOrch->>Monitor: startSessionMonitoring() [background]
        CodingAgent-->>Client: Pending (session running)
        
        Monitor->>SessionMgr: getSession()
        Monitor->>ShellExec: waitForSession()
        ShellExec-->>Monitor: ✓ exit code & output
        Monitor->>Renderer: updateLiveTerminalStatus()
        Renderer->>Renderer: Update timeline item
        Renderer-->>Monitor: Emit ToolResult
        Monitor->>SessionMgr: removeSession()
    else Sync Mode (wait=true)
        ToolOrch->>ShellExec: startLiveExecution()
        ShellExec->>ShellExec: Wait for completion
        ShellExec-->>ToolOrch: ToolResult.Success/Error
        ToolOrch-->>CodingAgent: ToolResult.Success/Error
        CodingAgent-->>Client: Final result
    end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Areas requiring extra attention:

  • Async execution model: Session lifecycle, pending result handling, and the background monitoring coroutine in ToolOrchestrator.startSessionMonitoring — verify proper cleanup and timeout behavior
  • Session management thread-safety: ShellSessionManager mutex usage, concurrent access patterns, and state consistency across ManagedSession
  • Compiler service integration: New abstraction point in KoogLLMService and IdeaAgentViewModel — verify proper initialization order and fallback to default implementation
  • Process cancellation semantics: Cross-component cancellation flow through handleProcessCancel, metadata propagation with cancelledByUser flag, and downstream result formatting
  • ANSI stripping robustness: AnsiStripper.stripAndNormalize handling of edge cases (incomplete sequences, mixed encodings, rare escape codes)
  • IntelliJ API integration: IdeaContextManager file listening, IdeaPromptEnhancer IO dispatch, and dialog/renderer project-context propagation
  • Live terminal UI coordination: ProcessOutputCollector, IdeaLiveTerminalBubble, and the channel-based result handoff in renderers (updateLiveTerminalStatusawaitSessionResult)

Possibly related PRs

Poem

🐰 A rabbit's ode to async streams and shells so fine,
Sessions pending, live terminals that brightly shine,
With contexts gathered and prompts optimized true,
The IDE now blooms with workflows ever new!
Hops of joy for renderers and actions galore,
What once was sync, now runs forevermore! 🎉

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ac43616 and d9f8abc.

📒 Files selected for processing (55)
  • .github/workflows/build.yml (1 hunks)
  • exts/devins-lang/src/main/kotlin/cc/unitmesh/devti/language/compiler/exec/file/FileInsCommand.kt (2 hunks)
  • exts/devins-lang/src/main/kotlin/cc/unitmesh/devti/language/run/DevInsProgramRunner.kt (2 hunks)
  • mpp-core/src/commonMain/kotlin/cc/unitmesh/agent/CodingAgent.kt (1 hunks)
  • mpp-core/src/commonMain/kotlin/cc/unitmesh/agent/executor/CodingAgentExecutor.kt (6 hunks)
  • mpp-core/src/commonMain/kotlin/cc/unitmesh/agent/executor/DocumentAgentExecutor.kt (2 hunks)
  • mpp-core/src/commonMain/kotlin/cc/unitmesh/agent/orchestrator/ToolExecutionResult.kt (3 hunks)
  • mpp-core/src/commonMain/kotlin/cc/unitmesh/agent/orchestrator/ToolOrchestrator.kt (7 hunks)
  • mpp-core/src/commonMain/kotlin/cc/unitmesh/agent/render/CodingAgentRenderer.kt (3 hunks)
  • mpp-core/src/commonMain/kotlin/cc/unitmesh/agent/tool/Tool.kt (1 hunks)
  • mpp-core/src/commonMain/kotlin/cc/unitmesh/agent/tool/impl/ProcessManagementTools.kt (1 hunks)
  • mpp-core/src/commonMain/kotlin/cc/unitmesh/agent/tool/impl/ShellTool.kt (6 hunks)
  • mpp-core/src/commonMain/kotlin/cc/unitmesh/agent/tool/schema/ToolResultFormatter.kt (2 hunks)
  • mpp-core/src/commonMain/kotlin/cc/unitmesh/agent/tool/shell/AnsiStripper.kt (1 hunks)
  • mpp-core/src/commonMain/kotlin/cc/unitmesh/agent/tool/shell/LiveShellSession.kt (2 hunks)
  • mpp-core/src/commonMain/kotlin/cc/unitmesh/agent/tool/shell/ShellSessionManager.kt (1 hunks)
  • mpp-core/src/commonMain/kotlin/cc/unitmesh/devins/compiler/service/DefaultDevInsCompilerService.kt (1 hunks)
  • mpp-core/src/commonMain/kotlin/cc/unitmesh/devins/compiler/service/DevInsCompilerService.kt (1 hunks)
  • mpp-core/src/commonMain/kotlin/cc/unitmesh/llm/KoogLLMService.kt (3 hunks)
  • mpp-core/src/jsMain/kotlin/cc/unitmesh/llm/JsExports.kt (1 hunks)
  • mpp-core/src/jvmMain/kotlin/cc/unitmesh/agent/tool/shell/DefaultShellExecutor.jvm.kt (2 hunks)
  • mpp-core/src/jvmMain/kotlin/cc/unitmesh/agent/tool/shell/PtyShellExecutor.kt (2 hunks)
  • mpp-core/src/jvmTest/kotlin/cc/unitmesh/devins/compiler/service/DevInsCompilerServiceTest.kt (1 hunks)
  • mpp-idea/src/main/kotlin/cc/unitmesh/devins/idea/compiler/IdeaDevInsCompilerService.kt (1 hunks)
  • mpp-idea/src/main/kotlin/cc/unitmesh/devins/idea/components/status/IdeaToolLoadingStatusBar.kt (2 hunks)
  • mpp-idea/src/main/kotlin/cc/unitmesh/devins/idea/components/timeline/IdeaLiveTerminalBubble.kt (1 hunks)
  • mpp-idea/src/main/kotlin/cc/unitmesh/devins/idea/components/timeline/IdeaTimelineContent.kt (4 hunks)
  • mpp-idea/src/main/kotlin/cc/unitmesh/devins/idea/editor/IdeaBottomToolbar.kt (2 hunks)
  • mpp-idea/src/main/kotlin/cc/unitmesh/devins/idea/editor/IdeaContextManager.kt (1 hunks)
  • mpp-idea/src/main/kotlin/cc/unitmesh/devins/idea/editor/IdeaDevInInput.kt (1 hunks)
  • mpp-idea/src/main/kotlin/cc/unitmesh/devins/idea/editor/IdeaFileSearchPopup.kt (1 hunks)
  • mpp-idea/src/main/kotlin/cc/unitmesh/devins/idea/editor/IdeaMcpConfigDialog.kt (9 hunks)
  • mpp-idea/src/main/kotlin/cc/unitmesh/devins/idea/editor/IdeaPromptEnhancer.kt (1 hunks)
  • mpp-idea/src/main/kotlin/cc/unitmesh/devins/idea/editor/IdeaTopToolbar.kt (4 hunks)
  • mpp-idea/src/main/kotlin/cc/unitmesh/devins/idea/renderer/JewelRenderer.kt (2 hunks)
  • mpp-idea/src/main/kotlin/cc/unitmesh/devins/idea/renderer/sketch/IdeaCodeBlockRenderer.kt (3 hunks)
  • mpp-idea/src/main/kotlin/cc/unitmesh/devins/idea/renderer/sketch/IdeaDiffRenderer.kt (3 hunks)
  • mpp-idea/src/main/kotlin/cc/unitmesh/devins/idea/renderer/sketch/IdeaMermaidRenderer.kt (1 hunks)
  • mpp-idea/src/main/kotlin/cc/unitmesh/devins/idea/renderer/sketch/IdeaPlanRenderer.kt (1 hunks)
  • mpp-idea/src/main/kotlin/cc/unitmesh/devins/idea/renderer/sketch/IdeaSketchRenderer.kt (6 hunks)
  • mpp-idea/src/main/kotlin/cc/unitmesh/devins/idea/renderer/sketch/IdeaTerminalRenderer.kt (1 hunks)
  • mpp-idea/src/main/kotlin/cc/unitmesh/devins/idea/renderer/sketch/actions/IdeaCodeActions.kt (1 hunks)
  • mpp-idea/src/main/kotlin/cc/unitmesh/devins/idea/renderer/sketch/actions/IdeaDiagramActions.kt (1 hunks)
  • mpp-idea/src/main/kotlin/cc/unitmesh/devins/idea/renderer/sketch/actions/IdeaDiffActions.kt (1 hunks)
  • mpp-idea/src/main/kotlin/cc/unitmesh/devins/idea/renderer/sketch/actions/IdeaPlanActions.kt (1 hunks)
  • mpp-idea/src/main/kotlin/cc/unitmesh/devins/idea/renderer/sketch/actions/IdeaTerminalActions.kt (1 hunks)
  • mpp-idea/src/main/kotlin/cc/unitmesh/devins/idea/services/IdeaToolConfigService.kt (1 hunks)
  • mpp-idea/src/main/kotlin/cc/unitmesh/devins/idea/toolwindow/IdeaAgentApp.kt (2 hunks)
  • mpp-idea/src/main/kotlin/cc/unitmesh/devins/idea/toolwindow/IdeaAgentViewModel.kt (6 hunks)
  • mpp-idea/src/main/kotlin/cc/unitmesh/devins/idea/toolwindow/IdeaComposeIcons.kt (1 hunks)
  • mpp-idea/src/main/kotlin/cc/unitmesh/devins/idea/toolwindow/IdeaDevInInputArea.kt (1 hunks)
  • mpp-idea/src/main/kotlin/cc/unitmesh/devins/idea/toolwindow/codereview/IdeaAnalysisComponents.kt (2 hunks)
  • mpp-idea/src/main/resources/META-INF/plugin.xml (1 hunks)
  • mpp-ui/src/commonMain/kotlin/cc/unitmesh/devins/ui/compose/agent/ComposeRenderer.kt (1 hunks)
  • mpp-ui/src/jvmMain/kotlin/cc/unitmesh/server/cli/CodingCli.kt (2 hunks)

Comment @coderabbitai help to get the list of available commands and usage tips.

@phodal phodal merged commit 6e071b5 into unit-mesh:master Dec 2, 2025
3 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant