Skip to content

🤯 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.

🌐 chore: translate non-English comments to English in src/store/tool (#11766)

LobeHub Bot70a086782ed4
diff --git a/src/store/tool/selectors/tool.ts b/src/store/tool/selectors/tool.ts
index 97fda92452d..223f9080df8 100644
--- a/src/store/tool/selectors/tool.ts
+++ b/src/store/tool/selectors/tool.ts
@@ -41,7 +41,7 @@ const getManifestById =
.concat(s.builtinTools.map((b) => b.manifest as LobeChatPluginManifest))
.find((i) => i.identifier === id);
-// 获取插件 manifest 加载状态
+// Get plugin manifest loading status
const getManifestLoadingStatus = (id: string) => (s: ToolStoreState) => {
const manifest = getManifestById(id)(s);
diff --git a/src/store/tool/slices/builtin/selectors.ts b/src/store/tool/slices/builtin/selectors.ts
index 443000be978..23063e6794e 100644
--- a/src/store/tool/slices/builtin/selectors.ts
+++ b/src/store/tool/slices/builtin/selectors.ts
@@ -32,13 +32,13 @@ const getKlavisMetas = (s: ToolStoreState): LobeToolMeta[] =>
.filter((server) => server.status === KlavisServerStatus.CONNECTED && server.tools?.length)
.map((server) => ({
author: 'Klavis',
- // 使用 identifier 作为存储标识符(如 'google-calendar')
+ // Use identifier as storage identifier (e.g., 'google-calendar')
identifier: server.identifier,
meta: {
avatar: '☁️',
description: `LobeHub Mcp Server: ${server.serverName}`,
tags: ['klavis', 'mcp'],
- // title 仍然使用 serverName 显示友好名称
+ // title still uses serverName to display friendly name
title: server.serverName,
},
type: 'builtin' as const,
diff --git a/src/store/tool/slices/klavisStore/action.ts b/src/store/tool/slices/klavisStore/action.ts
index eb79cb9cfa8..a681d99d9a0 100644
--- a/src/store/tool/slices/klavisStore/action.ts
+++ b/src/store/tool/slices/klavisStore/action.ts
@@ -25,37 +25,37 @@ const n = setNamespace('klavisStore');
*/
export interface KlavisStoreAction {
/**
- * 调用 Klavis 工具
+ * Call Klavis tool
*/
callKlavisTool: (params: CallKlavisToolParams) => Promise<CallKlavisToolResult>;
/**
- * 完成 OAuth 认证后,更新服务器状态
- * @param identifier - 服务器标识符 (e.g., 'google-calendar')
+ * Complete OAuth authentication and update server status
+ * @param identifier - Server identifier (e.g., 'google-calendar')
*/
completeKlavisServerAuth: (identifier: string) => Promise<void>;
/**
- * 创建单个 Klavis MCP Server 实例
- * @returns 创建的服务器实例,如果需要 OAuth 则返回带 oauthUrl 的对象
+ * Create a single Klavis MCP Server instance
+ * @returns Created server instance, or object with oauthUrl if OAuth is required
*/
createKlavisServer: (params: CreateKlavisServerParams) => Promise<KlavisServer | undefined>;
/**
- * 刷新 Klavis Server 的工具列表
- * @param identifier - 服务器标识符 (e.g., 'google-calendar')
+ * Refresh Klavis Server tool list
+ * @param identifier - Server identifier (e.g., 'google-calendar')
*/
refreshKlavisServerTools: (identifier: string) => Promise<void>;
/**
- * 删除 Klavis Server
- * @param identifier - 服务器标识符 (e.g., 'google-calendar')
+ * Remove Klavis Server
+ * @param identifier - Server identifier (e.g., 'google-calendar')
*/
removeKlavisServer: (identifier: string) => Promise<void>;
/**
- * 使用 SWR 获取用户的 Klavis 服务器列表
- * @param enabled - 是否启用获取
+ * Use SWR to fetch user's Klavis server list
+ * @param enabled - Whether to enable fetching
*/
useFetchUserKlavisServers: (enabled: boolean) => SWRResponse<KlavisServer[]>;
}
@@ -80,7 +80,7 @@ export const createKlavisStoreSlice: StateCreator<
);
try {
- // 调用 tRPC 服务端接口执行工具(使用 toolsClient 以获得更长的超时时间)
+ // Call tRPC server interface to execute tool (use toolsClient for longer timeout)
const response = await toolsClient.klavis.callTool.mutate({
serverUrl,
toolArgs,
@@ -117,7 +117,7 @@ export const createKlavisStoreSlice: StateCreator<
},
completeKlavisServerAuth: async (identifier) => {
- // OAuth 完成后,刷新工具列表
+ // After OAuth completes, refresh tool list
await get().refreshKlavisServerTools(identifier);
},
@@ -133,14 +133,14 @@ export const createKlavisStoreSlice: StateCreator<
);
try {
- // 调用 tRPC 服务端接口创建单个服务器实例
+ // Call tRPC server interface to create single server instance
const response = await lambdaClient.klavis.createServerInstance.mutate({
identifier,
serverName,
userId,
});
- // 构建服务器对象
+ // Build server object
const server: KlavisServer = {
createdAt: Date.now(),
identifier: response.identifier,
@@ -154,10 +154,10 @@ export const createKlavisStoreSlice: StateCreator<
: KlavisServerStatus.PENDING_AUTH,
};
- // 添加到 servers 列表
+ // Add to servers list
set(
produce((draft: KlavisStoreState) => {
- // 检查是否已存在(使用 identifier),如果存在则更新
+ // Check if already exists (using identifier), update if exists
const existingIndex = draft.servers.findIndex((s) => s.identifier === identifier);
if (existingIndex >= 0) {
draft.servers[existingIndex] = server;
@@ -189,7 +189,7 @@ export const createKlavisStoreSlice: StateCreator<
refreshKlavisServerTools: async (identifier) => {
const { servers } = get();
- // 使用 identifier 查找服务器
+ // Find server using identifier
const server = servers.find((s) => s.identifier === identifier);
if (!server) {
console.error('[Klavis] Server not found:', identifier);
@@ -205,19 +205,19 @@ export const createKlavisStoreSlice: StateCreator<
);
try {
- // 首先检查服务器的认证状态
+ // First check server authentication status
const instanceStatus = await lambdaClient.klavis.getServerInstance.query({
instanceId: server.instanceId,
});
- // 如果认证失败,删除服务器并重置状态
+ // If authentication failed, remove server and reset status
if (!instanceStatus.isAuthenticated) {
if (!instanceStatus.authNeeded) {
- // 如果不需要认证,说明没问题
+ // If no authentication needed, all is well
return;
}
- // 从本地状态移除(使用 identifier)
+ // Remove from local state (using identifier)
set(
produce((draft: KlavisStoreState) => {
draft.servers = draft.servers.filter((s) => s.identifier !== identifier);
@@ -227,7 +227,7 @@ export const createKlavisStoreSlice: StateCreator<
n('refreshKlavisServerTools/authFailed'),
);
- // 从数据库删除
+ // Delete from database
await lambdaClient.klavis.deleteServerInstance.mutate({
identifier,
instanceId: server.instanceId,
@@ -236,7 +236,7 @@ export const createKlavisStoreSlice: StateCreator<
return;
}
- // 认证成功,获取工具列表(使用 toolsClient 以获得更长的超时时间)
+ // Authentication successful, get tool list (use toolsClient for longer timeout)
const response = await toolsClient.klavis.listTools.query({
serverUrl: server.serverUrl,
});
@@ -245,7 +245,7 @@ export const createKlavisStoreSlice: StateCreator<
set(
produce((draft: KlavisStoreState) => {
- // 使用 identifier 查找服务器
+ // Find server using identifier
const serverIndex = draft.servers.findIndex((s) => s.identifier === identifier);
if (serverIndex >= 0) {
draft.servers[serverIndex].tools = tools;
@@ -259,7 +259,7 @@ export const createKlavisStoreSlice: StateCreator<
n('refreshKlavisServerTools/success'),
);
- // 更新数据库中的工具列表和认证状态
+ // Update tool list and authentication status in database
await lambdaClient.klavis.updateKlavisPlugin.mutate({
identifier,
instanceId: server.instanceId,
@@ -277,7 +277,7 @@ export const createKlavisStoreSlice: StateCreator<
set(
produce((draft: KlavisStoreState) => {
- // 使用 identifier 查找服务器
+ // Find server using identifier
const serverIndex = draft.servers.findIndex((s) => s.identifier === identifier);
if (serverIndex >= 0) {
draft.servers[serverIndex].status = KlavisServerStatus.ERROR;
@@ -294,19 +294,19 @@ export const createKlavisStoreSlice: StateCreator<
removeKlavisServer: async (identifier) => {
const { servers } = get();
- // 使用 identifier 查找服务器
+ // Find server using identifier
const server = servers.find((s) => s.identifier === identifier);
set(
produce((draft: KlavisStoreState) => {
- // 使用 identifier 过滤
+ // Filter using identifier
draft.servers = draft.servers.filter((s) => s.identifier !== identifier);
}),
false,
n('removeKlavisServer'),
);
- // 从 Klavis API 和数据库删除
+ // Delete from Klavis API and database
if (server) {
try {
await lambdaClient.klavis.deleteServerInstance.mutate({
@@ -327,7 +327,7 @@ export const createKlavisStoreSlice: StateCreator<
if (klavisPlugins.length === 0) return [];
- // 转换为 KlavisServer 对象
+ // Convert to KlavisServer objects
return klavisPlugins
.filter((plugin) => plugin.customParams?.klavis)
.map((plugin) => {
@@ -359,7 +359,7 @@ export const createKlavisStoreSlice: StateCreator<
set(
produce((draft: KlavisStoreState) => {
if (data.length > 0) {
- // 使用 identifier 检查是否已存在
+ // Check if already exists using identifier
const existingIdentifiers = new Set(draft.servers.map((s) => s.identifier));
const newServers = data.filter((s) => !existingIdentifiers.has(s.identifier));
draft.servers = [...draft.servers, ...newServers];
diff --git a/src/store/tool/slices/klavisStore/initialState.ts b/src/store/tool/slices/klavisStore/initialState.ts
index d103fca0fa6..fd55466c64c 100644
--- a/src/store/tool/slices/klavisStore/initialState.ts
+++ b/src/store/tool/slices/klavisStore/initialState.ts
@@ -1,24 +1,24 @@
import { type KlavisServer } from './types';
/**
- * Klavis Store 状态接口
+ * Klavis Store state interface
*
* NOTE: API Key is NOT stored in client-side state for security reasons.
* It's only available on the server-side.
*/
export interface KlavisStoreState {
- /** 正在执行的工具调用 ID 集合 */
+ /** Set of executing tool call IDs */
executingToolIds: Set<string>;
- /** 是否已完成初始化加载 */
+ /** Whether initialization loading is complete */
isServersInit: boolean;
- /** 正在加载的服务器 ID 集合 */
+ /** Set of loading server IDs */
loadingServerIds: Set<string>;
- /** 已创建的 Klavis Server 列表 */
+ /** List of created Klavis Servers */
servers: KlavisServer[];
}
/**
- * Klavis Store 初始状态
+ * Klavis Store initial state
*/
export const initialKlavisStoreState: KlavisStoreState = {
executingToolIds: new Set(),
diff --git a/src/store/tool/slices/klavisStore/selectors.ts b/src/store/tool/slices/klavisStore/selectors.ts
index d91dfcbde7a..56d7ce769b1 100644
--- a/src/store/tool/slices/klavisStore/selectors.ts
+++ b/src/store/tool/slices/klavisStore/selectors.ts
@@ -6,7 +6,7 @@ import { type KlavisServer, KlavisServerStatus } from './types';
*/
export const klavisStoreSelectors = {
/**
- * 获取所有 Klavis 服务器的 identifier 集合
+ * Get identifier set of all Klavis servers
*/
getAllServerIdentifiers: (s: ToolStore): Set<string> => {
const servers = s.servers || [];
@@ -14,46 +14,46 @@ export const klavisStoreSelectors = {
},
/**
- * 获取所有可用的工具(来自所有已连接的服务器)
+ * Get all available tools (from all connected servers)
*/
getAllTools: (s: ToolStore) => {
const connectedServers = klavisStoreSelectors.getConnectedServers(s);
return connectedServers.flatMap((server) =>
(server.tools || []).map((tool) => ({
...tool,
- // 工具仍然需要 serverName 用于 API 调用
+ // Tool still needs serverName for API calls
serverName: server.serverName,
})),
);
},
/**
- * 获取所有已连接的服务器
+ * Get all connected servers
*/
getConnectedServers: (s: ToolStore): KlavisServer[] =>
(s.servers || []).filter((server) => server.status === KlavisServerStatus.CONNECTED),
/**
- * 获取所有待认证的服务器
+ * Get all servers pending authentication
*/
getPendingAuthServers: (s: ToolStore): KlavisServer[] =>
(s.servers || []).filter((server) => server.status === KlavisServerStatus.PENDING_AUTH),
/**
- * 根据 identifier 获取服务器
- * @param identifier - 服务器标识符 (e.g., 'google-calendar')
+ * Get server by identifier
+ * @param identifier - Server identifier (e.g., 'google-calendar')
*/
getServerByIdentifier: (identifier: string) => (s: ToolStore) =>
s.servers?.find((server) => server.identifier === identifier),
/**
- * 获取所有 Klavis 服务器
+ * Get all Klavis servers
*/
getServers: (s: ToolStore): KlavisServer[] => s.servers || [],
/**
- * 检查给定的 identifier 是否是 Klavis 服务器
- * @param identifier - 服务器标识符 (e.g., 'google-calendar')
+ * Check if given identifier is a Klavis server
+ * @param identifier - Server identifier (e.g., 'google-calendar')
*/
isKlavisServer:
(identifier: string) =>
@@ -63,14 +63,14 @@ export const klavisStoreSelectors = {
},
/**
- * 检查服务器是否正在加载
- * @param identifier - 服务器标识符 (e.g., 'google-calendar')
+ * Check if server is loading
+ * @param identifier - Server identifier (e.g., 'google-calendar')
*/
isServerLoading: (identifier: string) => (s: ToolStore) =>
s.loadingServerIds?.has(identifier) || false,
/**
- * 检查工具是否正在执行
+ * Check if tool is executing
*/
isToolExecuting: (serverUrl: string, toolName: string) => (s: ToolStore) => {
const toolId = `${serverUrl}:${toolName}`;
@@ -97,7 +97,7 @@ export const klavisStoreSelectors = {
if (apis.length > 0) {
tools.push({
- // 使用 identifier 作为存储和引用的标识符
+ // Use identifier as storage and reference identifier
identifier: server.identifier,
manifest: {
api: apis,
diff --git a/src/store/tool/slices/klavisStore/types.ts b/src/store/tool/slices/klavisStore/types.ts
index 1aa13f55643..d729a4fd55d 100644
--- a/src/store/tool/slices/klavisStore/types.ts
+++ b/src/store/tool/slices/klavisStore/types.ts
@@ -1,100 +1,100 @@
/**
- * Klavis Server 连接状态
+ * Klavis Server connection status
*/
export enum KlavisServerStatus {
- /** 已连接,可以使用 */
+ /** Connected and ready to use */
CONNECTED = 'connected',
- /** 连接失败 */
+ /** Connection failed */
ERROR = 'error',
- /** 未认证,需要完成 OAuth 流程 */
+ /** Not authenticated, needs OAuth flow completion */
PENDING_AUTH = 'pending_auth',
}
/**
- * Klavis 工具定义(MCP 格式)
+ * Klavis tool definition (MCP format)
*/
export interface KlavisTool {
- /** 工具描述 */
+ /** Tool description */
description?: string;
- /** 工具输入的 JSON Schema */
+ /** JSON Schema for tool input */
inputSchema: {
properties?: Record<string, any>;
required?: string[];
type: string;
};
- /** 工具名称 */
+ /** Tool name */
name: string;
}
/**
- * Klavis Server 实例
+ * Klavis Server instance
*/
export interface KlavisServer {
- /** 创建时间戳 */
+ /** Creation timestamp */
createdAt: number;
- /** 错误信息(如果有) */
+ /** Error message (if any) */
errorMessage?: string;
- /** 服务器图标 URL */
+ /** Server icon URL */
icon?: string;
/**
- * 标识符,用于存储到数据库(如 'google-calendar')
- * 格式:小写,空格替换为连字符
+ * Identifier for storing to database (e.g., 'google-calendar')
+ * Format: lowercase, spaces replaced with hyphens
*/
identifier: string;
- /** Klavis 实例 ID */
+ /** Klavis instance ID */
instanceId: string;
- /** 是否已认证 */
+ /** Whether authenticated */
isAuthenticated: boolean;
- /** OAuth 认证 URL */
+ /** OAuth authentication URL */
oauthUrl?: string;
/**
- * 服务器名称,用于调用 Klavis API(如 'Google Calendar')
+ * Server name for calling Klavis API (e.g., 'Google Calendar')
*/
serverName: string;
- /** 服务器 URL (用于连接和调用工具) */
+ /** Server URL (for connection and tool calling) */
serverUrl: string;
- /** 连接状态 */
+ /** Connection status */
status: KlavisServerStatus;
- /** 服务器提供的工具列表 */
+ /** List of tools provided by server */
tools?: KlavisTool[];
}
/**
- * 创建 Klavis Server 的参数
+ * Parameters for creating Klavis Server
*/
export interface CreateKlavisServerParams {
/**
- * 标识符,用于存储到数据库(如 'google-calendar')
+ * Identifier for storing to database (e.g., 'google-calendar')
*/
identifier: string;
/**
- * 服务器名称,用于调用 Klavis API(如 'Google Calendar')
+ * Server name for calling Klavis API (e.g., 'Google Calendar')
*/
serverName: string;
- /** 用户 ID */
+ /** User ID */
userId: string;
}
/**
- * 调用 Klavis 工具的参数
+ * Parameters for calling Klavis tool
*/
export interface CallKlavisToolParams {
/** Strata Server URL */
serverUrl: string;
- /** 工具参数 */
+ /** Tool arguments */
toolArgs?: Record<string, unknown>;
- /** 工具名称 */
+ /** Tool name */
toolName: string;
}
/**
- * 调用 Klavis 工具的结果
+ * Result of calling Klavis tool
*/
export interface CallKlavisToolResult {
- /** 返回数据 */
+ /** Return data */
data?: any;
- /** 错误信息 */
+ /** Error message */
error?: string;
- /** 是否成功 */
+ /** Whether successful */
success: boolean;
}
diff --git a/src/store/tool/slices/lobehubSkillStore/action.ts b/src/store/tool/slices/lobehubSkillStore/action.ts
index 7cbaf09c156..6df30f8f632 100644
--- a/src/store/tool/slices/lobehubSkillStore/action.ts
+++ b/src/store/tool/slices/lobehubSkillStore/action.ts
@@ -25,21 +25,21 @@ const n = setNamespace('lobehubSkillStore');
*/
export interface LobehubSkillStoreAction {
/**
- * 调用 LobeHub Skill 工具
+ * Call LobeHub Skill tool
*/
callLobehubSkillTool: (params: CallLobehubSkillToolParams) => Promise<CallLobehubSkillToolResult>;
/**
- * 获取单个 Provider 的连接状态
- * @param provider - Provider ID (如 'linear')
+ * Get single Provider connection status
+ * @param provider - Provider ID (e.g., 'linear')
*/
checkLobehubSkillStatus: (provider: string) => Promise<LobehubSkillServer | undefined>;
/**
- * 获取 Provider 的授权信息(URL、code、过期时间)
- * @param provider - Provider ID (如 'linear')
- * @param options - 可选的 scopes 和 redirectUri
- * @returns 授权 URL 和相关信息
+ * Get Provider authorization info (URL, code, expiration time)
+ * @param provider - Provider ID (e.g., 'linear')
+ * @param options - Optional scopes and redirectUri
+ * @returns Authorization URL and related info
*/
getLobehubSkillAuthorizeUrl: (
provider: string,
@@ -47,7 +47,7 @@ export interface LobehubSkillStoreAction {
) => Promise<{ authorizeUrl: string; code: string; expiresIn: number }>;
/**
- * 内部方法: 更新 Server 状态
+ * Internal method: Update Server status
*/
internal_updateLobehubSkillServer: (
provider: string,
@@ -55,26 +55,26 @@ export interface LobehubSkillStoreAction {
) => void;
/**
- * 刷新 Provider 的 Token (如果支持)
+ * Refresh Provider Token (if supported)
* @param provider - Provider ID
*/
refreshLobehubSkillToken: (provider: string) => Promise<boolean>;
/**
- * 刷新 Provider 的工具列表
+ * Refresh Provider tool list
* @param provider - Provider ID
*/
refreshLobehubSkillTools: (provider: string) => Promise<void>;
/**
- * 断开 Provider 连接
+ * Disconnect Provider connection
* @param provider - Provider ID
*/
revokeLobehubSkill: (provider: string) => Promise<void>;
/**
- * 使用 SWR 获取用户的所有连接状态
- * @param enabled - 是否启用获取
+ * Use SWR to fetch user's all connection statuses
+ * @param enabled - Whether to enable fetching
*/
useFetchLobehubSkillConnections: (enabled: boolean) => SWRResponse<LobehubSkillServer[]>;
}
diff --git a/src/store/tool/slices/lobehubSkillStore/initialState.ts b/src/store/tool/slices/lobehubSkillStore/initialState.ts
index 54734bd7485..035775f7c66 100644
--- a/src/store/tool/slices/lobehubSkillStore/initialState.ts
+++ b/src/store/tool/slices/lobehubSkillStore/initialState.ts
@@ -1,21 +1,21 @@
import { type LobehubSkillServer } from './types';
/**
- * LobeHub Skill Store 状态接口
+ * LobeHub Skill Store state interface
*
- * NOTE: 所有连接状态和工具数据都从 Market API 实时获取,不存储到本地数据库
+ * NOTE: All connection states and tool data are fetched in real-time from Market API, not stored in local database
*/
export interface LobehubSkillStoreState {
- /** 正在执行的工具调用 ID 集合 */
+ /** Set of executing tool call IDs */
lobehubSkillExecutingToolIds: Set<string>;
- /** 正在加载的 Provider ID 集合 */
+ /** Set of loading Provider IDs */
lobehubSkillLoadingIds: Set<string>;
- /** 已连接的 LobeHub Skill Server 列表 */
+ /** List of connected LobeHub Skill Servers */
lobehubSkillServers: LobehubSkillServer[];
}
/**
- * LobeHub Skill Store 初始状态
+ * LobeHub Skill Store initial state
*/
export const initialLobehubSkillStoreState: LobehubSkillStoreState = {
lobehubSkillExecutingToolIds: new Set(),
diff --git a/src/store/tool/slices/lobehubSkillStore/types.ts b/src/store/tool/slices/lobehubSkillStore/types.ts
index 562312b8d26..989cd723ed1 100644
--- a/src/store/tool/slices/lobehubSkillStore/types.ts
+++ b/src/store/tool/slices/lobehubSkillStore/types.ts
@@ -1,100 +1,100 @@
/**
- * LobeHub Skill Server 连接状态
+ * LobeHub Skill Server connection status
*/
export enum LobehubSkillStatus {
- /** 已连接,可以使用 */
+ /** Connected and ready to use */
CONNECTED = 'connected',
- /** 连接中 */
+ /** Connecting */
CONNECTING = 'connecting',
- /** 连接失败或 Token 过期 */
+ /** Connection failed or token expired */
ERROR = 'error',
- /** 未连接 */
+ /** Not connected */
NOT_CONNECTED = 'not_connected',
}
/**
- * LobeHub Skill Tool 定义 (来自 Market API)
+ * LobeHub Skill Tool definition (from Market API)
*/
export interface LobehubSkillTool {
- /** 工具描述 */
+ /** Tool description */
description?: string;
- /** 工具输入的 JSON Schema */
+ /** JSON Schema for tool input */
inputSchema: {
additionalProperties?: boolean;
properties?: Record<string, any>;
required?: string[];
type: string;
};
- /** 工具名称 */
+ /** Tool name */
name: string;
}
/**
- * LobeHub Skill Provider 定义 (来自 Market API)
+ * LobeHub Skill Provider definition (from Market API)
*/
export interface LobehubSkillProvider {
- /** Provider 图标 URL */
+ /** Provider icon URL */
icon?: string;
- /** Provider ID (如 'linear', 'github') */
+ /** Provider ID (e.g., 'linear', 'github') */
id: string;
- /** 显示名称 */
+ /** Display name */
name: string;
- /** 是否支持刷新 Token */
+ /** Whether token refresh is supported */
refreshSupported?: boolean;
- /** Provider 类型 */
+ /** Provider type */
type?: 'mcp' | 'rest';
}
/**
- * LobeHub Skill Server 实例 (用户已连接的 provider)
+ * LobeHub Skill Server instance (user-connected provider)
*/
export interface LobehubSkillServer {
- /** 缓存时间戳 */
+ /** Cache timestamp */
cachedAt?: number;
- /** 错误信息 */
+ /** Error message */
errorMessage?: string;
- /** Provider 图标 URL */
+ /** Provider icon URL */
icon?: string;
- /** Provider ID (如 'linear') */
+ /** Provider ID (e.g., 'linear') */
identifier: string;
- /** 是否已认证 */
+ /** Whether authenticated */
isConnected: boolean;
- /** Provider 显示名称 */
+ /** Provider display name */
name: string;
- /** Provider 用户名 (如 GitHub username) */
+ /** Provider username (e.g., GitHub username) */
providerUsername?: string;
- /** 授权的 scopes */
+ /** Authorized scopes */
scopes?: string[];
- /** 连接状态 */
+ /** Connection status */
status: LobehubSkillStatus;
- /** Token 过期时间 */
+ /** Token expiration time */
tokenExpiresAt?: string;
- /** 工具列表 (已连接后可用) */
+ /** Tool list (available after connection) */
tools?: LobehubSkillTool[];
}
/**
- * 调用 LobeHub Skill 工具的参数
+ * Parameters for calling LobeHub Skill tool
*/
export interface CallLobehubSkillToolParams {
- /** 工具参数 */
+ /** Tool arguments */
args?: Record<string, unknown>;
- /** Provider ID (如 'linear') */
+ /** Provider ID (e.g., 'linear') */
provider: string;
- /** 工具名称 */
+ /** Tool name */
toolName: string;
}
/**
- * 调用 LobeHub Skill 工具的结果
+ * Result of calling LobeHub Skill tool
*/
export interface CallLobehubSkillToolResult {
- /** 返回数据 */
+ /** Return data */
data?: any;
- /** 错误信息 */
+ /** Error message */
error?: string;
- /** 错误代码 */
+ /** Error code */
errorCode?: string;
- /** 是否成功 */
+ /** Whether successful */
success: boolean;
}
diff --git a/src/store/tool/slices/mcpStore/initialState.ts b/src/store/tool/slices/mcpStore/initialState.ts
index 9e7e986aa0f..634ebacf4d3 100644
--- a/src/store/tool/slices/mcpStore/initialState.ts
+++ b/src/store/tool/slices/mcpStore/initialState.ts
@@ -12,7 +12,7 @@ export interface MCPStoreState {
mcpInstallProgress: MCPInstallProgressMap;
mcpPluginItems: PluginItem[];
mcpSearchKeywords?: string;
- // 测试连接相关状态
+ // Test connection related state
mcpTestAbortControllers: Record<string, AbortController>;
mcpTestErrors: Record<string, string>;
mcpTestLoading: Record<string, boolean>;
@@ -28,7 +28,7 @@ export const initialMCPStoreState: MCPStoreState = {
mcpInstallAbortControllers: {},
mcpInstallProgress: {},
mcpPluginItems: [],
- // 测试连接相关状态初始化
+ // Test connection related state initialization
mcpTestAbortControllers: {},
mcpTestErrors: {},
mcpTestLoading: {},
diff --git a/src/store/tool/slices/mcpStore/selectors.ts b/src/store/tool/slices/mcpStore/selectors.ts
index 1dc6492f4d0..6077380eabb 100644
--- a/src/store/tool/slices/mcpStore/selectors.ts
+++ b/src/store/tool/slices/mcpStore/selectors.ts
@@ -42,14 +42,14 @@ const getMCPPluginRequiringConfig = (id: string) => (s: ToolStoreState) =>
const isMCPPluginRequiringConfig = (id: string) => (s: ToolStoreState) =>
!!s.mcpInstallProgress[id]?.configSchema;
-// 检查插件是否正在安装中(有安装进度且不是配置阶段)
+// Check if plugin is installing (has install progress and not in config stage)
const isMCPInstallInProgress = (id: string) => (s: ToolStoreState) => {
const progress = s.mcpInstallProgress[id];
return !!progress && !progress.needsConfig && progress.step !== 'Error';
};
-// 测试连接相关选择器
+// Test connection related selectors
const isMCPConnectionTesting = (id: string) => (s: ToolStoreState) => s.mcpTestLoading[id] || false;
const getMCPConnectionTestError = (id: string) => (s: ToolStoreState) => s.mcpTestErrors[id];
diff --git a/src/store/tool/slices/oldStore/action.ts b/src/store/tool/slices/oldStore/action.ts
index 60e080d1626..2c0cb3eb79b 100644
--- a/src/store/tool/slices/oldStore/action.ts
+++ b/src/store/tool/slices/oldStore/action.ts
@@ -57,10 +57,10 @@ export const createPluginStoreSlice: StateCreator<
const { updateInstallLoadingState, refreshPlugins, updatePluginInstallProgress } = get();
try {
- // 开始安装流程
+ // Start installation process
updateInstallLoadingState(name, true);
- // 步骤 1: 获取插件清单
+ // Step 1: Fetch plugin manifest
updatePluginInstallProgress(name, {
progress: 25,
step: PluginInstallStep.FETCHING_MANIFEST,
@@ -68,7 +68,7 @@ export const createPluginStoreSlice: StateCreator<
const data = await toolService.getToolManifest(plugin.manifest);
- // 步骤 2: 安装插件
+ // Step 2: Install plugin
updatePluginInstallProgress(name, {
progress: 60,
step: PluginInstallStep.INSTALLING_PLUGIN,
@@ -83,13 +83,13 @@ export const createPluginStoreSlice: StateCreator<
await refreshPlugins();
- // 步骤 4: 完成安装
+ // Step 4: Complete installation
updatePluginInstallProgress(name, {
progress: 100,
step: PluginInstallStep.COMPLETED,
});
- // 短暂显示完成状态后清除进度
+ // Briefly show completion status then clear progress
await sleep(1000);
updatePluginInstallProgress(name, undefined);
@@ -99,7 +99,7 @@ export const createPluginStoreSlice: StateCreator<
const err = error as PluginInstallError;
- // 设置错误状态
+ // Set error state
updatePluginInstallProgress(name, {
error: err.message,
progress: 0,
diff --git a/src/store/tool/slices/oldStore/initialState.ts b/src/store/tool/slices/oldStore/initialState.ts
index 30a6c1c2700..ae9501d6287 100644
--- a/src/store/tool/slices/oldStore/initialState.ts
+++ b/src/store/tool/slices/oldStore/initialState.ts
@@ -18,7 +18,7 @@ export enum PluginInstallStep {
/* eslint-enable */
export interface PluginInstallProgress {
- // 错误信息
+ // Error message
error?: string;
// 0-100
progress: number;
diff --git a/src/store/tool/slices/plugin/action.ts b/src/store/tool/slices/plugin/action.ts
index 9fdabe525bc..c2a495b4550 100644
--- a/src/store/tool/slices/plugin/action.ts
+++ b/src/store/tool/slices/plugin/action.ts
@@ -12,7 +12,7 @@ import { pluginStoreSelectors } from '../oldStore/selectors';
import { pluginSelectors } from './selectors';
/**
- * 插件接口
+ * Plugin interface
*/
export interface PluginAction {
checkPluginsIsInstalled: (plugins: string[]) => Promise<void>;
diff --git a/src/store/tool/slices/plugin/selectors.ts b/src/store/tool/slices/plugin/selectors.ts
index e53637a9d9d..6be8343bedf 100644
--- a/src/store/tool/slices/plugin/selectors.ts
+++ b/src/store/tool/slices/plugin/selectors.ts
@@ -54,7 +54,7 @@ const installedPluginManifestList = (s: ToolStoreState) =>
const installedPluginMetaList = (s: ToolStoreState) =>
installedPlugins(s)
- // 过滤掉 Klavis 插件(它们有自己的显示位置)
+ // Filter out Klavis plugins (they have their own display location)
.filter((p) => !p.customParams?.klavis)
.map<InstallPluginMeta>((p) => ({
author: p.manifest?.author,