MCPcopy Create free account
hub / github.com/agentforce314/clawcodex / file_read_status

Method file_read_status

src/tool_system/context.py:258–278  ·  view source on GitHub ↗

Return the read status of a file for write/edit staleness checks. Returns one of: - ``"not_read"`` -- no prior read recorded - ``"partial"`` -- file was read with offset/limit (partial view) - ``"modified"`` -- file changed on disk since last read - ``"ok"``

(self, path: Path)

Source from the content-addressed store, hash-verified

256 return (mtime, size) == (int(stat.st_mtime), int(stat.st_size))
257
258 def file_read_status(self, path: Path) -> str:
259 """Return the read status of a file for write/edit staleness checks.
260
261 Returns one of:
262 - ``"not_read"`` -- no prior read recorded
263 - ``"partial"`` -- file was read with offset/limit (partial view)
264 - ``"modified"`` -- file changed on disk since last read
265 - ``"ok"`` -- file was fully read and unchanged
266 """
267 resolved = path.resolve()
268 fingerprint = self.read_file_fingerprints.get(resolved)
269 if fingerprint is None:
270 return "not_read"
271 mtime, size = fingerprint[0], fingerprint[1]
272 is_partial = fingerprint[2] if len(fingerprint) > 2 else False
273 if is_partial:
274 return "partial"
275 stat = resolved.stat()
276 if (mtime, size) != (int(stat.st_mtime), int(stat.st_size)):
277 return "modified"
278 return "ok"
279
280 def allowed_roots(self) -> tuple[Path, ...]:
281 roots: list[Path] = [self.workspace_root]

Callers 1

_validate_inputFunction · 0.80

Calls 1

getMethod · 0.45

Tested by

no test coverage detected