-
Notifications
You must be signed in to change notification settings - Fork 0
React Webview State and Messaging
YarCraSy edited this page Jul 12, 2026
·
3 revisions
The UI uses src/ui/Chat/src/VsCodeApi.ts and postMessage.
-
useMessageHandler: processes messages from the backend. -
useStreamHandler: accumulates chunks and reasoning, then renders text progressively so transport chunk boundaries are not exposed directly to the user. -
useChatConfig: loads and maintains configuration. -
useToolCallController: coordinates approvals and results. -
FileSelector: renders path autocomplete suggestions for./and../.
- Do not access the filesystem directly from React.
- Do not store API keys in localStorage.
- Avoid duplicating contracts outside
src/adapters/message.ts. - Backend errors should be shown without blocking the whole UI.
- Local state should be rebuildable from
configLoaded,history, andconversationLoaded. - Chat state remains mounted while switching between Chat, History, and Settings so pending generation and tool confirmations are not lost.
- Cancelled generation should restore the cancelled prompt to the input and remove the cancelled turn from visible chat state.