|
Entropic 2.14.3
Local-first agentic inference engine
|
Tracks file read state for read-before-write enforcement. More...
#include <entropic/mcp/servers/filesystem.h>
Public Member Functions | |
| void | record_read (const std::string &session, const std::string &path, size_t hash) |
Record that session read a file. | |
| bool | was_read (const std::string &session, const std::string &path) const |
Check whether session has read a file. | |
| bool | release_session (const std::string &session) |
Forget every read session recorded (gh#158). | |
| std::size_t | session_count () const |
| Sessions currently holding recorded reads. | |
Tracks file read state for read-before-write enforcement.
gh#158 (v2.13.0), two passes. First LOCKED: one FilesystemServer serves every unbound session on a handle, and concurrent_sessions defaults true, so read_file and write_file / edit_file reached one map from several run threads at once. Then re-scoped PER SESSION: a shared map let session B overwrite a file only session A had read. Reads are now recorded and consulted under the calling session's key, and released with that session's conversation (release_session).
Definition at line 42 of file filesystem.h.
| void entropic::FileAccessTracker::record_read | ( | const std::string & | session, |
| const std::string & | path, | ||
| size_t | hash | ||
| ) |
Record that session read a file.
Record that a session read a file, with its content hash.
| session | Session key the read belongs to ("" = default). |
| path | Canonical file path. |
| hash | Content hash at time of read. @threadsafety Safe from any thread (gh#158). |
The tracker is what makes read-before-write enforceable: write_file and edit_file refuse an existing file with no recorded read.
gh#158 (v2.13.0): recorded under the READING session's key, so the read unlocks that session's writes and nobody else's; the map is locked because concurrent sessions record from several run threads.
| session | Session key the read belongs to. |
| path | Canonical file path. |
| hash | Content hash at time of read. @req REQ-MCP-021 @req REQ-LOOP-009 |
Definition at line 56 of file filesystem.cpp.
Forget every read session recorded (gh#158).
Forget every read a session recorded (gh#158).
| session | Session key. |
Called when the session's conversation ends — the model no longer holds the content it read, so a later write must read again.
| session | Session key. |
Definition at line 98 of file filesystem.cpp.
| std::size_t entropic::FileAccessTracker::session_count | ( | ) | const |
Sessions currently holding recorded reads.
Sessions currently holding recorded reads (gh#158).
Definition at line 108 of file filesystem.cpp.
| bool entropic::FileAccessTracker::was_read | ( | const std::string & | session, |
| const std::string & | path | ||
| ) | const |
Check whether session has read a file.
Check whether a session has read a file.
| session | Session key asking. |
| path | Canonical file path. |
path. @threadsafety Safe from any thread (gh#158). gh#158 (v2.13.0): consults ONLY session's reads. A lookup never creates an entry, so asking on behalf of a session that read nothing does not grow the map.
| session | Session key asking. |
| path | Canonical file path. |
Definition at line 79 of file filesystem.cpp.