Skip to content

GUI IDE Integration

refact-planner edited this page Jun 7, 2026 · 1 revision

GUI IDE Integration

The GUI exchanges typed messages with host environments through postMessage-style transport and event bus hooks.

Transport layer

src/hooks/usePostMessage.ts selects one transport at runtime:

  • VS Code: window.acquireVsCodeApi().postMessage
  • JetBrains: window.postIntellijMessage
  • Web fallback: window.postMessage(message, "*")

Host modes

The authoritative host modes are:

  • web
  • vscode
  • jetbrains
  • ide

Event bus hooks

  • useEventBusForApp listens to window.message and routes IDE-originating actions into Redux.
  • useEventBusForIDE builds GUI-originating action objects and sends them through the transport.
  • usePostMessage is the transport abstraction.

IDE → GUI events

useEventBusForApp handles these actions/messages from the IDE side:

  • updateConfig
  • setFileInfo
  • setSelectedSnippet
  • newChatAction
  • ideToolCallResponse

It also dispatches setCurrentProjectInfo and ideSwitchToThread handling in the same listener.

GUI → IDE events

useEventBusForIDE emits these messages outward:

  • ideOpenFile
  • ideDiffPasteBack
  • ideToolCall
  • ideNewFile
  • ideOpenSettings
  • ideOpenHotKeys
  • ideOpenChatInNewTab
  • ideOpenChatInBrowser
  • ideOpenFolderInNewWindow
  • ideAnimateFileStart
  • ideAnimateFileStop
  • ideChatPageChange
  • ideEscapeKeyPressed
  • ideIsChatStreaming
  • ideIsChatReady
  • ideForceReloadFileByPath
  • ideSetCodeCompletionModel
  • ideSetLoginMessage
  • ideTaskDone
  • ideAskQuestions

Common flow

flowchart LR
  IDE[Host IDE] -- window.message --> App[useEventBusForApp]
  App --> Redux[Redux actions/state]
  Redux --> IDEHooks[useEventBusForIDE]
  IDEHooks -- postMessage --> IDE
Loading

Notes

  • useEventBusForApp ensures the chat page is pushed into the navigation stack before opening a new chat or switching threads when needed.
  • useEventBusForIDE can resolve a file path before sending ideOpenFile by querying the path API.
  • The integration is message-based; no direct IDE SDK dependency is required in the app components themselves.

Related pages

Clone this wiki locally