@omnizap-system/omnizap 2.6.0 → 2.6.2

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 (261) hide show
  1. package/.env.example +58 -13
  2. package/.github/workflows/ci.yml +5 -5
  3. package/.github/workflows/codeql.yml +1 -1
  4. package/.github/workflows/db-migration-check.yml +2 -2
  5. package/.github/workflows/dependency-review.yml +1 -1
  6. package/.github/workflows/deploy.yml +2 -2
  7. package/.github/workflows/release.yml +2 -2
  8. package/.github/workflows/security-attest-provenance.yml +2 -2
  9. package/.github/workflows/security-gitleaks.yml +13 -4
  10. package/.github/workflows/security-runner-hardening.yml +2 -2
  11. package/.github/workflows/security-scorecard.yml +1 -1
  12. package/.github/workflows/security-zap-baseline.yml +1 -1
  13. package/.github/workflows/security-zap-full-scan.yml +2 -1
  14. package/.github/workflows/security-zizmor.yml +1 -1
  15. package/.github/workflows/wiki-sync.yml +1 -1
  16. package/.gitleaksignore +9 -0
  17. package/CODE_OF_CONDUCT.md +2 -2
  18. package/GEMINI.md +64 -0
  19. package/README.md +52 -82
  20. package/SECURITY.md +1 -1
  21. package/app/config/index.js +2 -0
  22. package/app/configParts/adminIdentity.js +5 -5
  23. package/app/configParts/baileysConfig.js +230 -58
  24. package/app/configParts/groupUtils.js +5 -0
  25. package/app/configParts/messagePersistenceService.js +145 -4
  26. package/app/configParts/sessionConfig.js +157 -0
  27. package/app/connection/baileysCompatibility.test.js +1 -1
  28. package/app/connection/groupOwnerWriteStateResolver.js +109 -0
  29. package/app/connection/socketController.js +660 -158
  30. package/app/connection/socketController.multiSession.test.js +108 -0
  31. package/app/controllers/messageController.js +1 -1
  32. package/app/controllers/messagePipeline/commandMiddleware.js +12 -10
  33. package/app/controllers/messagePipeline/conversationMiddleware.js +2 -1
  34. package/app/controllers/messagePipeline/messagePipelineMiddlewares.test.js +104 -0
  35. package/app/controllers/messagePipeline/preProcessingMiddlewares.js +80 -2
  36. package/app/controllers/messageProcessingPipeline.js +93 -13
  37. package/app/controllers/messageProcessingPipeline.test.js +200 -0
  38. package/app/modules/adminModule/AGENT.md +1 -1
  39. package/app/modules/adminModule/commandConfig.json +3318 -1347
  40. package/app/modules/adminModule/groupCommandHandlers.js +858 -15
  41. package/app/modules/adminModule/groupCommandHandlers.test.js +378 -11
  42. package/app/modules/adminModule/groupWarningRepository.js +152 -0
  43. package/app/modules/aiModule/AGENT.md +47 -30
  44. package/app/modules/aiModule/aiConfigRuntime.js +1 -0
  45. package/app/modules/aiModule/catCommand.js +135 -27
  46. package/app/modules/aiModule/commandConfig.json +114 -28
  47. package/app/modules/analyticsModule/messageAnalysisEventRepository.js +54 -6
  48. package/app/modules/gameModule/AGENT.md +1 -1
  49. package/app/modules/gameModule/commandConfig.json +29 -0
  50. package/app/modules/menuModule/AGENT.md +1 -1
  51. package/app/modules/menuModule/commandConfig.json +45 -10
  52. package/app/modules/menuModule/menuCatalogService.js +190 -0
  53. package/app/modules/menuModule/menuCommandUsageRepository.js +109 -0
  54. package/app/modules/menuModule/menuDynamicService.js +511 -0
  55. package/app/modules/menuModule/menuDynamicService.test.js +141 -0
  56. package/app/modules/menuModule/menus.js +36 -5
  57. package/app/modules/playModule/AGENT.md +10 -5
  58. package/app/modules/playModule/commandConfig.json +140 -12
  59. package/app/modules/playModule/playCommand.js +1 -1417
  60. package/app/modules/playModule/playCommandConstants.js +80 -0
  61. package/app/modules/playModule/playCommandCore.js +361 -0
  62. package/app/modules/playModule/playCommandHandlers.js +41 -0
  63. package/app/modules/playModule/playCommandMediaClient.js +1872 -0
  64. package/app/modules/playModule/playConfigRuntime.js +245 -4
  65. package/app/modules/playModule/playModuleCriticalFlows.test.js +152 -0
  66. package/app/modules/quoteModule/AGENT.md +1 -1
  67. package/app/modules/quoteModule/commandConfig.json +29 -0
  68. package/app/modules/quoteModule/quoteCommand.js +3 -2
  69. package/app/modules/rpgPokemonModule/AGENT.md +1 -1
  70. package/app/modules/rpgPokemonModule/commandConfig.json +29 -0
  71. package/app/modules/rpgPokemonModule/rpgBattleCanvasRenderer.js +5 -4
  72. package/app/modules/rpgPokemonModule/rpgBattleService.test.js +2 -1
  73. package/app/modules/rpgPokemonModule/rpgPokemonDomain.js +2 -1
  74. package/app/modules/rpgPokemonModule/rpgPokemonService.js +38 -37
  75. package/app/modules/rpgPokemonModule/rpgProfileCanvasRenderer.js +4 -3
  76. package/app/modules/statsModule/AGENT.md +1 -1
  77. package/app/modules/statsModule/commandConfig.json +58 -0
  78. package/app/modules/statsModule/rankingCommon.js +5 -4
  79. package/app/modules/stickerModule/AGENT.md +1 -1
  80. package/app/modules/stickerModule/addStickerMetadata.js +4 -3
  81. package/app/modules/stickerModule/commandConfig.json +145 -0
  82. package/app/modules/stickerModule/stickerCommand.js +1 -1
  83. package/app/modules/stickerPackModule/AGENT.md +1 -1
  84. package/app/modules/stickerPackModule/autoPackCollectorService.js +5 -1
  85. package/app/modules/stickerPackModule/commandConfig.json +29 -0
  86. package/app/modules/stickerPackModule/semanticThemeClusterService.js +7 -6
  87. package/app/modules/stickerPackModule/stickerAutoPackByTagsRuntime.js +10 -9
  88. package/app/modules/stickerPackModule/stickerClassificationBackgroundRuntime.js +9 -8
  89. package/app/modules/stickerPackModule/stickerDomainEventConsumerRuntime.js +3 -2
  90. package/app/modules/stickerPackModule/stickerMarketplaceDriftService.js +2 -1
  91. package/app/modules/stickerPackModule/stickerPackCommandHandlers.js +80 -58
  92. package/app/modules/stickerPackModule/stickerPackMarketplaceService.js +2 -1
  93. package/app/modules/stickerPackModule/stickerPackRepository.js +2 -1
  94. package/app/modules/stickerPackModule/stickerPackScoreSnapshotRuntime.js +5 -4
  95. package/app/modules/stickerPackModule/stickerPackService.js +13 -6
  96. package/app/modules/stickerPackModule/stickerStorageService.js +3 -2
  97. package/app/modules/stickerPackModule/stickerWorkerPipelineRuntime.js +2 -1
  98. package/app/modules/systemMetricsModule/AGENT.md +1 -1
  99. package/app/modules/systemMetricsModule/commandConfig.json +29 -0
  100. package/app/modules/systemMetricsModule/pingCommand.js +6 -5
  101. package/app/modules/tiktokModule/AGENT.md +1 -1
  102. package/app/modules/tiktokModule/commandConfig.json +29 -0
  103. package/app/modules/tiktokModule/tiktokCommand.js +2 -1
  104. package/app/modules/userModule/AGENT.md +1 -1
  105. package/app/modules/userModule/commandConfig.json +29 -0
  106. package/app/modules/userModule/userCommand.js +72 -23
  107. package/app/modules/waifuPicsModule/AGENT.md +57 -27
  108. package/app/modules/waifuPicsModule/commandConfig.json +87 -0
  109. package/app/modules/waifuPicsModule/waifuPicsCommand.js +3 -2
  110. package/app/observability/metrics.js +136 -0
  111. package/app/services/ai/commandConfigEnrichmentService.js +229 -47
  112. package/app/services/ai/conversationRouterService.js +4 -3
  113. package/app/services/ai/geminiService.js +132 -7
  114. package/app/services/ai/geminiService.test.js +59 -2
  115. package/app/services/ai/globalModuleAiHelpService.js +3 -2
  116. package/app/services/ai/messageCommandExecutionService.js +2 -1
  117. package/app/services/ai/moduleAiHelpCoreService.js +45 -14
  118. package/app/services/ai/moduleToolExecutorService.js +3 -2
  119. package/app/services/ai/moduleToolRegistryService.js +2 -1
  120. package/app/services/ai/toolCandidateSelectorService.js +6 -5
  121. package/app/services/auth/googleWebLinkService.js +3 -2
  122. package/app/services/auth/whatsappLoginLinkService.js +3 -2
  123. package/app/services/external/pokeApiService.js +4 -3
  124. package/app/services/group/groupMetadataService.js +24 -1
  125. package/app/services/infra/dbWriteQueue.js +57 -26
  126. package/app/services/infra/featureFlagService.js +2 -1
  127. package/app/services/messaging/captchaService.js +3 -2
  128. package/app/services/messaging/newsBroadcastService.js +846 -29
  129. package/app/services/multiSession/assignmentBalancerService.js +457 -0
  130. package/app/services/multiSession/groupOwnershipRepository.js +381 -0
  131. package/app/services/multiSession/groupOwnershipService.js +890 -0
  132. package/app/services/multiSession/groupOwnershipService.test.js +309 -0
  133. package/app/services/multiSession/sessionRegistryService.js +293 -0
  134. package/app/services/sticker/stickerFocusService.js +11 -10
  135. package/app/store/aiPromptStore.js +36 -19
  136. package/app/store/conversationSessionStore.js +7 -6
  137. package/app/store/groupConfigStore.js +41 -5
  138. package/app/store/premiumUserStore.js +21 -7
  139. package/app/utils/antiLink/antiLinkModule.js +352 -16
  140. package/app/workers/aiHelperContinuousLearningWorker.js +512 -0
  141. package/app/workers/aiLearningWorker.js +6 -5
  142. package/app/workers/commandConfigEnrichmentWorker.js +4 -3
  143. package/database/index.js +14 -8
  144. package/database/migrations/20260307_d0_hardening_down.sql +1 -1
  145. package/database/migrations/20260314_d7_canonical_sender_down.sql +1 -1
  146. package/database/migrations/20260406_d30_security_analytics_down.sql +1 -1
  147. package/database/migrations/20260411_d35_group_community_metadata_down.sql +59 -0
  148. package/database/migrations/20260411_d35_group_community_metadata_up.sql +62 -0
  149. package/database/migrations/20260412_d36_system_config_tables_down.sql +32 -0
  150. package/database/migrations/20260412_d36_system_config_tables_up.sql +66 -0
  151. package/database/migrations/20260413_d37_group_user_warnings_down.sql +11 -0
  152. package/database/migrations/20260413_d37_group_user_warnings_up.sql +24 -0
  153. package/database/migrations/20260414_d38_multi_session_foundation_down.sql +72 -0
  154. package/database/migrations/20260414_d38_multi_session_foundation_up.sql +125 -0
  155. package/database/migrations/20260414_d39_multi_session_cutover_down.sql +103 -0
  156. package/database/migrations/20260414_d39_multi_session_cutover_up.sql +83 -0
  157. package/database/schema.sql +102 -1
  158. package/docker-compose.yml +4 -1
  159. package/docs/compliance/acceptable-use-policy-2026-03-07.md +1 -1
  160. package/docs/compliance/dpa-b2b-standard-2026-03-07.md +1 -1
  161. package/docs/compliance/privacy-policy-2026-03-07.md +4 -4
  162. package/docs/security/dsar-lgpd-runbook-2026-03-07.md +1 -1
  163. package/docs/security/incident-response-lgpd-anpd-runbook-2026-03-07.md +1 -1
  164. package/docs/security/network-hardening-runbook-2026-03-07.md +53 -0
  165. package/docs/security/omnizap-static-security-headers.conf +25 -0
  166. package/docs/wiki/Home.md +1 -1
  167. package/ecosystem.prod.config.cjs +32 -12
  168. package/index.js +57 -23
  169. package/observability/alert-rules.yml +20 -0
  170. package/observability/grafana/dashboards/omnizap-system-admin.json +229 -0
  171. package/observability/mysql-setup.sql +4 -4
  172. package/observability/system-admin-observability.md +26 -0
  173. package/package.json +20 -6
  174. package/public/apple-touch-icon.png +0 -0
  175. package/public/comandos/commands-catalog.json +2853 -3326
  176. package/public/favicon-16x16.png +0 -0
  177. package/public/favicon-32x32.png +0 -0
  178. package/public/favicon.ico +0 -0
  179. package/public/js/apps/apiDocsApp.js +3 -2
  180. package/public/js/apps/commandsReactApp.js +280 -99
  181. package/public/js/apps/createPackApp.js +11 -10
  182. package/public/js/apps/homeReactApp.js +181 -130
  183. package/public/js/apps/loginReactApp.js +1 -1
  184. package/public/js/apps/stickersApp.js +263 -110
  185. package/public/js/apps/termsReactApp.js +73 -24
  186. package/public/js/apps/userApp.js +4 -3
  187. package/public/js/apps/userPasswordResetReactApp.js +406 -0
  188. package/public/js/apps/userReactApp.js +355 -280
  189. package/public/js/apps/userSystemAdmReactApp.js +1506 -0
  190. package/public/pages/api-docs.html +1 -1
  191. package/public/pages/aup.html +2 -2
  192. package/public/pages/dpa.html +3 -3
  193. package/public/pages/licenca.html +4 -4
  194. package/public/pages/login.html +1 -1
  195. package/public/pages/notice-and-takedown.html +2 -2
  196. package/public/pages/politica-de-privacidade.html +6 -6
  197. package/public/pages/seo-bot-whatsapp-para-grupo.html +3 -3
  198. package/public/pages/seo-bot-whatsapp-sem-programar.html +3 -3
  199. package/public/pages/seo-como-automatizar-avisos-no-whatsapp.html +3 -3
  200. package/public/pages/seo-como-criar-comandos-whatsapp.html +3 -3
  201. package/public/pages/seo-como-evitar-spam-no-whatsapp.html +3 -3
  202. package/public/pages/seo-como-moderar-grupo-whatsapp.html +3 -3
  203. package/public/pages/seo-como-organizar-comunidade-whatsapp.html +3 -3
  204. package/public/pages/seo-melhor-bot-whatsapp-para-grupos.html +3 -3
  205. package/public/pages/stickers-admin.html +1 -1
  206. package/public/pages/stickers-create.html +1 -1
  207. package/public/pages/stickers.html +6 -6
  208. package/public/pages/suboperadores.html +2 -2
  209. package/public/pages/termos-de-uso-texto-integral.html +6 -6
  210. package/public/pages/termos-de-uso.html +3 -3
  211. package/public/pages/user-password-reset.html +4 -5
  212. package/public/pages/user-systemadm.html +9 -463
  213. package/public/pages/user.html +2 -2
  214. package/scripts/clear-whatsapp-session.sh +123 -0
  215. package/scripts/core-ai-mode.mjs +163 -0
  216. package/scripts/deploy.sh +11 -1
  217. package/scripts/email-broadcast-terms-update.mjs +2 -1
  218. package/scripts/enrich-command-config-ux-openai.mjs +492 -0
  219. package/scripts/generate-commands-catalog.mjs +166 -2
  220. package/scripts/generate-module-agents.mjs +2 -1
  221. package/scripts/generate-seo-satellite-pages.mjs +5 -4
  222. package/scripts/github-deploy-notify.mjs +2 -1
  223. package/scripts/github-release-notify.mjs +25 -10
  224. package/scripts/new-whatsapp-session.sh +317 -0
  225. package/scripts/release.sh +2 -19
  226. package/scripts/security-smoketest.mjs +6 -5
  227. package/scripts/security-web-surface-check.mjs +218 -0
  228. package/scripts/sticker-catalog-loadtest.mjs +5 -4
  229. package/server/auth/googleWebAuth/googleWebAuthService.js +8 -7
  230. package/server/auth/jwt/webJwtService.js +1 -1
  231. package/server/auth/stickerCatalogAuthContext.js +2 -1
  232. package/server/auth/termsAcceptance/termsAcceptanceHandler.js +2 -1
  233. package/server/auth/userPassword/userPasswordAuthService.js +2 -1
  234. package/server/auth/userPassword/userPasswordRecoveryService.js +4 -3
  235. package/server/auth/webAccount/webAccountHandlers.js +9 -10
  236. package/server/controllers/admin/adminPanelHandlers.js +267 -16
  237. package/server/controllers/admin/systemAdminController.js +267 -0
  238. package/server/controllers/seo/stickerCatalogSeoContext.js +10 -9
  239. package/server/controllers/sticker/nonCatalogHandlers.js +2 -1
  240. package/server/controllers/sticker/stickerCatalogController.js +23 -36
  241. package/server/controllers/system/contactController.js +9 -17
  242. package/server/controllers/system/githubController.js +3 -2
  243. package/server/controllers/system/stickerCatalogSystemContext.js +41 -19
  244. package/server/controllers/system/systemController.js +254 -1
  245. package/server/controllers/system/systemMetricsController.js +2 -1
  246. package/server/controllers/userController.js +6 -0
  247. package/server/email/emailTemplateService.js +5 -3
  248. package/server/http/httpServer.js +11 -6
  249. package/server/middleware/rateLimit.js +2 -1
  250. package/server/middleware/securityHeaders.js +20 -1
  251. package/server/routes/admin/systemAdminRouter.js +6 -0
  252. package/server/routes/indexRouter.js +30 -6
  253. package/server/routes/observability/grafanaProxyRouter.js +254 -0
  254. package/server/routes/static/staticPageRouter.js +27 -1
  255. package/server/utils/publicContact.js +31 -0
  256. package/utils/time/timeModule.js +135 -0
  257. package/utils/time/timeModule.test.js +65 -0
  258. package/utils/whatsapp/contactEnv.js +39 -0
  259. package/vite.config.mjs +7 -1
  260. package/public/assets/images/brand-icon-192.png +0 -0
  261. package/scripts/sync-readme-snapshot.mjs +0 -133
@@ -0,0 +1,229 @@
1
+ {
2
+ "uid": "omnizap-system-admin",
3
+ "title": "OmniZap System Admin",
4
+ "timezone": "browser",
5
+ "schemaVersion": 38,
6
+ "version": 2,
7
+ "refresh": "10s",
8
+ "time": {
9
+ "from": "now-6h",
10
+ "to": "now"
11
+ },
12
+ "tags": ["omnizap", "system-admin", "observability"],
13
+ "panels": [
14
+ {
15
+ "type": "timeseries",
16
+ "title": "Admin Snapshot Freshness (s)",
17
+ "datasource": "Prometheus",
18
+ "gridPos": { "x": 0, "y": 0, "w": 12, "h": 8 },
19
+ "targets": [
20
+ {
21
+ "expr": "time() - omnizap_admin_overview_updated_at_seconds",
22
+ "legendFormat": "freshness_s",
23
+ "refId": "A"
24
+ }
25
+ ]
26
+ },
27
+ {
28
+ "type": "timeseries",
29
+ "title": "Snapshot Publishes/sec",
30
+ "datasource": "Prometheus",
31
+ "gridPos": { "x": 12, "y": 0, "w": 12, "h": 8 },
32
+ "targets": [
33
+ {
34
+ "expr": "rate(omnizap_admin_overview_requests_total[5m])",
35
+ "legendFormat": "{{source}}",
36
+ "refId": "A"
37
+ }
38
+ ]
39
+ },
40
+ {
41
+ "type": "timeseries",
42
+ "title": "Sessoes, Usuarios e Bans",
43
+ "datasource": "Prometheus",
44
+ "gridPos": { "x": 0, "y": 8, "w": 12, "h": 8 },
45
+ "targets": [
46
+ {
47
+ "expr": "omnizap_admin_counters{counter=~\"active_google_sessions|known_google_users|active_bans\"}",
48
+ "legendFormat": "{{counter}}",
49
+ "refId": "A"
50
+ }
51
+ ]
52
+ },
53
+ {
54
+ "type": "timeseries",
55
+ "title": "Mensagens, Spam e Erros (Quick)",
56
+ "datasource": "Prometheus",
57
+ "gridPos": { "x": 12, "y": 8, "w": 12, "h": 8 },
58
+ "targets": [
59
+ {
60
+ "expr": "omnizap_admin_dashboard_quick{metric=~\"messages_today|spam_blocked_today|errors_5xx\"}",
61
+ "legendFormat": "{{metric}}",
62
+ "refId": "A"
63
+ }
64
+ ]
65
+ },
66
+ {
67
+ "type": "timeseries",
68
+ "title": "CPU e RAM (%)",
69
+ "datasource": "Prometheus",
70
+ "gridPos": { "x": 0, "y": 16, "w": 8, "h": 8 },
71
+ "targets": [
72
+ {
73
+ "expr": "omnizap_admin_system_health{metric=~\"cpu_percent|ram_percent\"}",
74
+ "legendFormat": "{{metric}}",
75
+ "refId": "A"
76
+ }
77
+ ]
78
+ },
79
+ {
80
+ "type": "timeseries",
81
+ "title": "Latencia P95 e Queue Pending",
82
+ "datasource": "Prometheus",
83
+ "gridPos": { "x": 8, "y": 16, "w": 8, "h": 8 },
84
+ "targets": [
85
+ {
86
+ "expr": "omnizap_admin_system_health{metric=~\"http_latency_p95_ms|queue_pending\"}",
87
+ "legendFormat": "{{metric}}",
88
+ "refId": "A"
89
+ }
90
+ ]
91
+ },
92
+ {
93
+ "type": "timeseries",
94
+ "title": "DB Total e Slow Queries",
95
+ "datasource": "Prometheus",
96
+ "gridPos": { "x": 16, "y": 16, "w": 8, "h": 8 },
97
+ "targets": [
98
+ {
99
+ "expr": "omnizap_admin_system_health{metric=~\"db_total_queries|db_slow_queries\"}",
100
+ "legendFormat": "{{metric}}",
101
+ "refId": "A"
102
+ }
103
+ ]
104
+ },
105
+ {
106
+ "type": "timeseries",
107
+ "title": "Alertas por severidade",
108
+ "datasource": "Prometheus",
109
+ "gridPos": { "x": 0, "y": 24, "w": 8, "h": 8 },
110
+ "targets": [
111
+ {
112
+ "expr": "omnizap_admin_alerts_total",
113
+ "legendFormat": "{{severity}}",
114
+ "refId": "A"
115
+ }
116
+ ]
117
+ },
118
+ {
119
+ "type": "timeseries",
120
+ "title": "Feature Flags",
121
+ "datasource": "Prometheus",
122
+ "gridPos": { "x": 8, "y": 24, "w": 8, "h": 8 },
123
+ "targets": [
124
+ {
125
+ "expr": "omnizap_admin_feature_flags_total",
126
+ "legendFormat": "{{state}}",
127
+ "refId": "A"
128
+ }
129
+ ]
130
+ },
131
+ {
132
+ "type": "timeseries",
133
+ "title": "Itens por secao do Snapshot",
134
+ "datasource": "Prometheus",
135
+ "gridPos": { "x": 16, "y": 24, "w": 8, "h": 8 },
136
+ "targets": [
137
+ {
138
+ "expr": "omnizap_admin_snapshot_items_total",
139
+ "legendFormat": "{{section}}",
140
+ "refId": "A"
141
+ }
142
+ ]
143
+ },
144
+ {
145
+ "type": "timeseries",
146
+ "title": "MySQL Disponibilidade e Conexoes",
147
+ "datasource": "Prometheus",
148
+ "gridPos": { "x": 0, "y": 32, "w": 8, "h": 8 },
149
+ "targets": [
150
+ {
151
+ "expr": "mysql_up",
152
+ "legendFormat": "mysql_up",
153
+ "refId": "A"
154
+ },
155
+ {
156
+ "expr": "mysql_global_status_threads_connected",
157
+ "legendFormat": "threads_connected",
158
+ "refId": "B"
159
+ }
160
+ ]
161
+ },
162
+ {
163
+ "type": "timeseries",
164
+ "title": "MySQL Throughput (QPS/Writes/Slow)",
165
+ "datasource": "Prometheus",
166
+ "gridPos": { "x": 8, "y": 32, "w": 8, "h": 8 },
167
+ "targets": [
168
+ {
169
+ "expr": "rate(mysql_global_status_queries[5m])",
170
+ "legendFormat": "qps",
171
+ "refId": "A"
172
+ },
173
+ {
174
+ "expr": "sum(rate(mysql_global_status_commands_total{command=~\"insert|update|delete\"}[5m])) or (sum(rate(mysql_global_status_com_insert[5m])) + sum(rate(mysql_global_status_com_update[5m])) + sum(rate(mysql_global_status_com_delete[5m]))) or vector(0)",
175
+ "legendFormat": "writes",
176
+ "refId": "B"
177
+ },
178
+ {
179
+ "expr": "rate(mysql_global_status_slow_queries[5m])",
180
+ "legendFormat": "slow",
181
+ "refId": "C"
182
+ }
183
+ ]
184
+ },
185
+ {
186
+ "type": "timeseries",
187
+ "title": "MySQL Perf Schema (series ativas)",
188
+ "datasource": "Prometheus",
189
+ "gridPos": { "x": 16, "y": 32, "w": 8, "h": 8 },
190
+ "targets": [
191
+ {
192
+ "expr": "count(mysql_perf_schema_events_statements_errors_total)",
193
+ "legendFormat": "perf_schema_series",
194
+ "refId": "A"
195
+ }
196
+ ]
197
+ },
198
+ {
199
+ "type": "timeseries",
200
+ "title": "MySQL InnoDB (Locks e Buffer)",
201
+ "datasource": "Prometheus",
202
+ "gridPos": { "x": 0, "y": 40, "w": 12, "h": 8 },
203
+ "targets": [
204
+ {
205
+ "expr": "rate(mysql_global_status_innodb_row_lock_waits[5m])",
206
+ "legendFormat": "lock_waits",
207
+ "refId": "A"
208
+ },
209
+ {
210
+ "expr": "1 - (rate(mysql_global_status_innodb_buffer_pool_reads[5m]) / rate(mysql_global_status_innodb_buffer_pool_read_requests[5m]))",
211
+ "legendFormat": "buffer_pool_hit_ratio",
212
+ "refId": "B"
213
+ }
214
+ ]
215
+ },
216
+ {
217
+ "type": "logs",
218
+ "title": "MySQL Slow Log (Loki)",
219
+ "datasource": "Loki",
220
+ "gridPos": { "x": 12, "y": 40, "w": 12, "h": 8 },
221
+ "targets": [
222
+ {
223
+ "expr": "{job=\"mysql-slow\"}",
224
+ "refId": "A"
225
+ }
226
+ ]
227
+ }
228
+ ]
229
+ }
@@ -3,7 +3,8 @@
3
3
  -- This script is idempotent and focused on metrics/logging for mysqld-exporter.
4
4
 
5
5
  -- 1) Metrics user for mysqld-exporter
6
- -- Matches docker-compose default DSN: exporter:exporter@(host.docker.internal:3306)/
6
+ -- Matches docker-compose default DSN:
7
+ -- exporter:exporter@unix(/run/mysqld/mysqld.sock)/
7
8
  CREATE USER IF NOT EXISTS 'exporter'@'%' IDENTIFIED BY 'exporter';
8
9
  ALTER USER 'exporter'@'%' IDENTIFIED BY 'exporter';
9
10
 
@@ -17,9 +18,8 @@ FLUSH PRIVILEGES;
17
18
  SET GLOBAL slow_query_log = ON;
18
19
  SET GLOBAL long_query_time = 0.5;
19
20
  SET GLOBAL log_output = 'FILE';
20
- -- Keep slow log in datadir for compatibility across MariaDB/MySQL host setups.
21
- -- If needed, change to another writable path.
22
- SET GLOBAL slow_query_log_file = '/var/lib/mysql/mysql-slow.log';
21
+ -- This path matches promtail's mysql-slow scrape target in observability/promtail-config.yml.
22
+ SET GLOBAL slow_query_log_file = '/var/log/mysql/mysql-slow.log';
23
23
 
24
24
  -- 3) Performance Schema consumers/instruments
25
25
  -- NOTE: performance_schema itself cannot be enabled dynamically.
@@ -0,0 +1,26 @@
1
+ # System Admin na Observabilidade
2
+
3
+ Esta integração publica o snapshot do painel `System Admin` no endpoint `/metrics`, permitindo acompanhar os mesmos dados no Prometheus/Grafana.
4
+
5
+ ## Dashboard
6
+
7
+ - Grafana: `OmniZap System Admin`
8
+ - Arquivo: `observability/grafana/dashboards/omnizap-system-admin.json`
9
+
10
+ ## Métricas adicionadas
11
+
12
+ - `omnizap_admin_overview_updated_at_seconds`
13
+ - `omnizap_admin_overview_requests_total{source}`
14
+ - `omnizap_admin_counters{counter}`
15
+ - `omnizap_admin_dashboard_quick{metric}`
16
+ - `omnizap_admin_system_health{metric}`
17
+ - `omnizap_admin_alerts_total{severity}`
18
+ - `omnizap_admin_feature_flags_total{state}`
19
+ - `omnizap_admin_snapshot_items_total{section}`
20
+
21
+ ## Alertas
22
+
23
+ Em `observability/alert-rules.yml`:
24
+
25
+ - `OmniZapAdminSnapshotStale`
26
+ - `OmniZapAdminCriticalAlerts`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@omnizap-system/omnizap",
3
- "version": "2.6.0",
3
+ "version": "2.6.2",
4
4
  "description": "Sistema profissional de automação WhatsApp com tecnologia Baileys",
5
5
  "main": "index.js",
6
6
  "publishConfig": {
@@ -8,7 +8,8 @@
8
8
  },
9
9
  "type": "module",
10
10
  "imports": {
11
- "#logger": "./utils/logger/loggerModule.js"
11
+ "#logger": "./utils/logger/loggerModule.js",
12
+ "#time": "./utils/time/timeModule.js"
12
13
  },
13
14
  "packageManager": "npm@10.9.2",
14
15
  "keywords": [
@@ -55,7 +56,6 @@
55
56
  "build:css:stickers-admin": "cp ./public/css/stickers-admin.css ./public/assets/css/stickers-admin.css",
56
57
  "build:css:user-systemadm": "cat ./public/css/systemadm/tokens.css ./public/css/systemadm/base.css ./public/css/systemadm/layout.css ./public/css/systemadm/components.css ./public/css/systemadm/admin.css > ./public/assets/css/user-systemadm.css",
57
58
  "build:css:home:watch": "tailwindcss -i ./public/assets/css/home-react.input.css -o ./public/assets/css/home-react.css --watch",
58
- "readme:sync-snapshot": "node ./scripts/sync-readme-snapshot.mjs",
59
59
  "wiki:sync": "bash ./scripts/wiki-sync.sh",
60
60
  "loadtest:stickers": "node ./scripts/sticker-catalog-loadtest.mjs",
61
61
  "baileys:smoke": "node ./scripts/baileys-compat-smoke.mjs",
@@ -73,6 +73,12 @@
73
73
  "lint": "eslint .",
74
74
  "lint:fix": "eslint . --fix",
75
75
  "validate:command-configs": "node ./scripts/validate-command-configs.mjs",
76
+ "command-config:ux:openai": "node ./scripts/enrich-command-config-ux-openai.mjs",
77
+ "core:ai": "node ./scripts/core-ai-mode.mjs",
78
+ "core:ai:on": "node ./scripts/core-ai-mode.mjs on",
79
+ "core:ai:off": "node ./scripts/core-ai-mode.mjs off",
80
+ "core:ai:status": "node ./scripts/core-ai-mode.mjs status",
81
+ "new:work": "bash ./scripts/new-whatsapp-session.sh",
76
82
  "command-config:schema:generate": "node ./scripts/generate-command-config-schema.mjs",
77
83
  "command-config:schema:validate": "node ./scripts/validate-command-config-schema.mjs",
78
84
  "format": "node ./scripts/run-prettier-all.mjs --write",
@@ -81,12 +87,13 @@
81
87
  "ci": "npm run check && npm run build",
82
88
  "security:audit": "npm audit --audit-level=high",
83
89
  "security:audit:fix": "npm audit fix",
84
- "security:codeql": "bash ./scripts/run-codeql-local.sh"
90
+ "security:codeql": "bash ./scripts/run-codeql-local.sh",
91
+ "security:web-surface": "node ./scripts/security-web-surface-check.mjs"
85
92
  },
86
93
  "dependencies": {
87
94
  "@hapi/boom": "^10.0.1",
88
95
  "@kaikybrofc/logger-module": "^1.0.4",
89
- "@whiskeysockets/baileys": "github:jlucaso1/Baileys#be89465e07afa871cf3f0e19cabfec9780db6be7",
96
+ "@whiskeysockets/baileys": "github:jlucaso1/Baileys#feat-add-stickerpack-support",
90
97
  "argon2": "^0.44.0",
91
98
  "axios": "^1.13.5",
92
99
  "canvas": "^3.2.1",
@@ -97,9 +104,9 @@
97
104
  "ffmpeg": "^0.0.4",
98
105
  "helmet": "^8.1.0",
99
106
  "htm": "^3.1.1",
100
- "jimp": "^1.6.0",
101
107
  "jsonwebtoken": "^9.0.3",
102
108
  "lodash": "^4.17.21",
109
+ "luxon": "^3.7.2",
103
110
  "moment-timezone": "^0.5.48",
104
111
  "mysql2": "^3.15.0",
105
112
  "natural": "^8.1.1",
@@ -113,6 +120,7 @@
113
120
  "qrcode-terminal": "^0.12.0",
114
121
  "react": "^18.3.1",
115
122
  "react-dom": "^18.3.1",
123
+ "sharp": "^0.34.3",
116
124
  "stream-json": "^1.9.1",
117
125
  "uuid": "^13.0.0",
118
126
  "webp-conv": "github:kaikybrofc/webp-conv",
@@ -130,6 +138,12 @@
130
138
  "tailwindcss": "^4.2.1",
131
139
  "vite": "^6.4.1"
132
140
  },
141
+ "overrides": {
142
+ "music-metadata": {
143
+ "file-type": "21.3.2"
144
+ },
145
+ "flatted": "3.4.2"
146
+ },
133
147
  "engines": {
134
148
  "node": ">=18.0.0"
135
149
  },
Binary file