Skip to content

feat(app): load configured GUI plugins in Desktop - #58472

Closed
mortezaPRK wants to merge 4 commits into
anomalyco:devfrom
mortezaPRK:gui-desktop
Closed

mortezaPRK wants to merge 4 commits into
anomalyco:devfrom
mortezaPRK:gui-desktop

Conversation

@mortezaPRK

@mortezaPRK mortezaPRK commented Oct 23, 2026 •

Copy link
Copy Markdown

Issue for this PR

Related: #55246.

Stacked on #58471.

I could not open the rest of this stack here because of limits on my account. It is in my fork for now: sidebar, header, panels, menus, main-process entries.

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Desktop loads the configured GUI plugins from its built-in server after startup and registers them with the existing extension host. Through @opencode/plugin/gui a plugin can add commands, open interactive dialogs, keep plugin-scoped storage and open sessions in app tabs. Cleanup runs when a plugin is removed or reloaded. Plugins come from the built-in server; web builds and remote servers are skipped.

flowchart LR
  S["Built-in server: plugin.list / plugin.gui"] --> L["Desktop loader"]
  L --> E["Existing extension host"]
  E --> P["Plugin setup: @opencode/plugin/gui"]
  P --> U["Commands + interactive dialogs"]
  P --> K["Plugin-scoped storage"]
  P --> N["sessions.open -> app tabs"]
  E --> X["Cleanup on removal / reload"]
Loading

How did you verify your code works?

  • bun run check and bun run lint:changed pass on this branch.
  • packages/app/component-tests/extension-host.spec.ts covers loading, commands, dialogs and cleanup.

The flow ran under Playwright against the production Electron build in a Tart macOS VM (1 passed). The manual version is below; it uses the command and dialog example from mortezaPRK#4, which contains this layer.

# Host: check out the example PR (it contains this layer) and boot a Tart macOS VM with it mounted read-only
gh pr checkout 4 --repo mortezaPRK/opencode
tart run oc-test --dir="source:$PWD:ro"

# VM: copy the checkout and build Desktop (needs Node and Bun 1.4.4)
mkdir -p ~/gui-e2e
rsync -a --exclude=.git --exclude=node_modules --exclude=out --exclude=dist \
  "/Volumes/My Shared Files/source/" ~/gui-e2e/
cd ~/gui-e2e
bun install --frozen-lockfile --ignore-scripts
node packages/desktop/node_modules/electron/install.js
(cd packages/desktop && OPENCODE_CHANNEL=local OPENCODE_VERSION=2.1.4 bun run build)

# VM: throwaway profile with the example enabled in the global config
export OPENCODE_DESKTOP_TEST_ROOT="$(mktemp -d)"
export OPENCODE_CONFIG_DIR="$OPENCODE_DESKTOP_TEST_ROOT/config"
export OPENCODE_DB="$OPENCODE_DESKTOP_TEST_ROOT/data/opencode.db"
export OPENCODE_TEST_HOME="$OPENCODE_DESKTOP_TEST_ROOT/home"
mkdir -p "$OPENCODE_CONFIG_DIR" "$OPENCODE_TEST_HOME" "$OPENCODE_DESKTOP_TEST_ROOT"/{data,desktop}
printf '{"plugins":["%s/packages/plugins/project-sessions"]}' "$PWD" > "$OPENCODE_CONFIG_DIR/opencode.json"
printf '{"firstLaunchOnboardingComplete":true}' > "$OPENCODE_DESKTOP_TEST_ROOT/desktop/opencode.settings"
export OPENCODE_DESKTOP_CLI_DEV="$PWD/packages/cli"
export OPENCODE_DESKTOP_ISOLATED_SERVER=1 OPENCODE_DESKTOP_SERVER_CHANNEL=local
export OPENCODE_DESKTOP_DISABLE_PROTOCOL_REGISTRATION=1 OPENCODE_TEST_ONBOARDING=0

# VM: start Desktop
node packages/desktop/node_modules/electron/cli.js packages/desktop
# In the app: create a session in each of two Git projects, press Cmd+Shift+P and run
# "Sessions by project". Both projects are listed; picking a session opens its tab.

Screenshots / recordings

Screenshot: mortezaPRK#4 (command and dialog example).

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@github-actions github-actions Bot added the needs:compliance This means the issue will auto-close after 2 hours. label Oct 23, 2026
@github-actions github-actions Bot removed the needs:compliance This means the issue will auto-close after 2 hours. label Oct 23, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

@mortezaPRK mortezaPRK closed this Oct 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant