refactor: route FileSystem through Effect's R channel - #16
Open
K-Mistele wants to merge 1 commit into
Open
Conversation
Replace the eager mutable singleton in DefaultFileSystem.ts with Effect's standard service mechanism. FileSystem.FileSystem is now a session-level service provided by NodeServices.layer at the CLI composition root, and a ToolHandlerServices member available to every tool handler. - Add FileSystem.FileSystem to ToolHandlerServices and the tool runtime's layer graph (ToolRuntimeLayer, Provisioning, StartSession) - Add FileSystem.FileSystem to SessionProvisioningServices so it flows through the session graph to every provisioned runtime - Convert all fold-agent tool handlers (read, write, edit, apply_patch, bash) to yield FileSystem from R instead of calling fileSystemFor() - Convert all fold-agent config/session/catalog/skills/memory/output modules to yield FileSystem from R - Convert fold-xai and fold-codex auth stores from mutable singletons to Effect-returning constructors - Delete the DefaultFileSystem singleton, fileSystemFor, and FsToolOptions (only cwdFor remains) - Update all tests to provide NodeFileSystem.layer or test FileSystem layers via Effect.provide Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> HumanLayer-Session: https://app.dev.codelayer.gg/sessions/01a0179a-5c6f-7ab7-8e1e-92b5a54ffad3
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
DefaultFileSystem.tswith Effect's standard service mechanismFileSystem.FileSystemis now aToolHandlerServicesmember (alongsideToolState,ToolEvents,Subagents, etc.) and aSessionProvisioningServicesmemberyield* FileSystem.FileSysteminstead of callingfileSystemFor(options)fold-xai,fold-codex) returnEffect<AuthStore>instead of using duplicated mutable singletonsfileSystemFor,FsToolOptions, anddefaultNodeFileSystemare all deleted — onlycwdForremainsNodeFileSystem.layeror testFileSystemlayers viaEffect.provide, matching the pattern used forClock,Random,Ids, andCryptoThis is the consistency cleanup raised during PR #9:
Clock,Random,Ids, andCryptoall flow through Effect's R channel, butFileSystemwas the last holdout using an eager singleton. Now all runtime capabilities use the same mechanism.Test plan
bun run typecheck— 0 errorsbun run lint— 0 errorsbun run test— all 692 tests pass across all packages🤖 Generated with Claude Code