opencode icon indicating copy to clipboard operation
opencode copied to clipboard

feat(plugin): add sidebar panel API for plugins

Open z80dev opened this issue 3 weeks ago • 0 comments

Summary

Adds a plugin API that allows plugins to register custom panels in the sidebar.

Closes #5971

Changes

  • Add SidebarPanel and SidebarPanelItem types to @opencode-ai/plugin
  • Add sidebar hook for plugins to register panels
  • Add GET /plugin/sidebar server endpoint
  • Add Plugin.getSidebarPanels() to aggregate panels from all plugins
  • Render plugin panels in sidebar with collapse/expand support
  • Poll every 5 seconds for dynamic updates

Usage

import { definePlugin } from "@opencode-ai/plugin"

export default definePlugin({
  name: "my-plugin",
  hooks: {
    sidebar: [
      {
        id: "status",
        title: "My Plugin Status",
        items: [
          { label: "Version", value: "1.0.0" },
          { label: "Status", value: "Active", status: "success" }
        ]
      }
    ]
  }
})

Both sidebar and items can be functions for dynamic content.

z80dev avatar Dec 29 '25 19:12 z80dev