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.

:recycle: refactor rename code-interpreter to cloud-sandbox

arvinxx9ea3df62b304
diff --git a/packages/builtin-tool-code-interpreter/package.json b/packages/builtin-tool-cloud-sandbox/package.json
similarity index 89%
rename from packages/builtin-tool-code-interpreter/package.json
rename to packages/builtin-tool-cloud-sandbox/package.json
index d8ff279eaf9..fc888d4176c 100644
--- a/packages/builtin-tool-code-interpreter/package.json
+++ b/packages/builtin-tool-cloud-sandbox/package.json
@@ -1,5 +1,5 @@
{
- "name": "@lobechat/builtin-tool-code-interpreter",
+ "name": "@lobechat/builtin-tool-cloud-sandbox",
"version": "1.0.0",
"private": true,
"exports": {
diff --git a/packages/builtin-tool-code-interpreter/src/ExecutionRuntime/index.ts b/packages/builtin-tool-cloud-sandbox/src/ExecutionRuntime/index.ts
similarity index 98%
rename from packages/builtin-tool-code-interpreter/src/ExecutionRuntime/index.ts
rename to packages/builtin-tool-cloud-sandbox/src/ExecutionRuntime/index.ts
index 38eabb00ac7..02719560e4c 100644
--- a/packages/builtin-tool-code-interpreter/src/ExecutionRuntime/index.ts
+++ b/packages/builtin-tool-cloud-sandbox/src/ExecutionRuntime/index.ts
@@ -115,7 +115,7 @@ interface ExecuteCodeParams {
language?: 'javascript' | 'python' | 'typescript';
}
-export class CodeInterpreterExecutionRuntime {
+export class CloudSandboxExecutionRuntime {
private context: ExecutionContext;
constructor(context: ExecutionContext) {
@@ -501,9 +501,7 @@ export class CodeInterpreterExecutionRuntime {
const result = await codeInterpreterService.callTool(toolName, params, this.context);
if (!result.success) {
- throw new Error(
- (result as any).error?.message || `Cloud Sandbox tool ${toolName} failed`,
- );
+ throw new Error((result as any).error?.message || `Cloud Sandbox tool ${toolName} failed`);
}
return result;
diff --git a/packages/builtin-tool-code-interpreter/src/client/Inspector/ExecuteCode/index.tsx b/packages/builtin-tool-cloud-sandbox/src/client/Inspector/ExecuteCode/index.tsx
similarity index 88%
rename from packages/builtin-tool-code-interpreter/src/client/Inspector/ExecuteCode/index.tsx
rename to packages/builtin-tool-cloud-sandbox/src/client/Inspector/ExecuteCode/index.tsx
index 75870fa1606..809875254b6 100644
--- a/packages/builtin-tool-code-interpreter/src/client/Inspector/ExecuteCode/index.tsx
+++ b/packages/builtin-tool-cloud-sandbox/src/client/Inspector/ExecuteCode/index.tsx
@@ -43,13 +43,13 @@ export const ExecuteCodeInspector = memo<
if (!description)
return (
<div className={cx(styles.root, shinyTextStyles.shinyText)}>
- <span>{t('builtins.lobe-cloud-code-interpreter.apiName.executeCode')}</span>
+ <span>{t('builtins.lobe-cloud-sandbox.apiName.executeCode')}</span>
</div>
);
return (
<div className={cx(styles.root, shinyTextStyles.shinyText)}>
- <span>{t('builtins.lobe-cloud-code-interpreter.apiName.executeCode')}: </span>
+ <span>{t('builtins.lobe-cloud-sandbox.apiName.executeCode')}: </span>
<span className={highlightTextStyles.gold}>{description}</span>
</div>
);
@@ -58,7 +58,7 @@ export const ExecuteCodeInspector = memo<
return (
<div className={cx(styles.root, isLoading && shinyTextStyles.shinyText)}>
<span style={{ marginInlineStart: 2 }}>
- <span>{t('builtins.lobe-cloud-code-interpreter.apiName.executeCode')}: </span>
+ <span>{t('builtins.lobe-cloud-sandbox.apiName.executeCode')}: </span>
{description && <span className={highlightTextStyles.primary}>{description}</span>}
{isLoading ? null : pluginState?.success ? (
<Check className={styles.statusIcon} color={cssVar.colorSuccess} size={14} />
diff --git a/packages/builtin-tool-code-interpreter/src/client/Inspector/RunCommand/index.tsx b/packages/builtin-tool-cloud-sandbox/src/client/Inspector/RunCommand/index.tsx
similarity index 88%
rename from packages/builtin-tool-code-interpreter/src/client/Inspector/RunCommand/index.tsx
rename to packages/builtin-tool-cloud-sandbox/src/client/Inspector/RunCommand/index.tsx
index 88efc7f6a13..9ac3d93d2f4 100644
--- a/packages/builtin-tool-code-interpreter/src/client/Inspector/RunCommand/index.tsx
+++ b/packages/builtin-tool-cloud-sandbox/src/client/Inspector/RunCommand/index.tsx
@@ -42,13 +42,13 @@ export const RunCommandInspector = memo<BuiltinInspectorProps<RunCommandParams,
if (!description)
return (
<div className={cx(styles.root, shinyTextStyles.shinyText)}>
- <span>{t('builtins.lobe-cloud-code-interpreter.apiName.runCommand')}</span>
+ <span>{t('builtins.lobe-cloud-sandbox.apiName.runCommand')}</span>
</div>
);
return (
<div className={cx(styles.root, shinyTextStyles.shinyText)}>
- <span>{t('builtins.lobe-cloud-code-interpreter.apiName.runCommand')}: </span>
+ <span>{t('builtins.lobe-cloud-sandbox.apiName.runCommand')}: </span>
<span className={highlightTextStyles.primary}>{description}</span>
</div>
);
@@ -57,7 +57,7 @@ export const RunCommandInspector = memo<BuiltinInspectorProps<RunCommandParams,
return (
<div className={cx(styles.root, isLoading && shinyTextStyles.shinyText)}>
<span style={{ marginInlineStart: 2 }}>
- <span>{t('builtins.lobe-cloud-code-interpreter.apiName.runCommand')}: </span>
+ <span>{t('builtins.lobe-cloud-sandbox.apiName.runCommand')}: </span>
{description && <span className={highlightTextStyles.primary}>{description}</span>}
{isLoading ? null : pluginState?.success && pluginState?.exitCode === 0 ? (
<Check className={styles.statusIcon} color={cssVar.colorSuccess} size={14} />
diff --git a/packages/builtin-tool-cloud-sandbox/src/client/Inspector/index.ts b/packages/builtin-tool-cloud-sandbox/src/client/Inspector/index.ts
new file mode 100644
index 00000000000..096f9c3fc0c
--- /dev/null
+++ b/packages/builtin-tool-cloud-sandbox/src/client/Inspector/index.ts
@@ -0,0 +1,11 @@
+import { CloudSandboxApiName } from '../../types';
+import { ExecuteCodeInspector } from './ExecuteCode';
+import { RunCommandInspector } from './RunCommand';
+
+/**
+ * Code Interpreter Inspector Components Registry
+ */
+export const CloudSandboxInspectors = {
+ [CloudSandboxApiName.executeCode]: ExecuteCodeInspector,
+ [CloudSandboxApiName.runCommand]: RunCommandInspector,
+};
diff --git a/packages/builtin-tool-code-interpreter/src/client/Intervention/EditLocalFile/index.tsx b/packages/builtin-tool-cloud-sandbox/src/client/Intervention/EditLocalFile/index.tsx
similarity index 100%
rename from packages/builtin-tool-code-interpreter/src/client/Intervention/EditLocalFile/index.tsx
rename to packages/builtin-tool-cloud-sandbox/src/client/Intervention/EditLocalFile/index.tsx
diff --git a/packages/builtin-tool-code-interpreter/src/client/Intervention/ExecuteCode/index.tsx b/packages/builtin-tool-cloud-sandbox/src/client/Intervention/ExecuteCode/index.tsx
similarity index 100%
rename from packages/builtin-tool-code-interpreter/src/client/Intervention/ExecuteCode/index.tsx
rename to packages/builtin-tool-cloud-sandbox/src/client/Intervention/ExecuteCode/index.tsx
diff --git a/packages/builtin-tool-code-interpreter/src/client/Intervention/MoveLocalFiles/index.tsx b/packages/builtin-tool-cloud-sandbox/src/client/Intervention/MoveLocalFiles/index.tsx
similarity index 100%
rename from packages/builtin-tool-code-interpreter/src/client/Intervention/MoveLocalFiles/index.tsx
rename to packages/builtin-tool-cloud-sandbox/src/client/Intervention/MoveLocalFiles/index.tsx
diff --git a/packages/builtin-tool-code-interpreter/src/client/Intervention/RunCommand/index.tsx b/packages/builtin-tool-cloud-sandbox/src/client/Intervention/RunCommand/index.tsx
similarity index 100%
rename from packages/builtin-tool-code-interpreter/src/client/Intervention/RunCommand/index.tsx
rename to packages/builtin-tool-cloud-sandbox/src/client/Intervention/RunCommand/index.tsx
diff --git a/packages/builtin-tool-code-interpreter/src/client/Intervention/WriteFile/index.tsx b/packages/builtin-tool-cloud-sandbox/src/client/Intervention/WriteFile/index.tsx
similarity index 100%
rename from packages/builtin-tool-code-interpreter/src/client/Intervention/WriteFile/index.tsx
rename to packages/builtin-tool-cloud-sandbox/src/client/Intervention/WriteFile/index.tsx
diff --git a/packages/builtin-tool-cloud-sandbox/src/client/Intervention/index.ts b/packages/builtin-tool-cloud-sandbox/src/client/Intervention/index.ts
new file mode 100644
index 00000000000..3d0847511a2
--- /dev/null
+++ b/packages/builtin-tool-cloud-sandbox/src/client/Intervention/index.ts
@@ -0,0 +1,17 @@
+import { CloudSandboxApiName } from '../../types';
+import EditLocalFile from './EditLocalFile';
+import ExecuteCode from './ExecuteCode';
+import MoveLocalFiles from './MoveLocalFiles';
+import RunCommand from './RunCommand';
+import WriteFile from './WriteFile';
+
+/**
+ * Cloud Sandbox Intervention Components Registry
+ */
+export const CloudSandboxInterventions = {
+ [CloudSandboxApiName.editLocalFile]: EditLocalFile,
+ [CloudSandboxApiName.executeCode]: ExecuteCode,
+ [CloudSandboxApiName.moveLocalFiles]: MoveLocalFiles,
+ [CloudSandboxApiName.runCommand]: RunCommand,
+ [CloudSandboxApiName.writeLocalFile]: WriteFile,
+};
diff --git a/packages/builtin-tool-code-interpreter/src/client/Render/EditLocalFile/index.tsx b/packages/builtin-tool-cloud-sandbox/src/client/Render/EditLocalFile/index.tsx
similarity index 100%
rename from packages/builtin-tool-code-interpreter/src/client/Render/EditLocalFile/index.tsx
rename to packages/builtin-tool-cloud-sandbox/src/client/Render/EditLocalFile/index.tsx
diff --git a/packages/builtin-tool-code-interpreter/src/client/Render/ExecuteCode/index.tsx b/packages/builtin-tool-cloud-sandbox/src/client/Render/ExecuteCode/index.tsx
similarity index 100%
rename from packages/builtin-tool-code-interpreter/src/client/Render/ExecuteCode/index.tsx
rename to packages/builtin-tool-cloud-sandbox/src/client/Render/ExecuteCode/index.tsx
diff --git a/packages/builtin-tool-code-interpreter/src/client/Render/ExportFile/index.tsx b/packages/builtin-tool-cloud-sandbox/src/client/Render/ExportFile/index.tsx
similarity index 100%
rename from packages/builtin-tool-code-interpreter/src/client/Render/ExportFile/index.tsx
rename to packages/builtin-tool-cloud-sandbox/src/client/Render/ExportFile/index.tsx
diff --git a/packages/builtin-tool-code-interpreter/src/client/Render/ListFiles/index.tsx b/packages/builtin-tool-cloud-sandbox/src/client/Render/ListFiles/index.tsx
similarity index 100%
rename from packages/builtin-tool-code-interpreter/src/client/Render/ListFiles/index.tsx
rename to packages/builtin-tool-cloud-sandbox/src/client/Render/ListFiles/index.tsx
diff --git a/packages/builtin-tool-code-interpreter/src/client/Render/MoveLocalFiles/index.tsx b/packages/builtin-tool-cloud-sandbox/src/client/Render/MoveLocalFiles/index.tsx
similarity index 100%
rename from packages/builtin-tool-code-interpreter/src/client/Render/MoveLocalFiles/index.tsx
rename to packages/builtin-tool-cloud-sandbox/src/client/Render/MoveLocalFiles/index.tsx
diff --git a/packages/builtin-tool-code-interpreter/src/client/Render/ReadLocalFile/index.tsx b/packages/builtin-tool-cloud-sandbox/src/client/Render/ReadLocalFile/index.tsx
similarity index 100%
rename from packages/builtin-tool-code-interpreter/src/client/Render/ReadLocalFile/index.tsx
rename to packages/builtin-tool-cloud-sandbox/src/client/Render/ReadLocalFile/index.tsx
diff --git a/packages/builtin-tool-code-interpreter/src/client/Render/RunCommand/index.tsx b/packages/builtin-tool-cloud-sandbox/src/client/Render/RunCommand/index.tsx
similarity index 100%
rename from packages/builtin-tool-code-interpreter/src/client/Render/RunCommand/index.tsx
rename to packages/builtin-tool-cloud-sandbox/src/client/Render/RunCommand/index.tsx
diff --git a/packages/builtin-tool-code-interpreter/src/client/Render/SearchFiles/index.tsx b/packages/builtin-tool-cloud-sandbox/src/client/Render/SearchFiles/index.tsx
similarity index 100%
rename from packages/builtin-tool-code-interpreter/src/client/Render/SearchFiles/index.tsx
rename to packages/builtin-tool-cloud-sandbox/src/client/Render/SearchFiles/index.tsx
diff --git a/packages/builtin-tool-code-interpreter/src/client/Render/WriteFile/index.tsx b/packages/builtin-tool-cloud-sandbox/src/client/Render/WriteFile/index.tsx
similarity index 100%
rename from packages/builtin-tool-code-interpreter/src/client/Render/WriteFile/index.tsx
rename to packages/builtin-tool-cloud-sandbox/src/client/Render/WriteFile/index.tsx
diff --git a/packages/builtin-tool-cloud-sandbox/src/client/Render/index.ts b/packages/builtin-tool-cloud-sandbox/src/client/Render/index.ts
new file mode 100644
index 00000000000..6639b447866
--- /dev/null
+++ b/packages/builtin-tool-cloud-sandbox/src/client/Render/index.ts
@@ -0,0 +1,29 @@
+import { CloudSandboxApiName } from '../../types';
+import EditLocalFile from './EditLocalFile';
+import ExecuteCode from './ExecuteCode';
+import ExportFile from './ExportFile';
+import ListFiles from './ListFiles';
+import MoveLocalFiles from './MoveLocalFiles';
+import ReadLocalFile from './ReadLocalFile';
+import RunCommand from './RunCommand';
+import SearchFiles from './SearchFiles';
+import WriteFile from './WriteFile';
+
+/**
+ * Cloud Sandbox Render Components Registry
+ */
+export const CloudSandboxRenders = {
+ [CloudSandboxApiName.editLocalFile]: EditLocalFile,
+ [CloudSandboxApiName.executeCode]: ExecuteCode,
+ [CloudSandboxApiName.exportFile]: ExportFile,
+ [CloudSandboxApiName.listLocalFiles]: ListFiles,
+ [CloudSandboxApiName.moveLocalFiles]: MoveLocalFiles,
+ [CloudSandboxApiName.readLocalFile]: ReadLocalFile,
+ [CloudSandboxApiName.runCommand]: RunCommand,
+ [CloudSandboxApiName.searchLocalFiles]: SearchFiles,
+ [CloudSandboxApiName.writeLocalFile]: WriteFile,
+};
+
+// Export API names for use in other modules
+
+export { CloudSandboxApiName } from '../../types';
diff --git a/packages/builtin-tool-code-interpreter/src/client/Streaming/ExecuteCode/index.tsx b/packages/builtin-tool-cloud-sandbox/src/client/Streaming/ExecuteCode/index.tsx
similarity index 100%
rename from packages/builtin-tool-code-interpreter/src/client/Streaming/ExecuteCode/index.tsx
rename to packages/builtin-tool-cloud-sandbox/src/client/Streaming/ExecuteCode/index.tsx
diff --git a/packages/builtin-tool-cloud-sandbox/src/client/Streaming/index.ts b/packages/builtin-tool-cloud-sandbox/src/client/Streaming/index.ts
new file mode 100644
index 00000000000..544db7bf402
--- /dev/null
+++ b/packages/builtin-tool-cloud-sandbox/src/client/Streaming/index.ts
@@ -0,0 +1,9 @@
+import { CloudSandboxApiName } from '../../types';
+import { ExecuteCodeStreaming } from './ExecuteCode';
+
+/**
+ * Code Interpreter Streaming Components Registry
+ */
+export const CloudSandboxStreamings = {
+ [CloudSandboxApiName.executeCode]: ExecuteCodeStreaming,
+};
diff --git a/packages/builtin-tool-cloud-sandbox/src/client/index.ts b/packages/builtin-tool-cloud-sandbox/src/client/index.ts
new file mode 100644
index 00000000000..c00f880bf8f
--- /dev/null
+++ b/packages/builtin-tool-cloud-sandbox/src/client/index.ts
@@ -0,0 +1,15 @@
+// Inspector components (customized tool call headers)
+export { CloudSandboxInspectors } from './Inspector';
+
+// Render components (read-only snapshots)
+export { CloudSandboxRenders } from './Render';
+
+// Intervention components (approval dialogs)
+export { CloudSandboxInterventions } from './Intervention';
+
+// Streaming components
+export { CloudSandboxStreamings } from './Streaming';
+
+// Re-export types and manifest for convenience
+export { CloudSandboxIdentifier, CloudSandboxManifest } from '../manifest';
+export * from '../types';
diff --git a/packages/builtin-tool-code-interpreter/src/index.ts b/packages/builtin-tool-cloud-sandbox/src/index.ts
similarity index 100%
rename from packages/builtin-tool-code-interpreter/src/index.ts
rename to packages/builtin-tool-cloud-sandbox/src/index.ts
diff --git a/packages/builtin-tool-code-interpreter/src/manifest.ts b/packages/builtin-tool-cloud-sandbox/src/manifest.ts
similarity index 90%
rename from packages/builtin-tool-code-interpreter/src/manifest.ts
rename to packages/builtin-tool-cloud-sandbox/src/manifest.ts
index 4492bf853a3..44aa4262213 100644
--- a/packages/builtin-tool-code-interpreter/src/manifest.ts
+++ b/packages/builtin-tool-cloud-sandbox/src/manifest.ts
@@ -1,18 +1,18 @@
import type { BuiltinToolManifest } from '@lobechat/types';
import { systemPrompt } from './systemRole';
-import { CodeInterpreterApiName } from './types';
+import { CloudSandboxApiName } from './types';
-export const CodeInterpreterIdentifier = 'lobe-cloud-sandbox';
+export const CloudSandboxIdentifier = 'lobe-cloud-sandbox';
/* eslint-disable sort-keys-fix/sort-keys-fix */
-export const CodeInterpreterManifest: BuiltinToolManifest = {
+export const CloudSandboxManifest: BuiltinToolManifest = {
api: [
{
description:
'Execute code directly in the sandbox environment. Supports Python, JavaScript, and TypeScript. Returns execution output, errors, and exit code.',
humanIntervention: 'required',
- name: CodeInterpreterApiName.executeCode,
+ name: CloudSandboxApiName.executeCode,
parameters: {
properties: {
description: {
@@ -37,7 +37,7 @@ export const CodeInterpreterManifest: BuiltinToolManifest = {
{
description:
'List files and folders in a specified directory. Input should be a path. Output is a JSON array of file/folder names.',
- name: CodeInterpreterApiName.listLocalFiles,
+ name: CloudSandboxApiName.listLocalFiles,
parameters: {
properties: {
directoryPath: {
@@ -52,7 +52,7 @@ export const CodeInterpreterManifest: BuiltinToolManifest = {
{
description:
'Read the content of a specific file. Input should be the file path. Output is the file content as a string.',
- name: CodeInterpreterApiName.readLocalFile,
+ name: CloudSandboxApiName.readLocalFile,
parameters: {
properties: {
endLine: {
@@ -74,7 +74,7 @@ export const CodeInterpreterManifest: BuiltinToolManifest = {
},
{
description: 'Search for files within the sandbox based on keywords and filter options.',
- name: CodeInterpreterApiName.searchLocalFiles,
+ name: CloudSandboxApiName.searchLocalFiles,
parameters: {
properties: {
directory: {
@@ -106,7 +106,7 @@ export const CodeInterpreterManifest: BuiltinToolManifest = {
description:
'Moves or renames multiple files/directories. Input is an array of operations with source and destination paths.',
humanIntervention: 'required',
- name: CodeInterpreterApiName.moveLocalFiles,
+ name: CloudSandboxApiName.moveLocalFiles,
parameters: {
properties: {
operations: {
@@ -135,7 +135,7 @@ export const CodeInterpreterManifest: BuiltinToolManifest = {
{
description:
'Rename a file or folder in its current location. Input should be the current full path and the new name.',
- name: CodeInterpreterApiName.renameLocalFile,
+ name: CloudSandboxApiName.renameLocalFile,
parameters: {
properties: {
newName: {
@@ -155,7 +155,7 @@ export const CodeInterpreterManifest: BuiltinToolManifest = {
description:
'Write content to a specific file. Input should be the file path and content. Overwrites existing file or creates a new one.',
humanIntervention: 'required',
- name: CodeInterpreterApiName.writeLocalFile,
+ name: CloudSandboxApiName.writeLocalFile,
parameters: {
properties: {
content: {
@@ -179,7 +179,7 @@ export const CodeInterpreterManifest: BuiltinToolManifest = {
description:
'Perform exact string replacements in files. Must read the file first before editing.',
humanIntervention: 'required',
- name: CodeInterpreterApiName.editLocalFile,
+ name: CloudSandboxApiName.editLocalFile,
parameters: {
properties: {
all: {
@@ -207,7 +207,7 @@ export const CodeInterpreterManifest: BuiltinToolManifest = {
description:
'Execute a shell command and return its output. Supports both synchronous and background execution with timeout control.',
humanIntervention: 'required',
- name: CodeInterpreterApiName.runCommand,
+ name: CloudSandboxApiName.runCommand,
parameters: {
properties: {
description: {
@@ -235,7 +235,7 @@ export const CodeInterpreterManifest: BuiltinToolManifest = {
{
description:
'Retrieve output from a running or completed background shell command. Returns only new output since the last check.',
- name: CodeInterpreterApiName.getCommandOutput,
+ name: CloudSandboxApiName.getCommandOutput,
parameters: {
properties: {
commandId: {
@@ -249,7 +249,7 @@ export const CodeInterpreterManifest: BuiltinToolManifest = {
},
{
description: 'Kill a running background shell command by its ID.',
- name: CodeInterpreterApiName.killCommand,
+ name: CloudSandboxApiName.killCommand,
parameters: {
properties: {
commandId: {
@@ -264,7 +264,7 @@ export const CodeInterpreterManifest: BuiltinToolManifest = {
{
description:
'Search for content within files using regex patterns. Supports various output modes and filtering options.',
- name: CodeInterpreterApiName.grepContent,
+ name: CloudSandboxApiName.grepContent,
parameters: {
properties: {
directory: {
@@ -291,7 +291,7 @@ export const CodeInterpreterManifest: BuiltinToolManifest = {
{
description:
'Find files matching glob patterns. Supports standard glob syntax like "**/*.js" or "src/**/*.ts".',
- name: CodeInterpreterApiName.globLocalFiles,
+ name: CloudSandboxApiName.globLocalFiles,
parameters: {
properties: {
directory: {
@@ -310,7 +310,7 @@ export const CodeInterpreterManifest: BuiltinToolManifest = {
{
description:
'Export a file from the sandbox to cloud storage. The file will be uploaded to a pre-signed URL and can be downloaded by the user.',
- name: CodeInterpreterApiName.exportFile,
+ name: CloudSandboxApiName.exportFile,
parameters: {
properties: {
path: {
@@ -324,14 +324,13 @@ export const CodeInterpreterManifest: BuiltinToolManifest = {
},
},
],
- identifier: CodeInterpreterIdentifier,
+ identifier: CloudSandboxIdentifier,
meta: {
- avatar:
- '💻',
+ avatar: '💻',
title: 'Cloud Sandbox',
},
systemRole: systemPrompt,
type: 'builtin',
};
-export { CodeInterpreterApiName } from './types';
+export { CloudSandboxApiName } from './types';
diff --git a/packages/builtin-tool-code-interpreter/src/systemRole.ts b/packages/builtin-tool-cloud-sandbox/src/systemRole.ts
similarity index 100%
rename from packages/builtin-tool-code-interpreter/src/systemRole.ts
rename to packages/builtin-tool-cloud-sandbox/src/systemRole.ts
diff --git a/packages/builtin-tool-code-interpreter/src/types.ts b/packages/builtin-tool-cloud-sandbox/src/types.ts
similarity index 95%
rename from packages/builtin-tool-code-interpreter/src/types.ts
rename to packages/builtin-tool-cloud-sandbox/src/types.ts
index bbd9d882019..bacf85985e9 100644
--- a/packages/builtin-tool-code-interpreter/src/types.ts
+++ b/packages/builtin-tool-cloud-sandbox/src/types.ts
@@ -1,7 +1,7 @@
/**
* API names for Cloud Sandbox tool
*/
-export const CodeInterpreterApiName = {
+export const CloudSandboxApiName = {
editLocalFile: 'editLocalFile',
executeCode: 'executeCode',
exportFile: 'exportFile',
@@ -18,8 +18,8 @@ export const CodeInterpreterApiName = {
writeLocalFile: 'writeLocalFile',
} as const;
-export type CodeInterpreterApiNameType =
- (typeof CodeInterpreterApiName)[keyof typeof CodeInterpreterApiName];
+export type CloudSandboxApiNameType =
+ (typeof CloudSandboxApiName)[keyof typeof CloudSandboxApiName];
// ==================== File Operations ====================
diff --git a/packages/builtin-tool-code-interpreter/src/client/Inspector/index.ts b/packages/builtin-tool-code-interpreter/src/client/Inspector/index.ts
deleted file mode 100644
index f9edefd7103..00000000000
--- a/packages/builtin-tool-code-interpreter/src/client/Inspector/index.ts
+++ /dev/null
@@ -1,11 +0,0 @@
-import { CodeInterpreterApiName } from '../../types';
-import { ExecuteCodeInspector } from './ExecuteCode';
-import { RunCommandInspector } from './RunCommand';
-
-/**
- * Code Interpreter Inspector Components Registry
- */
-export const CodeInterpreterInspectors = {
- [CodeInterpreterApiName.executeCode]: ExecuteCodeInspector,
- [CodeInterpreterApiName.runCommand]: RunCommandInspector,
-};
diff --git a/packages/builtin-tool-code-interpreter/src/client/Intervention/index.ts b/packages/builtin-tool-code-interpreter/src/client/Intervention/index.ts
deleted file mode 100644
index cfc5220f26e..00000000000
--- a/packages/builtin-tool-code-interpreter/src/client/Intervention/index.ts
+++ /dev/null
@@ -1,17 +0,0 @@
-import { CodeInterpreterApiName } from '../../types';
-import EditLocalFile from './EditLocalFile';
-import ExecuteCode from './ExecuteCode';
-import MoveLocalFiles from './MoveLocalFiles';
-import RunCommand from './RunCommand';
-import WriteFile from './WriteFile';
-
-/**
- * Cloud Sandbox Intervention Components Registry
- */
-export const CodeInterpreterInterventions = {
- [CodeInterpreterApiName.editLocalFile]: EditLocalFile,
- [CodeInterpreterApiName.executeCode]: ExecuteCode,
- [CodeInterpreterApiName.moveLocalFiles]: MoveLocalFiles,
- [CodeInterpreterApiName.runCommand]: RunCommand,
- [CodeInterpreterApiName.writeLocalFile]: WriteFile,
-};
diff --git a/packages/builtin-tool-code-interpreter/src/client/Render/index.ts b/packages/builtin-tool-code-interpreter/src/client/Render/index.ts
deleted file mode 100644
index 7495daefdde..00000000000
--- a/packages/builtin-tool-code-interpreter/src/client/Render/index.ts
+++ /dev/null
@@ -1,29 +0,0 @@
-import { CodeInterpreterApiName } from '../../types';
-import EditLocalFile from './EditLocalFile';
-import ExecuteCode from './ExecuteCode';
-import ExportFile from './ExportFile';
-import ListFiles from './ListFiles';
-import MoveLocalFiles from './MoveLocalFiles';
-import ReadLocalFile from './ReadLocalFile';
-import RunCommand from './RunCommand';
-import SearchFiles from './SearchFiles';
-import WriteFile from './WriteFile';
-
-/**
- * Cloud Sandbox Render Components Registry
- */
-export const CodeInterpreterRenders = {
- [CodeInterpreterApiName.editLocalFile]: EditLocalFile,
- [CodeInterpreterApiName.executeCode]: ExecuteCode,
- [CodeInterpreterApiName.exportFile]: ExportFile,
- [CodeInterpreterApiName.listLocalFiles]: ListFiles,
- [CodeInterpreterApiName.moveLocalFiles]: MoveLocalFiles,
- [CodeInterpreterApiName.readLocalFile]: ReadLocalFile,
- [CodeInterpreterApiName.runCommand]: RunCommand,
- [CodeInterpreterApiName.searchLocalFiles]: SearchFiles,
- [CodeInterpreterApiName.writeLocalFile]: WriteFile,
-};
-
-// Export API names for use in other modules
-
-export { CodeInterpreterApiName } from '../../types';
diff --git a/packages/builtin-tool-code-interpreter/src/client/Streaming/index.ts b/packages/builtin-tool-code-interpreter/src/client/Streaming/index.ts
deleted file mode 100644
index 0c9d546f639..00000000000
--- a/packages/builtin-tool-code-interpreter/src/client/Streaming/index.ts
+++ /dev/null
@@ -1,9 +0,0 @@
-import { CodeInterpreterApiName } from '../../types';
-import { ExecuteCodeStreaming } from './ExecuteCode';
-
-/**
- * Code Interpreter Streaming Components Registry
- */
-export const CodeInterpreterStreamings = {
- [CodeInterpreterApiName.executeCode]: ExecuteCodeStreaming,
-};
diff --git a/packages/builtin-tool-code-interpreter/src/client/index.ts b/packages/builtin-tool-code-interpreter/src/client/index.ts
deleted file mode 100644
index b0f184cf560..00000000000
--- a/packages/builtin-tool-code-interpreter/src/client/index.ts
+++ /dev/null
@@ -1,15 +0,0 @@
-// Inspector components (customized tool call headers)
-export { CodeInterpreterInspectors } from './Inspector';
-
-// Render components (read-only snapshots)
-export { CodeInterpreterRenders } from './Render';
-
-// Intervention components (approval dialogs)
-export { CodeInterpreterInterventions } from './Intervention';
-
-// Streaming components
-export { CodeInterpreterStreamings } from './Streaming';
-
-// Re-export types and manifest for convenience
-export { CodeInterpreterIdentifier, CodeInterpreterManifest } from '../manifest';
-export * from '../types';
diff --git a/src/store/chat/slices/builtinTool/actions/interpreter.ts b/src/store/chat/slices/builtinTool/actions/interpreter.ts
index 81c655445af..e695661ee81 100644
--- a/src/store/chat/slices/builtinTool/actions/interpreter.ts
+++ b/src/store/chat/slices/builtinTool/actions/interpreter.ts
@@ -1,4 +1,4 @@
-import { CodeInterpreterIdentifier } from '@lobechat/builtin-tool-code-interpreter';
+import { CloudSandboxIdentifier } from '@lobechat/builtin-tool-cloud-sandbox';
import {
type CodeInterpreterFileItem,
type CodeInterpreterParams,
@@ -79,7 +79,7 @@ export const codeInterpreterSlice: StateCreator<
files.push(new File([blob], image.alt));
}
for (const tool of message.tools ?? []) {
- if (tool.identifier === CodeInterpreterIdentifier) {
+ if (tool.identifier === CloudSandboxIdentifier) {
const message = dbMessageSelectors.getDbMessageByToolCallId(tool.id)(get());
if (message?.content) {
const content = JSON.parse(message.content) as CodeInterpreterResponse;
diff --git a/src/store/chat/slices/plugin/actions/pluginTypes.ts b/src/store/chat/slices/plugin/actions/pluginTypes.ts
index b87756bfcb9..11aac61d203 100644
--- a/src/store/chat/slices/plugin/actions/pluginTypes.ts
+++ b/src/store/chat/slices/plugin/actions/pluginTypes.ts
@@ -1,5 +1,5 @@
/* eslint-disable sort-keys-fix/sort-keys-fix, typescript-sort-keys/interface */
-import { CodeInterpreterIdentifier, type ExportFileState } from '@lobechat/builtin-tool-code-interpreter';
+import { CloudSandboxIdentifier, type ExportFileState } from '@lobechat/builtin-tool-cloud-sandbox';
import { GroupAgentBuilderIdentifier } from '@lobechat/builtin-tool-group-agent-builder';
import { type ChatToolPayload, type RuntimeStepContext } from '@lobechat/types';
import { PluginErrorType } from '@lobehub/chat-plugin-sdk';
@@ -137,7 +137,7 @@ export const pluginTypes: StateCreator<
}
// Check if this is Cloud Code Interpreter - route to specific handler
- if (payload.identifier === CodeInterpreterIdentifier) {
+ if (payload.identifier === CloudSandboxIdentifier) {
return await get().invokeCloudCodeInterpreterTool(id, payload);
}
@@ -287,11 +287,11 @@ export const pluginTypes: StateCreator<
try {
// Import ExecutionRuntime dynamically to avoid circular dependencies
- const { CodeInterpreterExecutionRuntime } =
- await import('@lobechat/builtin-tool-code-interpreter/executionRuntime');
+ const { CloudSandboxExecutionRuntime } =
+ await import('@lobechat/builtin-tool-cloud-sandbox/executionRuntime');
// Create runtime with context
- const runtime = new CodeInterpreterExecutionRuntime({
+ const runtime = new CloudSandboxExecutionRuntime({
topicId: message?.topicId || 'default',
userId: 'current-user', // TODO: Get actual userId from auth context
});
diff --git a/src/tools/code-interpreter-draft/Render/components/ResultFileGallery.tsx b/src/tools/code-interpreter-draft/Render/components/ResultFileGallery.tsx
deleted file mode 100644
index 8956994ac36..00000000000
--- a/src/tools/code-interpreter-draft/Render/components/ResultFileGallery.tsx
+++ /dev/null
@@ -1,56 +0,0 @@
-import { type CodeInterpreterFileItem } from '@lobechat/types';
-import { Flexbox, PreviewGroup } from '@lobehub/ui';
-import { memo } from 'react';
-
-import GalleyGrid from '@/components/GalleyGrid';
-
-import { ResultFile, ResultImage } from './ResultFileItem';
-
-const ResultFileGallery = memo<{ files: CodeInterpreterFileItem[] }>(({ files }) => {
- if (!files || files.length === 0) {
- return null;
- }
-
- // 分离图片和其他文件
- const imageFiles = [];
- const otherFiles = [];
- for (const file of files) {
- if (/\.(png|jpg|jpeg|gif|bmp|webp|svg)$/i.test(file.filename)) {
- imageFiles.push(file);
- } else {
- otherFiles.push(file);
- }
- }
-
- return (
- <Flexbox gap={16}>
- {/* 图片预览组 */}
- {imageFiles.length > 0 && (
- <PreviewGroup>
- {imageFiles.length === 1 ? (
- // 单张图片时占据更大空间
- <Flexbox style={{ maxWidth: 400 }}>
- <ResultImage {...imageFiles[0]} />
- </Flexbox>
- ) : (
- <GalleyGrid
- items={imageFiles.map((file) => ({ ...file }))}
- renderItem={(props) => <ResultImage {...props} />}
- />
- )}
- </PreviewGroup>
- )}
-
- {/* 其他文件列表 */}
- {otherFiles.length > 0 && (
- <Flexbox gap={8} horizontal wrap="wrap">
- {otherFiles.map((file, index) => (
- <ResultFile key={`${file.filename}-${index}`} {...file} />
- ))}
- </Flexbox>
- )}
- </Flexbox>
- );
-});
-
-export default ResultFileGallery;
diff --git a/src/tools/code-interpreter-draft/Render/components/ResultFileItem.tsx b/src/tools/code-interpreter-draft/Render/components/ResultFileItem.tsx
deleted file mode 100644
index 709dc7f4d2c..00000000000
--- a/src/tools/code-interpreter-draft/Render/components/ResultFileItem.tsx
+++ /dev/null
@@ -1,106 +0,0 @@
-import { type CodeInterpreterFileItem } from '@lobechat/types';
-import { Icon, Image, MaterialFileTypeIcon, Text, Tooltip } from '@lobehub/ui';
-import { createStaticStyles } from 'antd-style';
-import { Download } from 'lucide-react';
-import React, { memo } from 'react';
-
-import { fileService } from '@/services/file';
-import { useChatStore } from '@/store/chat';
-
-const imageStyles = createStaticStyles(({ css, cssVar }) => ({
- container: css`
- overflow: hidden;
-
- border: 1px solid ${cssVar.colorBorder};
- border-radius: 8px;
-
- background: ${cssVar.colorBgContainer};
-
- transition: all 0.2s ease;
-
- &:hover {
- border-color: ${cssVar.colorPrimary};
- box-shadow: 0 2px 8px ${cssVar.colorFillQuaternary};
- }
- `,
-}));
-
-const fileStyles = createStaticStyles(({ css, cssVar }) => ({
- container: css`
- cursor: pointer;
-
- display: inline-flex;
- gap: ${cssVar.marginXS};
- align-items: center;
-
- padding-block: ${cssVar.paddingXS};
- padding-inline: ${cssVar.paddingSM};
- border: 1px solid ${cssVar.colorBorder};
- border-radius: ${cssVar.borderRadiusSM};
-
- font-size: ${cssVar.fontSizeSM};
- color: ${cssVar.colorText};
-
- background: ${cssVar.colorBgContainer};
-
- transition: all 0.2s ease;
-
- &:hover {
- border-color: ${cssVar.colorPrimary};
- background: ${cssVar.colorBgTextHover};
- }
- `,
-}));
-
-function basename(filename: string) {
- return filename.split('/').pop() ?? filename;
-}
-
-// 图片显示子组件
-const ResultImage = memo<CodeInterpreterFileItem>(({ filename, previewUrl, fileId }) => {
- const [useFetchPythonFileItem] = useChatStore((s) => [s.useFetchInterpreterFileItem]);
- const { data } = useFetchPythonFileItem(fileId);
- const styles = imageStyles;
-
- const imageUrl = data?.url ?? previewUrl;
- const baseName = basename(data?.filename ?? filename);
-
- if (imageUrl) {
- return (
- <div className={styles.container}>
- <Tooltip title={baseName}>
- <Image alt={baseName} onLoad={() => URL.revokeObjectURL(imageUrl)} src={imageUrl} />
- </Tooltip>
- </div>
- );
- }
-
- return null;
-});
-
-// 文件显示子组件
-const ResultFile = memo<CodeInterpreterFileItem>(({ filename, fileId, previewUrl }) => {
- const styles = fileStyles;
- const baseName = basename(filename);
- const onDownload = async (e: React.MouseEvent) => {
- e.stopPropagation();
- let downloadUrl = previewUrl;
- if (!downloadUrl) {
- const { url } = await fileService.getFile(fileId!);
- downloadUrl = url;
- }
- const link = document.createElement('a');
- link.href = downloadUrl;
- link.download = baseName;
- link.click();
- };
- return (
- <div className={styles.container} onClick={onDownload}>
- <MaterialFileTypeIcon filename={baseName} size={20} type="file" />
- <Text>{baseName}</Text>
- <Icon icon={Download} size={'small'} />
- </div>
- );
-});
-
-export { ResultFile, ResultImage };
diff --git a/src/tools/code-interpreter-draft/Render/index.tsx b/src/tools/code-interpreter-draft/Render/index.tsx
deleted file mode 100644
index 4cf991706c7..00000000000
--- a/src/tools/code-interpreter-draft/Render/index.tsx
+++ /dev/null
@@ -1,117 +0,0 @@
-import {
- type BuiltinRenderProps,
- type CodeInterpreterParams,
- type CodeInterpreterResponse,
- type CodeInterpreterState,
-} from '@lobechat/types';
-import { Alert, Flexbox, Highlighter, Text } from '@lobehub/ui';
-import { cssVar } from 'antd-style';
-import { memo } from 'react';
-import { useTranslation } from 'react-i18next';
-
-import BubblesLoading from '@/components/BubblesLoading';
-import { useChatStore } from '@/store/chat';
-import { chatToolSelectors } from '@/store/chat/slices/builtinTool/selectors';
-
-import ResultFileGallery from './components/ResultFileGallery';
-
-const CodeInterpreter = memo<
- BuiltinRenderProps<CodeInterpreterParams, CodeInterpreterState, CodeInterpreterResponse>
->(({ content, args, pluginState, messageId, apiName }) => {
- const { t } = useTranslation('tool');
-
- const isExecuting = useChatStore(chatToolSelectors.isInterpreterExecuting(messageId));
-
- if (pluginState?.error) {
- console.error(pluginState.error);
- }
-
- return (
- <Flexbox gap={12}>
- {/* 代码显示 */}
- <Flexbox>
- <Highlighter
- actionIconSize="small"
- language={apiName!}
- showLanguage={false}
- style={{ maxHeight: 200, overflow: 'scroll', width: '100%' }}
- >
- {args.code}
- </Highlighter>
- </Flexbox>
-
- {/* 执行状态 */}
- {isExecuting && (
- <Flexbox gap={8} horizontal>
- <BubblesLoading />
- <Text type="secondary">{t('codeInterpreter.executing')}</Text>
- </Flexbox>
- )}
-
- {/* 执行错误 */}
- {!isExecuting && pluginState?.error && (
- <Alert
- description={String(pluginState.error)}
- showIcon
- title={t('codeInterpreter.error')}
- type="error"
- />
- )}
-
- {!isExecuting && content && (
- <Flexbox gap={8}>
- {/* 返回值 */}
- {content.result && (
- <Flexbox>
- <Text strong style={{ marginBottom: 4 }}>
- {t('codeInterpreter.returnValue')}
- </Text>
- <Highlighter copyable={false} language="text" showLanguage={false}>
- {content.result}
- </Highlighter>
- </Flexbox>
- )}
-
- {/* 输出 */}
- {content?.output && content.output.length > 0 && (
- <Flexbox>
- <Text strong style={{ marginBottom: 4 }}>
- {t('codeInterpreter.output')}
- </Text>
- <div
- style={{
- backgroundColor: cssVar.colorBgContainer,
- border: `1px solid ${cssVar.colorBorder}`,
- borderRadius: cssVar.borderRadius,
- fontSize: 13,
- lineHeight: 1.5,
- overflow: 'auto',
- padding: 12,
- whiteSpace: 'pre',
- }}
- >
- {content.output?.map((item, index) => (
- <Text code key={index} type={item.type === 'stderr' ? 'danger' : undefined}>
- {item.data}
- </Text>
- ))}
- </div>
- </Flexbox>
- )}
-
- {/* 文件显示 */}
- {content?.files && content.files.length > 0 && (
- <Flexbox>
- <Text strong style={{ marginBottom: 8 }}>
- {t('codeInterpreter.files')}
- </Text>
- <ResultFileGallery files={content.files} />
- </Flexbox>
- )}
- </Flexbox>
- )}
- </Flexbox>
- );
-});
-
-export default CodeInterpreter;
diff --git a/src/tools/code-interpreter-draft/index.ts b/src/tools/code-interpreter-draft/index.ts
deleted file mode 100644
index c7a5c41217e..00000000000
--- a/src/tools/code-interpreter-draft/index.ts
+++ /dev/null
@@ -1,67 +0,0 @@
-import { type BuiltinToolManifest } from '@lobechat/types';
-
-export const CodeInterpreterIdentifier = 'lobe-code-interpreter';
-
-export const CodeInterpreterManifest: BuiltinToolManifest = {
- api: [
- {
- description: 'A Python interpreter. Use this tool to run Python code. ',
- name: 'python',
- parameters: {
- properties: {
- code: {
- description: 'The Python code to run.',
- type: 'string',
- },
- packages: {
- description: 'The packages to install before running the code.',
- items: {
- type: 'string',
- },
- type: 'array',
- },
- },
- required: ['packages', 'code'],
- type: 'object',
- },
- },
- ],
- identifier: CodeInterpreterIdentifier,
- meta: {
- avatar:
- 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48IS0tIFVwbG9hZGVkIHRvOiBTVkcgUmVwbywgd3d3LnN2Z3JlcG8uY29tLCBHZW5lcmF0b3I6IFNWRyBSZXBvIE1peGVyIFRvb2xzIC0tPgo8c3ZnIHdpZHRoPSI4MDBweCIgaGVpZ2h0PSI4MDBweCIgdmlld0JveD0iMCAwIDMyIDMyIiBmaWxsPSJub25lIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPg0KPHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0xMy4wMTY0IDJDMTAuODE5MyAyIDkuMDM4MjUgMy43MjQ1MyA5LjAzODI1IDUuODUxODVWOC41MTg1MkgxNS45MjM1VjkuMjU5MjZINS45NzgxNEMzLjc4MTA3IDkuMjU5MjYgMiAxMC45ODM4IDIgMTMuMTExMUwyIDE4Ljg4ODlDMiAyMS4wMTYyIDMuNzgxMDcgMjIuNzQwNyA1Ljk3ODE0IDIyLjc0MDdIOC4yNzMyMlYxOS40ODE1QzguMjczMjIgMTcuMzU0MiAxMC4wNTQzIDE1LjYyOTYgMTIuMjUxNCAxNS42Mjk2SDE5LjU5NTZDMjEuNDU0NyAxNS42Mjk2IDIyLjk2MTcgMTQuMTcwNCAyMi45NjE3IDEyLjM3MDRWNS44NTE4NUMyMi45NjE3IDMuNzI0NTMgMjEuMTgwNyAyIDE4Ljk4MzYgMkgxMy4wMTY0Wk0xMi4wOTg0IDYuNzQwNzRDMTIuODU4OSA2Ljc0MDc0IDEzLjQ3NTQgNi4xNDM3OCAxMy40NzU0IDUuNDA3NDFDMTMuNDc1NCA0LjY3MTAzIDEyLjg1ODkgNC4wNzQwNyAxMi4wOTg0IDQuMDc0MDdDMTEuMzM3OCA0LjA3NDA3IDEwLjcyMTMgNC42NzEwMyAxMC43MjEzIDUuNDA3NDFDMTAuNzIxMyA2LjE0Mzc4IDExLjMzNzggNi43NDA3NCAxMi4wOTg0IDYuNzQwNzRaIiBmaWxsPSJ1cmwoI3BhaW50MF9saW5lYXJfODdfODIwNCkiLz4NCjxwYXRoIGZpbGwtcnVsZT0iZXZlbm9kZCIgY2xpcC1ydWxlPSJldmVub2RkIiBkPSJNMTguOTgzNCAzMEMyMS4xODA1IDMwIDIyLjk2MTYgMjguMjc1NSAyMi45NjE2IDI2LjE0ODJWMjMuNDgxNUwxNi4wNzYzIDIzLjQ4MTVMMTYuMDc2MyAyMi43NDA4TDI2LjAyMTcgMjIuNzQwOEMyOC4yMTg4IDIyLjc0MDggMjkuOTk5OCAyMS4wMTYyIDI5Ljk5OTggMTguODg4OVYxMy4xMTExQzI5Ljk5OTggMTAuOTgzOCAyOC4yMTg4IDkuMjU5MjggMjYuMDIxNyA5LjI1OTI4TDIzLjcyNjYgOS4yNTkyOFYxMi41MTg1QzIzLjcyNjYgMTQuNjQ1OSAyMS45NDU1IDE2LjM3MDQgMTkuNzQ4NSAxNi4zNzA0TDEyLjQwNDIgMTYuMzcwNEMxMC41NDUxIDE2LjM3MDQgOS4wMzgwOSAxNy44Mjk2IDkuMDM4MDkgMTkuNjI5Nkw5LjAzODA5IDI2LjE0ODJDOS4wMzgwOSAyOC4yNzU1IDEwLjgxOTIgMzAgMTMuMDE2MiAzMEgxOC45ODM0Wk0xOS45MDE1IDI1LjI1OTNDMTkuMTQwOSAyNS4yNTkzIDE4LjUyNDQgMjUuODU2MiAxOC41MjQ0IDI2LjU5MjZDMTguNTI0NCAyNy4zMjkgMTkuMTQwOSAyNy45MjU5IDE5LjkwMTUgMjcuOTI1OUMyMC42NjIgMjcuOTI1OSAyMS4yNzg1IDI3LjMyOSAyMS4yNzg1IDI2LjU5MjZDMjEuMjc4NSAyNS44NTYyIDIwLjY2MiAyNS4yNTkzIDE5LjkwMTUgMjUuMjU5M1oiIGZpbGw9InVybCgjcGFpbnQxX2xpbmVhcl84N184MjA0KSIvPg0KPGRlZnM+DQo8bGluZWFyR3JhZGllbnQgaWQ9InBhaW50MF9saW5lYXJfODdfODIwNCIgeDE9IjEyLjQ4MDkiIHkxPSIyIiB4Mj0iMTIuNDgwOSIgeTI9IjIyLjc0MDciIGdyYWRpZW50VW5pdHM9InVzZXJTcGFjZU9uVXNlIj4NCjxzdG9wIHN0b3AtY29sb3I9IiMzMjdFQkQiLz4NCjxzdG9wIG9mZnNldD0iMSIgc3RvcC1jb2xvcj0iIzE1NjVBNyIvPg0KPC9saW5lYXJHcmFkaWVudD4NCjxsaW5lYXJHcmFkaWVudCBpZD0icGFpbnQxX2xpbmVhcl84N184MjA0IiB4MT0iMTkuNTE5IiB5MT0iOS4yNTkyOCIgeDI9IjE5LjUxOSIgeTI9IjMwIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSI+DQo8c3RvcCBzdG9wLWNvbG9yPSIjRkZEQTRCIi8+DQo8c3RvcCBvZmZzZXQ9IjEiIHN0b3AtY29sb3I9IiNGOUM2MDAiLz4NCjwvbGluZWFyR3JhZGllbnQ+DQo8L2RlZnM+DQo8L3N2Zz4=',
- title: 'Code Interpreter',
- },
- systemRole: `When you send a message containing Python code to python, it will be executed in a temporary pyodide python environment in browser.
-python will respond with the output of the execution or time out after 60.0 seconds.
-The drive at '/mnt/data' can be used to save and persist user files.
-
-If you are using matplotlib:
-- never use seaborn
-- give each chart its own distinct plot (no subplots)
-- never set any specific colors – unless explicitly asked to by the user
-
-If you are accessing the internet, You MUST use pyfetch from pyodide.http package. Any other methods of accessing the internet will fail.
-pyfetch is a wrapper of js fetch API, it is a async function that returns a pyodide.http.FetchResponse object.
-Here are some useful methods of FetchResponse:
- - async bytes(): returns a bytes object
- - async text(): returns a string
- - async json(): returns a json object
-
-If you are generating files:
-- You MUST use the instructed library for each supported file format. (Do not assume any other libraries are available):
- - pdf --> reportlab
- - docx --> python-docx
- - xlsx --> openpyxl
- - pptx --> python-pptx
- - csv --> pandas
- - ods --> odfpy
- - odt --> odfpy
- - odp --> odfpy
-- None of the above packages are installed by default. You MUST include them in the packages parameter to install them EVERY TIME.
-- If you are generating a pdf
- - You MUST prioritize generating text content using reportlab.platypus rather than canvas
- - If you are generating text in Chinese, you MUST use STSong. To use the font, you must call pdfmetrics.registerFont(TTFont('STSong', 'STSong.ttf')) and apply the style to all text elements
- `,
- type: 'builtin',
-};
diff --git a/src/tools/identifiers.ts b/src/tools/identifiers.ts
index 6ad25163c91..42cbdebea5b 100644
--- a/src/tools/identifiers.ts
+++ b/src/tools/identifiers.ts
@@ -1,5 +1,5 @@
import { AgentBuilderManifest } from '@lobechat/builtin-tool-agent-builder';
-import { CodeInterpreterManifest } from '@lobechat/builtin-tool-code-interpreter';
+import { CloudSandboxManifest } from '@lobechat/builtin-tool-cloud-sandbox';
import { GroupAgentBuilderManifest } from '@lobechat/builtin-tool-group-agent-builder';
import { GroupManagementManifest } from '@lobechat/builtin-tool-group-management';
import { GTDManifest } from '@lobechat/builtin-tool-gtd';
@@ -18,7 +18,7 @@ export const builtinToolIdentifiers: string[] = [
LocalSystemManifest.identifier,
WebBrowsingManifest.identifier,
KnowledgeBaseManifest.identifier,
- CodeInterpreterManifest.identifier,
+ CloudSandboxManifest.identifier,
PageAgentManifest.identifier,
GroupAgentBuilderManifest.identifier,
GroupManagementManifest.identifier,
diff --git a/src/tools/index.ts b/src/tools/index.ts
index fcd4f34f154..98e3b7a8288 100644
--- a/src/tools/index.ts
+++ b/src/tools/index.ts
@@ -1,5 +1,5 @@
import { AgentBuilderManifest } from '@lobechat/builtin-tool-agent-builder';
-import { CodeInterpreterManifest } from '@lobechat/builtin-tool-code-interpreter';
+import { CloudSandboxManifest } from '@lobechat/builtin-tool-cloud-sandbox';
import { GroupAgentBuilderManifest } from '@lobechat/builtin-tool-group-agent-builder';
import { GroupManagementManifest } from '@lobechat/builtin-tool-group-management';
import { GTDManifest } from '@lobechat/builtin-tool-gtd';
@@ -38,8 +38,8 @@ export const builtinTools: LobeBuiltinTool[] = [
type: 'builtin',
},
{
- identifier: CodeInterpreterManifest.identifier,
- manifest: CodeInterpreterManifest,
+ identifier: CloudSandboxManifest.identifier,
+ manifest: CloudSandboxManifest,
type: 'builtin',
},
{
diff --git a/src/tools/inspectors.ts b/src/tools/inspectors.ts
index 93d2d54833d..a85534eccb1 100644
--- a/src/tools/inspectors.ts
+++ b/src/tools/inspectors.ts
@@ -1,7 +1,7 @@
import {
- CodeInterpreterIdentifier,
- CodeInterpreterInspectors,
-} from '@lobechat/builtin-tool-code-interpreter/client';
+ CloudSandboxIdentifier,
+ CloudSandboxInspectors,
+} from '@lobechat/builtin-tool-cloud-sandbox/client';
import {
GroupManagementInspectors,
GroupManagementManifest,
@@ -25,7 +25,7 @@ import { LocalSystemInspectors } from './local-system/Inspector';
* of tool calls in the conversation UI.
*/
const BuiltinToolInspectors: Record<string, Record<string, BuiltinInspector>> = {
- [CodeInterpreterIdentifier]: CodeInterpreterInspectors as Record<string, BuiltinInspector>,
+ [CloudSandboxIdentifier]: CloudSandboxInspectors as Record<string, BuiltinInspector>,
[GroupManagementManifest.identifier]: GroupManagementInspectors as Record<
string,
BuiltinInspector
diff --git a/src/tools/interventions.ts b/src/tools/interventions.ts
index 14b3607eae3..c08b4fac959 100644
--- a/src/tools/interventions.ts
+++ b/src/tools/interventions.ts
@@ -2,8 +2,8 @@ import {
AgentBuilderInterventions,
AgentBuilderManifest,
} from '@lobechat/builtin-tool-agent-builder/client';
-import { CodeInterpreterManifest } from '@lobechat/builtin-tool-code-interpreter';
-import { CodeInterpreterInterventions } from '@lobechat/builtin-tool-code-interpreter/client';
+import { CloudSandboxManifest } from '@lobechat/builtin-tool-cloud-sandbox';
+import { CloudSandboxInterventions } from '@lobechat/builtin-tool-cloud-sandbox/client';
import {
GroupManagementInterventions,
GroupManagementManifest,
@@ -23,7 +23,7 @@ import { LocalSystemInterventions } from './local-system/Intervention';
*/
export const BuiltinToolInterventions: Record<string, Record<string, any>> = {
[AgentBuilderManifest.identifier]: AgentBuilderInterventions,
- [CodeInterpreterManifest.identifier]: CodeInterpreterInterventions,
+ [CloudSandboxManifest.identifier]: CloudSandboxInterventions,
[GroupManagementManifest.identifier]: GroupManagementInterventions,
[GTDManifest.identifier]: GTDInterventions,
[LocalSystemManifest.identifier]: LocalSystemInterventions,
diff --git a/src/tools/renders.ts b/src/tools/renders.ts
index 3b6c89a0f5e..3829451c573 100644
--- a/src/tools/renders.ts
+++ b/src/tools/renders.ts
@@ -1,9 +1,9 @@
// agent-builder
import { AgentBuilderManifest } from '@lobechat/builtin-tool-agent-builder';
import { AgentBuilderRenders } from '@lobechat/builtin-tool-agent-builder/client';
-// code-interpreter
-import { CodeInterpreterManifest } from '@lobechat/builtin-tool-code-interpreter';
-import { CodeInterpreterRenders } from '@lobechat/builtin-tool-code-interpreter/client';
+// cloud-sandbox
+import { CloudSandboxManifest } from '@lobechat/builtin-tool-cloud-sandbox';
+import { CloudSandboxRenders } from '@lobechat/builtin-tool-cloud-sandbox/client';
// group-management
import { GroupManagementManifest } from '@lobechat/builtin-tool-group-management';
import { GroupManagementRenders } from '@lobechat/builtin-tool-group-management/client';
@@ -30,7 +30,7 @@ import { LocalSystemRenders } from './local-system/Render';
*/
const BuiltinToolsRenders: Record<string, Record<string, BuiltinRender>> = {
[AgentBuilderManifest.identifier]: AgentBuilderRenders as Record<string, BuiltinRender>,
- [CodeInterpreterManifest.identifier]: CodeInterpreterRenders as Record<string, BuiltinRender>,
+ [CloudSandboxManifest.identifier]: CloudSandboxRenders as Record<string, BuiltinRender>,
[GroupManagementManifest.identifier]: GroupManagementRenders as Record<string, BuiltinRender>,
[GTDManifest.identifier]: GTDRenders as Record<string, BuiltinRender>,
[NotebookManifest.identifier]: NotebookRenders as Record<string, BuiltinRender>,
diff --git a/src/tools/streamings.ts b/src/tools/streamings.ts
index 9161b326acc..bd3d1d99236 100644
--- a/src/tools/streamings.ts
+++ b/src/tools/streamings.ts
@@ -1,7 +1,7 @@
import {
- CodeInterpreterIdentifier,
- CodeInterpreterStreamings,
-} from '@lobechat/builtin-tool-code-interpreter/client';
+ CloudSandboxIdentifier,
+ CloudSandboxStreamings,
+} from '@lobechat/builtin-tool-cloud-sandbox/client';
import {
GroupManagementManifest,
GroupManagementStreamings,
@@ -21,7 +21,7 @@ import { LocalSystemStreamings } from './local-system/Streaming';
* The component should fetch streaming content from store internally.
*/
const BuiltinToolStreamings: Record<string, Record<string, BuiltinStreaming>> = {
- [CodeInterpreterIdentifier]: CodeInterpreterStreamings as Record<string, BuiltinStreaming>,
+ [CloudSandboxIdentifier]: CloudSandboxStreamings as Record<string, BuiltinStreaming>,
[GroupManagementManifest.identifier]: GroupManagementStreamings as Record<
string,
BuiltinStreaming