npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

cdp-edge

v2.6.1

Published

CDP Edge - Quantum Tracking - Sistema multi-agente para tracking digital Cloudflare Native (Workers + D1)

Readme

🚀 CDP Edge — Quantum Tracking Enterprise

Padrão Quantum Tracking: 100% Cloudflare Edge. Tracking server-side, first-party e orientado a performance.

v2.6.1 — Consolidação WhatsApp Agent (CTWA + Notificações + ZapMan SDR), correções deploy-client e npm audit 0 vulns (12 de Maio de 2026)


💻 INSTALAÇÃO

npx cdp-edge install
# ou
npm install -g cdp-edge
cdp-edge install . --name "Nome do Projeto"

🤖 MANIFESTO: EU, CDP EDGE

Eu não sou um simples "script de pixel". Eu sou uma arquitetura Enterprise Tier 10 nascida e construída 100% nativa na infraestrutura da Cloudflare.

Quando um evento de Lead bate no endpoint /track:

  1. Fraud Gate: Bloqueio bots silenciosamente antes de qualquer processamento (~2ms via KV)
  2. Quiz Scoring Engine: Classifico as respostas do quiz com Granite 4.0 Micro — comprador | interessado | curioso | perdido
  3. A/B LTV Testing: Sorteio de prompt via KV Cache em ~0ms
  4. LTV Predictor: Machine Learning para qualificar intenção e gerar valor preditivo em BRL
  5. Nurture Scheduler: Agendar sequência de follow-up baseada na qualificação (background)
  6. CAPI Dispatch: Meta/GA4/TikTok recebem payload limpo com LTV e intention injetados
  7. Sales Engine: Semanalmente, calculo ROAS real por campanha e atualizo o seed de Lookalike com compradores confirmados

🏗️ ARQUITETURA QUANTUM ENTERPRISE

POST /track (QuizComplete)
  │
  ├─ [1] 🛡️  Fraud Gate (KV blocklist + velocity) ~2ms
  ├─ [2] 🤖  Quiz Scoring Engine (Granite 4.0 Micro) → comprador/interessado/curioso/perdido
  ├─ [3] 🔮  A/B LTV Sorting (KV cache ~0ms)
  ├─ [4] 🧮  LTV Prediction (Granite 4.0 Micro) — intent qualificado → High LTV
  ├─ [5] 💾  D1 Writes background (quiz_sessions + leads + nurture_sequences)
  └─ [6] 📡  CAPI paralelo (Meta v25.0 + GA4 + TikTok v1.3)

Cron semanal (Intelligence Agent):
  ├─ ROAS Feedback — cruza leads × purchases por campanha → bid recommendation
  ├─ Nurture Queue — envia D+1/D+3/D+7 para leads qualificados
  ├─ Lookalike Seed — compradores confirmados → Meta Custom Audience
  ├─ LTV Model Training — regressão logística com dados reais
  └─ A/B LTV Auto-winner — declara vencedor quando amostra suficiente

📊 BANCO DE DADOS D1 — 31 Tabelas + 12 VIEWs

CORE TRACKING          ML & INTELLIGENCE         SALES ENGINE
──────────────         ─────────────────────     ──────────────────
leads                  ml_segments               roas_reports
events                 ml_segment_members        nurture_sequences
sessions               bid_recommendations       lookalike_seeds
webhook_events         ltv_ab_tests              quiz_sessions
api_failures           ltv_ab_variations
device_graph           ltv_ab_assignments
user_profiles          fraud_signals
intelligence_logs      fraud_alerts
messaging_history      match_quality_logs
automation_rules       utm_mappings
edge_fingerprints

VIEWS (12)
──────────────────────────────────────────────────────────────────
v_active_segments           v_active_bid_recs
v_ab_test_performance       v_fraud_dashboard
v_quiz_qualification_summary v_quiz_dimension_impact
v_roas_latest               v_nurture_pending
v_nurture_stats             v_quiz_session_summary
v_leads_segmented           v_ltv_feedback

🧠 CATÁLOGO DE MÓDULOS ML

| Módulo | Arquivo | Função | |---|---|---| | Quiz Scoring | modules/ml/quiz.ts | Análise dimensional automática das respostas | | LTV Prediction | modules/ml/ltv.ts | Score 0-100 + valor BRL via Granite + A/B test | | Fraud Gate | modules/ml/fraud.ts | Detecção de bots e fraude na borda | | ML Clustering | modules/ml/segmentation.ts | K-means vetorial com bge-m3 embeddings | | Bidding ML | modules/ml/bidding.ts | Recomendação de bid por segmento × plataforma | | ROAS Feedback | modules/ml/roas.ts | ROAS real por campanha, alimenta bidding | | Match Quality | modules/ml/matchquality.ts | Score de qualidade de dados para CAPI | | Logistic | modules/ml/logistic.ts | Regressão logística para LTV model treinável | | Nurture Engine | modules/nurture.ts | Sequências automáticas pós-qualificação |


🧠 CATÁLOGO DE AGENTES

| Categoria | Agente | Função | |---|---|---| | Orquestração | master-orchestrator.md | Coordena todo o setup | | Análise | page-analyzer.md | Detecta CTAs, forms e nicho | | Plataformas | meta-agent.md, google-agent.md, tiktok-agent.md... | Especialistas por plataforma | | Infra | server-tracking.md, devops-agent.md | Arquitetura Cloudflare | | Enterprise | ml-clustering-agent.md | Segmentação dinâmica ML | | Enterprise | bidding-agent.md | Bids ML por segmento | | Enterprise | ab-ltv-agent.md | A/B testing de prompts LTV | | Enterprise | fraud-detection-agent.md | Detecção de fraude na borda | | Infraestrutura | zapman-agent.md | Roteamento de leads p/ ZapMan SDR (Kanban + webhook IA) | | Monitoramento | intelligence-agent.md | Cron — ROAS, Nurture, Lookalike, LTV training |


📋 TODOS OS ENDPOINTS

Core

| Rota | Método | Função | |---|---|---| | /track | POST | Evento principal — Fraud Gate → Quiz Scoring → LTV → CAPI | | /health | GET | Liveness público mínimo | | /api/health | GET | Diagnóstico autenticado D1 + KV + AI + vars/secrets | | /webhook/ticto | POST | Purchase webhook (HMAC) | | /webhook/whatsapp | POST | Webhook Meta WhatsApp → ZapMan SDR | | /export/customer-match | GET | Export leads para Google Ads | | /validate-install | GET | Diagnostico pos-deploy autenticado |

Rotas administrativas (/api/* e /validate-install) exigem Authorization: Bearer <ADMIN_API_TOKEN>. Para o diagnostico via CLI:

wrangler secret put ADMIN_API_TOKEN
cdp-edge validate https://seu-dominio.com --admin-token "$ADMIN_API_TOKEN"

Estado atual da maquina - 10/05/2026

Esta build esta validada como pacote npm [email protected] e Worker Cloudflare Native.

O que ela faz hoje:

  • Recebe eventos no POST /track usando o endpoint canonico same-domain /track.
  • Deduplica event_id cedo, antes de enrichments caros e antes de dispatch externo.
  • Executa Fraud Gate antes do pipeline principal, com silent drop para bots/fraude.
  • Enriquece leads com perfil, UTMs, device graph, geo, quiz, LTV, match quality e sinais de funil.
  • Persiste eventos, leads, perfis, fingerprints, sinais de fraude, automacoes, webhooks, LTV e dados de inteligencia no D1.
  • Envia eventos server-side para Meta CAPI, GA4, TikTok e demais plataformas quando os secrets existem.
  • Processa webhooks de compra e WhatsApp, com HMAC em Ticto e assinatura Meta x-hub-signature-256 para WhatsApp quando META_APP_SECRET esta configurado.
  • Protege rotas administrativas /api/*, /api/health e /validate-install com Authorization: Bearer <ADMIN_API_TOKEN>.
  • Mantem /health publico como liveness minimo, sem expor bindings, vars ou secrets.
  • Gera SDK browser em dist/sdk/* durante npm run build e durante npm pack/prepare.
  • Empacota sem arquivos locais sensiveis: .client.env, .wrangler/ e dist-check/ ficam fora do tarball.

Validacao local desta finalizacao:

  • npm run build passou.
  • npm run typecheck passou.
  • npm run test:unit passou.
  • npm run test:integration passou: 5 arquivos, 85 testes.
  • npm run agents:check passou.
  • npm pack --dry-run passou: 175 arquivos, ~569.8 kB, sem publish.

ML Clustering (Fase 1)

| Rota | Método | Função | |---|---|---| | /api/segmentation/cluster | POST | K-means vetorial (bge-m3 + Granite) | | /api/segmentation/list | GET | Segmentos ativos | | /api/segmentation/outliers | GET | Outliers comportamentais | | /api/segmentation/update | PUT | Atualiza metadados |

Bidding (Fase 2)

| Rota | Método | Função | |---|---|---| | /api/bidding/recommend | POST | Bid por segmento × plataforma | | /api/bidding/history | GET | Histórico de recomendações | | /api/bidding/status | GET | Snapshot atual |

A/B LTV (Fase 3)

| Rota | Método | Função | |---|---|---| | /api/ltv/ab-test/create | POST | Cria experimento | | /api/ltv/ab-test/list | GET | Lista experimentos | | /api/ltv/ab-test/results | GET | Accuracy por variação | | /api/ltv/ab-test/winner | POST | Declara vencedor |

Fraud (Fase 4)

| Rota | Método | Função | |---|---|---| | /api/fraud/stats | GET | Dashboard 24h | | /api/fraud/alerts | GET | Log de sinais | | /api/fraud/blocklist | GET | IPs bloqueados | | /api/fraud/blocklist/add | POST | Bloquear | | /api/fraud/blocklist/remove | DELETE | Desbloquear |


🚀 DEPLOY COMPLETO

cd server-edge-tracker

# Schemas D1 (ordem correta — todos idempotentes)
wrangler d1 execute cdp-edge-db --file=schema.sql --remote
wrangler d1 execute cdp-edge-db --file=migrate-v6.sql --remote
wrangler d1 execute cdp-edge-db --file=schema-segmentation.sql --remote
wrangler d1 execute cdp-edge-db --file=schema-bidding.sql --remote
wrangler d1 execute cdp-edge-db --file=schema-ab-ltv.sql --remote
wrangler d1 execute cdp-edge-db --file=schema-fraud.sql --remote
wrangler d1 execute cdp-edge-db --file=schema-indexes.sql --remote
wrangler d1 execute cdp-edge-db --file=migrate-v7.sql --remote
wrangler d1 execute cdp-edge-db --file=schema-ltv-feedback.sql --remote
wrangler d1 execute cdp-edge-db --file=schema-utm.sql --remote
wrangler d1 execute cdp-edge-db --file=schema-quiz.sql --remote
wrangler d1 execute cdp-edge-db --file=schema-sales-engine.sql --remote

# Secrets (nunca em arquivos — sempre via wrangler secret put)
wrangler secret put META_ACCESS_TOKEN
wrangler secret put GA4_API_SECRET
wrangler secret put TIKTOK_ACCESS_TOKEN
wrangler secret put ZAPMAN_API_KEY

# Deploy
wrangler deploy

🗺️ GRAPHIFY — Navegando o Código

/graphify .                                          # gera o mapa
/graphify query "como funciona o quiz scoring?"      # exploração BFS
/graphify query "nurture engine → meta audience"     # exploração DFS
/graphify path "quiz_answers" "meta capi"            # menor caminho

Changelog completo → CHANGELOG.md


CDP Edge — By Rica Soares

"Dados sem inteligência são apenas ruído. No Quantum Tier Enterprise, transformamos dados em ROAS."

© 2026 CDP Edge Premium. Todos os direitos reservados.