feat(policy): add per-channel channelPolicies with hot-reload list mode/lists

This commit is contained in:
2026-02-26 00:23:47 +00:00
parent 6d463a4572
commit d6f908b813
7 changed files with 68 additions and 6 deletions

View File

@@ -17,6 +17,7 @@ NO_REPLY_API_KEY="${NO_REPLY_API_KEY:-wg-local-test-token}"
LIST_MODE="${LIST_MODE:-human-list}"
HUMAN_LIST_JSON="${HUMAN_LIST_JSON:-[\"561921120408698910\",\"1474088632750047324\"]}"
AGENT_LIST_JSON="${AGENT_LIST_JSON:-[]}"
CHANNEL_POLICIES_JSON="${CHANNEL_POLICIES_JSON:-{}}"
END_SYMBOLS_JSON="${END_SYMBOLS_JSON:-[\"🔚\"]}"
STATE_DIR="${STATE_DIR:-$HOME/.openclaw/whispergate-install-records}"
@@ -138,7 +139,7 @@ PY
current_plugins_json='{}'
fi
new_plugins_json="$(CURRENT_PLUGINS_JSON="$current_plugins_json" PLUGIN_PATH="$PLUGIN_PATH" LIST_MODE="$LIST_MODE" HUMAN_LIST_JSON="$HUMAN_LIST_JSON" AGENT_LIST_JSON="$AGENT_LIST_JSON" END_SYMBOLS_JSON="$END_SYMBOLS_JSON" NO_REPLY_PROVIDER_ID="$NO_REPLY_PROVIDER_ID" NO_REPLY_MODEL_ID="$NO_REPLY_MODEL_ID" python3 - <<'PY'
new_plugins_json="$(CURRENT_PLUGINS_JSON="$current_plugins_json" PLUGIN_PATH="$PLUGIN_PATH" LIST_MODE="$LIST_MODE" HUMAN_LIST_JSON="$HUMAN_LIST_JSON" AGENT_LIST_JSON="$AGENT_LIST_JSON" CHANNEL_POLICIES_JSON="$CHANNEL_POLICIES_JSON" END_SYMBOLS_JSON="$END_SYMBOLS_JSON" NO_REPLY_PROVIDER_ID="$NO_REPLY_PROVIDER_ID" NO_REPLY_MODEL_ID="$NO_REPLY_MODEL_ID" python3 - <<'PY'
import json, os
plugins=json.loads(os.environ['CURRENT_PLUGINS_JSON'])
if not isinstance(plugins,dict):
@@ -162,6 +163,7 @@ entries['whispergate']={
'listMode': os.environ['LIST_MODE'],
'humanList': json.loads(os.environ['HUMAN_LIST_JSON']),
'agentList': json.loads(os.environ['AGENT_LIST_JSON']),
'channelPolicies': json.loads(os.environ['CHANNEL_POLICIES_JSON']),
'endSymbols': json.loads(os.environ['END_SYMBOLS_JSON']),
'noReplyProvider': os.environ['NO_REPLY_PROVIDER_ID'],
'noReplyModel': os.environ['NO_REPLY_MODEL_ID'],