Class: Insika::Sandbox::Env
- Inherits:
-
Object
- Object
- Insika::Sandbox::Env
- Defined in:
- lib/insika/sandbox.rb
Overview
The per-agent sandbox environment: composes an FS boundary with an exec
provider and the default limits. Delegates the boundary surface (resolve /
relative / inside?) and adds exec. Immutable, safely shared across turns.
Instance Attribute Summary collapse
-
#boundary ⇒ Object
readonly
Returns the value of attribute boundary.
-
#max_output ⇒ Object
readonly
Returns the value of attribute max_output.
-
#provider ⇒ Object
readonly
Returns the value of attribute provider.
-
#root ⇒ Object
readonly
Returns the value of attribute root.
-
#timeout ⇒ Object
readonly
Returns the value of attribute timeout.
Instance Method Summary collapse
-
#exec(command, timeout: @timeout, max_output: @max_output) ⇒ Object
--- command exec (via the provider) -> Result ---.
-
#initialize(boundary:, provider:, timeout:, max_output:) ⇒ Env
constructor
A new instance of Env.
- #inside?(abs) ⇒ Boolean
- #relative(abs) ⇒ Object
-
#resolve(path, for_write: false) ⇒ Object
--- FS boundary (host-side, always on) ---.
- #to_s ⇒ Object
Constructor Details
#initialize(boundary:, provider:, timeout:, max_output:) ⇒ Env
Returns a new instance of Env.
64 65 66 67 68 69 70 |
# File 'lib/insika/sandbox.rb', line 64 def initialize(boundary:, provider:, timeout:, max_output:) @boundary = boundary @provider = provider @root = boundary.root @timeout = timeout @max_output = max_output end |
Instance Attribute Details
#boundary ⇒ Object (readonly)
Returns the value of attribute boundary.
62 63 64 |
# File 'lib/insika/sandbox.rb', line 62 def boundary @boundary end |
#max_output ⇒ Object (readonly)
Returns the value of attribute max_output.
62 63 64 |
# File 'lib/insika/sandbox.rb', line 62 def max_output @max_output end |
#provider ⇒ Object (readonly)
Returns the value of attribute provider.
62 63 64 |
# File 'lib/insika/sandbox.rb', line 62 def provider @provider end |
#root ⇒ Object (readonly)
Returns the value of attribute root.
62 63 64 |
# File 'lib/insika/sandbox.rb', line 62 def root @root end |
#timeout ⇒ Object (readonly)
Returns the value of attribute timeout.
62 63 64 |
# File 'lib/insika/sandbox.rb', line 62 def timeout @timeout end |
Instance Method Details
#exec(command, timeout: @timeout, max_output: @max_output) ⇒ Object
--- command exec (via the provider) -> Result ---
78 79 80 |
# File 'lib/insika/sandbox.rb', line 78 def exec(command, timeout: @timeout, max_output: @max_output) @provider.exec(command, root: @root, timeout: timeout, max_output: max_output) end |
#inside?(abs) ⇒ Boolean
74 |
# File 'lib/insika/sandbox.rb', line 74 def inside?(abs) = @boundary.inside?(abs) |
#relative(abs) ⇒ Object
75 |
# File 'lib/insika/sandbox.rb', line 75 def relative(abs) = @boundary.relative(abs) |
#resolve(path, for_write: false) ⇒ Object
--- FS boundary (host-side, always on) ---
73 |
# File 'lib/insika/sandbox.rb', line 73 def resolve(path, for_write: false) = @boundary.resolve(path, for_write: for_write) |
#to_s ⇒ Object
82 |
# File 'lib/insika/sandbox.rb', line 82 def to_s = "Sandbox(#{@provider}, root=#{@root})" |