@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.
Files changed (290) hide show
  1. package/README.md +150 -0
  2. package/agent-templates/README.md +37 -0
  3. package/agent-templates/argus/AGENTS.md +52 -0
  4. package/agent-templates/argus/IDENTITY.md +7 -0
  5. package/agent-templates/argus/MEMORY.md +9 -0
  6. package/agent-templates/argus/SOUL.md +24 -0
  7. package/agent-templates/argus/TOOLS.md +8 -0
  8. package/agent-templates/atlas/AGENTS.md +47 -0
  9. package/agent-templates/atlas/HEARTBEAT.md +10 -0
  10. package/agent-templates/atlas/IDENTITY.md +6 -0
  11. package/agent-templates/atlas/MEMORY.md +9 -0
  12. package/agent-templates/atlas/SOUL.md +21 -0
  13. package/agent-templates/atlas/TOOLS.md +4 -0
  14. package/agent-templates/base-image/.trigger +0 -0
  15. package/agent-templates/base-image/Dockerfile +90 -0
  16. package/agent-templates/base-image/entrypoint.sh +37 -0
  17. package/agent-templates/custom/AGENTS.md +29 -0
  18. package/agent-templates/custom/BOOTSTRAP.md +56 -0
  19. package/agent-templates/custom/MEMORY.md +8 -0
  20. package/agent-templates/prometheus/AGENTS.md +37 -0
  21. package/agent-templates/prometheus/IDENTITY.md +6 -0
  22. package/agent-templates/prometheus/MEMORY.md +9 -0
  23. package/agent-templates/prometheus/SOUL.md +21 -0
  24. package/agent-templates/prometheus/TOOLS.md +4 -0
  25. package/app/agents/ChannelManager.tsx +465 -0
  26. package/app/agents/ImageDownloadBanner.tsx +159 -0
  27. package/app/agents/PageClient.tsx +1285 -0
  28. package/app/agents/create/PageClient.tsx +437 -0
  29. package/app/agents/create/page.tsx +126 -0
  30. package/app/agents/loading.tsx +14 -0
  31. package/app/agents/page.tsx +5 -0
  32. package/app/api/agents/[id]/backup/route.ts +169 -0
  33. package/app/api/agents/[id]/channels/pairing/route.ts +69 -0
  34. package/app/api/agents/[id]/channels/route.ts +14 -0
  35. package/app/api/agents/[id]/channels/telegram/route.ts +50 -0
  36. package/app/api/agents/[id]/lifecycle/route.ts +94 -0
  37. package/app/api/agents/[id]/recreate/route.ts +199 -0
  38. package/app/api/agents/[id]/restart/route.ts +33 -0
  39. package/app/api/agents/[id]/restore/route.ts +81 -0
  40. package/app/api/agents/[id]/route.ts +280 -0
  41. package/app/api/agents/channels-summary/route.ts +39 -0
  42. package/app/api/agents/config-json/route.ts +58 -0
  43. package/app/api/agents/create/route.ts +488 -0
  44. package/app/api/agents/download-image/route.ts +32 -0
  45. package/app/api/agents/image-status/route.ts +126 -0
  46. package/app/api/agents/route.ts +213 -0
  47. package/app/api/agents/token/route.ts +94 -0
  48. package/app/api/agents-active/route.ts +190 -0
  49. package/app/api/agents-config/route.ts +629 -0
  50. package/app/api/alerts/smoke/route.ts +26 -0
  51. package/app/api/aliases/add/route.ts +28 -0
  52. package/app/api/aliases/remove/route.ts +27 -0
  53. package/app/api/assistant/route.ts +204 -0
  54. package/app/api/auth/check/route.ts +38 -0
  55. package/app/api/auth/login/route.ts +85 -0
  56. package/app/api/auth/logout/route.ts +7 -0
  57. package/app/api/auth/status/route.ts +33 -0
  58. package/app/api/config/env/route.ts +132 -0
  59. package/app/api/config/restart/route.ts +26 -0
  60. package/app/api/containers/route.ts +75 -0
  61. package/app/api/cost-override/route.ts +46 -0
  62. package/app/api/costs/route.ts +84 -0
  63. package/app/api/credentials/[id]/reveal/route.ts +21 -0
  64. package/app/api/credentials/[id]/route.ts +52 -0
  65. package/app/api/credentials/[id]/sync/route.ts +58 -0
  66. package/app/api/credentials/detect/route.ts +246 -0
  67. package/app/api/credentials/route.ts +33 -0
  68. package/app/api/crons/[id]/route.ts +69 -0
  69. package/app/api/crons/route.ts +12 -0
  70. package/app/api/crons/runs/route.ts +31 -0
  71. package/app/api/debug/route.ts +11 -0
  72. package/app/api/envcheck/route.ts +18 -0
  73. package/app/api/events/route.ts +24 -0
  74. package/app/api/gateway/agent/route.ts +154 -0
  75. package/app/api/gateway/provider/balance/route.ts +38 -0
  76. package/app/api/gateway/provider/keys.ts +38 -0
  77. package/app/api/gateway/provider/oauth/route.ts +304 -0
  78. package/app/api/gateway/provider/route.ts +209 -0
  79. package/app/api/gateway/route.ts +223 -0
  80. package/app/api/gateway/sync.ts +189 -0
  81. package/app/api/lineage/route.ts +54 -0
  82. package/app/api/memory-context/route.ts +15 -0
  83. package/app/api/metrics/route.ts +35 -0
  84. package/app/api/models/route.ts +77 -0
  85. package/app/api/plugins/route.js +37 -0
  86. package/app/api/provider/upstream.ts +142 -0
  87. package/app/api/provider/v1/chat/completions/route.ts +146 -0
  88. package/app/api/provider/v1/models/route.ts +167 -0
  89. package/app/api/provider-usage/route.ts +629 -0
  90. package/app/api/session/route.ts +39 -0
  91. package/app/api/sessions/[id]/route.ts +38 -0
  92. package/app/api/sessions/route.ts +23 -0
  93. package/app/api/setup/agent-image/route.ts +102 -0
  94. package/app/api/setup/password/route.ts +111 -0
  95. package/app/api/setup/restart/route.ts +76 -0
  96. package/app/api/skills/delete/route.js +105 -0
  97. package/app/api/skills/promote/route.js +129 -0
  98. package/app/api/skills/route.js +203 -0
  99. package/app/api/skills/save/route.js +142 -0
  100. package/app/api/stats/route.ts +34 -0
  101. package/app/api/stats-since/route.ts +20 -0
  102. package/app/api/stream/route.ts +70 -0
  103. package/app/api/system-health/route.ts +233 -0
  104. package/app/api/tool-calls/route.ts +24 -0
  105. package/app/api/tools-config/route.ts +163 -0
  106. package/app/api/update-check/route.ts +127 -0
  107. package/app/api/version/route.ts +25 -0
  108. package/app/api/wizard/complete/route.ts +32 -0
  109. package/app/api/wizard/reset/route.ts +28 -0
  110. package/app/api/wizard/status/route.ts +28 -0
  111. package/app/api/workspace/route.ts +392 -0
  112. package/app/api/workspace/stream/route.ts +136 -0
  113. package/app/components/AppShell.tsx +33 -0
  114. package/app/components/AuthGuard.tsx +91 -0
  115. package/app/components/CostBreakdown.tsx +37 -0
  116. package/app/components/DashboardHeader.tsx +73 -0
  117. package/app/components/DashboardLayout.tsx +76 -0
  118. package/app/components/DashboardToolbar.tsx +61 -0
  119. package/app/components/FloatingActions.tsx +33 -0
  120. package/app/components/Icons.tsx +78 -0
  121. package/app/components/LineageGraphPage.tsx +142 -0
  122. package/app/components/LiveFeed.tsx +48 -0
  123. package/app/components/MobileBottomNav.tsx +84 -0
  124. package/app/components/ModelPickerModal.tsx +94 -0
  125. package/app/components/PasswordInput.tsx +86 -0
  126. package/app/components/PulseChat.tsx +362 -0
  127. package/app/components/Rev4aLoader.tsx +48 -0
  128. package/app/components/SessionDrawer.tsx +263 -0
  129. package/app/components/SessionTopology.tsx +289 -0
  130. package/app/components/Sidebar.tsx +294 -0
  131. package/app/components/Skeleton.tsx +133 -0
  132. package/app/components/SystemCockpit.tsx +169 -0
  133. package/app/components/VersionBanner.tsx +105 -0
  134. package/app/components/WizardButton.tsx +30 -0
  135. package/app/components/ui/Badge.tsx +30 -0
  136. package/app/components/ui/Button.tsx +59 -0
  137. package/app/components/ui/ConfirmModal.tsx +46 -0
  138. package/app/components/ui/FilterBar.tsx +33 -0
  139. package/app/components/ui/Input.tsx +25 -0
  140. package/app/components/ui/ItemList.tsx +83 -0
  141. package/app/components/ui/LoadingSpinner.tsx +30 -0
  142. package/app/components/ui/Metric.tsx +22 -0
  143. package/app/components/ui/Modal.tsx +42 -0
  144. package/app/components/ui/Page.tsx +18 -0
  145. package/app/components/ui/Pill.tsx +6 -0
  146. package/app/components/ui/PropertyList.tsx +24 -0
  147. package/app/components/ui/Select.tsx +26 -0
  148. package/app/components/ui/StatusCard.tsx +32 -0
  149. package/app/components/ui/Surface.tsx +14 -0
  150. package/app/components/ui/Tabs.tsx +55 -0
  151. package/app/components/ui/TemplateOption.tsx +59 -0
  152. package/app/components/ui/Toast.tsx +44 -0
  153. package/app/components/ui/index.ts +19 -0
  154. package/app/components/ui/tokens.ts +18 -0
  155. package/app/config/PageClient.tsx +293 -0
  156. package/app/config/loading.tsx +10 -0
  157. package/app/config/page.tsx +7 -0
  158. package/app/containers/ContainersClient.tsx +129 -0
  159. package/app/containers/loading.tsx +21 -0
  160. package/app/containers/page.tsx +5 -0
  161. package/app/containers/terminal/[id]/TerminalClient.tsx +313 -0
  162. package/app/containers/terminal/[id]/page.tsx +6 -0
  163. package/app/credentials/PageClient.tsx +598 -0
  164. package/app/credentials/loading.tsx +10 -0
  165. package/app/credentials/page.tsx +7 -0
  166. package/app/crons/PageClient.tsx +538 -0
  167. package/app/crons/loading.tsx +10 -0
  168. package/app/crons/page.tsx +5 -0
  169. package/app/design-system.ts +57 -0
  170. package/app/gateway/PageClient.tsx +1048 -0
  171. package/app/gateway/loading.tsx +24 -0
  172. package/app/gateway/page.tsx +5 -0
  173. package/app/globals.css +1474 -0
  174. package/app/layout.tsx +45 -0
  175. package/app/lib/models-context.tsx +41 -0
  176. package/app/lineage/loading.tsx +10 -0
  177. package/app/lineage/page.tsx +13 -0
  178. package/app/loading.tsx +16 -0
  179. package/app/login/page.tsx +160 -0
  180. package/app/memory/MemoryContextPageClient.tsx +196 -0
  181. package/app/memory/loading.tsx +10 -0
  182. package/app/memory/page.tsx +8 -0
  183. package/app/page.tsx +31 -0
  184. package/app/plugins/PageClient.tsx +296 -0
  185. package/app/plugins/loading.tsx +10 -0
  186. package/app/plugins/page.tsx +5 -0
  187. package/app/setup/PageClient.tsx +227 -0
  188. package/app/setup/loading.tsx +21 -0
  189. package/app/setup/page.tsx +7 -0
  190. package/app/skills/PageClient.tsx +499 -0
  191. package/app/skills/loading.tsx +10 -0
  192. package/app/skills/page.tsx +5 -0
  193. package/app/tools/ToolsPageClient.tsx +308 -0
  194. package/app/tools/loading.tsx +10 -0
  195. package/app/tools/page.tsx +62 -0
  196. package/app/tools/tools-catalog.ts +141 -0
  197. package/app/wizard/PageClient.tsx +485 -0
  198. package/app/wizard/icons.tsx +89 -0
  199. package/app/wizard/loading.tsx +24 -0
  200. package/app/wizard/page.tsx +7 -0
  201. package/app/wizard/storage.ts +33 -0
  202. package/app/wizard/useWizard.ts +101 -0
  203. package/app/workspace/WorkspaceClient.tsx +633 -0
  204. package/app/workspace/loading.tsx +36 -0
  205. package/app/workspace/page.tsx +8 -0
  206. package/bin/docker-entrypoint.sh +21 -0
  207. package/bin/postinstall.js +20 -0
  208. package/bin/rev4a.js +696 -0
  209. package/daemon.js +783 -0
  210. package/docs/ARCHITECTURE.md +557 -0
  211. package/docs/CONTAINER-TERMINAL.md +280 -0
  212. package/docs/DESIGN-SYSTEM.md +99 -0
  213. package/docs/FRONTEND-ARCHITECTURE.md +119 -0
  214. package/docs/REV4A.md +504 -0
  215. package/docs/dev/API-REFERENCE.md +1835 -0
  216. package/docs/dev/DATABASE.md +224 -0
  217. package/docs/dev/GATEWAY.md +300 -0
  218. package/docs/dev/PROVIDERS.md +229 -0
  219. package/docs/dev/SESSION-MAINTENANCE-PLAN.md +607 -0
  220. package/docs/dev/WORKSPACE.md +199 -0
  221. package/docs/rag/DATA-FRESHNESS.md +109 -0
  222. package/docs/rag/GLOSSARY.md +125 -0
  223. package/docs/rag/REV4A-OVERVIEW.md +135 -0
  224. package/docs/rag/WHAT-I-CAN-ANSWER.md +124 -0
  225. package/lib/agent-setup.ts +130 -0
  226. package/lib/alerts.ts +115 -0
  227. package/lib/apiFetch.ts +7 -0
  228. package/lib/auth.ts +28 -0
  229. package/lib/billing.ts +100 -0
  230. package/lib/buildAgentImage.ts +346 -0
  231. package/lib/channelManager.ts +386 -0
  232. package/lib/container.ts +60 -0
  233. package/lib/credentials/db.ts +86 -0
  234. package/lib/credentials/delivery.ts +448 -0
  235. package/lib/credentials/detect.ts +149 -0
  236. package/lib/credentials/hash.ts +9 -0
  237. package/lib/credentials/providers.ts +110 -0
  238. package/lib/credentials/vault.ts +195 -0
  239. package/lib/db-bootstrap.d.ts +3 -0
  240. package/lib/db-bootstrap.mjs +144 -0
  241. package/lib/db.ts +25 -0
  242. package/lib/docker-utils.ts +60 -0
  243. package/lib/hooks/useDashboard.ts +264 -0
  244. package/lib/hooks/useRev4aTimezone.ts +28 -0
  245. package/lib/hooks/useScreenshot.ts +30 -0
  246. package/lib/memory-context.ts +385 -0
  247. package/lib/model-catalogue.ts +131 -0
  248. package/lib/model-pricing.ts +63 -0
  249. package/lib/openclaw-cron.ts +350 -0
  250. package/lib/patterns/ApiAdapter.ts +73 -0
  251. package/lib/patterns/ApiClient.ts +65 -0
  252. package/lib/patterns/EventBus.ts +113 -0
  253. package/lib/patterns/FilterStrategy.ts +79 -0
  254. package/lib/patterns/SessionFactory.ts +117 -0
  255. package/lib/patterns/sessionPresentation.ts +117 -0
  256. package/lib/provider-balance.ts +163 -0
  257. package/lib/requireAuth.tsx +38 -0
  258. package/lib/rev4a-auth.d.ts +3 -0
  259. package/lib/rev4a-auth.js +36 -0
  260. package/lib/rev4a-paths.ts +145 -0
  261. package/lib/timezone.ts +46 -0
  262. package/lib/types/index.ts +96 -0
  263. package/lib/utils/format.ts +82 -0
  264. package/lineage.js +56 -0
  265. package/model-pricing.json +482 -0
  266. package/models.config.json +844 -0
  267. package/next-env.d.ts +6 -0
  268. package/next.config.mjs +7 -0
  269. package/package.json +82 -0
  270. package/public/apple-touch-icon.png +0 -0
  271. package/public/favicon-64.png +0 -0
  272. package/public/favicon.svg +58 -0
  273. package/public/icon-192-maskable.png +0 -0
  274. package/public/icon-192.png +0 -0
  275. package/public/icon-512-maskable.png +0 -0
  276. package/public/icon-512.png +0 -0
  277. package/public/manifest.json +38 -0
  278. package/public/rev4a-logo.png +0 -0
  279. package/public/rev4a-logo.svg +58 -0
  280. package/rev4a-rules/AGENTS.md +37 -0
  281. package/scripts/add-auth.cjs +185 -0
  282. package/scripts/backup.sh +66 -0
  283. package/scripts/check-providers.mjs +143 -0
  284. package/scripts/docker/traefik/docker-compose.yml +32 -0
  285. package/scripts/docker/traefik/dynamic/.gitkeep +18 -0
  286. package/scripts/docker/traefik/traefik.yml +37 -0
  287. package/scripts/remove-auth-profile.js +56 -0
  288. package/scripts/restore.sh +82 -0
  289. package/terminal-ws-server.js +139 -0
  290. package/tsconfig.json +42 -0
@@ -0,0 +1,199 @@
1
+ # Workspace — Multi-Workspace File Explorer
2
+
3
+ > **Status:** Active — `main` branch
4
+ > **Last updated:** 2026-06-30
5
+
6
+ ---
7
+
8
+ ## 1. Overview
9
+
10
+ The Workspace feature provides a unified file explorer for OpenClaw agent workspaces across
11
+ the VPS host and any Docker containers. Users can browse directories, read files, write
12
+ content, and navigate a recursive tree — all from the Rev4a dashboard.
13
+
14
+ **Purpose:** Give operators direct access to agent workspace files (MEMORY.md, logs,
15
+ configurations, project files) without needing to SSH into the host or exec into containers.
16
+
17
+ ---
18
+
19
+ ## 2. Workspace Selector (UI)
20
+
21
+ The dashboard includes a **workspace selector** — a dropdown that lists all available
22
+ workspaces. Selecting one loads its file tree into the editor panel.
23
+
24
+ Available workspaces are grouped by type:
25
+
26
+ - **Host:** always one entry — the VPS host workspace (`vps`)
27
+ - **Containers:** one entry per running Docker container that has an `AGENT_ID` label
28
+
29
+ ---
30
+
31
+ ## 3. Available Workspaces
32
+
33
+ ### VPS Host
34
+
35
+ | Property | Value |
36
+ |---|---|
37
+ | ID | `vps` |
38
+ | Label | `VPS Host (Nexus)` |
39
+ | Type | `host` |
40
+ | Root path | `/path/to/workspace/` |
41
+ | Access | `fs.readdirSync` / `fs.readFileSync` / `fs.writeFileSync` (direct filesystem) |
42
+
43
+ ### Container Agents
44
+
45
+ Container workspaces are **auto-discovered** at runtime by querying Docker:
46
+
47
+ ```
48
+ docker ps --filter label=AGENT_ID --format '{{.Names}}|{{.Label "AGENT_ID"}}'
49
+ ```
50
+
51
+ | Property | Value |
52
+ |---|---|
53
+ | ID convention | `container-<containerName>` (e.g. `container-openclaw-atlas`) |
54
+ | Label | `<agentId> (<containerName>)` (e.g. `atlas (openclaw-atlas)`) |
55
+ | Type | `container` |
56
+ | Root path | `/root/.openclaw/workspace/` |
57
+ | Access | `docker exec` (shell commands over Docker socket) |
58
+
59
+ Only containers with the `AGENT_ID` Docker label appear — this prevents showing
60
+ infrastructure containers (Traefik, databases, etc.) that are not agent workspaces.
61
+
62
+ ---
63
+
64
+ ## 4. API Endpoints
65
+
66
+ ### `GET /api/workspace?action=list`
67
+
68
+ List all available workspaces.
69
+
70
+ **Auth:** Bearer token, query param, `x-agent-token` header, or browser cookie
71
+
72
+ **Response:**
73
+ ```json
74
+ {
75
+ "workspaces": [
76
+ { "id": "vps", "label": "VPS Host (Nexus)", "type": "host" },
77
+ { "id": "container-agent_8ba21f83", "label": "Giuanmuzzziins", "type": "container" }
78
+ ]
79
+ }
80
+ ```
81
+
82
+ ### `GET /api/workspace?workspace=<id>[&path=<path>][&tree=1]`
83
+
84
+ List files in a workspace, read a file, or return a recursive tree.
85
+
86
+ **Auth:** any auth method
87
+
88
+ **Query params:**
89
+ | Param | Default | Description |
90
+ |---|---|---|
91
+ | `workspace` | `vps` | Workspace ID |
92
+ | `path` | workspace root | Directory or file path to read |
93
+ | `tree=1` | — | When set, returns a recursive flat list of all entries |
94
+
95
+ **Response (directory listing):**
96
+ ```json
97
+ {
98
+ "workspace": "vps",
99
+ "label": "VPS Host (Nexus)",
100
+ "path": "/path/to/workspace",
101
+ "type": "host",
102
+ "files": [
103
+ { "name": "config", "isDirectory": true, "isFile": false, "path": "..." },
104
+ { "name": "SOUL.md", "isDirectory": false, "isFile": true, "path": "..." }
105
+ ]
106
+ }
107
+ ```
108
+
109
+ **Response (`tree=1` — recursive tree):**
110
+ ```json
111
+ {
112
+ "workspace": "vps",
113
+ "label": "VPS Host (Nexus)",
114
+ "path": "/path/to/workspace",
115
+ "root": "/path/to/workspace",
116
+ "type": "host",
117
+ "entries": [
118
+ { "name": "rev4a", "path": "/path/to/workspace/rev4a",
119
+ "relPath": "rev4a", "type": "directory", "size": 0,
120
+ "mtimeMs": 1750000000000, "isDirectory": true, "isFile": false },
121
+ ...
122
+ ],
123
+ "tree": [ "...same items as entries..." ],
124
+ "files": [ "...same items as entries..." ]
125
+ }
126
+ ```
127
+
128
+ **Response (file read):** Same structure with a `content` field (string) instead of `files`.
129
+
130
+ ### `PUT /api/workspace`
131
+
132
+ Write content to a workspace file.
133
+
134
+ **Auth:** any auth method
135
+
136
+ **Body:**
137
+ ```json
138
+ {
139
+ "workspace": "vps",
140
+ "path": "/path/to/workspace/test.md",
141
+ "content": "hello"
142
+ }
143
+ ```
144
+
145
+ **Response:** `{ "ok": true }`
146
+
147
+ If `workspace` is omitted, defaults to `vps`.
148
+
149
+ ---
150
+
151
+ ## 5. Entry Sorting (Consistency Rule)
152
+
153
+ All directory listings and trees are sorted server-side by `compareWorkspaceEntries()`:
154
+
155
+ 1. **Directories before files** — at every level of a nested path
156
+ 2. **Alphabetical within each group** — directories sorted by name, then files sorted by name
157
+ 3. **Recursive depth-first** — the same rule applies at every nesting level
158
+
159
+ This ordering is **always applied server-side** so the UI receives a consistent
160
+ sequence regardless of filesystem order (`readdir` order differs across platforms and
161
+ filesystems). Both host and container listings use the same comparator.
162
+
163
+ ---
164
+
165
+ ## 6. Host Workspace Implementation
166
+
167
+ - Uses `fs.readdirSync` / `fs.readFileSync` / `fs.writeFileSync` — real-time, no caching
168
+ - Paths are validated against `VPS_ROOT` (`/path/to/workspace/`) to prevent directory traversal
169
+ - Binary files (images, PDFs) are detected by extension (`BINARY_EXTENSIONS` set) and served inline
170
+ - Hidden files (starting with `.`) and `node_modules` are skipped in directory listings
171
+
172
+ ---
173
+
174
+ ## 7. Container Workspace Implementation
175
+
176
+ - Uses `docker exec` to run shell commands inside the container for listing, reading, and writing
177
+ - **Discovery** uses `execFileSync('docker', ['ps', ...])` with explicit arguments — this avoids
178
+ shell quoting fragility compared to `execSync('docker ps ...')`
179
+ - **List directory:** `docker exec <name> ls -1Ap <dir>` (detects directories via trailing `/`)
180
+ - **File existence check:** `docker exec <name> test -d <path> && echo YES || echo NO`
181
+ - **File read:** `docker exec <name> cat <path>`
182
+ - **File write:** `docker exec -i <name> sh -c 'mkdir -p $(dirname <path>) && cat > <path>'` with content piped via heredoc
183
+ - Container root is scoped to `/root/.openclaw/workspace/` rather than the full
184
+ container filesystem — this is intentional: it limits the editor to agent workspace
185
+ files and prevents accidental editing of system files inside the container
186
+
187
+ ---
188
+
189
+ ## 8. Design Decisions
190
+
191
+ | Decision | Rationale |
192
+ |---|---|
193
+ | Server-side sorting | Filesystem `readdir` order is platform-dependent (e.g. ext4 vs overlayfs). Sorting server-side guarantees consistent ordering for the UI. |
194
+ | Container discovery via `AGENT_ID` | Avoids listing all containers (including Traefik, DBs, etc.) — only agent containers are relevant workspace targets. |
195
+ | `execFileSync` for `docker ps` | `execFileSync` passes arguments as an array, avoiding shell injection vulnerabilities and fragile quoting compared to `execSync('docker ps ...')` with string concatenation. |
196
+ | Container root at `/root/.openclaw/workspace/` | Prevents operators from accidentally reading/writing system files (e.g. `/etc/passwd`, `/bin/sh`) inside the container. The workspace root is the only exposed sandbox. |
197
+ | Real-time file reads (no caching) | Workspace files change frequently (agents write MEMORY.md, logs). Caching would require invalidation logic with little benefit — file reads are fast. |
198
+ | UI tree auto-refresh (5s polling) | The file tree re-fetches every 5s (recursive `setTimeout`, not `setInterval`, to avoid overlapping requests) so external changes — a credential sync writing `TOOLS.md`, a restore, a manual edit inside the container — appear without a manual page reload. Only the tree is refreshed; the currently open file is left untouched to avoid clobbering an in-progress edit. Cleaned up on unmount via a `mounted` flag + `clearTimeout`. |
199
+ | Flat tree with aliases (`entries`, `tree`, `files`) | Backward compatibility: older UI components expect `files` or `tree` keys; `entries` is the canonical name in the current codebase. |
@@ -0,0 +1,109 @@
1
+ # Data Freshness in Rev4a
2
+
3
+ > **Last updated:** 2026-07-18
4
+
5
+ Understanding how current the data in Rev4a is — and what is truly real-time vs. periodically updated.
6
+
7
+ ---
8
+
9
+ ## Session data
10
+
11
+ **Update frequency:** every 15–30 seconds
12
+
13
+ The daemon polls `openclaw sessions --json --all-agents` on this schedule:
14
+ - 15 seconds when at least one session has status `working`
15
+ - 30 seconds when no sessions are actively working
16
+
17
+ This means session statuses, token counts, and costs are at most 30 seconds behind reality during quiet periods, and 15 seconds behind during active work.
18
+
19
+ **What this means for PULSE:** if you ask "is Argus working right now?", the answer reflects data that is up to 30 seconds old.
20
+
21
+ ---
22
+
23
+ ## Event feed
24
+
25
+ **Update frequency:** ~3 seconds (via SSE stream)
26
+
27
+ The `/api/stream` endpoint pushes updates to the dashboard every ~3 seconds. This includes:
28
+ - New events (spawn, complete, error, tool_call)
29
+ - Updated session list
30
+ - Today's cost total
31
+ - Lineage data
32
+
33
+ The event feed is as close to real-time as Rev4a gets. However, events are generated by the daemon's poll cycle, so an event that just happened may take up to 30 seconds to appear.
34
+
35
+ ---
36
+
37
+ ## System metrics (CPU, RAM, disk)
38
+
39
+ **Update frequency:** every daemon poll cycle (15–30 seconds)
40
+
41
+ **Retention:** last 24 hours only (older rows are pruned automatically)
42
+
43
+ ---
44
+
45
+ ## Cost totals
46
+
47
+ **Update frequency:** every 15–30 seconds (recalculated from sessions on each API call)
48
+
49
+ The cost figures shown in the dashboard are always computed fresh from the database on each page load or SSE push. They are not cached.
50
+
51
+ **Cost override:** if a manual override is set for the current month, it is shown immediately after being saved — no delay.
52
+
53
+ ---
54
+
55
+ ## Cron jobs
56
+
57
+ **Update frequency:** on demand (fetched live from OpenClaw gateway on page load)
58
+
59
+ Cron status (last run, next run) is fetched directly from the OpenClaw gateway each time the Crons page is loaded. It is not stored in the database.
60
+
61
+ **Note:** if the OpenClaw gateway returns a scope-blocked error when listing crons, Rev4a may show no crons even if crons exist. This is an authorization scope issue, not a real absence of crons.
62
+
63
+ ---
64
+
65
+ ## Agent configuration
66
+
67
+ **Update frequency:** on demand (read from `openclaw.json` on each request)
68
+
69
+ The agents list, Telegram accounts, and bindings are read directly from `openclaw.json` each time the Agents Config page is accessed. Changes saved via the UI take effect immediately.
70
+
71
+ ## Agent base image
72
+
73
+ **Update frequency:** polled every 2 seconds during a build; on page load otherwise
74
+
75
+ The `GET /api/agents/image-status` endpoint compares the local image digest
76
+ with the remote registry digest (ghcr.io). Download progress is shown inline
77
+ via polling `GET /api/agents/image-status` and reading logs from
78
+ `/tmp/rev4a-download-<timestamp>.log`.
79
+
80
+ ---
81
+
82
+ ## Memory / context files
83
+
84
+ **Update frequency:** on demand (files read from disk on each request)
85
+
86
+ Memory files (MEMORY.md, etc.) are read from disk each time they are requested. There is no caching.
87
+
88
+ ---
89
+
90
+ ## What is NOT real-time
91
+
92
+ | Data | Why it may be stale |
93
+ |---|---|
94
+ | Sessions ended more than 7 days ago | `agents-active` endpoint only looks back 7 days |
95
+ | Sessions never polled by daemon | If the daemon was down, sessions from that window are missing |
96
+ | Tool calls for a session | Only captured if the OpenClaw session export includes them |
97
+ | Costs before Rev4a was installed | Historical data before the first daemon run is not available |
98
+
99
+ ---
100
+
101
+ ## How to check if data is fresh
102
+
103
+ The System Health page shows a check like "last event X seconds ago". If this number is larger than ~60 seconds, the daemon may have stopped.
104
+
105
+ You can also run this command on the server to check directly:
106
+ ```bash
107
+ sqlite3 data/events.db \
108
+ "SELECT datetime(MAX(ts)/1000, 'unixepoch', 'localtime') FROM events"
109
+ ```
@@ -0,0 +1,125 @@
1
+ # Rev4a Glossary
2
+
3
+ > **Last updated:** 2026-07-15
4
+
5
+ Terms you'll encounter while using the Rev4a dashboard.
6
+
7
+ ---
8
+
9
+ ## Agent
10
+ An AI assistant configured with a specific role, AI model, and workspace. Each agent has a name (e.g. "Argus") and can run multiple sessions over time. Agents are deployed as Docker containers with persistent data volumes.
11
+
12
+ ## Agent Template
13
+ A pre-built configuration used when creating a new agent. Templates include default files (AGENTS.md, SOUL.md, MEMORY.md, IDENTITY.md, TOOLS.md, HEARTBEAT.md, BOOTSTRAP.md) and settings. Located in `agent-templates/`. Available templates: **Atlas** (general dev), **Argus** (security/audit), **Prometheus** (client-facing), and **Custom** (blank slate — bootstraps identity interactively on first run).
14
+
15
+ ## Badge
16
+ A small inline label component used for status indicators and channel chips. Supports success, danger, warning, and neutral tones. Used for TG/WA chips on the agent list and pairing status in the Channel Manager.
17
+
18
+ ## Backup (Agent)
19
+ A compressed archive (`.tar.gz`) of an agent's persistent volume (`/root/`). Backups exclude the npm cache to keep sizes small (~1.5 MB). Stored in the `rev4a-backups` Docker volume. Used for restore operations and auto-created before each recreate.
20
+
21
+ ## Container
22
+ A Docker container running on the server. Each agent runs in its own container. The Containers page shows all containers, including infrastructure ones (databases, reverse proxies, etc.), with CPU/memory metrics, logs, and a web terminal.
23
+
24
+ ## Channel
25
+ A communication channel (Telegram) configured on an agent. Channels allow users to send DMs to the agent via messaging apps. The Channel Manager modal lets you connect/disconnect Telegram and manage pairings (approve/reject senders).
26
+
27
+ ## Channel Manager
28
+ Modal in the agent detail panel for configuring Telegram channels. Connect with bot token, restart agent, manage pairings (approve pending codes, revoke approved senders). Pairings are polled every 5 seconds with automatic cancellation of stale requests via AbortController.
29
+
30
+ ## Cost
31
+ The estimated cost of an agent session in USD, calculated from tokens used and per-model pricing. Rev4a shows cost by today, 7 days, 30 days, all-time, and by model.
32
+
33
+ ## Cost Override
34
+ A manual correction for a month's total cost. If the automatic calculation doesn't match the actual invoice, you can set an override value for that month with an optional note.
35
+
36
+ ## Credential
37
+ A third-party service token (GitHub PAT, Trello API key, Vercel token, Supabase access key, Notion API token) stored in the Rev4a vault. Credentials can be scoped to specific agent containers and synced via CLI auth or config files. Every reveal is logged in the audit trail.
38
+
39
+ ## Cron / Cron Job
40
+ A scheduled task that runs an agent automatically at a fixed time (e.g. every night at 3:15 AM). Configured with standard cron syntax. Jobs can be enabled/disabled per entry.
41
+
42
+ ## Dashboard
43
+ The main page of Rev4a (`/`). Shows live sessions, cost summary, system health metrics (CPU, RAM, disk, load average), and a real-time event feed. A setup banner appears if the onboarding wizard is incomplete.
44
+
45
+ ## Event
46
+ A lifecycle occurrence for a session: spawned, completed, errored, or a tool call made. Events appear in the live feed on the Dashboard and are pushed via SSE every ~3 seconds.
47
+
48
+ ## Gateway
49
+ The routing layer that connects agents to AI providers. The Gateway page has two panels: Provider Sync (push the model catalogue to all agents) and Agent Model Config (set each agent's primary model and fallbacks).
50
+
51
+ ## Lineage
52
+ The parent-child relationship tree between sessions. When an agent spawns another agent to do work, that relationship is shown as an interactive graph on the Lineage page. Configurable time periods: 1d, 7d, 30d.
53
+
54
+ ## Memory
55
+ Files that store an agent's persistent knowledge and personality: MEMORY.md, SOUL.md, IDENTITY.md, USER.md, AGENTS.md, TOOLS.md, HEARTBEAT.md. Editing them changes how an agent behaves. The Memory page shows all files with size and budget tracking.
56
+
57
+ ## Model
58
+ The AI model used by an agent or session. Examples: GPT-5.4, Claude Sonnet 4, DeepSeek V4 Flash. Models are linked to specific providers. The Gateway page manages which models are enabled and which agent uses which model.
59
+
60
+ ## Onboarding
61
+ First-time setup wizard at `/onboarding`. Four steps: Welcome → Providers → First Agent → Ready. Progress is tracked per-step in `data/onboarding-progress.json`. A badge in the sidebar shows remaining steps (e.g. "2/3"). Always accessible from the sidebar or mobile navbar.
62
+
63
+ ## Plugin
64
+ An extension that adds new tools and capabilities to agents. Plugins are installed in the workspace and appear in the Plugins page with enable/disable toggles.
65
+
66
+ ## Provider
67
+ An AI service provider (OpenAI, Anthropic, Groq, OpenRouter, DeepSeek, etc.) that hosts models. Provider API keys are configured in the Gateway page or via the onboarding wizard.
68
+
69
+ ## Provider Gateway
70
+ Rev4a's built-in proxy that gives all agents unified access to configured LLM providers. Agents point to `http://host.docker.internal:3740/api/provider/v1` and Rev4a routes requests to the correct upstream using the stored API keys.
71
+
72
+ ## Pulse
73
+ The AI concierge embedded in Rev4a. Click the floating chat button (bottom-right) on any page to ask questions about the dashboard features and navigation.
74
+
75
+ ## Recreate (Agent)
76
+ Rebuild an agent container from the latest `openclaw-agent-base:latest` image while preserving the persistent volume. Auto-backups the volume first — if the backup fails, the recreate is aborted. This is how agents pick up OpenClaw image updates.
77
+
78
+ ## Restore (Agent)
79
+ Replace an agent's persistent volume with a previously created backup. The container is stopped, the volume content is fully replaced, then the container is restarted.
80
+
81
+ ## Session
82
+ One instance of an agent doing work. Tracks: start/end time, tokens used, cost, model, status, and task description. A session starts when an agent receives a task and ends when it completes or fails.
83
+
84
+ ## Pairing
85
+ A security mechanism for Telegram channels. When a user sends `/start` to the bot, a 4-digit pairing code is generated. An admin must approve this code in the Channel Manager to add the user to the allowlist. Approved senders can be revoked at any time.
86
+
87
+ ## Telegram
88
+ A messaging channel type. Agents can be connected to Telegram via a bot token from @BotFather. Once connected, users send `/start` to get a pairing code, which an admin approves in the Channel Manager.
89
+
90
+ ## Session ID
91
+ A unique identifier for a session. Format: `agent:<name>:<role>` (e.g. `agent:ops:main`) or `agent:<name>:subagent:<uuid>` for temporary child agents.
92
+
93
+ ## Skill
94
+ A reusable prompt/tool bundle that agents can invoke. Skills appear in the Skills page and can be used by agents via commands or direct invocation.
95
+
96
+ ## Status (Session)
97
+ Current state of a session:
98
+ - **idle** — agent is running but not actively processing
99
+ - **working** — agent is actively processing a task (consuming tokens)
100
+ - **completed** — task finished successfully
101
+ - **error** — task failed
102
+
103
+ ## BOOTSTRAP.md
104
+ A first-run ritual file for agents. When an agent starts for the first time in a new workspace, it reads BOOTSTRAP.md, introduces itself, learns who the user is, and together they define the agent's name, personality, tone, and boundaries. The agent then creates/updates SOUL.md, IDENTITY.md, and USER.md, then deletes BOOTSTRAP.md so the ritual never repeats. Used by the Custom agent template.
105
+
106
+ ## Token
107
+ The unit of text processed by an AI model. Input tokens (your prompt) and output tokens (the AI's response) are counted separately and used to calculate cost.
108
+
109
+ ## Tool
110
+ A capability available to agents: running shell commands, reading files, searching the web, etc. Tools can be built-in, from plugins, or from MCP servers.
111
+
112
+ ## Tool Call
113
+ A record of an agent using a tool during a session. Useful for auditing what an agent actually did. Shown in the Session Drawer.
114
+
115
+ ## Traefik
116
+ Optional reverse proxy for routing web traffic to agent containers. If configured, an agent gets a public URL. Rev4a itself runs on port 3740 and does not require Traefik.
117
+
118
+ ## Vault
119
+ Rev4a's credential storage system. Stores provider API keys and third-party service tokens with per-agent permission scoping. Supports reveal (with audit trail), sync to containers, and live detection of installed credentials.
120
+
121
+ ## Workspace
122
+ The directory where an agent's operational files live (config, memory files, skills, plugins, scripts). The Workspace page lets you browse, view, and edit files across the VPS host and all agent containers.
123
+
124
+ ## System Health
125
+ Hardware metrics shown on the Dashboard: CPU usage (%), RAM used/total (MB), disk used/total (GB), system load average (1m). The System Health API (`/api/system-health`) also generates recommendations (e.g. "Consider archiving old sessions to reduce disk usage"). Status can be `ok`, `warn`, or `error`.
@@ -0,0 +1,135 @@
1
+ # What is Rev4a?
2
+
3
+ > **Last updated:** 2026-07-18
4
+
5
+ Rev4a is the control panel for your AI agent infrastructure. It shows you everything your agents are doing, how much they cost, and whether the system is healthy — all in one dashboard.
6
+
7
+ ## What can you do in Rev4a?
8
+
9
+ ### Dashboard (`/`)
10
+ The main page. See live sessions (who's working right now), cost summary by model and time period (today, 7 days, 30 days), system health (CPU, RAM, disk, load average), and a real-time event feed. Click any session row to open the Session Drawer and see every tool call the agent made. If the onboarding wizard is incomplete, a banner appears at the top with a link to continue.
11
+
12
+ ### Onboarding (`/onboarding`)
13
+ First-run setup wizard that guides new users through configuration. Four steps:
14
+ 1. **Welcome** — what Rev4a is and what it can do
15
+ 2. **Providers** — add API keys for DeepSeek, OpenAI, OpenRouter, or Groq (saved via the Provider Gateway)
16
+ 3. **First Agent** — understand how agents work and what you need to create one
17
+ 4. **Ready** — site map of key sections with quick links
18
+
19
+ The wizard is always accessible from the sidebar. A progress badge (e.g. "1/3") shows how many steps are complete. Once finished, the badge disappears and the dashboard banner goes away.
20
+
21
+ ### Agents (`/agents`)
22
+ Manage Docker containers running OpenClaw agents. See which agents are running, stopped, or errored. Filter by status, view agent details (environment variables, ports, auth tokens, backups, Telegram channels), and create new agents. Each agent card shows its template, status, TG channel chip, and a direct link to its Control UI.
23
+
24
+ **Agent Creation Wizard** (`/agents/create`) — two-step flow:
25
+ 1. Pick a template: **Atlas** (general dev), **Argus** (security/audit), **Prometheus** (client-facing), or **Custom** (blank slate)
26
+ 2. Configure: name, optional port, optional model → Deploy
27
+
28
+ **Custom template:** starts with no preset identity. On first run, the agent runs a bootstrap ritual (BOOTSTRAP.md): introduces itself, asks who the user is, and together they define name, personality, tone, and boundaries. No AI generation needed — it's a native OpenClaw feature.
29
+
30
+ **Channel Manager:** Each agent detail panel has a "CHANNELS" section with TG status badge and a "Manage Channels" button. The modal lets you:
31
+ - **Telegram:** connect a bot (paste bot token → save → restart agent), disconnect, and manage pairings (approve pending codes, revoke approved senders). Pairings are polled every 5 seconds.
32
+
33
+ The agent list also shows a compact TG chip next to each agent name (green = connected, hidden if not configured).
34
+
35
+ The Agents page includes a banner for the **agent base image** (`openclaw-agent-base:latest`):
36
+ - Green: image is up-to-date (no banner shown)
37
+ - Yellow: image is outdated or missing — click "Rebuild Image" to start a build
38
+ - Copper: a build is running in the background — click "View Progress" to open
39
+ the build modal
40
+
41
+ The build modal shows live Docker build logs (polled every 2s). You can:
42
+ - **Run in Background** — close the modal, build continues on the server
43
+ - **Abort** — kill the build process; the existing image stays intact
44
+ - **Refresh / re-enter** — opening the modal again resumes log streaming
45
+ from the last seen line
46
+
47
+ The build writes logs to `/tmp/rev4a-build-<timestamp>.log` so they survive
48
+ page refreshes and modal closes.
49
+
50
+ ### Create Agent (`/agents/create`)
51
+ Wizard to spin up a new agent. Steps: choose a template (Prometheus, Argus, Atlas, etc.), name your agent, pick a model, set an optional port range (default: auto-assigned 10-port block, e.g. 3700-3709). The agent is created as a Docker container with a persistent volume — all config, workspace files, and credentials survive container restarts.
52
+
53
+ ### Lineage (`/lineage?period=7d`)
54
+ Interactive graph showing session family trees — which agent spawned which child agent, across configurable time periods (1d, 7d, 30d). Click any node to inspect. Includes a live feed side panel.
55
+
56
+ ### Gateway (`/gateway`)
57
+ Central hub connecting agents to AI providers. Two panels:
58
+ - **Provider Sync** — reads the model catalogue from `models.config.json`, discovers which providers have API keys, and syncs the full model list to every agent container
59
+ - **Agent Model Config** — set each agent's primary model and fallback models via `PUT /api/gateway/agent`
60
+
61
+ ### Containers (`/containers`)
62
+ Full list of all Docker containers on the server. See name, image, status, ports, IP, CPU%, and memory usage. Click "Terminal" on any container to open an interactive shell. Use Start/Stop/Restart buttons to manage lifecycle.
63
+
64
+ ### Container Terminal (`/containers/terminal/[id]`)
65
+ Live web terminal into a Docker container. Run commands, inspect files, debug issues — like SSH but in the browser.
66
+
67
+ ### Workspace (`/workspace`)
68
+ File explorer for the OpenClaw workspace. Browse, view, and edit files across workspaces: the VPS host workspace and every agent container workspace. Switch between workspaces via a dropdown. Supports binary file preview (images) and text editing with syntax awareness.
69
+
70
+ ### Credentials (`/credentials`)
71
+ Manage third-party service credentials: GitHub, Trello, Vercel, Supabase, Notion. Each credential can be scoped to specific agent containers. Sync pushes credentials into containers via CLI auth (gh, vercel, supabase) or config files (trello, notion). Live detection shows which credentials are actually installed in each container. Audit trail for every reveal action.
72
+
73
+ ### Crons (`/crons`)
74
+ Scheduled tasks auto-discovered from the host OpenClaw gateway (via `openclaw cron list --json`) and every running Docker container with the `AGENT_ID` label (via `docker exec openclaw cron list --json`). Filter jobs by agent using the toolbar tabs. Each job shows name, description, cron expression, next run, last run, and last status. Toggle on/off per job. The run history panel shows recent cron run executions for the selected job, loaded on demand from the container's gateway.
75
+
76
+ ### Memory / Context (`/memory`)
77
+ Browse agent memory files — MEMORY.md, SOUL.md, IDENTITY.md, USER.md, AGENTS.md, TOOLS.md, HEARTBEAT.md. These files define how agents behave, what they know, and their personality. Also shows total memory budget vs usage.
78
+
79
+ ### Config (`/config`)
80
+ Rev4a application settings. View and modify environment variables (password, tokens, secrets), restart the server. Changes are persisted to `.env`, synced to systemd, and a daemon-reload is triggered.
81
+
82
+ ### Tools (`/tools`)
83
+ Catalog of every tool available to agents — built-in commands, MCP server tools, plugin tools, and audio/TTS configuration. Includes timezone settings.
84
+
85
+ ### Plugins (`/plugins`)
86
+ Browse installed OpenClaw plugins. Enable/disable toggle per plugin. Plugins extend agent capabilities with new tools and integrations.
87
+
88
+ ### Skills (`/skills`)
89
+ Skill registry showing all skills across three sources:
90
+ - **Shared** — global skills from `/docker/shared-skills`, available to all agents
91
+ - **Per-agent** — skills in each agent's workspace (`<workspace>/skills`), shown with agent label
92
+ - **Bundled** — skills shipped with OpenClaw (read-only)
93
+
94
+ Filter by source, view and edit SKILL.md content, and **promote** agent-local skills to shared with one click.
95
+
96
+ ### Plugins & Skills (`/plugins-skills`)
97
+ Combined view showing both plugins and skills side by side.
98
+
99
+ ### Login (`/login`)
100
+ Password-protected access to the dashboard. Enter the Rev4a password to authenticate. Session persists via a JWT cookie (7-day expiry).
101
+
102
+ ### Vault (`/vault`)
103
+ Credential storage with per-agent permissions. Store API keys and service tokens, scope them to specific agents, and manage permissions via the UI.
104
+
105
+ ## What about Pulse?
106
+
107
+ Pulse is the AI assistant embedded in Rev4a. She appears as a floating chat button in the bottom-right corner of every page. She can:
108
+
109
+ - Explain what any page does
110
+ - Guide you through features ("how do I create an agent?")
111
+ - Answer questions about agents, providers, costs, sessions, containers, crons, credentials, and onboarding
112
+ - Give practical tips based on the page you're on
113
+
114
+ Pulse does NOT have access to live data — she knows the page layout and features, but you need to look at the dashboard for real-time information.
115
+
116
+ ## What is an "agent"?
117
+
118
+ An agent is an AI assistant that runs tasks autonomously. Each agent has:
119
+ - A name and role (e.g. "Argus" the ops lead)
120
+ - A configured AI model (e.g. GPT-5.4, Claude Sonnet)
121
+ - A workspace with its memory files and configuration
122
+ - Sessions — each time an agent does work, it creates a session
123
+ - A Docker container with a persistent data volume
124
+ - Backups that can be created, restored, and managed from the Agents page
125
+
126
+ ## What is a "session"?
127
+
128
+ A session is one unit of agent work. It starts when an agent receives a task and ends when the task completes or fails. Sessions track:
129
+ - Tokens used (input and output)
130
+ - Cost in USD
131
+ - Model used
132
+ - Status (idle, working, completed, error)
133
+ - Tool calls made during the session
134
+
135
+ Sessions can have parent-child relationships (lineage): one agent spawns another to delegate work.