Files
CodeNomad/packages/opencode-config
Mateusz Popielarz 313e82880b feat(lazy loading): Implement virtual list with virtua (#241)
### Summary of Improvements

This PR replaces the custom `IntersectionObserver`-based virtualization
with the `virtua` library to significantly improve rendering performance
and UI responsiveness.

### 🚀 Performance Results

Verified using `session-performance.test.ts`:
- **Rendering**: 2000 messages rendered in **16.90ms**.
- **Huge Conversation**: 10,000 messages processed in **0.80ms**.
- **Session Switching**: Average switch time reduced to **0.58ms**
(virtually zero lag).

### 🛠️ Key Changes

- **Virtualized Message Stream**: Integrated `virtua/solid` for
efficient windowing and automatic scroll compensation.
- **Floating Scroll Controls**: Applied `position: absolute` and
`pointer-events: none` to the list controls to ensure
scroll-to-top/bottom buttons float correctly over the message area
without blocking interactions.
- **Package Synchronization**: Updated `virtua` and SDK dependencies,
with a fully synchronized `package-lock.json` for stable builds.

### 🎥 UI Verification


https://github.com/user-attachments/assets/24e483a3-8be6-4ac4-a431-d719f2015f4e


- **Smooth Scrolling**: Verified that rendering gaps are eliminated
during fast scrolls.
- **Position Retention**: Scroll positions are preserved when switching
between sessions.

> [!NOTE]
> Detailed performance gains and layout fixes are isolated to the
`virtua` implementation and core package updates, following the
requested cleanup.

---------

Co-authored-by: Shantur Rathore <i@shantur.com>
2026-03-20 22:46:05 +00:00
..

opencode-config

TLDR

Template config + plugins injected into every OpenCode instance that CodeNomad launches. It provides a CodeNomad bridge plugin for local event exchange between the CLI server and opencode.

What it is

A packaged config directory that CodeNomad copies into ~/.config/codenomad/opencode-config for production builds or uses directly in dev. OpenCode autoloads any plugin/*.ts or plugin/*.js from this directory.

How it works

  • CodeNomad sets OPENCODE_CONFIG_DIR when spawning each opencode instance (packages/server/src/workspaces/manager.ts).
  • This template is synced from packages/opencode-config (packages/server/src/opencode-config.ts, packages/server/scripts/copy-opencode-config.mjs).
  • OpenCode autoloads plugins from plugin/ (packages/opencode-config/plugin/codenomad.ts).
  • The CodeNomadPlugin reads CODENOMAD_INSTANCE_ID + CODENOMAD_BASE_URL, connects to GET /workspaces/:id/plugin/events, and posts to POST /workspaces/:id/plugin/event (packages/opencode-config/plugin/lib/client.ts).
  • The server exposes the plugin routes and maps events into the UI SSE pipeline (packages/server/src/server/routes/plugin.ts, packages/server/src/plugins/handlers.ts).

Expectations

  • Local-only bridge (no auth/token yet).
  • Plugin must fail startup if it cannot connect after 3 retries.
  • Keep plugin entrypoints thin; put shared logic under plugin/lib/ to avoid autoloaded helpers.
  • Keep event shapes small and explicit; use type + properties only.

Ideas

  • Add feature modules under plugin/lib/features/ (tool lifecycle, permission prompts, custom commands).
  • Expand /workspaces/:id/plugin/* with dedicated endpoints as needed.
  • Promote stable event shapes and version tags once the protocol settles.

Pointers

  • Plugin entry: packages/opencode-config/plugin/codenomad.ts
  • Plugin client: packages/opencode-config/plugin/lib/client.ts
  • Plugin server routes: packages/server/src/server/routes/plugin.ts
  • Plugin event handling: packages/server/src/plugins/handlers.ts
  • Workspace env injection: packages/server/src/workspaces/manager.ts