@danhachuel/leadmaster 0.1.25 → 0.1.27

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 (33) hide show
  1. package/CHANGELOG.md +47 -0
  2. package/backend/__pycache__/main.cpython-311.pyc +0 -0
  3. package/backend/main.py +50 -1
  4. package/backend/services/__pycache__/__init__.cpython-311.pyc +0 -0
  5. package/backend/services/__pycache__/agents.cpython-311.pyc +0 -0
  6. package/backend/services/__pycache__/crm_agent.cpython-311.pyc +0 -0
  7. package/backend/services/__pycache__/extractors.cpython-311.pyc +0 -0
  8. package/backend/services/__pycache__/flags.cpython-311.pyc +0 -0
  9. package/backend/services/__pycache__/llm.cpython-311.pyc +0 -0
  10. package/backend/services/__pycache__/storage.cpython-311.pyc +0 -0
  11. package/backend/tests/__pycache__/conftest.cpython-311-pytest-8.4.2.pyc +0 -0
  12. package/backend/tests/__pycache__/test_agents_routes.cpython-311-pytest-8.4.2.pyc +0 -0
  13. package/backend/tests/__pycache__/test_campaigns_routes.cpython-311-pytest-8.4.2.pyc +0 -0
  14. package/backend/tests/__pycache__/test_cnpj_extractor.cpython-311-pytest-8.4.2.pyc +0 -0
  15. package/backend/tests/__pycache__/test_config.cpython-311-pytest-8.4.2.pyc +0 -0
  16. package/backend/tests/__pycache__/test_crm_routes.cpython-311-pytest-8.4.2.pyc +0 -0
  17. package/backend/tests/__pycache__/test_extractors_real.cpython-311-pytest-8.4.2.pyc +0 -0
  18. package/backend/tests/__pycache__/test_funnel_routes.cpython-311-pytest-8.4.2.pyc +0 -0
  19. package/backend/tests/__pycache__/test_instagram_extractor.cpython-311-pytest-8.4.2.pyc +0 -0
  20. package/backend/tests/__pycache__/test_launcher_protections.cpython-311-pytest-8.4.2.pyc +0 -0
  21. package/backend/tests/__pycache__/test_lead_edit_routes.cpython-311-pytest-8.4.2.pyc +0 -0
  22. package/backend/tests/__pycache__/test_leads_export.cpython-311-pytest-8.4.2.pyc +0 -0
  23. package/backend/tests/__pycache__/test_maps_extractor.cpython-311-pytest-8.4.2.pyc +0 -0
  24. package/backend/tests/__pycache__/test_metrics.cpython-311-pytest-8.4.2.pyc +0 -0
  25. package/backend/tests/__pycache__/test_process_flags.cpython-311-pytest-8.4.2.pyc +0 -0
  26. package/backend/tests/__pycache__/test_webhook_routes.cpython-311-pytest-8.4.2.pyc +0 -0
  27. package/backend/tests/test_launcher_protections.py +12 -7
  28. package/backend/tests/test_leads_export.py +56 -0
  29. package/frontend/dist/assets/{index-BLuj5jS4.css → index-NeGNWLr8.css} +1 -1
  30. package/frontend/dist/assets/{index-C1mEC85V.js → index-pSgnrc_D.js} +13 -13
  31. package/frontend/dist/index.html +2 -2
  32. package/package.json +1 -1
  33. package/scripts/cli.mjs +23 -20
@@ -5,8 +5,8 @@
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
6
  <link rel="icon" type="image/svg+xml" href="/favicon.svg" />
7
7
  <title>LeadMaster — Painel</title>
8
- <script type="module" crossorigin src="/assets/index-C1mEC85V.js"></script>
9
- <link rel="stylesheet" crossorigin href="/assets/index-BLuj5jS4.css">
8
+ <script type="module" crossorigin src="/assets/index-pSgnrc_D.js"></script>
9
+ <link rel="stylesheet" crossorigin href="/assets/index-NeGNWLr8.css">
10
10
  </head>
11
11
  <body class="bg-gray-100 min-h-screen">
12
12
  <div id="root"></div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@danhachuel/leadmaster",
3
- "version": "0.1.25",
3
+ "version": "0.1.27",
4
4
  "description": "SaaS local de prospecção e automação: CRM, extratores de leads e agentes de IA — 100% local.",
5
5
  "license": "MIT",
6
6
  "author": "Dan Hachuel",
package/scripts/cli.mjs CHANGED
@@ -640,6 +640,19 @@ function cmdStart(args) {
640
640
  }
641
641
  });
642
642
 
643
+ // -------------------------------------------------------------------------
644
+ // Keep-alive INFALÍVEL — Dummy Server (regra inviolável do AGENTS.md)
645
+ //
646
+ // Um socket TCP aberto no sistema operacional (porta efêmera em 127.0.0.1)
647
+ // segura o event loop do Node INDEPENDENTE do terminal: mesmo que o
648
+ // MobaXterm feche o stdin (EOF), que o wrapper do npx feche os streams ou
649
+ // que timers sejam perdidos, o handle do servidor impede o processo de
650
+ // encerrar sozinho. Enquanto `keepAliveServer` existir, o prompt NUNCA é
651
+ // devolvido e o uvicorn nunca fica órfão. NUNCA REMOVER.
652
+ // -------------------------------------------------------------------------
653
+ const keepAliveServer = http.createServer((req, res) => res.end('ok'));
654
+ keepAliveServer.listen(0, '127.0.0.1');
655
+
643
656
  const stop = () => {
644
657
  console.log('\nEncerrando LeadMaster...');
645
658
  if (platform() === 'win32' && child.pid) {
@@ -659,11 +672,10 @@ function cmdStart(args) {
659
672
  }
660
673
 
661
674
  // -------------------------------------------------------------------------
662
- // Sinais (regra inviolável do AGENTS.md)
663
- // MobaXterm envia SIGINT/SIGHUP espúrios (perda de foco, minimização): no
664
- // Windows esses sinais são APENAS ABSORVIDOS (log), sem encerrar o launcher,
665
- // para o app não morrer sozinho. SIGTERM e SIGBREAK são paradas legítimas e
666
- // sempre encerram. No Linux/macOS, SIGINT/SIGHUP mantêm o stop gracioso.
675
+ // Camadas SECUNDÁRIAS de keep-alive (o Dummy Server acima é a principal):
676
+ // setInterval mantém o loop ativo, stdin.resume ouve digitação, e o
677
+ // beforeExit re-arma o timer se o loop esvaziar. Erros de stdin são
678
+ // ignorados — nenhum deles pode derrubar o launcher.
667
679
  // -------------------------------------------------------------------------
668
680
  const ehWindows = platform() === 'win32';
669
681
  const naoAbsorver = () => { stop(); process.exit(0); };
@@ -678,23 +690,8 @@ function cmdStart(args) {
678
690
  process.on('SIGBREAK', naoAbsorver);
679
691
  }
680
692
 
681
- // Keep-alive (regra inviolável do AGENTS.md): mantém o event loop ativo
682
- // mesmo sem I/O de console (MobaXterm minimizado / sem stream ativo).
683
693
  setInterval(() => {}, 1000);
684
-
685
- // Terminal preso (regra inviolável do AGENTS.md) — SOLUÇÃO DEFINITIVA:
686
- // ao retomar a entrada padrão IMEDIATAMENTE antes das mensagens finais
687
- // de sucesso, o Node permanece vivo indefinidamente aguardando qualquer
688
- // digitação do usuário. O prompt do MobaXterm NUNCA é devolvido e a PTY
689
- // (e com ela o uvicorn) não é fechada. Esta linha NÃO depende de timers
690
- // nem de npx — NUNCA REMOVER.
691
694
  process.stdin.resume();
692
-
693
- // Rede de segurança (regra inviolável do AGENTS.md): se o event loop
694
- // esvaziar (stdin em EOF, timer perdido, qualquer surpresa do terminal/
695
- // PTY do MobaXterm), o Node re-ativa o keep-alive no 'beforeExit' em vez
696
- // de encerrar — o prompt NUNCA é devolvido e o uvicorn não fica órfão.
697
- // Erros no stream de stdin também nunca derrubam o launcher.
698
695
  process.stdin.on('error', () => {});
699
696
  process.on('beforeExit', () => {
700
697
  setInterval(() => {}, 1000);
@@ -708,6 +705,12 @@ function cmdStart(args) {
708
705
  ? 'ℹ Para encerrar: Ctrl+Break ou feche a janela (Ctrl+C é absorvido no Windows contra sinais espúrios do MobaXterm).'
709
706
  : 'ℹ Para encerrar: Ctrl+C.',
710
707
  );
708
+
709
+ // Congela o fluxo principal PARA SEMPRE (regra inviolável): a promessa
710
+ // nunca resolve, então nenhum código posterior pode rodar e nenhum exit
711
+ // "natural" acontece. A saída acontece somente pelo ciclo de vida do
712
+ // filho (Python morre) ou por SIGTERM/SIGBREAK — ambos com log.
713
+ await new Promise(() => {});
711
714
  })().catch((err) => {
712
715
  console.error('✗ Erro inesperado ao iniciar:', err && err.message ? err.message : err);
713
716
  process.exit(1);