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

Write tool constructors: write, edit, multi_edit, mkdir, move, copy, delete (wraps saferm), and set_executable -- all enforcing write-scope containment, with write/edit routed through write-safety's queue and stale-write tracker.

#tool.src.orxtra.tool._write_tools

#tool.src.orxtra.tool._write_tools

File write tool constructors for the orxtra tool module.

#_path_error_to_tool_error

python
def _path_error_to_tool_error(exc: PathError) -> ToolError

Convert a PathError to a ToolError.

#_resolve_path

python
def _resolve_path(raw_path: str, root: Path) -> Path

Resolve a path, converting PathError to ToolError.

#_check_scope

python
def _check_scope(resolved: Path, scope: list[Path] | None, root: Path) -> None

Check write scope, converting PathError to ToolError.

#make_write_tool

python
def make_write_tool(read_root: Path, write_scope: list[Path] | None, queue: WriteQueue, tracker: StaleWriteTracker, session_id: str) -> Tool

Construct the file write tool.

Args:

  • read_root: Root directory for path containment.
  • write_scope: Allowed write paths, or None for unrestricted.
  • queue: Per-path write queue for serialization.
  • tracker: Stale-write detector.
  • session_id: The session performing writes.

#make_edit_tool

python
def make_edit_tool(read_root: Path, write_scope: list[Path] | None, queue: WriteQueue, tracker: StaleWriteTracker, session_id: str) -> Tool

Construct the find-and-replace edit tool.

Args:

  • read_root: Root directory for path containment.
  • write_scope: Allowed write paths, or None for unrestricted.
  • queue: Per-path write queue for serialization.
  • tracker: Stale-write detector.
  • session_id: The session performing writes.

#make_multi_edit_tool

python
def make_multi_edit_tool(read_root: Path, write_scope: list[Path] | None, queue: WriteQueue, tracker: StaleWriteTracker, session_id: str) -> Tool

Construct the multi-edit tool for batched find-and-replace edits.

Applies edits sequentially. If any edit fails, the result reports which edits succeeded and which failed (no atomic rollback).

Args:

  • read_root: Root directory for path containment.
  • write_scope: Allowed write paths, or None for unrestricted.
  • queue: Per-path write queue for serialization.
  • tracker: Stale-write detector.
  • session_id: The session performing writes.

#make_mkdir_tool

python
def make_mkdir_tool(read_root: Path, write_scope: list[Path] | None) -> Tool

Construct the mkdir tool.

Args:

  • read_root: Root directory for path containment.
  • write_scope: Allowed write paths, or None for unrestricted.

#make_move_tool

python
def make_move_tool(read_root: Path, write_scope: list[Path] | None, queue: WriteQueue, tracker: StaleWriteTracker, session_id: str) -> Tool

Construct the move/rename tool.

Args:

  • read_root: Root directory for path containment.
  • write_scope: Allowed write paths, or None for unrestricted.
  • queue: Per-path write queue for serialization.
  • tracker: Stale-write detector.
  • session_id: The session performing writes.

#make_copy_tool

python
def make_copy_tool(read_root: Path, write_scope: list[Path] | None, queue: WriteQueue, tracker: StaleWriteTracker, session_id: str) -> Tool

Construct the file copy tool.

Args:

  • read_root: Root directory for path containment.
  • write_scope: Allowed write paths, or None for unrestricted.
  • queue: Per-path write queue for serialization.
  • tracker: Stale-write detector.
  • session_id: The session performing writes.

#make_delete_tool

python
def make_delete_tool(read_root: Path, write_scope: list[Path] | None) -> Tool

Construct the delete tool (wraps saferm).

Args:

  • read_root: Root directory for path containment.
  • write_scope: Allowed write paths, or None for unrestricted.

#make_set_executable_tool

python
def make_set_executable_tool(read_root: Path, write_scope: list[Path] | None) -> Tool

Construct the set-executable tool.

Args:

  • read_root: Root directory for path containment.
  • write_scope: Allowed write paths, or None for unrestricted.
Search