🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.
TypeScript agentagent-collaborationagent-harnessloop-engineeringmcppersonal-assistantproactive-agentskillssuper-agenttask-management
import { type LobeTool, type ToolManifest } from '@lobechat/types';
import { lambdaClient } from '@/libs/trpc/client';
import { type LobeToolCustomPlugin } from '@/types/tool/plugin';
export interface InstallPluginParams {
customParams?: Record<string, any>;
identifier: string;
manifest: ToolManifest;
settings?: Record<string, any>;
type: 'plugin' | 'customPlugin';
}
export class PluginService {
/**
* @deprecated No in-app caller: marketplace MCPs install as connectors
* (`connector.create`). Kept until the legacy create routes are removed.
*/
installPlugin = async (plugin: InstallPluginParams): Promise<void> => {
await lambdaClient.plugin.createOrInstallPlugin.mutate(plugin);
};
getInstalledPlugins = (): Promise<LobeTool[]> => {
return lambdaClient.plugin.getPlugins.query();
};
uninstallPlugin = async (identifier: string): Promise<void> => {
await lambdaClient.plugin.removePlugin.mutate({ id: identifier });
};
/**
* @deprecated No in-app caller: custom MCPs are added as connectors
* (`connector.create`). Kept until the legacy create routes are removed.
*/
createCustomPlugin = async (customPlugin: LobeToolCustomPlugin): Promise<void> => {
await lambdaClient.plugin.createPlugin.mutate({ ...customPlugin, type: 'customPlugin' });
};
updatePlugin = async (id: string, value: Partial<LobeToolCustomPlugin>): Promise<void> => {
await lambdaClient.plugin.updatePlugin.mutate({
customParams: value.customParams,
id,
manifest: value.manifest,
settings: value.settings,
});
};
updatePluginManifest = async (id: string, manifest: ToolManifest): Promise<void> => {
await lambdaClient.plugin.updatePlugin.mutate({ id, manifest });
};
updatePluginSettings = async (id: string, settings: any, signal?: AbortSignal): Promise<void> => {
await lambdaClient.plugin.updatePlugin.mutate({ id, settings }, { signal });
};
}
export const pluginService = new PluginService();