@lobehub/lobehub 2.0.0-next.313 → 2.0.0-next.315
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +50 -0
- package/apps/desktop/src/main/appBrowsers.ts +4 -1
- package/apps/desktop/src/main/controllers/BrowserWindowsCtr.ts +15 -3
- package/apps/desktop/src/main/core/browser/Browser.ts +14 -4
- package/apps/desktop/src/main/core/browser/BrowserManager.ts +7 -2
- package/changelog/v1.json +18 -0
- package/e2e/src/steps/community/detail-pages.steps.ts +2 -2
- package/e2e/src/steps/community/interactions.steps.ts +6 -6
- package/e2e/src/steps/hooks.ts +19 -3
- package/package.json +1 -1
- package/packages/desktop-bridge/src/index.ts +5 -0
- package/packages/electron-client-ipc/src/types/window.ts +3 -2
- package/src/app/[variants]/(desktop)/desktop-onboarding/_layout/index.tsx +6 -3
- package/src/app/[variants]/(desktop)/desktop-onboarding/components/OnboardingFooterActions.tsx +38 -0
- package/src/app/[variants]/(desktop)/desktop-onboarding/features/DataModeStep.tsx +19 -14
- package/src/app/[variants]/(desktop)/desktop-onboarding/features/LoginStep.tsx +53 -19
- package/src/app/[variants]/(desktop)/desktop-onboarding/features/PermissionsStep.tsx +19 -14
- package/src/app/[variants]/(desktop)/desktop-onboarding/index.tsx +8 -7
- package/src/app/manifest.ts +1 -1
- package/src/features/Electron/titlebar/NavigationBar.tsx +1 -2
- package/src/server/manifest.ts +2 -2
- package/src/server/services/aiAgent/index.ts +28 -11
- package/src/server/services/klavis/index.ts +228 -0
- package/src/server/services/market/index.ts +13 -0
- package/src/server/services/sandbox/index.ts +84 -18
- package/src/server/services/toolExecution/builtin.ts +12 -0
- package/src/server/services/toolExecution/index.ts +70 -4
- package/src/server/services/toolExecution/serverRuntimes/cloudSandbox.ts +7 -0
- package/src/services/electron/system.ts +5 -5
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { type ChatToolPayload } from '@lobechat/types';
|
|
2
|
+
import { safeParseJSON } from '@lobechat/utils';
|
|
2
3
|
import debug from 'debug';
|
|
3
4
|
|
|
5
|
+
import { type CloudMCPParams, type ToolCallContent } from '@/libs/mcp';
|
|
6
|
+
import { contentBlocksToString } from '@/server/services/mcp/contentProcessor';
|
|
7
|
+
|
|
8
|
+
import { DiscoverService } from '../discover';
|
|
4
9
|
import { type MCPService } from '../mcp';
|
|
5
10
|
import { type PluginGatewayService } from '../pluginGateway';
|
|
6
11
|
import { type BuiltinToolsExecutor } from './builtin';
|
|
@@ -121,12 +126,20 @@ export class ToolExecutionService {
|
|
|
121
126
|
};
|
|
122
127
|
}
|
|
123
128
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
129
|
+
log(
|
|
130
|
+
'Calling MCP service with params for: %s:%s (type: %s)',
|
|
131
|
+
identifier,
|
|
132
|
+
apiName,
|
|
133
|
+
mcpParams.type,
|
|
134
|
+
);
|
|
127
135
|
|
|
128
136
|
try {
|
|
129
|
-
//
|
|
137
|
+
// Check if this is a cloud MCP endpoint
|
|
138
|
+
if (mcpParams.type === 'cloud') {
|
|
139
|
+
return await this.executeCloudMCPTool(payload, context, mcpParams);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
// For stdio/http/sse types, use standard MCP service
|
|
130
143
|
const result = await this.mcpService.callTool({
|
|
131
144
|
argsStr: args,
|
|
132
145
|
clientParams: mcpParams,
|
|
@@ -152,6 +165,59 @@ export class ToolExecutionService {
|
|
|
152
165
|
};
|
|
153
166
|
}
|
|
154
167
|
}
|
|
168
|
+
|
|
169
|
+
private async executeCloudMCPTool(
|
|
170
|
+
payload: ChatToolPayload,
|
|
171
|
+
context: ToolExecutionContext,
|
|
172
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
173
|
+
_mcpParams: CloudMCPParams,
|
|
174
|
+
): Promise<ToolExecutionResult> {
|
|
175
|
+
const { identifier, apiName, arguments: args } = payload;
|
|
176
|
+
|
|
177
|
+
log('Executing Cloud MCP tool: %s:%s via cloud gateway', identifier, apiName);
|
|
178
|
+
|
|
179
|
+
try {
|
|
180
|
+
// Create DiscoverService with user context
|
|
181
|
+
const discoverService = new DiscoverService({
|
|
182
|
+
userInfo: context.userId ? { userId: context.userId } : undefined,
|
|
183
|
+
});
|
|
184
|
+
|
|
185
|
+
// Parse arguments
|
|
186
|
+
const apiParams = safeParseJSON(args) || {};
|
|
187
|
+
|
|
188
|
+
// Call cloud MCP endpoint via Market API
|
|
189
|
+
// Returns CloudGatewayResponse: { content: ToolCallContent[], isError?: boolean }
|
|
190
|
+
const cloudResult = await discoverService.callCloudMcpEndpoint({
|
|
191
|
+
apiParams,
|
|
192
|
+
identifier,
|
|
193
|
+
toolName: apiName,
|
|
194
|
+
});
|
|
195
|
+
|
|
196
|
+
const cloudResultContent = (cloudResult?.content ?? []) as ToolCallContent[];
|
|
197
|
+
|
|
198
|
+
// Convert content blocks to string (same as market router does)
|
|
199
|
+
const content = contentBlocksToString(cloudResultContent);
|
|
200
|
+
const state = { ...cloudResult, content: cloudResultContent };
|
|
201
|
+
|
|
202
|
+
log('Cloud MCP tool execution successful for: %s:%s', identifier, apiName);
|
|
203
|
+
|
|
204
|
+
return {
|
|
205
|
+
content,
|
|
206
|
+
state,
|
|
207
|
+
success: !cloudResult?.isError,
|
|
208
|
+
};
|
|
209
|
+
} catch (error) {
|
|
210
|
+
log('Cloud MCP tool execution failed for %s:%s: %O', identifier, apiName, error);
|
|
211
|
+
return {
|
|
212
|
+
content: (error as Error).message,
|
|
213
|
+
error: {
|
|
214
|
+
code: 'CLOUD_MCP_EXECUTION_ERROR',
|
|
215
|
+
message: (error as Error).message,
|
|
216
|
+
},
|
|
217
|
+
success: false,
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
}
|
|
155
221
|
}
|
|
156
222
|
|
|
157
223
|
export * from './types';
|
|
@@ -3,6 +3,7 @@ import {
|
|
|
3
3
|
CloudSandboxIdentifier,
|
|
4
4
|
} from '@lobechat/builtin-tool-cloud-sandbox';
|
|
5
5
|
|
|
6
|
+
import { FileService } from '@/server/services/file';
|
|
6
7
|
import { MarketService } from '@/server/services/market';
|
|
7
8
|
import { ServerSandboxService } from '@/server/services/sandbox';
|
|
8
9
|
|
|
@@ -18,8 +19,14 @@ export const cloudSandboxRuntime: ServerRuntimeRegistration = {
|
|
|
18
19
|
throw new Error('userId and topicId are required for Cloud Sandbox execution');
|
|
19
20
|
}
|
|
20
21
|
|
|
22
|
+
if (!context.serverDB) {
|
|
23
|
+
throw new Error('serverDB is required for Cloud Sandbox execution');
|
|
24
|
+
}
|
|
25
|
+
|
|
21
26
|
const marketService = new MarketService({ userInfo: { userId: context.userId } });
|
|
27
|
+
const fileService = new FileService(context.serverDB, context.userId);
|
|
22
28
|
const sandboxService = new ServerSandboxService({
|
|
29
|
+
fileService,
|
|
23
30
|
marketService,
|
|
24
31
|
topicId: context.topicId,
|
|
25
32
|
userId: context.userId,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type {
|
|
2
2
|
ElectronAppState,
|
|
3
|
-
|
|
3
|
+
WindowMinimumSizeParams,
|
|
4
4
|
WindowSizeParams,
|
|
5
5
|
} from '@lobechat/electron-client-ipc';
|
|
6
6
|
|
|
@@ -36,14 +36,14 @@ class ElectronSystemService {
|
|
|
36
36
|
return this.ipc.windows.minimizeWindow();
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
async setWindowResizable(params: WindowResizableParams): Promise<void> {
|
|
40
|
-
return this.ipc.windows.setWindowResizable(params);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
39
|
async setWindowSize(params: WindowSizeParams): Promise<void> {
|
|
44
40
|
return this.ipc.windows.setWindowSize(params);
|
|
45
41
|
}
|
|
46
42
|
|
|
43
|
+
async setWindowMinimumSize(params: WindowMinimumSizeParams): Promise<void> {
|
|
44
|
+
return this.ipc.windows.setWindowMinimumSize(params);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
47
|
async openExternalLink(url: string): Promise<void> {
|
|
48
48
|
return this.ipc.system.openExternalLink(url);
|
|
49
49
|
}
|