Spaces:
Running
Running
github-actions[bot] commited on
Commit Β·
7bba7b2
1
Parent(s): 3cefd3a
sync: update from private huggingface space
Browse files- .gitignore +0 -31
- CHANGELOG.md +0 -19
- README.md +4 -63
- openclaw-sync.py +1 -1
- start.sh +50 -2
.gitignore
DELETED
|
@@ -1,31 +0,0 @@
|
|
| 1 |
-
# Environment files
|
| 2 |
-
.env
|
| 3 |
-
.env.*
|
| 4 |
-
|
| 5 |
-
# GitHub workflows/secrets
|
| 6 |
-
.github/
|
| 7 |
-
.gitignore
|
| 8 |
-
|
| 9 |
-
# Node modules
|
| 10 |
-
node_modules/
|
| 11 |
-
|
| 12 |
-
# Logs
|
| 13 |
-
*.log
|
| 14 |
-
|
| 15 |
-
# SQLite temp files
|
| 16 |
-
*.sqlite-wal
|
| 17 |
-
*.sqlite-shm
|
| 18 |
-
|
| 19 |
-
# Python cache
|
| 20 |
-
__pycache__/
|
| 21 |
-
*.pyc
|
| 22 |
-
|
| 23 |
-
# OS files
|
| 24 |
-
.DS_Store
|
| 25 |
-
Thumbs.db
|
| 26 |
-
|
| 27 |
-
# HuggingClaw state
|
| 28 |
-
.huggingclaw-state/
|
| 29 |
-
|
| 30 |
-
# Cache
|
| 31 |
-
.cache/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CHANGELOG.md
CHANGED
|
@@ -2,25 +2,6 @@
|
|
| 2 |
|
| 3 |
All notable changes to this project will be documented in this file.
|
| 4 |
|
| 5 |
-
## [1.5.0] - 2026-05-10
|
| 6 |
-
|
| 7 |
-
### Added
|
| 8 |
-
|
| 9 |
-
- **Universal multi-provider API key rotation** β replaced the NVIDIA-only rotator with `multi-provider-key-rotator.cjs`, supporting round-robin key pools such as `ANTHROPIC_API_KEYS`, `OPENAI_API_KEYS`, `GEMINI_API_KEYS`, `OPENROUTER_API_KEYS`, `GROQ_API_KEYS`, `NVIDIA_API_KEYS`, and other provider-specific plural variables
|
| 10 |
-
- **Multi-provider setup documentation** β expanded `.env.example` and README guidance so users can keep one default `LLM_MODEL` while enabling extra providers with native provider key secrets
|
| 11 |
-
- **Runtime plugin controls** β documented `BROWSER_PLUGIN_MODE`, `ACP_PLUGIN_MODE`, OpenClaw log-level overrides, and `GATEWAY_VERBOSE` for advanced deployments
|
| 12 |
-
|
| 13 |
-
### Changed
|
| 14 |
-
|
| 15 |
-
- **Key rotation generalized** β HuggingClaw now preloads one provider-aware rotator that patches `fetch`, `http`, and `https` requests for all supported provider hostnames instead of only handling NVIDIA traffic
|
| 16 |
-
- **Startup defaults tuned for HF Spaces** β Spaces default to compact warning-level console logs and disabled browser/ACP plugins, while local runs keep friendlier auto/pretty defaults
|
| 17 |
-
- **Playwright dependency isolation** β browser support dependencies are installed in a sidecar `browser-deps` directory so the bundled OpenClaw app dependency tree is not mutated
|
| 18 |
-
|
| 19 |
-
### Fixed
|
| 20 |
-
|
| 21 |
-
- **Provider key fallback consistency** β provider-specific rotation pools now fall back to the singular provider key and then `LLM_API_KEY`, making single-key and multi-key setups behave consistently
|
| 22 |
-
- **Documentation drift** β README now matches the latest `.env.example`, Docker preload, and startup behavior for key rotation, multiple providers, and optional plugin controls
|
| 23 |
-
|
| 24 |
## [1.4.0] - 2026-04-25
|
| 25 |
|
| 26 |
### Added
|
|
|
|
| 2 |
|
| 3 |
All notable changes to this project will be documented in this file.
|
| 4 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
## [1.4.0] - 2026-04-25
|
| 6 |
|
| 7 |
### Added
|
README.md
CHANGED
|
@@ -36,17 +36,16 @@ secrets:
|
|
| 36 |
- [π₯ Video Tutorial](#-video-tutorial)
|
| 37 |
- [π Quick Start](#-quick-start)
|
| 38 |
- [π± Telegram Setup *(Optional)*](#-telegram-setup-optional)
|
| 39 |
-
- [π Cloudflare Proxy](#-cloudflare-proxy-
|
| 40 |
- [π¬ WhatsApp Setup *(Optional)*](#-whatsapp-setup-optional)
|
| 41 |
- [πΎ Workspace Backup *(Optional)*](#-workspace-backup-optional)
|
| 42 |
- [π Webhooks *(Optional)*](#-webhooks-optional)
|
| 43 |
-
- [π Security & Advanced *(Optional)*](#-security-advanced-optional)
|
| 44 |
- [π€ LLM Providers](#-llm-providers)
|
| 45 |
-
- [π API Key Rotation & Multi-Provider Mode](#-api-key-rotation-multi-provider-mode)
|
| 46 |
- [π» Local Development](#-local-development)
|
| 47 |
- [π CLI Access](#-cli-access)
|
| 48 |
- [ποΈ Architecture](#-architecture)
|
| 49 |
-
- [π Staying Alive](#-staying-alive
|
| 50 |
- [π Troubleshooting](#-troubleshooting)
|
| 51 |
- [π Links](#-links)
|
| 52 |
- [π€ Contributing](#-contributing)
|
|
@@ -55,8 +54,6 @@ secrets:
|
|
| 55 |
## β¨ Features
|
| 56 |
|
| 57 |
- π **Any LLM:** Use Claude, OpenAI GPT, Google Gemini, Grok, DeepSeek, Qwen, and 40+ providers (set `LLM_API_KEY` and `LLM_MODEL` accordingly).
|
| 58 |
-
- π **API Key Rotation:** Add comma-separated `*_API_KEYS` pools for supported providers and HuggingClaw rotates keys round-robin per provider at runtime.
|
| 59 |
-
- π **Multi-Provider Mode:** Keep one default `LLM_MODEL`, then expose extra providers in OpenClaw by adding their native provider keys directly as secrets.
|
| 60 |
- β‘ **Zero Config:** Duplicate this Space and set **just three** secrets (LLM_API_KEY, LLM_MODEL, GATEWAY_TOKEN) β no other setup needed.
|
| 61 |
- π³ **Fast Builds:** Uses a pre-built OpenClaw Docker image to deploy in minutes.
|
| 62 |
- π **Cloudflare Outbound Proxy:** HuggingClaw can automatically provision a Cloudflare Worker proxy for blocked outbound traffic such as Telegram API requests.
|
|
@@ -228,7 +225,6 @@ Register a custom endpoint at startup without modifying the CLI.
|
|
| 228 |
| `LLM_MODEL` | Must match `{CUSTOM_PROVIDER_NAME}/{CUSTOM_MODEL_ID}` | **Required** |
|
| 229 |
| `CUSTOM_API_KEY` | Provider-specific key | `LLM_API_KEY` |
|
| 230 |
| `CUSTOM_CONTEXT_WINDOW` | Context limit | `128000` |
|
| 231 |
-
| `CUSTOM_MAX_TOKENS` | Max output tokens for the registered model | `500` |
|
| 232 |
|
| 233 |
> [!TIP]
|
| 234 |
> `CUSTOM_PROVIDER_NAME` cannot override built-in providers (openai, anthropic, etc.).
|
|
@@ -242,58 +238,6 @@ CUSTOM_MODEL_ID=zai-org/GLM-5.1-FP8
|
|
| 242 |
LLM_MODEL=modal/zai-org/GLM-5.1-FP8
|
| 243 |
```
|
| 244 |
|
| 245 |
-
## π API Key Rotation & Multi-Provider Mode
|
| 246 |
-
|
| 247 |
-
HuggingClaw now includes a universal key rotator that patches OpenClaw's outbound `fetch`, `http`, and `https` calls. For each supported provider, you can provide a comma-separated key pool and HuggingClaw will rotate through those keys independently on every matching provider request.
|
| 248 |
-
|
| 249 |
-
### Per-provider key pools
|
| 250 |
-
|
| 251 |
-
Use the plural environment variable for the provider you want to rotate:
|
| 252 |
-
|
| 253 |
-
```bash
|
| 254 |
-
LLM_MODEL=anthropic/claude-sonnet-4-5
|
| 255 |
-
LLM_API_KEY=sk-ant-default
|
| 256 |
-
ANTHROPIC_API_KEYS=sk-ant-key1,sk-ant-key2,sk-ant-key3
|
| 257 |
-
```
|
| 258 |
-
|
| 259 |
-
Key lookup order is:
|
| 260 |
-
|
| 261 |
-
1. Provider-specific plural pool, for example `ANTHROPIC_API_KEYS` or `OPENAI_API_KEYS`.
|
| 262 |
-
2. Provider-specific singular key, for example `ANTHROPIC_API_KEY` or `OPENAI_API_KEY`.
|
| 263 |
-
3. `LLM_API_KEY` as the final fallback.
|
| 264 |
-
|
| 265 |
-
Common rotation variables include `ANTHROPIC_API_KEYS`, `OPENAI_API_KEYS`, `GEMINI_API_KEYS`, `DEEPSEEK_API_KEYS`, `OPENROUTER_API_KEYS`, `OPENCODE_API_KEYS`, `ZAI_API_KEYS`, `MOONSHOT_API_KEYS`, `MINIMAX_API_KEYS`, `MISTRAL_API_KEYS`, `XAI_API_KEYS`, `NVIDIA_API_KEYS`, `GROQ_API_KEYS`, `COHERE_API_KEYS`, `TOGETHER_API_KEYS`, `CEREBRAS_API_KEYS`, and `HUGGINGFACE_HUB_TOKENS`. See `.env.example` for the full commented list.
|
| 266 |
-
|
| 267 |
-
### Enable multiple providers at once
|
| 268 |
-
|
| 269 |
-
`LLM_MODEL` still controls the default model. To make additional providers available in the Control UI, add their native API-key secrets directly:
|
| 270 |
-
|
| 271 |
-
```bash
|
| 272 |
-
LLM_MODEL=anthropic/claude-sonnet-4-6
|
| 273 |
-
LLM_API_KEY=sk-ant-default
|
| 274 |
-
|
| 275 |
-
OPENAI_API_KEY=sk-openai-extra
|
| 276 |
-
OPENAI_API_KEYS=sk-openai-key1,sk-openai-key2
|
| 277 |
-
|
| 278 |
-
GROQ_API_KEY=gsk-extra
|
| 279 |
-
GROQ_API_KEYS=gsk-key1,gsk-key2,gsk-key3
|
| 280 |
-
```
|
| 281 |
-
|
| 282 |
-
This lets you keep a safe default model while switching to other configured providers from OpenClaw when needed.
|
| 283 |
-
|
| 284 |
-
### Runtime and plugin controls
|
| 285 |
-
|
| 286 |
-
For Hugging Face Spaces, HuggingClaw defaults to quieter logs and disables optional browser/ACP plugins unless explicitly enabled. For local runs, those plugins remain in auto mode. Advanced users can override the defaults with:
|
| 287 |
-
|
| 288 |
-
| Variable | Default on HF Spaces | Default locally | Description |
|
| 289 |
-
| :--- | :--- | :--- | :--- |
|
| 290 |
-
| `OPENCLAW_CONSOLE_LOG_LEVEL` | `warn` | `info` | Console log verbosity |
|
| 291 |
-
| `OPENCLAW_FILE_LOG_LEVEL` | `info` | `info` | Gateway log-file verbosity |
|
| 292 |
-
| `OPENCLAW_CONSOLE_LOG_STYLE` | `compact` | `pretty` | Console log formatting |
|
| 293 |
-
| `BROWSER_PLUGIN_MODE` | `disabled` | `auto` | Set `enabled`, `disabled`, or `auto` for managed Chromium/browser tools |
|
| 294 |
-
| `ACP_PLUGIN_MODE` | `disabled` | `auto` | Set `enabled`, `disabled`, or `auto` for the ACP plugin |
|
| 295 |
-
| `GATEWAY_VERBOSE` | `0` | `0` | Set to `1` to add OpenClaw gateway verbose logging |
|
| 296 |
-
|
| 297 |
## π» Local Development
|
| 298 |
|
| 299 |
```bash
|
|
@@ -340,7 +284,6 @@ HuggingClaw uses a multi-layered approach to ensure stability and persistence on
|
|
| 340 |
- **Health Check (`/health`)**: Endpoint for uptime monitoring and readiness probes.
|
| 341 |
- **Sync Engine**: Python background process managing HF Dataset persistence.
|
| 342 |
- **Transparent Proxy**: Interceptor for requests to blocked domains (Telegram, etc.).
|
| 343 |
-
- **Key Rotator**: Node preload that rotates provider API keys without changing OpenClaw code.
|
| 344 |
|
| 345 |
**Startup sequence:**
|
| 346 |
|
|
@@ -355,7 +298,7 @@ HuggingClaw uses a multi-layered approach to ensure stability and persistence on
|
|
| 355 |
## π Troubleshooting
|
| 356 |
|
| 357 |
- **Missing secrets:** Ensure `LLM_API_KEY`, `LLM_MODEL`, and `GATEWAY_TOKEN` are set in your Space **Settings β Secrets**.
|
| 358 |
-
- **Telegram bot issues:** Verify your `TELEGRAM_BOT_TOKEN`.
|
| 359 |
- **Backup restore failing:** Make sure `HF_TOKEN` is valid and has write access to your HF account dataset. Set `HF_USERNAME` only if auto-detection is not available in your environment.
|
| 360 |
- **Space keeps sleeping:** Add `CLOUDFLARE_WORKERS_TOKEN` as a Space secret to enable automatic keep-awake monitoring via Cloudflare Workers.
|
| 361 |
- **Auth errors / proxy:** If you see reverse-proxy auth errors, add the logged IPs under `TRUSTED_PROXIES` (from logs `remote=x.x.x.x`).
|
|
@@ -363,8 +306,6 @@ HuggingClaw uses a multi-layered approach to ensure stability and persistence on
|
|
| 363 |
- **WhatsApp lost its session after restart:** Make sure `HF_TOKEN` is configured so the hidden session backup can be restored on boot.
|
| 364 |
- **UI blocked (CORS):** Set `ALLOWED_ORIGINS=https://your-space-name.hf.space`.
|
| 365 |
- **Version mismatches:** Pin a specific OpenClaw build with the `OPENCLAW_VERSION` Variable in HF Spaces, or `--build-arg OPENCLAW_VERSION=...` locally.
|
| 366 |
-
- **Rotation is not using the expected key:** Make sure you set the plural provider pool (for example `OPENAI_API_KEYS`) as a Space secret, separated only by commas; the rotator falls back to the singular provider key and then `LLM_API_KEY`.
|
| 367 |
-
- **Browser/ACP tools are missing on HF Spaces:** Set `BROWSER_PLUGIN_MODE=enabled` or `ACP_PLUGIN_MODE=enabled` if you intentionally need those optional plugins.
|
| 368 |
|
| 369 |
## π More Projects
|
| 370 |
|
|
|
|
| 36 |
- [π₯ Video Tutorial](#-video-tutorial)
|
| 37 |
- [π Quick Start](#-quick-start)
|
| 38 |
- [π± Telegram Setup *(Optional)*](#-telegram-setup-optional)
|
| 39 |
+
- [π Cloudflare Proxy *(Optional)*](#-cloudflare-proxy-optional)
|
| 40 |
- [π¬ WhatsApp Setup *(Optional)*](#-whatsapp-setup-optional)
|
| 41 |
- [πΎ Workspace Backup *(Optional)*](#-workspace-backup-optional)
|
| 42 |
- [π Webhooks *(Optional)*](#-webhooks-optional)
|
| 43 |
+
- [π Security & Advanced *(Optional)*](#-security--advanced-optional)
|
| 44 |
- [π€ LLM Providers](#-llm-providers)
|
|
|
|
| 45 |
- [π» Local Development](#-local-development)
|
| 46 |
- [π CLI Access](#-cli-access)
|
| 47 |
- [ποΈ Architecture](#-architecture)
|
| 48 |
+
- [π Staying Alive](#-staying-alive)
|
| 49 |
- [π Troubleshooting](#-troubleshooting)
|
| 50 |
- [π Links](#-links)
|
| 51 |
- [π€ Contributing](#-contributing)
|
|
|
|
| 54 |
## β¨ Features
|
| 55 |
|
| 56 |
- π **Any LLM:** Use Claude, OpenAI GPT, Google Gemini, Grok, DeepSeek, Qwen, and 40+ providers (set `LLM_API_KEY` and `LLM_MODEL` accordingly).
|
|
|
|
|
|
|
| 57 |
- β‘ **Zero Config:** Duplicate this Space and set **just three** secrets (LLM_API_KEY, LLM_MODEL, GATEWAY_TOKEN) β no other setup needed.
|
| 58 |
- π³ **Fast Builds:** Uses a pre-built OpenClaw Docker image to deploy in minutes.
|
| 59 |
- π **Cloudflare Outbound Proxy:** HuggingClaw can automatically provision a Cloudflare Worker proxy for blocked outbound traffic such as Telegram API requests.
|
|
|
|
| 225 |
| `LLM_MODEL` | Must match `{CUSTOM_PROVIDER_NAME}/{CUSTOM_MODEL_ID}` | **Required** |
|
| 226 |
| `CUSTOM_API_KEY` | Provider-specific key | `LLM_API_KEY` |
|
| 227 |
| `CUSTOM_CONTEXT_WINDOW` | Context limit | `128000` |
|
|
|
|
| 228 |
|
| 229 |
> [!TIP]
|
| 230 |
> `CUSTOM_PROVIDER_NAME` cannot override built-in providers (openai, anthropic, etc.).
|
|
|
|
| 238 |
LLM_MODEL=modal/zai-org/GLM-5.1-FP8
|
| 239 |
```
|
| 240 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 241 |
## π» Local Development
|
| 242 |
|
| 243 |
```bash
|
|
|
|
| 284 |
- **Health Check (`/health`)**: Endpoint for uptime monitoring and readiness probes.
|
| 285 |
- **Sync Engine**: Python background process managing HF Dataset persistence.
|
| 286 |
- **Transparent Proxy**: Interceptor for requests to blocked domains (Telegram, etc.).
|
|
|
|
| 287 |
|
| 288 |
**Startup sequence:**
|
| 289 |
|
|
|
|
| 298 |
## π Troubleshooting
|
| 299 |
|
| 300 |
- **Missing secrets:** Ensure `LLM_API_KEY`, `LLM_MODEL`, and `GATEWAY_TOKEN` are set in your Space **Settings β Secrets**.
|
| 301 |
+
- **Telegram bot issues:** Verify your `TELEGRAM_BOT_TOKEN`. Check Space logs for lines like `π± Enabling Telegram`.
|
| 302 |
- **Backup restore failing:** Make sure `HF_TOKEN` is valid and has write access to your HF account dataset. Set `HF_USERNAME` only if auto-detection is not available in your environment.
|
| 303 |
- **Space keeps sleeping:** Add `CLOUDFLARE_WORKERS_TOKEN` as a Space secret to enable automatic keep-awake monitoring via Cloudflare Workers.
|
| 304 |
- **Auth errors / proxy:** If you see reverse-proxy auth errors, add the logged IPs under `TRUSTED_PROXIES` (from logs `remote=x.x.x.x`).
|
|
|
|
| 306 |
- **WhatsApp lost its session after restart:** Make sure `HF_TOKEN` is configured so the hidden session backup can be restored on boot.
|
| 307 |
- **UI blocked (CORS):** Set `ALLOWED_ORIGINS=https://your-space-name.hf.space`.
|
| 308 |
- **Version mismatches:** Pin a specific OpenClaw build with the `OPENCLAW_VERSION` Variable in HF Spaces, or `--build-arg OPENCLAW_VERSION=...` locally.
|
|
|
|
|
|
|
| 309 |
|
| 310 |
## π More Projects
|
| 311 |
|
openclaw-sync.py
CHANGED
|
@@ -51,7 +51,7 @@ EXCLUDED_SYNC_DIRS = {
|
|
| 51 |
}
|
| 52 |
MAX_FILE_SIZE_BYTES = int(os.environ.get("SYNC_MAX_FILE_BYTES", str(50 * 1024 * 1024)))
|
| 53 |
|
| 54 |
-
STATE_DIR = WORKSPACE / "
|
| 55 |
OPENCLAW_STATE_BACKUP_DIR = STATE_DIR / "openclaw"
|
| 56 |
EXCLUDED_STATE_NAMES = {
|
| 57 |
"workspace",
|
|
|
|
| 51 |
}
|
| 52 |
MAX_FILE_SIZE_BYTES = int(os.environ.get("SYNC_MAX_FILE_BYTES", str(50 * 1024 * 1024)))
|
| 53 |
|
| 54 |
+
STATE_DIR = WORKSPACE / "huggingclaw-state"
|
| 55 |
OPENCLAW_STATE_BACKUP_DIR = STATE_DIR / "openclaw"
|
| 56 |
EXCLUDED_STATE_NAMES = {
|
| 57 |
"workspace",
|
start.sh
CHANGED
|
@@ -421,8 +421,35 @@ if [ "$WHATSAPP_ENABLED_NORMALIZED" = "true" ]; then
|
|
| 421 |
fi
|
| 422 |
|
| 423 |
# Write config
|
| 424 |
-
|
| 425 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 426 |
|
| 427 |
# ββ Enable Gateway Preload Fixes ββ
|
| 428 |
# This preload script keeps iframe embedding working on HF Spaces.
|
|
@@ -510,6 +537,27 @@ if [ -n "${CLOUDFLARE_WORKERS_TOKEN:-}" ]; then
|
|
| 510 |
python3 /home/node/app/cloudflare-keepalive-setup.py || true
|
| 511 |
fi
|
| 512 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 513 |
# ββ Launch gateway ββ
|
| 514 |
echo "Launching OpenClaw gateway on port 7860..."
|
| 515 |
|
|
|
|
| 421 |
fi
|
| 422 |
|
| 423 |
# Write config
|
| 424 |
+
EXISTING_CONFIG="/home/node/.openclaw/openclaw.json"
|
| 425 |
+
if [ -f "$EXISTING_CONFIG" ]; then
|
| 426 |
+
echo "Restored config found β patching required fields only..."
|
| 427 |
+
PATCHED=$(jq \
|
| 428 |
+
--arg token "$GATEWAY_TOKEN" \
|
| 429 |
+
--arg model "$LLM_MODEL" \
|
| 430 |
+
--arg fileLevel "$OPENCLAW_FILE_LOG_LEVEL" \
|
| 431 |
+
--arg consoleLevel "$OPENCLAW_CONSOLE_LOG_LEVEL" \
|
| 432 |
+
--arg consoleStyle "$OPENCLAW_CONSOLE_LOG_STYLE" \
|
| 433 |
+
'.gateway.auth.token = $token
|
| 434 |
+
| .agents.defaults.model = $model
|
| 435 |
+
| .logging.level = $fileLevel
|
| 436 |
+
| .logging.consoleLevel = $consoleLevel
|
| 437 |
+
| .logging.consoleStyle = $consoleStyle' \
|
| 438 |
+
"$EXISTING_CONFIG" 2>/dev/null)
|
| 439 |
+
|
| 440 |
+
if [ -n "$PATCHED" ]; then
|
| 441 |
+
echo "$PATCHED" > "$EXISTING_CONFIG.tmp" \
|
| 442 |
+
&& mv "$EXISTING_CONFIG.tmp" "$EXISTING_CONFIG"
|
| 443 |
+
echo "Config patched successfully."
|
| 444 |
+
else
|
| 445 |
+
echo "Patch failed β writing fresh config."
|
| 446 |
+
echo "$CONFIG_JSON" > "$EXISTING_CONFIG"
|
| 447 |
+
fi
|
| 448 |
+
else
|
| 449 |
+
echo "No restored config β writing fresh config..."
|
| 450 |
+
echo "$CONFIG_JSON" > "$EXISTING_CONFIG"
|
| 451 |
+
fi
|
| 452 |
+
chmod 600 "$EXISTING_CONFIG"
|
| 453 |
|
| 454 |
# ββ Enable Gateway Preload Fixes ββ
|
| 455 |
# This preload script keeps iframe embedding working on HF Spaces.
|
|
|
|
| 537 |
python3 /home/node/app/cloudflare-keepalive-setup.py || true
|
| 538 |
fi
|
| 539 |
|
| 540 |
+
# ββ Re-install previously installed plugins ββ
|
| 541 |
+
EXISTING_CONFIG="/home/node/.openclaw/openclaw.json"
|
| 542 |
+
if [ -f "$EXISTING_CONFIG" ]; then
|
| 543 |
+
INSTALLS=$(jq -r '.plugins.installs // {} | keys[]' "$EXISTING_CONFIG" 2>/dev/null || echo "")
|
| 544 |
+
if [ -n "$INSTALLS" ]; then
|
| 545 |
+
echo "Re-installing plugins from config..."
|
| 546 |
+
while IFS= read -r pkg; do
|
| 547 |
+
[ -z "$pkg" ] && continue
|
| 548 |
+
# Try short name first, then @openclaw/ prefix
|
| 549 |
+
if openclaw plugins install "$pkg" 2>/dev/null; then
|
| 550 |
+
echo " Installed: $pkg"
|
| 551 |
+
elif openclaw plugins install "@openclaw/$pkg" 2>/dev/null; then
|
| 552 |
+
echo " Installed: @openclaw/$pkg"
|
| 553 |
+
else
|
| 554 |
+
echo " Warning: could not install $pkg"
|
| 555 |
+
fi
|
| 556 |
+
done <<< "$INSTALLS"
|
| 557 |
+
echo "Plugins done."
|
| 558 |
+
fi
|
| 559 |
+
fi
|
| 560 |
+
|
| 561 |
# ββ Launch gateway ββ
|
| 562 |
echo "Launching OpenClaw gateway on port 7860..."
|
| 563 |
|