Skip to main content

Module fs

Module fs 

Source
Expand description

Filesystem backend abstraction.

FsBackend is the trait boundary between the fs tool family (read_file / write_file / edit_file) and the underlying I/O. Two implementations:

  • defect_tools::fs::LocalFsBackend: writes directly to disk
  • defect_acp::fs::AcpFsBackend: delegates to the client via ACP fs/read_text_file / fs/write_text_file reverse requests

Assembly is handled in the defect-acp session/new handler — the backend is selected based on the client’s FileSystemCapabilities negotiation result and injected into crate::session::AgentCore::create_session.

Structs§

Fingerprint
A fingerprint of file content. Used with FsBackend::fingerprint and Fingerprint::of: edit_file records the fingerprint after reading, and takes it again before writing; a mismatch indicates a concurrent write conflict.
NoopFsBackend
A no-op fs backend for testing only. All methods return FsError::NotPermitted, allowing test scenarios that require Arc<dyn FsBackend> (without actually running fs tools) to skip setup.

Enums§

FsError
Fs backend error.

Traits§

FsBackend
Fs backend trait.

Functions§

resolve_workspace_path
Resolves a request path to an absolute path within the workspace, verifying it does not escape.