Class: LittleGhost::Tools::Filesystem

Inherits:
Object
  • Object
show all
Defined in:
lib/little_ghost/tools/filesystem.rb

Overview

Filesystem gives an agent read, list, write, and replace tools backed by the application's Sandbox. A read-only sandbox automatically exposes only the non-mutating tools.

binding = LittleGhost::Tool::Binding.new(sandbox: sandbox)
registry = LittleGhost::ToolRegistry.new(
[LittleGhost::Tools::Filesystem], binding: binding
)
registry.names # => ["read_file", "list_files"]

Security and trust

These tools do not add isolation. The configured sandbox must enforce path containment, permissions, size limits, and cancellation.

Direct Known Subclasses

Exclusive

Defined Under Namespace

Classes: Exclusive, ExclusiveListFiles, ExclusiveReadFile, ExclusiveReplaceInFile, ExclusiveWriteFile, ListFiles, ReadFile, ReplaceInFile, WriteFile

Class Method Summary collapse

Class Method Details

.tools(binding) ⇒ Object

Provides read tools for every sandbox and mutation tools only when the sandbox is writable.



96
97
98
# File 'lib/little_ghost/tools/filesystem.rb', line 96

def tools(binding)
  [*read_tools, *(write_tools if binding.sandbox.writable?)]
end