Skip to content

armgit / E2B

Public Imported from GitHub
0

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

Fix versions to match updated envd version

Jakub Novak359d17d0c4a0
diff --git a/packages/js-sdk/src/envd/versions.ts b/packages/js-sdk/src/envd/versions.ts
new file mode 100644
index 000000000..86da44065
--- /dev/null
+++ b/packages/js-sdk/src/envd/versions.ts
@@ -0,0 +1 @@
+export const ENVD_VERSION_RECURSIVE_WATCH = '0.1.4'
\ No newline at end of file
diff --git a/packages/js-sdk/src/sandbox/filesystem/index.ts b/packages/js-sdk/src/sandbox/filesystem/index.ts
index 5536a2447..02a3c4416 100644
--- a/packages/js-sdk/src/sandbox/filesystem/index.ts
+++ b/packages/js-sdk/src/sandbox/filesystem/index.ts
@@ -24,6 +24,7 @@ import { WatchHandle, FilesystemEvent } from './watchHandle'
import { compareVersions } from 'compare-versions'
import { TemplateError } from '../../errors'
+import {ENVD_VERSION_RECURSIVE_WATCH} from '../../envd/versions'
/**
* Sandbox filesystem object information.
@@ -442,7 +443,7 @@ export class Filesystem {
onEvent: (event: FilesystemEvent) => void | Promise<void>,
opts?: WatchOpts
): Promise<WatchHandle> {
- if (opts?.recursive && this.envdApi.version && compareVersions(this.envdApi.version, '0.1.3') < 0) {
+ if (opts?.recursive && this.envdApi.version && compareVersions(this.envdApi.version, ENVD_VERSION_RECURSIVE_WATCH) < 0) {
throw new TemplateError(
'You need to update the template to use recursive watching. ' +
'You can do this by running `e2b template build` in the directory with the template.'
diff --git a/packages/python-sdk/e2b/envd/versions.py b/packages/python-sdk/e2b/envd/versions.py
new file mode 100644
index 000000000..74d15a7c7
--- /dev/null
+++ b/packages/python-sdk/e2b/envd/versions.py
@@ -0,0 +1,3 @@
+from packaging.version import Version
+
+ENVD_VERSION_RECURSIVE_WATCH = Version("0.1.4")
diff --git a/packages/python-sdk/e2b/sandbox_async/filesystem/filesystem.py b/packages/python-sdk/e2b/sandbox_async/filesystem/filesystem.py
index 7210b99bc..f2d4f6076 100644
--- a/packages/python-sdk/e2b/sandbox_async/filesystem/filesystem.py
+++ b/packages/python-sdk/e2b/sandbox_async/filesystem/filesystem.py
@@ -14,6 +14,7 @@ from e2b.connection_config import (
from e2b.envd.api import ENVD_API_FILES_ROUTE, ahandle_envd_api_exception
from e2b.envd.filesystem import filesystem_connect, filesystem_pb2
from e2b.envd.rpc import authentication_header, handle_rpc_exception
+from e2b.envd.versions import ENVD_VERSION_RECURSIVE_WATCH
from e2b.exceptions import SandboxException, TemplateException
from e2b.sandbox.filesystem.filesystem import EntryInfo, map_file_type
from e2b.sandbox.filesystem.watch_handle import FilesystemEvent
@@ -361,7 +362,11 @@ class Filesystem:
:return: `AsyncWatchHandle` object for stopping watching directory
"""
- if recursive and self._envd_version is not None and Version(self._envd_version) < Version("0.1.3"):
+ if (
+ recursive
+ and self._envd_version is not None
+ and Version(self._envd_version) < ENVD_VERSION_RECURSIVE_WATCH
+ ):
raise TemplateException(
"You need to update the template to use recursive watching. "
"You can do this by running `e2b template build` in the directory with the template."
diff --git a/packages/python-sdk/e2b/sandbox_sync/filesystem/filesystem.py b/packages/python-sdk/e2b/sandbox_sync/filesystem/filesystem.py
index 5945226ae..7f979ec16 100644
--- a/packages/python-sdk/e2b/sandbox_sync/filesystem/filesystem.py
+++ b/packages/python-sdk/e2b/sandbox_sync/filesystem/filesystem.py
@@ -6,6 +6,7 @@ import httpcore
import httpx
from packaging.version import Version
+from e2b.envd.versions import ENVD_VERSION_RECURSIVE_WATCH
from e2b.exceptions import TemplateException
from e2b.connection_config import (
ConnectionConfig,
@@ -353,7 +354,11 @@ class Filesystem:
:return: `WatchHandle` object for stopping watching directory
"""
- if recursive and self._envd_version is not None and Version(self._envd_version) < Version("0.1.3"):
+ if (
+ recursive
+ and self._envd_version is not None
+ and Version(self._envd_version) < ENVD_VERSION_RECURSIVE_WATCH
+ ):
raise TemplateException(
"You need to update the template to use recursive watching. "
"You can do this by running `e2b template build` in the directory with the template."