@lobehub/lobehub 2.0.0-next.343 → 2.0.0-next.344
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
CHANGED
|
@@ -2,6 +2,31 @@
|
|
|
2
2
|
|
|
3
3
|
# Changelog
|
|
4
4
|
|
|
5
|
+
## [Version 2.0.0-next.344](https://github.com/lobehub/lobe-chat/compare/v2.0.0-next.343...v2.0.0-next.344)
|
|
6
|
+
|
|
7
|
+
<sup>Released on **2026-01-23**</sup>
|
|
8
|
+
|
|
9
|
+
#### 🐛 Bug Fixes
|
|
10
|
+
|
|
11
|
+
- **misc**: Fixed the sandbox tools call when error should use right callback.
|
|
12
|
+
|
|
13
|
+
<br/>
|
|
14
|
+
|
|
15
|
+
<details>
|
|
16
|
+
<summary><kbd>Improvements and Fixes</kbd></summary>
|
|
17
|
+
|
|
18
|
+
#### What's fixed
|
|
19
|
+
|
|
20
|
+
- **misc**: Fixed the sandbox tools call when error should use right callback, closes [#11721](https://github.com/lobehub/lobe-chat/issues/11721) ([e8fce68](https://github.com/lobehub/lobe-chat/commit/e8fce68))
|
|
21
|
+
|
|
22
|
+
</details>
|
|
23
|
+
|
|
24
|
+
<div align="right">
|
|
25
|
+
|
|
26
|
+
[](#readme-top)
|
|
27
|
+
|
|
28
|
+
</div>
|
|
29
|
+
|
|
5
30
|
## [Version 2.0.0-next.343](https://github.com/lobehub/lobe-chat/compare/v2.0.0-next.342...v2.0.0-next.343)
|
|
6
31
|
|
|
7
32
|
<sup>Released on **2026-01-23**</sup>
|
package/changelog/v1.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lobehub/lobehub",
|
|
3
|
-
"version": "2.0.0-next.
|
|
3
|
+
"version": "2.0.0-next.344",
|
|
4
4
|
"description": "LobeHub - an open-source,comprehensive AI Agent framework that supports speech synthesis, multimodal, and extensible Function Call plugin system. Supports one-click free deployment of your private ChatGPT/LLM web application.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"framework",
|
|
@@ -65,6 +65,14 @@ export class CloudSandboxExecutionRuntime {
|
|
|
65
65
|
try {
|
|
66
66
|
const result = await this.callTool('listLocalFiles', args);
|
|
67
67
|
|
|
68
|
+
if (!result.success) {
|
|
69
|
+
return {
|
|
70
|
+
content: result.error?.message || JSON.stringify(result.error),
|
|
71
|
+
state: { files: [] },
|
|
72
|
+
success: true,
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
|
|
68
76
|
const files = result.result?.files || [];
|
|
69
77
|
const state: ListLocalFilesState = { files };
|
|
70
78
|
|
|
@@ -90,6 +98,19 @@ export class CloudSandboxExecutionRuntime {
|
|
|
90
98
|
try {
|
|
91
99
|
const result = await this.callTool('readLocalFile', args);
|
|
92
100
|
|
|
101
|
+
if (!result.success) {
|
|
102
|
+
return {
|
|
103
|
+
content: result.error?.message || JSON.stringify(result.error),
|
|
104
|
+
state: {
|
|
105
|
+
content: '',
|
|
106
|
+
endLine: args.endLine,
|
|
107
|
+
path: args.path,
|
|
108
|
+
startLine: args.startLine,
|
|
109
|
+
},
|
|
110
|
+
success: true,
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
|
|
93
114
|
const state: ReadLocalFileState = {
|
|
94
115
|
content: result.result?.content || '',
|
|
95
116
|
endLine: args.endLine,
|
|
@@ -123,6 +144,17 @@ export class CloudSandboxExecutionRuntime {
|
|
|
123
144
|
try {
|
|
124
145
|
const result = await this.callTool('writeLocalFile', args);
|
|
125
146
|
|
|
147
|
+
if (!result.success) {
|
|
148
|
+
return {
|
|
149
|
+
content: result.error?.message || JSON.stringify(result.error),
|
|
150
|
+
state: {
|
|
151
|
+
path: args.path,
|
|
152
|
+
success: false,
|
|
153
|
+
},
|
|
154
|
+
success: true,
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
|
|
126
158
|
const state: WriteLocalFileState = {
|
|
127
159
|
bytesWritten: result.result?.bytesWritten,
|
|
128
160
|
path: args.path,
|
|
@@ -148,6 +180,17 @@ export class CloudSandboxExecutionRuntime {
|
|
|
148
180
|
try {
|
|
149
181
|
const result = await this.callTool('editLocalFile', args);
|
|
150
182
|
|
|
183
|
+
if (!result.success) {
|
|
184
|
+
return {
|
|
185
|
+
content: result.error?.message || JSON.stringify(result.error),
|
|
186
|
+
state: {
|
|
187
|
+
path: args.path,
|
|
188
|
+
replacements: 0,
|
|
189
|
+
},
|
|
190
|
+
success: true,
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
|
|
151
194
|
const state: EditLocalFileState = {
|
|
152
195
|
diffText: result.result?.diffText,
|
|
153
196
|
linesAdded: result.result?.linesAdded,
|
|
@@ -177,6 +220,17 @@ export class CloudSandboxExecutionRuntime {
|
|
|
177
220
|
try {
|
|
178
221
|
const result = await this.callTool('searchLocalFiles', args);
|
|
179
222
|
|
|
223
|
+
if (!result.success) {
|
|
224
|
+
return {
|
|
225
|
+
content: result.error?.message || JSON.stringify(result.error),
|
|
226
|
+
state: {
|
|
227
|
+
results: [],
|
|
228
|
+
totalCount: 0,
|
|
229
|
+
},
|
|
230
|
+
success: true,
|
|
231
|
+
};
|
|
232
|
+
}
|
|
233
|
+
|
|
180
234
|
const results = result.result?.results || [];
|
|
181
235
|
const state: SearchLocalFilesState = {
|
|
182
236
|
results,
|
|
@@ -201,6 +255,18 @@ export class CloudSandboxExecutionRuntime {
|
|
|
201
255
|
try {
|
|
202
256
|
const result = await this.callTool('moveLocalFiles', args);
|
|
203
257
|
|
|
258
|
+
if (!result.success) {
|
|
259
|
+
return {
|
|
260
|
+
content: result.error?.message || JSON.stringify(result.error),
|
|
261
|
+
state: {
|
|
262
|
+
results: [],
|
|
263
|
+
successCount: 0,
|
|
264
|
+
totalCount: args.operations.length,
|
|
265
|
+
},
|
|
266
|
+
success: true,
|
|
267
|
+
};
|
|
268
|
+
}
|
|
269
|
+
|
|
204
270
|
const results = result.result?.results || [];
|
|
205
271
|
const state: MoveLocalFilesState = {
|
|
206
272
|
results,
|
|
@@ -224,6 +290,19 @@ export class CloudSandboxExecutionRuntime {
|
|
|
224
290
|
try {
|
|
225
291
|
const result = await this.callTool('renameLocalFile', args);
|
|
226
292
|
|
|
293
|
+
if (!result.success) {
|
|
294
|
+
return {
|
|
295
|
+
content: result.error?.message || JSON.stringify(result.error),
|
|
296
|
+
state: {
|
|
297
|
+
error: result.error?.message,
|
|
298
|
+
newPath: '',
|
|
299
|
+
oldPath: args.oldPath,
|
|
300
|
+
success: false,
|
|
301
|
+
},
|
|
302
|
+
success: true,
|
|
303
|
+
};
|
|
304
|
+
}
|
|
305
|
+
|
|
227
306
|
const state: RenameLocalFileState = {
|
|
228
307
|
error: result.result?.error,
|
|
229
308
|
newPath: result.result?.newPath || '',
|
|
@@ -241,7 +320,7 @@ export class CloudSandboxExecutionRuntime {
|
|
|
241
320
|
return {
|
|
242
321
|
content,
|
|
243
322
|
state,
|
|
244
|
-
success:
|
|
323
|
+
success: true,
|
|
245
324
|
};
|
|
246
325
|
} catch (error) {
|
|
247
326
|
return this.handleError(error);
|
|
@@ -264,15 +343,24 @@ export class CloudSandboxExecutionRuntime {
|
|
|
264
343
|
language,
|
|
265
344
|
output: result.result?.output,
|
|
266
345
|
stderr: result.result?.stderr,
|
|
267
|
-
success: result.success,
|
|
346
|
+
success: result.success || false,
|
|
268
347
|
};
|
|
269
348
|
|
|
349
|
+
if (!result.success) {
|
|
350
|
+
return {
|
|
351
|
+
content: result.error?.message || JSON.stringify(result.error),
|
|
352
|
+
state,
|
|
353
|
+
success: true,
|
|
354
|
+
};
|
|
355
|
+
}
|
|
356
|
+
|
|
270
357
|
return {
|
|
271
358
|
content: JSON.stringify(result.result),
|
|
272
359
|
state,
|
|
273
|
-
success:
|
|
360
|
+
success: true,
|
|
274
361
|
};
|
|
275
362
|
} catch (error) {
|
|
363
|
+
console.log('executeCode error', error);
|
|
276
364
|
return this.handleError(error);
|
|
277
365
|
}
|
|
278
366
|
}
|
|
@@ -283,6 +371,18 @@ export class CloudSandboxExecutionRuntime {
|
|
|
283
371
|
try {
|
|
284
372
|
const result = await this.callTool('runCommand', args);
|
|
285
373
|
|
|
374
|
+
if (!result.success) {
|
|
375
|
+
return {
|
|
376
|
+
content: result.error?.message || JSON.stringify(result.error),
|
|
377
|
+
state: {
|
|
378
|
+
error: result.error?.message,
|
|
379
|
+
isBackground: args.background || false,
|
|
380
|
+
success: false,
|
|
381
|
+
},
|
|
382
|
+
success: true,
|
|
383
|
+
};
|
|
384
|
+
}
|
|
385
|
+
|
|
286
386
|
const state: RunCommandState = {
|
|
287
387
|
commandId: result.result?.commandId,
|
|
288
388
|
error: result.result?.error,
|
|
@@ -296,7 +396,7 @@ export class CloudSandboxExecutionRuntime {
|
|
|
296
396
|
return {
|
|
297
397
|
content: JSON.stringify(result.result),
|
|
298
398
|
state,
|
|
299
|
-
success:
|
|
399
|
+
success: true,
|
|
300
400
|
};
|
|
301
401
|
} catch (error) {
|
|
302
402
|
return this.handleError(error);
|
|
@@ -307,6 +407,18 @@ export class CloudSandboxExecutionRuntime {
|
|
|
307
407
|
try {
|
|
308
408
|
const result = await this.callTool('getCommandOutput', args);
|
|
309
409
|
|
|
410
|
+
if (!result.success) {
|
|
411
|
+
return {
|
|
412
|
+
content: result.error?.message || JSON.stringify(result.error),
|
|
413
|
+
state: {
|
|
414
|
+
error: result.error?.message,
|
|
415
|
+
running: false,
|
|
416
|
+
success: false,
|
|
417
|
+
},
|
|
418
|
+
success: true,
|
|
419
|
+
};
|
|
420
|
+
}
|
|
421
|
+
|
|
310
422
|
const state: GetCommandOutputState = {
|
|
311
423
|
error: result.result?.error,
|
|
312
424
|
newOutput: result.result?.newOutput,
|
|
@@ -317,7 +429,7 @@ export class CloudSandboxExecutionRuntime {
|
|
|
317
429
|
return {
|
|
318
430
|
content: JSON.stringify(result.result),
|
|
319
431
|
state,
|
|
320
|
-
success:
|
|
432
|
+
success: true,
|
|
321
433
|
};
|
|
322
434
|
} catch (error) {
|
|
323
435
|
return this.handleError(error);
|
|
@@ -328,6 +440,18 @@ export class CloudSandboxExecutionRuntime {
|
|
|
328
440
|
try {
|
|
329
441
|
const result = await this.callTool('killCommand', args);
|
|
330
442
|
|
|
443
|
+
if (!result.success) {
|
|
444
|
+
return {
|
|
445
|
+
content: result.error?.message || JSON.stringify(result.error),
|
|
446
|
+
state: {
|
|
447
|
+
commandId: args.commandId,
|
|
448
|
+
error: result.error?.message,
|
|
449
|
+
success: false,
|
|
450
|
+
},
|
|
451
|
+
success: true,
|
|
452
|
+
};
|
|
453
|
+
}
|
|
454
|
+
|
|
331
455
|
const state: KillCommandState = {
|
|
332
456
|
commandId: args.commandId,
|
|
333
457
|
error: result.result?.error,
|
|
@@ -340,7 +464,7 @@ export class CloudSandboxExecutionRuntime {
|
|
|
340
464
|
success: true,
|
|
341
465
|
}),
|
|
342
466
|
state,
|
|
343
|
-
success:
|
|
467
|
+
success: true,
|
|
344
468
|
};
|
|
345
469
|
} catch (error) {
|
|
346
470
|
return this.handleError(error);
|
|
@@ -353,6 +477,18 @@ export class CloudSandboxExecutionRuntime {
|
|
|
353
477
|
try {
|
|
354
478
|
const result = await this.callTool('grepContent', args);
|
|
355
479
|
|
|
480
|
+
if (!result.success) {
|
|
481
|
+
return {
|
|
482
|
+
content: result.error?.message || JSON.stringify(result.error),
|
|
483
|
+
state: {
|
|
484
|
+
matches: [],
|
|
485
|
+
pattern: args.pattern,
|
|
486
|
+
totalMatches: 0,
|
|
487
|
+
},
|
|
488
|
+
success: true,
|
|
489
|
+
};
|
|
490
|
+
}
|
|
491
|
+
|
|
356
492
|
const state: GrepContentState = {
|
|
357
493
|
matches: result.result?.matches || [],
|
|
358
494
|
pattern: args.pattern,
|
|
@@ -373,6 +509,18 @@ export class CloudSandboxExecutionRuntime {
|
|
|
373
509
|
try {
|
|
374
510
|
const result = await this.callTool('globLocalFiles', args);
|
|
375
511
|
|
|
512
|
+
if (!result.success) {
|
|
513
|
+
return {
|
|
514
|
+
content: result.error?.message || JSON.stringify(result.error),
|
|
515
|
+
state: {
|
|
516
|
+
files: [],
|
|
517
|
+
pattern: args.pattern,
|
|
518
|
+
totalCount: 0,
|
|
519
|
+
},
|
|
520
|
+
success: true,
|
|
521
|
+
};
|
|
522
|
+
}
|
|
523
|
+
|
|
376
524
|
const files = result.result?.files || [];
|
|
377
525
|
const totalCount = result.result?.totalCount || 0;
|
|
378
526
|
|
|
@@ -433,7 +581,7 @@ export class CloudSandboxExecutionRuntime {
|
|
|
433
581
|
success: false,
|
|
434
582
|
}),
|
|
435
583
|
state,
|
|
436
|
-
success:
|
|
584
|
+
success: true,
|
|
437
585
|
};
|
|
438
586
|
}
|
|
439
587
|
|
|
@@ -455,13 +603,14 @@ export class CloudSandboxExecutionRuntime {
|
|
|
455
603
|
private async callTool(
|
|
456
604
|
toolName: string,
|
|
457
605
|
params: Record<string, any>,
|
|
458
|
-
): Promise<{
|
|
606
|
+
): Promise<{
|
|
607
|
+
error?: { message: string; name?: string };
|
|
608
|
+
result: any;
|
|
609
|
+
sessionExpiredAndRecreated?: boolean;
|
|
610
|
+
success: boolean;
|
|
611
|
+
}> {
|
|
459
612
|
const result = await this.sandboxService.callTool(toolName, params);
|
|
460
613
|
|
|
461
|
-
if (!result.success) {
|
|
462
|
-
throw new Error(result.error?.message || `Cloud Sandbox tool ${toolName} failed`);
|
|
463
|
-
}
|
|
464
|
-
|
|
465
614
|
return result;
|
|
466
615
|
}
|
|
467
616
|
|