Webview
Tauren's UI is a VS Code webview backed by browser code in src/webview.
Host and browser split
The extension host creates and manages the webview. Browser code handles DOM interaction inside the sidebar.
Host-side files:
src/sidebar/chatWebview.tsbuilds the webview HTML.src/sidebar/chatWebviewStyles.tsandsrc/sidebar/styles/define static CSS.src/sidebar/nonce.tscreates CSP nonces.src/webviewProtocol/types.tsdefines shared messages and state.
Browser-side files:
src/webview/main.tsis the ready/composition entrypoint.src/webview/composer/owns prompt input behavior.src/webview/messages/owns transcript rendering.src/webview/sessions/owns session list and tree UI.src/webview/settings/owns settings UI.src/webview/customUI/owns Pi extension custom UI rendering.
Bundling
Browser code is bundled with esbuild:
sh
npm run compile:webviewThe output is:
text
resources/webview/chat.jsGenerated first-party webview assets belong under resources/webview. Vendored browser-only libraries live under resources/vendor.
Rendering expectations
The webview should feel VS Code-native:
- use VS Code CSS variables,
- preserve keyboard-first workflows,
- keep code readable when syntax highlighting fails,
- avoid broad frontend rewrites without a clear goal,
- do not queue follow-up prompts while Pi is streaming.
Markdown and highlighting
Markdown rendering lives under src/webview/messages/. Syntax highlighting is done asynchronously by extension-host Shiki code in src/highlighting/shikiCodeRenderer.ts.
If highlighting fails, code must remain readable as plain text.
Protocol changes
When adding webview messages or state:
- update shared types in
src/webviewProtocol/types.ts, - update host-side parsing/dispatch,
- update browser-side handling,
- add tests for parsing or behavior where practical.