feat: youhua frontend

This commit is contained in:
WangCham
2026-05-07 18:19:48 +08:00
parent 188511a911
commit e412ed5527
11 changed files with 698 additions and 149 deletions

View File

@@ -28,6 +28,7 @@ export interface PluginInstallTask {
source: 'github' | 'marketplace' | 'local';
stage: InstallStage;
overallProgress: number; // 0-100
extensionType: 'plugin' | 'mcp' | 'skill'; // type of extension being installed
fileSize?: number; // bytes, if known
// Download progress
downloadCurrent?: number; // bytes downloaded so far
@@ -53,6 +54,7 @@ interface PluginInstallTaskContextValue {
taskId: number;
pluginName: string;
source: 'github' | 'marketplace' | 'local';
extensionType: 'plugin' | 'mcp' | 'skill';
fileSize?: number;
}) => void;
removeTask: (id: string) => void;
@@ -131,7 +133,7 @@ function extractSourceFromName(
* Check if a backend task name is a plugin install task.
*/
function isPluginInstallTask(name: string): boolean {
return name.startsWith('plugin-install-');
return name.startsWith('plugin-install-') || name.startsWith('mcp-install-') || name.startsWith('skill-install-');
}
/**
@@ -165,13 +167,21 @@ function asyncTaskToPluginInstallTask(task: AsyncTask): PluginInstallTask {
overallProgress = Math.min(95, stageToProgress(stage));
}
const pluginName = str(md.plugin_name) || task.label || `${source} plugin`;
const pluginName = str(md.plugin_name) || task.label || `${source} extension`;
let extensionType: 'plugin' | 'mcp' | 'skill' = 'plugin';
if (task.name.startsWith('mcp-install-')) {
extensionType = 'mcp';
} else if (task.name.startsWith('skill-install-')) {
extensionType = 'skill';
}
return {
id: `${source}-${task.id}`,
taskId: task.id,
pluginName,
source,
extensionType,
stage,
overallProgress,
downloadCurrent: num(md.download_current),
@@ -388,6 +398,7 @@ export function PluginInstallTaskProvider({
converted.startedAt = existing.startedAt;
converted.pluginName = existing.pluginName;
converted.fileSize = existing.fileSize;
converted.extensionType = existing.extensionType;
updatedTasks[idx] = converted;
}
}
@@ -433,6 +444,7 @@ export function PluginInstallTaskProvider({
taskId: number;
pluginName: string;
source: 'github' | 'marketplace' | 'local';
extensionType: 'plugin' | 'mcp' | 'skill';
fileSize?: number;
}) => {
const taskKey = `${params.source}-${params.taskId}`;
@@ -445,6 +457,7 @@ export function PluginInstallTaskProvider({
taskId: params.taskId,
pluginName: params.pluginName,
source: params.source,
extensionType: params.extensionType,
stage: InstallStage.DOWNLOADING,
overallProgress: 5,
fileSize: params.fileSize,