fix: preserve internal tool write scopes
Maintainer edit: keep capability-specific allowed_dir boundaries active even when the outer workspace scope is full access, and cover Dream plus ordinary full-access filesystem behavior.
This commit is contained in:
@@ -101,15 +101,13 @@ class _FsTool(Tool):
|
||||
return current_file_states(self._fallback_file_states)
|
||||
|
||||
def _effective_allowed_root(self, access_allowed_root: Path | None) -> Path | None:
|
||||
if access_allowed_root is None:
|
||||
return None
|
||||
if self._allowed_dir is None or self._workspace is None:
|
||||
return access_allowed_root
|
||||
try:
|
||||
allowed_dir = Path(self._allowed_dir).expanduser().resolve(strict=False)
|
||||
workspace = Path(self._workspace).expanduser().resolve(strict=False)
|
||||
except (OSError, RuntimeError, TypeError, ValueError):
|
||||
return access_allowed_root
|
||||
return access_allowed_root if access_allowed_root is not None else self._allowed_dir
|
||||
if allowed_dir == workspace:
|
||||
return access_allowed_root
|
||||
return allowed_dir
|
||||
|
||||
Reference in New Issue
Block a user