feat: stream real-time progress for agent SDK install/upgrade/uninstall

Replace the spinner-only UX with live log output during agent SDK
operations, matching the existing OpenCode plugin install experience.

Backend: emit structured events (started/log/completed/failed) via
EventEmitter during npm install and binary download. npm commands now
run with piped stdio for line-by-line streaming; binary downloads
report chunked progress every 1 MB.

Frontend: subscribe to `app://agent-install` events through a new
`useAgentInstallStream` hook and render a theme-aware log terminal
below the preflight checks panel.

Also fixes the install log container in both agent settings and the
OpenCode plugins modal: auto-scroll no longer shifts the outer page,
and colours now follow the active light/dark theme.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
xintaofei
2026-04-12 21:43:54 +08:00
parent 6c69f432b9
commit a763adaf36
10 changed files with 541 additions and 118 deletions

View File

@@ -172,9 +172,10 @@ export async function acpClearBinaryCache(agentType: AgentType): Promise<void> {
}
export async function acpDownloadAgentBinary(
agentType: AgentType
agentType: AgentType,
taskId: string
): Promise<void> {
return invoke("acp_download_agent_binary", { agentType })
return invoke("acp_download_agent_binary", { agentType, taskId })
}
export async function acpDetectAgentLocalVersion(
@@ -185,16 +186,21 @@ export async function acpDetectAgentLocalVersion(
export async function acpPrepareNpxAgent(
agentType: AgentType,
registryVersion?: string | null
registryVersion: string | null | undefined,
taskId: string
): Promise<string> {
return invoke("acp_prepare_npx_agent", {
agentType,
registryVersion: registryVersion ?? null,
taskId,
})
}
export async function acpUninstallAgent(agentType: AgentType): Promise<void> {
return invoke("acp_uninstall_agent", { agentType })
export async function acpUninstallAgent(
agentType: AgentType,
taskId: string
): Promise<void> {
return invoke("acp_uninstall_agent", { agentType, taskId })
}
export async function acpUpdateAgentPreferences(