Spaces:
Running
Running
feat: terminal on by default, uses GATEWAY_TOKEN, add dashboard button
Browse files- DEV_MODE defaults to true β no extra secret needed
- JUPYTER_TOKEN falls back to GATEWAY_TOKEN (single password)
- Add "Open Terminal β" button beside "Open Hermes Agent β" on dashboard
- Update README to reflect new defaults
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- README.md +7 -9
- health-server.js +8 -2
- start.sh +8 -6
README.md
CHANGED
|
@@ -202,22 +202,20 @@ With `CLOUDFLARE_WORKERS_TOKEN` set, HuggingMes can create a keep-alive worker t
|
|
| 202 |
| `SYNC_INTERVAL` | `600` | Backup frequency in seconds |
|
| 203 |
| `CLOUDFLARE_KEEPALIVE_ENABLED` | `true` | Set `false` to disable keep-awake worker |
|
| 204 |
| `TELEGRAM_MODE` | `webhook` | `webhook` or `polling` |
|
| 205 |
-
| `DEV_MODE` | `
|
| 206 |
-
| `JUPYTER_TOKEN` |
|
| 207 |
|
| 208 |
## π» Terminal Access (JupyterLab)
|
| 209 |
|
| 210 |
-
HuggingMes includes
|
| 211 |
|
| 212 |
### Setup
|
| 213 |
|
| 214 |
-
|
| 215 |
-
- `DEV_MODE` = `true`
|
| 216 |
-
- `JUPYTER_TOKEN` = a strong random token (`openssl rand -hex 32`)
|
| 217 |
-
2. Restart the Space.
|
| 218 |
-
3. Open `https://your-space.hf.space/terminal/` β log in with your `GATEWAY_TOKEN` first, then JupyterLab will prompt for `JUPYTER_TOKEN`.
|
| 219 |
|
| 220 |
-
|
|
|
|
|
|
|
| 221 |
|
| 222 |
### What you can do
|
| 223 |
|
|
|
|
| 202 |
| `SYNC_INTERVAL` | `600` | Backup frequency in seconds |
|
| 203 |
| `CLOUDFLARE_KEEPALIVE_ENABLED` | `true` | Set `false` to disable keep-awake worker |
|
| 204 |
| `TELEGRAM_MODE` | `webhook` | `webhook` or `polling` |
|
| 205 |
+
| `DEV_MODE` | `true` | Set `false` to disable JupyterLab terminal at `/terminal/` |
|
| 206 |
+
| `JUPYTER_TOKEN` | *(uses `GATEWAY_TOKEN`)* | Override terminal password (optional) |
|
| 207 |
|
| 208 |
## π» Terminal Access (JupyterLab)
|
| 209 |
|
| 210 |
+
HuggingMes includes a JupyterLab terminal at `/terminal/` for direct shell access to the container β useful for running `hermes` commands, inspecting files, installing packages, and debugging. Enabled by default when `GATEWAY_TOKEN` is set.
|
| 211 |
|
| 212 |
### Setup
|
| 213 |
|
| 214 |
+
The terminal is **on by default** β no extra configuration needed. Click **Open Terminal β** on the dashboard, then log in with your `GATEWAY_TOKEN`.
|
|
|
|
|
|
|
|
|
|
|
|
|
| 215 |
|
| 216 |
+
To disable it, set `DEV_MODE=false`. To use a separate terminal password, set `JUPYTER_TOKEN` to a different value.
|
| 217 |
+
|
| 218 |
+
> **Security:** JupyterLab grants full shell access to the container. The terminal will not start if no `GATEWAY_TOKEN` is set.
|
| 219 |
|
| 220 |
### What you can do
|
| 221 |
|
health-server.js
CHANGED
|
@@ -492,8 +492,11 @@ function renderDashboard(data) {
|
|
| 492 |
header { text-align:center; margin-bottom:22px; }
|
| 493 |
h1 { margin:0; font-size:1.65rem; line-height:1; letter-spacing:0; }
|
| 494 |
.subtitle { margin-top:12px; color:var(--muted); font-size:.72rem; text-transform:uppercase; letter-spacing:.14em; font-weight:800; }
|
| 495 |
-
.hero-
|
|
|
|
| 496 |
.hero-action:hover { background:#e5e5e5; }
|
|
|
|
|
|
|
| 497 |
.overview { display:grid; grid-template-columns:repeat(2, minmax(0, 1fr)); gap:10px; margin-bottom:10px; }
|
| 498 |
.tile { border:1px solid var(--line); background:var(--panel); border-radius:11px; padding:18px; min-height:124px; display:flex; flex-direction:column; gap:10px; position:relative; }
|
| 499 |
.tile.ok { border-color:rgba(34,197,94,.22); }
|
|
@@ -531,7 +534,10 @@ function renderDashboard(data) {
|
|
| 531 |
<h1>HuggingMes</h1>
|
| 532 |
<div class="subtitle">Self-hosted - Hermes Agent</div>
|
| 533 |
</header>
|
| 534 |
-
<
|
|
|
|
|
|
|
|
|
|
| 535 |
<section class="overview">
|
| 536 |
${tiles}
|
| 537 |
</section>
|
|
|
|
| 492 |
header { text-align:center; margin-bottom:22px; }
|
| 493 |
h1 { margin:0; font-size:1.65rem; line-height:1; letter-spacing:0; }
|
| 494 |
.subtitle { margin-top:12px; color:var(--muted); font-size:.72rem; text-transform:uppercase; letter-spacing:.14em; font-weight:800; }
|
| 495 |
+
.hero-buttons { display:flex; gap:10px; margin:24px 0 20px; }
|
| 496 |
+
.hero-action { display:flex; flex:1; min-height:46px; align-items:center; justify-content:center; border-radius:8px; background:#ffffff; color:#000000; text-decoration:none; font-weight:850; font-size:.98rem; transition:background 0.15s ease; }
|
| 497 |
.hero-action:hover { background:#e5e5e5; }
|
| 498 |
+
.hero-action.secondary { background:var(--panel); color:var(--text); border:1px solid var(--line); }
|
| 499 |
+
.hero-action.secondary:hover { background:var(--panel2); }
|
| 500 |
.overview { display:grid; grid-template-columns:repeat(2, minmax(0, 1fr)); gap:10px; margin-bottom:10px; }
|
| 501 |
.tile { border:1px solid var(--line); background:var(--panel); border-radius:11px; padding:18px; min-height:124px; display:flex; flex-direction:column; gap:10px; position:relative; }
|
| 502 |
.tile.ok { border-color:rgba(34,197,94,.22); }
|
|
|
|
| 534 |
<h1>HuggingMes</h1>
|
| 535 |
<div class="subtitle">Self-hosted - Hermes Agent</div>
|
| 536 |
</header>
|
| 537 |
+
<div class="hero-buttons">
|
| 538 |
+
<a class="hero-action" href="${APP_BASE}/" target="_blank" rel="noopener noreferrer">Open Hermes Agent β</a>
|
| 539 |
+
<a class="hero-action secondary" href="/terminal/" target="_blank" rel="noopener noreferrer">Open Terminal β</a>
|
| 540 |
+
</div>
|
| 541 |
<section class="overview">
|
| 542 |
${tiles}
|
| 543 |
</section>
|
start.sh
CHANGED
|
@@ -308,17 +308,19 @@ echo "Dashboard : http://127.0.0.1:${DASHBOARD_PORT}"
|
|
| 308 |
echo "Gateway : http://127.0.0.1:${GATEWAY_API_PORT}"
|
| 309 |
echo ""
|
| 310 |
|
| 311 |
-
# ββ JupyterLab terminal (
|
| 312 |
start_jupyter() {
|
| 313 |
-
if [ "${DEV_MODE:-
|
| 314 |
-
echo "JupyterLab disabled (
|
| 315 |
return 0
|
| 316 |
fi
|
| 317 |
-
|
| 318 |
-
|
| 319 |
-
|
|
|
|
| 320 |
return 1
|
| 321 |
fi
|
|
|
|
| 322 |
if ! python3 -c "import jupyterlab" >/dev/null 2>&1; then
|
| 323 |
echo "WARNING: jupyterlab not installed; skipping terminal." >&2
|
| 324 |
return 1
|
|
|
|
| 308 |
echo "Gateway : http://127.0.0.1:${GATEWAY_API_PORT}"
|
| 309 |
echo ""
|
| 310 |
|
| 311 |
+
# ββ JupyterLab terminal (on by default, uses GATEWAY_TOKEN) ββ
|
| 312 |
start_jupyter() {
|
| 313 |
+
if [ "${DEV_MODE:-true}" = "false" ]; then
|
| 314 |
+
echo "JupyterLab disabled (DEV_MODE=false)."
|
| 315 |
return 0
|
| 316 |
fi
|
| 317 |
+
# Use JUPYTER_TOKEN if set, otherwise fall back to GATEWAY_TOKEN
|
| 318 |
+
local token="${JUPYTER_TOKEN:-${API_SERVER_KEY:-}}"
|
| 319 |
+
if [ -z "$token" ]; then
|
| 320 |
+
echo "WARNING: No GATEWAY_TOKEN or JUPYTER_TOKEN set β JupyterLab skipped (terminal would be unauthenticated)." >&2
|
| 321 |
return 1
|
| 322 |
fi
|
| 323 |
+
export JUPYTER_TOKEN="$token"
|
| 324 |
if ! python3 -c "import jupyterlab" >/dev/null 2>&1; then
|
| 325 |
echo "WARNING: jupyterlab not installed; skipping terminal." >&2
|
| 326 |
return 1
|