Files
agent-zero/plugins/_a0_connector/helpers/remote_tree.py
Alessandro Frau 2b0b3a416d Add host workspace tree settings with container inheritance
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.
2026-11-17 15:28:13 +01:00

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