levix-bot 4.9.1 → 5.0.0

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 (245) hide show
  1. package/README.md +57 -3
  2. package/SETUP.md +63 -7
  3. package/app.cjs +159 -46
  4. package/deploy/install.sh +10 -5
  5. package/package.json +9 -6
  6. package/public/dashboard/assets/40af6d88b63079a0-BZ8ojJNu.woff2 +0 -0
  7. package/public/dashboard/assets/481acf6760031cee-BypgxfGb.woff2 +0 -0
  8. package/public/dashboard/assets/6d3351fc535f8ef3-D2-eand5.woff2 +0 -0
  9. package/public/dashboard/assets/8ab0af53a3bda9d3-CyCXRvzh.woff2 +0 -0
  10. package/public/dashboard/assets/8f262393e9249e61-TQp-UTiE.woff2 +0 -0
  11. package/public/dashboard/assets/94d65887a83f1282-DmpS2jIq.woff2 +0 -0
  12. package/public/dashboard/assets/99e400330f36ae77-D3oMJlXt.woff2 +0 -0
  13. package/public/dashboard/assets/9d1f41b13e519d90-BVNSOH3d.woff2 +0 -0
  14. package/public/dashboard/assets/a005256cb957ecc7-CoYeBiSI.woff2 +0 -0
  15. package/public/dashboard/assets/b19c2080652a3c2b-DIC32ArD.woff2 +0 -0
  16. package/public/dashboard/assets/c4064400db3750ce-BehTv68k.woff2 +0 -0
  17. package/public/dashboard/assets/c69d345fa1068c2d-CmI34b-g.woff2 +0 -0
  18. package/public/dashboard/assets/cc27b30471250057-6fWv1k7M.woff2 +0 -0
  19. package/public/dashboard/assets/d8c30647abfeffe6-eXO_dkmS.woff2 +0 -0
  20. package/public/dashboard/assets/eb83d8d40af4411f-Buze_B52.woff2 +0 -0
  21. package/public/dashboard/assets/effc6711249e7349-qRpaaN48.woff2 +0 -0
  22. package/public/dashboard/assets/gateway-BDYet0pI.css +1 -0
  23. package/public/dashboard/assets/gateway-BYt6-s1O.js +1 -0
  24. package/public/dashboard/assets/index-B9wFpD_z.css +2 -0
  25. package/public/dashboard/assets/index-DWcQmu0_.js +124 -0
  26. package/public/dashboard/assets/index-Da-j89O-.js +458 -0
  27. package/public/dashboard/font-licenses/jetbrainsmono-OFL.txt +93 -0
  28. package/public/dashboard/font-licenses/plusjakartasans-OFL.txt +93 -0
  29. package/public/dashboard/font-licenses/tajawal-OFL.txt +93 -0
  30. package/public/dashboard/gateway.html +17 -0
  31. package/public/dashboard/index.html +3 -5
  32. package/public/ui-boot.js +33 -14
  33. package/scheduler.cjs +76 -23
  34. package/src/auth/auth-storage.cjs +54 -7
  35. package/src/auth/use-database-auth-state.js +70 -39
  36. package/src/automation/engine.js +412 -0
  37. package/src/automation/limits.cjs +6 -0
  38. package/src/automation/manage.js +290 -0
  39. package/src/automation/reactions.js +471 -0
  40. package/src/automation/rules.cjs +114 -0
  41. package/src/automation/status.cjs +76 -0
  42. package/src/backup/account.cjs +29 -0
  43. package/src/backup/activation.cjs +247 -0
  44. package/src/backup/content.cjs +36 -0
  45. package/src/backup/create.cjs +280 -0
  46. package/src/backup/extensions.cjs +101 -0
  47. package/src/backup/format.cjs +565 -0
  48. package/src/backup/jobs.cjs +111 -0
  49. package/src/backup/journal.cjs +41 -0
  50. package/src/backup/plan.cjs +223 -0
  51. package/src/backup/recovery.cjs +110 -0
  52. package/src/backup/restore.cjs +460 -0
  53. package/src/backup/uploads.cjs +146 -0
  54. package/src/bootstrap/core.js +50 -12
  55. package/src/bootstrap/panel.js +53 -2
  56. package/src/bootstrap/session-startup-policy.js +8 -1
  57. package/src/cli.js +163 -22
  58. package/src/commands/autodelete.cjs +41 -57
  59. package/src/commands/autoschedule.cjs +7 -33
  60. package/src/commands/blacklist.cjs +17 -35
  61. package/src/commands/block.cjs +4 -18
  62. package/src/commands/calc.cjs +22 -74
  63. package/src/commands/debt.cjs +28 -59
  64. package/src/commands/deleteschedule.cjs +7 -23
  65. package/src/commands/digit.cjs +5 -39
  66. package/src/commands/gemini.cjs +135 -218
  67. package/src/commands/group/add.cjs +28 -76
  68. package/src/commands/group/all.cjs +4 -15
  69. package/src/commands/group/antilink.cjs +28 -41
  70. package/src/commands/group/antispam.cjs +25 -35
  71. package/src/commands/group/approveall.cjs +7 -21
  72. package/src/commands/group/clearwarns.cjs +4 -18
  73. package/src/commands/group/deletenote.cjs +4 -18
  74. package/src/commands/group/demote.cjs +6 -23
  75. package/src/commands/group/flagged.cjs +10 -19
  76. package/src/commands/group/kick.cjs +26 -36
  77. package/src/commands/group/media.cjs +21 -36
  78. package/src/commands/group/members.cjs +16 -28
  79. package/src/commands/group/note.cjs +3 -14
  80. package/src/commands/group/policy.cjs +16 -37
  81. package/src/commands/group/promote.cjs +5 -22
  82. package/src/commands/group/removeall.cjs +6 -38
  83. package/src/commands/group/rules.cjs +4 -19
  84. package/src/commands/group/save.cjs +4 -18
  85. package/src/commands/group/setname.cjs +5 -19
  86. package/src/commands/group/setpp.cjs +8 -26
  87. package/src/commands/group/setrules.cjs +4 -15
  88. package/src/commands/group/setwarn.cjs +6 -23
  89. package/src/commands/group/tagadmins.cjs +5 -16
  90. package/src/commands/group/warn.cjs +5 -16
  91. package/src/commands/group/warns.cjs +12 -33
  92. package/src/commands/group/welcome.cjs +17 -34
  93. package/src/commands/group.cjs +91 -68
  94. package/src/commands/help.cjs +48 -89
  95. package/src/commands/lang.cjs +38 -97
  96. package/src/commands/listschedules.cjs +19 -30
  97. package/src/commands/loop.cjs +9 -55
  98. package/src/commands/md.cjs +2 -13
  99. package/src/commands/memory.cjs +53 -87
  100. package/src/commands/mod.cjs +40 -79
  101. package/src/commands/notes.cjs +4 -15
  102. package/src/commands/pack.cjs +26 -49
  103. package/src/commands/packs.cjs +8 -18
  104. package/src/commands/perm.cjs +48 -51
  105. package/src/commands/ping.cjs +2 -10
  106. package/src/commands/poll.cjs +5 -38
  107. package/src/commands/prayer.cjs +55 -36
  108. package/src/commands/qr.cjs +4 -18
  109. package/src/commands/rand.cjs +9 -58
  110. package/src/commands/restart.cjs +15 -33
  111. package/src/commands/schedule.cjs +5 -25
  112. package/src/commands/score.cjs +6 -27
  113. package/src/commands/send.cjs +4 -18
  114. package/src/commands/setprefix.cjs +11 -23
  115. package/src/commands/shortlink.cjs +13 -39
  116. package/src/commands/status.cjs +188 -76
  117. package/src/commands/sticker.cjs +5 -16
  118. package/src/commands/stickers.cjs +16 -20
  119. package/src/commands/stopbot.cjs +9 -25
  120. package/src/commands/stt.cjs +75 -107
  121. package/src/commands/todo.cjs +11 -31
  122. package/src/commands/toimage.cjs +11 -27
  123. package/src/commands/translate.cjs +53 -36
  124. package/src/commands/tts.cjs +46 -40
  125. package/src/commands/unblock.cjs +3 -17
  126. package/src/commands/update.cjs +23 -0
  127. package/src/commands/weather.cjs +40 -47
  128. package/src/config/ai-identity.cjs +14 -1
  129. package/src/config/baileys.config.js +16 -3
  130. package/src/config/data-dir.cjs +37 -0
  131. package/src/config/defaults.cjs +1 -0
  132. package/src/config/exit-codes.cjs +11 -0
  133. package/src/config/lock.cjs +55 -81
  134. package/src/config/official-links.cjs +61 -0
  135. package/src/config/paths.cjs +4 -33
  136. package/src/config/release.cjs +87 -0
  137. package/src/config/settings.cjs +199 -10
  138. package/src/core/connection.js +77 -9
  139. package/src/core/events.js +119 -33
  140. package/src/core/session.js +536 -84
  141. package/src/core/socket.js +81 -10
  142. package/src/db/copy.cjs +136 -0
  143. package/src/db/db.cjs +241 -36
  144. package/src/db/startup-guard.js +5 -0
  145. package/src/db/store.cjs +561 -54
  146. package/src/diagnostics/baileysLog.cjs +87 -0
  147. package/src/diagnostics/debugLog.cjs +16 -4
  148. package/src/diagnostics/device.cjs +4 -2
  149. package/src/diagnostics/nodeRuntime.cjs +131 -0
  150. package/src/diagnostics/signalSessionInspect.cjs +38 -0
  151. package/src/domain/command.js +24 -22
  152. package/src/extensions/autoReply.cjs +521 -0
  153. package/src/extensions/context.cjs +73 -0
  154. package/src/extensions/contract.cjs +69 -0
  155. package/src/extensions/entitlement/client.cjs +381 -0
  156. package/src/extensions/entitlement/index.cjs +629 -0
  157. package/src/extensions/entitlement/installation.cjs +117 -0
  158. package/src/extensions/entitlement/keys.cjs +72 -0
  159. package/src/extensions/entitlement/state.cjs +201 -0
  160. package/src/extensions/entitlement/target.cjs +7 -0
  161. package/src/extensions/entitlement/token.cjs +225 -0
  162. package/src/extensions/host.cjs +519 -0
  163. package/src/extensions/templateKeys.cjs +81 -0
  164. package/src/handlers/command.handler.js +191 -64
  165. package/src/handlers/group.handler.js +78 -18
  166. package/src/handlers/message.handler.js +56 -25
  167. package/src/i18n/catalog.generated.cjs +3537 -0
  168. package/src/index.js +51 -12
  169. package/src/legal/bundled/ar.json +102 -0
  170. package/src/legal/bundled/en.json +102 -0
  171. package/src/legal/bundled/es-419.json +102 -0
  172. package/src/legal/bundled/pt-BR.json +102 -0
  173. package/src/legal/cli.cjs +200 -0
  174. package/src/legal/consent.cjs +187 -0
  175. package/src/legal/document.cjs +156 -0
  176. package/src/legal/keys.cjs +100 -0
  177. package/src/legal/release.cjs +226 -0
  178. package/src/legal/remote.cjs +419 -0
  179. package/src/legal/terms.cjs +142 -0
  180. package/src/messaging/escape.cjs +31 -0
  181. package/src/messaging/health.cjs +65 -0
  182. package/src/messaging/identity.cjs +42 -0
  183. package/src/messaging/message.cjs +136 -0
  184. package/src/messaging/parser.cjs +88 -0
  185. package/src/messaging/router.cjs +217 -0
  186. package/src/middleware/permissions.middleware.js +34 -2
  187. package/src/panel/account-profile.cjs +489 -0
  188. package/src/panel/fallback-page.cjs +177 -0
  189. package/src/panel/password-reset.cjs +13 -14
  190. package/src/panel/recovery-email.cjs +3 -1
  191. package/src/routes/backup.api.esm.js +175 -0
  192. package/src/routes/dashboard.api.esm.js +183 -7
  193. package/src/routes/plus.api.esm.js +172 -0
  194. package/src/routes/reactions.api.esm.js +60 -0
  195. package/src/services/aiAgent.cjs +56 -43
  196. package/src/services/aiDocs.cjs +187 -0
  197. package/src/services/aiImage.cjs +183 -0
  198. package/src/services/aiMedia.cjs +146 -0
  199. package/src/services/aiProviders.cjs +76 -80
  200. package/src/services/aiRouter.cjs +2 -2
  201. package/src/services/aiToolAuth.cjs +76 -4
  202. package/src/services/aiTools.cjs +431 -105
  203. package/src/services/autoDelete.cjs +9 -1
  204. package/src/services/levix-docs.generated.json +2623 -0
  205. package/src/services/memoryPolicy.cjs +56 -0
  206. package/src/services/updateCheck.cjs +362 -0
  207. package/src/stickers/errors.cjs +53 -97
  208. package/src/stickers/library.cjs +13 -6
  209. package/src/stickers/owner.cjs +1 -1
  210. package/src/utils/commandContext.cjs +13 -0
  211. package/src/utils/commandDocs.cjs +42 -20
  212. package/src/utils/geminiHttpOptions.cjs +56 -0
  213. package/src/utils/geminiMedia.cjs +28 -3
  214. package/src/utils/groupMetadataCache.cjs +386 -21
  215. package/src/utils/httpsFetch.cjs +113 -0
  216. package/src/utils/i18n.cjs +117 -7
  217. package/src/utils/linkPreview.cjs +90 -0
  218. package/src/utils/logger.cjs +6 -0
  219. package/src/utils/markdownParser.cjs +3 -3
  220. package/src/utils/memory.cjs +375 -28
  221. package/src/utils/messageContent.cjs +7 -1
  222. package/src/utils/moderationAction.cjs +116 -73
  223. package/src/utils/moderationSummary.cjs +32 -56
  224. package/src/utils/permissionLevel.cjs +7 -28
  225. package/src/utils/permissions.cjs +23 -14
  226. package/src/utils/permissions.esm.js +99 -166
  227. package/src/utils/recentMessageCache.esm.js +241 -37
  228. package/src/utils/recurrence.cjs +78 -66
  229. package/src/utils/sendBotMessage.cjs +14 -29
  230. package/src/utils/sendBotMessage.esm.js +28 -13
  231. package/src/utils/statusMessage.cjs +94 -33
  232. package/src/utils/stickerBot.cjs +18 -16
  233. package/src/utils/storage.cjs +2 -0
  234. package/src/utils/storage.esm.js +2 -0
  235. package/src/utils/thumbnail.cjs +5 -21
  236. package/public/dashboard/assets/index-B1sOW2VX.js +0 -561
  237. package/public/dashboard/assets/index-CK8osB4o.css +0 -2
  238. package/public/dashboard.css +0 -3127
  239. package/public/dashboard.js +0 -1981
  240. package/public/gateway-i18n.js +0 -321
  241. package/public/gateway.js +0 -70
  242. package/views/dashboard.ejs +0 -775
  243. package/views/login.ejs +0 -408
  244. package/views/qr.ejs +0 -155
  245. package/views/setup.ejs +0 -118
@@ -1,775 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <script src="/ui-boot.js"></script>
5
- <meta charset="UTF-8" />
6
- <meta name="viewport" content="width=device-width, initial-scale=1" />
7
- <title><%= brand.name %> · Control panel</title>
8
- <link rel="icon" type="image/png" sizes="32x32" href="/brand/icon-32.png" />
9
- <link rel="icon" type="image/png" sizes="16x16" href="/brand/icon-16.png" />
10
- <link rel="apple-touch-icon" href="/brand/apple-touch-icon.png" />
11
- <link rel="stylesheet" href="/dashboard.css" />
12
- </head>
13
- <body class="dashboard-page">
14
- <div class="shell">
15
- <aside class="sidebar" id="sidebar">
16
- <a
17
- class="brand"
18
- href="#overview"
19
- aria-label="<%= brand.name %> overview"
20
- >
21
- <img src="/brand/mark.svg" alt="" />
22
- <div class="brand-copy">
23
- <div class="brand-name"><%= brand.name %></div>
24
- <div class="brand-tag">Private control room</div>
25
- </div>
26
- <span class="brand-pulse" aria-hidden="true"
27
- ><i></i><i></i><i></i
28
- ></span>
29
- </a>
30
-
31
- <nav class="nav" aria-label="Primary navigation">
32
- <a href="#overview" data-view="overview">
33
- <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
34
- <rect width="7" height="7" x="3" y="3" rx="1" />
35
- <rect width="7" height="7" x="14" y="3" rx="1" />
36
- <rect width="7" height="7" x="14" y="14" rx="1" />
37
- <rect width="7" height="7" x="3" y="14" rx="1" />
38
- </svg>
39
- <span data-i18n="overview">Overview</span>
40
- </a>
41
- <a href="#connection" data-view="connection">
42
- <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
43
- <path d="M4.9 19.1C1 15.2 1 8.8 4.9 4.9" />
44
- <path d="M7.8 16.2c-2.3-2.3-2.3-6.1 0-8.5" />
45
- <circle cx="12" cy="12" r="2" />
46
- <path d="M16.2 7.8c2.3 2.3 2.3 6.1 0 8.5" />
47
- <path d="M19.1 4.9C23 8.8 23 15.1 19.1 19" />
48
- </svg>
49
- <span data-i18n="connection">Connection</span>
50
- </a>
51
-
52
- <div class="nav-label" data-i18n="control">Control</div>
53
- <a href="#commands" data-view="commands">
54
- <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
55
- <polyline points="4 17 10 11 4 5" />
56
- <line x1="12" y1="19" x2="20" y2="19" />
57
- </svg>
58
- <span data-i18n="commands">Commands</span>
59
- </a>
60
- <a href="#ai" data-view="ai">
61
- <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
62
- <path d="M12 8V4H8" />
63
- <rect width="16" height="12" x="4" y="8" rx="2" />
64
- <path d="M2 14h2" />
65
- <path d="M20 14h2" />
66
- <path d="M15 13v2" />
67
- <path d="M9 13v2" />
68
- </svg>
69
- <span data-i18n="ai">AI &amp; memory</span>
70
- </a>
71
- <a href="#groups" data-view="groups">
72
- <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
73
- <path d="M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2" />
74
- <circle cx="9" cy="7" r="4" />
75
- <path d="M22 21v-2a4 4 0 0 0-3-3.87" />
76
- <path d="M16 3.13a4 4 0 0 1 0 7.75" />
77
- </svg>
78
- <span data-i18n="groups">Groups</span>
79
- </a>
80
- <a href="#roles" data-view="roles">
81
- <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
82
- <path d="M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z" />
83
- </svg>
84
- <span data-i18n="roles">Roles</span>
85
- </a>
86
-
87
- <div class="nav-label" data-i18n="data_label">Data</div>
88
- <a href="#data" data-view="data">
89
- <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
90
- <path d="M12 2v20M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6" />
91
- </svg>
92
- <span data-i18n="data">Tables</span>
93
- </a>
94
- <a href="#settings" data-view="settings">
95
- <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
96
- <line x1="4" x2="4" y1="21" y2="14" />
97
- <line x1="4" x2="4" y1="10" y2="3" />
98
- <line x1="12" x2="12" y1="21" y2="12" />
99
- <line x1="12" x2="12" y1="8" y2="3" />
100
- <line x1="20" x2="20" y1="21" y2="16" />
101
- <line x1="20" x2="20" y1="12" y2="3" />
102
- <line x1="1" x2="7" y1="14" y2="14" />
103
- <line x1="9" x2="15" y1="8" y2="8" />
104
- <line x1="17" x2="23" y1="16" y2="16" />
105
- </svg>
106
- <span data-i18n="settings">Settings</span>
107
- </a>
108
- </nav>
109
-
110
- <div class="sidebar-foot">
111
- <div class="local-note">
112
- <span class="local-note-icon" aria-hidden="true"></span>
113
- <span
114
- ><strong>Self-hosted</strong>Your workspace, on your server.</span
115
- >
116
- </div>
117
- <div class="sidebar-credit flex">
118
- <div class="c1">
119
- &copy; <%= brand.copyrightYear %>
120
- <a href="<%= brand.developerSite %>"><%= brand.developer %></a>
121
- (<a href="<%= brand.studioSite %>"><%= brand.studio %></a>)
122
- </div>
123
- <a
124
- href="<%= brand.repo %>"
125
- target="_blank"
126
- rel="noopener noreferrer"
127
- >Source &amp; docs ↗</a
128
- >
129
- </div>
130
- </div>
131
- </aside>
132
-
133
- <button
134
- class="sidebar-backdrop"
135
- id="sidebar-backdrop"
136
- type="button"
137
- aria-label="Close navigation"
138
- ></button>
139
-
140
- <div class="main">
141
- <header class="topbar">
142
- <button
143
- class="btn btn-icon menu-btn"
144
- id="menu-btn"
145
- type="button"
146
- aria-label="Open navigation"
147
- aria-controls="sidebar"
148
- aria-expanded="false"
149
- >
150
- <svg viewBox="0 0 24 24" aria-hidden="true">
151
- <path d="M4 7h16M4 12h16M4 17h16" />
152
- </svg>
153
- </button>
154
- <div class="page-heading">
155
- <span>Levix workspace</span>
156
- <h1 id="page-title">Overview</h1>
157
- </div>
158
- <div class="spacer"></div>
159
- <div class="topbar-actions">
160
- <span class="pill" id="status-pill"
161
- ><span class="dot"></span>Checking…</span
162
- >
163
- <div class="icon-cluster">
164
- <button
165
- class="btn btn-icon"
166
- id="refresh-btn"
167
- type="button"
168
- aria-label="Refresh current view"
169
- title="Refresh current view"
170
- >
171
- <svg viewBox="0 0 24 24" aria-hidden="true">
172
- <path d="M20 11a8 8 0 1 0-2.34 5.66M20 4v7h-7" />
173
- </svg>
174
- </button>
175
- <button
176
- class="btn btn-icon theme-toggle"
177
- id="theme-btn"
178
- type="button"
179
- aria-label="Switch color theme"
180
- title="Switch color theme"
181
- >
182
- <svg class="sun-icon" viewBox="0 0 24 24" aria-hidden="true">
183
- <circle cx="12" cy="12" r="3.5" />
184
- <path
185
- d="M12 2v2M12 20v2M4.93 4.93l1.42 1.42M17.65 17.65l1.42 1.42M2 12h2M20 12h2M4.93 19.07l1.42-1.42M17.65 6.35l1.42-1.42"
186
- />
187
- </svg>
188
- <svg class="moon-icon" viewBox="0 0 24 24" aria-hidden="true">
189
- <path
190
- d="M20 15.4A8.5 8.5 0 0 1 8.6 4a8.5 8.5 0 1 0 11.4 11.4z"
191
- />
192
- </svg>
193
- </button>
194
- <button
195
- class="btn btn-icon lang-btn"
196
- id="lang-btn"
197
- type="button"
198
- aria-label="Switch language"
199
- title="Switch language / تغيير اللغة"
200
- >
201
- <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true">
202
- <circle cx="12" cy="12" r="10" />
203
- <line x1="2" y1="12" x2="22" y2="12" />
204
- <path d="M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z" />
205
- </svg>
206
- <span class="lang-tag" id="lang-tag">AR</span>
207
- </button>
208
- </div>
209
- <form action="/logout" method="post" class="logout-form">
210
- <button type="submit" class="btn btn-sm logout-btn">
211
- <span>Log out</span>
212
- <svg viewBox="0 0 24 24" aria-hidden="true">
213
- <path
214
- d="M10 17l5-5-5-5M15 12H3M14 3h5a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-5"
215
- />
216
- </svg>
217
- </button>
218
- </form>
219
- </div>
220
- </header>
221
-
222
- <main class="content">
223
- <!-- Overview ---------------------------------------------------->
224
- <section class="view" id="view-overview">
225
- <div class="overview-hero">
226
- <div class="hero-copy">
227
- <span class="eyebrow">Personal assistant operations</span>
228
- <h2>Your conversations,<br /><em>under one calm roof.</em></h2>
229
- <p>
230
- Watch the live connection, shape how Levix responds, and
231
- manage the details that keep every chat moving.
232
- </p>
233
- <div class="hero-actions">
234
- <a class="btn btn-primary" href="#connection">
235
- Manage connection
236
- <svg viewBox="0 0 24 24" aria-hidden="true">
237
- <path d="M5 12h14M13 6l6 6-6 6" />
238
- </svg>
239
- </a>
240
- <a class="text-link" href="#settings"
241
- >Tune workspace <span aria-hidden="true">↗</span></a
242
- >
243
- </div>
244
- </div>
245
- <div class="signal-stage" aria-hidden="true">
246
- <div class="signal-orbit orbit-one"></div>
247
- <div class="signal-orbit orbit-two"></div>
248
- <div class="signal-core">
249
- <img src="/brand/mark.svg" alt="" />
250
- </div>
251
- <span class="signal-node node-one"></span>
252
- <span class="signal-node node-two"></span>
253
- <span class="signal-node node-three"></span>
254
- <div class="signal-label">
255
- <span>Always within reach</span
256
- ><strong>One private workspace</strong>
257
- </div>
258
- </div>
259
- </div>
260
-
261
- <div class="section-head section-head-split">
262
- <div>
263
- <span class="eyebrow">Workspace pulse</span>
264
- <h2>At a glance</h2>
265
- <p>The essentials from your running assistant.</p>
266
- </div>
267
- <span class="section-note">Refreshes every 15 seconds</span>
268
- </div>
269
-
270
- <div class="stats" id="stat-cards"></div>
271
-
272
- <div class="card runtime-card">
273
- <div class="card-head">
274
- <div>
275
- <span class="eyebrow">Runtime</span>
276
- <h2>System signals</h2>
277
- </div>
278
- <span class="source">Current process</span>
279
- </div>
280
- <div class="grid-2" id="overview-info"></div>
281
- </div>
282
- </section>
283
-
284
- <!-- Connection -------------------------------------------------->
285
- <section class="view" id="view-connection">
286
- <div class="section-head">
287
- <span class="eyebrow">Live link</span>
288
- <h2>Connection</h2>
289
- <p>
290
- Start or stop the WhatsApp session, and link or unlink an
291
- account.
292
- </p>
293
- </div>
294
-
295
- <div class="card session-card">
296
- <div class="card-head">
297
- <div>
298
- <span class="eyebrow">WhatsApp</span>
299
- <h2>Session</h2>
300
- </div>
301
- <div class="spacer"></div>
302
- <span id="conn-state"></span>
303
- </div>
304
-
305
- <div class="hint session-detail" id="conn-detail"></div>
306
- <div id="conn-disconnect-alert" class="session-error-callout" style="display: none; margin-top: 10px; padding: 10px 14px; border-radius: 8px; background: rgba(239, 68, 68, 0.12); color: #ef4444; font-size: 13px; font-weight: 500; border: 1px solid rgba(239, 68, 68, 0.25);">
307
- <span id="conn-disconnect-text"></span>
308
- </div>
309
-
310
- <div class="hint" id="conn-proxy"></div>
311
-
312
- <div id="pair-chooser" class="pair-chooser">
313
- <p class="hint">How should this phone link?</p>
314
- <div class="pair-methods">
315
- <label class="pair-option">
316
- <input type="radio" name="pair-method" value="qr" />
317
- QR code
318
- </label>
319
- <label class="pair-option">
320
- <input type="radio" name="pair-method" value="pairing" />
321
- Pairing code
322
- </label>
323
- </div>
324
- <div id="pair-phone-wrap" class="pair-phone-wrap" hidden>
325
- <label for="pair-phone">WhatsApp number with country code</label>
326
- <input
327
- id="pair-phone"
328
- type="tel"
329
- inputmode="numeric"
330
- autocomplete="tel"
331
- placeholder="2010…"
332
- />
333
- <p class="hint">This WhatsApp’s own number. Country code, no leading 0 (Egypt: 2010… not 010…).</p>
334
- </div>
335
- </div>
336
-
337
- <div class="inline action-cluster">
338
- <button class="btn btn-primary" id="start-btn" type="button">
339
- Start session
340
- </button>
341
- <button class="btn" id="reconnect-btn" type="button">
342
- Reconnect to apply
343
- </button>
344
- <button class="btn" id="stop-btn" type="button">
345
- Stop session
346
- </button>
347
- <button class="btn btn-danger" id="unlink-btn" type="button">
348
- Unlink account
349
- </button>
350
- <button class="btn" id="restart-btn" type="button">
351
- Restart bot
352
- </button>
353
- </div>
354
- <div class="callout">
355
- <span class="callout-icon" aria-hidden="true">i</span>
356
- <p>
357
- Levix runs whether or not WhatsApp is connected. Starting the
358
- session is the only thing that opens a connection; restart
359
- only comes back on its own under a supervisor (pm2, systemd,
360
- Docker).
361
- </p>
362
- </div>
363
-
364
- <div id="qr-panel" style="display: none">
365
- <div class="qr-box" id="qr-box">
366
- <div class="qr-frame" id="qr-frame"></div>
367
- <div class="hint" id="qr-note">Waiting for a QR code…</div>
368
- <ol class="steps" id="qr-steps">
369
- <li>Open WhatsApp on the phone the bot should use.</li>
370
- <li>Settings → Linked devices → Link a device.</li>
371
- <li>Point the camera at the code above.</li>
372
- </ol>
373
- </div>
374
- <div class="qr-box" id="pairing-box" hidden>
375
- <div class="pairing-code" id="pairing-code">••••-••••</div>
376
- <div class="hint" id="pairing-phone"></div>
377
- <div class="hint" id="pairing-note">Waiting for a pairing code…</div>
378
- <ol class="steps">
379
- <li>Open WhatsApp on that number → Settings → Linked devices.</li>
380
- <li>Link a device → Link with phone number instead.</li>
381
- <li>Type the code above. Get a new code if it fails.</li>
382
- </ol>
383
- </div>
384
- </div>
385
- </div>
386
- </section>
387
-
388
- <!-- Commands ---------------------------------------------------->
389
- <section class="view" id="view-commands">
390
- <div class="section-head">
391
- <span class="eyebrow">Behavior</span>
392
- <h2>Commands</h2>
393
- <p>
394
- Rename triggers, change who may run what, switch commands off.
395
- </p>
396
- </div>
397
-
398
- <div class="card compact-card">
399
- <div class="card-head"><h2>Prefix</h2></div>
400
- <div class="inline prefix-control">
401
- <label class="sr-only" for="prefix-input">Command prefix</label>
402
- <input type="text" id="prefix-input" maxlength="3" />
403
- <button class="btn btn-primary" id="prefix-save" type="button">
404
- Save prefix
405
- </button>
406
- <span class="hint"
407
- >The character every command starts with, e.g.
408
- <code>!ping</code>.</span
409
- >
410
- </div>
411
- </div>
412
-
413
- <div class="card">
414
- <div class="toolbar">
415
- <label class="search-field">
416
- <span class="sr-only">Search commands</span>
417
- <svg viewBox="0 0 24 24" aria-hidden="true">
418
- <circle cx="11" cy="11" r="7" />
419
- <path d="m20 20-4-4" />
420
- </svg>
421
- <input
422
- type="text"
423
- id="cmd-search"
424
- placeholder="Search commands…"
425
- />
426
- </label>
427
- <select id="cmd-filter" aria-label="Filter commands by type">
428
- <option value="all">All commands</option>
429
- <option value="general">General</option>
430
- <option value="group">Group</option>
431
- </select>
432
- <div class="spacer" style="flex: 1"></div>
433
- <span class="hint">Changes apply to the next message.</span>
434
- </div>
435
-
436
- <div class="table-wrap">
437
- <table>
438
- <thead>
439
- <tr>
440
- <th>Command</th>
441
- <th>Type</th>
442
- <th>Aliases (comma separated)</th>
443
- <th>Who can run it</th>
444
- <th>On</th>
445
- </tr>
446
- </thead>
447
- <tbody id="cmd-body">
448
- <tr>
449
- <td colspan="5"><div class="loading">Loading…</div></td>
450
- </tr>
451
- </tbody>
452
- </table>
453
- </div>
454
- </div>
455
- </section>
456
-
457
- <!-- AI ---------------------------------------------------------->
458
- <section class="view" id="view-ai">
459
- <div class="section-head">
460
- <span class="eyebrow">Intelligence</span>
461
- <h2>AI &amp; memory</h2>
462
- <p>
463
- The prompt the model gets, and everything it has been told to
464
- remember.
465
- </p>
466
- </div>
467
-
468
- <div class="card">
469
- <div class="card-head">
470
- <h2>System prompt</h2>
471
- <div class="spacer"></div>
472
- <span class="hint"
473
- ><code id="persona-file">ai-persona.md</code></span
474
- >
475
- </div>
476
- <textarea id="persona-body" spellcheck="false"></textarea>
477
- <div class="inline form-actions">
478
- <button class="btn btn-primary" id="persona-save" type="button">
479
- Save prompt
480
- </button>
481
- <span class="hint"
482
- >Applies to the next message — no restart.</span
483
- >
484
- </div>
485
- </div>
486
-
487
- <div class="card">
488
- <div class="card-head"><h2>Long-term memory</h2></div>
489
- <div class="inline" id="memory-list"></div>
490
-
491
- <div
492
- id="memory-editor"
493
- class="memory-editor"
494
- style="display: none"
495
- >
496
- <div class="card-head">
497
- <h2>Editing <code id="memory-scope"></code></h2>
498
- </div>
499
- <textarea id="memory-content" spellcheck="false"></textarea>
500
- <div class="inline form-actions">
501
- <button
502
- class="btn btn-primary"
503
- id="memory-save"
504
- type="button"
505
- >
506
- Save memory
507
- </button>
508
- <button
509
- class="btn btn-danger"
510
- id="memory-delete"
511
- type="button"
512
- >
513
- Delete file
514
- </button>
515
- <span class="hint"
516
- >Plain Markdown — a line starting with <code>-</code> is one
517
- memory.</span
518
- >
519
- </div>
520
- </div>
521
- </div>
522
- </section>
523
-
524
- <!-- Groups ------------------------------------------------------>
525
- <section class="view" id="view-groups">
526
- <div class="section-head">
527
- <span class="eyebrow">Moderation</span>
528
- <h2>Groups</h2>
529
- <p>
530
- Moderation settings per group. Same values the
531
- <code>!group</code> commands change.
532
- </p>
533
- </div>
534
- <div id="groups-list"><div class="loading">Loading…</div></div>
535
- </section>
536
-
537
- <!-- Roles ------------------------------------------------------->
538
- <section class="view" id="view-roles">
539
- <div class="section-head">
540
- <span class="eyebrow">Access</span>
541
- <h2>Roles</h2>
542
- <p>
543
- Bot-level roles. An owner can do everything; an admin counts as
544
- an admin in every chat.
545
- </p>
546
- </div>
547
-
548
- <div class="card">
549
- <div class="card-head"><h2>Add someone</h2></div>
550
- <div class="inline role-control">
551
- <label class="sr-only" for="role-number">Phone number</label>
552
- <input
553
- type="text"
554
- id="role-number"
555
- placeholder="201234567890"
556
- inputmode="numeric"
557
- />
558
- <label class="sr-only" for="role-kind">Role</label>
559
- <select id="role-kind">
560
- <option value="admin">Admin</option>
561
- <option value="owner">Owner</option>
562
- </select>
563
- <button class="btn btn-primary" id="role-add" type="button">
564
- Add person
565
- </button>
566
- <span class="hint">International format, digits only.</span>
567
- </div>
568
- </div>
569
-
570
- <div class="card">
571
- <div class="card-head"><h2>Owners</h2></div>
572
- <div class="table-wrap">
573
- <table>
574
- <thead>
575
- <tr>
576
- <th>Number</th>
577
- <th>Name</th>
578
- <th></th>
579
- </tr>
580
- </thead>
581
- <tbody id="owners-body"></tbody>
582
- </table>
583
- </div>
584
- </div>
585
-
586
- <div class="card">
587
- <div class="card-head"><h2>Admins</h2></div>
588
- <div class="table-wrap">
589
- <table>
590
- <thead>
591
- <tr>
592
- <th>Number</th>
593
- <th>Name</th>
594
- <th></th>
595
- </tr>
596
- </thead>
597
- <tbody id="admins-body"></tbody>
598
- </table>
599
- </div>
600
- </div>
601
- </section>
602
-
603
- <!-- Data -------------------------------------------------------->
604
- <section class="view" id="view-data">
605
- <div class="section-head">
606
- <span class="eyebrow">Stored records</span>
607
- <h2>Tables</h2>
608
- <p>
609
- What the bot has stored: debts, warnings, notes, todo lists,
610
- known users.
611
- </p>
612
- </div>
613
-
614
- <div class="card">
615
- <div
616
- class="toolbar data-tabs"
617
- id="data-tabs"
618
- role="tablist"
619
- aria-label="Stored data tables"
620
- >
621
- <button
622
- class="btn btn-sm btn-primary"
623
- data-table="debts"
624
- type="button"
625
- role="tab"
626
- aria-selected="true"
627
- >
628
- Debts
629
- </button>
630
- <button
631
- class="btn btn-sm"
632
- data-table="warnings"
633
- type="button"
634
- role="tab"
635
- aria-selected="false"
636
- >
637
- Warnings
638
- </button>
639
- <button
640
- class="btn btn-sm"
641
- data-table="notes"
642
- type="button"
643
- role="tab"
644
- aria-selected="false"
645
- >
646
- Notes
647
- </button>
648
- <button
649
- class="btn btn-sm"
650
- data-table="todos"
651
- type="button"
652
- role="tab"
653
- aria-selected="false"
654
- >
655
- Todos
656
- </button>
657
- <button
658
- class="btn btn-sm"
659
- data-table="users"
660
- type="button"
661
- role="tab"
662
- aria-selected="false"
663
- >
664
- Users
665
- </button>
666
- <button
667
- class="btn btn-sm"
668
- data-table="schedules"
669
- type="button"
670
- role="tab"
671
- aria-selected="false"
672
- >
673
- Schedules
674
- </button>
675
- </div>
676
- <div id="data-table"><div class="loading">Loading…</div></div>
677
- </div>
678
- </section>
679
-
680
- <!-- Settings ---------------------------------------------------->
681
- <section class="view" id="view-settings">
682
- <div class="section-head">
683
- <span class="eyebrow" data-i18n="workspace">Workspace</span>
684
- <h2 data-i18n="settings">Settings</h2>
685
- <p data-i18n="settings_sub">
686
- This page is the only place the bot is configured — there is no
687
- config file. Clear a field to go back to its default.
688
- </p>
689
- </div>
690
-
691
- <!-- Settings Category Navigation -->
692
- <div class="settings-nav-tabs" role="tablist" id="settings-nav-tabs">
693
- <button class="settings-tab active" data-tab="ai" type="button" role="tab" aria-selected="true">
694
- <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12 8V4H8"/><rect width="16" height="12" x="4" y="8" rx="2"/><path d="M2 14h2"/><path d="M20 14h2"/><path d="M15 13v2"/><path d="M9 13v2"/></svg>
695
- <span data-i18n="settings_tab_ai">AI Assistant</span>
696
- </button>
697
- <button class="settings-tab" data-tab="general" type="button" role="tab" aria-selected="false">
698
- <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><line x1="4" x2="4" y1="21" y2="14"/><line x1="4" x2="4" y1="10" y2="3"/><line x1="12" x2="12" y1="21" y2="12"/><line x1="12" x2="12" y1="8" y2="3"/><line x1="20" x2="20" y1="21" y2="16"/><line x1="20" x2="20" y1="12" y2="3"/><line x1="1" x2="7" y1="14" y2="14"/><line x1="9" x2="15" y1="8" y2="8"/><line x1="17" x2="23" y1="16" y2="16"/></svg>
699
- <span data-i18n="settings_tab_general">General</span>
700
- </button>
701
- <button class="settings-tab" data-tab="security" type="button" role="tab" aria-selected="false">
702
- <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z"/></svg>
703
- <span data-i18n="settings_tab_security">Security</span>
704
- </button>
705
- <button class="settings-tab" data-tab="whatsapp" type="button" role="tab" aria-selected="false">
706
- <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="12" cy="12" r="10"/><path d="M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20"/><path d="M2 12h20"/></svg>
707
- <span data-i18n="settings_tab_whatsapp">WhatsApp Proxy</span>
708
- </button>
709
- <button class="settings-tab" data-tab="media" type="button" role="tab" aria-selected="false">
710
- <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><line x1="22" x2="2" y1="12" y2="12"/><path d="M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z"/><line x1="6" x2="6.01" y1="16" y2="16"/><line x1="10" x2="10.01" y1="16" y2="16"/></svg>
711
- <span data-i18n="settings_tab_media">Media & Storage</span>
712
- </button>
713
- </div>
714
-
715
- <div id="settings-tab-security" class="settings-tab-content" style="display: none;">
716
- <div class="card security-card">
717
- <div class="card-head"><h2 data-i18n="pw_heading">Control panel password</h2></div>
718
- <div class="password-grid">
719
- <label class="field">
720
- <span data-i18n="pw_current">Current password</span>
721
- <input
722
- type="password"
723
- id="pw-current"
724
- autocomplete="current-password"
725
- />
726
- </label>
727
- <label class="field">
728
- <span data-i18n="pw_next">New password</span>
729
- <input
730
- type="password"
731
- id="pw-next"
732
- autocomplete="new-password"
733
- />
734
- </label>
735
- <button class="btn btn-primary" id="pw-save" type="button" data-i18n="pw_change_btn">
736
- Change password
737
- </button>
738
- </div>
739
- <div class="hint" data-i18n="pw_hint">
740
- This password is the only thing between the internet and a
741
- linked WhatsApp account. It is stored as a hash — nobody,
742
- including this page, can read it back.
743
- </div>
744
- </div>
745
- </div>
746
-
747
- <div id="settings-list"><div class="loading">Loading…</div></div>
748
-
749
- <!-- Advanced AI Settings Modal -->
750
- <div class="modal-backdrop" id="ai-advanced-modal" style="display: none;">
751
- <div class="modal-card">
752
- <div class="modal-head">
753
- <h2 data-i18n="ai_advanced_title">Advanced AI Settings</h2>
754
- <button class="btn btn-icon modal-close" id="ai-advanced-close" type="button" aria-label="Close">
755
- <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M18 6L6 18M6 6l12 12"/></svg>
756
- </button>
757
- </div>
758
- <div class="modal-body" id="ai-advanced-fields"></div>
759
- <div class="modal-foot">
760
- <button class="btn btn-primary" id="ai-advanced-done" type="button" data-i18n="done">Done</button>
761
- </div>
762
- </div>
763
- </div>
764
- </section>
765
- </main>
766
- </div>
767
- </div>
768
-
769
- <div class="toasts" id="toasts"></div>
770
-
771
- <script src="/socket.io.min.js"></script>
772
- <script src="/qrcode.min.js"></script>
773
- <script src="/dashboard.js"></script>
774
- </body>
775
- </html>