Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions cli-config.yaml.example
Original file line number Diff line number Diff line change
Expand Up @@ -1401,6 +1401,14 @@ platform_toolsets:
# reactions: true # Show processing reactions (default: true)
# history_backfill: true # Recover missed channel messages on mention (default: true)
# history_backfill_limit: 50 # Max messages to scan backwards (default: 50)
#
# Mattermost-specific settings (config.yaml top-level, not under platforms:):
#
# mattermost:
# require_mention: true # Require @mention in server channels (default: true)
# reply_mode: "off" # "thread" to nest replies under the root post
# free_response_channels: "" # Channel IDs where no mention is needed
# thread_context: on # Seed prior thread posts on first turn (on/off; default: on)

# ─────────────────────────────────────────────────────────────────────────────
# Available toolsets (use these names in platform_toolsets or the toolsets list)
Expand Down
13 changes: 12 additions & 1 deletion gateway/platforms/_shared.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,12 +177,23 @@ def send_error(message: Any) -> dict:

# kind -> (applies-when predicate over (cfg, key), env encoder). "lower"/"json" bridge whenever the key
# is present (YAML ``none`` still writes "none"); "str" skips null/blank, "csv" skips null and leaves
# lists to the setter's comma join.
# lists to the setter's comma join; "onoff" coerces a boolean-ish value to canonical "on"/"off".
_ONOFF_OFF_TOKENS = {"off", "false", "0", "no", "none", ""}


def _encode_onoff(value: Any) -> str:
if value is None:
return "on"
token = str(value).strip().lower()
return "off" if token in _ONOFF_OFF_TOKENS else "on"


_YAML_KINDS: dict[str, tuple[Callable[[dict, str], bool], Callable[[Any], Any]]] = {
"lower": (lambda cfg, key: key in cfg, lambda v: str(v).lower()),
"str": (lambda cfg, key: cfg.get(key) not in (None, ""), str),
"csv": (lambda cfg, key: cfg.get(key) is not None, lambda v: v),
"json": (lambda cfg, key: key in cfg, json.dumps),
"onoff": (lambda cfg, key: key in cfg, _encode_onoff),
}


Expand Down
4 changes: 4 additions & 0 deletions hermes_cli/config_defaults.py
Original file line number Diff line number Diff line change
Expand Up @@ -2824,6 +2824,10 @@ def _base_url(name, prompt_name=None):
"MATTERMOST_FREE_RESPONSE_CHANNELS": _msg(
"Comma-separated Mattermost channel IDs where bot responds without @mention",
"Free-response channel IDs (comma-separated)", None),
"MATTERMOST_THREAD_CONTEXT": _msg(
"Seed prior thread posts into context on the first turn the bot is drawn into an "
"existing thread: on (default) or off.",
"Seed thread history on first turn (on/off)", None),
"MATRIX_HOMESERVER": _msg("Matrix homeserver URL (e.g. https://matrix.example.org)",
"Matrix homeserver URL", "https://matrix.org/ecosystem/servers/"),
"MATRIX_ACCESS_TOKEN": _msg("Matrix access token (preferred over password login)",
Expand Down
Loading