somratpro commited on
Commit
df6be22
Β·
1 Parent(s): 316749c

feat: conditionally configure logging and restrict enabled plugins when running on Hugging Face Spaces

Browse files
Files changed (1) hide show
  1. start.sh +25 -6
start.sh CHANGED
@@ -14,12 +14,17 @@ OPENCLAW_RUNTIME_VERSION=""
14
  WHATSAPP_ENABLED="${WHATSAPP_ENABLED:-false}"
15
  WHATSAPP_ENABLED_NORMALIZED=$(printf '%s' "$WHATSAPP_ENABLED" | tr '[:upper:]' '[:lower:]')
16
  SYNC_INTERVAL="${SYNC_INTERVAL:-180}"
17
- OPENCLAW_CONSOLE_LOG_LEVEL="${OPENCLAW_CONSOLE_LOG_LEVEL:-warn}"
18
- OPENCLAW_FILE_LOG_LEVEL="${OPENCLAW_FILE_LOG_LEVEL:-info}"
19
- OPENCLAW_CONSOLE_LOG_STYLE="${OPENCLAW_CONSOLE_LOG_STYLE:-compact}"
20
-
21
- # HF Spaces does not benefit from Bonjour discovery, and the retries add noise.
22
- export OPENCLAW_DISABLE_BONJOUR="${OPENCLAW_DISABLE_BONJOUR:-1}"
 
 
 
 
 
23
  echo ""
24
  echo " ╔══════════════════════════════════════════╗"
25
  echo " β•‘ 🦞 HuggingClaw Gateway β•‘"
@@ -261,6 +266,20 @@ if [ -n "$BROWSER_EXECUTABLE_PATH" ] && [ -x "$BROWSER_EXECUTABLE_PATH" ]; then
261
  BROWSER_SHOULD_ENABLE=true
262
  fi
263
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
264
  if [ "$BROWSER_SHOULD_ENABLE" = "true" ]; then
265
  CONFIG_JSON=$(echo "$CONFIG_JSON" | jq \
266
  ".browser = {
 
14
  WHATSAPP_ENABLED="${WHATSAPP_ENABLED:-false}"
15
  WHATSAPP_ENABLED_NORMALIZED=$(printf '%s' "$WHATSAPP_ENABLED" | tr '[:upper:]' '[:lower:]')
16
  SYNC_INTERVAL="${SYNC_INTERVAL:-180}"
17
+ if [ -n "${SPACE_HOST:-}" ]; then
18
+ OPENCLAW_CONSOLE_LOG_LEVEL="${OPENCLAW_CONSOLE_LOG_LEVEL:-warn}"
19
+ OPENCLAW_FILE_LOG_LEVEL="${OPENCLAW_FILE_LOG_LEVEL:-info}"
20
+ OPENCLAW_CONSOLE_LOG_STYLE="${OPENCLAW_CONSOLE_LOG_STYLE:-compact}"
21
+ # HF Spaces does not benefit from Bonjour discovery, and the retries add noise.
22
+ export OPENCLAW_DISABLE_BONJOUR="${OPENCLAW_DISABLE_BONJOUR:-1}"
23
+ else
24
+ OPENCLAW_CONSOLE_LOG_LEVEL="${OPENCLAW_CONSOLE_LOG_LEVEL:-info}"
25
+ OPENCLAW_FILE_LOG_LEVEL="${OPENCLAW_FILE_LOG_LEVEL:-info}"
26
+ OPENCLAW_CONSOLE_LOG_STYLE="${OPENCLAW_CONSOLE_LOG_STYLE:-pretty}"
27
+ fi
28
  echo ""
29
  echo " ╔══════════════════════════════════════════╗"
30
  echo " β•‘ 🦞 HuggingClaw Gateway β•‘"
 
266
  BROWSER_SHOULD_ENABLE=true
267
  fi
268
 
269
+ # Restrict bundled plugin loading on HF Spaces so unrelated broken plugins do not crash the gateway after startup.
270
+ PLUGIN_ALLOW_JSON='["acpx","device-pair","phone-control","talk-voice"]'
271
+ if [ "$BROWSER_SHOULD_ENABLE" = "true" ]; then
272
+ PLUGIN_ALLOW_JSON=$(jq '. + ["browser"]' <<<"$PLUGIN_ALLOW_JSON")
273
+ fi
274
+ if [ -n "${TELEGRAM_BOT_TOKEN:-}" ]; then
275
+ PLUGIN_ALLOW_JSON=$(jq '. + ["telegram"]' <<<"$PLUGIN_ALLOW_JSON")
276
+ fi
277
+ if [ "$WHATSAPP_ENABLED_NORMALIZED" = "true" ]; then
278
+ PLUGIN_ALLOW_JSON=$(jq '. + ["whatsapp"]' <<<"$PLUGIN_ALLOW_JSON")
279
+ fi
280
+ CONFIG_JSON=$(echo "$CONFIG_JSON" | jq ".plugins.allow = $PLUGIN_ALLOW_JSON")
281
+ CONFIG_JSON=$(echo "$CONFIG_JSON" | jq '.plugins.entries.lmstudio.enabled = false | .plugins.entries.xai.enabled = false')
282
+
283
  if [ "$BROWSER_SHOULD_ENABLE" = "true" ]; then
284
  CONFIG_JSON=$(echo "$CONFIG_JSON" | jq \
285
  ".browser = {