Skip to content

feat(sdk): add includeEntry option to filesystem watch#1385

Open
mishushakov wants to merge 2 commits into
mainfrom
mishushakov/client-side-infra-pr-2930
Open

feat(sdk): add includeEntry option to filesystem watch#1385
mishushakov wants to merge 2 commits into
mainfrom
mishushakov/client-side-infra-pr-2930

Conversation

@mishushakov
Copy link
Copy Markdown
Member

Client-side counterpart to e2b-dev/infra#2930: adds an includeEntry/include_entry option to filesystem directory watching across the JS and Python (sync + async) SDKs, so each FilesystemEvent can carry the affected entry's EntryInfo (best-effort — unset for remove/rename-away events where the path no longer exists). This regenerates the filesystem proto code from the updated spec, threads the flag through watchDir/watch_dir (streaming WatchDir and polling CreateWatcher), maps the new entry field onto the event, and extracts a shared entry-mapping helper reused by list/getInfo/rename. The option degrades gracefully: older sandboxes (< envd 0.6.2) ignore it and leave entry unset, so there's no hard version gate. Includes new watch tests for all three SDKs and a minor-bump changeset for e2b and @e2b/python-sdk.

Note: the entry-info tests require envd 0.6.2 (shipped by the infra PR), so this should land with/after that deploy.

Usage

JavaScript

const handle = await sandbox.files.watchDir(
  'my-dir',
  (event) => {
    console.log(event.type, event.name, event.entry?.path, event.entry?.type)
  },
  { includeEntry: true }
)

Python (async)

def on_event(e):
    print(e.type, e.name, e.entry.path if e.entry else None)

handle = await sandbox.files.watch_dir("my-dir", on_event=on_event, include_entry=True)

Python (sync)

handle = sandbox.files.watch_dir("my-dir", include_entry=True)
for e in handle.get_new_events():
    print(e.type, e.name, e.entry.path if e.entry else None)

🤖 Generated with Claude Code

Mirror infra PR e2b-dev/infra#2930 on the client: add an
includeEntry/include_entry option to directory watching across the JS
and Python (sync + async) SDKs. When enabled, each FilesystemEvent
carries the affected entry's EntryInfo (best-effort; unset for
remove/rename-away events). Regenerated the filesystem proto code and
added tests plus a changeset.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@cla-bot cla-bot Bot added the cla-signed label Jun 4, 2026
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Jun 4, 2026

🦋 Changeset detected

Latest commit: 551fc36

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@e2b/python-sdk Minor
e2b Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@cursor
Copy link
Copy Markdown

cursor Bot commented Jun 4, 2026

PR Summary

Low Risk
Additive, backward-compatible API and proto fields with graceful degradation on older envd; main coupling is deploying alongside envd 0.6.2 for entry-info tests and full behavior.

Overview
Adds includeEntry / include_entry to directory watch APIs in the JS and Python SDKs (streaming watchDir and polling CreateWatcher), so FilesystemEvent can optionally include EntryInfo for the affected path (best-effort; omitted when the entry cannot be stat’d, e.g. remove/rename-away).

The filesystem proto and generated bindings gain include_entry on watch requests and an optional entry on events; watch handlers map that field onto public event types. A shared mapEntryInfo / map_entry_info helper also replaces duplicated mapping in list, getInfo, and rename.

Documented behavior: full entry metadata needs envd 0.6.2+; older sandboxes ignore the flag and leave entry unset. New watch tests cover JS, Python sync, and async; changeset bumps e2b and @e2b/python-sdk as minor.

Reviewed by Cursor Bugbot for commit 551fc36. Bugbot is set up for automated code reviews on this repo. Configure here.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 4, 2026

Package Artifacts

Built from abfdc28. Download artifacts from this workflow run.

JS SDK (e2b@2.27.2-mishushakov-client-side-infra-pr-2930.0):

npm install ./e2b-2.27.2-mishushakov-client-side-infra-pr-2930.0.tgz

CLI (@e2b/cli@2.10.4-mishushakov-client-side-infra-pr-2930.0):

npm install ./e2b-cli-2.10.4-mishushakov-client-side-infra-pr-2930.0.tgz

Python SDK (e2b==2.25.1+mishushakov-client-side-infra-pr-2930):

pip install ./e2b-2.25.1+mishushakov.client.side.infra.pr.2930-py3-none-any.whl

@mishushakov mishushakov marked this pull request as ready for review June 4, 2026 19:16
Comment thread packages/python-sdk/e2b/sandbox_async/filesystem/filesystem.py
The lone remaining inline EntryInfo construction; brings the async
get_info call site in line with the other list/get_info/rename sites
across the JS and Python SDKs.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant