mirror of
https://github.com/agentscope-ai/ReMe.git
synced 2026-11-27 23:58:47 +00:00
* Add sandboxed Python execution and home AutoBash plugin * Harden read-only shell commands and filesystem sandboxes * Group file sandbox backends in one package * Fix macOS file sandbox isolation and runtime access * Refine file sandbox limits and executor checks * Harden AutoBash policy and macOS sandbox supervision * fix(home): require ReMe release with file sandbox * refactor(home): simplify sandbox calls and redundant tests * fix(execution): bound output and clean up cancelled sandbox startup * fix(tests): mock Seatbelt platform requirements on Linux * fix(home): block Git help helpers and harden sandbox cleanup * Fix sandbox runtime links and subprocess cleanup * ci: cover Home plugin tests * test: wait for pipeline descendants to exit after cancellation * fix: align Home dependencies and preserve cleanup cancellation Require ReMe 0.4.2.1 and verify isolated Home wheel installation in package CI. Share cancellation-safe cleanup with thread calls, retain AnyIO cancellation semantics, and record Bubblewrap mount targets during argument construction.
18 lines
849 B
Python
18 lines
849 B
Python
"""Select a local file sandbox for supported operating systems."""
|
|
|
|
import sys
|
|
|
|
from .file_sandbox_backend import FileSandboxBackend
|
|
from .path_bubble_backend import PathBubbleBackend
|
|
from .path_seatbelt_backend import PathSeatbeltBackend
|
|
|
|
|
|
def create_file_sandbox_backend(*, memory_limit_mib: int | None = None, **kwargs) -> FileSandboxBackend:
|
|
"""Construct the platform backend; never silently execute without isolation."""
|
|
if sys.platform.startswith("linux"):
|
|
limit = 4096 if memory_limit_mib is None else memory_limit_mib
|
|
return PathBubbleBackend(memory_limit_mib=limit, **kwargs)
|
|
if sys.platform == "darwin":
|
|
limit = 0 if memory_limit_mib is None else memory_limit_mib
|
|
return PathSeatbeltBackend(memory_limit_mib=limit, **kwargs)
|
|
raise RuntimeError(f"No file sandbox backend for {sys.platform}")
|