Entropic 2.3.8
Local-first agentic inference engine
Loading...
Searching...
No Matches
entropic::ScopedSandbox Class Reference

RAII directory swapper for sandbox-scoped tool execution. More...

#include <entropic/core/sandbox.h>

Public Types

using SwapDirFn = void(*)(const std::filesystem::path &path, void *user_data)
 Callback type for directory swapping.
 

Public Member Functions

 ScopedSandbox (SwapDirFn swap_fn, void *user_data, const std::filesystem::path &sandbox_path, const std::filesystem::path &original_path)
 Construct and swap directories.
 
 ~ScopedSandbox ()
 Restore the original directory.
 
 ScopedSandbox (const ScopedSandbox &)=delete
 
ScopedSandboxoperator= (const ScopedSandbox &)=delete
 

Detailed Description

RAII directory swapper for sandbox-scoped tool execution.

Swaps the engine's tool working directory to the sandbox path on construction and restores it on destruction. Used by DelegationManager to route MCP server (filesystem, bash, …) calls into the sandbox during a delegation.

Version
2.1.5

Definition at line 285 of file sandbox.h.

Member Typedef Documentation

◆ SwapDirFn

using entropic::ScopedSandbox::SwapDirFn = void (*)( const std::filesystem::path& path, void* user_data)

Callback type for directory swapping.

The facade implements this to iterate registered servers and call entropic_mcp_server_set_working_dir() on each.

Parameters
pathNew working directory.
user_dataOpaque pointer (facade context).
Version
2.1.5

Definition at line 297 of file sandbox.h.

Constructor & Destructor Documentation

◆ ScopedSandbox()

entropic::ScopedSandbox::ScopedSandbox ( SwapDirFn  swap_fn,
void *  user_data,
const std::filesystem::path &  sandbox_path,
const std::filesystem::path &  original_path 
)

Construct and swap directories.

Parameters
swap_fnDirectory swap callback (may be null — no-op).
user_dataOpaque pointer for swap_fn.
sandbox_pathTarget sandbox directory.
original_pathOriginal directory to restore on destruction.
Version
2.1.5
Parameters
swap_fnDirectory swap callback.
user_dataOpaque pointer for swap_fn.
sandbox_pathTarget sandbox directory.
original_pathOriginal directory to restore.

Definition at line 614 of file sandbox.cpp.

◆ ~ScopedSandbox()

entropic::ScopedSandbox::~ScopedSandbox ( )

Restore the original directory.

Version
2.1.5

Definition at line 634 of file sandbox.cpp.


The documentation for this class was generated from the following files: