orxtra v0.13.0 /tool.src.orxtra.tool._write_integration
On this page

Bridges tool writes to write-safety: safe_write locks the per-path queue, checks for stale writes, performs the atomic write, and records the new hash; safe_read_for_write does the matching locked read for edit's read-modify-write.

#tool.src.orxtra.tool._write_integration

#tool.src.orxtra.tool._write_integration

#safe_write

python
async def safe_write(path: Path, content: str | bytes, queue: WriteQueue, tracker: StaleWriteTracker, session_id: str, *, is_new_file: bool) -> None

Lock, stale check, atomic write, release.

Args:

  • path: Target file path.
  • content: Content to write.
  • queue: Per-path write queue for serialization.
  • tracker: Stale-write detector.
  • session_id: The session performing the write.
  • is_new_file: If True, skip stale-write detection (file doesn't exist yet).

#safe_read_for_write

python
async def safe_read_for_write(path: Path, queue: WriteQueue, tracker: StaleWriteTracker, session_id: str) -> str

Lock, read, record hash, release. For edit's read-modify-write.

Args:

  • path: File path to read.
  • queue: Per-path write queue for serialization.
  • tracker: Stale-write detector.
  • session_id: The session performing the read.

Returns:

  • The file contents as a string.
Search