forked from smallcloudai/refact
-
-
Notifications
You must be signed in to change notification settings - Fork 4
GUI IDE Integration
refact-planner edited this page Jun 7, 2026
·
1 revision
The GUI exchanges typed messages with host environments through postMessage-style transport and event bus hooks.
src/hooks/usePostMessage.ts selects one transport at runtime:
- VS Code:
window.acquireVsCodeApi().postMessage - JetBrains:
window.postIntellijMessage - Web fallback:
window.postMessage(message, "*")
The authoritative host modes are:
webvscodejetbrainside
-
useEventBusForApplistens towindow.messageand routes IDE-originating actions into Redux. -
useEventBusForIDEbuilds GUI-originating action objects and sends them through the transport. -
usePostMessageis the transport abstraction.
useEventBusForApp handles these actions/messages from the IDE side:
updateConfigsetFileInfosetSelectedSnippetnewChatActionideToolCallResponse
It also dispatches setCurrentProjectInfo and ideSwitchToThread handling in the same listener.
useEventBusForIDE emits these messages outward:
ideOpenFileideDiffPasteBackideToolCallideNewFileideOpenSettingsideOpenHotKeysideOpenChatInNewTabideOpenChatInBrowserideOpenFolderInNewWindowideAnimateFileStartideAnimateFileStopideChatPageChangeideEscapeKeyPressedideIsChatStreamingideIsChatReadyideForceReloadFileByPathideSetCodeCompletionModelideSetLoginMessageideTaskDoneideAskQuestions
flowchart LR
IDE[Host IDE] -- window.message --> App[useEventBusForApp]
App --> Redux[Redux actions/state]
Redux --> IDEHooks[useEventBusForIDE]
IDEHooks -- postMessage --> IDE
-
useEventBusForAppensures the chat page is pushed into the navigation stack before opening a new chat or switching threads when needed. -
useEventBusForIDEcan resolve a file path before sendingideOpenFileby querying the path API. - The integration is message-based; no direct IDE SDK dependency is required in the app components themselves.
Refact on GitHub: https://github.com/JegernOUTT/refact
- Agent Modes
- Agent Tools
- Task Planner & Cards
- Worktrees
- Subagents
- Memory & Knowledge
- Hidden Roles & Plans
- Context Compression
- Scheduler & Cron
- Processes & PTY
- Buddy
- MCP
- Skills, Commands & Hooks
- Marketplace
- Chat System
- Providers
- Caps & Models
- Code Completion (FIM)
- AST
- VecDB
- Exec Runtime
- HTTP API
- Checkpoints & Git
- Voice