mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-05-18 04:41:56 +00:00
feat(terminal,cli): docker_extra_args + display.timestamps
Two independent opt-in QoL toggles, both off by default. terminal.docker_extra_args: - List of extra flags appended verbatim to docker run after security defaults. Useful for adding capabilities (e.g. --cap-add SETUID) or other docker run options not exposed by existing config keys. - Non-string entries are logged and skipped. - Also available via TERMINAL_DOCKER_EXTRA_ARGS='[...]' env var. display.timestamps: - Appends [HH:MM] to user input bullet and the assistant response box header. Single hub in _format_submitted_user_message_preview() covers both single-line and multi-line user previews; assistant response label gets the timestamp at box-open time. Closes #1569 (timestamps). Co-authored-by: Mibayy <Mibayy@users.noreply.github.com>
This commit is contained in:
parent
228b7d27bd
commit
ebf2ea584a
5 changed files with 38 additions and 2 deletions
|
|
@ -300,6 +300,7 @@ class DockerEnvironment(BaseEnvironment):
|
|||
host_cwd: str = None,
|
||||
auto_mount_cwd: bool = False,
|
||||
run_as_host_user: bool = False,
|
||||
extra_args: list = None,
|
||||
):
|
||||
if cwd == "~":
|
||||
cwd = "/root"
|
||||
|
|
@ -476,6 +477,15 @@ class DockerEnvironment(BaseEnvironment):
|
|||
security_args = _build_security_args(run_as_host_user and bool(user_args))
|
||||
|
||||
logger.info(f"Docker volume_args: {volume_args}")
|
||||
# User-supplied extra docker run flags (docker_extra_args in config.yaml).
|
||||
# Appended last so they can override defaults if needed.
|
||||
validated_extra = []
|
||||
for arg in (extra_args or []):
|
||||
if not isinstance(arg, str):
|
||||
logger.warning("Ignoring non-string docker_extra_args entry: %r", arg)
|
||||
continue
|
||||
validated_extra.append(arg)
|
||||
|
||||
all_run_args = (
|
||||
security_args
|
||||
+ user_args
|
||||
|
|
@ -483,6 +493,7 @@ class DockerEnvironment(BaseEnvironment):
|
|||
+ resource_args
|
||||
+ volume_args
|
||||
+ env_args
|
||||
+ validated_extra
|
||||
)
|
||||
logger.info(f"Docker run_args: {all_run_args}")
|
||||
|
||||
|
|
|
|||
|
|
@ -1087,6 +1087,7 @@ def _get_env_config() -> Dict[str, Any]:
|
|||
"docker_volumes": _parse_env_var("TERMINAL_DOCKER_VOLUMES", "[]", json.loads, "valid JSON"),
|
||||
"docker_env": _parse_env_var("TERMINAL_DOCKER_ENV", "{}", json.loads, "valid JSON"),
|
||||
"docker_run_as_host_user": os.getenv("TERMINAL_DOCKER_RUN_AS_HOST_USER", "false").lower() in ("true", "1", "yes"),
|
||||
"docker_extra_args": _parse_env_var("TERMINAL_DOCKER_EXTRA_ARGS", "[]", json.loads, "valid JSON"),
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1129,6 +1130,7 @@ def _create_environment(env_type: str, image: str, cwd: str, timeout: int,
|
|||
volumes = cc.get("docker_volumes", [])
|
||||
docker_forward_env = cc.get("docker_forward_env", [])
|
||||
docker_env = cc.get("docker_env", {})
|
||||
docker_extra_args = cc.get("docker_extra_args", [])
|
||||
|
||||
if env_type == "local":
|
||||
return _LocalEnvironment(cwd=cwd, timeout=timeout)
|
||||
|
|
@ -1144,6 +1146,7 @@ def _create_environment(env_type: str, image: str, cwd: str, timeout: int,
|
|||
forward_env=docker_forward_env,
|
||||
env=docker_env,
|
||||
run_as_host_user=cc.get("docker_run_as_host_user", False),
|
||||
extra_args=docker_extra_args,
|
||||
)
|
||||
|
||||
elif env_type == "singularity":
|
||||
|
|
@ -1792,6 +1795,7 @@ def terminal_tool(
|
|||
"docker_forward_env": config.get("docker_forward_env", []),
|
||||
"docker_env": config.get("docker_env", {}),
|
||||
"docker_run_as_host_user": config.get("docker_run_as_host_user", False),
|
||||
"docker_extra_args": config.get("docker_extra_args", []),
|
||||
}
|
||||
|
||||
local_config = None
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue