Spaces:
Paused
Paused
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>
Files changed (3)
- README.md+7-9
- health-server.js+8-2
- start.sh+8-6
201 unmodified lines202203204205206207208209210211212213214215216217218219220221222223201 unmodified lines| `SYNC_INTERVAL` | `600` | Backup frequency in seconds || `CLOUDFLARE_KEEPALIVE_ENABLED` | `true` | Set `false` to disable keep-awake worker || `TELEGRAM_MODE` | `webhook` | `webhook` or `polling` || `DEV_MODE` | `false` | Set `true` to enable JupyterLab terminal at `/terminal/` || `JUPYTER_TOKEN` | — | Required when `DEV_MODE=true` — secures terminal access |## 💻 Terminal Access (JupyterLab)HuggingMes includes an optional JupyterLab terminal at `/terminal/` for direct shell access to the container — useful for running `hermes` commands, inspecting files, installing packages, and debugging.### Setup1. Add two secrets to your Space:- `DEV_MODE` = `true`- `JUPYTER_TOKEN` = a strong random token (`openssl rand -hex 32`)2. Restart the Space.3. Open `https://your-space.hf.space/terminal/` — log in with your `GATEWAY_TOKEN` first, then JupyterLab will prompt for `JUPYTER_TOKEN`.> **Security:** JupyterLab grants full shell access to the container. Always use a strong, unique `JUPYTER_TOKEN`. The terminal will refuse to start if `JUPYTER_TOKEN` is empty or set to the insecure default.### What you can do201 unmodified lines202203204205206207208209210211212213214215216217218219220221201 unmodified lines| `SYNC_INTERVAL` | `600` | Backup frequency in seconds || `CLOUDFLARE_KEEPALIVE_ENABLED` | `true` | Set `false` to disable keep-awake worker || `TELEGRAM_MODE` | `webhook` | `webhook` or `polling` || `DEV_MODE` | `true` | Set `false` to disable JupyterLab terminal at `/terminal/` || `JUPYTER_TOKEN` | *(uses `GATEWAY_TOKEN`)* | Override terminal password (optional) |## 💻 Terminal Access (JupyterLab)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.### SetupThe terminal is **on by default** — no extra configuration needed. Click **Open Terminal →** on the dashboard, then log in with your `GATEWAY_TOKEN`.To disable it, set `DEV_MODE=false`. To use a separate terminal password, set `JUPYTER_TOKEN` to a different value.> **Security:** JupyterLab grants full shell access to the container. The terminal will not start if no `GATEWAY_TOKEN` is set.### What you can do
491 unmodified lines49249349449549649749849931 unmodified lines531532533534535536537491 unmodified linesheader { text-align:center; margin-bottom:22px; }h1 { margin:0; font-size:1.65rem; line-height:1; letter-spacing:0; }.subtitle { margin-top:12px; color:var(--muted); font-size:.72rem; text-transform:uppercase; letter-spacing:.14em; font-weight:800; }.hero-action { display:flex; width:100%; 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; margin:24px 0 20px; transition: background 0.15s ease; }.hero-action:hover { background:#e5e5e5; }.overview { display:grid; grid-template-columns:repeat(2, minmax(0, 1fr)); gap:10px; margin-bottom:10px; }.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; }.tile.ok { border-color:rgba(34,197,94,.22); }31 unmodified lines<h1>HuggingMes</h1><div class="subtitle">Self-hosted - Hermes Agent</div></header><a class="hero-action" href="${APP_BASE}/" target="_blank" rel="noopener noreferrer">Open Hermes Agent -></a><section class="overview">${tiles}</section>491 unmodified lines49249349449549649749849950050150231 unmodified lines534535536537538539540541542543491 unmodified linesheader { text-align:center; margin-bottom:22px; }h1 { margin:0; font-size:1.65rem; line-height:1; letter-spacing:0; }.subtitle { margin-top:12px; color:var(--muted); font-size:.72rem; text-transform:uppercase; letter-spacing:.14em; font-weight:800; }.hero-buttons { display:flex; gap:10px; margin:24px 0 20px; }.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; }.hero-action:hover { background:#e5e5e5; }.hero-action.secondary { background:var(--panel); color:var(--text); border:1px solid var(--line); }.hero-action.secondary:hover { background:var(--panel2); }.overview { display:grid; grid-template-columns:repeat(2, minmax(0, 1fr)); gap:10px; margin-bottom:10px; }.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; }.tile.ok { border-color:rgba(34,197,94,.22); }31 unmodified lines<h1>HuggingMes</h1><div class="subtitle">Self-hosted - Hermes Agent</div></header><div class="hero-buttons"><a class="hero-action" href="${APP_BASE}/" target="_blank" rel="noopener noreferrer">Open Hermes Agent →</a><a class="hero-action secondary" href="/terminal/" target="_blank" rel="noopener noreferrer">Open Terminal →</a></div><section class="overview">${tiles}</section>
307 unmodified lines308309310311312313314315316317318319320321322323324307 unmodified linesecho "Gateway : http://127.0.0.1:${GATEWAY_API_PORT}"echo ""# ── JupyterLab terminal (DEV_MODE=true + JUPYTER_TOKEN required) ──start_jupyter() {if [ "${DEV_MODE:-false}" != "true" ]; thenecho "JupyterLab disabled (set DEV_MODE=true to enable /terminal/)."return 0fiif [ -z "${JUPYTER_TOKEN:-}" ] || [ "${JUPYTER_TOKEN}" = "huggingface" ]; thenecho "ERROR: JUPYTER_TOKEN unset or insecure default. JupyterLab grants full shell — set a strong token." >&2echo " Hint: openssl rand -hex 32" >&2return 1fiif ! python3 -c "import jupyterlab" >/dev/null 2>&1; thenecho "WARNING: jupyterlab not installed; skipping terminal." >&2return 1307 unmodified lines308309310311312313314315316317318319320321322323324325326307 unmodified linesecho "Gateway : http://127.0.0.1:${GATEWAY_API_PORT}"echo ""# ── JupyterLab terminal (on by default, uses GATEWAY_TOKEN) ──start_jupyter() {if [ "${DEV_MODE:-true}" = "false" ]; thenecho "JupyterLab disabled (DEV_MODE=false)."return 0fi# Use JUPYTER_TOKEN if set, otherwise fall back to GATEWAY_TOKENlocal token="${JUPYTER_TOKEN:-${API_SERVER_KEY:-}}"if [ -z "$token" ]; thenecho "WARNING: No GATEWAY_TOKEN or JUPYTER_TOKEN set — JupyterLab skipped (terminal would be unauthenticated)." >&2return 1fiexport JUPYTER_TOKEN="$token"if ! python3 -c "import jupyterlab" >/dev/null 2>&1; thenecho "WARNING: jupyterlab not installed; skipping terminal." >&2return 1
README.md+7-9
health-server.js+8-2
start.sh+8-6