opencode
opencode copied to clipboard
feat(plugin): add sidebar panel API for plugins
Summary
Adds a plugin API that allows plugins to register custom panels in the sidebar.
Closes #5971
Changes
- Add
SidebarPanelandSidebarPanelItemtypes to@opencode-ai/plugin - Add
sidebarhook for plugins to register panels - Add
GET /plugin/sidebarserver 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.