@lobehub/lobehub 2.0.0-next.312 → 2.0.0-next.314

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.
Files changed (93) hide show
  1. package/CHANGELOG.md +51 -0
  2. package/apps/desktop/src/main/appBrowsers.ts +4 -1
  3. package/apps/desktop/src/main/controllers/AuthCtr.ts +75 -7
  4. package/apps/desktop/src/main/controllers/BrowserWindowsCtr.ts +15 -3
  5. package/apps/desktop/src/main/core/browser/Browser.ts +14 -4
  6. package/apps/desktop/src/main/core/browser/BrowserManager.ts +7 -2
  7. package/changelog/v1.json +18 -0
  8. package/docs/usage/providers/internlm.mdx +2 -2
  9. package/docs/usage/providers/internlm.zh-CN.mdx +3 -3
  10. package/e2e/src/steps/community/detail-pages.steps.ts +2 -2
  11. package/e2e/src/steps/community/interactions.steps.ts +6 -6
  12. package/e2e/src/steps/hooks.ts +19 -3
  13. package/locales/en-US/error.json +10 -1
  14. package/locales/en-US/subscription.json +1 -1
  15. package/locales/zh-CN/desktop-onboarding.json +5 -0
  16. package/locales/zh-CN/error.json +10 -1
  17. package/locales/zh-CN/subscription.json +1 -1
  18. package/package.json +1 -1
  19. package/packages/agent-runtime/src/agents/GeneralChatAgent.ts +14 -2
  20. package/packages/agent-runtime/src/agents/__tests__/GeneralChatAgent.test.ts +275 -1
  21. package/packages/builtin-tool-cloud-sandbox/package.json +1 -0
  22. package/packages/builtin-tool-cloud-sandbox/src/ExecutionRuntime/index.ts +105 -134
  23. package/packages/builtin-tool-cloud-sandbox/src/executor/index.ts +254 -0
  24. package/packages/builtin-tool-cloud-sandbox/src/index.ts +1 -0
  25. package/packages/builtin-tool-cloud-sandbox/src/types/api.ts +22 -0
  26. package/packages/builtin-tool-cloud-sandbox/src/types/index.ts +4 -0
  27. package/packages/builtin-tool-cloud-sandbox/src/types/params.ts +85 -0
  28. package/packages/builtin-tool-cloud-sandbox/src/types/service.ts +48 -0
  29. package/packages/builtin-tool-cloud-sandbox/src/{types.ts → types/state.ts} +0 -23
  30. package/packages/builtin-tool-memory/src/manifest.ts +5 -5
  31. package/packages/desktop-bridge/src/index.ts +5 -0
  32. package/packages/editor-runtime/src/__tests__/EditorRuntime.real.test.ts +1 -1
  33. package/packages/editor-runtime/src/__tests__/EditorRuntime.test.ts +1 -1
  34. package/packages/electron-client-ipc/src/events/index.ts +5 -1
  35. package/packages/electron-client-ipc/src/events/remoteServer.ts +23 -0
  36. package/packages/electron-client-ipc/src/types/window.ts +3 -2
  37. package/packages/memory-user-memory/src/schemas/index.ts +0 -1
  38. package/packages/model-bank/src/modelProviders/internlm.ts +1 -1
  39. package/packages/model-runtime/src/core/RouterRuntime/createRuntime.ts +5 -15
  40. package/packages/model-runtime/src/providers/internlm/index.test.ts +15 -15
  41. package/packages/model-runtime/src/providers/internlm/index.ts +1 -1
  42. package/packages/types/src/tool/intervention.ts +4 -2
  43. package/packages/types/src/user/preference.ts +1 -0
  44. package/src/app/[variants]/(desktop)/desktop-onboarding/_layout/index.tsx +6 -3
  45. package/src/app/[variants]/(desktop)/desktop-onboarding/components/OnboardingFooterActions.tsx +38 -0
  46. package/src/app/[variants]/(desktop)/desktop-onboarding/features/DataModeStep.tsx +19 -14
  47. package/src/app/[variants]/(desktop)/desktop-onboarding/features/LoginStep.tsx +121 -29
  48. package/src/app/[variants]/(desktop)/desktop-onboarding/features/PermissionsStep.tsx +19 -14
  49. package/src/app/[variants]/(desktop)/desktop-onboarding/index.tsx +8 -7
  50. package/src/app/[variants]/(main)/_layout/DesktopAutoOidcOnFirstOpen.tsx +4 -0
  51. package/src/app/manifest.ts +1 -1
  52. package/src/business/server/user.ts +4 -0
  53. package/src/features/Conversation/Messages/Task/Actions/index.tsx +0 -2
  54. package/src/features/Conversation/Messages/Task/index.tsx +1 -1
  55. package/src/features/Conversation/Messages/Tasks/shared/ProcessingState.tsx +0 -2
  56. package/src/features/Electron/titlebar/NavigationBar.tsx +1 -2
  57. package/src/features/NavPanel/components/NavPanelDraggable.tsx +0 -14
  58. package/src/features/ResourceManager/components/Explorer/ItemDropdown/useFileItemDropdown.tsx +4 -3
  59. package/src/features/SharePopover/index.tsx +5 -3
  60. package/src/hooks/useAppOrigin.ts +16 -0
  61. package/src/layout/GlobalProvider/useUserStateRedirect.ts +37 -24
  62. package/src/libs/trusted-client/index.ts +2 -5
  63. package/src/locales/default/desktop-onboarding.ts +5 -0
  64. package/src/locales/default/error.ts +11 -0
  65. package/src/locales/default/subscription.ts +1 -1
  66. package/src/server/manifest.ts +2 -2
  67. package/src/server/modules/AgentRuntime/RuntimeExecutors.ts +2 -0
  68. package/src/server/routers/lambda/user.ts +24 -10
  69. package/src/server/services/agentRuntime/AgentRuntimeService.test.ts +3 -0
  70. package/src/server/services/agentRuntime/AgentRuntimeService.ts +8 -5
  71. package/src/server/services/agentRuntime/types.ts +7 -0
  72. package/src/server/services/aiAgent/__tests__/execGroupSubAgentTask.test.ts +3 -0
  73. package/src/server/services/aiAgent/index.ts +10 -4
  74. package/src/server/services/market/index.ts +20 -0
  75. package/src/server/services/sandbox/index.ts +186 -0
  76. package/src/server/services/toolExecution/builtin.ts +12 -18
  77. package/src/server/services/toolExecution/index.ts +1 -1
  78. package/src/server/services/toolExecution/serverRuntimes/cloudSandbox.ts +38 -0
  79. package/src/server/services/toolExecution/serverRuntimes/index.ts +55 -0
  80. package/src/server/services/toolExecution/serverRuntimes/types.ts +14 -0
  81. package/src/server/services/toolExecution/serverRuntimes/webBrowsing.ts +20 -0
  82. package/src/server/services/toolExecution/types.ts +2 -0
  83. package/src/services/{codeInterpreter.ts → cloudSandbox.ts} +3 -3
  84. package/src/services/electron/remoteServer.ts +8 -0
  85. package/src/services/electron/system.ts +5 -5
  86. package/src/store/chat/agents/GroupOrchestration/__tests__/batch-exec-async-tasks.test.ts +626 -0
  87. package/src/store/chat/agents/GroupOrchestration/createGroupOrchestrationExecutors.ts +294 -0
  88. package/src/store/chat/slices/plugin/action.test.ts +0 -48
  89. package/src/store/chat/slices/plugin/actions/pluginTypes.ts +0 -131
  90. package/src/store/tool/slices/builtin/executors/index.ts +2 -0
  91. package/src/store/user/slices/settings/selectors/toolIntervention.test.ts +143 -0
  92. package/src/store/user/slices/settings/selectors/toolIntervention.ts +11 -2
  93. package/packages/memory-user-memory/src/schemas/jsonSchemas.ts +0 -37
@@ -0,0 +1,254 @@
1
+ import { BaseExecutor, type BuiltinToolContext, type BuiltinToolResult } from '@lobechat/types';
2
+
3
+ import { cloudSandboxService } from '@/services/cloudSandbox';
4
+ import { useUserStore } from '@/store/user';
5
+ import { userProfileSelectors } from '@/store/user/slices/auth/selectors';
6
+
7
+ import { CloudSandboxExecutionRuntime } from '../ExecutionRuntime';
8
+ import { CloudSandboxIdentifier } from '../manifest';
9
+ import {
10
+ CloudSandboxApiName,
11
+ type EditLocalFileParams,
12
+ type ExecuteCodeParams,
13
+ type ExportFileParams,
14
+ type GetCommandOutputParams,
15
+ type GlobLocalFilesParams,
16
+ type GrepContentParams,
17
+ type ISandboxService,
18
+ type KillCommandParams,
19
+ type ListLocalFilesParams,
20
+ type MoveLocalFilesParams,
21
+ type ReadLocalFileParams,
22
+ type RenameLocalFileParams,
23
+ type RunCommandParams,
24
+ type SandboxCallToolResult,
25
+ type SandboxExportFileResult,
26
+ type SearchLocalFilesParams,
27
+ type WriteLocalFileParams,
28
+ } from '../types';
29
+
30
+ /**
31
+ * Client-side Sandbox Service
32
+ * Wraps codeInterpreterService with bound context (topicId, userId)
33
+ */
34
+ class ClientSandboxService implements ISandboxService {
35
+ private topicId: string;
36
+ private userId: string;
37
+
38
+ constructor(topicId: string) {
39
+ this.topicId = topicId;
40
+ // Get userId from user store - client-side auth
41
+ const userId = userProfileSelectors.userId(useUserStore.getState());
42
+ if (!userId) {
43
+ throw new Error('userId must be provided');
44
+ }
45
+ this.userId = userId;
46
+ }
47
+
48
+ async callTool(toolName: string, params: Record<string, any>): Promise<SandboxCallToolResult> {
49
+ return cloudSandboxService.callTool(toolName, params, {
50
+ topicId: this.topicId,
51
+ userId: this.userId,
52
+ });
53
+ }
54
+
55
+ async exportAndUploadFile(path: string, filename: string): Promise<SandboxExportFileResult> {
56
+ return cloudSandboxService.exportAndUploadFile(path, filename, this.topicId);
57
+ }
58
+ }
59
+
60
+ /**
61
+ * Cloud Sandbox Client Executor
62
+ *
63
+ * This executor handles Cloud Sandbox tool calls on the client side.
64
+ * It creates a CloudSandboxExecutionRuntime with a ClientSandboxService
65
+ * that has topicId bound at construction time.
66
+ */
67
+ class CloudSandboxExecutor extends BaseExecutor<typeof CloudSandboxApiName> {
68
+ readonly identifier = CloudSandboxIdentifier;
69
+ protected readonly apiEnum = CloudSandboxApiName;
70
+
71
+ /**
72
+ * Get or create a runtime for the given context
73
+ */
74
+ private getRuntime(ctx: BuiltinToolContext): CloudSandboxExecutionRuntime {
75
+ const topicId = ctx.topicId;
76
+
77
+ if (!topicId) {
78
+ throw new Error('Can not init runtime with empty topicId');
79
+ }
80
+
81
+ const service = new ClientSandboxService(topicId);
82
+ return new CloudSandboxExecutionRuntime(service);
83
+ }
84
+
85
+ // ==================== File Operations ====================
86
+
87
+ listLocalFiles = async (
88
+ params: ListLocalFilesParams,
89
+ ctx: BuiltinToolContext,
90
+ ): Promise<BuiltinToolResult> => {
91
+ const runtime = this.getRuntime(ctx);
92
+ const result = await runtime.listLocalFiles(params);
93
+ return this.toBuiltinResult(result);
94
+ };
95
+
96
+ readLocalFile = async (
97
+ params: ReadLocalFileParams,
98
+ ctx: BuiltinToolContext,
99
+ ): Promise<BuiltinToolResult> => {
100
+ const runtime = this.getRuntime(ctx);
101
+ const result = await runtime.readLocalFile(params);
102
+ return this.toBuiltinResult(result);
103
+ };
104
+
105
+ writeLocalFile = async (
106
+ params: WriteLocalFileParams,
107
+ ctx: BuiltinToolContext,
108
+ ): Promise<BuiltinToolResult> => {
109
+ const runtime = this.getRuntime(ctx);
110
+ const result = await runtime.writeLocalFile(params);
111
+ return this.toBuiltinResult(result);
112
+ };
113
+
114
+ editLocalFile = async (
115
+ params: EditLocalFileParams,
116
+ ctx: BuiltinToolContext,
117
+ ): Promise<BuiltinToolResult> => {
118
+ const runtime = this.getRuntime(ctx);
119
+ const result = await runtime.editLocalFile(params);
120
+ return this.toBuiltinResult(result);
121
+ };
122
+
123
+ searchLocalFiles = async (
124
+ params: SearchLocalFilesParams,
125
+ ctx: BuiltinToolContext,
126
+ ): Promise<BuiltinToolResult> => {
127
+ const runtime = this.getRuntime(ctx);
128
+ const result = await runtime.searchLocalFiles(params);
129
+ return this.toBuiltinResult(result);
130
+ };
131
+
132
+ moveLocalFiles = async (
133
+ params: MoveLocalFilesParams,
134
+ ctx: BuiltinToolContext,
135
+ ): Promise<BuiltinToolResult> => {
136
+ const runtime = this.getRuntime(ctx);
137
+ const result = await runtime.moveLocalFiles(params);
138
+ return this.toBuiltinResult(result);
139
+ };
140
+
141
+ renameLocalFile = async (
142
+ params: RenameLocalFileParams,
143
+ ctx: BuiltinToolContext,
144
+ ): Promise<BuiltinToolResult> => {
145
+ const runtime = this.getRuntime(ctx);
146
+ const result = await runtime.renameLocalFile(params);
147
+ return this.toBuiltinResult(result);
148
+ };
149
+
150
+ // ==================== Code Execution ====================
151
+
152
+ executeCode = async (
153
+ params: ExecuteCodeParams,
154
+ ctx: BuiltinToolContext,
155
+ ): Promise<BuiltinToolResult> => {
156
+ const runtime = this.getRuntime(ctx);
157
+ const result = await runtime.executeCode(params);
158
+ return this.toBuiltinResult(result);
159
+ };
160
+
161
+ // ==================== Shell Commands ====================
162
+
163
+ runCommand = async (
164
+ params: RunCommandParams,
165
+ ctx: BuiltinToolContext,
166
+ ): Promise<BuiltinToolResult> => {
167
+ const runtime = this.getRuntime(ctx);
168
+ const result = await runtime.runCommand(params);
169
+ return this.toBuiltinResult(result);
170
+ };
171
+
172
+ getCommandOutput = async (
173
+ params: GetCommandOutputParams,
174
+ ctx: BuiltinToolContext,
175
+ ): Promise<BuiltinToolResult> => {
176
+ const runtime = this.getRuntime(ctx);
177
+ const result = await runtime.getCommandOutput(params);
178
+ return this.toBuiltinResult(result);
179
+ };
180
+
181
+ killCommand = async (
182
+ params: KillCommandParams,
183
+ ctx: BuiltinToolContext,
184
+ ): Promise<BuiltinToolResult> => {
185
+ const runtime = this.getRuntime(ctx);
186
+ const result = await runtime.killCommand(params);
187
+ return this.toBuiltinResult(result);
188
+ };
189
+
190
+ // ==================== Search & Find ====================
191
+
192
+ grepContent = async (
193
+ params: GrepContentParams,
194
+ ctx: BuiltinToolContext,
195
+ ): Promise<BuiltinToolResult> => {
196
+ const runtime = this.getRuntime(ctx);
197
+ const result = await runtime.grepContent(params);
198
+ return this.toBuiltinResult(result);
199
+ };
200
+
201
+ globLocalFiles = async (
202
+ params: GlobLocalFilesParams,
203
+ ctx: BuiltinToolContext,
204
+ ): Promise<BuiltinToolResult> => {
205
+ const runtime = this.getRuntime(ctx);
206
+ const result = await runtime.globLocalFiles(params);
207
+ return this.toBuiltinResult(result);
208
+ };
209
+
210
+ // ==================== Export Operations ====================
211
+
212
+ exportFile = async (
213
+ params: ExportFileParams,
214
+ ctx: BuiltinToolContext,
215
+ ): Promise<BuiltinToolResult> => {
216
+ const runtime = this.getRuntime(ctx);
217
+ const result = await runtime.exportFile(params);
218
+ return this.toBuiltinResult(result);
219
+ };
220
+
221
+ // ==================== Helper Methods ====================
222
+
223
+ /**
224
+ * Convert BuiltinServerRuntimeOutput to BuiltinToolResult
225
+ */
226
+ private toBuiltinResult(output: {
227
+ content: string;
228
+ error?: any;
229
+ state?: any;
230
+ success: boolean;
231
+ }): BuiltinToolResult {
232
+ if (!output.success) {
233
+ return {
234
+ content: output.content,
235
+ error: {
236
+ body: output.error,
237
+ message: output.content || 'Unknown error',
238
+ type: 'PluginServerError',
239
+ },
240
+ state: output.state,
241
+ success: false,
242
+ };
243
+ }
244
+
245
+ return {
246
+ content: output.content,
247
+ state: output.state,
248
+ success: true,
249
+ };
250
+ }
251
+ }
252
+
253
+ // Export the executor instance for registration
254
+ export const cloudSandboxExecutor = new CloudSandboxExecutor();
@@ -1,3 +1,4 @@
1
+ export * from './ExecutionRuntime';
1
2
  export * from './manifest';
2
3
  export * from './systemRole';
3
4
  export * from './types';
@@ -0,0 +1,22 @@
1
+ /**
2
+ * API names for Cloud Sandbox tool
3
+ */
4
+ export const CloudSandboxApiName = {
5
+ editLocalFile: 'editLocalFile',
6
+ executeCode: 'executeCode',
7
+ exportFile: 'exportFile',
8
+ getCommandOutput: 'getCommandOutput',
9
+ globLocalFiles: 'globLocalFiles',
10
+ grepContent: 'grepContent',
11
+ killCommand: 'killCommand',
12
+ listLocalFiles: 'listLocalFiles',
13
+ moveLocalFiles: 'moveLocalFiles',
14
+ readLocalFile: 'readLocalFile',
15
+ renameLocalFile: 'renameLocalFile',
16
+ runCommand: 'runCommand',
17
+ searchLocalFiles: 'searchLocalFiles',
18
+ writeLocalFile: 'writeLocalFile',
19
+ } as const;
20
+
21
+ export type CloudSandboxApiNameType =
22
+ (typeof CloudSandboxApiName)[keyof typeof CloudSandboxApiName];
@@ -0,0 +1,4 @@
1
+ export * from './api';
2
+ export * from './params';
3
+ export * from './service';
4
+ export * from './state';
@@ -0,0 +1,85 @@
1
+ // ==================== File Operations Params ====================
2
+
3
+ export interface ListLocalFilesParams {
4
+ directoryPath: string;
5
+ }
6
+
7
+ export interface ReadLocalFileParams {
8
+ endLine?: number;
9
+ path: string;
10
+ startLine?: number;
11
+ }
12
+
13
+ export interface WriteLocalFileParams {
14
+ content: string;
15
+ createDirectories?: boolean;
16
+ path: string;
17
+ }
18
+
19
+ export interface EditLocalFileParams {
20
+ all?: boolean;
21
+ path: string;
22
+ replace: string;
23
+ search: string;
24
+ }
25
+
26
+ export interface SearchLocalFilesParams {
27
+ directory: string;
28
+ fileType?: string;
29
+ keyword?: string;
30
+ modifiedAfter?: string;
31
+ modifiedBefore?: string;
32
+ }
33
+
34
+ export interface MoveLocalFilesParams {
35
+ operations: Array<{
36
+ destination: string;
37
+ source: string;
38
+ }>;
39
+ }
40
+
41
+ export interface RenameLocalFileParams {
42
+ newName: string;
43
+ oldPath: string;
44
+ }
45
+
46
+ export interface GlobLocalFilesParams {
47
+ directory?: string;
48
+ pattern: string;
49
+ }
50
+
51
+ export interface ExportFileParams {
52
+ path: string;
53
+ }
54
+
55
+ // ==================== Code Execution Params ====================
56
+
57
+ export interface ExecuteCodeParams {
58
+ code: string;
59
+ language?: 'javascript' | 'python' | 'typescript';
60
+ }
61
+
62
+ // ==================== Shell Command Params ====================
63
+
64
+ export interface RunCommandParams {
65
+ background?: boolean;
66
+ command: string;
67
+ timeout?: number;
68
+ }
69
+
70
+ export interface GetCommandOutputParams {
71
+ commandId: string;
72
+ }
73
+
74
+ export interface KillCommandParams {
75
+ commandId: string;
76
+ }
77
+
78
+ // ==================== Search & Find Params ====================
79
+
80
+ export interface GrepContentParams {
81
+ directory: string;
82
+ filePattern?: string;
83
+ pattern: string;
84
+ recursive?: boolean;
85
+ }
@@ -0,0 +1,48 @@
1
+ // ==================== Sandbox Service Interface ====================
2
+
3
+ /**
4
+ * Result of calling a sandbox tool
5
+ */
6
+ export interface SandboxCallToolResult {
7
+ error?: { message: string; name?: string };
8
+ result: any;
9
+ sessionExpiredAndRecreated?: boolean;
10
+ success: boolean;
11
+ }
12
+
13
+ /**
14
+ * Result of exporting and uploading a file from sandbox
15
+ */
16
+ export interface SandboxExportFileResult {
17
+ error?: { message: string };
18
+ fileId?: string;
19
+ filename: string;
20
+ mimeType?: string;
21
+ size?: number;
22
+ success: boolean;
23
+ url?: string;
24
+ }
25
+
26
+ /**
27
+ * Sandbox Service Interface - for dependency injection
28
+ *
29
+ * Context (topicId, userId) is bound at service creation time, not passed per-call.
30
+ * This allows CloudSandboxExecutionRuntime to work on both client and server:
31
+ * - Client: Implemented via tRPC client (codeInterpreterService)
32
+ * - Server: Implemented via MarketSDK directly (ServerSandboxService)
33
+ */
34
+ export interface ISandboxService {
35
+ /**
36
+ * Call a sandbox tool
37
+ * @param toolName - The name of the tool to call (e.g., 'runCommand', 'writeLocalFile')
38
+ * @param params - The parameters for the tool
39
+ */
40
+ callTool(toolName: string, params: Record<string, any>): Promise<SandboxCallToolResult>;
41
+
42
+ /**
43
+ * Export a file from sandbox and upload to cloud storage
44
+ * @param path - The file path in the sandbox
45
+ * @param filename - The name of the file to export
46
+ */
47
+ exportAndUploadFile(path: string, filename: string): Promise<SandboxExportFileResult>;
48
+ }
@@ -1,26 +1,3 @@
1
- /**
2
- * API names for Cloud Sandbox tool
3
- */
4
- export const CloudSandboxApiName = {
5
- editLocalFile: 'editLocalFile',
6
- executeCode: 'executeCode',
7
- exportFile: 'exportFile',
8
- getCommandOutput: 'getCommandOutput',
9
- globLocalFiles: 'globLocalFiles',
10
- grepContent: 'grepContent',
11
- killCommand: 'killCommand',
12
- listLocalFiles: 'listLocalFiles',
13
- moveLocalFiles: 'moveLocalFiles',
14
- readLocalFile: 'readLocalFile',
15
- renameLocalFile: 'renameLocalFile',
16
- runCommand: 'runCommand',
17
- searchLocalFiles: 'searchLocalFiles',
18
- writeLocalFile: 'writeLocalFile',
19
- } as const;
20
-
21
- export type CloudSandboxApiNameType =
22
- (typeof CloudSandboxApiName)[keyof typeof CloudSandboxApiName];
23
-
24
1
  // ==================== File Operations ====================
25
2
 
26
3
  export interface ListLocalFilesState {
@@ -278,16 +278,16 @@ export const MemoryManifest: BuiltinToolManifest = {
278
278
  },
279
279
  },
280
280
  required: [
281
+ 'situation',
282
+ 'reasoning',
281
283
  'action',
284
+ 'possibleOutcome',
282
285
  'keyLearning',
283
- 'knowledgeValueScore',
286
+ 'type',
284
287
  'labels',
285
- 'possibleOutcome',
286
288
  'problemSolvingScore',
287
- 'reasoning',
288
289
  'scoreConfidence',
289
- 'situation',
290
- 'type',
290
+ 'knowledgeValueScore',
291
291
  ],
292
292
  type: 'object',
293
293
  },
@@ -10,3 +10,8 @@ export {
10
10
 
11
11
  // Desktop window constants
12
12
  export const TITLE_BAR_HEIGHT = 38;
13
+
14
+ export const APP_WINDOW_MIN_SIZE = {
15
+ height: 600,
16
+ width: 1000,
17
+ } as const;
@@ -21,7 +21,7 @@ describe('EditorRuntime - Real Cases', () => {
21
21
  let mockTitleGetter: ReturnType<typeof vi.fn>;
22
22
 
23
23
  beforeEach(() => {
24
- editor = new Kernel();
24
+ editor = new Kernel() as unknown as IEditor;
25
25
  editor.registerPlugins([CommonPlugin, MarkdownPlugin, ListPlugin, LitexmlPlugin]);
26
26
  editor.initNodeEditor();
27
27
 
@@ -19,7 +19,7 @@ describe('EditorRuntime', () => {
19
19
 
20
20
  beforeEach(() => {
21
21
  resetRandomKey();
22
- editor = new Kernel();
22
+ editor = new Kernel() as unknown as IEditor;
23
23
  editor.registerPlugins([CommonPlugin, MarkdownPlugin, LitexmlPlugin]);
24
24
  editor.initNodeEditor();
25
25
 
@@ -22,5 +22,9 @@ export type MainBroadcastParams<T extends MainBroadcastEventKey> = Parameters<
22
22
  MainBroadcastEvents[T]
23
23
  >[0];
24
24
 
25
- export type { MarketAuthorizationParams } from './remoteServer';
25
+ export type {
26
+ AuthorizationPhase,
27
+ AuthorizationProgress,
28
+ MarketAuthorizationParams,
29
+ } from './remoteServer';
26
30
  export type { OpenSettingsWindowOptions } from './windows';
@@ -2,11 +2,34 @@ export interface MarketAuthorizationParams {
2
2
  authUrl: string;
3
3
  }
4
4
 
5
+ /**
6
+ * Authorization phase for progress tracking
7
+ */
8
+ export type AuthorizationPhase =
9
+ | 'browser_opened' // Browser has been opened for authorization
10
+ | 'waiting_for_auth' // Waiting for user to complete browser login
11
+ | 'verifying' // Received credentials, verifying with server
12
+ | 'cancelled'; // Authorization was cancelled by user
13
+
14
+ /**
15
+ * Authorization progress info for UI updates
16
+ */
17
+ export interface AuthorizationProgress {
18
+ /** Elapsed time in milliseconds since authorization started */
19
+ elapsed: number;
20
+ /** Maximum polling time in milliseconds */
21
+ maxPollTime: number;
22
+ /** Current authorization phase */
23
+ phase: AuthorizationPhase;
24
+ }
25
+
5
26
  /**
6
27
  * 从主进程广播的远程服务器相关事件
7
28
  */
8
29
  export interface RemoteServerBroadcastEvents {
9
30
  authorizationFailed: (params: { error: string }) => void;
31
+ /** Broadcast authorization progress for UI updates */
32
+ authorizationProgress: (params: AuthorizationProgress) => void;
10
33
  authorizationRequired: (params: void) => void;
11
34
  authorizationSuccessful: (params: void) => void;
12
35
  remoteServerConfigUpdated: (params: void) => void;
@@ -3,6 +3,7 @@ export interface WindowSizeParams {
3
3
  width?: number;
4
4
  }
5
5
 
6
- export interface WindowResizableParams {
7
- resizable: boolean;
6
+ export interface WindowMinimumSizeParams {
7
+ height?: number;
8
+ width?: number;
8
9
  }
@@ -3,5 +3,4 @@ export * from './context';
3
3
  export * from './experience';
4
4
  export * from './gatekeeper';
5
5
  export * from './identity';
6
- export * from './jsonSchemas';
7
6
  export * from './preference';
@@ -14,7 +14,7 @@ const InternLM: ModelProviderCard = {
14
14
  settings: {
15
15
  disableBrowserRequest: true,
16
16
  proxyUrl: {
17
- placeholder: 'https://internlm-chat.intern-ai.org.cn/puyu/api/v1',
17
+ placeholder: 'https://chat.intern-ai.org.cn/api/v1',
18
18
  },
19
19
  sdkType: 'openai',
20
20
  showModelFetcher: true,
@@ -133,14 +133,6 @@ export interface CreateRouterRuntimeOptions<T extends Record<string, any> = any>
133
133
  routers: Routers;
134
134
  }
135
135
 
136
- const formatErrorMessage = (error: unknown): string => {
137
- if (error instanceof Error) {
138
- return error.name ? `${error.name}: ${error.message}` : error.message;
139
- }
140
-
141
- return String(error);
142
- };
143
-
144
136
  export const createRouterRuntime = ({
145
137
  id,
146
138
  routers,
@@ -310,30 +302,28 @@ export const createRouterRuntime = ({
310
302
  } catch (error) {
311
303
  lastError = error;
312
304
 
313
- const message = formatErrorMessage(error);
314
305
  if (attempt < totalOptions) {
315
306
  log(
316
- 'attempt failed, fallback to next: model=%s attempt=%d/%d apiType=%s channelId=%s remark=%s error=%s',
317
- model,
307
+ 'attempt %d/%d failed (model=%s apiType=%s channelId=%s remark=%s), trying next',
318
308
  attempt,
319
309
  totalOptions,
310
+ model,
320
311
  resolvedApiType,
321
312
  channelId ?? '',
322
313
  remark ?? '',
323
- message,
324
314
  );
325
315
  } else {
326
316
  log(
327
- 'attempt failed, no more fallbacks: model=%s attempt=%d/%d apiType=%s channelId=%s remark=%s error=%s',
328
- model,
317
+ 'attempt %d/%d failed (model=%s apiType=%s channelId=%s remark=%s), no more fallbacks',
329
318
  attempt,
330
319
  totalOptions,
320
+ model,
331
321
  resolvedApiType,
332
322
  channelId ?? '',
333
323
  remark ?? '',
334
- message,
335
324
  );
336
325
  }
326
+ console.error(error);
337
327
  }
338
328
  }
339
329