This repository was archived by the owner on Feb 25, 2026. It is now read-only.
feat(vscode): Wire up OpenCode chat UI in webview (2)#143
Closed
markijbema wants to merge 8 commits intomark/copy-files-from-appfrom
Closed
feat(vscode): Wire up OpenCode chat UI in webview (2)#143markijbema wants to merge 8 commits intomark/copy-files-from-appfrom
markijbema wants to merge 8 commits intomark/copy-files-from-appfrom
Conversation
7b228c0 to
cc14ca0
Compare
- Add typed message protocol for webview ↔ extension communication - Implement webview-side transport layer with Solid.js context - Implement extension-host ChatController bridging to CLI backend - Create minimal ChatView component with message timeline and prompt input - Configure TypeScript path aliases and add required dependencies - Add NOTES.md documentation
- Remove disabled state from PromptInput (was disabled during loading) - Add try/catch to loadSession to ensure isLoading is reset on error - Users can now type while session is loading
- Replace basic inline components with @opencode-ai/ui components: - Button, IconButton, Icon for UI elements - BasicTool for tool call display with collapsible details - Tooltip for hover information - Spinner for loading states - Card for permission requests - Collapsible for reasoning sections - Mark logo component - createAutoScroll hook for auto-scrolling - Import Tailwind CSS from @opencode-ai/ui/styles/tailwind - Add font loaders (woff, woff2, ttf, eot, svg) to esbuild config - Improve message layout with proper spacing and styling - Add empty state with suggested actions - Better session header with status indicator - Improved prompt input with keyboard shortcuts display - Better permission request UI with Card component
The createAutoScroll hook from @opencode-ai/ui requires a working() function in its options object. Replace with a simple scrollToBottom implementation to fix the black screen issue.
- Update ChatView to use semantic CSS variables from the UI library: - --background-base, --background-weak instead of --color-background-* - --text-base, --text-weak, --text-strong instead of --color-text-* - --border-base, --border-weak-base instead of --color-border - --surface-* variables for raised/inset surfaces - --icon-* variables for icon colors - Force dark mode in chat-view.css with color-scheme: dark - Fix Invalid Date issue by adding safe formatTime helper - Remove unused createMemo import
The @opencode-ai/ui components were rendering with white backgrounds because the CSS uses @media (prefers-color-scheme: dark) which doesn't work reliably in VSCode webviews. This fix: - Wraps the App with ThemeProvider from @opencode-ai/ui/theme - Adds DarkModeEnforcer component that explicitly sets dark color scheme on mount - The ThemeProvider dynamically injects dark theme CSS variables, bypassing the media query issue
- Fixed HTML template in KiloProvider.ts to properly set up height chain for flex layout (html/body/root all need height: 100%) - Added box-sizing reset and removed conflicting padding/centering styles - Changed ChatView from h-screen to h-full for proper webview sizing - Added min-h-0 to flex children to prevent overflow issues - Removed inline style override from App.tsx container
8657bc6 to
4a1f2d1
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR wires up the OpenCode chat UI in the VS Code extension webview, establishing the communication layer between the webview and the extension host, which in turn bridges to the CLI backend.
Key Changes
New Files
src/shared/chat-protocol.ts- Typed message protocol for webview ↔ extension communicationsrc/controllers/ChatController.ts- Extension-host controller bridging webview to CLI backendwebview-ui/src/transport/- Webview-side transport layer with Solid.js contextwebview-ui/src/views/ChatView.tsx- Minimal chat UI component with message timeline and prompt inputNOTES.md- Architecture documentationModified Files
esbuild.js- Added alias plugin for@/importspackage.json- Added dependencies (solid-js, eventsource)webview-ui/tsconfig.json- Added path aliasessrc/KiloProvider.ts- Updated to use ChatControllerwebview-ui/src/App.tsx- Updated to render ChatView with TransportProviderArchitecture
Known Limitations
Testing Instructions
pnpm compileNext Steps