Filesystem watch (Phase 2): streaming WatchDir - #3
Open
col wants to merge 7 commits into
Open
Conversation
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds live directory watching to
E2bEx.Filesystemvia the envd streamingWatchDirRPC — message-first, likeCommands.start/PTY.E2bEx.Filesystem.watch_dir/4→{:ok, %WatchHandle{}}, pushing{ref, {:fs_event, %E2bEx.FilesystemEvent{}}}to a subscriber as changes happen; ends with a terminal{ref, {:error, %E2bEx.Error{}}}if the stream fails or closes.E2bEx.FilesystemEvent—{name, type (:create|:write|:remove|:rename|:chmod), entry}(the%EntryInfo{}is included wheninclude_entry: true).E2bEx.Filesystem.WatchHandle—stop/1ends the watch (no terminal message), cancelling the stream.E2bEx.Filesystem.WatchServer— internal streaming GenServer, modeled onCommands.HandleServer. The key difference:WatchDirframes are a bareWatchDirResponseoneof (start/filesystem/keepalive), not wrapped in an"event"field; and watch has no result, so a closed stream is terminal{:error, …}.opts:
:recursive,:include_entry,:subscriber, plus the usual:user/:timeout_ms/:domain/:port/:base_url.Notes
feat/filesystem(PR Filesystem Phase 1: file operations + content #2, Phase 1). Once Filesystem Phase 1: file operations + content #2 merges tomain, this rebases ontomain. Phase 1 code is untouched here — onlywatch_dir/4/spawn_watch/3were added tofilesystem.ex.HandleServeris a deliberate, documented choice (deferred unification) to avoid touching the shipped Commands/PTY path.CreateWatcher/GetWatcherEvents/RemoveWatcher).Spec:
docs/superpowers/specs/2026-06-13-e2b-filesystem-watch-design.md· Plan:docs/superpowers/plans/2026-06-13-e2b-filesystem-watch.mdTest Plan
mix test— 163 tests, 0 failuresmix compile --warnings-as-errorscleanFilesystemEvent.from_api/1(all event types + nested entry);WatchHandle.stop/1(live + dead);watch_dir/4streaming (chunked incremental decode, entry present/absent, keepalive-ignored, defaults, pre-start non-2xx error, mid-stream trailer error, post-start truncated-frame malformed,stop/1no-terminal)🤖 Generated with Claude Code