Class: Nexo::Tools::Glob
- Inherits:
-
RubyLLM::Tool
- Object
- RubyLLM::Tool
- Nexo::Tools::Glob
- Defined in:
- lib/nexo/tools/glob.rb
Overview
Lists workspace files matching a glob pattern. Authorizes :glob first;
a denial is returned as { error: ... }.
Instance Method Summary collapse
-
#execute(pattern:) ⇒ Object
Authorizes
:glob, then returns{ files: [...] }matchingpattern— or{ error: ... }on a denial. -
#initialize(sandbox:, permissions:) ⇒ Glob
constructor
sandboxperforms the match;permissionsgates the:globcapability.
Constructor Details
#initialize(sandbox:, permissions:) ⇒ Glob
sandbox performs the match; permissions gates the :glob capability.
12 13 14 15 16 |
# File 'lib/nexo/tools/glob.rb', line 12 def initialize(sandbox:, permissions:) @sandbox = sandbox @permissions = super() end |
Instance Method Details
#execute(pattern:) ⇒ Object
Authorizes :glob, then returns { files: [...] } matching pattern —
or { error: ... } on a denial.
20 21 22 23 24 25 |
# File 'lib/nexo/tools/glob.rb', line 20 def execute(pattern:) @permissions.(:glob, pattern) {files: @sandbox.glob(pattern)} rescue Permissions::Denied => e {error: e.} end |