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.

♻️ refactor(local-system,cloud-sandbox): drop "Local" prefix from tool names (#14364)

Arvin Xucb4412421f5a
diff --git a/apps/cli/src/tools/index.test.ts b/apps/cli/src/tools/index.test.ts
index ded3100d81e..61064b17d78 100644
--- a/apps/cli/src/tools/index.test.ts
+++ b/apps/cli/src/tools/index.test.ts
@@ -27,22 +27,22 @@ describe('executeToolCall', () => {
fs.rmSync(tmpDir, { force: true, recursive: true });
});
- it('should dispatch readLocalFile', async () => {
+ it('should dispatch readFile', async () => {
const filePath = path.join(tmpDir, 'test.txt');
await writeFile(filePath, 'hello world');
- const result = await executeToolCall('readLocalFile', JSON.stringify({ path: filePath }));
+ const result = await executeToolCall('readFile', JSON.stringify({ path: filePath }));
expect(result.success).toBe(true);
const parsed = JSON.parse(result.content);
expect(parsed.content).toContain('hello world');
});
- it('should dispatch writeLocalFile', async () => {
+ it('should dispatch writeFile', async () => {
const filePath = path.join(tmpDir, 'new.txt');
const result = await executeToolCall(
- 'writeLocalFile',
+ 'writeFile',
JSON.stringify({ content: 'written', path: filePath }),
);
@@ -50,6 +50,17 @@ describe('executeToolCall', () => {
expect(fs.readFileSync(filePath, 'utf8')).toBe('written');
});
+ it('should dispatch legacy alias readLocalFile', async () => {
+ const filePath = path.join(tmpDir, 'legacy.txt');
+ await writeFile(filePath, 'legacy hello');
+
+ const result = await executeToolCall('readLocalFile', JSON.stringify({ path: filePath }));
+
+ expect(result.success).toBe(true);
+ const parsed = JSON.parse(result.content);
+ expect(parsed.content).toContain('legacy hello');
+ });
+
it('should dispatch runCommand', async () => {
const result = await executeToolCall(
'runCommand',
@@ -61,21 +72,21 @@ describe('executeToolCall', () => {
expect(parsed.stdout).toContain('dispatched');
});
- it('should dispatch listLocalFiles', async () => {
+ it('should dispatch listFiles', async () => {
await writeFile(path.join(tmpDir, 'a.txt'), 'a');
- const result = await executeToolCall('listLocalFiles', JSON.stringify({ path: tmpDir }));
+ const result = await executeToolCall('listFiles', JSON.stringify({ path: tmpDir }));
expect(result.success).toBe(true);
const parsed = JSON.parse(result.content);
expect(parsed.totalCount).toBeGreaterThan(0);
});
- it('should dispatch globLocalFiles', async () => {
+ it('should dispatch globFiles', async () => {
await writeFile(path.join(tmpDir, 'test.ts'), 'code');
const result = await executeToolCall(
- 'globLocalFiles',
+ 'globFiles',
JSON.stringify({ cwd: tmpDir, pattern: '*.ts' }),
);
@@ -84,12 +95,12 @@ describe('executeToolCall', () => {
expect(parsed.files).toContain('test.ts');
});
- it('should dispatch editLocalFile', async () => {
+ it('should dispatch editFile', async () => {
const filePath = path.join(tmpDir, 'edit.txt');
await writeFile(filePath, 'old content');
const result = await executeToolCall(
- 'editLocalFile',
+ 'editFile',
JSON.stringify({
file_path: filePath,
new_string: 'new content',
@@ -116,7 +127,7 @@ describe('executeToolCall', () => {
const filePath = path.join(tmpDir, 'str.txt');
await writeFile(filePath, 'content');
- const result = await executeToolCall('readLocalFile', JSON.stringify({ path: filePath }));
+ const result = await executeToolCall('readFile', JSON.stringify({ path: filePath }));
expect(result.success).toBe(true);
// Result should be valid JSON
@@ -124,7 +135,7 @@ describe('executeToolCall', () => {
});
it('should return error for invalid JSON arguments', async () => {
- const result = await executeToolCall('readLocalFile', 'not-json');
+ const result = await executeToolCall('readFile', 'not-json');
expect(result.success).toBe(false);
expect(result.error).toBeDefined();
@@ -141,11 +152,11 @@ describe('executeToolCall', () => {
expect(result.success).toBe(true);
});
- it('should dispatch searchLocalFiles', async () => {
+ it('should dispatch searchFiles', async () => {
await writeFile(path.join(tmpDir, 'search_target.txt'), 'found');
const result = await executeToolCall(
- 'searchLocalFiles',
+ 'searchFiles',
JSON.stringify({ directory: tmpDir, keywords: 'search_target' }),
);
diff --git a/apps/cli/src/tools/index.ts b/apps/cli/src/tools/index.ts
index ea6a5a9f823..c20089dd0cd 100644
--- a/apps/cli/src/tools/index.ts
+++ b/apps/cli/src/tools/index.ts
@@ -11,14 +11,22 @@ import {
import { getCommandOutput, killCommand, runCommand } from './shell';
const methodMap: Record<string, (args: any) => Promise<unknown>> = {
- editLocalFile,
+ editFile: editLocalFile,
getCommandOutput,
- globLocalFiles,
+ globFiles: globLocalFiles,
grepContent,
killCommand,
+ listFiles: listLocalFiles,
+ readFile: readLocalFile,
+ runCommand,
+ searchFiles: searchLocalFiles,
+ writeFile: writeLocalFile,
+
+ // Legacy aliases β€” older Gateway versions may still send the long form
+ editLocalFile,
+ globLocalFiles,
listLocalFiles,
readLocalFile,
- runCommand,
searchLocalFiles,
writeLocalFile,
};
diff --git a/apps/desktop/src/main/controllers/GatewayConnectionCtr.ts b/apps/desktop/src/main/controllers/GatewayConnectionCtr.ts
index 317618ca944..e62852145c6 100644
--- a/apps/desktop/src/main/controllers/GatewayConnectionCtr.ts
+++ b/apps/desktop/src/main/controllers/GatewayConnectionCtr.ts
@@ -111,20 +111,39 @@ export default class GatewayConnectionCtr extends ControllerModule {
// ─── Tool Call Routing ───
private async executeToolCall(apiName: string, args: any): Promise<unknown> {
+ const editFile = () => this.localFileCtr.handleEditFile(args);
+ const globFiles = () => this.localFileCtr.handleGlobFiles(args);
+ const listFiles = () => this.localFileCtr.listLocalFiles(args);
+ const moveFiles = () => this.localFileCtr.handleMoveFiles(args);
+ const readFile = () => this.localFileCtr.readFile(args);
+ const searchFiles = () => this.localFileCtr.handleLocalFilesSearch(args);
+ const writeFile = () => this.localFileCtr.handleWriteFile(args);
+
const methodMap: Record<string, () => Promise<unknown>> = {
- editLocalFile: () => this.localFileCtr.handleEditFile(args),
- globLocalFiles: () => this.localFileCtr.handleGlobFiles(args),
+ editFile,
+ globFiles,
grepContent: () => this.localFileCtr.handleGrepContent(args),
- listLocalFiles: () => this.localFileCtr.listLocalFiles(args),
- moveLocalFiles: () => this.localFileCtr.handleMoveFiles(args),
- readLocalFile: () => this.localFileCtr.readFile(args),
- renameLocalFile: () => this.localFileCtr.handleRenameFile(args),
- searchLocalFiles: () => this.localFileCtr.handleLocalFilesSearch(args),
- writeLocalFile: () => this.localFileCtr.handleWriteFile(args),
+ listFiles,
+ moveFiles,
+ readFile,
+ searchFiles,
+ writeFile,
getCommandOutput: () => this.shellCommandCtr.handleGetCommandOutput(args),
killCommand: () => this.shellCommandCtr.handleKillCommand(args),
runCommand: () => this.shellCommandCtr.handleRunCommand(args),
+
+ // Legacy aliases β€” keep these so older Gateway versions sending the long
+ // names continue to route correctly. `renameLocalFile` is also kept even
+ // though the new surface drops rename (it's now handled by `moveFiles`).
+ editLocalFile: editFile,
+ globLocalFiles: globFiles,
+ listLocalFiles: listFiles,
+ moveLocalFiles: moveFiles,
+ readLocalFile: readFile,
+ renameLocalFile: () => this.localFileCtr.handleRenameFile(args),
+ searchLocalFiles: searchFiles,
+ writeLocalFile: writeFile,
};
const handler = methodMap[apiName];
diff --git a/apps/desktop/src/main/controllers/__tests__/GatewayConnectionCtr.test.ts b/apps/desktop/src/main/controllers/__tests__/GatewayConnectionCtr.test.ts
index 99ff60c00c4..8309bba1725 100644
--- a/apps/desktop/src/main/controllers/__tests__/GatewayConnectionCtr.test.ts
+++ b/apps/desktop/src/main/controllers/__tests__/GatewayConnectionCtr.test.ts
@@ -433,18 +433,23 @@ describe('GatewayConnectionCtr', () => {
}
it.each([
- ['readLocalFile', 'readFile', mockLocalFileCtr],
- ['listLocalFiles', 'listLocalFiles', mockLocalFileCtr],
- ['moveLocalFiles', 'handleMoveFiles', mockLocalFileCtr],
- ['renameLocalFile', 'handleRenameFile', mockLocalFileCtr],
- ['searchLocalFiles', 'handleLocalFilesSearch', mockLocalFileCtr],
- ['writeLocalFile', 'handleWriteFile', mockLocalFileCtr],
- ['editLocalFile', 'handleEditFile', mockLocalFileCtr],
- ['globLocalFiles', 'handleGlobFiles', mockLocalFileCtr],
+ ['readFile', 'readFile', mockLocalFileCtr],
+ ['listFiles', 'listLocalFiles', mockLocalFileCtr],
+ ['moveFiles', 'handleMoveFiles', mockLocalFileCtr],
+ ['searchFiles', 'handleLocalFilesSearch', mockLocalFileCtr],
+ ['writeFile', 'handleWriteFile', mockLocalFileCtr],
+ ['editFile', 'handleEditFile', mockLocalFileCtr],
+ ['globFiles', 'handleGlobFiles', mockLocalFileCtr],
['grepContent', 'handleGrepContent', mockLocalFileCtr],
['runCommand', 'handleRunCommand', mockShellCommandCtr],
['getCommandOutput', 'handleGetCommandOutput', mockShellCommandCtr],
['killCommand', 'handleKillCommand', mockShellCommandCtr],
+ // Legacy aliases β€” older Gateway versions may still send the long form.
+ // `renameLocalFile` is kept even though the new surface drops rename.
+ ['readLocalFile', 'readFile', mockLocalFileCtr],
+ ['listLocalFiles', 'listLocalFiles', mockLocalFileCtr],
+ ['writeLocalFile', 'handleWriteFile', mockLocalFileCtr],
+ ['renameLocalFile', 'handleRenameFile', mockLocalFileCtr],
] as const)('should route %s to %s', async (apiName, methodName, controller) => {
const client = await connectAndOpen();
const args = { test: 'arg' };
@@ -470,7 +475,7 @@ describe('GatewayConnectionCtr', () => {
});
const client = await connectAndOpen();
- client.simulateToolCallRequest('readLocalFile', { path: '/a.txt' }, 'req-42');
+ client.simulateToolCallRequest('readFile', { path: '/a.txt' }, 'req-42');
await vi.advanceTimersByTimeAsync(0);
expect(client.sendToolCallResponse).toHaveBeenCalledWith({
@@ -497,7 +502,7 @@ describe('GatewayConnectionCtr', () => {
vi.mocked(mockLocalFileCtr.readFile).mockRejectedValueOnce(new Error('File not found'));
const client = await connectAndOpen();
- client.simulateToolCallRequest('readLocalFile', { path: '/missing' }, 'req-err');
+ client.simulateToolCallRequest('readFile', { path: '/missing' }, 'req-err');
await vi.advanceTimersByTimeAsync(0);
expect(client.sendToolCallResponse).toHaveBeenCalledWith({
diff --git a/packages/builtin-tool-cloud-sandbox/src/client/Inspector/index.ts b/packages/builtin-tool-cloud-sandbox/src/client/Inspector/index.ts
index 8f9622d2123..6c3160b201a 100644
--- a/packages/builtin-tool-cloud-sandbox/src/client/Inspector/index.ts
+++ b/packages/builtin-tool-cloud-sandbox/src/client/Inspector/index.ts
@@ -13,17 +13,28 @@ import { WriteLocalFileInspector } from './WriteLocalFile';
/**
* Code Interpreter Inspector Components Registry
+ *
+ * Each component is also registered under the legacy long API name so old DB
+ * messages with apiName like 'readLocalFile' still render after the rename.
*/
export const CloudSandboxInspectors = {
- [CloudSandboxApiName.editLocalFile]: EditLocalFileInspector,
+ [CloudSandboxApiName.editFile]: EditLocalFileInspector,
[CloudSandboxApiName.executeCode]: ExecuteCodeInspector,
[CloudSandboxApiName.exportFile]: ExportFileInspector,
- [CloudSandboxApiName.globLocalFiles]: GlobLocalFilesInspector,
+ [CloudSandboxApiName.globFiles]: GlobLocalFilesInspector,
[CloudSandboxApiName.grepContent]: GrepContentInspector,
- [CloudSandboxApiName.listLocalFiles]: ListLocalFilesInspector,
- [CloudSandboxApiName.moveLocalFiles]: MoveLocalFilesInspector,
- [CloudSandboxApiName.readLocalFile]: ReadLocalFileInspector,
+ [CloudSandboxApiName.listFiles]: ListLocalFilesInspector,
+ [CloudSandboxApiName.moveFiles]: MoveLocalFilesInspector,
+ [CloudSandboxApiName.readFile]: ReadLocalFileInspector,
[CloudSandboxApiName.runCommand]: RunCommandInspector,
- [CloudSandboxApiName.searchLocalFiles]: SearchLocalFilesInspector,
- [CloudSandboxApiName.writeLocalFile]: WriteLocalFileInspector,
+ [CloudSandboxApiName.searchFiles]: SearchLocalFilesInspector,
+ [CloudSandboxApiName.writeFile]: WriteLocalFileInspector,
+ // Legacy aliases β€” keep these so historical messages keep rendering
+ editLocalFile: EditLocalFileInspector,
+ globLocalFiles: GlobLocalFilesInspector,
+ listLocalFiles: ListLocalFilesInspector,
+ moveLocalFiles: MoveLocalFilesInspector,
+ readLocalFile: ReadLocalFileInspector,
+ searchLocalFiles: SearchLocalFilesInspector,
+ writeLocalFile: WriteLocalFileInspector,
};
diff --git a/packages/builtin-tool-cloud-sandbox/src/client/Intervention/index.ts b/packages/builtin-tool-cloud-sandbox/src/client/Intervention/index.ts
index 3d0847511a2..d532e014891 100644
--- a/packages/builtin-tool-cloud-sandbox/src/client/Intervention/index.ts
+++ b/packages/builtin-tool-cloud-sandbox/src/client/Intervention/index.ts
@@ -7,11 +7,18 @@ import WriteFile from './WriteFile';
/**
* Cloud Sandbox Intervention Components Registry
+ *
+ * Each component is also registered under the legacy long API name so old DB
+ * messages with apiName like 'editLocalFile' still resolve after the rename.
*/
export const CloudSandboxInterventions = {
- [CloudSandboxApiName.editLocalFile]: EditLocalFile,
+ [CloudSandboxApiName.editFile]: EditLocalFile,
[CloudSandboxApiName.executeCode]: ExecuteCode,
- [CloudSandboxApiName.moveLocalFiles]: MoveLocalFiles,
+ [CloudSandboxApiName.moveFiles]: MoveLocalFiles,
[CloudSandboxApiName.runCommand]: RunCommand,
- [CloudSandboxApiName.writeLocalFile]: WriteFile,
+ [CloudSandboxApiName.writeFile]: WriteFile,
+ // Legacy aliases β€” keep these so historical messages keep rendering
+ editLocalFile: EditLocalFile,
+ moveLocalFiles: MoveLocalFiles,
+ writeLocalFile: WriteFile,
};
diff --git a/packages/builtin-tool-cloud-sandbox/src/client/Render/index.ts b/packages/builtin-tool-cloud-sandbox/src/client/Render/index.ts
index 7031c9ed719..90534c1a200 100644
--- a/packages/builtin-tool-cloud-sandbox/src/client/Render/index.ts
+++ b/packages/builtin-tool-cloud-sandbox/src/client/Render/index.ts
@@ -10,17 +10,27 @@ import ExportFile from './ExportFile';
*
* Reuses local-system renders for shared file/shell operations.
* Only cloud-specific tools (executeCode, exportFile) have their own renders.
+ *
+ * Each component is also registered under the legacy long API name so old DB
+ * messages with apiName like 'readLocalFile' still render after the rename.
*/
export const CloudSandboxRenders = {
- [CloudSandboxApiName.editLocalFile]: LocalSystemRenders.editLocalFile,
+ [CloudSandboxApiName.editFile]: LocalSystemRenders.editFile,
[CloudSandboxApiName.executeCode]: ExecuteCode,
[CloudSandboxApiName.exportFile]: ExportFile,
- [CloudSandboxApiName.listLocalFiles]: LocalSystemRenders.listLocalFiles,
- [CloudSandboxApiName.moveLocalFiles]: LocalSystemRenders.moveLocalFiles,
- [CloudSandboxApiName.readLocalFile]: LocalSystemRenders.readLocalFile,
+ [CloudSandboxApiName.listFiles]: LocalSystemRenders.listFiles,
+ [CloudSandboxApiName.moveFiles]: LocalSystemRenders.moveFiles,
+ [CloudSandboxApiName.readFile]: LocalSystemRenders.readFile,
[CloudSandboxApiName.runCommand]: RunCommandRender,
- [CloudSandboxApiName.searchLocalFiles]: LocalSystemRenders.searchLocalFiles,
- [CloudSandboxApiName.writeLocalFile]: LocalSystemRenders.writeLocalFile,
+ [CloudSandboxApiName.searchFiles]: LocalSystemRenders.searchFiles,
+ [CloudSandboxApiName.writeFile]: LocalSystemRenders.writeFile,
+ // Legacy aliases β€” keep these so historical messages keep rendering
+ editLocalFile: LocalSystemRenders.editFile,
+ listLocalFiles: LocalSystemRenders.listFiles,
+ moveLocalFiles: LocalSystemRenders.moveFiles,
+ readLocalFile: LocalSystemRenders.readFile,
+ searchLocalFiles: LocalSystemRenders.searchFiles,
+ writeLocalFile: LocalSystemRenders.writeFile,
};
// Export API names for use in other modules
diff --git a/packages/builtin-tool-cloud-sandbox/src/executor/index.ts b/packages/builtin-tool-cloud-sandbox/src/executor/index.ts
index 7cdde9f32c5..e613f78b65c 100644
--- a/packages/builtin-tool-cloud-sandbox/src/executor/index.ts
+++ b/packages/builtin-tool-cloud-sandbox/src/executor/index.ts
@@ -19,7 +19,6 @@ import type {
ListLocalFilesParams,
MoveLocalFilesParams,
ReadLocalFileParams,
- RenameLocalFileParams,
RunCommandParams,
SandboxCallToolResult,
SandboxExportFileResult,
@@ -85,7 +84,7 @@ class CloudSandboxExecutor extends BaseExecutor<typeof CloudSandboxApiName> {
// ==================== File Operations ====================
- listLocalFiles = async (
+ listFiles = async (
params: ListLocalFilesParams,
ctx: BuiltinToolContext,
): Promise<BuiltinToolResult> => {
@@ -94,7 +93,7 @@ class CloudSandboxExecutor extends BaseExecutor<typeof CloudSandboxApiName> {
return this.toBuiltinResult(result);
};
- readLocalFile = async (
+ readFile = async (
params: ReadLocalFileParams,
ctx: BuiltinToolContext,
): Promise<BuiltinToolResult> => {
@@ -103,7 +102,7 @@ class CloudSandboxExecutor extends BaseExecutor<typeof CloudSandboxApiName> {
return this.toBuiltinResult(result);
};
- writeLocalFile = async (
+ writeFile = async (
params: WriteLocalFileParams,
ctx: BuiltinToolContext,
): Promise<BuiltinToolResult> => {
@@ -112,7 +111,7 @@ class CloudSandboxExecutor extends BaseExecutor<typeof CloudSandboxApiName> {
return this.toBuiltinResult(result);
};
- editLocalFile = async (
+ editFile = async (
params: EditLocalFileParams,
ctx: BuiltinToolContext,
): Promise<BuiltinToolResult> => {
@@ -121,7 +120,7 @@ class CloudSandboxExecutor extends BaseExecutor<typeof CloudSandboxApiName> {
return this.toBuiltinResult(result);
};
- searchLocalFiles = async (
+ searchFiles = async (
params: SearchLocalFilesParams,
ctx: BuiltinToolContext,
): Promise<BuiltinToolResult> => {
@@ -130,7 +129,7 @@ class CloudSandboxExecutor extends BaseExecutor<typeof CloudSandboxApiName> {
return this.toBuiltinResult(result);
};
- moveLocalFiles = async (
+ moveFiles = async (
params: MoveLocalFilesParams,
ctx: BuiltinToolContext,
): Promise<BuiltinToolResult> => {
@@ -139,15 +138,6 @@ class CloudSandboxExecutor extends BaseExecutor<typeof CloudSandboxApiName> {
return this.toBuiltinResult(result);
};
- renameLocalFile = async (
- params: RenameLocalFileParams,
- ctx: BuiltinToolContext,
- ): Promise<BuiltinToolResult> => {
- const runtime = this.getRuntime(ctx);
- const result = await runtime.renameFile(params);
- return this.toBuiltinResult(result);
- };
-
// ==================== Code Execution ====================
executeCode = async (
@@ -199,7 +189,7 @@ class CloudSandboxExecutor extends BaseExecutor<typeof CloudSandboxApiName> {
return this.toBuiltinResult(result);
};
- globLocalFiles = async (
+ globFiles = async (
params: GlobLocalFilesParams,
ctx: BuiltinToolContext,
): Promise<BuiltinToolResult> => {
diff --git a/packages/builtin-tool-cloud-sandbox/src/manifest.ts b/packages/builtin-tool-cloud-sandbox/src/manifest.ts
index 1086d351d32..7116ee45143 100644
--- a/packages/builtin-tool-cloud-sandbox/src/manifest.ts
+++ b/packages/builtin-tool-cloud-sandbox/src/manifest.ts
@@ -36,7 +36,7 @@ export const CloudSandboxManifest: 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: CloudSandboxApiName.listLocalFiles,
+ name: CloudSandboxApiName.listFiles,
parameters: {
properties: {
directoryPath: {
@@ -51,7 +51,7 @@ export const CloudSandboxManifest: BuiltinToolManifest = {
{
description:
'Read the content of a specific file. Input should be the file path. Output is the file content as a string.',
- name: CloudSandboxApiName.readLocalFile,
+ name: CloudSandboxApiName.readFile,
parameters: {
properties: {
endLine: {
@@ -73,7 +73,7 @@ export const CloudSandboxManifest: BuiltinToolManifest = {
},
{
description: 'Search for files within the sandbox based on keywords and filter options.',
- name: CloudSandboxApiName.searchLocalFiles,
+ name: CloudSandboxApiName.searchFiles,
parameters: {
properties: {
directory: {
@@ -105,7 +105,7 @@ export const CloudSandboxManifest: BuiltinToolManifest = {
description:
'Moves or renames multiple files/directories. Input is an array of operations with source and destination paths.',
humanIntervention: 'required',
- name: CloudSandboxApiName.moveLocalFiles,
+ name: CloudSandboxApiName.moveFiles,
parameters: {
properties: {
operations: {
@@ -131,30 +131,11 @@ export const CloudSandboxManifest: BuiltinToolManifest = {
type: 'object',
},
},
- {
- description:
- 'Rename a file or folder in its current location. Input should be the current full path and the new name.',
- name: CloudSandboxApiName.renameLocalFile,
- parameters: {
- properties: {
- newName: {
- description: 'The new name for the file or folder (filename only, not full path)',
- type: 'string',
- },
- oldPath: {
- description: 'The current full path of the file or folder to rename',
- type: 'string',
- },
- },
- required: ['oldPath', 'newName'],
- type: 'object',
- },
- },
{
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: CloudSandboxApiName.writeLocalFile,
+ name: CloudSandboxApiName.writeFile,
parameters: {
properties: {
content: {
@@ -178,7 +159,7 @@ export const CloudSandboxManifest: BuiltinToolManifest = {
description:
'Perform exact string replacements in files. Must read the file first before editing.',
humanIntervention: 'required',
- name: CloudSandboxApiName.editLocalFile,
+ name: CloudSandboxApiName.editFile,
parameters: {
properties: {
all: {
@@ -290,7 +271,7 @@ export const CloudSandboxManifest: BuiltinToolManifest = {
{
description:
'Find files matching glob patterns. Supports standard glob syntax like "**/*.js" or "src/**/*.ts".',
- name: CloudSandboxApiName.globLocalFiles,
+ name: CloudSandboxApiName.globFiles,
parameters: {
properties: {
directory: {
diff --git a/packages/builtin-tool-cloud-sandbox/src/systemRole.ts b/packages/builtin-tool-cloud-sandbox/src/systemRole.ts
index a96eae565de..15e44f97e33 100644
--- a/packages/builtin-tool-cloud-sandbox/src/systemRole.ts
+++ b/packages/builtin-tool-cloud-sandbox/src/systemRole.ts
@@ -77,28 +77,27 @@ You have access to the following tools for interacting with the cloud sandbox:
**File Operations:**
-1. **listLocalFiles**: Lists files and directories in a specified path within the sandbox.
-2. **readLocalFile**: Reads the content of a specified file, optionally within a line range.
-3. **writeLocalFile**: Write content to a specific file. Creates parent directories if needed.
-4. **editLocalFile**: Performs exact string replacements in files. Must read the file first before editing.
-5. **renameLocalFile**: Renames a single file or directory in its current location.
-6. **moveLocalFiles**: Moves multiple files or directories.
-7. **exportFile**: Export a file from the sandbox to allow user download.
+1. **listFiles**: Lists files and directories in a specified path within the sandbox.
+2. **readFile**: Reads the content of a specified file, optionally within a line range.
+3. **writeFile**: Write content to a specific file. Creates parent directories if needed.
+4. **editFile**: Performs exact string replacements in files. Must read the file first before editing.
+5. **moveFiles**: Moves or renames files and directories. To rename, keep the same directory and change the filename in \`newPath\`.
+6. **exportFile**: Export a file from the sandbox to allow user download.
**Code Execution:**
-8. **executeCode**: Execute code directly in the sandbox. Supports Python (default), JavaScript, and TypeScript.
+7. **executeCode**: Execute code directly in the sandbox. Supports Python (default), JavaScript, and TypeScript.
**Shell Commands:**
-9. **runCommand**: Execute shell commands with timeout control. Supports background execution.
-10. **getCommandOutput**: Retrieve output from running background commands.
-11. **killCommand**: Terminate a running background shell command by its ID.
+8. **runCommand**: Execute shell commands with timeout control. Supports background execution.
+9. **getCommandOutput**: Retrieve output from running background commands.
+10. **killCommand**: Terminate a running background shell command by its ID.
**Search & Find:**
-12. **searchLocalFiles**: Search for files based on keywords and criteria.
-13. **grepContent**: Search for content within files using regex patterns.
-14. **globLocalFiles**: Find files matching glob patterns (e.g., "**/*.js").
+11. **searchFiles**: Search for files based on keywords and criteria.
+12. **grepContent**: Search for content within files using regex patterns.
+13. **globFiles**: Find files matching glob patterns (e.g., "**/*.js").
</core_capabilities>
@@ -159,14 +158,14 @@ When code execution produces any output files (documents, images, data, etc.), y
<tool_usage_guidelines>
-- For listing directory contents: Use 'listLocalFiles' with the target directory path.
-- For reading a file: Use 'readLocalFile' with the file path. Optionally specify startLine/endLine for partial reads.
-- For writing files: Use 'writeLocalFile' with the file path and content. Set createDirectories: true if needed.
-- For editing files: Use 'editLocalFile'. Always read the file first to verify content before editing.
+- For listing directory contents: Use 'listFiles' with the target directory path.
+- For reading a file: Use 'readFile' with the file path. Optionally specify startLine/endLine for partial reads.
+- For writing files: Use 'writeFile' with the file path and content. Set createDirectories: true if needed.
+- For editing files: Use 'editFile'. Always read the file first to verify content before editing.
- For executing code directly: Use 'executeCode' with the code and optional language (python/javascript/typescript). This is preferred over runCommand for simple code execution.
- For running shell commands: Use 'runCommand' to execute shell commands like \`pip install package\` or complex shell operations.
- For background tasks: Set background: true in runCommand, then use getCommandOutput to check progress.
-- For searching files: Use 'searchLocalFiles' for filename search, 'grepContent' for content search, 'globLocalFiles' for pattern matching.
+- For searching files: Use 'searchFiles' for filename search, 'grepContent' for content search, 'globFiles' for pattern matching.
- For exporting files: Use 'exportFile' with the file path to generate a download URL for the user. **Export by default when any output files are produced - only skip when user explicitly asks to just run/check something.**
</tool_usage_guidelines>
diff --git a/packages/builtin-tool-cloud-sandbox/src/types/api.ts b/packages/builtin-tool-cloud-sandbox/src/types/api.ts
index b3d0ebc6e22..e1631a6e973 100644
--- a/packages/builtin-tool-cloud-sandbox/src/types/api.ts
+++ b/packages/builtin-tool-cloud-sandbox/src/types/api.ts
@@ -2,20 +2,19 @@
* API names for Cloud Sandbox tool
*/
export const CloudSandboxApiName = {
- editLocalFile: 'editLocalFile',
+ editFile: 'editFile',
executeCode: 'executeCode',
exportFile: 'exportFile',
getCommandOutput: 'getCommandOutput',
- globLocalFiles: 'globLocalFiles',
+ globFiles: 'globFiles',
grepContent: 'grepContent',
killCommand: 'killCommand',
- listLocalFiles: 'listLocalFiles',
- moveLocalFiles: 'moveLocalFiles',
- readLocalFile: 'readLocalFile',
- renameLocalFile: 'renameLocalFile',
+ listFiles: 'listFiles',
+ moveFiles: 'moveFiles',
+ readFile: 'readFile',
runCommand: 'runCommand',
- searchLocalFiles: 'searchLocalFiles',
- writeLocalFile: 'writeLocalFile',
+ searchFiles: 'searchFiles',
+ writeFile: 'writeFile',
} as const;
export type CloudSandboxApiNameType =
diff --git a/packages/builtin-tool-creds/src/systemRole.ts b/packages/builtin-tool-creds/src/systemRole.ts
index 1508d68c5c8..76567067610 100644
--- a/packages/builtin-tool-creds/src/systemRole.ts
+++ b/packages/builtin-tool-creds/src/systemRole.ts
@@ -128,7 +128,7 @@ runCommand({
**Important:**
- Never pass credential values in the \`command\` string β€” use the \`env\` parameter of \`runCommand\` instead
- Never pass credential values to \`executeCode\` β€” it runs in an isolated process without env support
-- File credentials: \`getPlaintextCred\` returns a \`fileUrl\` (download URL) in state β€” use \`runCommand\` with \`curl\` or \`writeLocalFile\` to save the file locally first, then reference the local path
+- File credentials: \`getPlaintextCred\` returns a \`fileUrl\` (download URL) in state β€” use \`runCommand\` with \`curl\` or \`writeFile\` to save the file locally first, then reference the local path
</local_integration>
<klavis_integrations>
diff --git a/packages/builtin-tool-local-system/src/client/Inspector/index.ts b/packages/builtin-tool-local-system/src/client/Inspector/index.ts
index ff3d3dab80c..4440dd60871 100644
--- a/packages/builtin-tool-local-system/src/client/Inspector/index.ts
+++ b/packages/builtin-tool-local-system/src/client/Inspector/index.ts
@@ -12,16 +12,29 @@ import { WriteLocalFileInspector } from './WriteLocalFile';
/**
* Local System Inspector Components Registry
+ *
+ * Register each component under both the new short API name and the legacy
+ * long name so old DB messages keep rendering after the rename.
*/
export const LocalSystemInspectors = {
- [LocalSystemApiName.editLocalFile]: EditLocalFileInspector,
- [LocalSystemApiName.globLocalFiles]: GlobLocalFilesInspector,
+ [LocalSystemApiName.editFile]: EditLocalFileInspector,
+ [LocalSystemApiName.globFiles]: GlobLocalFilesInspector,
[LocalSystemApiName.grepContent]: GrepContentInspector,
- [LocalSystemApiName.listLocalFiles]: ListLocalFilesInspector,
- [LocalSystemApiName.moveLocalFiles]: MoveLocalFilesInspector,
- [LocalSystemApiName.readLocalFile]: ReadLocalFileInspector,
- [LocalSystemApiName.renameLocalFile]: RenameLocalFileInspector,
+ [LocalSystemApiName.listFiles]: ListLocalFilesInspector,
+ [LocalSystemApiName.moveFiles]: MoveLocalFilesInspector,
+ [LocalSystemApiName.readFile]: ReadLocalFileInspector,
[LocalSystemApiName.runCommand]: RunCommandInspector,
- [LocalSystemApiName.searchLocalFiles]: SearchLocalFilesInspector,
- [LocalSystemApiName.writeLocalFile]: WriteLocalFileInspector,
+ [LocalSystemApiName.searchFiles]: SearchLocalFilesInspector,
+ [LocalSystemApiName.writeFile]: WriteLocalFileInspector,
+ // Legacy aliases β€” keep these so historical messages keep rendering.
+ // `renameLocalFile` is kept here even though the new tool surface no longer
+ // exposes a rename API (rename is now done via `moveFiles`).
+ editLocalFile: EditLocalFileInspector,
+ globLocalFiles: GlobLocalFilesInspector,
+ listLocalFiles: ListLocalFilesInspector,
+ moveLocalFiles: MoveLocalFilesInspector,
+ readLocalFile: ReadLocalFileInspector,
+ renameLocalFile: RenameLocalFileInspector,
+ searchLocalFiles: SearchLocalFilesInspector,
+ writeLocalFile: WriteLocalFileInspector,
};
diff --git a/packages/builtin-tool-local-system/src/client/Intervention/index.ts b/packages/builtin-tool-local-system/src/client/Intervention/index.ts
index 92a2e3fcb4d..927d1bd44b5 100644
--- a/packages/builtin-tool-local-system/src/client/Intervention/index.ts
+++ b/packages/builtin-tool-local-system/src/client/Intervention/index.ts
@@ -12,16 +12,29 @@ import WriteFile from './WriteFile';
/**
* Local System Intervention Components Registry
+ *
+ * Register each component under both the new short API name and the legacy
+ * long name so old DB messages keep rendering after the rename.
*/
export const LocalSystemInterventions = {
- [LocalSystemApiName.editLocalFile]: EditLocalFile,
- [LocalSystemApiName.globLocalFiles]: GlobLocalFiles,
+ [LocalSystemApiName.editFile]: EditLocalFile,
+ [LocalSystemApiName.globFiles]: GlobLocalFiles,
[LocalSystemApiName.grepContent]: GrepContent,
- [LocalSystemApiName.listLocalFiles]: ListLocalFiles,
- [LocalSystemApiName.moveLocalFiles]: MoveLocalFiles,
- [LocalSystemApiName.readLocalFile]: ReadLocalFile,
- [LocalSystemApiName.renameLocalFile]: RenameLocalFile,
+ [LocalSystemApiName.listFiles]: ListLocalFiles,
+ [LocalSystemApiName.moveFiles]: MoveLocalFiles,
+ [LocalSystemApiName.readFile]: ReadLocalFile,
[LocalSystemApiName.runCommand]: RunCommand,
- [LocalSystemApiName.searchLocalFiles]: SearchLocalFiles,
- [LocalSystemApiName.writeLocalFile]: WriteFile,
+ [LocalSystemApiName.searchFiles]: SearchLocalFiles,
+ [LocalSystemApiName.writeFile]: WriteFile,
+ // Legacy aliases β€” keep these so historical messages keep rendering.
+ // `renameLocalFile` is kept here even though the new tool surface no longer
+ // exposes a rename API (rename is now done via `moveFiles`).
+ editLocalFile: EditLocalFile,
+ globLocalFiles: GlobLocalFiles,
+ listLocalFiles: ListLocalFiles,
+ moveLocalFiles: MoveLocalFiles,
+ readLocalFile: ReadLocalFile,
+ renameLocalFile: RenameLocalFile,
+ searchLocalFiles: SearchLocalFiles,
+ writeLocalFile: WriteFile,
};
diff --git a/packages/builtin-tool-local-system/src/client/Render/index.ts b/packages/builtin-tool-local-system/src/client/Render/index.ts
index 15f2e3f0f3f..23e1ff0ff4f 100644
--- a/packages/builtin-tool-local-system/src/client/Render/index.ts
+++ b/packages/builtin-tool-local-system/src/client/Render/index.ts
@@ -10,13 +10,24 @@ import WriteFile from './WriteFile';
/**
* Local System Render Components Registry
+ *
+ * Register each component under both the new short API name (used going
+ * forward) and the legacy long name (kept so old DB messages with
+ * apiName: 'readLocalFile' etc. still render after the rename).
*/
export const LocalSystemRenders = {
- [LocalSystemApiName.editLocalFile]: EditLocalFile,
- [LocalSystemApiName.listLocalFiles]: ListFiles,
- [LocalSystemApiName.moveLocalFiles]: MoveLocalFiles,
- [LocalSystemApiName.readLocalFile]: ReadLocalFile,
+ [LocalSystemApiName.editFile]: EditLocalFile,
+ [LocalSystemApiName.listFiles]: ListFiles,
+ [LocalSystemApiName.moveFiles]: MoveLocalFiles,
+ [LocalSystemApiName.readFile]: ReadLocalFile,
[LocalSystemApiName.runCommand]: RunCommandRender,
- [LocalSystemApiName.searchLocalFiles]: SearchFiles,
- [LocalSystemApiName.writeLocalFile]: WriteFile,
+ [LocalSystemApiName.searchFiles]: SearchFiles,
+ [LocalSystemApiName.writeFile]: WriteFile,
+ // Legacy aliases β€” keep these so historical messages keep rendering
+ editLocalFile: EditLocalFile,
+ listLocalFiles: ListFiles,
+ moveLocalFiles: MoveLocalFiles,
+ readLocalFile: ReadLocalFile,
+ searchLocalFiles: SearchFiles,
+ writeLocalFile: WriteFile,
};
diff --git a/packages/builtin-tool-local-system/src/client/Streaming/index.ts b/packages/builtin-tool-local-system/src/client/Streaming/index.ts
index 032ebd9fca4..d572612f78e 100644
--- a/packages/builtin-tool-local-system/src/client/Streaming/index.ts
+++ b/packages/builtin-tool-local-system/src/client/Streaming/index.ts
@@ -4,8 +4,13 @@ import { WriteFileStreaming } from './WriteFile';
/**
* Local System Streaming Components Registry
+ *
+ * Register each component under both the new short API name and the legacy
+ * long name so old DB messages keep rendering after the rename.
*/
export const LocalSystemStreamings = {
[LocalSystemApiName.runCommand]: RunCommandStreaming,
- [LocalSystemApiName.writeLocalFile]: WriteFileStreaming,
+ [LocalSystemApiName.writeFile]: WriteFileStreaming,
+ // Legacy aliases β€” keep these so historical messages keep rendering
+ writeLocalFile: WriteFileStreaming,
};
diff --git a/packages/builtin-tool-local-system/src/executor/index.test.ts b/packages/builtin-tool-local-system/src/executor/index.test.ts
index a510a924a03..c40d713dde3 100644
--- a/packages/builtin-tool-local-system/src/executor/index.test.ts
+++ b/packages/builtin-tool-local-system/src/executor/index.test.ts
@@ -17,7 +17,7 @@ describe('LocalSystemExecutor', () => {
vi.clearAllMocks();
});
- describe('globLocalFiles', () => {
+ describe('globFiles', () => {
it('should preserve scope and relative pattern when delegating glob search', async () => {
globFilesMock.mockResolvedValue({
files: ['/tmp/images/a.png'],
@@ -25,7 +25,7 @@ describe('LocalSystemExecutor', () => {
total_files: 1,
});
- await localSystemExecutor.globLocalFiles({
+ await localSystemExecutor.globFiles({
pattern: '**/*.{png,jpg,jpeg,gif,webp}',
scope: '/tmp/images',
});
@@ -44,7 +44,7 @@ describe('LocalSystemExecutor', () => {
total_files: 2,
});
- const result = await localSystemExecutor.globLocalFiles({
+ const result = await localSystemExecutor.globFiles({
pattern: '**/*.pdf',
scope: '/Users/me/Downloads',
});
@@ -71,7 +71,7 @@ describe('LocalSystemExecutor', () => {
total_files: 0,
});
- const result = await localSystemExecutor.globLocalFiles({
+ const result = await localSystemExecutor.globFiles({
pattern: '**/*never-matches*',
});
@@ -100,7 +100,7 @@ describe('LocalSystemExecutor', () => {
total_files: 0,
});
- const result = await localSystemExecutor.globLocalFiles({
+ const result = await localSystemExecutor.globFiles({
pattern: '**/*Financial*Statement*',
});
diff --git a/packages/builtin-tool-local-system/src/executor/index.ts b/packages/builtin-tool-local-system/src/executor/index.ts
index c8dbfa9d8a7..2d1e15549e0 100644
--- a/packages/builtin-tool-local-system/src/executor/index.ts
+++ b/packages/builtin-tool-local-system/src/executor/index.ts
@@ -9,7 +9,6 @@ import type {
LocalReadFilesParams,
LocalSearchFilesParams,
MoveLocalFilesParams,
- RenameLocalFileParams,
RunCommandParams,
WriteLocalFileParams,
} from '@lobechat/electron-client-ipc';
@@ -23,19 +22,18 @@ import { LocalSystemIdentifier } from '../types';
import { resolveArgsWithScope } from '../utils/path';
const LocalSystemApiEnum = {
- editLocalFile: 'editLocalFile' as const,
+ editFile: 'editFile' as const,
getCommandOutput: 'getCommandOutput' as const,
- globLocalFiles: 'globLocalFiles' as const,
+ globFiles: 'globFiles' as const,
grepContent: 'grepContent' as const,
killCommand: 'killCommand' as const,
- listLocalFiles: 'listLocalFiles' as const,
- moveLocalFiles: 'moveLocalFiles' as const,
- readLocalFile: 'readLocalFile' as const,
- readLocalFiles: 'readLocalFiles' as const,
- renameLocalFile: 'renameLocalFile' as const,
+ listFiles: 'listFiles' as const,
+ moveFiles: 'moveFiles' as const,
+ readFile: 'readFile' as const,
+ readFiles: 'readFiles' as const,
runCommand: 'runCommand' as const,
- searchLocalFiles: 'searchLocalFiles' as const,
- writeLocalFile: 'writeLocalFile' as const,
+ searchFiles: 'searchFiles' as const,
+ writeFile: 'writeFile' as const,
};
/**
@@ -56,7 +54,7 @@ class LocalSystemExecutor extends BaseExecutor<typeof LocalSystemApiEnum> {
* Single funnel for every executor return β€” keep it strict:
* - never propagate an undefined `content` (would collapse downstream into
* `''` and leave the Debug "Response" pane blank while pluginState was
- * still saved β€” see globLocalFiles regression);
+ * still saved β€” see globFiles regression);
* - always preserve `state` when the runtime produced one, regardless of
* `success`, so renderers can keep displaying partial outputs on failure.
*/
@@ -85,7 +83,7 @@ class LocalSystemExecutor extends BaseExecutor<typeof LocalSystemApiEnum> {
// ==================== File Operations ====================
- listLocalFiles = async (params: ListLocalFileParams): Promise<BuiltinToolResult> => {
+ listFiles = async (params: ListLocalFileParams): Promise<BuiltinToolResult> => {
try {
const result = await this.runtime.listFiles({
directoryPath: params.path,
@@ -98,7 +96,7 @@ class LocalSystemExecutor extends BaseExecutor<typeof LocalSystemApiEnum> {
}
};
- readLocalFile = async (params: LocalReadFileParams): Promise<BuiltinToolResult> => {
+ readFile = async (params: LocalReadFileParams): Promise<BuiltinToolResult> => {
try {
const result = await this.runtime.readFile({
endLine: params.loc?.[1],
@@ -111,7 +109,7 @@ class LocalSystemExecutor extends BaseExecutor<typeof LocalSystemApiEnum> {
}
};
- readLocalFiles = async (params: LocalReadFilesParams): Promise<BuiltinToolResult> => {
+ readFiles = async (params: LocalReadFilesParams): Promise<BuiltinToolResult> => {
try {
const result = await this.runtime.readFiles(params);
return this.toResult(result);
@@ -120,7 +118,7 @@ class LocalSystemExecutor extends BaseExecutor<typeof LocalSystemApiEnum> {
}
};
- searchLocalFiles = async (params: LocalSearchFilesParams): Promise<BuiltinToolResult> => {
+ searchFiles = async (params: LocalSearchFilesParams): Promise<BuiltinToolResult> => {
try {
const resolvedParams = resolveArgsWithScope(params, 'directory');
const result = await this.runtime.searchFiles({
@@ -133,7 +131,7 @@ class LocalSystemExecutor extends BaseExecutor<typeof LocalSystemApiEnum> {
}
};
- moveLocalFiles = async (params: MoveLocalFilesParams): Promise<BuiltinToolResult> => {
+ moveFiles = async (params: MoveLocalFilesParams): Promise<BuiltinToolResult> => {
try {
const result = await this.runtime.moveFiles({
operations: params.items.map((item) => ({
@@ -147,19 +145,7 @@ class LocalSystemExecutor extends BaseExecutor<typeof LocalSystemApiEnum> {
}
};
- renameLocalFile = async (params: RenameLocalFileParams): Promise<BuiltinToolResult> => {
- try {
- const result = await this.runtime.renameFile({
- newName: params.newName,
- oldPath: params.path,
- });
- return this.toResult(result);
- } catch (error) {
- return this.errorResult(error);
- }
- };
-
- writeLocalFile = async (params: WriteLocalFileParams): Promise<BuiltinToolResult> => {
+ writeFile = async (params: WriteLocalFileParams): Promise<BuiltinToolResult> => {
try {
const result = await this.runtime.writeFile(params);
return this.toResult(result);
@@ -168,7 +154,7 @@ class LocalSystemExecutor extends BaseExecutor<typeof LocalSystemApiEnum> {
}
};
- editLocalFile = async (params: EditLocalFileParams): Promise<BuiltinToolResult> => {
+ editFile = async (params: EditLocalFileParams): Promise<BuiltinToolResult> => {
try {
const result = await this.runtime.editFile({
all: params.replace_all,
@@ -230,7 +216,7 @@ class LocalSystemExecutor extends BaseExecutor<typeof LocalSystemApiEnum> {
}
};
- globLocalFiles = async (params: GlobFilesParams): Promise<BuiltinToolResult> => {
+ globFiles = async (params: GlobFilesParams): Promise<BuiltinToolResult> => {
try {
const result = await this.runtime.globFiles({
directory: params.scope,
diff --git a/packages/builtin-tool-local-system/src/manifest.ts b/packages/builtin-tool-local-system/src/manifest.ts
index 48d9c1ed4f8..df6fff5063c 100644
--- a/packages/builtin-tool-local-system/src/manifest.ts
+++ b/packages/builtin-tool-local-system/src/manifest.ts
@@ -16,7 +16,7 @@ export const LocalSystemManifest: BuiltinToolManifest = {
type: 'pathScopeAudit',
},
},
- name: LocalSystemApiName.listLocalFiles,
+ name: LocalSystemApiName.listFiles,
parameters: {
properties: {
limit: {
@@ -55,7 +55,7 @@ export const LocalSystemManifest: BuiltinToolManifest = {
type: 'pathScopeAudit',
},
},
- name: LocalSystemApiName.readLocalFile,
+ name: LocalSystemApiName.readFile,
parameters: {
properties: {
loc: {
@@ -85,7 +85,7 @@ export const LocalSystemManifest: BuiltinToolManifest = {
type: 'pathScopeAudit',
},
},
- name: LocalSystemApiName.searchLocalFiles,
+ name: LocalSystemApiName.searchFiles,
parameters: {
properties: {
contentContains: {
@@ -169,7 +169,7 @@ export const LocalSystemManifest: BuiltinToolManifest = {
type: 'pathScopeAudit',
},
},
- name: LocalSystemApiName.moveLocalFiles,
+ name: LocalSystemApiName.moveFiles,
parameters: {
properties: {
items: {
@@ -196,32 +196,6 @@ export const LocalSystemManifest: BuiltinToolManifest = {
type: 'object',
},
},
- {
- description:
- 'Rename a file or folder in its current location. Input should be the current full path and the new name.',
- humanIntervention: {
- dynamic: {
- default: 'never',
- policy: 'required',
- type: 'pathScopeAudit',
- },
- },
- name: LocalSystemApiName.renameLocalFile,
- parameters: {
- properties: {
- newName: {
- description: 'The new name for the file or folder (without path)',
- type: 'string',
- },
- path: {
- description: 'The current full path of the file or folder to rename',
- type: 'string',
- },
- },
- required: ['path', 'newName'],
- type: 'object',
- },
- },
{
description:
'Write content to a specific file. Input should be the file path and content. Overwrites existing file or creates a new one.',
@@ -232,7 +206,7 @@ export const LocalSystemManifest: BuiltinToolManifest = {
type: 'pathScopeAudit',
},
},
- name: LocalSystemApiName.writeLocalFile,
+ name: LocalSystemApiName.writeFile,
parameters: {
properties: {
content: {
@@ -258,7 +232,7 @@ export const LocalSystemManifest: BuiltinToolManifest = {
type: 'pathScopeAudit',
},
},
- name: LocalSystemApiName.editLocalFile,
+ name: LocalSystemApiName.editFile,
parameters: {
properties: {
file_path: {
@@ -433,7 +407,7 @@ export const LocalSystemManifest: BuiltinToolManifest = {
type: 'pathScopeAudit',
},
},
- name: LocalSystemApiName.globLocalFiles,
+ name: LocalSystemApiName.globFiles,
parameters: {
properties: {
pattern: {
diff --git a/packages/builtin-tool-local-system/src/systemRole.desktop.ts b/packages/builtin-tool-local-system/src/systemRole.desktop.ts
index 9e18dd94829..dd4f2ecc6ba 100644
--- a/packages/builtin-tool-local-system/src/systemRole.desktop.ts
+++ b/packages/builtin-tool-local-system/src/systemRole.desktop.ts
@@ -21,36 +21,35 @@ Use these paths when the user refers to these common locations by name (e.g., "m
You have access to a set of tools to interact with the user's local file system:
**File Operations:**
-1. **listLocalFiles**: Lists files and directories in a specified path. Returns metadata including file size and modification time. Results are sorted by modification time (newest first) by default and limited to 100 items.
-2. **readLocalFile**: Reads the content of a specified file, optionally within a line range. You can read file types such as Word, Excel, PowerPoint, PDF, and plain text files.
-3. **writeLocalFile**: Write content to a specific file, only support plain text file like \`.text\` or \`.md\`
-4. **editLocalFile**: Performs exact string replacements in files. Must read the file first before editing.
-5. **renameLocalFile**: Renames a single file or directory in its current location.
-6. **moveLocalFiles**: Moves multiple files or directories. Can be used for renaming during the move.
+1. **listFiles**: Lists files and directories in a specified path. Returns metadata including file size and modification time. Results are sorted by modification time (newest first) by default and limited to 100 items.
+2. **readFile**: Reads the content of a specified file, optionally within a line range. You can read file types such as Word, Excel, PowerPoint, PDF, and plain text files.
+3. **writeFile**: Write content to a specific file, only support plain text file like \`.text\` or \`.md\`
+4. **editFile**: Performs exact string replacements in files. Must read the file first before editing.
+5. **moveFiles**: Moves multiple files or directories. Also handles renames β€” pass the original directory with the new filename in \`newPath\`.
**Shell Commands:**
-7. **runCommand**: Execute shell commands with timeout control. Supports both synchronous and background execution. When providing a description, always use the same language as the user's input.
-8. **getCommandOutput**: Retrieve output from running background commands. Returns only new output since last check.
-9. **killCommand**: Terminate a running background shell command by its ID.
+6. **runCommand**: Execute shell commands with timeout control. Supports both synchronous and background execution. When providing a description, always use the same language as the user's input.
+7. **getCommandOutput**: Retrieve output from running background commands. Returns only new output since last check.
+8. **killCommand**: Terminate a running background shell command by its ID.
**Search & Find:**
-10. **searchLocalFiles**: Searches for files based on keywords and other criteria using native search. Use this tool to find files if the user is unsure about the exact path.
-11. **grepContent**: Search for content within files using regex patterns. Supports various output modes, filtering, and context lines.
-12. **globLocalFiles**: Find files matching glob patterns (e.g., "**/*.js", "*.{ts,tsx}").
+9. **searchFiles**: Searches for files based on keywords and other criteria using native search. Use this tool to find files if the user is unsure about the exact path.
+10. **grepContent**: Search for content within files using regex patterns. Supports various output modes, filtering, and context lines.
+11. **globFiles**: Find files matching glob patterns (e.g., "**/*.js", "*.{ts,tsx}").
</core_capabilities>
<workflow>
1. Understand the user's request regarding local operations (files, commands, searches).
2. Select the appropriate tool:
- - File operations: listLocalFiles, readLocalFile, writeLocalFile, editLocalFile, renameLocalFile, moveLocalFiles
+ - File operations: listFiles, readFile, writeFile, editFile, moveFiles
- Shell commands: runCommand, getCommandOutput, killCommand
- - Search/Find: searchLocalFiles, grepContent, globLocalFiles
+ - Search/Find: searchFiles, grepContent, globFiles
3. Execute the operation. **If the user mentions a common location (like Desktop, Documents, Downloads, etc.) without providing a full path, use the corresponding path from the <user_context> section.**
4. Present the results or confirmation.
</workflow>
<tool_usage_guidelines>
-- For listing directory contents: Use 'listLocalFiles'. Provide the following parameters:
+- For listing directory contents: Use 'listFiles'. Provide the following parameters:
- 'path': The directory path to list.
- 'sortBy' (Optional): Field to sort results by. Options: 'name', 'modifiedTime', 'createdTime', 'size'. Defaults to 'modifiedTime'.
- 'sortOrder' (Optional): Sort order. Options: 'asc', 'desc'. Defaults to 'desc' (newest/largest first).
@@ -62,7 +61,7 @@ You have access to a set of tools to interact with the user's local file system:
- 'loc' (Optional): A two-element array [startLine, endLine] to specify a line range to read (e.g., '[301, 400]' reads lines 301 to 400).
- If 'loc' is omitted, it defaults to reading the first 200 lines ('[0, 200]').
- To read the entire file: First call 'readFile' (potentially without 'loc'). The response includes 'totalLineCount'. Then, call 'readFile' again with 'loc: [0, totalLineCount]' to get the full content.
-- For searching files: Use 'searchLocalFiles' with the 'keywords' parameter (search string). 'keywords' is split on whitespace and every token must appear as a substring of the filename (case- and diacritic-insensitive, order-independent). Pass only the discriminating words β€” long phrases full of optional words will return nothing. You can optionally add the following filter parameters to narrow down the search:
+- For searching files: Use 'searchFiles' with the 'keywords' parameter (search string). 'keywords' is split on whitespace and every token must appear as a substring of the filename (case- and diacritic-insensitive, order-independent). Pass only the discriminating words β€” long phrases full of optional words will return nothing. You can optionally add the following filter parameters to narrow down the search:
- 'contentContains': Find files whose content includes specific text.
- 'createdAfter' / 'createdBefore': Filter by creation date.
- 'modifiedAfter' / 'modifiedBefore': Filter by modification date.
@@ -71,17 +70,14 @@ You have access to a set of tools to interact with the user's local file system:
- 'exclude': Exclude specific files or directories.
- 'limit': Limit the number of results returned.
- 'sortBy' / 'sortDirection': Sort the results.
-- For renaming a file/folder in place: Use 'renameFile'. Provide the following parameters:
- - 'path': The current full path of the file or folder.
- - 'newName': The desired new name (without path components).
-- For moving multiple files/folders (and optionally renaming them): Use 'moveLocalFiles'. Provide the following parameter:
- - 'items': An array of objects, where each object represents a move operation and must contain:
- - 'oldPath': The current absolute path of the file/directory to move or rename.
- - 'newPath': The target absolute path for the file/directory (can include a new name).
+- For moving or renaming files/folders: Use 'moveFiles'. Provide the following parameter:
+ - 'items': An array of objects, where each object represents a move/rename operation and must contain:
+ - 'oldPath': The current absolute path of the file/directory.
+ - 'newPath': The target absolute path. To rename in place, keep the original directory and change only the filename.
- For writing a file: Use 'writeFile'. Provide:
- 'path': The file path to write to.
- 'content': The text content.
-- For editing files: Use 'editLocalFile'. Provide:
+- For editing files: Use 'editFile'. Provide:
- 'file_path': The absolute path to the file to modify.
- 'old_string': The exact text to replace.
- 'new_string': The replacement text.
@@ -106,7 +102,7 @@ You have access to a set of tools to interact with the user's local file system:
- '-n' (Optional): Show line numbers (requires output_mode: "content").
- '-A/-B/-C' (Optional): Show N lines after/before/around matches (requires output_mode: "content").
- 'head_limit' (Optional): Limit results to first N matches.
-- For finding files by pattern: Use 'globLocalFiles'. Provide:
+- For finding files by pattern: Use 'globFiles'. Provide:
- 'pattern': Glob pattern (e.g., "**/*.js", "src/**/*.ts").
- 'scope' (Optional): Directory to search in. **Always set this when looking inside a user folder** (e.g. {{downloadsPath}}) β€” when omitted it falls back to the user's home directory, which can be very slow for broad patterns like "**/*foo*".
Returns files sorted by modification time (most recent first).
diff --git a/packages/builtin-tool-local-system/src/systemRole.ts b/packages/builtin-tool-local-system/src/systemRole.ts
index bda59021c3b..5cb83819dad 100644
--- a/packages/builtin-tool-local-system/src/systemRole.ts
+++ b/packages/builtin-tool-local-system/src/systemRole.ts
@@ -10,36 +10,35 @@ export const systemPrompt = `You have a Local System tool with capabilities to i
You have access to a set of tools to interact with the user's local file system:
**File Operations:**
-1. **listLocalFiles**: Lists files and directories in a specified path. Returns metadata including file size and modification time. Results are sorted by modification time (newest first) by default and limited to 100 items.
-2. **readLocalFile**: Reads the content of a specified file, optionally within a line range. You can read file types such as Word, Excel, PowerPoint, PDF, and plain text files.
-3. **writeLocalFile**: Write content to a specific file, only support plain text file like \`.text\` or \`.md\`
-4. **editLocalFile**: Performs exact string replacements in files. Must read the file first before editing.
-5. **renameLocalFile**: Renames a single file or directory in its current location.
-6. **moveLocalFiles**: Moves multiple files or directories. Can be used for renaming during the move.
+1. **listFiles**: Lists files and directories in a specified path. Returns metadata including file size and modification time. Results are sorted by modification time (newest first) by default and limited to 100 items.
+2. **readFile**: Reads the content of a specified file, optionally within a line range. You can read file types such as Word, Excel, PowerPoint, PDF, and plain text files.
+3. **writeFile**: Write content to a specific file, only support plain text file like \`.text\` or \`.md\`
+4. **editFile**: Performs exact string replacements in files. Must read the file first before editing.
+5. **moveFiles**: Moves multiple files or directories. Also handles renames β€” pass the original directory with the new filename in \`newPath\`.
**Shell Commands:**
-7. **runCommand**: Execute shell commands with timeout control. Supports both synchronous and background execution. When providing a description, always use the same language as the user's input.
-8. **getCommandOutput**: Retrieve output from running background commands. Returns only new output since last check.
-9. **killCommand**: Terminate a running background shell command by its ID.
+6. **runCommand**: Execute shell commands with timeout control. Supports both synchronous and background execution. When providing a description, always use the same language as the user's input.
+7. **getCommandOutput**: Retrieve output from running background commands. Returns only new output since last check.
+8. **killCommand**: Terminate a running background shell command by its ID.
**Search & Find:**
-10. **searchLocalFiles**: Searches for files based on keywords and other criteria using native search. Use this tool to find files if the user is unsure about the exact path.
-11. **grepContent**: Search for content within files using regex patterns. Supports various output modes, filtering, and context lines.
-12. **globLocalFiles**: Find files matching glob patterns (e.g., "**/*.js", "*.{ts,tsx}").
+9. **searchFiles**: Searches for files based on keywords and other criteria using native search. Use this tool to find files if the user is unsure about the exact path.
+10. **grepContent**: Search for content within files using regex patterns. Supports various output modes, filtering, and context lines.
+11. **globFiles**: Find files matching glob patterns (e.g., "**/*.js", "*.{ts,tsx}").
</core_capabilities>
<workflow>
1. Understand the user's request regarding local operations (files, commands, searches).
2. Select the appropriate tool:
- - File operations: listLocalFiles, readLocalFile, writeLocalFile, editLocalFile, renameLocalFile, moveLocalFiles
+ - File operations: listFiles, readFile, writeFile, editFile, moveFiles
- Shell commands: runCommand, getCommandOutput, killCommand
- - Search/Find: searchLocalFiles, grepContent, globLocalFiles
+ - Search/Find: searchFiles, grepContent, globFiles
3. Execute the operation. **If the user mentions a common location (like Desktop, Documents, Downloads, etc.) without providing a full path, use the corresponding path from the <user_context> section.**
4. Present the results or confirmation.
</workflow>
<tool_usage_guidelines>
-- For listing directory contents: Use 'listLocalFiles'. Provide the following parameters:
+- For listing directory contents: Use 'listFiles'. Provide the following parameters:
- 'path': The directory path to list.
- 'sortBy' (Optional): Field to sort results by. Options: 'name', 'modifiedTime', 'createdTime', 'size'. Defaults to 'modifiedTime'.
- 'sortOrder' (Optional): Sort order. Options: 'asc', 'desc'. Defaults to 'desc' (newest/largest first).
@@ -51,7 +50,7 @@ You have access to a set of tools to interact with the user's local file system:
- 'loc' (Optional): A two-element array [startLine, endLine] to specify a line range to read (e.g., '[301, 400]' reads lines 301 to 400).
- If 'loc' is omitted, it defaults to reading the first 200 lines ('[0, 200]').
- To read the entire file: First call 'readFile' (potentially without 'loc'). The response includes 'totalLineCount'. Then, call 'readFile' again with 'loc: [0, totalLineCount]' to get the full content.
-- For searching files: Use 'searchLocalFiles' with the 'keywords' parameter (search string). 'keywords' is split on whitespace and every token must appear as a substring of the filename (case- and diacritic-insensitive, order-independent). Pass only the discriminating words β€” long phrases full of optional words will return nothing. You can optionally add the following filter parameters to narrow down the search:
+- For searching files: Use 'searchFiles' with the 'keywords' parameter (search string). 'keywords' is split on whitespace and every token must appear as a substring of the filename (case- and diacritic-insensitive, order-independent). Pass only the discriminating words β€” long phrases full of optional words will return nothing. You can optionally add the following filter parameters to narrow down the search:
- 'contentContains': Find files whose content includes specific text.
- 'createdAfter' / 'createdBefore': Filter by creation date.
- 'modifiedAfter' / 'modifiedBefore': Filter by modification date.
@@ -60,17 +59,14 @@ You have access to a set of tools to interact with the user's local file system:
- 'exclude': Exclude specific files or directories.
- 'limit': Limit the number of results returned.
- 'sortBy' / 'sortDirection': Sort the results.
-- For renaming a file/folder in place: Use 'renameFile'. Provide the following parameters:
- - 'path': The current full path of the file or folder.
- - 'newName': The desired new name (without path components).
-- For moving multiple files/folders (and optionally renaming them): Use 'moveLocalFiles'. Provide the following parameter:
- - 'items': An array of objects, where each object represents a move operation and must contain:
- - 'oldPath': The current absolute path of the file/directory to move or rename.
- - 'newPath': The target absolute path for the file/directory (can include a new name).
+- For moving or renaming files/folders: Use 'moveFiles'. Provide the following parameter:
+ - 'items': An array of objects, where each object represents a move/rename operation and must contain:
+ - 'oldPath': The current absolute path of the file/directory.
+ - 'newPath': The target absolute path. To rename in place, keep the original directory and change only the filename.
- For writing a file: Use 'writeFile'. Provide:
- 'path': The file path to write to.
- 'content': The text content.
-- For editing files: Use 'editLocalFile'. Provide:
+- For editing files: Use 'editFile'. Provide:
- 'file_path': The absolute path to the file to modify.
- 'old_string': The exact text to replace.
- 'new_string': The replacement text.
@@ -95,7 +91,7 @@ You have access to a set of tools to interact with the user's local file system:
- '-n' (Optional): Show line numbers (requires output_mode: "content").
- '-A/-B/-C' (Optional): Show N lines after/before/around matches (requires output_mode: "content").
- 'head_limit' (Optional): Limit results to first N matches.
-- For finding files by pattern: Use 'globLocalFiles'. Provide:
+- For finding files by pattern: Use 'globFiles'. Provide:
- 'pattern': Glob pattern (e.g., "**/*.js", "src/**/*.ts").
- 'scope' (Optional): Directory to search in. **Always set this when looking inside a user folder** β€” when omitted it falls back to the user's home directory, which can be very slow for broad patterns like "**/*foo*".
Returns files sorted by modification time (most recent first).
diff --git a/packages/builtin-tool-local-system/src/types.ts b/packages/builtin-tool-local-system/src/types.ts
index 30b1e802467..d91bf725cec 100644
--- a/packages/builtin-tool-local-system/src/types.ts
+++ b/packages/builtin-tool-local-system/src/types.ts
@@ -15,19 +15,18 @@ export type {
export const LocalSystemIdentifier = 'lobe-local-system';
export const LocalSystemApiName = {
- editLocalFile: 'editLocalFile',
+ editFile: 'editFile',
getCommandOutput: 'getCommandOutput',
- globLocalFiles: 'globLocalFiles',
+ globFiles: 'globFiles',
grepContent: 'grepContent',
killCommand: 'killCommand',
- listLocalFiles: 'listLocalFiles',
- moveLocalFiles: 'moveLocalFiles',
- readLocalFile: 'readLocalFile',
- renameLocalFile: 'renameLocalFile',
+ listFiles: 'listFiles',
+ moveFiles: 'moveFiles',
+ readFile: 'readFile',
runCommand: 'runCommand',
- searchLocalFiles: 'searchLocalFiles',
- writeLocalFile: 'writeLocalFile',
-};
+ searchFiles: 'searchFiles',
+ writeFile: 'writeFile',
+} as const;
export interface FileResult {
contentType?: string;
diff --git a/packages/builtin-tools/src/placeholders.ts b/packages/builtin-tools/src/placeholders.ts
index 774f9593abb..db945806d0d 100644
--- a/packages/builtin-tools/src/placeholders.ts
+++ b/packages/builtin-tools/src/placeholders.ts
@@ -16,8 +16,11 @@ import { type BuiltinPlaceholder } from '@lobechat/types';
*/
export const BuiltinToolPlaceholders: Record<string, Record<string, any>> = {
[LocalSystemIdentifier]: {
- [LocalSystemApiName.searchLocalFiles]: LocalSystemSearchFilesPlaceholder,
- [LocalSystemApiName.listLocalFiles]: LocalSystemListFilesPlaceholder,
+ [LocalSystemApiName.searchFiles]: LocalSystemSearchFilesPlaceholder,
+ [LocalSystemApiName.listFiles]: LocalSystemListFilesPlaceholder,
+ // Legacy aliases β€” keep these so historical messages keep rendering
+ listLocalFiles: LocalSystemListFilesPlaceholder,
+ searchLocalFiles: LocalSystemSearchFilesPlaceholder,
},
[WebBrowsingManifest.identifier]: WebBrowsingPlaceholders as Record<string, any>,
};
diff --git a/packages/builtin-tools/src/renders.ts b/packages/builtin-tools/src/renders.ts
index 047fd571b3a..d45071ee81d 100644
--- a/packages/builtin-tools/src/renders.ts
+++ b/packages/builtin-tools/src/renders.ts
@@ -90,7 +90,7 @@ export const listBuiltinRenderEntries = (): BuiltinRenderRegistryEntry[] =>
/**
* Get builtin render component for a specific API
* @param identifier - Tool identifier (e.g., 'lobe-local-system')
- * @param apiName - API name (e.g., 'searchLocalFiles')
+ * @param apiName - API name (e.g., 'searchFiles')
*/
export const getBuiltinRender = (
identifier?: string,
diff --git a/packages/types/src/message/common/metadata.ts b/packages/types/src/message/common/metadata.ts
index be16b7d2699..fb3fae897bc 100644
--- a/packages/types/src/message/common/metadata.ts
+++ b/packages/types/src/message/common/metadata.ts
@@ -4,7 +4,7 @@ import type { PageSelection } from './pageSelection';
import { PageSelectionSchema } from './pageSelection';
const LocalSystemToolSnapshotSchema = z.object({
- apiName: z.enum(['readLocalFile', 'listLocalFiles']),
+ apiName: z.enum(['readFile', 'listFiles', 'readLocalFile', 'listLocalFiles']),
arguments: z.record(z.string(), z.unknown()),
capturedAt: z.string(),
content: z.string().nullable(),
@@ -18,7 +18,7 @@ const LocalSystemToolSnapshotSchema = z.object({
});
export interface LocalSystemToolSnapshot {
- apiName: 'readLocalFile' | 'listLocalFiles';
+ apiName: 'readFile' | 'listFiles' | 'readLocalFile' | 'listLocalFiles';
arguments: Record<string, unknown>;
capturedAt: string;
content: string | null;
diff --git a/src/features/Conversation/Messages/AssistantGroup/constants.ts b/src/features/Conversation/Messages/AssistantGroup/constants.ts
index f969fb934bc..4f0879d46e5 100644
--- a/src/features/Conversation/Messages/AssistantGroup/constants.ts
+++ b/src/features/Conversation/Messages/AssistantGroup/constants.ts
@@ -136,19 +136,29 @@ export const TOOL_API_DISPLAY_NAMES: Record<string, string> = {
solve: 'workflow.toolDisplayName.solve',
execute: 'workflow.toolDisplayName.execute',
- // Local system
- editLocalFile: 'workflow.toolDisplayName.editLocalFile',
- globLocalFiles: 'workflow.toolDisplayName.globLocalFiles',
+ // Local system / cloud sandbox (file ops share the same display label)
+ editFile: 'workflow.toolDisplayName.editLocalFile',
+ globFiles: 'workflow.toolDisplayName.globLocalFiles',
grepContent: 'workflow.toolDisplayName.grepContent',
killCommand: 'workflow.toolDisplayName.killCommand',
+ listFiles: 'workflow.toolDisplayName.listLocalFiles',
+ moveFiles: 'workflow.toolDisplayName.moveLocalFiles',
+ readFile: 'workflow.toolDisplayName.readLocalFile',
+ runCommand: 'workflow.toolDisplayName.runCommand',
+ searchFiles: 'workflow.toolDisplayName.searchLocalFiles',
+ writeFile: 'workflow.toolDisplayName.writeLocalFile',
+ getCommandOutput: 'workflow.toolDisplayName.getCommandOutput',
+ // Legacy aliases β€” keep so historical messages still get a label.
+ // `renameLocalFile` is kept even though the new surface drops rename
+ // (rename is now done via `moveFiles`).
+ editLocalFile: 'workflow.toolDisplayName.editLocalFile',
+ globLocalFiles: 'workflow.toolDisplayName.globLocalFiles',
listLocalFiles: 'workflow.toolDisplayName.listLocalFiles',
moveLocalFiles: 'workflow.toolDisplayName.moveLocalFiles',
readLocalFile: 'workflow.toolDisplayName.readLocalFile',
renameLocalFile: 'workflow.toolDisplayName.renameLocalFile',
- runCommand: 'workflow.toolDisplayName.runCommand',
searchLocalFiles: 'workflow.toolDisplayName.searchLocalFiles',
writeLocalFile: 'workflow.toolDisplayName.writeLocalFile',
- getCommandOutput: 'workflow.toolDisplayName.getCommandOutput',
// Cloud sandbox
executeCode: 'workflow.toolDisplayName.executeCode',
diff --git a/src/locales/default/plugin.ts b/src/locales/default/plugin.ts
index 2d2bcf58822..520597cb092 100644
--- a/src/locales/default/plugin.ts
+++ b/src/locales/default/plugin.ts
@@ -59,18 +59,26 @@ export default {
'builtins.lobe-claude-code.todoWrite.allDone': 'All tasks completed',
'builtins.lobe-claude-code.todoWrite.currentStep': 'Current step',
'builtins.lobe-claude-code.todoWrite.todos': 'Todos',
- 'builtins.lobe-cloud-sandbox.apiName.editLocalFile': 'Edit file',
+ 'builtins.lobe-cloud-sandbox.apiName.editFile': 'Edit file',
'builtins.lobe-cloud-sandbox.apiName.executeCode': 'Execute code',
'builtins.lobe-cloud-sandbox.apiName.exportFile': 'Export file',
'builtins.lobe-cloud-sandbox.apiName.getCommandOutput': 'Get command output',
- 'builtins.lobe-cloud-sandbox.apiName.globLocalFiles': 'Glob search files',
+ 'builtins.lobe-cloud-sandbox.apiName.globFiles': 'Glob search files',
'builtins.lobe-cloud-sandbox.apiName.grepContent': 'Search content',
'builtins.lobe-cloud-sandbox.apiName.killCommand': 'Terminate command',
+ 'builtins.lobe-cloud-sandbox.apiName.listFiles': 'List files',
+ 'builtins.lobe-cloud-sandbox.apiName.moveFiles': 'Move files',
+ 'builtins.lobe-cloud-sandbox.apiName.readFile': 'Read file content',
+ 'builtins.lobe-cloud-sandbox.apiName.runCommand': 'Run command',
+ 'builtins.lobe-cloud-sandbox.apiName.searchFiles': 'Search files',
+ 'builtins.lobe-cloud-sandbox.apiName.writeFile': 'Write file',
+ // Legacy aliases β€” keep so historical tool calls still get a label
+ 'builtins.lobe-cloud-sandbox.apiName.editLocalFile': 'Edit file',
+ 'builtins.lobe-cloud-sandbox.apiName.globLocalFiles': 'Glob search files',
'builtins.lobe-cloud-sandbox.apiName.listLocalFiles': 'List files',
'builtins.lobe-cloud-sandbox.apiName.moveLocalFiles': 'Move files',
'builtins.lobe-cloud-sandbox.apiName.readLocalFile': 'Read file content',
'builtins.lobe-cloud-sandbox.apiName.renameLocalFile': 'Rename',
- 'builtins.lobe-cloud-sandbox.apiName.runCommand': 'Run command',
'builtins.lobe-cloud-sandbox.apiName.searchLocalFiles': 'Search files',
'builtins.lobe-cloud-sandbox.apiName.writeLocalFile': 'Write file',
'builtins.lobe-cloud-sandbox.inspector.noResults': 'No results',
@@ -137,16 +145,24 @@ export default {
'builtins.lobe-knowledge-base.inspector.andMoreFiles': 'and {{count}} more',
'builtins.lobe-knowledge-base.inspector.noResults': 'No results',
'builtins.lobe-knowledge-base.title': 'Library',
- 'builtins.lobe-local-system.apiName.editLocalFile': 'Edit file',
+ 'builtins.lobe-local-system.apiName.editFile': 'Edit file',
'builtins.lobe-local-system.apiName.getCommandOutput': 'Get command output',
- 'builtins.lobe-local-system.apiName.globLocalFiles': 'Glob search files',
+ 'builtins.lobe-local-system.apiName.globFiles': 'Glob search files',
'builtins.lobe-local-system.apiName.grepContent': 'Search content',
'builtins.lobe-local-system.apiName.killCommand': 'Terminate command',
+ 'builtins.lobe-local-system.apiName.listFiles': 'List files',
+ 'builtins.lobe-local-system.apiName.moveFiles': 'Move files',
+ 'builtins.lobe-local-system.apiName.readFile': 'Read file content',
+ 'builtins.lobe-local-system.apiName.runCommand': 'Run command',
+ 'builtins.lobe-local-system.apiName.searchFiles': 'Search files',
+ 'builtins.lobe-local-system.apiName.writeFile': 'Write file',
+ // Legacy aliases β€” keep so historical tool calls still get a label
+ 'builtins.lobe-local-system.apiName.editLocalFile': 'Edit file',
+ 'builtins.lobe-local-system.apiName.globLocalFiles': 'Glob search files',
'builtins.lobe-local-system.apiName.listLocalFiles': 'List files',
'builtins.lobe-local-system.apiName.moveLocalFiles': 'Move files',
'builtins.lobe-local-system.apiName.readLocalFile': 'Read file content',
'builtins.lobe-local-system.apiName.renameLocalFile': 'Rename',
- 'builtins.lobe-local-system.apiName.runCommand': 'Run command',
'builtins.lobe-local-system.apiName.searchLocalFiles': 'Search files',
'builtins.lobe-local-system.apiName.writeLocalFile': 'Write file',
'builtins.lobe-local-system.inspector.noResults': 'No results',
diff --git a/src/services/cloudSandbox.ts b/src/services/cloudSandbox.ts
index 3099763ffff..a855727f7ec 100644
--- a/src/services/cloudSandbox.ts
+++ b/src/services/cloudSandbox.ts
@@ -9,7 +9,7 @@ import {
class CloudSandboxService {
/**
* Call a cloud sandbox tool
- * @param toolName - The name of the tool to call (e.g., 'runCommand', 'writeLocalFile')
+ * @param toolName - The name of the tool to call (e.g., 'runCommand', 'writeFile')
* @param params - The parameters for the tool
* @param context - Session context containing topicId and optional userId for isolation
*/
diff --git a/src/store/chat/slices/aiChat/actions/__tests__/conversationLifecycle.test.ts b/src/store/chat/slices/aiChat/actions/__tests__/conversationLifecycle.test.ts
index 1479ec151c5..e967c92a0d2 100644
--- a/src/store/chat/slices/aiChat/actions/__tests__/conversationLifecycle.test.ts
+++ b/src/store/chat/slices/aiChat/actions/__tests__/conversationLifecycle.test.ts
@@ -916,7 +916,7 @@ describe('ConversationLifecycle actions', () => {
const payload = sendMessageInServerSpy.mock.calls[0]?.[0];
expect(payload?.newUserMessage.metadata?.localSystemToolSnapshots).toMatchObject([
{
- apiName: 'readLocalFile',
+ apiName: 'readFile',
arguments: { path: '/Users/me/project/foo.ts' },
content: expect.stringContaining('export const x = 1;'),
identifier: 'lobe-local-system',
@@ -992,7 +992,7 @@ describe('ConversationLifecycle actions', () => {
expect(runtimeUserMessage?.metadata?.localSystemToolSnapshots).toMatchObject([
{
- apiName: 'readLocalFile',
+ apiName: 'readFile',
arguments: { path: '/Users/me/project/foo.ts' },
content: expect.stringContaining('export const x = 1;'),
identifier: 'lobe-local-system',
diff --git a/src/store/chat/slices/aiChat/actions/localSystemToolSnapshots.ts b/src/store/chat/slices/aiChat/actions/localSystemToolSnapshots.ts
index 149f7945446..e46fcab08a2 100644
--- a/src/store/chat/slices/aiChat/actions/localSystemToolSnapshots.ts
+++ b/src/store/chat/slices/aiChat/actions/localSystemToolSnapshots.ts
@@ -1,3 +1,4 @@
+import { LocalSystemApiName, LocalSystemIdentifier } from '@lobechat/builtin-tool-local-system';
import type { ListLocalFilesResult, LocalReadFileResult } from '@lobechat/electron-client-ipc';
import { formatFileContent, formatFileList } from '@lobechat/prompts';
import type { LocalSystemToolSnapshot } from '@lobechat/types';
@@ -7,9 +8,6 @@ import { localFileService } from '@/services/electron/localFileService';
import type { ParsedLocalFileReference } from './commandBus/parseCommands';
-const LOCAL_SYSTEM_IDENTIFIER = 'lobe-local-system';
-const READ_LOCAL_FILE = 'readLocalFile';
-const LIST_LOCAL_FILES = 'listLocalFiles';
const DEFAULT_DIRECTORY_LIMIT = 100;
const createSnapshotId = () => `local-system-snapshot-${nanoid()}`;
@@ -52,11 +50,11 @@ const createReadSnapshot = async (
};
return {
- apiName: READ_LOCAL_FILE,
+ apiName: LocalSystemApiName.readFile,
arguments: args,
capturedAt,
content,
- identifier: LOCAL_SYSTEM_IDENTIFIER,
+ identifier: LocalSystemIdentifier,
result: normalizeReadResult(result),
snapshotId,
state,
@@ -67,12 +65,12 @@ const createReadSnapshot = async (
const message = error instanceof Error ? error.message : String(error);
return {
- apiName: READ_LOCAL_FILE,
+ apiName: LocalSystemApiName.readFile,
arguments: args,
capturedAt,
content: message,
error: { message, type: 'LocalFileReadError' },
- identifier: LOCAL_SYSTEM_IDENTIFIER,
+ identifier: LocalSystemIdentifier,
snapshotId,
success: false,
toolCallId: createToolCallId(snapshotId),
@@ -104,11 +102,11 @@ const createListSnapshot = async (
});
return {
- apiName: LIST_LOCAL_FILES,
+ apiName: LocalSystemApiName.listFiles,
arguments: args,
capturedAt,
content,
- identifier: LOCAL_SYSTEM_IDENTIFIER,
+ identifier: LocalSystemIdentifier,
result: normalizeListResult(result),
snapshotId,
state: normalizeListResult(result),
@@ -119,12 +117,12 @@ const createListSnapshot = async (
const message = error instanceof Error ? error.message : String(error);
return {
- apiName: LIST_LOCAL_FILES,
+ apiName: LocalSystemApiName.listFiles,
arguments: args,
capturedAt,
content: message,
error: { message, type: 'LocalDirectoryListError' },
- identifier: LOCAL_SYSTEM_IDENTIFIER,
+ identifier: LocalSystemIdentifier,
snapshotId,
success: false,
toolCallId: createToolCallId(snapshotId),