67 std::filesystem::path
path;
172 const std::string& delegation_id,
173 std::optional<SandboxInfo>
chain_from = std::nullopt);
218 const std::string& delegation_id,
219 const std::string& patch);
261 bool ensure_base_snapshot();
275 bool snapshot_tree(
const std::filesystem::path& source,
276 const std::filesystem::path& target);
290 bool path_in_session_base(
const std::filesystem::path&
p)
const;
297 void safe_remove(
const std::filesystem::path&
p);
303 void prune_stale_sessions();
305 std::filesystem::path project_dir_;
306 std::string session_id_;
307 std::filesystem::path session_base_;
308 std::filesystem::path base_dir_;
309 bool base_ready_ =
false;
316 mutable std::mutex base_mutex_;
318 std::atomic<unsigned> id_seq_{0};
359 const std::string& session_key,
360 const std::filesystem::path& path,
377 std::string session_key,
393 std::string session_key_;
394 std::filesystem::path original_path_;
Create, finalize, and discard per-delegation filesystem sandboxes.
const std::filesystem::path & session_base() const
Get this session's sandbox base directory.
void discard_sandbox(const SandboxInfo &info)
Remove a sandbox directory.
std::string next_delegation_id(const std::string &prefix)
Mint a sandbox id that no sibling delegation can collide with.
std::optional< SandboxResult > finalize_sandbox(const SandboxInfo &info)
Produce the final patch artifact for a sandbox.
std::optional< SandboxInfo > create_sandbox(const std::string &delegation_id, std::optional< SandboxInfo > chain_from=std::nullopt)
Create a new delegation sandbox.
~SandboxManager()
Remove this session's sandbox tree.
std::optional< std::filesystem::path > write_pending_patch(const std::string &delegation_id, const std::string &patch)
Write a patch to the session's pending/ directory.
const std::filesystem::path & project_dir() const
Get the project directory this manager snapshots from.
RAII directory swapper for sandbox-scoped tool execution.
~ScopedSandbox()
Restore the original directory.
void(*)(const std::string &session_key, const std::filesystem::path &path, bool entering, void *user_data) SwapDirFn
Callback type for directory swapping.
Activate model on GPU (WARM → ACTIVE).
@ optional
optional: every escape asks the host's path approver
Identifies one delegation's sandbox directory.
std::filesystem::path base_dir
Snapshot used as this sandbox's starting state.
std::filesystem::path path
Sandbox directory (under session base)
std::string delegation_id
Short delegation id (e.g. "d1", "pipeline")
Final artifact emitted by a finalized sandbox.
std::filesystem::path head_dir
Final sandbox state.
std::vector< std::filesystem::path > files_touched
Relative paths that changed.
std::string patch
Unified diff text.
std::filesystem::path base_dir
Snapshot the diff is against.