Skip to content

Clawbox UI - #14

Closed
yalexx wants to merge 7 commits into
feature/x64-installerfrom
clawbox-ui
Closed

yalexx wants to merge 7 commits into
feature/x64-installerfrom
clawbox-ui

Conversation

@yalexx

@yalexx yalexx commented Mar 18, 2026

Copy link
Copy Markdown
Collaborator

Summary by CodeRabbit

  • New Features

    • Full desktop environment with draggable app icons, window management, and customizable wallpaper.
    • Integrated browser and remote desktop access for system management.
    • System update and power management controls in the system tray.
    • Enhanced setup wizard with new security and credential configuration steps.
    • Desktop customization options including auto-login and background settings.
  • Chores

    • Updated gateway configuration for LAN accessibility.
    • Expanded installation process with additional tools and components.

yalexx and others added 2 commits March 18, 2026 15:50
… steps

- Move desktop UI to / as the default landing page, setup wizard at /setup
- Add Security (password/hotspot) and Telegram steps to setup wizard (6 steps total)
- Deduplicate getGatewayToken() into shared gateway-proxy module
- Update Chromium icon to proper Chromium SVG
- Parallelize browser lock file cleanup
- Move system update button from setup to settings app
- Remove stats from DoneStep (already in desktop UI)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@yalexx yalexx self-assigned this Mar 18, 2026
@coderabbitai

coderabbitai Bot commented Mar 18, 2026

Copy link
Copy Markdown

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 33db1795-ca36-4d9d-91a3-d5c7900405b6

📥 Commits

Reviewing files that changed from the base of the PR and between cd3adb0 and 922d804.

📒 Files selected for processing (25)
  • .coderabbit.yaml
  • config/clawbox-gateway.service
  • install.sh
  • next.config.ts
  • scripts/gateway-pre-start.sh
  • scripts/terminal-server.ts
  • src/app/page.tsx
  • src/app/route.ts
  • src/app/setup-api/browser/manage/route.ts
  • src/app/setup-api/gateway/route.ts
  • src/app/setup/page.tsx
  • src/components/BrowserApp.tsx
  • src/components/ChromeShelf.tsx
  • src/components/DoneStep.tsx
  • src/components/ProgressBar.tsx
  • src/components/SettingsApp.tsx
  • src/components/SetupWizard.tsx
  • src/components/SystemTray.tsx
  • src/components/UpdateStep.tsx
  • src/components/VNCApp.tsx
  • src/components/Window.tsx
  • src/instrumentation-node.ts
  • src/instrumentation.ts
  • src/lib/gateway-proxy.ts
  • src/lib/updater.ts

📝 Walkthrough

Walkthrough

This pull request refactors ClawBox's architecture by shifting the desktop interface from the setup wizard to a new dedicated client-side page, while reconfiguring gateway/terminal services, expanding installation steps for VNC/GitHub CLI/AI tools, and enhancing browser management and UI components.

Changes

Cohort / File(s) Summary
Configuration & Service Setup
.coderabbit.yaml, config/clawbox-gateway.service, next.config.ts
Updated auto-review branches, changed gateway service to bind to LAN with token authentication, and switched dev origin from IP-based to clawbox.local.
Installation & Startup Scripts
install.sh, scripts/gateway-pre-start.sh, scripts/terminal-server.ts
Expanded install with desktop customization, VNC, GitHub CLI, and AI tools steps. Updated gateway pre-start to perform config migration with JSON editing and token-based auth. Refactored terminal server to spawn bash as fixed user clawbox with conditional sudo and explicit environment variables.
Terminal Server Instrumentation
src/instrumentation-node.ts, src/instrumentation.ts
Extracted terminal server startup into dedicated module with HTTP-based running-process detection, npx-based tsx spawning, and auto-restart on exit. Simplified main instrumentation to delegate via dynamic require.
API Routes
src/app/setup-api/browser/manage/route.ts, src/app/setup-api/gateway/route.ts
Enhanced browser launch with dynamic X display probing, Xauthority resolution, GPU/Ozone flags, and improved profile cleanup. Updated gateway route to derive WebSocket host from request header and inject token into localStorage instead of DOM script element.
Desktop & Setup Pages
src/app/page.tsx, src/app/setup/page.tsx, src/app/route.ts
Moved full desktop UI (ChromeDesktop with window management, launcher, shelf, wallpaper, icon grid) from setup wizard to new dedicated page.tsx. Replaced setup/page.tsx with minimal SetupWizard wrapper. Removed root GET handler from app/route.ts.
Core Components
src/components/BrowserApp.tsx, src/components/ChromeShelf.tsx, src/components/SettingsApp.tsx, src/components/SystemTray.tsx, src/components/UpdateStep.tsx, src/components/VNCApp.tsx, src/components/Window.tsx
Added onOpenApp callback to BrowserApp, power button to ChromeShelf. Enhanced SettingsApp with update status polling and branch selection. Implemented reboot/power transition overlay in SystemTray with reconnection polling. Added "up to date" detection and conditional UI in UpdateStep. Enabled VNC focus, keyboard interception, and active tracking. Added window ID attribute.
Setup & UI Utilities
src/components/DoneStep.tsx, src/components/ProgressBar.tsx, src/components/SetupWizard.tsx
Removed system update/telemetry features from DoneStep. Updated ProgressBar to reflect new Security and Telegram steps. Added CredentialsStep to SetupWizard with refactored completion handling via POST endpoint.
Library & Configuration
src/lib/gateway-proxy.ts, src/lib/updater.ts
Exported getGatewayToken for reuse in gateway route. Updated token injection to use localStorage instead of DOM. Added VNC install step to UPDATE_STEPS with openclaw target satisfaction logic.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Browser
    participant NextApp as Next.js App
    participant SetupAPI as Setup API
    participant Prefs as Preferences (SQLite)
    participant Gateway as OpenClaw Gateway

    User->>Browser: Navigate to /
    Browser->>NextApp: GET /
    NextApp->>SetupAPI: Check /setup-api/setup/status
    alt setup_complete = false
        SetupAPI-->>NextApp: setup incomplete
        NextApp->>Browser: Redirect to /setup
    else setup_complete = true
        SetupAPI-->>NextApp: setup complete
        NextApp->>SetupAPI: GET /setup-api/preferences?all=1
        SetupAPI->>Prefs: Fetch UI state (wallpaper, apps, windows, icons)
        Prefs-->>SetupAPI: Return persisted state
        SetupAPI-->>NextApp: Return preferences
        NextApp->>Browser: Render ChromeDesktop with apps, windows, shelf, launcher
        User->>Browser: Interact with desktop (drag, open apps, resize windows)
        Browser->>NextApp: POST /setup-api/preferences (debounced)
        NextApp->>Prefs: Persist icon positions, app state, wallpaper
    end
Loading
sequenceDiagram
    participant Install as install.sh
    participant GatewayPre as gateway-pre-start.sh
    participant ConfigFile as openclaw.json
    participant CLI as openclaw CLI
    participant Service as clawbox-gateway.service

    Install->>Install: Set gateway.bind=lan
    Install->>Install: Delete agents.defaults.tools/systemPromptSuffix
    Install->>Service: Update ExecStart with --bind lan --token clawbox
    Service->>GatewayPre: Run pre-start hook
    GatewayPre->>ConfigFile: Check if config exists
    alt Config exists
        GatewayPre->>ConfigFile: Python: Remove invalid keys from agents.defaults
        GatewayPre->>ConfigFile: Python: Fix gateway.bind if needed
    end
    GatewayPre->>CLI: Set gateway.controlUi.allowedOrigins
    GatewayPre->>CLI: Set gateway.bind=lan
    GatewayPre->>CLI: Set gateway.auth.mode=token
    GatewayPre->>CLI: Set gateway.auth.token=clawbox
    GatewayPre-->>Service: Config ready
    Service->>Service: Start openclaw gateway with --bind lan --token clawbox
Loading
sequenceDiagram
    participant Node as Node.js Server
    participant Instr as instrumentation.ts
    participant InstrNode as instrumentation-node.ts
    participant TermServer as terminal-server.ts (child)
    participant NPX as npx/tsx

    Node->>Instr: Server initialization
    Instr->>InstrNode: Dynamic require & startTerminalServer()
    InstrNode->>InstrNode: Determine TERMINAL_WS_PORT (default 3006)
    InstrNode->>InstrNode: HTTP request to detect running server
    alt Server already running
        InstrNode->>Instr: Log & return
    else Server not running
        InstrNode->>InstrNode: Terminate any stale child (SIGTERM)
        InstrNode->>NPX: Spawn tsx terminal-server.ts
        NPX->>TermServer: Start with TERMINAL_WS_PORT env
        TermServer-->>NPX: Listen on WebSocket port
        NPX-->>InstrNode: Child process started
        InstrNode->>InstrNode: Attach exit/error handlers
        InstrNode->>Instr: Terminal server ready
    end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

Suggested labels

enhancement

Poem

🐰 A desktop springs forth from the setup's old nest,
With windows and shelves, now prettily dressed,
VNC connects, the gateway glows true,
Token auth guards what the browser can do,
ClawBox hops forward—LAN-bound and free! 🎉

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch clawbox-ui
📝 Coding Plan
  • Generate coding plan for human review comments

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions

github-actions Bot commented Mar 18, 2026

Copy link
Copy Markdown

✅ Test Report

  • Result: passed

View run

yalexx and others added 5 commits March 18, 2026 15:58
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Remove DoneStep from wizard — completing/skipping Telegram marks setup
  complete and redirects to desktop UI
- Setup wizard now 5 steps: WiFi, Update, Security, AI Model, Telegram
- Center setup cards vertically on desktop

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…s check

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add loading spinner to UpdateStep while checking for updates
- Show "System Up to Date" with green indicator when on latest version
- Fix OpenClaw version comparison (includes vs exact match)
- Fix double "v" prefix in sidebar version display
- Move update modal to top-level so it works from any settings tab
- Add Discord Community link to About section
- Use real version in About instead of hardcoded v2.2.3
- Remove /boot/efi from storage, interfaces from Network, network/processes from System
- Default wallpaper opacity to 50%

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@yalexx

yalexx commented Mar 20, 2026

Copy link
Copy Markdown
Collaborator Author

@CodeRabbit

@yalexx

yalexx commented Mar 20, 2026

Copy link
Copy Markdown
Collaborator Author

@CodeRabbit review

@coderabbitai

coderabbitai Bot commented Mar 20, 2026

Copy link
Copy Markdown

Tip

For best results, initiate chat on the files or code changes.

@yalexx, it looks like your comment might be incomplete! 😊 How can I help you with this PR? Here are some things I can do:

  • Review the PR — trigger a fresh review of the changes
  • Answer questions — about the code, architecture, or implementation details
  • Generate code — suggest fixes, improvements, or new features
  • Create issues — log follow-up tasks or bugs

Let me know what you need!


🧠 Learnings used
Learnt from: CR
Repo: ID-Robots/clawbox PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-02-15T10:14:49.645Z
Learning: ClawBox is optimized for local edge deployment on NVIDIA Jetson with no external dependencies and fully offline capability

@coderabbitai

coderabbitai Bot commented Mar 20, 2026

Copy link
Copy Markdown
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@yalexx yalexx closed this Mar 20, 2026
yalexx added a commit that referenced this pull request Sep 6, 2026
…740)

* security: close the CodeRabbit deep-scan findings that still hold on beta

The 2026-09-05 scan of main reported 23 findings; each was re-verified against
beta before anything changed. Five were already fixed on beta (#1 #2 #5 #8
#18), three are the appliance's documented design (#3 #13 #15), two need a
design decision rather than a patch (#12 the self-updating root steps, #16
system_power via the bearer) and are deferred with their designs written up.
This closes the rest:

- #21/#8: root units (clawbox-ap, ap-watchdog, the NM failover hook,
  first-boot VNC, recover) run the root-owned /usr/local/libexec/clawbox
  copies and load /etc/clawbox/network.env, never the clawbox-owned tree;
  clawbox-heartbeat runs as User=clawbox; a class-wide test pins the rule.
- #11: the Files API refuses to rename or delete a protected container
  (data/, the checkout, ~/.config, the browse root) — protected_container.
- #19: the MCP path guard judges the canonical path (nearest existing
  ancestor) as well as the typed one, and the file tools open the vetted
  target with O_NOFOLLOW.
- #17: the webapp document carries a sandbox CSP wherever it is opened
  (shipped through next.config.ts, since a route header is dropped in
  production), and installed_* preference writes are owner-only.
- #20/#22: clawkeep restore derives every destination on the box and refuses
  the manifest's before anything moves; link members must resolve inside the
  staging root; restore/unpair/snapshot/encryption/reset-state are owner-only
  and same-origin.
- #7: CF-Connecting-IP and its siblings are stripped unless the socket peer is
  loopback (cloudflared's), so a LAN client cannot pick its lockout bucket.
- #4: regex code search is gone (400 regex_unsupported).
- #6: uploads are bounded by a free-space reserve with busboy limits and
  partials unlinked; the attachments route gets the same teardown deferral.
- #14: the Kokoro/Whisper sockets are 0600 with SO_PEERCRED, and Kokoro's
  output path is confined to a .wav regular file under /tmp.
- #9 (part): the MCP server scrubs CLAWBOX_MCP_TOKEN from its environment at
  startup; allow_dangerous is documented as a typo override, not consent.
- #10: issue-triage/pr-review validate the model's JSON on both transports,
  derive labels from fixed tables and sanitise comment text.
- #23: e2e-install writes repository secrets only off pull_request events.
- #1/#5 residuals: setup/complete checks the session in-handler; the
  middleware matcher no longer skips /fonts/ and /images/.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SuyrrYnKgrUkBXECWqW1gb

* fix: vouch for the path at the two sinks CodeQL flagged

The multipart cleanup unlinked paths whose containment check governed the
write inside the promise, not the catch block; and the dangling-link resolver
lstat/readlink'd a name straight off the caller's path. Both now resolve and
prefix-check right before the call, the shape safePath already uses
(js/path-injection alerts 519-521).

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SuyrrYnKgrUkBXECWqW1gb

* fix: address CodeRabbit's review of the security sweep

- e2e-install: the one job names its Environment by event (e2e-credentials
  off pull_request, an empty e2e-pull-request on one), documented for the
  owner; the schema strip for the SDK transport is schema-aware and covers
  Anthropic's whole unsupported set, and the local validator refuses any
  constraint it cannot check so no cap is silently unenforced.
- clawkeep: a Hermes sessions asset that omits sqlite still retires the
  sidecars (the box's own flag wins); OPENCLAW_STATE_DIR placeholders count as
  unset; the no-state fallback matches both CLI message forms, with one shared
  recorded-CLI fixture.
- install.sh: a libexec copy that did not land is never a success —
  collected, recorded as root_libexec, and the units that name the copies are
  not written over it.
- root-unit tests parse User= (User=root is root) and refuse /home/clawbox
  anywhere in a directive value; the code search route refuses a non-string
  pattern; notebook_edit has its symlink regression case.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SuyrrYnKgrUkBXECWqW1gb

* test: give the libexec test in root-steps both ceilings

It runs install_root_libexec under a real bash, and the timeout-hygiene rule
(test-timeout-hygiene.test.ts) asks every spawning suite for a declared
testTimeout and hookTimeout — the one CI failure on the previous commit.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SuyrrYnKgrUkBXECWqW1gb

---------

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant