@flame0510/project-aether 1.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +150 -0
- package/agent-templates/README.md +37 -0
- package/agent-templates/argus/AGENTS.md +52 -0
- package/agent-templates/argus/IDENTITY.md +7 -0
- package/agent-templates/argus/MEMORY.md +9 -0
- package/agent-templates/argus/SOUL.md +24 -0
- package/agent-templates/argus/TOOLS.md +8 -0
- package/agent-templates/atlas/AGENTS.md +47 -0
- package/agent-templates/atlas/HEARTBEAT.md +10 -0
- package/agent-templates/atlas/IDENTITY.md +6 -0
- package/agent-templates/atlas/MEMORY.md +9 -0
- package/agent-templates/atlas/SOUL.md +21 -0
- package/agent-templates/atlas/TOOLS.md +4 -0
- package/agent-templates/base-image/.trigger +0 -0
- package/agent-templates/base-image/Dockerfile +90 -0
- package/agent-templates/base-image/entrypoint.sh +37 -0
- package/agent-templates/custom/AGENTS.md +29 -0
- package/agent-templates/custom/BOOTSTRAP.md +56 -0
- package/agent-templates/custom/MEMORY.md +8 -0
- package/agent-templates/prometheus/AGENTS.md +37 -0
- package/agent-templates/prometheus/IDENTITY.md +6 -0
- package/agent-templates/prometheus/MEMORY.md +9 -0
- package/agent-templates/prometheus/SOUL.md +21 -0
- package/agent-templates/prometheus/TOOLS.md +4 -0
- package/app/agents/ChannelManager.tsx +465 -0
- package/app/agents/ImageDownloadBanner.tsx +159 -0
- package/app/agents/PageClient.tsx +1285 -0
- package/app/agents/create/PageClient.tsx +437 -0
- package/app/agents/create/page.tsx +126 -0
- package/app/agents/loading.tsx +14 -0
- package/app/agents/page.tsx +5 -0
- package/app/api/agents/[id]/backup/route.ts +169 -0
- package/app/api/agents/[id]/channels/pairing/route.ts +69 -0
- package/app/api/agents/[id]/channels/route.ts +14 -0
- package/app/api/agents/[id]/channels/telegram/route.ts +50 -0
- package/app/api/agents/[id]/lifecycle/route.ts +94 -0
- package/app/api/agents/[id]/recreate/route.ts +199 -0
- package/app/api/agents/[id]/restart/route.ts +33 -0
- package/app/api/agents/[id]/restore/route.ts +81 -0
- package/app/api/agents/[id]/route.ts +280 -0
- package/app/api/agents/channels-summary/route.ts +39 -0
- package/app/api/agents/config-json/route.ts +58 -0
- package/app/api/agents/create/route.ts +488 -0
- package/app/api/agents/download-image/route.ts +32 -0
- package/app/api/agents/image-status/route.ts +126 -0
- package/app/api/agents/route.ts +213 -0
- package/app/api/agents/token/route.ts +94 -0
- package/app/api/agents-active/route.ts +190 -0
- package/app/api/agents-config/route.ts +629 -0
- package/app/api/alerts/smoke/route.ts +26 -0
- package/app/api/aliases/add/route.ts +28 -0
- package/app/api/aliases/remove/route.ts +27 -0
- package/app/api/assistant/route.ts +204 -0
- package/app/api/auth/check/route.ts +38 -0
- package/app/api/auth/login/route.ts +85 -0
- package/app/api/auth/logout/route.ts +7 -0
- package/app/api/auth/status/route.ts +33 -0
- package/app/api/config/env/route.ts +132 -0
- package/app/api/config/restart/route.ts +26 -0
- package/app/api/containers/route.ts +75 -0
- package/app/api/cost-override/route.ts +46 -0
- package/app/api/costs/route.ts +84 -0
- package/app/api/credentials/[id]/reveal/route.ts +21 -0
- package/app/api/credentials/[id]/route.ts +52 -0
- package/app/api/credentials/[id]/sync/route.ts +58 -0
- package/app/api/credentials/detect/route.ts +246 -0
- package/app/api/credentials/route.ts +33 -0
- package/app/api/crons/[id]/route.ts +69 -0
- package/app/api/crons/route.ts +12 -0
- package/app/api/crons/runs/route.ts +31 -0
- package/app/api/debug/route.ts +11 -0
- package/app/api/envcheck/route.ts +18 -0
- package/app/api/events/route.ts +24 -0
- package/app/api/gateway/agent/route.ts +154 -0
- package/app/api/gateway/provider/balance/route.ts +38 -0
- package/app/api/gateway/provider/keys.ts +38 -0
- package/app/api/gateway/provider/oauth/route.ts +304 -0
- package/app/api/gateway/provider/route.ts +209 -0
- package/app/api/gateway/route.ts +223 -0
- package/app/api/gateway/sync.ts +189 -0
- package/app/api/lineage/route.ts +54 -0
- package/app/api/memory-context/route.ts +15 -0
- package/app/api/metrics/route.ts +35 -0
- package/app/api/models/route.ts +77 -0
- package/app/api/plugins/route.js +37 -0
- package/app/api/provider/upstream.ts +142 -0
- package/app/api/provider/v1/chat/completions/route.ts +146 -0
- package/app/api/provider/v1/models/route.ts +167 -0
- package/app/api/provider-usage/route.ts +629 -0
- package/app/api/session/route.ts +39 -0
- package/app/api/sessions/[id]/route.ts +38 -0
- package/app/api/sessions/route.ts +23 -0
- package/app/api/setup/agent-image/route.ts +102 -0
- package/app/api/setup/password/route.ts +111 -0
- package/app/api/setup/restart/route.ts +76 -0
- package/app/api/skills/delete/route.js +105 -0
- package/app/api/skills/promote/route.js +129 -0
- package/app/api/skills/route.js +203 -0
- package/app/api/skills/save/route.js +142 -0
- package/app/api/stats/route.ts +34 -0
- package/app/api/stats-since/route.ts +20 -0
- package/app/api/stream/route.ts +70 -0
- package/app/api/system-health/route.ts +233 -0
- package/app/api/tool-calls/route.ts +24 -0
- package/app/api/tools-config/route.ts +163 -0
- package/app/api/update-check/route.ts +127 -0
- package/app/api/version/route.ts +25 -0
- package/app/api/wizard/complete/route.ts +32 -0
- package/app/api/wizard/reset/route.ts +28 -0
- package/app/api/wizard/status/route.ts +28 -0
- package/app/api/workspace/route.ts +392 -0
- package/app/api/workspace/stream/route.ts +136 -0
- package/app/components/AppShell.tsx +33 -0
- package/app/components/AuthGuard.tsx +91 -0
- package/app/components/CostBreakdown.tsx +37 -0
- package/app/components/DashboardHeader.tsx +73 -0
- package/app/components/DashboardLayout.tsx +76 -0
- package/app/components/DashboardToolbar.tsx +61 -0
- package/app/components/FloatingActions.tsx +33 -0
- package/app/components/Icons.tsx +78 -0
- package/app/components/LineageGraphPage.tsx +142 -0
- package/app/components/LiveFeed.tsx +48 -0
- package/app/components/MobileBottomNav.tsx +84 -0
- package/app/components/ModelPickerModal.tsx +94 -0
- package/app/components/PasswordInput.tsx +86 -0
- package/app/components/PulseChat.tsx +362 -0
- package/app/components/Rev4aLoader.tsx +48 -0
- package/app/components/SessionDrawer.tsx +263 -0
- package/app/components/SessionTopology.tsx +289 -0
- package/app/components/Sidebar.tsx +294 -0
- package/app/components/Skeleton.tsx +133 -0
- package/app/components/SystemCockpit.tsx +169 -0
- package/app/components/VersionBanner.tsx +105 -0
- package/app/components/WizardButton.tsx +30 -0
- package/app/components/ui/Badge.tsx +30 -0
- package/app/components/ui/Button.tsx +59 -0
- package/app/components/ui/ConfirmModal.tsx +46 -0
- package/app/components/ui/FilterBar.tsx +33 -0
- package/app/components/ui/Input.tsx +25 -0
- package/app/components/ui/ItemList.tsx +83 -0
- package/app/components/ui/LoadingSpinner.tsx +30 -0
- package/app/components/ui/Metric.tsx +22 -0
- package/app/components/ui/Modal.tsx +42 -0
- package/app/components/ui/Page.tsx +18 -0
- package/app/components/ui/Pill.tsx +6 -0
- package/app/components/ui/PropertyList.tsx +24 -0
- package/app/components/ui/Select.tsx +26 -0
- package/app/components/ui/StatusCard.tsx +32 -0
- package/app/components/ui/Surface.tsx +14 -0
- package/app/components/ui/Tabs.tsx +55 -0
- package/app/components/ui/TemplateOption.tsx +59 -0
- package/app/components/ui/Toast.tsx +44 -0
- package/app/components/ui/index.ts +19 -0
- package/app/components/ui/tokens.ts +18 -0
- package/app/config/PageClient.tsx +293 -0
- package/app/config/loading.tsx +10 -0
- package/app/config/page.tsx +7 -0
- package/app/containers/ContainersClient.tsx +129 -0
- package/app/containers/loading.tsx +21 -0
- package/app/containers/page.tsx +5 -0
- package/app/containers/terminal/[id]/TerminalClient.tsx +313 -0
- package/app/containers/terminal/[id]/page.tsx +6 -0
- package/app/credentials/PageClient.tsx +598 -0
- package/app/credentials/loading.tsx +10 -0
- package/app/credentials/page.tsx +7 -0
- package/app/crons/PageClient.tsx +538 -0
- package/app/crons/loading.tsx +10 -0
- package/app/crons/page.tsx +5 -0
- package/app/design-system.ts +57 -0
- package/app/gateway/PageClient.tsx +1048 -0
- package/app/gateway/loading.tsx +24 -0
- package/app/gateway/page.tsx +5 -0
- package/app/globals.css +1474 -0
- package/app/layout.tsx +45 -0
- package/app/lib/models-context.tsx +41 -0
- package/app/lineage/loading.tsx +10 -0
- package/app/lineage/page.tsx +13 -0
- package/app/loading.tsx +16 -0
- package/app/login/page.tsx +160 -0
- package/app/memory/MemoryContextPageClient.tsx +196 -0
- package/app/memory/loading.tsx +10 -0
- package/app/memory/page.tsx +8 -0
- package/app/page.tsx +31 -0
- package/app/plugins/PageClient.tsx +296 -0
- package/app/plugins/loading.tsx +10 -0
- package/app/plugins/page.tsx +5 -0
- package/app/setup/PageClient.tsx +227 -0
- package/app/setup/loading.tsx +21 -0
- package/app/setup/page.tsx +7 -0
- package/app/skills/PageClient.tsx +499 -0
- package/app/skills/loading.tsx +10 -0
- package/app/skills/page.tsx +5 -0
- package/app/tools/ToolsPageClient.tsx +308 -0
- package/app/tools/loading.tsx +10 -0
- package/app/tools/page.tsx +62 -0
- package/app/tools/tools-catalog.ts +141 -0
- package/app/wizard/PageClient.tsx +485 -0
- package/app/wizard/icons.tsx +89 -0
- package/app/wizard/loading.tsx +24 -0
- package/app/wizard/page.tsx +7 -0
- package/app/wizard/storage.ts +33 -0
- package/app/wizard/useWizard.ts +101 -0
- package/app/workspace/WorkspaceClient.tsx +633 -0
- package/app/workspace/loading.tsx +36 -0
- package/app/workspace/page.tsx +8 -0
- package/bin/docker-entrypoint.sh +21 -0
- package/bin/postinstall.js +20 -0
- package/bin/rev4a.js +696 -0
- package/daemon.js +783 -0
- package/docs/ARCHITECTURE.md +557 -0
- package/docs/CONTAINER-TERMINAL.md +280 -0
- package/docs/DESIGN-SYSTEM.md +99 -0
- package/docs/FRONTEND-ARCHITECTURE.md +119 -0
- package/docs/REV4A.md +504 -0
- package/docs/dev/API-REFERENCE.md +1835 -0
- package/docs/dev/DATABASE.md +224 -0
- package/docs/dev/GATEWAY.md +300 -0
- package/docs/dev/PROVIDERS.md +229 -0
- package/docs/dev/SESSION-MAINTENANCE-PLAN.md +607 -0
- package/docs/dev/WORKSPACE.md +199 -0
- package/docs/rag/DATA-FRESHNESS.md +109 -0
- package/docs/rag/GLOSSARY.md +125 -0
- package/docs/rag/REV4A-OVERVIEW.md +135 -0
- package/docs/rag/WHAT-I-CAN-ANSWER.md +124 -0
- package/lib/agent-setup.ts +130 -0
- package/lib/alerts.ts +115 -0
- package/lib/apiFetch.ts +7 -0
- package/lib/auth.ts +28 -0
- package/lib/billing.ts +100 -0
- package/lib/buildAgentImage.ts +346 -0
- package/lib/channelManager.ts +386 -0
- package/lib/container.ts +60 -0
- package/lib/credentials/db.ts +86 -0
- package/lib/credentials/delivery.ts +448 -0
- package/lib/credentials/detect.ts +149 -0
- package/lib/credentials/hash.ts +9 -0
- package/lib/credentials/providers.ts +110 -0
- package/lib/credentials/vault.ts +195 -0
- package/lib/db-bootstrap.d.ts +3 -0
- package/lib/db-bootstrap.mjs +144 -0
- package/lib/db.ts +25 -0
- package/lib/docker-utils.ts +60 -0
- package/lib/hooks/useDashboard.ts +264 -0
- package/lib/hooks/useRev4aTimezone.ts +28 -0
- package/lib/hooks/useScreenshot.ts +30 -0
- package/lib/memory-context.ts +385 -0
- package/lib/model-catalogue.ts +131 -0
- package/lib/model-pricing.ts +63 -0
- package/lib/openclaw-cron.ts +350 -0
- package/lib/patterns/ApiAdapter.ts +73 -0
- package/lib/patterns/ApiClient.ts +65 -0
- package/lib/patterns/EventBus.ts +113 -0
- package/lib/patterns/FilterStrategy.ts +79 -0
- package/lib/patterns/SessionFactory.ts +117 -0
- package/lib/patterns/sessionPresentation.ts +117 -0
- package/lib/provider-balance.ts +163 -0
- package/lib/requireAuth.tsx +38 -0
- package/lib/rev4a-auth.d.ts +3 -0
- package/lib/rev4a-auth.js +36 -0
- package/lib/rev4a-paths.ts +145 -0
- package/lib/timezone.ts +46 -0
- package/lib/types/index.ts +96 -0
- package/lib/utils/format.ts +82 -0
- package/lineage.js +56 -0
- package/model-pricing.json +482 -0
- package/models.config.json +844 -0
- package/next-env.d.ts +6 -0
- package/next.config.mjs +7 -0
- package/package.json +82 -0
- package/public/apple-touch-icon.png +0 -0
- package/public/favicon-64.png +0 -0
- package/public/favicon.svg +58 -0
- package/public/icon-192-maskable.png +0 -0
- package/public/icon-192.png +0 -0
- package/public/icon-512-maskable.png +0 -0
- package/public/icon-512.png +0 -0
- package/public/manifest.json +38 -0
- package/public/rev4a-logo.png +0 -0
- package/public/rev4a-logo.svg +58 -0
- package/rev4a-rules/AGENTS.md +37 -0
- package/scripts/add-auth.cjs +185 -0
- package/scripts/backup.sh +66 -0
- package/scripts/check-providers.mjs +143 -0
- package/scripts/docker/traefik/docker-compose.yml +32 -0
- package/scripts/docker/traefik/dynamic/.gitkeep +18 -0
- package/scripts/docker/traefik/traefik.yml +37 -0
- package/scripts/remove-auth-profile.js +56 -0
- package/scripts/restore.sh +82 -0
- package/terminal-ws-server.js +139 -0
- package/tsconfig.json +42 -0
package/docs/REV4A.md
ADDED
|
@@ -0,0 +1,504 @@
|
|
|
1
|
+
# Rev4a — VPS Dashboard
|
|
2
|
+
|
|
3
|
+
> **Last updated:** 2026-07-27
|
|
4
|
+
|
|
5
|
+
A Next.js 16 dashboard for monitoring and managing the OpenClaw ecosystem.
|
|
6
|
+
|
|
7
|
+
**URL:** `http://<vps-ip>:3740` (or behind a reverse proxy of your choice)
|
|
8
|
+
**Port:** 3740
|
|
9
|
+
**Process manager:** `rev4a serve` (single command). Production: systemd service (`rev4a.service`).
|
|
10
|
+
**Repository:** `github.com/Flame0510/rev4a.git` (branch: `main`)
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## Overview
|
|
15
|
+
|
|
16
|
+
| Field | Value |
|
|
17
|
+
|---|---|
|
|
18
|
+
| VPS IP | `187.77.156.41` |
|
|
19
|
+
| OS | Ubuntu 24.04.4 LTS |
|
|
20
|
+
| Resources | 4 CPU, 15 GB RAM, 193 GB disk |
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## Architecture
|
|
26
|
+
|
|
27
|
+
```
|
|
28
|
+
Internet
|
|
29
|
+
│
|
|
30
|
+
┌────┴────┐
|
|
31
|
+
│ Traefik │ (Docker container, host network)
|
|
32
|
+
│ :443 │
|
|
33
|
+
└────┬────┘
|
|
34
|
+
│
|
|
35
|
+
┌──────────┴──────────┐
|
|
36
|
+
│ rev4a │
|
|
37
|
+
│ systemd (rev4a.service) │
|
|
38
|
+
│ :3740 │
|
|
39
|
+
│ Next.js 16 │
|
|
40
|
+
└─────────────────────┘
|
|
41
|
+
│
|
|
42
|
+
┌─────────────┴─────────────┐
|
|
43
|
+
│ │
|
|
44
|
+
docker exec / API docker exec / API
|
|
45
|
+
│ │
|
|
46
|
+
┌──────┴──────┐ ┌────────┴────────┐
|
|
47
|
+
│ openclaw-core│ │ openclaw-atlas │
|
|
48
|
+
│ :3700-3708 │ │ :3731 → 3000 │
|
|
49
|
+
│ AGENT_ID=core│ │ AGENT_ID=atlas │
|
|
50
|
+
└──────────────┘ └─────────────────┘
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### Environment
|
|
54
|
+
|
|
55
|
+
Rev4a reads the following environment variables. Set them in `/config` (UI) or directly in `.env`.
|
|
56
|
+
|
|
57
|
+
| Variable | Required | Description |
|
|
58
|
+
|---|---|---|
|
|
59
|
+
| `REV4A_PASSWORD` | Yes | Login password for the dashboard |
|
|
60
|
+
| `REV4A_TOKEN` | Yes | Token used for programmatic API access |
|
|
61
|
+
| `REV4A_JWT_SECRET` | Yes | Secret used to sign session JWT tokens |
|
|
62
|
+
| `REV4A_DB` | No | Path to the events database (default: `data/events.db`) |
|
|
63
|
+
| `REV4A_WORKSPACE_ROOT` | No | Filesystem path for the local file explorer |
|
|
64
|
+
|
|
65
|
+
## Agent creation
|
|
66
|
+
|
|
67
|
+
Every agent is created with:
|
|
68
|
+
|
|
69
|
+
- A host port mapping (`-p <port>:3000`) for direct access
|
|
70
|
+
- URL format: `http://<host-public-ip>:<port>#token=...`
|
|
71
|
+
- The provider gateway at `http://host.docker.internal:3740/api/provider/v1`
|
|
72
|
+
- `allowedOrigins: ['*']` for browser Control UI access
|
|
73
|
+
|
|
74
|
+
The port is auto-assigned starting from 3000 (or user-specified).
|
|
75
|
+
|
|
76
|
+
Domain and HTTPS routing (Traefik) is an external concern — operators can
|
|
77
|
+
configure it on top of the base setup if needed, but Rev4a does not couple
|
|
78
|
+
to any specific reverse proxy.
|
|
79
|
+
|
|
80
|
+
## Config persistence
|
|
81
|
+
|
|
82
|
+
When environment variables are saved via the Config page (Save & Restart):
|
|
83
|
+
|
|
84
|
+
1. Values are written to `.env` in the project root
|
|
85
|
+
2. Secrets are loaded via `EnvironmentFile=` pointing to `.env` (chmod 600). Only non-secret vars (`NODE_ENV`, `PATH`, `REV4A_DB`) are in the unit file. Other vars (passwords, non-Rev4a keys) stay in `.env` for the application to read at runtime.
|
|
86
|
+
3. `systemctl daemon-reload` is run
|
|
87
|
+
4. The server restarts with the new environment
|
|
88
|
+
|
|
89
|
+
## Components
|
|
90
|
+
|
|
91
|
+
- **Rev4a:** Next.js app serving the dashboard UI and REST API. Reads Docker state, container configs, and agent workspaces via `docker exec` and `fs` calls.
|
|
92
|
+
- **Traefik:** External reverse proxy (optional). Rev4a does not depend on it — operators can use any reverse proxy or none at all.
|
|
93
|
+
- **OpenClaw agents:** Docker containers with `AGENT_ID` label. Rev4a discovers them dynamically via `docker ps`.
|
|
94
|
+
|
|
95
|
+
---
|
|
96
|
+
|
|
97
|
+
## Pages
|
|
98
|
+
|
|
99
|
+
| Route | Description |
|
|
100
|
+
|---|---|
|
|
101
|
+
| `/dashboard` | System overview — containers, resources, quick links |
|
|
102
|
+
| `/agents` | Running agents (Docker containers with `AGENT_ID`), gateway token management, agent creation wizard, channel manager (Telegram pairing) |
|
|
103
|
+
| `/containers` | All Docker containers on the host |
|
|
104
|
+
| `/onboarding` | First-run setup wizard (Welcome → Providers → Agent → Ready) |
|
|
105
|
+
| `/workspace` | File explorer with tree view + editor — VPS host or container workspaces |
|
|
106
|
+
| `/lineage` | Agent lineage / orchestration tree |
|
|
107
|
+
| `/memory` | Agent memory browser |
|
|
108
|
+
| `/crons` | Scheduled cron jobs — auto-discovered from the host gateway and every running agent container (Docker containers with `AGENT_ID` label), on/off toggle, run history per job |
|
|
109
|
+
| `/credentials` | Third-party tool credentials (GitHub, Trello, Vercel, Supabase) — JSON vault with audit trail, sync to agent containers via CLI auth (gh, vercel, supabase) or env files (trello) |
|
|
110
|
+
| `/plugins` | Plugin manager |
|
|
111
|
+
| `/plugins-skills` | Plugin skills |
|
|
112
|
+
| `/skills` | Skill registry — browse/edit all skills (shared, per-agent workspace, bundled). Promote agent skills to shared with one click. |
|
|
113
|
+
| `/tools` | Tool configuration |
|
|
114
|
+
| `/gateway` | LLM provider sync + agent model configuration — see [GATEWAY.md](dev/GATEWAY.md) |
|
|
115
|
+
| `/config` | Environment management and server restart |
|
|
116
|
+
| `/vault` | Credential storage (per-agent permissions) — see [PROVIDERS.md](dev/PROVIDERS.md) |
|
|
117
|
+
| `/login` | Authentication page |
|
|
118
|
+
|
|
119
|
+
---
|
|
120
|
+
|
|
121
|
+
## Authentication
|
|
122
|
+
|
|
123
|
+
Rev4a uses password-based login with JWT cookies.
|
|
124
|
+
|
|
125
|
+
**Env vars:**
|
|
126
|
+
```
|
|
127
|
+
REV4A_PASSWORD=*** # Login password
|
|
128
|
+
REV4A_TOKEN=*** # API token (Bearer / query param / x-agent-token)
|
|
129
|
+
REV4A_JWT_SECRET=*** # Secret for signing JWTs
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
**Auth flow:**
|
|
133
|
+
1. User visits `/login`, enters password
|
|
134
|
+
2. POST `/api/auth/login` validates password, returns a `rev4a_token` cookie (JWT, 7-day expiry)
|
|
135
|
+
3. All subsequent API calls use the cookie (`credentials: 'same-origin'`)
|
|
136
|
+
4. API-only auth fallbacks: `Authorization: Bearer <token>`, `?token=<token>`, or `x-agent-token` header
|
|
137
|
+
5. Control UI bootstrap links should use `#token=<token>` so the browser client can import the shared secret before opening the socket
|
|
138
|
+
|
|
139
|
+
---
|
|
140
|
+
|
|
141
|
+
## Service Management
|
|
142
|
+
|
|
143
|
+
```bash
|
|
144
|
+
# Start
|
|
145
|
+
sudo systemctl start rev4a.service
|
|
146
|
+
|
|
147
|
+
# Stop
|
|
148
|
+
sudo systemctl stop rev4a.service
|
|
149
|
+
|
|
150
|
+
# Restart
|
|
151
|
+
sudo systemctl restart rev4a.service
|
|
152
|
+
|
|
153
|
+
# Status
|
|
154
|
+
sudo systemctl status rev4a.service
|
|
155
|
+
|
|
156
|
+
# Logs (follow)
|
|
157
|
+
sudo journalctl -u rev4a -f
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
### Systemd environment override
|
|
161
|
+
|
|
162
|
+
File: `/etc/systemd/system/rev4a-next.service` (EnvironmentFile)
|
|
163
|
+
|
|
164
|
+
```ini
|
|
165
|
+
[Service]
|
|
166
|
+
Environment=REV4A_PASSWORD=***
|
|
167
|
+
Environment=REV4A_TOKEN=***
|
|
168
|
+
Environment=REV4A_JWT_SECRET=***
|
|
169
|
+
Environment=REV4A_DB=/path/to/rev4a/data/events.db
|
|
170
|
+
Environment=OPENCLAW_CONFIG_PATH=/path/to/openclaw-core.json
|
|
171
|
+
Environment=SHARED_CONTEXT_DIR=/path/to/shared-context
|
|
172
|
+
Environment=NODE_ENV=production
|
|
173
|
+
Environment=NEXT_TELEMETRY_DISABLED=1
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
---
|
|
177
|
+
|
|
178
|
+
## Build & Deploy
|
|
179
|
+
|
|
180
|
+
```bash
|
|
181
|
+
cd /path/to/'rev4a'
|
|
182
|
+
|
|
183
|
+
# One command (builds + starts):
|
|
184
|
+
rev4a serve
|
|
185
|
+
|
|
186
|
+
# Manual build:
|
|
187
|
+
npm run build
|
|
188
|
+
|
|
189
|
+
# Full rebuild:
|
|
190
|
+
rm -rf .next && npm run build
|
|
191
|
+
|
|
192
|
+
# Production systemd (after setup script):
|
|
193
|
+
sudo systemctl start rev4a.service
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
> **Important:** API routes (`route.ts`) are compiled at build time by Next.js. After editing any API route, a full `npm run build` is required. Restarting the server alone is not enough.
|
|
197
|
+
|
|
198
|
+
---
|
|
199
|
+
|
|
200
|
+
## Workspace API (`/api/workspace`)
|
|
201
|
+
|
|
202
|
+
The workspace feature provides a file tree explorer + editor for both the VPS host and container workspaces.
|
|
203
|
+
|
|
204
|
+
### Parameters
|
|
205
|
+
|
|
206
|
+
| Method | Parameters | Description |
|
|
207
|
+
|---|---|---|
|
|
208
|
+
| `GET` | `?action=list` | List available workspaces |
|
|
209
|
+
| `GET` | `?workspace=vps` | List root files in VPS host workspace |
|
|
210
|
+
| `GET` | `?workspace=vps&path=<dir>` | List files in a directory |
|
|
211
|
+
| `GET` | `?workspace=vps&path=<file>` | Read file content |
|
|
212
|
+
| `PUT` | JSON `{workspace, path, content}` | Write/overwrite file |
|
|
213
|
+
|
|
214
|
+
### Workspaces
|
|
215
|
+
|
|
216
|
+
| ID | Label | Type | Path |
|
|
217
|
+
|---|---|---|---|
|
|
218
|
+
| `vps` | VPS Host (Nexus) | host | `/path/to/workspace/` |
|
|
219
|
+
| `container-<name>` | `<agent_id> (<name>)` | container | `/root/.openclaw/` inside container |
|
|
220
|
+
|
|
221
|
+
Container workspaces are discovered dynamically — any Docker container with an `AGENT_ID` label is listed.
|
|
222
|
+
|
|
223
|
+
### Implementation notes
|
|
224
|
+
|
|
225
|
+
- **Host:** uses `fs.readdirSync`, `fs.readFileSync`, `fs.writeFileSync` — real-time, no caching
|
|
226
|
+
- **Container:** uses `docker exec` with `ls -1Ap`, `test -d`, `cat`, and heredoc writes
|
|
227
|
+
- **Subdirectory expansion:** lazy-loaded via API when the user clicks a directory in the tree
|
|
228
|
+
- **Binary files (images, PDFs):** detected by extension, served as-is or displayed inline
|
|
229
|
+
|
|
230
|
+
---
|
|
231
|
+
|
|
232
|
+
## Features (current)
|
|
233
|
+
|
|
234
|
+
### Vault (`/vault`)
|
|
235
|
+
Store and manage credentials (API keys, tokens) with per-agent permissions.
|
|
236
|
+
|
|
237
|
+
- **SQLite storage:** `credentials.db` in the data directory
|
|
238
|
+
- **Provider keys:** stored in `data/provider-keys.json`, managed via the Gateway UI
|
|
239
|
+
- **Agent permissions:** each credential can be scoped to specific agents
|
|
240
|
+
- **Service management:** add/remove provider API keys and service tokens via the UI
|
|
241
|
+
|
|
242
|
+
### Container management (`/containers`)
|
|
243
|
+
View all running Docker containers with:
|
|
244
|
+
- Name, image, status, ports, uptime
|
|
245
|
+
- Resource usage (CPU, memory)
|
|
246
|
+
- Per-container logs
|
|
247
|
+
- Quick links to agent control UIs
|
|
248
|
+
|
|
249
|
+
### Agent management (`/agents`)
|
|
250
|
+
Lists all agents (Docker containers with `AGENT_ID` label), with:
|
|
251
|
+
- Name, image, template, status, ports, IP
|
|
252
|
+
- TG channel status chip (green = connected, hidden if not configured)
|
|
253
|
+
- **Shared gateway token** — text input with Save & Sync. Changing the token saves it to `data/agents-token.json` and pushes it to all running containers.
|
|
254
|
+
- **Control UI link** — direct Traefik URL with `#token=<token>` hash, reads the token from `agents-token.json` (source of truth), not from the container's local config.
|
|
255
|
+
- **Agent creation wizard** — multi-step form at `/agents/create`.
|
|
256
|
+
- **Channel Manager** — each agent detail panel has a Channels section with Telegram configuration and pairing management.
|
|
257
|
+
|
|
258
|
+
### Agent Creation Wizard (`/agents/create`)
|
|
259
|
+
|
|
260
|
+
**Step 1 — Template:** Select an agent template from `agent-templates/`. Each template is a directory with AGENTS.md, SOUL.md, MEMORY.md, and optionally BOOTSTRAP.md files.
|
|
261
|
+
|
|
262
|
+
Available templates:
|
|
263
|
+
- **Atlas** — general-purpose development agent
|
|
264
|
+
- **Argus** — security and audit agent
|
|
265
|
+
- **Prometheus** — client-facing project delivery agent
|
|
266
|
+
- **Custom** — blank slate. On first run, the agent runs a bootstrap ritual: introduces itself, learns who the user is, and together they define name, personality, tone, and boundaries. The agent writes SOUL.md, IDENTITY.md, and USER.md, then deletes BOOTSTRAP.md. No preset identity, fully user-defined.
|
|
267
|
+
|
|
268
|
+
**Step 2 — Config:** Enter agent name, optional port, select a primary model from the available providers (pre-filtered by configured provider keys). The first model is pre-selected.
|
|
269
|
+
|
|
270
|
+
**Step 3 — Deploy:** `POST /api/agents/create` creates the Docker container and returns the Traefik URL with the shared gateway token.
|
|
271
|
+
|
|
272
|
+
**Post-creation pipeline:**
|
|
273
|
+
1. The container boots with the **openclaw-agent-base:latest** image — see [Agent Templates](#agent-templates) below.
|
|
274
|
+
2. OpenClaw gateway starts automatically with `--allow-unconfigured`, generating its own default config.
|
|
275
|
+
3. The route waits for the gateway to be fully ready (health check poll, up to 60 s).
|
|
276
|
+
4. Once ready, the route writes:
|
|
277
|
+
- `gateway.controlUi.allowedOrigins` — Rev4a dashboard URL + Traefik hostname (required for browser Control UI access)
|
|
278
|
+
- `agents.defaults.model.primary` + fallbacks — the primary model selected in the wizard
|
|
279
|
+
5. `syncAgent(name)` writes `models.providers.rev4a` into the container.
|
|
280
|
+
6. The agent's control UI is immediately accessible at `https://<name>.<your-domain>.com#token=<gateway-token>`.
|
|
281
|
+
|
|
282
|
+
**Key difference from the old pipeline:** the entrypoint no longer generates `openclaw.json`. The bootstrap config (including `controlUi.allowedOrigins`) is written by the create route after the gateway has already started. This eliminates the race condition where the entrypoint would overwrite synced provider config on boot.
|
|
283
|
+
|
|
284
|
+
---
|
|
285
|
+
|
|
286
|
+
## Agent persistence & lifecycle
|
|
287
|
+
|
|
288
|
+
Each agent is created with a **persistent Docker volume** `agent-<name>-data`
|
|
289
|
+
mounted at `/root`. This cleanly separates two planes:
|
|
290
|
+
|
|
291
|
+
- **Software → image.** OpenClaw, `gh`, `vercel`, `supabase`, `trello`, Node — all
|
|
292
|
+
live in `openclaw-agent-base:latest` (outside `/root`). Updated by rebuilding the
|
|
293
|
+
image and recreating the container.
|
|
294
|
+
- **Data → volume.** Config (`openclaw.json`), state DB (`openclaw.sqlite`),
|
|
295
|
+
workspace files, and CLI credentials (`.config/gh`, `.local/share/com.vercel.cli`,
|
|
296
|
+
`.supabase`, …) live in `/root` and survive container removal.
|
|
297
|
+
|
|
298
|
+
On create, template files are copied into the workspace **only if it is empty** —
|
|
299
|
+
a re-created agent keeps the workspace the user edited.
|
|
300
|
+
|
|
301
|
+
**Lifecycle actions** (see [API Reference](dev/API-REFERENCE.md) for endpoints):
|
|
302
|
+
|
|
303
|
+
| Action | What it does |
|
|
304
|
+
|---|---|
|
|
305
|
+
| **Backup** | `tar` of `/root` (excl. npm cache) → `.tar.gz` in the `rev4a-backups` volume |
|
|
306
|
+
| **Restore** | stop → replace `/root` with the backup (real wipe incl. dotfiles) → restart. Software/image untouched — only data goes back in time |
|
|
307
|
+
| **Recreate** | auto-backup first (aborts if it fails) → rebuild from `openclaw-agent-base:latest` keeping the volume → picks up image/OpenClaw/CLI updates |
|
|
308
|
+
| **Restart** | `docker restart`, nothing else |
|
|
309
|
+
| **Delete** | **destructive**: removes container **+ volume + all backups**. Cannot be undone |
|
|
310
|
+
|
|
311
|
+
Version migrations after an image update are handled by the entrypoint (see
|
|
312
|
+
[Entrypoint behavior](#agent-templates)), not by `openclaw update` — updating an
|
|
313
|
+
agent means rebuilding the image + Recreate, never `update` inside the container.
|
|
314
|
+
|
|
315
|
+
---
|
|
316
|
+
|
|
317
|
+
## Agent Templates
|
|
318
|
+
|
|
319
|
+
### Base Image (`openclaw-agent-base:latest`)
|
|
320
|
+
|
|
321
|
+
**Dockerfile:** `agent-templates/base-image/Dockerfile`
|
|
322
|
+
|
|
323
|
+
Built from `node:24-bookworm-slim`, includes:
|
|
324
|
+
- OpenClaw CLI + DeepSeek provider plugin
|
|
325
|
+
- `openssl` (for local token generation)
|
|
326
|
+
- Custom entrypoint `/agent-entrypoint.sh`
|
|
327
|
+
|
|
328
|
+
**Entrypoint behavior:**
|
|
329
|
+
- Resolves the auth token (file > env > local random)
|
|
330
|
+
- Does NOT generate `openclaw.json` — OpenClaw creates its own default config on first boot
|
|
331
|
+
- **Version-gated migration:** if the OpenClaw version differs from the one recorded in `/root/.openclaw/.last-version` (i.e. the image was rebuilt to a newer OpenClaw), runs `openclaw doctor --non-interactive` **before** starting the gateway. This applies only safe migrations (config normalization + on-disk state moves), skips service restarts, and aligns the persistent volume's state/config to the new binary. Best-effort — never blocks boot. Runs at most once per version change, not on every restart.
|
|
332
|
+
- Starts OpenClaw gateway with `--allow-unconfigured`: `openclaw gateway --bind lan --port 3000 --auth token --token "<token>" --allow-unconfigured`
|
|
333
|
+
- Everything else (controlUi, model refs, providers) is handled by the create route and the Gateway sync module
|
|
334
|
+
|
|
335
|
+
### Template directories
|
|
336
|
+
Located in `agent-templates/`. Each subdirectory (e.g. `atlas/`, `custom/`) contains:
|
|
337
|
+
- `AGENTS.md`, `SOUL.md`, `IDENTITY.md`, `MEMORY.md`, `TOOLS.md`, `HEARTBEAT.md`
|
|
338
|
+
- `BOOTSTRAP.md` (optional) — first-run ritual, deleted by the agent when complete
|
|
339
|
+
|
|
340
|
+
At container creation these files are **copied** into `/root/.openclaw/workspace/`
|
|
341
|
+
via `docker cp` (not bind-mounted), so agent edits never spill back to the Rev4a
|
|
342
|
+
repo. The copy is skipped when the workspace is already populated (see
|
|
343
|
+
[Agent persistence](#agent-persistence--lifecycle)).
|
|
344
|
+
|
|
345
|
+
---
|
|
346
|
+
|
|
347
|
+
## Gateway Page (`/gateway`)
|
|
348
|
+
|
|
349
|
+
Two panels:
|
|
350
|
+
|
|
351
|
+
### Provider Sync
|
|
352
|
+
- Reads active models from `models.config.json` (file-based model catalogue)
|
|
353
|
+
- Scans providers with keys in `data/provider-keys.json`
|
|
354
|
+
- `PUT /api/gateway/provider` runs `syncAllAgents()` which writes `models.providers.rev4a` to every agent container
|
|
355
|
+
- **Does NOT touch** `agents.defaults.model` or `agents.list[].model` — model references are managed per-container from the Agents Tab
|
|
356
|
+
|
|
357
|
+
### Agent Model Config
|
|
358
|
+
- Select a container and set its primary model
|
|
359
|
+
- `PUT /api/gateway/agent` writes the model ref (`primary`, `fallbacks`) directly into the container's `openclaw.json`
|
|
360
|
+
- Does NOT restart the gateway — writes are live via file write
|
|
361
|
+
|
|
362
|
+
### Model Catalogue (`models.config.json`)
|
|
363
|
+
File-based, tracked in git. Each entry:
|
|
364
|
+
```json
|
|
365
|
+
{ "id": "deepseek/deepseek-v4-flash", "name": "DeepSeek V4 Flash", "provider": "deepseek", "enabled": true }
|
|
366
|
+
```
|
|
367
|
+
Models with `enabled: false` are ignored.
|
|
368
|
+
Only models whose provider has a key in `data/provider-keys.json` are synced.
|
|
369
|
+
|
|
370
|
+
---
|
|
371
|
+
|
|
372
|
+
## Containers
|
|
373
|
+
|
|
374
|
+
### openclaw-atlas
|
|
375
|
+
|
|
376
|
+
| Property | Value |
|
|
377
|
+
|---|---|
|
|
378
|
+
| Image | `openclaw-agent-base:latest` (Node 24-bookworm-slim + OpenClaw) |
|
|
379
|
+
| Port | `0.0.0.0:3731 → 3000` |
|
|
380
|
+
| IP | `172.19.0.3` |
|
|
381
|
+
| AGENT_ID | `atlas` |
|
|
382
|
+
| Config mount | `/docker/atlas-data/openclaw-fixed.json → /root/.openclaw/openclaw.json` |
|
|
383
|
+
| Auth mode | `token` |
|
|
384
|
+
|
|
385
|
+
**Control UI:** `http://<vps-ip>:3731` — enter the gateway token to log in.
|
|
386
|
+
Rev4a-generated direct links should use `#token=<gateway-token>` for automatic Control UI sign-in.
|
|
387
|
+
|
|
388
|
+
### openclaw-core
|
|
389
|
+
|
|
390
|
+
| Property | Value |
|
|
391
|
+
|---|---|
|
|
392
|
+
| Image | `ghcr.io/hostinger/hvps-openclaw:latest` |
|
|
393
|
+
| Ports | `:3711-3719` (mapped to container `:3700-3708`) |
|
|
394
|
+
| AGENT_ID | `core` |
|
|
395
|
+
|
|
396
|
+
### openclaw-giacomo
|
|
397
|
+
|
|
398
|
+
| Property | Value |
|
|
399
|
+
|---|---|
|
|
400
|
+
| Image | `ghcr.io/hostinger/hvps-openclaw:latest` |
|
|
401
|
+
| Port | `:3730` |
|
|
402
|
+
| AGENT_ID | `giacomo` |
|
|
403
|
+
|
|
404
|
+
### Other containers
|
|
405
|
+
|
|
406
|
+
| Name | Image | Notes |
|
|
407
|
+
|---|---|---|
|
|
408
|
+
| `hermes` | `nousresearch/hermes-agent:latest` | Hermes agent |
|
|
409
|
+
| `hermes-dashboard` | `nousresearch/hermes-agent:latest` | Hermes dashboard |
|
|
410
|
+
| `traefik-traefik-1` | `traefik:latest` | Reverse proxy |
|
|
411
|
+
|
|
412
|
+
---
|
|
413
|
+
|
|
414
|
+
## Key Gotchas
|
|
415
|
+
|
|
416
|
+
1. **`auth.mode: "none"` + `0.0.0.0:3000`** → OpenClaw refuses to bind. Must be `auth.mode: "token"`.
|
|
417
|
+
2. **Control UI password** is the `gateway.auth.token`, not an env var.
|
|
418
|
+
3. **API routes need full build** — after editing `route.ts`, run `npm run build`. Server restart alone is not enough.
|
|
419
|
+
4. **Container directory listing** uses `docker exec` with `ls -1Ap` (single line per entry, trailing `/` on directories). Do NOT use `ls -la` with regex parsing.
|
|
420
|
+
5. **Subdirectory detection** for containers: `docker exec … test -d "$path" && echo YES || echo NO` before deciding to list or read.
|
|
421
|
+
6. **Service worker cache** (`public/sw.js`): if stale versions appear in the browser, delete this file and rebuild. Currently removed.
|
|
422
|
+
7. **Browser cache on workspace page:** the API uses `cache: 'no-store'` but the browser may still cache the rendered page. Use hard refresh (Ctrl/Cmd+Shift+R) or incognito mode to verify.
|
|
423
|
+
|
|
424
|
+
---
|
|
425
|
+
|
|
426
|
+
## Troubleshooting
|
|
427
|
+
|
|
428
|
+
### Workspace shows old files
|
|
429
|
+
1. Hard refresh (Ctrl/Cmd+Shift+R)
|
|
430
|
+
2. Open incognito/private tab
|
|
431
|
+
3. Check API directly: `curl -H "authorization: Bearer <token>" 'http://127.0.0.1:3740/api/workspace?workspace=vps'`
|
|
432
|
+
|
|
433
|
+
### API returns 500
|
|
434
|
+
- For VPS: check file permissions on the workspace path
|
|
435
|
+
- For containers: `docker exec` may fail on certain directories
|
|
436
|
+
|
|
437
|
+
### "Empty workspace"
|
|
438
|
+
- Verify the API returns files (test with curl)
|
|
439
|
+
- Ensure the `workspace` parameter is a valid workspace ID
|
|
440
|
+
|
|
441
|
+
### Old version persists after rebuild
|
|
442
|
+
1. Kill process: `fuser -k 3740/tcp`
|
|
443
|
+
2. Wait 2 seconds
|
|
444
|
+
3. Restart: `sudo systemctl restart rev4a.service`
|
|
445
|
+
4. Check `public/sw.js` exists (delete if so)
|
|
446
|
+
|
|
447
|
+
---
|
|
448
|
+
|
|
449
|
+
## API Test Commands
|
|
450
|
+
|
|
451
|
+
```bash
|
|
452
|
+
# Login (get cookie)
|
|
453
|
+
curl -c /tmp/cookies.txt -X POST http://localhost:3740/api/auth/login \
|
|
454
|
+
-H 'Content-Type: application/json' \
|
|
455
|
+
-d '{"password":"***"}'
|
|
456
|
+
|
|
457
|
+
# List workspaces
|
|
458
|
+
curl -b /tmp/cookies.txt 'http://localhost:3740/api/workspace?action=list'
|
|
459
|
+
|
|
460
|
+
# List VPS workspace files
|
|
461
|
+
curl -b /tmp/cookies.txt 'http://localhost:3740/api/workspace?workspace=vps'
|
|
462
|
+
|
|
463
|
+
# List Atlas container files
|
|
464
|
+
curl -b /tmp/cookies.txt 'http://localhost:3740/api/workspace?workspace=container-openclaw-atlas'
|
|
465
|
+
|
|
466
|
+
# Read a file
|
|
467
|
+
curl -b /tmp/cookies.txt 'http://localhost:3740/api/workspace?workspace=vps&path=/path/to/workspace/SOUL.md'
|
|
468
|
+
|
|
469
|
+
# Write a file
|
|
470
|
+
curl -b /tmp/cookies.txt -X PUT http://localhost:3740/api/workspace \
|
|
471
|
+
-H 'Content-Type: application/json' \
|
|
472
|
+
-d '{"workspace":"vps","path":"/path/to/workspace/test.md","content":"hello"}'
|
|
473
|
+
```
|
|
474
|
+
|
|
475
|
+
---
|
|
476
|
+
|
|
477
|
+
## Repository Structure
|
|
478
|
+
|
|
479
|
+
```
|
|
480
|
+
/path/to/rev4a/
|
|
481
|
+
├── app/ # Next.js app router pages & API routes
|
|
482
|
+
│ ├── agents/
|
|
483
|
+
│ ├── api/ # API routes (workspace, agents, vault, auth, …)
|
|
484
|
+
│ ├── components/ # Reusable React components
|
|
485
|
+
│ ├── containers/
|
|
486
|
+
│ ├── dashboard/
|
|
487
|
+
│ ├── login/
|
|
488
|
+
│ ├── memory/
|
|
489
|
+
│ ├── plugins-skills/
|
|
490
|
+
│ ├── skills/
|
|
491
|
+
│ ├── tools/
|
|
492
|
+
│ ├── vault/
|
|
493
|
+
│ └── workspace/
|
|
494
|
+
├── docs/ # Project documentation
|
|
495
|
+
│ ├── REV4A.md # This file — operational docs
|
|
496
|
+
│ └── ARCHITECTURE.md # Design & future vision
|
|
497
|
+
├── lib/ # Shared utilities (apiFetch, vault, memory-context)
|
|
498
|
+
├── public/ # Static assets
|
|
499
|
+
├── scripts/ # Utility scripts (setup, helpers)
|
|
500
|
+
├── .env # Local env vars (gitignored)
|
|
501
|
+
├── proxy.ts # Auth proxy
|
|
502
|
+
├── next.config.mjs
|
|
503
|
+
└── package.json
|
|
504
|
+
```
|