mirror of
https://github.com/agent0ai/agent-zero.git
synced 2026-12-04 17:38:45 +00:00
Add Host workspace controls to Agent Settings > Workdir. Inherit the current container workdir's four tree limits by default, or persist independent remote limits when inheritance is disabled. Validate non-negative whole numbers and preserve zero as unlimited without changing host access permissions. Include effective remote_tree_config in connector hello and tree acknowledgements so updated CLI and Launcher gateway sessions refresh their maps without reconnecting. Older connectors remain compatible. Document the settings and protocol behavior and add inheritance and validation coverage. Verification: 109 focused Core tests passed; desktop/mobile UI, Save/Cancel, persistence, and live gateway refresh checks passed. The full Core suite was not run.
14 lines
543 B
Python
14 lines
543 B
Python
"""Instance-owned limits for connected host workspace trees."""
|
|
|
|
|
|
def build_remote_tree_config() -> dict[str, int]:
|
|
from helpers import settings
|
|
|
|
config = settings.get_settings()
|
|
prefix = "workdir" if config.get("remote_tree_inherit", True) else "remote_tree"
|
|
limits = {}
|
|
for key, default in (("max_depth", 5), ("max_files", 20), ("max_folders", 20), ("max_lines", 250)):
|
|
value = config.get(f"{prefix}_{key}", default)
|
|
limits[key] = value if type(value) is int and value >= 0 else default
|
|
return limits
|