@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
package/next-env.d.ts ADDED
@@ -0,0 +1,6 @@
1
+ /// <reference types="next" />
2
+ /// <reference types="next/image-types/global" />
3
+ import "./.next/types/routes.d.ts";
4
+
5
+ // NOTE: This file should not be edited
6
+ // see https://nextjs.org/docs/app/api-reference/config/typescript for more information.
@@ -0,0 +1,7 @@
1
+ const nextConfig = {
2
+ reactStrictMode: true,
3
+ serverExternalPackages: ['better-sqlite3'],
4
+ allowedDevOrigins: ['187.77.156.41', '127.0.0.1', 'localhost', 'rev4a.srv1490011.hstgr.cloud'],
5
+ };
6
+
7
+ export default nextConfig;
package/package.json ADDED
@@ -0,0 +1,82 @@
1
+ {
2
+ "name": "@flame0510/project-aether",
3
+ "version": "1.1.9",
4
+ "description": "Rev4a \u2014 Revolution for Agents. OpenClaw agent fleet orchestrator.",
5
+ "keywords": [
6
+ "openclaw",
7
+ "rev4a",
8
+ "dashboard",
9
+ "monitoring",
10
+ "ai",
11
+ "agents"
12
+ ],
13
+ "license": "MIT",
14
+ "repository": {
15
+ "type": "git",
16
+ "url": "git+https://github.com/Flame0510/rev4a.git"
17
+ },
18
+ "bugs": {
19
+ "url": "https://github.com/Flame0510/rev4a/issues"
20
+ },
21
+ "homepage": "https://github.com/Flame0510/rev4a#readme",
22
+ "bin": {
23
+ "rev4a": "bin/rev4a.js"
24
+ },
25
+ "engines": {
26
+ "node": ">=22"
27
+ },
28
+ "files": [
29
+ "bin/",
30
+ "app/",
31
+ "lib/",
32
+ "public/",
33
+ "scripts/",
34
+ "docs/",
35
+ "agent-templates/",
36
+ "rev4a-rules/",
37
+ "daemon.js",
38
+ "lineage.js",
39
+ "terminal-ws-server.js",
40
+ "package.json",
41
+ "next.config.mjs",
42
+ "tsconfig.json",
43
+ "next-env.d.ts",
44
+ "*.css",
45
+ "*.png",
46
+ "model-pricing.json",
47
+ "models.config.json"
48
+ ],
49
+ "scripts": {
50
+ "dev": "next dev -p 3720",
51
+ "build": "next build",
52
+ "start": "rev4a serve",
53
+ "start:all": "rev4a serve",
54
+ "smoke:db-bootstrap": "node scripts/smoke-db-bootstrap.mjs",
55
+ "postinstall": "node bin/postinstall.js"
56
+ },
57
+ "dependencies": {
58
+ "@types/better-sqlite3": "^7.6.13",
59
+ "better-sqlite3": "^13.0.2",
60
+ "cron-parser": "^5.5.0",
61
+ "d3": "^7.9.0",
62
+ "highlight.js": "^11.11.1",
63
+ "html-to-image": "^1.11.13",
64
+ "html2canvas": "^1.4.1",
65
+ "jose": "^6.2.3",
66
+ "marked": "^18.0.5",
67
+ "next": "^16.0.1",
68
+ "node-pty": "^1.1.0",
69
+ "react": "^19.2.0",
70
+ "react-dom": "^19.2.0",
71
+ "ws": "^8.21.0"
72
+ },
73
+ "devDependencies": {
74
+ "@playwright/test": "^1.61.1",
75
+ "@types/d3": "^7.4.3",
76
+ "@types/node": "25.9.5",
77
+ "@types/react": "19.2.17",
78
+ "@types/react-dom": "^19.2.3",
79
+ "@types/ws": "^8.18.1",
80
+ "typescript": "6.0.3"
81
+ }
82
+ }
Binary file
Binary file
@@ -0,0 +1,58 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <svg
3
+ xmlns="http://www.w3.org/2000/svg"
4
+ viewBox="0 0 1254 1254"
5
+ role="img"
6
+ aria-labelledby="title desc"
7
+ shape-rendering="geometricPrecision"
8
+ >
9
+ <title id="title">REV4A glyph</title>
10
+ <desc id="desc">The fused geometric 4A monogram used by REV4A.</desc>
11
+
12
+ <defs>
13
+ <linearGradient
14
+ id="rev4a-violet"
15
+ x1="249"
16
+ y1="250"
17
+ x2="1012"
18
+ y2="1005"
19
+ gradientUnits="userSpaceOnUse"
20
+ >
21
+ <stop offset="0" stop-color="#965FFF" />
22
+ <stop offset="0.52" stop-color="#925BFC" />
23
+ <stop offset="1" stop-color="#8E57FB" />
24
+ </linearGradient>
25
+ </defs>
26
+
27
+ <path
28
+ fill="url(#rev4a-violet)"
29
+ fill-rule="evenodd"
30
+ clip-rule="evenodd"
31
+ d="
32
+ M 1012 1005
33
+ H 882
34
+ L 857 961
35
+ H 733
36
+ L 732 1005
37
+ H 613
38
+ V 416
39
+ L 418 662
40
+ L 578 663
41
+ L 579 803
42
+ H 249
43
+ V 664
44
+ L 416 458
45
+ L 575 255
46
+ L 579 250
47
+ H 736
48
+ V 541
49
+ L 1012 1005
50
+ Z
51
+
52
+ M 729 746
53
+ V 875
54
+ H 807
55
+ Z
56
+ "
57
+ />
58
+ </svg>
Binary file
Binary file
Binary file
Binary file
@@ -0,0 +1,38 @@
1
+ {
2
+ "id": "/",
3
+ "name": "REV4A - Agency Monitor",
4
+ "short_name": "REV4A",
5
+ "description": "Mobile-ready monitoring dashboard for OpenClaw workspaces.",
6
+ "start_url": "/",
7
+ "scope": "/",
8
+ "display": "standalone",
9
+ "orientation": "portrait-primary",
10
+ "background_color": "#0A0A0B",
11
+ "theme_color": "#925BFC",
12
+ "icons": [
13
+ {
14
+ "src": "/icon-192.png",
15
+ "sizes": "192x192",
16
+ "type": "image/png",
17
+ "purpose": "any"
18
+ },
19
+ {
20
+ "src": "/icon-512.png",
21
+ "sizes": "512x512",
22
+ "type": "image/png",
23
+ "purpose": "any"
24
+ },
25
+ {
26
+ "src": "/icon-192-maskable.png",
27
+ "sizes": "192x192",
28
+ "type": "image/png",
29
+ "purpose": "maskable"
30
+ },
31
+ {
32
+ "src": "/icon-512-maskable.png",
33
+ "sizes": "512x512",
34
+ "type": "image/png",
35
+ "purpose": "maskable"
36
+ }
37
+ ]
38
+ }
Binary file
@@ -0,0 +1,58 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <svg
3
+ xmlns="http://www.w3.org/2000/svg"
4
+ viewBox="0 0 1254 1254"
5
+ role="img"
6
+ aria-labelledby="title desc"
7
+ shape-rendering="geometricPrecision"
8
+ >
9
+ <title id="title">REV4A glyph</title>
10
+ <desc id="desc">The fused geometric 4A monogram used by REV4A.</desc>
11
+
12
+ <defs>
13
+ <linearGradient
14
+ id="rev4a-violet"
15
+ x1="249"
16
+ y1="250"
17
+ x2="1012"
18
+ y2="1005"
19
+ gradientUnits="userSpaceOnUse"
20
+ >
21
+ <stop offset="0" stop-color="#965FFF" />
22
+ <stop offset="0.52" stop-color="#925BFC" />
23
+ <stop offset="1" stop-color="#8E57FB" />
24
+ </linearGradient>
25
+ </defs>
26
+
27
+ <path
28
+ fill="url(#rev4a-violet)"
29
+ fill-rule="evenodd"
30
+ clip-rule="evenodd"
31
+ d="
32
+ M 1012 1005
33
+ H 882
34
+ L 857 961
35
+ H 733
36
+ L 732 1005
37
+ H 613
38
+ V 416
39
+ L 418 662
40
+ L 578 663
41
+ L 579 803
42
+ H 249
43
+ V 664
44
+ L 416 458
45
+ L 575 255
46
+ L 579 250
47
+ H 736
48
+ V 541
49
+ L 1012 1005
50
+ Z
51
+
52
+ M 729 746
53
+ V 875
54
+ H 807
55
+ Z
56
+ "
57
+ />
58
+ </svg>
@@ -0,0 +1,37 @@
1
+ # Rev4a System Rules
2
+
3
+ You are an agent managed by **Rev4a**, the OpenClaw infrastructure dashboard.
4
+ These rules are injected automatically into every session. They are immutable —
5
+ mounted read-only by the container runtime.
6
+
7
+ ## Immutable Boundaries
8
+
9
+ - **Your workspace is `/root/.openclaw/workspace/`.** This exact path is managed
10
+ by Rev4a. Do **NOT** rename, move, delete, or symlink it.
11
+ Create subdirectories inside it if you need project structure
12
+ (e.g. `workspace/my-project/`).
13
+ - **This file (`.rev4a/AGENTS.md`) is read-only system configuration.**
14
+ Do not attempt to modify, delete, or move it. The filesystem will reject writes.
15
+ - **Your config (`openclaw.json`), channels, model selection, and provider keys**
16
+ are managed through the Rev4a dashboard — not by editing config files directly.
17
+ Rev4a may apply configuration changes at any time.
18
+ - **Rev4a may restart your gateway** for updates or configuration changes.
19
+ This is normal operation and does not indicate a problem.
20
+
21
+ ## What Rev4a Handles
22
+
23
+ - Provider API keys and model catalogue
24
+ - Channel connections (Telegram, etc.)
25
+ - Container lifecycle (create, restart, recreate, backup, delete)
26
+ - Workspace file management
27
+ - Updates and migrations
28
+
29
+ ## Rev4a-Aware Behavior
30
+
31
+ - If you encounter an issue with your configuration, channels, or workspace
32
+ path, report it to the user — do not attempt to fix it by modifying system
33
+ files or directories yourself.
34
+ - You may read any file in your workspace. You may write files **inside** the
35
+ workspace. You may not rename or restructure the workspace root itself.
36
+ - When in doubt about system boundaries, ask the user or check the Rev4a
37
+ dashboard rather than experimenting with container internals.
@@ -0,0 +1,185 @@
1
+ #!/usr/bin/env node
2
+ 'use strict';
3
+
4
+ /**
5
+ * add-auth-to-routes.cjs
6
+ *
7
+ * Injects `requireAuthJWT` into every unprotected API route handler.
8
+ * Strategy:
9
+ * 1. Insert import line after the last existing import
10
+ * 2. Add auth check as first statement in every exported HTTP handler
11
+ * 3. Handle _req/_request/req → rename to request (standardize)
12
+ * 4. Handle handlers with no request param (add one)
13
+ * 5. Handle .ts and .js files
14
+ *
15
+ * Whitelist (public routes, no auth):
16
+ * app/api/auth/*, app/api/setup/*, app/api/wizard/*, app/api/provider/v1/*
17
+ */
18
+
19
+ const fs = require('fs');
20
+ const path = require('path');
21
+
22
+ const ROOT = path.resolve(__dirname, '..');
23
+ const API_DIR = path.join(ROOT, 'app', 'api');
24
+
25
+ const WHITELIST = [
26
+ 'app/api/auth/',
27
+ 'app/api/setup/',
28
+ 'app/api/wizard/',
29
+ 'app/api/provider/v1/',
30
+ ];
31
+
32
+ const ALREADY_PROTECTED = new Set([
33
+ 'app/api/cost-override/route.ts',
34
+ 'app/api/skills/promote/route.js',
35
+ 'app/api/skills/save/route.js',
36
+ 'app/api/skills/delete/route.js',
37
+ ]);
38
+
39
+ const IMPORT_LINE = `import { requireAuthJWT } from '@/lib/rev4a-auth';`;
40
+
41
+ const METHODS = ['GET', 'POST', 'PUT', 'PATCH', 'DELETE'];
42
+
43
+ function walk(dir) {
44
+ const out = [];
45
+ for (const e of fs.readdirSync(dir, { withFileTypes: true })) {
46
+ const p = path.join(dir, e.name);
47
+ if (e.isDirectory()) out.push(...walk(p));
48
+ else if (e.name === 'route.ts' || e.name === 'route.js') out.push(p);
49
+ }
50
+ return out;
51
+ }
52
+
53
+ /** Check if this path is whitelisted (public) */
54
+ function isWhitelisted(absPath) {
55
+ const rel = path.relative(ROOT, absPath);
56
+ return WHITELIST.some(w => rel.startsWith(w));
57
+ }
58
+
59
+ /** Check if this path already has auth protection */
60
+ function isProtected(absPath) {
61
+ const rel = path.relative(ROOT, absPath);
62
+ return ALREADY_PROTECTED.has(rel);
63
+ }
64
+
65
+ /**
66
+ * Rewrite a single file to add requireAuthJWT to every exported handler.
67
+ * Returns { status, reason, modified }.
68
+ */
69
+ function processFile(filePath) {
70
+ let src = fs.readFileSync(filePath, 'utf-8');
71
+ const isJs = filePath.endsWith('.js');
72
+
73
+ if (src.includes('requireAuthJWT')) {
74
+ return { status: 'skip', reason: 'already has requireAuthJWT' };
75
+ }
76
+
77
+ // Check if any HTTP handler exists
78
+ const hasMethod = METHODS.some(m => new RegExp(
79
+ `export\\s+(async\\s+)?function\\s+${m}\\s*\\(`
80
+ ).test(src));
81
+ if (!hasMethod) {
82
+ return { status: 'skip', reason: 'no HTTP handler' };
83
+ }
84
+
85
+ let modified = false;
86
+
87
+ // ── Step 1: Add import ────────────────────────────────────────
88
+ if (!src.includes(IMPORT_LINE)) {
89
+ const lines = src.split('\n');
90
+ let lastImport = -1;
91
+ for (let i = 0; i < lines.length; i++) {
92
+ const t = lines[i].trim();
93
+ if (t.startsWith('import ') || t === "'use strict';" || t === '"use strict";') {
94
+ lastImport = i;
95
+ }
96
+ }
97
+ if (lastImport >= 0) {
98
+ lines.splice(lastImport + 1, 0, IMPORT_LINE);
99
+ }
100
+ // else: no imports? prepend after block comment if any
101
+ src = lines.join('\n');
102
+ modified = true;
103
+ }
104
+
105
+ // ── Step 2: Standardize handler signatures ───────────────────
106
+ // Replace _req, _request, req (not "request") with "request" as first param
107
+ for (const m of METHODS) {
108
+ // "_req: Type" or "_req)" → "request: Type" / "request)"
109
+ src = src.replace(
110
+ new RegExp(`(function\\s+${m}\\s*\\()\\s*_req\\b`, 'g'),
111
+ '$1request'
112
+ );
113
+ // "_request: Type" or "_request)" → "request: Type" / "request)"
114
+ src = src.replace(
115
+ new RegExp(`(function\\s+${m}\\s*\\()\\s*_request\\b`, 'g'),
116
+ '$1request'
117
+ );
118
+ // "req:" (standalone, not part of "request:") → "request:"
119
+ src = src.replace(
120
+ new RegExp(`(function\\s+${m}\\s*\\()\\s*req\\b(?!uest)`, 'g'),
121
+ '$1request'
122
+ );
123
+ // "req)" (standalone) → "request)"
124
+ // (handled by the line below with the function body regex)
125
+ }
126
+
127
+ // Also fix body references: req.url → request.url, req.json → request.json
128
+ // Only in protected files that had _req or req renamed
129
+ src = src.replace(/\breq\.url\b/g, 'request.url');
130
+ src = src.replace(/\breq\.json\b/g, 'request.json');
131
+
132
+ // ── Step 3: Ensure every handler has "request" param ─────────
133
+ for (const m of METHODS) {
134
+ // Match: export async function METHOD() { (no params)
135
+ const noParams = new RegExp(
136
+ `(export\\s+(async\\s+)?function\\s+${m})\\s*\\(\\s*\\)`,
137
+ 'g'
138
+ );
139
+ src = src.replace(noParams, `$1(_req: NextRequest) { const request = _req;`);
140
+ modified = modified || noParams.test(src);
141
+ }
142
+
143
+ // ── Step 4: Inject auth check ─────────────────────────────────
144
+ for (const m of METHODS) {
145
+ // Match handler signature up to the opening brace + newline
146
+ // Pattern: export async function METHOD(params...) { \n
147
+ const pat = new RegExp(
148
+ `(export\\s+(async\\s+)?function\\s+${m}\\s*\\([^)]*\\)[^\{]*\\{)\\n`,
149
+ 'g'
150
+ );
151
+ const auth = isJs
152
+ ? ' const denied = await requireAuthJWT(request); if (denied) return denied;'
153
+ : ' const denied = await requireAuthJWT(request); if (denied) return denied as any;';
154
+ src = src.replace(pat, `$1\n${auth}\n`);
155
+ }
156
+
157
+ modified = true; // We injected auth
158
+ fs.writeFileSync(filePath, src, 'utf-8');
159
+ return { status: 'ok', reason: 'injected', modified };
160
+ }
161
+
162
+ // ── Main ────────────────────────────────────────────────────────
163
+ console.log('Step 1: Discover routes\n');
164
+ const all = walk(API_DIR);
165
+ console.log(`Total: ${all.length}\n`);
166
+
167
+ const targets = [];
168
+ for (const p of all) {
169
+ const rel = path.relative(ROOT, p);
170
+ if (isWhitelisted(p)) { console.log(` [whitelist] ${rel}`); continue; }
171
+ if (isProtected(p)) { console.log(` [protected] ${rel}`); continue; }
172
+ targets.push(p);
173
+ }
174
+
175
+ console.log(`\nStep 2: Inject auth into ${targets.length} routes\n`);
176
+
177
+ let ok = 0, skip = 0;
178
+ for (const p of targets) {
179
+ const rel = path.relative(ROOT, p);
180
+ const r = processFile(p);
181
+ if (r.status === 'ok') { console.log(` ✓ ${rel}`); ok++; }
182
+ else { console.log(` - ${rel} (${r.reason})`); skip++; }
183
+ }
184
+
185
+ console.log(`\nDone: ${ok} modified, ${skip} skipped`);
@@ -0,0 +1,66 @@
1
+ #!/usr/bin/env bash
2
+ # backup.sh — Backup Rev4a data to a tar.gz archive
3
+ #
4
+ # Usage:
5
+ # sudo bash scripts/backup.sh # backup to ./backups/
6
+ # sudo bash scripts/backup.sh /path/to/backups # custom directory
7
+ #
8
+ # What it backs up:
9
+ # - data/*.db (events, credentials, lineage)
10
+ # - data/provider-keys.json
11
+ # - data/agents-token.json
12
+ # - models.config.json
13
+ # - .env (credentials and configuration)
14
+ #
15
+ # Does NOT back up:
16
+ # - node_modules (can be reinstalled)
17
+ # - .next build cache (can be rebuilt)
18
+ set -euo pipefail
19
+
20
+ # Resolve script directory
21
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
22
+ REV4A_ROOT="$(cd "${SCRIPT_DIR}/.." && pwd)"
23
+ BACKUP_DIR="${1:-${REV4A_ROOT}/backups}"
24
+
25
+ mkdir -p "$BACKUP_DIR"
26
+
27
+ TS=$(date -u +%Y%m%d-%H%M%S)
28
+ ARCHIVE="${BACKUP_DIR}/rev4a-backup-${TS}.tar.gz"
29
+
30
+ echo "Backing up Rev4a data..."
31
+ echo " Source: ${REV4A_ROOT}"
32
+ echo " Target: ${ARCHIVE}"
33
+
34
+ cd "$REV4A_ROOT"
35
+
36
+ # Restrict permissions during archive creation
37
+ umask 077
38
+
39
+ # Create tar with only the files we care about
40
+ tar -czf "$ARCHIVE" \
41
+ --exclude='node_modules' \
42
+ --exclude='.next' \
43
+ --exclude='.git' \
44
+ --exclude='backups' \
45
+ data/*.db \
46
+ data/*.db-shm \
47
+ data/*.db-wal \
48
+ data/provider-keys.json 2>/dev/null || true \
49
+ data/agents-token.json 2>/dev/null || true \
50
+ models.config.json 2>/dev/null || true \
51
+ .env 2>/dev/null || true
52
+
53
+ echo ""
54
+ echo "=============================================="
55
+ echo " Backup complete!"
56
+ echo "=============================================="
57
+ echo ""
58
+ echo " Archive: ${ARCHIVE}"
59
+ echo " Size: $(du -h "$ARCHIVE" | cut -f1)"
60
+ echo ""
61
+ chmod 600 "$ARCHIVE"
62
+ echo " WARNING: This archive contains plain-text credentials (.env)."
63
+ echo " Store it securely (encrypted at rest recommended)."
64
+ echo ""
65
+ echo " To restore: sudo bash scripts/restore.sh ${ARCHIVE}"
66
+ echo "=============================================="