feat(frontend): add opencode plugin types and API methods

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
xintaofei
2026-04-12 10:26:51 +08:00
parent 996945223c
commit 4ff339d9fc
2 changed files with 48 additions and 0 deletions

View File

@@ -60,6 +60,7 @@ import type {
ChannelStatusInfo, ChannelStatusInfo,
ChatChannelMessageLog, ChatChannelMessageLog,
ModelProviderInfo, ModelProviderInfo,
PluginCheckSummary,
} from "./types" } from "./types"
export async function listConversations(params?: { export async function listConversations(params?: {
@@ -278,6 +279,26 @@ export async function acpPreflight(
}) })
} }
export async function opencodeListPlugins(): Promise<PluginCheckSummary> {
return getTransport().call("opencode_list_plugins", {})
}
export async function opencodeInstallPlugins(
taskId: string,
names?: string[] | null
): Promise<void> {
return getTransport().call("opencode_install_plugins", {
names: names ?? null,
taskId,
})
}
export async function opencodeUninstallPlugin(
name: string
): Promise<PluginCheckSummary> {
return getTransport().call("opencode_uninstall_plugin", { name })
}
export async function acpListAgentSkills(params: { export async function acpListAgentSkills(params: {
agentType: AgentType agentType: AgentType
workspacePath?: string | null workspacePath?: string | null

View File

@@ -885,6 +885,7 @@ export type FixActionKind =
| "redownload_binary" | "redownload_binary"
| "retry_connection" | "retry_connection"
| "open_agents_settings" | "open_agents_settings"
| "install_opencode_plugins"
export interface FixAction { export interface FixAction {
label: string label: string
@@ -909,6 +910,32 @@ export interface PreflightResult {
checks: CheckItem[] 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 ─── // ─── Chat Channels ───
export type ChannelType = "lark" | "telegram" | "weixin" export type ChannelType = "lark" | "telegram" | "weixin"