Skip to content

GUI State Management

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

GUI State Management

Redux state is split into feature slices, chat-thread runtime, selectors, and RTK Query APIs with very little persisted state.

Store composition

src/app/store.ts uses combineSlices with 12+ slices plus 20+ RTK Query APIs.

Root pieces

  • feature reducers: config, active_file, current_project, sidebar, selected_snippet, chat, history, pages, integrationsSlice, checkpointsSlice, patchesAndDiffsTrackerSlice, tasksSlice, connectionSlice, browserSlice, notificationsSlice, schedulerSlice, buddySlice, errorSlice, informationSlice
  • RTK Query reducers: statsApi, capsApi, promptsApi, toolsApi, commandsApi, pathApi, pingApi, linksApi, checkpointsApi, knowledgeApi, knowledgeGraphApi, providersApi, modelsApi, trajectoriesApi, trajectoryApi, tasksApi, schedulerApi, taskMemoriesApi, taskDocumentsApi, browserApi, worktreesApi, skillsStatusApi, mcpServerInfoApi, chatModesApi, customizationApi, projectInformationApi, setupStatusApi, extensionsApi, pluginsApi, mcpMarketplaceApi, extensionsMarketplaceApi, memoryEnrichmentApi, buddyApi

Chat state model

Per-thread runtime lives in state.chat.threads[id] as ChatThreadRuntime.

state.chat.threads[id] = {
  thread,
  streaming,
  waiting_for_response,
  prevent_send,
  error,
  queued_items,
  confirmation,
  snapshot_received,
}

Additional thread-runtime fields in the code include things like send_immediately, attachments, background agents, compression flags, session_state, and message indexes.

Navigation fields

  • current_thread_id
  • open_thread_ids
  • threads map

These drive tab switching and allow threads to continue processing even when not visible.

Selector-first convention

The codebase expects selectors to be used instead of directly reading state.chat.threads[id] in UI code.

Hidden-role selectors

  • selectVisibleMessages(state, threadId) — excludes event and plan messages
  • selectEventLog(state, threadId) — returns normalized event messages, excluding plan_delta
  • selectCurrentPlan(state, threadId) — returns the latest base plan for plan UI
  • selectPlanDeltaEvents(state, threadId) — returns hidden event(plan_delta) messages
  • selectSynthesizedPlanText(state, threadId) — merges plan text with plan-delta notes
  • selectPlanHistory(state, threadId) — returns base plan followed by plan-delta events

Persistence

Redux Persist is configured with a root whitelist of only:

  • tour
  • userSurvey

Chat/history are intentionally ephemeral and not persisted.

RTK Query API table

API Typical endpoints
capsApi /v1/caps
commandsApi /v1/at-command-completion, /v1/at-command-preview
toolsApi /v1/tools, /v1/tools/check_confirmation
dockerApi /v1/docker-container-list, /v1/docker-container-action
integrationsApi /v1/integrations-list, /v1/integration-get, /v1/integration-save
modelsApi, providersApi /v1/customization
checkpointsApi /v1/preview_checkpoints, /v1/restore_checkpoints
linksApi /v1/links
trajectoriesApi, trajectoryApi /v1/trajectories/*
tasksApi task CRUD
chatModesApi, customizationApi agent modes/customization
knowledgeApi, knowledgeGraphApi knowledge/memory

Related pages

Clone this wiki locally