fix(fcm): corrigir notificacoes push em background e tela bloqueada

This commit is contained in:
Winícius 2026-11-21 19:59:45 -03:00
parent 7488064058
commit 2229b2bd46
15 changed files with 816 additions and 205 deletions

View File

@ -33,6 +33,11 @@
android:name="android.support.FILE_PROVIDER_PATHS" android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/file_paths"></meta-data> android:resource="@xml/file_paths"></meta-data>
</provider> </provider>
<!-- Canal padrão de alta prioridade para notificações FCM em background e tela bloqueada -->
<meta-data
android:name="com.google.firebase.messaging.default_notification_channel_id"
android:value="maestri_urgent" />
</application> </application>
<!-- Permissions --> <!-- Permissions -->
@ -45,6 +50,11 @@
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES" /> <uses-permission android:name="android.permission.READ_MEDIA_IMAGES" />
<uses-permission android:name="android.permission.READ_MEDIA_AUDIO" /> <uses-permission android:name="android.permission.READ_MEDIA_AUDIO" />
<!-- Notificações em Background, Wake Lock e Vibração -->
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-feature android:name="android.hardware.microphone" android:required="false" /> <uses-feature android:name="android.hardware.microphone" android:required="false" />
<uses-feature android:name="android.hardware.camera" android:required="false" /> <uses-feature android:name="android.hardware.camera" android:required="false" />
</manifest> </manifest>

View File

@ -1,6 +1,9 @@
package com.maestri.remote; package com.maestri.remote;
import android.Manifest; import android.Manifest;
import android.app.Notification;
import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.content.pm.PackageManager; import android.content.pm.PackageManager;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
@ -16,9 +19,28 @@ public class MainActivity extends BridgeActivity {
@Override @Override
public void onCreate(Bundle savedInstanceState) { public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
createNotificationChannel();
checkAndRequestPermissions(); checkAndRequestPermissions();
} }
private void createNotificationChannel() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
NotificationChannel channel = new NotificationChannel(
"maestri_urgent",
"Alertas Críticos",
NotificationManager.IMPORTANCE_HIGH
);
channel.setDescription("Notificações urgentes de tarefas e aprovações do Maestri");
channel.enableVibration(true);
channel.setVibrationPattern(new long[]{0, 200, 100, 200, 100, 200});
channel.setLockscreenVisibility(Notification.VISIBILITY_PUBLIC);
NotificationManager manager = getSystemService(NotificationManager.class);
if (manager != null) {
manager.createNotificationChannel(channel);
}
}
}
private void checkAndRequestPermissions() { private void checkAndRequestPermissions() {
List<String> permissionsNeeded = new ArrayList<>(); List<String> permissionsNeeded = new ArrayList<>();
@ -31,6 +53,9 @@ public class MainActivity extends BridgeActivity {
} }
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
if (ContextCompat.checkSelfPermission(this, Manifest.permission.POST_NOTIFICATIONS) != PackageManager.PERMISSION_GRANTED) {
permissionsNeeded.add(Manifest.permission.POST_NOTIFICATIONS);
}
if (ContextCompat.checkSelfPermission(this, Manifest.permission.READ_MEDIA_IMAGES) != PackageManager.PERMISSION_GRANTED) { if (ContextCompat.checkSelfPermission(this, Manifest.permission.READ_MEDIA_IMAGES) != PackageManager.PERMISSION_GRANTED) {
permissionsNeeded.add(Manifest.permission.READ_MEDIA_IMAGES); permissionsNeeded.add(Manifest.permission.READ_MEDIA_IMAGES);
} }

View File

@ -0,0 +1,40 @@
# Manifesto: Correção de Notificações Push FCM em Background e Tela Bloqueada
**Data:** 2026-11-21 · **Status:** decisões fechadas, especificação pronta
## O problema
Mesmo após a integração inicial com o Firebase Cloud Messaging (FCM), as notificações push não despertavam o aparelho quando o smartphone estava com a tela bloqueada ou com o aplicativo inativo/em background (Doze Mode). O operador deixava de receber alertas de conclusão de tarefas e pedidos de aprovação dos agentes de IA quando o celular estava em repouso no bolso ou na mesa.
A investigação diagnóstica identificou as seguintes causas raízes:
1. **Payload FCM estritamente data-only no servidor (`src/relay/push-service.js`):** A mensagem continha apenas os nós `data` e `android`, sem o bloco raiz `notification: { title, body }`. Pelas especificações do Android e APNs (iOS), mensagens sem o bloco raiz `notification` são classificadas como `data-only` (silent pushes), sendo suspensas e descartadas pelo SO durante o Doze Mode quando o aplicativo não está em primeiro plano.
2. **Ausência de permissões e metadados no cliente Android (`AndroidManifest.xml` e `MainActivity.java`):** Faltavam as permissões `POST_NOTIFICATIONS` (obrigatória a partir do Android 13 / API 33), `WAKE_LOCK` (para despertar o processador no recebimento do push em Doze mode) e `VIBRATE`, além da vinculação do canal padrão `com.google.firebase.messaging.default_notification_channel_id` (`maestri_urgent`).
3. **Criação do Canal em Tempo de Execução Tardio:** O canal de notificação com importância máxima (`NotificationManager.IMPORTANCE_HIGH`) dependia da inicialização da WebView via Capacitor, não existindo no SO se uma notificação chegasse com o aplicativo totalmente encerrado.
4. **Tratamento de push no Service Worker:** O listener de push do PWA/WebPush não desempacotava de forma flexível payloads com `{ notification, data }` e não utilizava `requireInteraction: true` e `renotify: true`.
## O que decidimos, e por quê
- **Estruturação Completa e Padrão do Payload FCM v1:** O `PushService.formatFcmMessage` agora gera mensagens completas contendo:
- Bloco raiz `notification: { title, body }` obrigatório para acionar a bandeja nativa do SO.
- Bloco `android` com `priority: 'high'`, `channel_id: 'maestri_urgent'`, `channelId: 'maestri_urgent'`, `visibility: 'PUBLIC'` (tela de bloqueio), `notification_priority: 'PRIORITY_MAX'`, `default_sound: true`, `default_vibrate_timings: true` e `click_action: 'OPEN_APP'`.
- Bloco `apns` com `headers: { 'apns-priority': '10' }`, `sound: 'default'`, `contentAvailable: true` e `badge: 1`.
- Bloco `webpush` com `headers: { Urgency: 'high' }` e `requireInteraction: true`.
- Bloco `data` com todas as propriedades convertidas em string para consumo pela lógica da aplicação quando aberta.
- **Configuração de Permissões e Canal Nativo no Android:**
- Inclusão de `POST_NOTIFICATIONS`, `WAKE_LOCK` e `VIBRATE` no `AndroidManifest.xml`.
- Configuração do metadado de canal padrão do Firebase apontando para `maestri_urgent`.
- Criação nativa do canal de notificação no método `onCreate()` de `MainActivity.java` com `NotificationManager.IMPORTANCE_HIGH`, vibração ativada e `Notification.VISIBILITY_PUBLIC`.
- Verificação e solicitação explícita de `POST_NOTIFICATIONS` no Android 13+.
- **Resiliência e Escuta em Foreground/Background no App:**
- Adição do listener `pushNotificationReceived` no Capacitor para emitir alerta sonoro e feedback háptico quando o app estiver em uso ativo.
- Atualização do Service Worker para suporte total a payloads aninhados e flags de re-notificação com interação persistente.
## O que ficou de fora, de propósito
- Não alterar a interface gráfica visual dos chats nem dos terminais.
- Não introduzir dependências pesadas de terceiros além do `@capacitor/push-notifications` e `web-push` já existentes.
## Decisões abertas
| Pergunta | Dono | O que bloqueia |
| :--- | :--- | :--- |
| Nenhuma | — | — |
## Alternativas descartadas
- **Manter payload estritamente data-only e depender de background headless JS:** Descartado porque o sistema operacional Android suspende o processamento headless no Doze Mode sem notificação visível.
- **Solicitar permissões apenas via webview:** Descartado porque a declaração no `AndroidManifest.xml` é exigida obrigatoriamente pelo Google Play e sistema Android 13+.

View File

@ -0,0 +1,31 @@
# Spec: Correção das Notificações Push FCM em Background e Tela Bloqueada
**Work Item:** N/A (Projeto Pessoal · Sem Azure Boards)
**Criada em:** 2026-11-21 18:10
**Status:** Concluída (implementada, testada e pronta para deploy)
**Baseline:** maestri-remote@7488064 (main, 2026-11-21)
**Complexidade:** M (3 pts — backend push FCM v1, Android nativo e Service Worker)
**Estimativa (h):** 3,0 h
## Estado atual
2026-11-21 18:15 · Antigravity (Builder) — Implementação e validação concluídas:
- Payload FCM no backend formatado com bloco raiz `notification: { title, body }`, bloco `android` com `priority: high`, `channel_id: maestri_urgent`, `visibility: PUBLIC`, `notification_priority: PRIORITY_MAX`, `apns` com `sound: default` e `contentAvailable: true`, e `webpush` com `requireInteraction: true`.
- Cliente Android configurado no `AndroidManifest.xml` com `POST_NOTIFICATIONS`, `WAKE_LOCK`, `VIBRATE` e meta-data `com.google.firebase.messaging.default_notification_channel_id`.
- `MainActivity.java` cria o canal nativo de notificação no `onCreate` com `NotificationManager.IMPORTANCE_HIGH` e `Notification.VISIBILITY_PUBLIC`.
- `public/app.js` protegido contra acessos a `navigator` em SSR/Node e listener `pushNotificationReceived` adicionado.
- `public/sw.js` com desempacotamento de payload completo, `requireInteraction: true` e `renotify: true`.
- Suíte completa de testes unitários e de integração com 141 testes passando (100% verde).
## Capabilities Afetadas
- `docs/capabilities/maestri-remote.md`: Atualizar a seção de Push Notifications e supervisão remota para documentar a entrega de notificações em background e tela bloqueada (Doze mode) com bloco raiz `notification`, canal nativo Android `maestri_urgent` com visibilidade pública, prioridade máxima no FCM v1 e permissões `POST_NOTIFICATIONS`/`WAKE_LOCK`.
## Pronto quando
1. O payload formatado em `PushService.formatFcmMessage` contém o bloco raiz `notification: { title, body }`.
2. O bloco `android` inclui `priority: 'high'`, `channel_id: 'maestri_urgent'`, `visibility: 'PUBLIC'` e `notification_priority: 'PRIORITY_MAX'`.
3. O bloco `apns` inclui `headers: { 'apns-priority': '10' }`, som default e `contentAvailable: true`.
4. O bloco `webpush` inclui `Urgency: 'high'` e `requireInteraction: true`.
5. `AndroidManifest.xml` declara permissões `POST_NOTIFICATIONS`, `WAKE_LOCK` e `VIBRATE`, além do meta-data `com.google.firebase.messaging.default_notification_channel_id`.
6. `MainActivity.java` cria o canal de notificação nativo no `onCreate()` com `IMPORTANCE_HIGH` e `VISIBILITY_PUBLIC`.
7. `public/app.js` registra `pushNotificationReceived` para feedback sonoro e de vibração quando em primeiro plano.
8. `public/sw.js` suporta payloads aninhados e habilita `renotify: true` e `requireInteraction: true`.
9. A suíte completa de testes automatizados (`npm test`) atinge 100% de aprovação (141 testes passando).
10. A esteira de publicação completa (Bundle OTA, Docker ARM64, Rollout K3s e build do agente) é executada com sucesso.

740
package-lock.json generated
View File

@ -1,12 +1,12 @@
{ {
"name": "maestri-remote-agent", "name": "maestri-remote-agent",
"version": "1.0.27", "version": "1.0.28",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "maestri-remote-agent", "name": "maestri-remote-agent",
"version": "1.0.27", "version": "1.0.28",
"dependencies": { "dependencies": {
"@capacitor/push-notifications": "^6.0.2", "@capacitor/push-notifications": "^6.0.2",
"pg": "^8.23.1", "pg": "^8.23.1",
@ -17,7 +17,21 @@
"maestri-remote": "bin/maestri-remote.js" "maestri-remote": "bin/maestri-remote.js"
}, },
"devDependencies": { "devDependencies": {
"jsdom": "^31.0.1" "jsdom": "^25.0.1"
}
},
"node_modules/@asamuzakjp/css-color": {
"version": "3.2.0",
"resolved": "https://registry.npmjs.org/@asamuzakjp/css-color/-/css-color-3.2.0.tgz",
"integrity": "sha512-K1A6z8tS3XsmCMM86xoWdn7Fkdn9m6RSVtocUrJYIwZnFVkng/PvkEoWtOWmP+Scc6saYWHWZYbndEEXxl24jw==",
"dev": true,
"license": "MIT",
"dependencies": {
"@csstools/css-calc": "^2.1.3",
"@csstools/css-color-parser": "^3.0.9",
"@csstools/css-parser-algorithms": "^3.0.4",
"@csstools/css-tokenizer": "^3.0.3",
"lru-cache": "^10.4.3"
} }
}, },
"node_modules/@capacitor/core": { "node_modules/@capacitor/core": {
@ -39,22 +53,119 @@
"@capacitor/core": "^6.0.0" "@capacitor/core": "^6.0.0"
} }
}, },
"node_modules/@exodus/bytes": { "node_modules/@csstools/color-helpers": {
"version": "1.16.0", "version": "5.1.0",
"resolved": "https://registry.npmjs.org/@exodus/bytes/-/bytes-1.16.0.tgz", "resolved": "https://registry.npmjs.org/@csstools/color-helpers/-/color-helpers-5.1.0.tgz",
"integrity": "sha512-IcpW84uEn3N7ETtNZMlxKhfl6Pec8rUNGOTBtWbK1FKhJxIFAptZyVrvVRVBimAJxJCgc3PxepxkdWWG4DVzfA==", "integrity": "sha512-S11EXWJyy0Mz5SYvRmY8nJYTFFd1LCNV+7cXyAgQtOOuzb4EsgfqDufL+9esx72/eLhsRdGZwaldu/h+E4t4BA==",
"dev": true, "dev": true,
"funding": [
{
"type": "github",
"url": "https://github.com/sponsors/csstools"
},
{
"type": "opencollective",
"url": "https://opencollective.com/csstools"
}
],
"license": "MIT-0",
"engines": {
"node": ">=18"
}
},
"node_modules/@csstools/css-calc": {
"version": "2.1.4",
"resolved": "https://registry.npmjs.org/@csstools/css-calc/-/css-calc-2.1.4.tgz",
"integrity": "sha512-3N8oaj+0juUw/1H3YwmDDJXCgTB1gKU6Hc/bB502u9zR0q2vd786XJH9QfrKIEgFlZmhZiq6epXl4rHqhzsIgQ==",
"dev": true,
"funding": [
{
"type": "github",
"url": "https://github.com/sponsors/csstools"
},
{
"type": "opencollective",
"url": "https://opencollective.com/csstools"
}
],
"license": "MIT", "license": "MIT",
"engines": { "engines": {
"node": "^20.19.0 || ^22.12.0 || >=24.0.0" "node": ">=18"
}, },
"peerDependencies": { "peerDependencies": {
"@noble/hashes": "^1.8.0 || ^2.0.0" "@csstools/css-parser-algorithms": "^3.0.5",
}, "@csstools/css-tokenizer": "^3.0.4"
"peerDependenciesMeta": {
"@noble/hashes": {
"optional": true
} }
},
"node_modules/@csstools/css-color-parser": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/@csstools/css-color-parser/-/css-color-parser-3.1.0.tgz",
"integrity": "sha512-nbtKwh3a6xNVIp/VRuXV64yTKnb1IjTAEEh3irzS+HkKjAOYLTGNb9pmVNntZ8iVBHcWDA2Dof0QtPgFI1BaTA==",
"dev": true,
"funding": [
{
"type": "github",
"url": "https://github.com/sponsors/csstools"
},
{
"type": "opencollective",
"url": "https://opencollective.com/csstools"
}
],
"license": "MIT",
"dependencies": {
"@csstools/color-helpers": "^5.1.0",
"@csstools/css-calc": "^2.1.4"
},
"engines": {
"node": ">=18"
},
"peerDependencies": {
"@csstools/css-parser-algorithms": "^3.0.5",
"@csstools/css-tokenizer": "^3.0.4"
}
},
"node_modules/@csstools/css-parser-algorithms": {
"version": "3.0.5",
"resolved": "https://registry.npmjs.org/@csstools/css-parser-algorithms/-/css-parser-algorithms-3.0.5.tgz",
"integrity": "sha512-DaDeUkXZKjdGhgYaHNJTV9pV7Y9B3b644jCLs9Upc3VeNGg6LWARAT6O+Q+/COo+2gg/bM5rhpMAtf70WqfBdQ==",
"dev": true,
"funding": [
{
"type": "github",
"url": "https://github.com/sponsors/csstools"
},
{
"type": "opencollective",
"url": "https://opencollective.com/csstools"
}
],
"license": "MIT",
"engines": {
"node": ">=18"
},
"peerDependencies": {
"@csstools/css-tokenizer": "^3.0.4"
}
},
"node_modules/@csstools/css-tokenizer": {
"version": "3.0.4",
"resolved": "https://registry.npmjs.org/@csstools/css-tokenizer/-/css-tokenizer-3.0.4.tgz",
"integrity": "sha512-Vd/9EVDiu6PPJt9yAh6roZP6El1xHrdvIVGjyBsHR0RYwNHgL7FJPyIIW4fANJNG6FtyZfvlRPpFI4ZM/lubvw==",
"dev": true,
"funding": [
{
"type": "github",
"url": "https://github.com/sponsors/csstools"
},
{
"type": "opencollective",
"url": "https://opencollective.com/csstools"
}
],
"license": "MIT",
"engines": {
"node": ">=18"
} }
}, },
"node_modules/agent-base": { "node_modules/agent-base": {
@ -78,32 +189,12 @@
"safer-buffer": "^2.1.0" "safer-buffer": "^2.1.0"
} }
}, },
"node_modules/bcp-47": { "node_modules/asynckit": {
"version": "2.1.2", "version": "0.4.0",
"resolved": "https://registry.npmjs.org/bcp-47/-/bcp-47-2.1.2.tgz", "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
"integrity": "sha512-wsv86UuNFuPnVieKLyECTT+CP1WSAHeoIg5P3xu2kA9Z+7fVPoKt7dxzSeEhtJel0AI+NW3fIW3KtTKQKUCngg==", "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT"
"dependencies": {
"is-alphabetical": "^2.0.0",
"is-alphanumerical": "^2.0.0",
"is-decimal": "^2.0.0"
},
"funding": {
"type": "github",
"url": "https://github.com/sponsors/wooorm"
}
},
"node_modules/bcp-47-match": {
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/bcp-47-match/-/bcp-47-match-2.0.3.tgz",
"integrity": "sha512-JtTezzbAibu8G0R9op9zb3vcWZd9JF6M0xOYGPn0fNCd7wOpRB1mU2mH9T8gaBGbAAyIIVgB2G7xG0GP98zMAQ==",
"dev": true,
"license": "MIT",
"funding": {
"type": "github",
"url": "https://github.com/sponsors/wooorm"
}
}, },
"node_modules/bn.js": { "node_modules/bn.js": {
"version": "4.12.5", "version": "4.12.5",
@ -117,18 +208,66 @@
"integrity": "sha512-zRpUiDwd/xk6ADqPMATG8vc9VPrkck7T07OIx0gnjmJAnHnTVXNQG3vfvWNuiZIkwu9KrKdA1iJKfsfTVxE6NA==", "integrity": "sha512-zRpUiDwd/xk6ADqPMATG8vc9VPrkck7T07OIx0gnjmJAnHnTVXNQG3vfvWNuiZIkwu9KrKdA1iJKfsfTVxE6NA==",
"license": "BSD-3-Clause" "license": "BSD-3-Clause"
}, },
"node_modules/data-urls": { "node_modules/call-bind-apply-helpers": {
"version": "8.0.0", "version": "1.0.2",
"resolved": "https://registry.npmjs.org/data-urls/-/data-urls-8.0.0.tgz", "resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz",
"integrity": "sha512-JQUCCK+/CAGbGGx618PlFZMXH81Jtj7t73CHv9dd/zVWvxgGT2zLFRjnKb+Ng46GIwcy+f7f88qd4duqllK+WQ==", "integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"whatwg-mimetype": "^5.0.0", "es-errors": "^1.3.0",
"whatwg-url": "^17.1.2" "function-bind": "^1.1.2"
}, },
"engines": { "engines": {
"node": "^22.14.0 || >=24.0.0" "node": ">= 0.4"
}
},
"node_modules/combined-stream": {
"version": "1.0.8",
"resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",
"integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==",
"dev": true,
"license": "MIT",
"dependencies": {
"delayed-stream": "~1.0.0"
},
"engines": {
"node": ">= 0.8"
}
},
"node_modules/cssstyle": {
"version": "4.6.0",
"resolved": "https://registry.npmjs.org/cssstyle/-/cssstyle-4.6.0.tgz",
"integrity": "sha512-2z+rWdzbbSZv6/rhtvzvqeZQHrBaqgogqt85sqFNbabZOuFbCVFb8kPeEtZjiKkbrm395irpNKiYeFeLiQnFPg==",
"dev": true,
"license": "MIT",
"dependencies": {
"@asamuzakjp/css-color": "^3.2.0",
"rrweb-cssom": "^0.8.0"
},
"engines": {
"node": ">=18"
}
},
"node_modules/cssstyle/node_modules/rrweb-cssom": {
"version": "0.8.0",
"resolved": "https://registry.npmjs.org/rrweb-cssom/-/rrweb-cssom-0.8.0.tgz",
"integrity": "sha512-guoltQEx+9aMf2gDZ0s62EcV8lsXR+0w8915TC3ITdn2YueuNjdAYh/levpU9nFaoChh9RUS5ZdQMrKfVEN9tw==",
"dev": true,
"license": "MIT"
},
"node_modules/data-urls": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/data-urls/-/data-urls-5.0.0.tgz",
"integrity": "sha512-ZYP5VBHshaDAiVZxjbRVcFJpc+4xGgT0bK3vzy1HLN8jTO975HEbuYzZJcHoQEY5K1a0z8YayJkyVETa08eNTg==",
"dev": true,
"license": "MIT",
"dependencies": {
"whatwg-mimetype": "^4.0.0",
"whatwg-url": "^14.0.0"
},
"engines": {
"node": ">=18"
} }
}, },
"node_modules/debug": { "node_modules/debug": {
@ -155,6 +294,31 @@
"dev": true, "dev": true,
"license": "MIT" "license": "MIT"
}, },
"node_modules/delayed-stream": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
"integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=0.4.0"
}
},
"node_modules/dunder-proto": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz",
"integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==",
"dev": true,
"license": "MIT",
"dependencies": {
"call-bind-apply-helpers": "^1.0.1",
"es-errors": "^1.3.0",
"gopd": "^1.2.0"
},
"engines": {
"node": ">= 0.4"
}
},
"node_modules/ecdsa-sig-formatter": { "node_modules/ecdsa-sig-formatter": {
"version": "1.0.11", "version": "1.0.11",
"resolved": "https://registry.npmjs.org/ecdsa-sig-formatter/-/ecdsa-sig-formatter-1.0.11.tgz", "resolved": "https://registry.npmjs.org/ecdsa-sig-formatter/-/ecdsa-sig-formatter-1.0.11.tgz",
@ -165,29 +329,199 @@
} }
}, },
"node_modules/entities": { "node_modules/entities": {
"version": "9.0.0", "version": "6.0.1",
"resolved": "https://registry.npmjs.org/entities/-/entities-9.0.0.tgz", "resolved": "https://registry.npmjs.org/entities/-/entities-6.0.1.tgz",
"integrity": "sha512-oJFNDJg3kTPwAD1cNn2+WmUq4wFoo09npc3Ydf1D7ED4smRiWrsKnaLxykrTWgyGEcusc87P5dxlAleol9kpkg==", "integrity": "sha512-aN97NXWF6AWBTahfVOIrB/NShkzi5H7F9r1s9mD3cDj4Ko5f2qhhVoYMibXF7GlLveb/D2ioWay8lxI97Ven3g==",
"dev": true, "dev": true,
"license": "BSD-2-Clause", "license": "BSD-2-Clause",
"engines": { "engines": {
"node": ">=20.19.0" "node": ">=0.12"
}, },
"funding": { "funding": {
"url": "https://github.com/fb55/entities?sponsor=1" "url": "https://github.com/fb55/entities?sponsor=1"
} }
}, },
"node_modules/html-encoding-sniffer": { "node_modules/es-define-property": {
"version": "7.0.0", "version": "1.0.1",
"resolved": "https://registry.npmjs.org/html-encoding-sniffer/-/html-encoding-sniffer-7.0.0.tgz", "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz",
"integrity": "sha512-UikN5yr7xsCDAq87Or5or0PAlD3HJJOKVzM05az588WnpDJ4Ux7a2A53Qi6gofGg2/EtvF/H4hCi/TXfCW4Y6w==", "integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">= 0.4"
}
},
"node_modules/es-errors": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz",
"integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">= 0.4"
}
},
"node_modules/es-object-atoms": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.2.tgz",
"integrity": "sha512-HWcBoN6NileqtSydK2FqHbS/LoDd2pqrnQHLyJzBj4kOp/ky2MWMN694xOfkK8/SnUsW2DH7EfyVlydKCsm1Zw==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@exodus/bytes": "^1.15.1" "es-errors": "^1.3.0"
}, },
"engines": { "engines": {
"node": "^22.13.0 || >=24.0.0" "node": ">= 0.4"
}
},
"node_modules/es-set-tostringtag": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/es-set-tostringtag/-/es-set-tostringtag-2.1.0.tgz",
"integrity": "sha512-j6vWzfrGVfyXxge+O0x5sh6cvxAog0a/4Rdd2K36zCMV5eJ+/+tOAngRO8cODMNWbVRdVlmGZQL2YS3yR8bIUA==",
"dev": true,
"license": "MIT",
"dependencies": {
"es-errors": "^1.3.0",
"get-intrinsic": "^1.2.6",
"has-tostringtag": "^1.0.2",
"hasown": "^2.0.2"
},
"engines": {
"node": ">= 0.4"
}
},
"node_modules/form-data": {
"version": "4.0.6",
"resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.6.tgz",
"integrity": "sha512-vKatAh4SlVfgbv+YtmhiRjhEMJsYpsG1Y2rMQtR+SVSbytsSD1YGzDIcrAJmdFec88u/+VoGmxnl+80gL1tRCQ==",
"dev": true,
"license": "MIT",
"dependencies": {
"asynckit": "^0.4.0",
"combined-stream": "^1.0.8",
"es-set-tostringtag": "^2.1.0",
"hasown": "^2.0.4",
"mime-types": "^2.1.35"
},
"engines": {
"node": ">= 6"
}
},
"node_modules/function-bind": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz",
"integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==",
"dev": true,
"license": "MIT",
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/get-intrinsic": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz",
"integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==",
"dev": true,
"license": "MIT",
"dependencies": {
"call-bind-apply-helpers": "^1.0.2",
"es-define-property": "^1.0.1",
"es-errors": "^1.3.0",
"es-object-atoms": "^1.1.1",
"function-bind": "^1.1.2",
"get-proto": "^1.0.1",
"gopd": "^1.2.0",
"has-symbols": "^1.1.0",
"hasown": "^2.0.2",
"math-intrinsics": "^1.1.0"
},
"engines": {
"node": ">= 0.4"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/get-proto": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/get-proto/-/get-proto-1.0.1.tgz",
"integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==",
"dev": true,
"license": "MIT",
"dependencies": {
"dunder-proto": "^1.0.1",
"es-object-atoms": "^1.0.0"
},
"engines": {
"node": ">= 0.4"
}
},
"node_modules/gopd": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz",
"integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">= 0.4"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/has-symbols": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz",
"integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">= 0.4"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/has-tostringtag": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.2.tgz",
"integrity": "sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw==",
"dev": true,
"license": "MIT",
"dependencies": {
"has-symbols": "^1.0.3"
},
"engines": {
"node": ">= 0.4"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/hasown": {
"version": "2.0.4",
"resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.4.tgz",
"integrity": "sha512-T2UbfbBEF32wiepXIsMlTW9+dDYC6wMh/t/vYA4tuOMKqWz/n3vr1NFSxQiyP+zk2mXsoMA/i/7qV6LKut1t1A==",
"dev": true,
"license": "MIT",
"dependencies": {
"function-bind": "^1.1.2"
},
"engines": {
"node": ">= 0.4"
}
},
"node_modules/html-encoding-sniffer": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/html-encoding-sniffer/-/html-encoding-sniffer-4.0.0.tgz",
"integrity": "sha512-Y22oTqIU4uuPgEemfz7NDJz6OeKf12Lsu+QC+s3BVpda64lTiMYCyGwg5ki4vFxkMwQdeZDl2adZoqUgdFuTgQ==",
"dev": true,
"license": "MIT",
"dependencies": {
"whatwg-encoding": "^3.1.1"
},
"engines": {
"node": ">=18"
} }
}, },
"node_modules/http_ece": { "node_modules/http_ece": {
@ -199,6 +533,20 @@
"node": ">=16" "node": ">=16"
} }
}, },
"node_modules/http-proxy-agent": {
"version": "7.0.2",
"resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-7.0.2.tgz",
"integrity": "sha512-T1gkAiYYDWYx3V5Bmyu7HcfcvL7mUrTWiM6yOfa3PIphViJ/gFPbvidQ+veqSOHci/PxBcDabeUNCzpOODJZig==",
"dev": true,
"license": "MIT",
"dependencies": {
"agent-base": "^7.1.0",
"debug": "^4.3.4"
},
"engines": {
"node": ">= 14"
}
},
"node_modules/https-proxy-agent": { "node_modules/https-proxy-agent": {
"version": "7.0.6", "version": "7.0.6",
"resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-7.0.6.tgz", "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-7.0.6.tgz",
@ -212,49 +560,25 @@
"node": ">= 14" "node": ">= 14"
} }
}, },
"node_modules/iconv-lite": {
"version": "0.6.3",
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz",
"integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==",
"dev": true,
"license": "MIT",
"dependencies": {
"safer-buffer": ">= 2.1.2 < 3.0.0"
},
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/inherits": { "node_modules/inherits": {
"version": "2.0.4", "version": "2.0.4",
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==",
"license": "ISC" "license": "ISC"
}, },
"node_modules/is-alphabetical": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/is-alphabetical/-/is-alphabetical-2.0.1.tgz",
"integrity": "sha512-FWyyY60MeTNyeSRpkM2Iry0G9hpr7/9kD40mD/cGQEuilcZYS4okz8SN2Q6rLCJ8gbCt6fN+rC+6tMGS99LaxQ==",
"dev": true,
"license": "MIT",
"funding": {
"type": "github",
"url": "https://github.com/sponsors/wooorm"
}
},
"node_modules/is-alphanumerical": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/is-alphanumerical/-/is-alphanumerical-2.0.1.tgz",
"integrity": "sha512-hmbYhX/9MUMF5uh7tOXyK/n0ZvWpad5caBA17GsC6vyuCqaWliRG5K1qS9inmUhEMaOBIW7/whAnSwveW/LtZw==",
"dev": true,
"license": "MIT",
"dependencies": {
"is-alphabetical": "^2.0.0",
"is-decimal": "^2.0.0"
},
"funding": {
"type": "github",
"url": "https://github.com/sponsors/wooorm"
}
},
"node_modules/is-decimal": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/is-decimal/-/is-decimal-2.0.1.tgz",
"integrity": "sha512-AAB9hiomQs5DXWcRB1rqsxGUstbRroFOPPVAomNk/3XHR5JyEZChOyTWe2oayKnsSsr/kcGqF+z6yuH6HHpN0A==",
"dev": true,
"license": "MIT",
"funding": {
"type": "github",
"url": "https://github.com/sponsors/wooorm"
}
},
"node_modules/is-potential-custom-element-name": { "node_modules/is-potential-custom-element-name": {
"version": "1.0.1", "version": "1.0.1",
"resolved": "https://registry.npmjs.org/is-potential-custom-element-name/-/is-potential-custom-element-name-1.0.1.tgz", "resolved": "https://registry.npmjs.org/is-potential-custom-element-name/-/is-potential-custom-element-name-1.0.1.tgz",
@ -263,39 +587,42 @@
"license": "MIT" "license": "MIT"
}, },
"node_modules/jsdom": { "node_modules/jsdom": {
"version": "31.0.1", "version": "25.0.1",
"resolved": "https://registry.npmjs.org/jsdom/-/jsdom-31.0.1.tgz", "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-25.0.1.tgz",
"integrity": "sha512-CbhJL8ZQg3eKswxSZth4QO9tW0jPIhmR0vtSXQSbKSfWbwIT6hoRc17wdHIVTQ43KI0mdV5iTJr3281IDgVZ5g==", "integrity": "sha512-8i7LzZj7BF8uplX+ZyOlIz86V6TAsSs+np6m1kpW9u0JWi4z/1t+FzcK1aek+ybTnAC4KhBL4uXCNT0wcUIeCw==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@exodus/bytes": "^1.16.0", "cssstyle": "^4.1.0",
"bcp-47": "^2.1.2", "data-urls": "^5.0.0",
"bcp-47-match": "^2.0.3", "decimal.js": "^10.4.3",
"data-urls": "^8.0.0", "form-data": "^4.0.0",
"decimal.js": "^10.6.0", "html-encoding-sniffer": "^4.0.0",
"html-encoding-sniffer": "^7.0.0", "http-proxy-agent": "^7.0.2",
"https-proxy-agent": "^7.0.5",
"is-potential-custom-element-name": "^1.0.1", "is-potential-custom-element-name": "^1.0.1",
"lru-cache": "^11.5.3", "nwsapi": "^2.2.12",
"parse5": "^8.1.0", "parse5": "^7.1.2",
"parse5-parser-stream": "^8.1.0", "rrweb-cssom": "^0.7.1",
"saxes": "^6.0.0", "saxes": "^6.0.0",
"tough-cookie": "^6.0.2", "symbol-tree": "^3.2.4",
"undici": "^8.12.3", "tough-cookie": "^5.0.0",
"w3c-xmlserializer": "^6.0.0", "w3c-xmlserializer": "^5.0.0",
"webidl-conversions": "^8.0.1", "webidl-conversions": "^7.0.0",
"whatwg-mimetype": "^5.0.0", "whatwg-encoding": "^3.1.1",
"whatwg-url": "^17.3.0", "whatwg-mimetype": "^4.0.0",
"whatwg-url": "^14.0.0",
"ws": "^8.18.0",
"xml-name-validator": "^5.0.0" "xml-name-validator": "^5.0.0"
}, },
"engines": { "engines": {
"node": "^22.22.2 || ^24.15.0 || >=26.0.0" "node": ">=18"
}, },
"peerDependencies": { "peerDependencies": {
"@napi-rs/canvas": "^1.0.13" "canvas": "^2.11.2"
}, },
"peerDependenciesMeta": { "peerDependenciesMeta": {
"@napi-rs/canvas": { "canvas": {
"optional": true "optional": true
} }
} }
@ -322,13 +649,43 @@
} }
}, },
"node_modules/lru-cache": { "node_modules/lru-cache": {
"version": "11.5.3", "version": "10.4.3",
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-11.5.3.tgz", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.4.3.tgz",
"integrity": "sha512-U4N8FgzmWxc8k1VH8Kr6lQg18U7Fjvby6wXHVRX/ZZ7IwWbRMgrRbP0Wrb5q5NVinryp4SQampHKdvtecItxUg==", "integrity": "sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==",
"dev": true, "dev": true,
"license": "BlueOak-1.0.0", "license": "ISC"
},
"node_modules/math-intrinsics": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz",
"integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==",
"dev": true,
"license": "MIT",
"engines": { "engines": {
"node": "20 || >=22" "node": ">= 0.4"
}
},
"node_modules/mime-db": {
"version": "1.52.0",
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz",
"integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">= 0.6"
}
},
"node_modules/mime-types": {
"version": "2.1.35",
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz",
"integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==",
"dev": true,
"license": "MIT",
"dependencies": {
"mime-db": "1.52.0"
},
"engines": {
"node": ">= 0.6"
} }
}, },
"node_modules/minimalistic-assert": { "node_modules/minimalistic-assert": {
@ -352,27 +709,21 @@
"integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",
"license": "MIT" "license": "MIT"
}, },
"node_modules/nwsapi": {
"version": "2.2.28",
"resolved": "https://registry.npmjs.org/nwsapi/-/nwsapi-2.2.28.tgz",
"integrity": "sha512-IlVB7OS7qrOsVYlpnFIkETjMwT9jwvmocJmmM+GZU/PAB3uGi9Ezd7vcWhWBUnSc0ya4ppmQITOyP1ez9gg8cg==",
"dev": true,
"license": "MIT"
},
"node_modules/parse5": { "node_modules/parse5": {
"version": "8.1.1", "version": "7.3.0",
"resolved": "https://registry.npmjs.org/parse5/-/parse5-8.1.1.tgz", "resolved": "https://registry.npmjs.org/parse5/-/parse5-7.3.0.tgz",
"integrity": "sha512-EcR/6WDcU7b2N3vQSxKALCk9lXGtUMQxXio008OEMBE0kavu/7JLfBEeFPzi43nMqVDSbEn3QCK+BMCc9zO//w==", "integrity": "sha512-IInvU7fabl34qmi9gY8XOVxhYyMyuH2xUNpb2q8/Y+7552KlejkRvqvD19nMoUW/uQGGbqNpA6Tufu5FL5BZgw==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"entities": "^9.0.0" "entities": "^6.0.0"
},
"funding": {
"url": "https://github.com/inikulin/parse5?sponsor=1"
}
},
"node_modules/parse5-parser-stream": {
"version": "8.1.1",
"resolved": "https://registry.npmjs.org/parse5-parser-stream/-/parse5-parser-stream-8.1.1.tgz",
"integrity": "sha512-hMcVbbUJcQmP8rURWUdYrT1flRiBiBVjq/RYGguJpDUgIXSqdYKlE0CxthmdMWoSlBAuL5bUBa73g0pttSy7Hw==",
"dev": true,
"license": "MIT",
"dependencies": {
"parse5": "^8.1.1"
}, },
"funding": { "funding": {
"url": "https://github.com/inikulin/parse5?sponsor=1" "url": "https://github.com/inikulin/parse5?sponsor=1"
@ -516,6 +867,13 @@
"node": ">=6" "node": ">=6"
} }
}, },
"node_modules/rrweb-cssom": {
"version": "0.7.1",
"resolved": "https://registry.npmjs.org/rrweb-cssom/-/rrweb-cssom-0.7.1.tgz",
"integrity": "sha512-TrEMa7JGdVm0UThDJSx7ddw5nVm3UJS9o9CCIZ72B1vSyEZoziDqBYP3XIoi/12lKrJR8rE3jeFHMok2F/Mnsg==",
"dev": true,
"license": "MIT"
},
"node_modules/safe-buffer": { "node_modules/safe-buffer": {
"version": "5.2.1", "version": "5.2.1",
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",
@ -564,50 +922,57 @@
"node": ">= 10.x" "node": ">= 10.x"
} }
}, },
"node_modules/symbol-tree": {
"version": "3.2.4",
"resolved": "https://registry.npmjs.org/symbol-tree/-/symbol-tree-3.2.4.tgz",
"integrity": "sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw==",
"dev": true,
"license": "MIT"
},
"node_modules/tldts": { "node_modules/tldts": {
"version": "7.5.4", "version": "6.1.86",
"resolved": "https://registry.npmjs.org/tldts/-/tldts-7.5.4.tgz", "resolved": "https://registry.npmjs.org/tldts/-/tldts-6.1.86.tgz",
"integrity": "sha512-Rn2ABgjHZrA+jzqom5zhxA0hLohzYrIgfCPyhpTUxqsUrcsBYuab49LseR9waB9Jr8/MxdodvMHA91oRiGLO3Q==", "integrity": "sha512-WMi/OQ2axVTf/ykqCQgXiIct+mSQDFdH2fkwhPwgEwvJ1kSzZRiinb0zF2Xb8u4+OqPChmyI6MEu4EezNJz+FQ==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"tldts-core": "^7.5.4" "tldts-core": "^6.1.86"
}, },
"bin": { "bin": {
"tldts": "bin/cli.js" "tldts": "bin/cli.js"
} }
}, },
"node_modules/tldts-core": { "node_modules/tldts-core": {
"version": "7.5.4", "version": "6.1.86",
"resolved": "https://registry.npmjs.org/tldts-core/-/tldts-core-7.5.4.tgz", "resolved": "https://registry.npmjs.org/tldts-core/-/tldts-core-6.1.86.tgz",
"integrity": "sha512-9+4zWtKEDZ3V3FoZ1B97rv+5z5oqp7yeXGVze3CxgQ+CJro9do9DCPD00wxstYZDXDMXsurkBerFfiB6GYtPbA==", "integrity": "sha512-Je6p7pkk+KMzMv2XXKmAE3McmolOQFdxkKw0R8EYNr7sELW46JqnNeTX8ybPiQgvg1ymCoF8LXs5fzFaZvJPTA==",
"dev": true, "dev": true,
"license": "MIT" "license": "MIT"
}, },
"node_modules/tough-cookie": { "node_modules/tough-cookie": {
"version": "6.1.0", "version": "5.1.2",
"resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-6.1.0.tgz", "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-5.1.2.tgz",
"integrity": "sha512-FTxc8u8Kl2tz0Lat1u8ksvcy8bwHRyEMawwTWybo51JqaC6O7SvfuhAKg+Ld6VqyIe2QRJBzY9HA7y2WyFRT2w==", "integrity": "sha512-FVDYdxtnj0G6Qm/DhNPSb8Ju59ULcup3tuJxkFb5K8Bv2pUXILbf0xZWU8PX8Ov19OXljbUyveOFwRMwkXzO+A==",
"dev": true, "dev": true,
"license": "BSD-3-Clause", "license": "BSD-3-Clause",
"dependencies": { "dependencies": {
"tldts": "^7.0.5" "tldts": "^6.1.32"
}, },
"engines": { "engines": {
"node": ">=16" "node": ">=16"
} }
}, },
"node_modules/tr46": { "node_modules/tr46": {
"version": "7.0.0", "version": "5.1.1",
"resolved": "https://registry.npmjs.org/tr46/-/tr46-7.0.0.tgz", "resolved": "https://registry.npmjs.org/tr46/-/tr46-5.1.1.tgz",
"integrity": "sha512-BcDSDW+SIGWVOns1Zm6Yg91q9AEj7eaID0QDY9oIqJD1A8dscNwMcl9Sms2DeuWCNov1X0/oXanHGYQBSLwZsg==", "integrity": "sha512-hdF5ZgjTqgAntKkklYw0R03MG2x/bSzTtkxmIRw/sTNV8YXsCJ1tfLAX23lhxhHJlEf3CRCOCGGWw3vI3GaSPw==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"punycode": "^2.3.1" "punycode": "^2.3.1"
}, },
"engines": { "engines": {
"node": "^22.14.0 || >=24.0.0" "node": ">=18"
} }
}, },
"node_modules/tslib": { "node_modules/tslib": {
@ -617,27 +982,17 @@
"license": "0BSD", "license": "0BSD",
"peer": true "peer": true
}, },
"node_modules/undici": {
"version": "8.12.4",
"resolved": "https://registry.npmjs.org/undici/-/undici-8.12.4.tgz",
"integrity": "sha512-8Mx+uNKKER2bA4AdtedkqRbwUCIJFr2nJckXRe5yrDqzePqwLP7VNcctN8/XdmDSbF7mS+jJKIszlL+vbam1VA==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=22.19.0"
}
},
"node_modules/w3c-xmlserializer": { "node_modules/w3c-xmlserializer": {
"version": "6.0.0", "version": "5.0.0",
"resolved": "https://registry.npmjs.org/w3c-xmlserializer/-/w3c-xmlserializer-6.0.0.tgz", "resolved": "https://registry.npmjs.org/w3c-xmlserializer/-/w3c-xmlserializer-5.0.0.tgz",
"integrity": "sha512-4Nsy8K5Tr6SPDH9jhKJOHf7ChDrc1zufZTVSF7x72hwuEXBqxqk9G6cK+K2NRUtB3iELRJqjXb4JPDMBjMTl2Q==", "integrity": "sha512-o8qghlI8NZHU1lLPrpi2+Uq7abh4GGPpYANlalzWxyWteJOCsr/P+oPBA49TOLu5FTZO4d3F9MnWJfiMo4BkmA==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"xml-name-validator": "^5.0.0" "xml-name-validator": "^5.0.0"
}, },
"engines": { "engines": {
"node": "^22.22.2 || ^24.15.0 || >=26.0.0" "node": ">=18"
} }
}, },
"node_modules/web-push": { "node_modules/web-push": {
@ -660,38 +1015,51 @@
} }
}, },
"node_modules/webidl-conversions": { "node_modules/webidl-conversions": {
"version": "8.0.1", "version": "7.0.0",
"resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-8.0.1.tgz", "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-7.0.0.tgz",
"integrity": "sha512-BMhLD/Sw+GbJC21C/UgyaZX41nPt8bUTg+jWyDeg7e7YN4xOM05YPSIXceACnXVtqyEw/LMClUQMtMZ+PGGpqQ==", "integrity": "sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g==",
"dev": true, "dev": true,
"license": "BSD-2-Clause", "license": "BSD-2-Clause",
"engines": { "engines": {
"node": ">=20" "node": ">=12"
} }
}, },
"node_modules/whatwg-mimetype": { "node_modules/whatwg-encoding": {
"version": "5.0.0", "version": "3.1.1",
"resolved": "https://registry.npmjs.org/whatwg-mimetype/-/whatwg-mimetype-5.0.0.tgz", "resolved": "https://registry.npmjs.org/whatwg-encoding/-/whatwg-encoding-3.1.1.tgz",
"integrity": "sha512-sXcNcHOC51uPGF0P/D4NVtrkjSU2fNsm9iog4ZvZJsL3rjoDAzXZhkm2MWt1y+PUdggKAYVoMAIYcs78wJ51Cw==", "integrity": "sha512-6qN4hJdMwfYBtE3YBTTHhoeuUrDBPZmbQaxWAqSALV/MeEnR5z1xd8UKud2RAkFoPkmB+hli1TZSnyi84xz1vQ==",
"dev": true, "deprecated": "Use @exodus/bytes instead for a more spec-conformant and faster implementation",
"license": "MIT",
"engines": {
"node": ">=20"
}
},
"node_modules/whatwg-url": {
"version": "17.3.0",
"resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-17.3.0.tgz",
"integrity": "sha512-KwOAJrpf+GTgBvcBQJcP38sMF0DsQKdwtG+TxM2pW44P6E5k0hDbWrDmyuJDIF0Uef0aQq0ZoJs+5oI+k8ddhg==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@exodus/bytes": "^1.16.0", "iconv-lite": "0.6.3"
"tr46": "^7.0.0",
"webidl-conversions": "^8.0.1"
}, },
"engines": { "engines": {
"node": "^22.14.0 || >=24.0.0" "node": ">=18"
}
},
"node_modules/whatwg-mimetype": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/whatwg-mimetype/-/whatwg-mimetype-4.0.0.tgz",
"integrity": "sha512-QaKxh0eNIi2mE9p2vEdzfagOKHCcj1pJ56EEHGQOVxp8r9/iszLUUV7v89x9O1p/T+NlTM5W7jW6+cz4Fq1YVg==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=18"
}
},
"node_modules/whatwg-url": {
"version": "14.2.0",
"resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-14.2.0.tgz",
"integrity": "sha512-De72GdQZzNTUBBChsXueQUnPKDkg/5A5zp7pFDuQAj5UFoENpiACU0wlCvzpAGnTkj++ihpKwKyYewn/XNUbKw==",
"dev": true,
"license": "MIT",
"dependencies": {
"tr46": "^5.1.0",
"webidl-conversions": "^7.0.0"
},
"engines": {
"node": ">=18"
} }
}, },
"node_modules/ws": { "node_modules/ws": {

View File

@ -1,6 +1,6 @@
{ {
"name": "maestri-remote-agent", "name": "maestri-remote-agent",
"version": "1.0.28", "version": "1.0.29",
"type": "module", "type": "module",
"description": "Gateway Local do Maestri Remote para estações de trabalho", "description": "Gateway Local do Maestri Remote para estações de trabalho",
"bin": { "bin": {
@ -10,7 +10,7 @@
"start": "node bin/maestri-remote.js start", "start": "node bin/maestri-remote.js start",
"build:bundle": "node scripts/build-bundle.js", "build:bundle": "node scripts/build-bundle.js",
"build:agent": "node scripts/build-agent-pkg.js", "build:agent": "node scripts/build-agent-pkg.js",
"test": "node --test \"test/*.test.js\"" "test": "node --test test/*.test.js"
}, },
"dependencies": { "dependencies": {
"@capacitor/push-notifications": "^6.0.2", "@capacitor/push-notifications": "^6.0.2",
@ -19,6 +19,6 @@
"ws": "^8.18.0" "ws": "^8.18.0"
}, },
"devDependencies": { "devDependencies": {
"jsdom": "^31.0.1" "jsdom": "^25.0.1"
} }
} }

View File

@ -5376,7 +5376,7 @@ if (pinInput) {
// Web Push Notifications & OTA Service // Web Push Notifications & OTA Service
// ========================================== // ==========================================
async function initServiceWorker() { async function initServiceWorker() {
if (!('serviceWorker' in navigator) || !('PushManager' in window)) return; if (typeof window === 'undefined' || typeof navigator === 'undefined' || !('serviceWorker' in navigator) || !('PushManager' in window)) return;
try { try {
const reg = await navigator.serviceWorker.register('/sw.js'); const reg = await navigator.serviceWorker.register('/sw.js');
@ -5476,6 +5476,16 @@ async function initNativePushNotifications() {
} }
}); });
PushNotifications.addListener('pushNotificationReceived', (notification) => {
console.log('[FCM] Notificação recebida no cliente:', notification);
if (typeof playNotificationSound === 'function') {
playNotificationSound();
}
if (typeof navigator !== 'undefined' && navigator.vibrate) {
navigator.vibrate([200, 100, 200]);
}
});
PushNotifications.addListener('pushNotificationActionPerformed', (action) => { PushNotifications.addListener('pushNotificationActionPerformed', (action) => {
console.log('[FCM] Notificação acionada pelo operador:', action); console.log('[FCM] Notificação acionada pelo operador:', action);
const data = action?.notification?.data || {}; const data = action?.notification?.data || {};

Binary file not shown.

Binary file not shown.

View File

@ -1,9 +1,9 @@
{ {
"version": "1.0.28", "version": "1.0.29",
"buildId": "c26de28b", "buildId": "159c83be",
"releasedAt": "2026-11-21T20:57:34.475Z", "releasedAt": "2026-11-21T22:56:51.813Z",
"bundleUrl": "/bundles/bundle-1.0.28.zip", "bundleUrl": "/bundles/bundle-1.0.29.zip",
"latestUrl": "/bundles/bundle-latest.zip", "latestUrl": "/bundles/bundle-latest.zip",
"checksum": "6a1134c67a3cb35376d10c37da034d6e015edfeefed8c31a1f1cd4617ce1e3ef", "checksum": "c0420588efb885fd14a38ee5088408abd84304ee174b0f2b2bddaa4c12ebd276",
"sizeBytes": 71641 "sizeBytes": 71328
} }

Binary file not shown.

View File

@ -18,19 +18,26 @@ self.addEventListener('push', (event) => {
if (event.data) data.body = event.data.text(); if (event.data) data.body = event.data.text();
} }
const title = (data.notification && data.notification.title) || data.title || 'Maestri Remote';
const body = (data.notification && data.notification.body) || data.body || 'Novo prompt aguardando sua resposta';
const stationId = data.data?.stationId || data.stationId || 'default';
const options = { const options = {
body: data.body, body,
icon: '/icon.svg', icon: '/icon.svg',
badge: '/icon.svg', badge: '/icon.svg',
vibrate: [100, 50, 100], vibrate: [200, 100, 200, 100, 200],
data: data.data || {}, data: data.data || data,
tag: `maestri-station-${stationId}`,
renotify: true,
requireInteraction: true,
actions: [ actions: [
{ action: 'open', title: 'Abrir no App' } { action: 'open', title: 'Abrir no App' }
] ]
}; };
event.waitUntil( event.waitUntil(
self.registration.showNotification(data.title, options) self.registration.showNotification(title, options)
); );
}); });

View File

@ -267,7 +267,7 @@ try {
} }
if (!zipSuccess) { if (!zipSuccess) {
execSync(`tar -a -c -f "${DIST_ZIP}" -C "${STAGING_DIR}" *`, { stdio: 'inherit' }); execSync(`tar -a -c -f "${DIST_ZIP}" -C "${STAGING_DIR}" .`, { stdio: 'inherit' });
} }
// Limpa staging // Limpa staging

View File

@ -101,24 +101,70 @@ export class PushService {
} }
formatFcmMessage({ token, eventType, agentName, stationId, promptText, options }) { formatFcmMessage({ token, eventType, agentName, stationId, promptText, options }) {
const title = `Maestri: ${agentName || 'Alerta'}`;
const body = promptText || 'Tarefa concluída no terminal.';
const optionsStr = typeof options === 'string' ? options : JSON.stringify(options || []);
return { return {
token, token,
// 1. Bloco raiz 'notification': obrigatório para Android e iOS exibirem notificação nativa
// mesmo quando o aplicativo estiver em background, suspenso (Doze Mode) ou com a tela bloqueada.
notification: {
title,
body
},
// 2. Bloco 'data': dados operacionais para o aplicativo manipular internamente
data: { data: {
type: eventType || 'PROMPT_PENDING', type: eventType || 'PROMPT_PENDING',
agentName: agentName || '', agentName: agentName || '',
stationId: stationId || '', stationId: stationId || '',
prompt: promptText || '', prompt: body,
options: typeof options === 'string' ? options : JSON.stringify(options || []), title,
body,
options: optionsStr,
timestamp: String(Date.now()) timestamp: String(Date.now())
}, },
// 3. Bloco 'android': prioridade alta, canal urgente com importância máxima e visibilidade pública na tela de bloqueio
android: { android: {
priority: 'high', priority: 'high',
notification: { notification: {
title: `Maestri: ${agentName || 'Alerta'}`, title,
body: promptText || 'Tarefa concluída no terminal.', body,
channel_id: 'maestri_urgent', channel_id: 'maestri_urgent',
channelId: 'maestri_urgent',
notification_priority: 'PRIORITY_MAX', notification_priority: 'PRIORITY_MAX',
visibility: 'PUBLIC' visibility: 'PUBLIC',
default_sound: true,
default_vibrate_timings: true,
click_action: 'OPEN_APP'
}
},
// 4. Bloco 'apns': Apple Push Notification Service com prioridade máxima e som
apns: {
headers: {
'apns-priority': '10'
},
payload: {
aps: {
alert: {
title,
body
},
sound: 'default',
contentAvailable: true,
badge: 1
}
}
},
// 5. Bloco 'webpush': PWA e navegadores desktop/mobile
webpush: {
headers: {
Urgency: 'high'
},
notification: {
title,
body,
requireInteraction: true
} }
} }
}; };

View File

@ -442,13 +442,40 @@ test('PushService deve registrar tokens FCM e despachar payloads FCM v1 de alta
assert.equal(dispatchedFcmMessages.length, 2); assert.equal(dispatchedFcmMessages.length, 2);
const msg1 = dispatchedFcmMessages[0]; const msg1 = dispatchedFcmMessages[0];
// Bloco raiz notification obrigatório para background/tela bloqueada
assert.ok(msg1.notification, 'Mensagem FCM deve conter bloco raiz notification');
assert.equal(msg1.notification.title, 'Maestri: Engenheiro #1');
assert.equal(msg1.notification.body, 'Autoriza execução do script?');
// Bloco Android de alta prioridade e visibilidade pública
assert.equal(msg1.android.priority, 'high'); assert.equal(msg1.android.priority, 'high');
assert.equal(msg1.android.notification.channel_id, 'maestri_urgent'); assert.equal(msg1.android.notification.channel_id, 'maestri_urgent');
assert.equal(msg1.android.notification.channelId, 'maestri_urgent');
assert.equal(msg1.android.notification.notification_priority, 'PRIORITY_MAX'); assert.equal(msg1.android.notification.notification_priority, 'PRIORITY_MAX');
assert.equal(msg1.android.notification.visibility, 'PUBLIC');
assert.equal(msg1.android.notification.default_sound, true);
assert.equal(msg1.android.notification.default_vibrate_timings, true);
assert.equal(msg1.android.notification.click_action, 'OPEN_APP');
// Bloco APNs (iOS)
assert.ok(msg1.apns, 'Mensagem FCM deve conter bloco apns');
assert.equal(msg1.apns.headers['apns-priority'], '10');
assert.equal(msg1.apns.payload.aps.sound, 'default');
assert.equal(msg1.apns.payload.aps.contentAvailable, true);
// Bloco Webpush
assert.ok(msg1.webpush, 'Mensagem FCM deve conter bloco webpush');
assert.equal(msg1.webpush.headers.Urgency, 'high');
assert.equal(msg1.webpush.notification.requireInteraction, true);
// Bloco Data
assert.equal(msg1.data.type, 'PROMPT_PENDING'); assert.equal(msg1.data.type, 'PROMPT_PENDING');
assert.equal(msg1.data.agentName, 'Engenheiro #1'); assert.equal(msg1.data.agentName, 'Engenheiro #1');
assert.equal(msg1.data.stationId, 'station-alpha'); assert.equal(msg1.data.stationId, 'station-alpha');
assert.equal(msg1.data.prompt, 'Autoriza execução do script?'); assert.equal(msg1.data.prompt, 'Autoriza execução do script?');
assert.equal(msg1.data.title, 'Maestri: Engenheiro #1');
assert.equal(msg1.data.body, 'Autoriza execução do script?');
assert.equal(msg1.data.options, JSON.stringify(['Sim', 'Não'])); assert.equal(msg1.data.options, JSON.stringify(['Sim', 'Não']));
// 3. Integração com sendNotification tradicional (despacha WebPush + FCM) // 3. Integração com sendNotification tradicional (despacha WebPush + FCM)
@ -460,6 +487,7 @@ test('PushService deve registrar tokens FCM e despachar payloads FCM v1 de alta
// Deve ter disparado mais 2 mensagens FCM para station-alpha // Deve ter disparado mais 2 mensagens FCM para station-alpha
assert.equal(dispatchedFcmMessages.length, 4); assert.equal(dispatchedFcmMessages.length, 4);
assert.equal(dispatchedFcmMessages[2].notification.title, 'Maestri: Engenheiro #1');
assert.equal(dispatchedFcmMessages[2].data.type, 'TASK_COMPLETED'); assert.equal(dispatchedFcmMessages[2].data.type, 'TASK_COMPLETED');
}); });
@ -511,3 +539,49 @@ test('createRelayHttpHandler deve cadastrar token FCM na rota POST /api/notifica
assert.ok(tokens.has('fcm-device-mobile-777')); assert.ok(tokens.has('fcm-device-mobile-777'));
}); });
test('PushService formatFcmMessage deve garantir cabeçalhos e blocos para exibição nativa em tela bloqueada', async () => {
const { PushService } = await import('../src/relay/push-service.js');
const service = new PushService({ keysFile: path.resolve('.tmp-vapid-test.json') });
const msg = service.formatFcmMessage({
token: 'device-token-xyz',
eventType: 'PROMPT_PENDING',
agentName: 'Planner',
stationId: 'st-10',
promptText: 'Aprovar rollout?',
options: ['Sim', 'Não']
});
// Validação estrita dos requisitos técnicos
assert.equal(msg.token, 'device-token-xyz');
assert.deepEqual(msg.notification, {
title: 'Maestri: Planner',
body: 'Aprovar rollout?'
});
assert.equal(msg.android.priority, 'high');
assert.equal(msg.android.notification.channel_id, 'maestri_urgent');
assert.equal(msg.android.notification.channelId, 'maestri_urgent');
assert.equal(msg.android.notification.visibility, 'PUBLIC');
assert.equal(msg.android.notification.notification_priority, 'PRIORITY_MAX');
assert.equal(msg.android.notification.default_sound, true);
assert.equal(msg.android.notification.default_vibrate_timings, true);
assert.equal(msg.android.notification.click_action, 'OPEN_APP');
assert.equal(msg.apns.headers['apns-priority'], '10');
assert.equal(msg.apns.payload.aps.alert.title, 'Maestri: Planner');
assert.equal(msg.apns.payload.aps.alert.body, 'Aprovar rollout?');
assert.equal(msg.apns.payload.aps.sound, 'default');
assert.equal(msg.apns.payload.aps.contentAvailable, true);
assert.equal(msg.webpush.headers.Urgency, 'high');
assert.equal(msg.webpush.notification.requireInteraction, true);
assert.equal(msg.data.type, 'PROMPT_PENDING');
assert.equal(msg.data.agentName, 'Planner');
assert.equal(msg.data.stationId, 'st-10');
assert.equal(msg.data.title, 'Maestri: Planner');
assert.equal(msg.data.body, 'Aprovar rollout?');
assert.equal(msg.data.options, JSON.stringify(['Sim', 'Não']));
assert.ok(msg.data.timestamp);
});