From 4ff339d9fc1f463b03c4a71afb92bb4a76e07d35 Mon Sep 17 00:00:00 2001 From: xintaofei Date: Sun, 12 Apr 2026 10:26:51 +0800 Subject: [PATCH] feat(frontend): add opencode plugin types and API methods Co-Authored-By: Claude Sonnet 4.6 --- src/lib/api.ts | 21 +++++++++++++++++++++ src/lib/types.ts | 27 +++++++++++++++++++++++++++ 2 files changed, 48 insertions(+) diff --git a/src/lib/api.ts b/src/lib/api.ts index 53af83b..73a21b0 100644 --- a/src/lib/api.ts +++ b/src/lib/api.ts @@ -60,6 +60,7 @@ import type { ChannelStatusInfo, ChatChannelMessageLog, ModelProviderInfo, + PluginCheckSummary, } from "./types" export async function listConversations(params?: { @@ -278,6 +279,26 @@ export async function acpPreflight( }) } +export async function opencodeListPlugins(): Promise { + return getTransport().call("opencode_list_plugins", {}) +} + +export async function opencodeInstallPlugins( + taskId: string, + names?: string[] | null +): Promise { + return getTransport().call("opencode_install_plugins", { + names: names ?? null, + taskId, + }) +} + +export async function opencodeUninstallPlugin( + name: string +): Promise { + return getTransport().call("opencode_uninstall_plugin", { name }) +} + export async function acpListAgentSkills(params: { agentType: AgentType workspacePath?: string | null diff --git a/src/lib/types.ts b/src/lib/types.ts index 306bc5c..fb269bf 100644 --- a/src/lib/types.ts +++ b/src/lib/types.ts @@ -885,6 +885,7 @@ export type FixActionKind = | "redownload_binary" | "retry_connection" | "open_agents_settings" + | "install_opencode_plugins" export interface FixAction { label: string @@ -909,6 +910,32 @@ export interface PreflightResult { checks: CheckItem[] } +// ─── OpenCode Plugins ─── + +export type PluginStatus = "installed" | "missing" + +export interface PluginInfo { + name: string + declared_spec: string + installed_version: string | null + status: PluginStatus +} + +export interface PluginCheckSummary { + config_path: string + cache_dir: string + plugins: PluginInfo[] + has_project_config_hint: boolean +} + +export type PluginInstallEventKind = "started" | "log" | "completed" | "failed" + +export interface PluginInstallEvent { + task_id: string + kind: PluginInstallEventKind + payload: string +} + // ─── Chat Channels ─── export type ChannelType = "lark" | "telegram" | "weixin"