Open-source, secure environment with real-world tools for enterprise-grade agents.
Python agentaiai-agentai-agentscode-interpretercopilotdevelopmentdevtoolsgptgpt-4javascriptllmnextjsopenaipythonreactsoftwaretypescript
feat(sdk): add allowNetworkMounts option to filesystem watch (#1420)
Mish Ushakove873ee94b6b5
diff --git a/.changeset/watch-allow-network-mounts.md b/.changeset/watch-allow-network-mounts.mdnew file mode 100644index 000000000..f2dcd593e--- /dev/null+++ b/.changeset/watch-allow-network-mounts.md@@ -0,0 +1,6 @@+---+"@e2b/python-sdk": minor+"e2b": minor+---++Add an `allowNetworkMounts`/`allow_network_mounts` option to filesystem directory watching. When enabled, paths on network filesystem mounts (NFS, CIFS, SMB, FUSE) can be watched — they are rejected by default because events on network mounts may be unreliable or not delivered at all. Requires envd 0.6.4 or later; watching with this option against an older sandbox raises a template error.diff --git a/packages/js-sdk/src/envd/filesystem/filesystem_pb.ts b/packages/js-sdk/src/envd/filesystem/filesystem_pb.tsindex 1c3bfd94a..c78f752d0 100644--- a/packages/js-sdk/src/envd/filesystem/filesystem_pb.ts+++ b/packages/js-sdk/src/envd/filesystem/filesystem_pb.ts@@ -24,7 +24,7 @@ import type { Message } from '@bufbuild/protobuf'export const file_filesystem_filesystem: GenFile =/*@__PURE__*/fileDesc(- 'ChtmaWxlc3lzdGVtL2ZpbGVzeXN0ZW0ucHJvdG8SCmZpbGVzeXN0ZW0iMgoLTW92ZVJlcXVlc3QSDgoGc291cmNlGAEgASgJEhMKC2Rlc3RpbmF0aW9uGAIgASgJIjQKDE1vdmVSZXNwb25zZRIkCgVlbnRyeRgBIAEoCzIVLmZpbGVzeXN0ZW0uRW50cnlJbmZvIh4KDk1ha2VEaXJSZXF1ZXN0EgwKBHBhdGgYASABKAkiNwoPTWFrZURpclJlc3BvbnNlEiQKBWVudHJ5GAEgASgLMhUuZmlsZXN5c3RlbS5FbnRyeUluZm8iHQoNUmVtb3ZlUmVxdWVzdBIMCgRwYXRoGAEgASgJIhAKDlJlbW92ZVJlc3BvbnNl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0uR2V0V2F0Y2hlckV2ZW50c1Jlc3BvbnNlElQKDVJlbW92ZVdhdGNoZXISIC5maWxlc3lzdGVtLlJlbW92ZVdhdGNoZXJSZXF1ZXN0GiEuZmlsZXN5c3RlbS5SZW1vdmVXYXRjaGVyUmVzcG9uc2VCaQoOY29tLmZpbGVzeXN0ZW1CD0ZpbGVzeXN0ZW1Qcm90b1ABogIDRlhYqgIKRmlsZXN5c3RlbcoCCkZpbGVzeXN0ZW3iAhZGaWxlc3lzdGVtXEdQQk1ldGFkYXRh6gIKRmlsZXN5c3RlbWIGcHJvdG8z',[file_google_protobuf_timestamp])@@ -307,6 +307,14 @@ export type WatchDirRequest = Message<'filesystem.WatchDirRequest'> & {* @generated from field: bool include_entry = 3;*/includeEntry: boolean++ /**+ * If true, allows watching paths on network filesystem mounts (NFS, CIFS, SMB, FUSE).+ * Events on network mounts may be unreliable or not delivered at all.+ *+ * @generated from field: bool allow_network_mounts = 4;+ */+ allowNetworkMounts: boolean}/**@@ -438,6 +446,14 @@ export type CreateWatcherRequest =* @generated from field: bool include_entry = 3;*/includeEntry: boolean++ /**+ * If true, allows watching paths on network filesystem mounts (NFS, CIFS, SMB, FUSE).+ * Events on network mounts may be unreliable or not delivered at all.+ *+ * @generated from field: bool allow_network_mounts = 4;+ */+ allowNetworkMounts: boolean}/**diff --git a/packages/js-sdk/src/envd/versions.ts b/packages/js-sdk/src/envd/versions.tsindex deba77431..61434e612 100644--- a/packages/js-sdk/src/envd/versions.ts+++ b/packages/js-sdk/src/envd/versions.ts@@ -6,3 +6,4 @@ export const ENVD_ENVD_CLOSE = '0.5.2'export const ENVD_OCTET_STREAM_UPLOAD = '0.5.7'export const ENVD_FILE_METADATA = '0.6.2'export const ENVD_VERSION_FS_EVENT_ENTRY_INFO = '0.6.3'+export const ENVD_VERSION_WATCH_NETWORK_MOUNTS = '0.6.4'diff --git a/packages/js-sdk/src/sandbox/filesystem/index.ts b/packages/js-sdk/src/sandbox/filesystem/index.tsindex d6dd5f895..e63e9ce3b 100644--- a/packages/js-sdk/src/sandbox/filesystem/index.ts+++ b/packages/js-sdk/src/sandbox/filesystem/index.ts@@ -35,6 +35,7 @@ import {ENVD_OCTET_STREAM_UPLOAD,ENVD_VERSION_FS_EVENT_ENTRY_INFO,ENVD_VERSION_RECURSIVE_WATCH,+ ENVD_VERSION_WATCH_NETWORK_MOUNTS,} from '../../envd/versions'import {FileNotFoundError,@@ -311,6 +312,15 @@ export interface WatchOpts extends FilesystemRequestOpts {* throws a `TemplateError`.*/includeEntry?: boolean+ /**+ * Allow watching paths on network filesystem mounts (NFS, CIFS, SMB, FUSE),+ * which are rejected by default. Events on network mounts may be unreliable+ * or not delivered at all.+ *+ * Requires envd 0.6.4 or later. Watching with this option against an older sandbox+ * throws a `TemplateError`.+ */+ allowNetworkMounts?: boolean}/**@@ -909,6 +919,17 @@ export class Filesystem {)}+ if (+ opts?.allowNetworkMounts &&+ this.envdApi.version &&+ compareVersions(this.envdApi.version, ENVD_VERSION_WATCH_NETWORK_MOUNTS) <+ 0+ ) {+ throw new TemplateError(+ 'You need to update the template to watch directories on network mounts.'+ )+ }+const requestTimeoutMs =opts?.requestTimeoutMs ?? this.connectionConfig.requestTimeoutMs@@ -922,6 +943,7 @@ export class Filesystem {path,recursive: opts?.recursive ?? this.defaultWatchRecursive,includeEntry: opts?.includeEntry ?? false,+ allowNetworkMounts: opts?.allowNetworkMounts ?? false,},{headers: {diff --git a/packages/js-sdk/tests/sandbox/files/watch.test.ts b/packages/js-sdk/tests/sandbox/files/watch.test.tsindex 725124222..850d4a4a6 100644--- a/packages/js-sdk/tests/sandbox/files/watch.test.ts+++ b/packages/js-sdk/tests/sandbox/files/watch.test.ts@@ -177,6 +177,46 @@ sandboxTest('watch directory changes with entry info', async ({ sandbox }) => {await handle.stop()})+sandboxTest(+ 'watch directory changes with network mounts allowed',+ async ({ sandbox }) => {+ const dirname = 'test_watch_dir_network_mounts'+ const filename = 'test_watch.txt'+ const content = 'This file will be watched.'+ const newContent = 'This file has been modified.'++ await sandbox.files.makeDir(dirname)+ await sandbox.files.write(`${dirname}/${filename}`, content)++ let trigger: () => void++ const eventPromise = new Promise<void>((resolve) => {+ trigger = resolve+ })++ // The flag only lifts the network-mount restriction — watching a regular+ // directory must work the same with it enabled.+ const handle = await sandbox.files.watchDir(+ dirname,+ async (event) => {+ if (+ event.type === FilesystemEventType.WRITE &&+ event.name === filename+ ) {+ trigger()+ }+ },+ { allowNetworkMounts: true }+ )++ await sandbox.files.write(`${dirname}/${filename}`, newContent)++ await eventPromise++ await handle.stop()+ }+)+sandboxTest('watch non-existing directory', async ({ sandbox }) => {const dirname = 'non_existing_watch_dir'diff --git a/packages/python-sdk/e2b/envd/filesystem/filesystem_pb2.py b/packages/python-sdk/e2b/envd/filesystem/filesystem_pb2.pyindex 0f3a92712..f2a37967a 100644--- a/packages/python-sdk/e2b/envd/filesystem/filesystem_pb2.py+++ b/packages/python-sdk/e2b/envd/filesystem/filesystem_pb2.py@@ -15,7 +15,7 @@ _sym_db = _symbol_database.Default()from google.protobuf import timestamp_pb2 as google_dot_protobuf_dot_timestamp__pb2-DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1b\x66ilesystem/filesystem.proto\x12\nfilesystem\x1a\x1fgoogle/protobuf/timestamp.proto\"G\n\x0bMoveRequest\x12\x16\n\x06source\x18\x01 \x01(\tR\x06source\x12 \n\x0b\x64\x65stination\x18\x02 \x01(\tR\x0b\x64\x65stination\";\n\x0cMoveResponse\x12+\n\x05\x65ntry\x18\x01 \x01(\x0b\x32\x15.filesystem.EntryInfoR\x05\x65ntry\"$\n\x0eMakeDirRequest\x12\x12\n\x04path\x18\x01 \x01(\tR\x04path\">\n\x0fMakeDirResponse\x12+\n\x05\x65ntry\x18\x01 \x01(\x0b\x32\x15.filesystem.EntryInfoR\x05\x65ntry\"#\n\rRemoveRequest\x12\x12\n\x04path\x18\x01 \x01(\tR\x04path\"\x10\n\x0eRemoveResponse\"!\n\x0bStatRequest\x12\x12\n\x04path\x18\x01 \x01(\tR\x04path\";\n\x0cStatResponse\x12+\n\x05\x65ntry\x18\x01 \x01(\x0b\x32\x15.filesystem.EntryInfoR\x05\x65ntry\"\xd1\x03\n\tEntryInfo\x12\x12\n\x04name\x18\x01 \x01(\tR\x04name\x12(\n\x04type\x18\x02 \x01(\x0e\x32\x14.filesystem.FileTypeR\x04type\x12\x12\n\x04path\x18\x03 \x01(\tR\x04path\x12\x12\n\x04size\x18\x04 \x01(\x03R\x04size\x12\x12\n\x04mode\x18\x05 \x01(\rR\x04mode\x12 \n\x0bpermissions\x18\x06 \x01(\tR\x0bpermissions\x12\x14\n\x05owner\x18\x07 \x01(\tR\x05owner\x12\x14\n\x05group\x18\x08 \x01(\tR\x05group\x12?\n\rmodified_time\x18\t \x01(\x0b\x32\x1a.google.protobuf.TimestampR\x0cmodifiedTime\x12*\n\x0esymlink_target\x18\n \x01(\tH\x00R\rsymlinkTarget\x88\x01\x01\x12?\n\x08metadata\x18\x0b \x03(\x0b\x32#.filesystem.EntryInfo.MetadataEntryR\x08metadata\x1a;\n\rMetadataEntry\x12\x10\n\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n\x05value\x18\x02 \x01(\tR\x05value:\x02\x38\x01\x42\x11\n\x0f_symlink_target\":\n\x0eListDirRequest\x12\x12\n\x04path\x18\x01 \x01(\tR\x04path\x12\x14\n\x05\x64\x65pth\x18\x02 \x01(\rR\x05\x64\x65pth\"B\n\x0fListDirResponse\x12/\n\x07\x65ntries\x18\x01 \x03(\x0b\x32\x15.filesystem.EntryInfoR\x07\x65ntries\"h\n\x0fWatchDirRequest\x12\x12\n\x04path\x18\x01 \x01(\tR\x04path\x12\x1c\n\trecursive\x18\x02 \x01(\x08R\trecursive\x12#\n\rinclude_entry\x18\x03 \x01(\x08R\x0cincludeEntry\"\x8c\x01\n\x0f\x46ilesystemEvent\x12\x12\n\x04name\x18\x01 \x01(\tR\x04name\x12)\n\x04type\x18\x02 \x01(\x0e\x32\x15.filesystem.EventTypeR\x04type\x12\x30\n\x05\x65ntry\x18\x03 \x01(\x0b\x32\x15.filesystem.EntryInfoH\x00R\x05\x65ntry\x88\x01\x01\x42\x08\n\x06_entry\"\xfe\x01\n\x10WatchDirResponse\x12?\n\x05start\x18\x01 \x01(\x0b\x32\'.filesystem.WatchDirResponse.StartEventH\x00R\x05start\x12=\n\nfilesystem\x18\x02 \x01(\x0b\x32\x1b.filesystem.FilesystemEventH\x00R\nfilesystem\x12\x46\n\tkeepalive\x18\x03 \x01(\x0b\x32&.filesystem.WatchDirResponse.KeepAliveH\x00R\tkeepalive\x1a\x0c\n\nStartEvent\x1a\x0b\n\tKeepAliveB\x07\n\x05\x65vent\"m\n\x14\x43reateWatcherRequest\x12\x12\n\x04path\x18\x01 \x01(\tR\x04path\x12\x1c\n\trecursive\x18\x02 \x01(\x08R\trecursive\x12#\n\rinclude_entry\x18\x03 \x01(\x08R\x0cincludeEntry\"6\n\x15\x43reateWatcherResponse\x12\x1d\n\nwatcher_id\x18\x01 \x01(\tR\twatcherId\"8\n\x17GetWatcherEventsRequest\x12\x1d\n\nwatcher_id\x18\x01 \x01(\tR\twatcherId\"O\n\x18GetWatcherEventsResponse\x12\x33\n\x06\x65vents\x18\x01 \x03(\x0b\x32\x1b.filesystem.FilesystemEventR\x06\x65vents\"5\n\x14RemoveWatcherRequest\x12\x1d\n\nwatcher_id\x18\x01 \x01(\tR\twatcherId\"\x17\n\x15RemoveWatcherResponse*R\n\x08\x46ileType\x12\x19\n\x15\x46ILE_TYPE_UNSPECIFIED\x10\x00\x12\x12\n\x0e\x46ILE_TYPE_FILE\x10\x01\x12\x17\n\x13\x46ILE_TYPE_DIRECTORY\x10\x02*\x98\x01\n\tEventType\x12\x1a\n\x16\x45VENT_TYPE_UNSPECIFIED\x10\x00\x12\x15\n\x11\x45VENT_TYPE_CREATE\x10\x01\x12\x14\n\x10\x45VENT_TYPE_WRITE\x10\x02\x12\x15\n\x11\x45VENT_TYPE_REMOVE\x10\x03\x12\x15\n\x11\x45VENT_TYPE_RENAME\x10\x04\x12\x14\n\x10\x45VENT_TYPE_CHMOD\x10\x05\x32\x9f\x05\n\nFilesystem\x12\x39\n\x04Stat\x12\x17.filesystem.StatRequest\x1a\x18.filesystem.StatResponse\x12\x42\n\x07MakeDir\x12\x1a.filesystem.MakeDirRequest\x1a\x1b.filesystem.MakeDirResponse\x12\x39\n\x04Move\x12\x17.filesystem.MoveRequest\x1a\x18.filesystem.MoveResponse\x12\x42\n\x07ListDir\x12\x1a.filesystem.ListDirRequest\x1a\x1b.filesystem.ListDirResponse\x12?\n\x06Remove\x12\x19.filesystem.RemoveRequest\x1a\x1a.filesystem.RemoveResponse\x12G\n\x08WatchDir\x12\x1b.filesystem.WatchDirRequest\x1a\x1c.filesystem.WatchDirResponse0\x01\x12T\n\rCreateWatcher\x12 .filesystem.CreateWatcherRequest\x1a!.filesystem.CreateWatcherResponse\x12]\n\x10GetWatcherEvents\x12#.filesystem.GetWatcherEventsRequest\x1a$.filesystem.GetWatcherEventsResponse\x12T\n\rRemoveWatcher\x12 .filesystem.RemoveWatcherRequest\x1a!.filesystem.RemoveWatcherResponseBi\n\x0e\x63om.filesystemB\x0f\x46ilesystemProtoP\x01\xa2\x02\x03\x46XX\xaa\x02\nFilesystem\xca\x02\nFilesystem\xe2\x02\x16\x46ilesystem\\GPBMetadata\xea\x02\nFilesystemb\x06proto3')+DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1b\x66ilesystem/filesystem.proto\x12\nfilesystem\x1a\x1fgoogle/protobuf/timestamp.proto\"G\n\x0bMoveRequest\x12\x16\n\x06source\x18\x01 \x01(\tR\x06source\x12 \n\x0b\x64\x65stination\x18\x02 \x01(\tR\x0b\x64\x65stination\";\n\x0cMoveResponse\x12+\n\x05\x65ntry\x18\x01 \x01(\x0b\x32\x15.filesystem.EntryInfoR\x05\x65ntry\"$\n\x0eMakeDirRequest\x12\x12\n\x04path\x18\x01 \x01(\tR\x04path\">\n\x0fMakeDirResponse\x12+\n\x05\x65ntry\x18\x01 \x01(\x0b\x32\x15.filesystem.EntryInfoR\x05\x65ntry\"#\n\rRemoveRequest\x12\x12\n\x04path\x18\x01 \x01(\tR\x04path\"\x10\n\x0eRemoveResponse\"!\n\x0bStatRequest\x12\x12\n\x04path\x18\x01 \x01(\tR\x04path\";\n\x0cStatResponse\x12+\n\x05\x65ntry\x18\x01 \x01(\x0b\x32\x15.filesystem.EntryInfoR\x05\x65ntry\"\xd1\x03\n\tEntryInfo\x12\x12\n\x04name\x18\x01 \x01(\tR\x04name\x12(\n\x04type\x18\x02 \x01(\x0e\x32\x14.filesystem.FileTypeR\x04type\x12\x12\n\x04path\x18\x03 \x01(\tR\x04path\x12\x12\n\x04size\x18\x04 \x01(\x03R\x04size\x12\x12\n\x04mode\x18\x05 \x01(\rR\x04mode\x12 \n\x0bpermissions\x18\x06 \x01(\tR\x0bpermissions\x12\x14\n\x05owner\x18\x07 \x01(\tR\x05owner\x12\x14\n\x05group\x18\x08 \x01(\tR\x05group\x12?\n\rmodified_time\x18\t \x01(\x0b\x32\x1a.google.protobuf.TimestampR\x0cmodifiedTime\x12*\n\x0esymlink_target\x18\n \x01(\tH\x00R\rsymlinkTarget\x88\x01\x01\x12?\n\x08metadata\x18\x0b \x03(\x0b\x32#.filesystem.EntryInfo.MetadataEntryR\x08metadata\x1a;\n\rMetadataEntry\x12\x10\n\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n\x05value\x18\x02 \x01(\tR\x05value:\x02\x38\x01\x42\x11\n\x0f_symlink_target\":\n\x0eListDirRequest\x12\x12\n\x04path\x18\x01 \x01(\tR\x04path\x12\x14\n\x05\x64\x65pth\x18\x02 \x01(\rR\x05\x64\x65pth\"B\n\x0fListDirResponse\x12/\n\x07\x65ntries\x18\x01 \x03(\x0b\x32\x15.filesystem.EntryInfoR\x07\x65ntries\"\x9a\x01\n\x0fWatchDirRequest\x12\x12\n\x04path\x18\x01 \x01(\tR\x04path\x12\x1c\n\trecursive\x18\x02 \x01(\x08R\trecursive\x12#\n\rinclude_entry\x18\x03 \x01(\x08R\x0cincludeEntry\x12\x30\n\x14\x61llow_network_mounts\x18\x04 \x01(\x08R\x12\x61llowNetworkMounts\"\x8c\x01\n\x0f\x46ilesystemEvent\x12\x12\n\x04name\x18\x01 \x01(\tR\x04name\x12)\n\x04type\x18\x02 \x01(\x0e\x32\x15.filesystem.EventTypeR\x04type\x12\x30\n\x05\x65ntry\x18\x03 \x01(\x0b\x32\x15.filesystem.EntryInfoH\x00R\x05\x65ntry\x88\x01\x01\x42\x08\n\x06_entry\"\xfe\x01\n\x10WatchDirResponse\x12?\n\x05start\x18\x01 \x01(\x0b\x32\'.filesystem.WatchDirResponse.StartEventH\x00R\x05start\x12=\n\nfilesystem\x18\x02 \x01(\x0b\x32\x1b.filesystem.FilesystemEventH\x00R\nfilesystem\x12\x46\n\tkeepalive\x18\x03 \x01(\x0b\x32&.filesystem.WatchDirResponse.KeepAliveH\x00R\tkeepalive\x1a\x0c\n\nStartEvent\x1a\x0b\n\tKeepAliveB\x07\n\x05\x65vent\"\x9f\x01\n\x14\x43reateWatcherRequest\x12\x12\n\x04path\x18\x01 \x01(\tR\x04path\x12\x1c\n\trecursive\x18\x02 \x01(\x08R\trecursive\x12#\n\rinclude_entry\x18\x03 \x01(\x08R\x0cincludeEntry\x12\x30\n\x14\x61llow_network_mounts\x18\x04 \x01(\x08R\x12\x61llowNetworkMounts\"6\n\x15\x43reateWatcherResponse\x12\x1d\n\nwatcher_id\x18\x01 \x01(\tR\twatcherId\"8\n\x17GetWatcherEventsRequest\x12\x1d\n\nwatcher_id\x18\x01 \x01(\tR\twatcherId\"O\n\x18GetWatcherEventsResponse\x12\x33\n\x06\x65vents\x18\x01 \x03(\x0b\x32\x1b.filesystem.FilesystemEventR\x06\x65vents\"5\n\x14RemoveWatcherRequest\x12\x1d\n\nwatcher_id\x18\x01 \x01(\tR\twatcherId\"\x17\n\x15RemoveWatcherResponse*R\n\x08\x46ileType\x12\x19\n\x15\x46ILE_TYPE_UNSPECIFIED\x10\x00\x12\x12\n\x0e\x46ILE_TYPE_FILE\x10\x01\x12\x17\n\x13\x46ILE_TYPE_DIRECTORY\x10\x02*\x98\x01\n\tEventType\x12\x1a\n\x16\x45VENT_TYPE_UNSPECIFIED\x10\x00\x12\x15\n\x11\x45VENT_TYPE_CREATE\x10\x01\x12\x14\n\x10\x45VENT_TYPE_WRITE\x10\x02\x12\x15\n\x11\x45VENT_TYPE_REMOVE\x10\x03\x12\x15\n\x11\x45VENT_TYPE_RENAME\x10\x04\x12\x14\n\x10\x45VENT_TYPE_CHMOD\x10\x05\x32\x9f\x05\n\nFilesystem\x12\x39\n\x04Stat\x12\x17.filesystem.StatRequest\x1a\x18.filesystem.StatResponse\x12\x42\n\x07MakeDir\x12\x1a.filesystem.MakeDirRequest\x1a\x1b.filesystem.MakeDirResponse\x12\x39\n\x04Move\x12\x17.filesystem.MoveRequest\x1a\x18.filesystem.MoveResponse\x12\x42\n\x07ListDir\x12\x1a.filesystem.ListDirRequest\x1a\x1b.filesystem.ListDirResponse\x12?\n\x06Remove\x12\x19.filesystem.RemoveRequest\x1a\x1a.filesystem.RemoveResponse\x12G\n\x08WatchDir\x12\x1b.filesystem.WatchDirRequest\x1a\x1c.filesystem.WatchDirResponse0\x01\x12T\n\rCreateWatcher\x12 .filesystem.CreateWatcherRequest\x1a!.filesystem.CreateWatcherResponse\x12]\n\x10GetWatcherEvents\x12#.filesystem.GetWatcherEventsRequest\x1a$.filesystem.GetWatcherEventsResponse\x12T\n\rRemoveWatcher\x12 .filesystem.RemoveWatcherRequest\x1a!.filesystem.RemoveWatcherResponseBi\n\x0e\x63om.filesystemB\x0f\x46ilesystemProtoP\x01\xa2\x02\x03\x46XX\xaa\x02\nFilesystem\xca\x02\nFilesystem\xe2\x02\x16\x46ilesystem\\GPBMetadata\xea\x02\nFilesystemb\x06proto3')_globals = globals()_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)@@ -25,10 +25,10 @@ if not _descriptor._USE_C_DESCRIPTORS:_globals['DESCRIPTOR']._serialized_options = b'\n\016com.filesystemB\017FilesystemProtoP\001\242\002\003FXX\252\002\nFilesystem\312\002\nFilesystem\342\002\026Filesystem\\GPBMetadata\352\002\nFilesystem'_globals['_ENTRYINFO_METADATAENTRY']._loaded_options = None_globals['_ENTRYINFO_METADATAENTRY']._serialized_options = b'8\001'- _globals['_FILETYPE']._serialized_start=1951- _globals['_FILETYPE']._serialized_end=2033- _globals['_EVENTTYPE']._serialized_start=2036- _globals['_EVENTTYPE']._serialized_end=2188+ _globals['_FILETYPE']._serialized_start=2053+ _globals['_FILETYPE']._serialized_end=2135+ _globals['_EVENTTYPE']._serialized_start=2138+ _globals['_EVENTTYPE']._serialized_end=2290_globals['_MOVEREQUEST']._serialized_start=76_globals['_MOVEREQUEST']._serialized_end=147_globals['_MOVERESPONSE']._serialized_start=149@@ -53,28 +53,28 @@ if not _descriptor._USE_C_DESCRIPTORS:_globals['_LISTDIRREQUEST']._serialized_end=989_globals['_LISTDIRRESPONSE']._serialized_start=991_globals['_LISTDIRRESPONSE']._serialized_end=1057- _globals['_WATCHDIRREQUEST']._serialized_start=1059- _globals['_WATCHDIRREQUEST']._serialized_end=1163- _globals['_FILESYSTEMEVENT']._serialized_start=1166- _globals['_FILESYSTEMEVENT']._serialized_end=1306- _globals['_WATCHDIRRESPONSE']._serialized_start=1309- _globals['_WATCHDIRRESPONSE']._serialized_end=1563- _globals['_WATCHDIRRESPONSE_STARTEVENT']._serialized_start=1529- _globals['_WATCHDIRRESPONSE_STARTEVENT']._serialized_end=1541- _globals['_WATCHDIRRESPONSE_KEEPALIVE']._serialized_start=1543- _globals['_WATCHDIRRESPONSE_KEEPALIVE']._serialized_end=1554- _globals['_CREATEWATCHERREQUEST']._serialized_start=1565- _globals['_CREATEWATCHERREQUEST']._serialized_end=1674- _globals['_CREATEWATCHERRESPONSE']._serialized_start=1676- _globals['_CREATEWATCHERRESPONSE']._serialized_end=1730- _globals['_GETWATCHEREVENTSREQUEST']._serialized_start=1732- _globals['_GETWATCHEREVENTSREQUEST']._serialized_end=1788- _globals['_GETWATCHEREVENTSRESPONSE']._serialized_start=1790- _globals['_GETWATCHEREVENTSRESPONSE']._serialized_end=1869- _globals['_REMOVEWATCHERREQUEST']._serialized_start=1871- _globals['_REMOVEWATCHERREQUEST']._serialized_end=1924- _globals['_REMOVEWATCHERRESPONSE']._serialized_start=1926- _globals['_REMOVEWATCHERRESPONSE']._serialized_end=1949- _globals['_FILESYSTEM']._serialized_start=2191- _globals['_FILESYSTEM']._serialized_end=2862+ _globals['_WATCHDIRREQUEST']._serialized_start=1060+ _globals['_WATCHDIRREQUEST']._serialized_end=1214+ _globals['_FILESYSTEMEVENT']._serialized_start=1217+ _globals['_FILESYSTEMEVENT']._serialized_end=1357+ _globals['_WATCHDIRRESPONSE']._serialized_start=1360+ _globals['_WATCHDIRRESPONSE']._serialized_end=1614+ _globals['_WATCHDIRRESPONSE_STARTEVENT']._serialized_start=1580+ _globals['_WATCHDIRRESPONSE_STARTEVENT']._serialized_end=1592+ _globals['_WATCHDIRRESPONSE_KEEPALIVE']._serialized_start=1594+ _globals['_WATCHDIRRESPONSE_KEEPALIVE']._serialized_end=1605+ _globals['_CREATEWATCHERREQUEST']._serialized_start=1617+ _globals['_CREATEWATCHERREQUEST']._serialized_end=1776+ _globals['_CREATEWATCHERRESPONSE']._serialized_start=1778+ _globals['_CREATEWATCHERRESPONSE']._serialized_end=1832+ _globals['_GETWATCHEREVENTSREQUEST']._serialized_start=1834+ _globals['_GETWATCHEREVENTSREQUEST']._serialized_end=1890+ _globals['_GETWATCHEREVENTSRESPONSE']._serialized_start=1892+ _globals['_GETWATCHEREVENTSRESPONSE']._serialized_end=1971+ _globals['_REMOVEWATCHERREQUEST']._serialized_start=1973+ _globals['_REMOVEWATCHERREQUEST']._serialized_end=2026+ _globals['_REMOVEWATCHERRESPONSE']._serialized_start=2028+ _globals['_REMOVEWATCHERRESPONSE']._serialized_end=2051+ _globals['_FILESYSTEM']._serialized_start=2293+ _globals['_FILESYSTEM']._serialized_end=2964# @@protoc_insertion_point(module_scope)diff --git a/packages/python-sdk/e2b/envd/filesystem/filesystem_pb2.pyi b/packages/python-sdk/e2b/envd/filesystem/filesystem_pb2.pyiindex 1346ada82..73ede13a1 100644--- a/packages/python-sdk/e2b/envd/filesystem/filesystem_pb2.pyi+++ b/packages/python-sdk/e2b/envd/filesystem/filesystem_pb2.pyi@@ -168,18 +168,21 @@ class ListDirResponse(_message.Message):) -> None: ...class WatchDirRequest(_message.Message):- __slots__ = ("path", "recursive", "include_entry")+ __slots__ = ("path", "recursive", "include_entry", "allow_network_mounts")PATH_FIELD_NUMBER: _ClassVar[int]RECURSIVE_FIELD_NUMBER: _ClassVar[int]INCLUDE_ENTRY_FIELD_NUMBER: _ClassVar[int]+ ALLOW_NETWORK_MOUNTS_FIELD_NUMBER: _ClassVar[int]path: strrecursive: boolinclude_entry: bool+ allow_network_mounts: booldef __init__(self,path: _Optional[str] = ...,recursive: bool = ...,include_entry: bool = ...,+ allow_network_mounts: bool = ...,) -> None: ...class FilesystemEvent(_message.Message):@@ -221,18 +224,21 @@ class WatchDirResponse(_message.Message):) -> None: ...class CreateWatcherRequest(_message.Message):- __slots__ = ("path", "recursive", "include_entry")+ __slots__ = ("path", "recursive", "include_entry", "allow_network_mounts")PATH_FIELD_NUMBER: _ClassVar[int]RECURSIVE_FIELD_NUMBER: _ClassVar[int]INCLUDE_ENTRY_FIELD_NUMBER: _ClassVar[int]+ ALLOW_NETWORK_MOUNTS_FIELD_NUMBER: _ClassVar[int]path: strrecursive: boolinclude_entry: bool+ allow_network_mounts: booldef __init__(self,path: _Optional[str] = ...,recursive: bool = ...,include_entry: bool = ...,+ allow_network_mounts: bool = ...,) -> None: ...class CreateWatcherResponse(_message.Message):diff --git a/packages/python-sdk/e2b/envd/versions.py b/packages/python-sdk/e2b/envd/versions.pyindex 0827e99a3..2b4542ce2 100644--- a/packages/python-sdk/e2b/envd/versions.py+++ b/packages/python-sdk/e2b/envd/versions.py@@ -8,3 +8,4 @@ ENVD_ENVD_CLOSE = Version("0.5.2")ENVD_OCTET_STREAM_UPLOAD = Version("0.5.7")ENVD_FILE_METADATA = Version("0.6.2")ENVD_VERSION_FS_EVENT_ENTRY_INFO = Version("0.6.3")+ENVD_VERSION_WATCH_NETWORK_MOUNTS = Version("0.6.4")diff --git a/packages/python-sdk/e2b/sandbox_async/filesystem/filesystem.py b/packages/python-sdk/e2b/sandbox_async/filesystem/filesystem.pyindex be1b99397..6c88811b0 100644--- a/packages/python-sdk/e2b/sandbox_async/filesystem/filesystem.py+++ b/packages/python-sdk/e2b/sandbox_async/filesystem/filesystem.py@@ -23,6 +23,7 @@ from e2b.envd.versions import (ENVD_OCTET_STREAM_UPLOAD,ENVD_VERSION_FS_EVENT_ENTRY_INFO,ENVD_VERSION_RECURSIVE_WATCH,+ ENVD_VERSION_WATCH_NETWORK_MOUNTS,)from e2b.exceptions import (FileNotFoundException,@@ -554,6 +555,7 @@ class Filesystem:timeout: Optional[float] = 60,recursive: bool = False,include_entry: bool = False,+ allow_network_mounts: bool = False,) -> AsyncWatchHandle:"""Watch directory for filesystem events.@@ -566,6 +568,7 @@ class Filesystem::param timeout: Timeout for the watch operation in **seconds**. Using `0` will not limit the watch time:param recursive: Watch directory recursively:param include_entry: Include the `EntryInfo` of the affected entry in each event, when available. Requires envd 0.6.3 or later+ :param allow_network_mounts: Allow watching paths on network filesystem mounts (NFS, CIFS, SMB, FUSE), which are rejected by default. Events on network mounts may be unreliable or not delivered at all. Requires envd 0.6.4 or later:return: `AsyncWatchHandle` object for stopping watching directory"""@@ -579,9 +582,20 @@ class Filesystem:"You need to update the template to include entry info in watch events.")+ if (+ allow_network_mounts+ and self._envd_version < ENVD_VERSION_WATCH_NETWORK_MOUNTS+ ):+ raise TemplateException(+ "You need to update the template to watch directories on network mounts."+ )+events = self._rpc.awatch_dir(filesystem_pb2.WatchDirRequest(- path=path, recursive=recursive, include_entry=include_entry+ path=path,+ recursive=recursive,+ include_entry=include_entry,+ allow_network_mounts=allow_network_mounts,),request_timeout=self._connection_config.get_request_timeout(request_timeoutdiff --git a/packages/python-sdk/e2b/sandbox_sync/filesystem/filesystem.py b/packages/python-sdk/e2b/sandbox_sync/filesystem/filesystem.pyindex be4f13412..7a233c1f8 100644--- a/packages/python-sdk/e2b/sandbox_sync/filesystem/filesystem.py+++ b/packages/python-sdk/e2b/sandbox_sync/filesystem/filesystem.py@@ -24,6 +24,7 @@ from e2b.envd.versions import (ENVD_OCTET_STREAM_UPLOAD,ENVD_VERSION_FS_EVENT_ENTRY_INFO,ENVD_VERSION_RECURSIVE_WATCH,+ ENVD_VERSION_WATCH_NETWORK_MOUNTS,)from e2b.exceptions import (FileNotFoundException,@@ -565,6 +566,7 @@ class Filesystem:request_timeout: Optional[float] = None,recursive: bool = False,include_entry: bool = False,+ allow_network_mounts: bool = False,) -> WatchHandle:"""Watch directory for filesystem events.@@ -574,6 +576,7 @@ class Filesystem::param request_timeout: Timeout for the request in **seconds**:param recursive: Watch directory recursively:param include_entry: Include the `EntryInfo` of the affected entry in each event, when available. Requires envd 0.6.3 or later+ :param allow_network_mounts: Allow watching paths on network filesystem mounts (NFS, CIFS, SMB, FUSE), which are rejected by default. Events on network mounts may be unreliable or not delivered at all. Requires envd 0.6.4 or later:return: `WatchHandle` object for stopping watching directory"""@@ -587,10 +590,21 @@ class Filesystem:"You need to update the template to include entry info in watch events.")+ if (+ allow_network_mounts+ and self._envd_version < ENVD_VERSION_WATCH_NETWORK_MOUNTS+ ):+ raise TemplateException(+ "You need to update the template to watch directories on network mounts."+ )+try:r = self._rpc.create_watcher(filesystem_pb2.CreateWatcherRequest(- path=path, recursive=recursive, include_entry=include_entry+ path=path,+ recursive=recursive,+ include_entry=include_entry,+ allow_network_mounts=allow_network_mounts,),request_timeout=self._connection_config.get_request_timeout(request_timeoutdiff --git a/packages/python-sdk/tests/async/sandbox_async/files/test_watch.py b/packages/python-sdk/tests/async/sandbox_async/files/test_watch.pyindex bf2730a17..a55a9f462 100644--- a/packages/python-sdk/tests/async/sandbox_async/files/test_watch.py+++ b/packages/python-sdk/tests/async/sandbox_async/files/test_watch.py@@ -47,6 +47,36 @@ async def test_watch_directory_changes_with_entry_info(async_sandbox: AsyncSandbawait handle.stop()+async def test_watch_directory_changes_with_network_mounts_allowed(+ async_sandbox: AsyncSandbox,+):+ dirname = "test_watch_dir_network_mounts"+ filename = "test_watch.txt"+ content = "This file will be watched."+ new_content = "This file has been modified."++ await async_sandbox.files.make_dir(dirname)+ await async_sandbox.files.write(f"{dirname}/{filename}", content)++ event_triggered = Event()++ def handle_event(e: FilesystemEvent):+ if e.type == FilesystemEventType.WRITE and e.name == filename:+ event_triggered.set()++ # The flag only lifts the network-mount restriction — watching a regular+ # directory must work the same with it enabled.+ handle = await async_sandbox.files.watch_dir(+ dirname, on_event=handle_event, allow_network_mounts=True+ )++ await async_sandbox.files.write(f"{dirname}/{filename}", new_content)++ await event_triggered.wait()++ await handle.stop()++async def test_watch_directory_changes(async_sandbox: AsyncSandbox):dirname = "test_watch_dir"filename = "test_watch.txt"diff --git a/packages/python-sdk/tests/sync/sandbox_sync/files/test_watch.py b/packages/python-sdk/tests/sync/sandbox_sync/files/test_watch.pyindex 11900dac6..9159070fa 100644--- a/packages/python-sdk/tests/sync/sandbox_sync/files/test_watch.py+++ b/packages/python-sdk/tests/sync/sandbox_sync/files/test_watch.py@@ -40,6 +40,34 @@ def test_watch_directory_changes_with_entry_info(sandbox: Sandbox):handle.stop()+def test_watch_directory_changes_with_network_mounts_allowed(sandbox: Sandbox):+ dirname = "test_watch_dir_network_mounts"+ filename = "test_watch.txt"+ content = "This file will be watched."+ new_content = "This file has been modified."++ sandbox.files.make_dir(dirname)+ sandbox.files.write(f"{dirname}/{filename}", content)++ # The flag only lifts the network-mount restriction — watching a regular+ # directory must work the same with it enabled.+ handle = sandbox.files.watch_dir(dirname, allow_network_mounts=True)+ sandbox.files.write(f"{dirname}/{filename}", new_content)++ events = handle.get_new_events()+ write_event = None+ for event in events:+ if event.type == FilesystemEventType.WRITE and event.name == filename:+ write_event = event+ break++ assert write_event is not None, (+ f"Expected WRITE event for {filename}, but got events: {events}"+ )++ handle.stop()++def test_watch_directory_changes(sandbox: Sandbox):dirname = "test_watch_dir"filename = "test_watch.txt"diff --git a/spec/envd/filesystem/filesystem.proto b/spec/envd/filesystem/filesystem.protoindex ad9d18a57..e97b687da 100644--- a/spec/envd/filesystem/filesystem.proto+++ b/spec/envd/filesystem/filesystem.proto@@ -88,6 +88,9 @@ message WatchDirRequest {bool recursive = 2;// If true, each FilesystemEvent includes the EntryInfo of the affected entry, when available.bool include_entry = 3;+ // If true, allows watching paths on network filesystem mounts (NFS, CIFS, SMB, FUSE).+ // Events on network mounts may be unreliable or not delivered at all.+ bool allow_network_mounts = 4;}message FilesystemEvent {@@ -116,6 +119,9 @@ message CreateWatcherRequest {bool recursive = 2;// If true, each FilesystemEvent includes the EntryInfo of the affected entry, when available.bool include_entry = 3;+ // If true, allows watching paths on network filesystem mounts (NFS, CIFS, SMB, FUSE).+ // Events on network mounts may be unreliable or not delivered at all.+ bool allow_network_mounts = 4;}message CreateWatcherResponse {