Skip to content

armgit / E2B

Public Imported from GitHub
0

Open-source, secure environment with real-world tools for enterprise-grade agents.

Fix naming; Add rename to python

Tomas Valenta335116c51f29
diff --git a/packages/js-sdk/src/sandbox/filesystem/index.ts b/packages/js-sdk/src/sandbox/filesystem/index.ts
index 3c72fe506..b17ef12b3 100644
--- a/packages/js-sdk/src/sandbox/filesystem/index.ts
+++ b/packages/js-sdk/src/sandbox/filesystem/index.ts
@@ -235,13 +235,13 @@ export class Filesystem {
}
}
- async move(from: string, to: string, opts?: FilesystemRequestOpts): Promise<boolean> {
+ async rename(oldPath: string, newPath: string, opts?: FilesystemRequestOpts): Promise<boolean> {
const username = opts?.user || defaultUsername
try {
await this.rpc.move({
- source: from,
- destination: to,
+ source: oldPath,
+ destination: newPath,
user: {
selector: {
case: 'username',
diff --git a/packages/js-sdk/src/sandbox/filesystem/watchHandle.ts b/packages/js-sdk/src/sandbox/filesystem/watchHandle.ts
index eced2acdd..66a451209 100644
--- a/packages/js-sdk/src/sandbox/filesystem/watchHandle.ts
+++ b/packages/js-sdk/src/sandbox/filesystem/watchHandle.ts
@@ -2,7 +2,6 @@ import { ConnectError, Code } from '@connectrpc/connect'
import { FilesystemError } from '.'
import { TimeoutError } from '../../connectionConfig'
-
import {
EventType,
WatchDirResponse,
diff --git a/packages/python-sdk/e2b/sandbox/filesystem/filesystem.py b/packages/python-sdk/e2b/sandbox/filesystem/filesystem.py
index 6d71c5d4f..e37b1a802 100644
--- a/packages/python-sdk/e2b/sandbox/filesystem/filesystem.py
+++ b/packages/python-sdk/e2b/sandbox/filesystem/filesystem.py
@@ -144,6 +144,22 @@ class Filesystem:
timeout=self._connection_config.get_request_timeout(request_timeout),
)
+ def rename(
+ self,
+ old_path: str,
+ new_path: str,
+ user: Username = "user",
+ request_timeout: Optional[float] = None,
+ ) -> None:
+ self._rpc.move(
+ filesystem_pb2.MoveRequest(
+ source=old_path,
+ destination=new_path,
+ user=User(username=user),
+ ),
+ timeout=self._connection_config.get_request_timeout(request_timeout),
+ )
+
def make_dir(
self,
path: str,