@lynxflow/seo-engine 2.0.1 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -4,7 +4,7 @@ High-Performance Universal Programmatic SEO & Structured Data Engine for Modern
4
4
 
5
5
  [![TypeScript](https://img.shields.io/badge/TypeScript-Ready-blue.svg)](https://www.typescriptlang.org/)
6
6
  [![License](https://img.shields.io/badge/License-Proprietary-green.svg)](LICENSE)
7
- [![Version](https://img.shields.io/badge/Version-2.0.0-orange.svg)](https://www.npmjs.com/package/@lynxflow/seo-engine)
7
+ [![Version](https://img.shields.io/badge/Version-2.1.0-orange.svg)](https://www.npmjs.com/package/@lynxflow/seo-engine)
8
8
 
9
9
  ---
10
10
 
@@ -0,0 +1,70 @@
1
+ /**
2
+ * 📊 Page Generation & Multi-Cycle Regeneration Tracker
3
+ *
4
+ * Tracks:
5
+ * 1. Unique Live Programmatic Pages in Index
6
+ * 2. Total Generation Cycles (Initial Creation + 2x, 3x+ Re-Optimizations)
7
+ * 3. Execution Mode: 'standard' (Deterministic 0€, 0 Token) vs 'ai-enhanced' (LLM Custom Copy with Token Billing)
8
+ * 4. Market Demand Signals & Emerging Country Opportunities (e.g. Brazil, US, Spain)
9
+ */
10
+ export interface PageGenerationRecord {
11
+ urlPath: string;
12
+ service: string;
13
+ location: string;
14
+ country: string;
15
+ language: string;
16
+ generationCount: number;
17
+ mode: "standard" | "ai-enhanced";
18
+ tokensConsumed: number;
19
+ firstGeneratedAt: string;
20
+ lastGeneratedAt: string;
21
+ }
22
+ export interface MarketOpportunitySignal {
23
+ country: string;
24
+ countryCode: string;
25
+ detectedRequests: number;
26
+ activeIndexedPages: number;
27
+ coverageStatus: "optimal" | "underserved" | "opportunity_detected";
28
+ estimatedMonthlyTrafficUpside: number;
29
+ recommendation: string;
30
+ }
31
+ export interface GenerationMetricsReport {
32
+ uniquePagesCount: number;
33
+ totalGenerationCycles: number;
34
+ regenerationFrequency: {
35
+ singleGeneration: number;
36
+ doubleGeneration: number;
37
+ multiGeneration: number;
38
+ };
39
+ modeDistribution: {
40
+ standardDeterministicCount: number;
41
+ aiEnhancedCount: number;
42
+ };
43
+ totalAiTokensConsumed: number;
44
+ activeCountriesCount: number;
45
+ marketOpportunities: MarketOpportunitySignal[];
46
+ }
47
+ export declare class PageRegenerationTracker {
48
+ private records;
49
+ private demandSignals;
50
+ /**
51
+ * Records a page generation or regeneration event.
52
+ */
53
+ recordGeneration(params: {
54
+ urlPath: string;
55
+ service?: string;
56
+ location?: string;
57
+ country?: string;
58
+ language?: string;
59
+ mode?: "standard" | "ai-enhanced";
60
+ tokensConsumed?: number;
61
+ }): PageGenerationRecord;
62
+ /**
63
+ * Ingests external traffic or search demand signals (e.g. from Cloudflare / Nginx Edge / Google Search Console).
64
+ */
65
+ recordMarketDemand(country: string, requestVolume?: number): void;
66
+ /**
67
+ * Computes comprehensive analytics report for admin dashboards.
68
+ */
69
+ getMetricsReport(): GenerationMetricsReport;
70
+ }
package/dist/index.d.ts CHANGED
@@ -110,6 +110,7 @@ import { LynxRateLimitedTranslator } from "./rate-limited-translator";
110
110
  import { InternalPageRankEngine } from "./internal-pagerank-graph";
111
111
  import { GeoCitationScorer } from "./geo-citation-scorer";
112
112
  import { MarketingSkillsEngine } from "./marketing-skills-engine";
113
+ import { PageRegenerationTracker } from "./generation-tracker";
113
114
  export declare function createLynxSeoEngine(config: EngineConfig): LynxSeoEngine;
114
115
  export declare const LynxSeo: {
115
116
  createEngine: typeof createLynxSeoEngine;
@@ -157,7 +158,9 @@ export declare const LynxSeo: {
157
158
  pageRankGraph: typeof InternalPageRankEngine;
158
159
  geoCitation: typeof GeoCitationScorer;
159
160
  marketingSkills: typeof MarketingSkillsEngine;
161
+ regenerationTracker: typeof PageRegenerationTracker;
160
162
  };
163
+ export * from "./generation-tracker";
161
164
  export * from "./internal-pagerank-graph";
162
165
  export * from "./geo-citation-scorer";
163
166
  export * from "./marketing-skills-engine";
package/dist/index.js CHANGED
@@ -9457,6 +9457,114 @@ class MarketingSkillsEngine {
9457
9457
  }
9458
9458
  }
9459
9459
 
9460
+ // src/generation-tracker.ts
9461
+ class PageRegenerationTracker {
9462
+ records = new Map;
9463
+ demandSignals = new Map;
9464
+ recordGeneration(params) {
9465
+ const key = params.urlPath.trim().toLowerCase();
9466
+ const existing = this.records.get(key);
9467
+ const now = new Date().toISOString();
9468
+ const country = params.country || existing?.country || "United States";
9469
+ const language = params.language || existing?.language || "en";
9470
+ const service = params.service || existing?.service || "General Service";
9471
+ const location = params.location || existing?.location || "National";
9472
+ const mode = params.mode || "standard";
9473
+ const tokens = params.tokensConsumed || 0;
9474
+ if (existing) {
9475
+ existing.generationCount += 1;
9476
+ existing.mode = mode;
9477
+ existing.tokensConsumed += tokens;
9478
+ existing.lastGeneratedAt = now;
9479
+ this.records.set(key, existing);
9480
+ return existing;
9481
+ }
9482
+ const newRecord = {
9483
+ urlPath: key,
9484
+ service,
9485
+ location,
9486
+ country,
9487
+ language,
9488
+ generationCount: 1,
9489
+ mode,
9490
+ tokensConsumed: tokens,
9491
+ firstGeneratedAt: now,
9492
+ lastGeneratedAt: now
9493
+ };
9494
+ this.records.set(key, newRecord);
9495
+ const countryKey = country.toLowerCase();
9496
+ const currentSignal = this.demandSignals.get(countryKey) || { requests: 0, country };
9497
+ currentSignal.requests += 1;
9498
+ this.demandSignals.set(countryKey, currentSignal);
9499
+ return newRecord;
9500
+ }
9501
+ recordMarketDemand(country, requestVolume = 1) {
9502
+ const countryKey = country.trim().toLowerCase();
9503
+ const current = this.demandSignals.get(countryKey) || { requests: 0, country };
9504
+ current.requests += requestVolume;
9505
+ this.demandSignals.set(countryKey, current);
9506
+ }
9507
+ getMetricsReport() {
9508
+ let singleGen = 0;
9509
+ let doubleGen = 0;
9510
+ let multiGen = 0;
9511
+ let standardCount = 0;
9512
+ let aiCount = 0;
9513
+ let totalTokens = 0;
9514
+ const countriesSet = new Set;
9515
+ const countryPageCounts = new Map;
9516
+ for (const record of this.records.values()) {
9517
+ if (record.generationCount === 1)
9518
+ singleGen++;
9519
+ else if (record.generationCount === 2)
9520
+ doubleGen++;
9521
+ else
9522
+ multiGen++;
9523
+ if (record.mode === "ai-enhanced") {
9524
+ aiCount++;
9525
+ totalTokens += record.tokensConsumed;
9526
+ } else {
9527
+ standardCount++;
9528
+ }
9529
+ countriesSet.add(record.country);
9530
+ const cKey = record.country.toLowerCase();
9531
+ countryPageCounts.set(cKey, (countryPageCounts.get(cKey) || 0) + 1);
9532
+ }
9533
+ const marketOpportunities = [];
9534
+ for (const [countryKey, signal] of this.demandSignals.entries()) {
9535
+ const indexedPages = countryPageCounts.get(countryKey) || 0;
9536
+ const countryFormatted = signal.country.charAt(0).toUpperCase() + signal.country.slice(1);
9537
+ if (signal.requests > 100 && indexedPages < 20) {
9538
+ marketOpportunities.push({
9539
+ country: countryFormatted,
9540
+ countryCode: countryKey.slice(0, 2).toUpperCase(),
9541
+ detectedRequests: signal.requests,
9542
+ activeIndexedPages: indexedPages,
9543
+ coverageStatus: "opportunity_detected",
9544
+ estimatedMonthlyTrafficUpside: Math.round(signal.requests * 3.4),
9545
+ recommendation: `High demand detected in ${countryFormatted} (${signal.requests} hits). Upgrade to Pro Growth or activate ${countryFormatted} in SEO_CONFIG to capture +${Math.round(signal.requests * 3.4)} visits/month.`
9546
+ });
9547
+ }
9548
+ }
9549
+ return {
9550
+ uniquePagesCount: this.records.size,
9551
+ totalGenerationCycles: singleGen + doubleGen * 2 + multiGen * 3,
9552
+ regenerationFrequency: {
9553
+ singleGeneration: singleGen,
9554
+ doubleGeneration: doubleGen,
9555
+ multiGeneration: multiGen
9556
+ },
9557
+ modeDistribution: {
9558
+ standardDeterministicCount: standardCount,
9559
+ aiEnhancedCount: aiCount
9560
+ },
9561
+ totalAiTokensConsumed: totalTokens,
9562
+ activeCountriesCount: countriesSet.size,
9563
+ marketOpportunities
9564
+ };
9565
+ }
9566
+ }
9567
+
9460
9568
  // src/index.ts
9461
9569
  function createLynxSeoEngine(config) {
9462
9570
  return new LynxSeoEngine(config);
@@ -9506,7 +9614,8 @@ var LynxSeo = {
9506
9614
  translator: LynxRateLimitedTranslator,
9507
9615
  pageRankGraph: InternalPageRankEngine,
9508
9616
  geoCitation: GeoCitationScorer,
9509
- marketingSkills: MarketingSkillsEngine
9617
+ marketingSkills: MarketingSkillsEngine,
9618
+ regenerationTracker: PageRegenerationTracker
9510
9619
  };
9511
9620
  var src_default = LynxSeo;
9512
9621
  export {
@@ -9546,6 +9655,7 @@ export {
9546
9655
  PublicRoutesManifestEngine,
9547
9656
  PseoMatrixEngine,
9548
9657
  PowerWordsPsychologyEngine,
9658
+ PageRegenerationTracker,
9549
9659
  PSEO_AGENT_SYSTEM_PROMPT,
9550
9660
  OgImageGenerator,
9551
9661
  NGramDensityAnalyzer,
package/dist/index.mjs CHANGED
@@ -9457,6 +9457,114 @@ class MarketingSkillsEngine {
9457
9457
  }
9458
9458
  }
9459
9459
 
9460
+ // src/generation-tracker.ts
9461
+ class PageRegenerationTracker {
9462
+ records = new Map;
9463
+ demandSignals = new Map;
9464
+ recordGeneration(params) {
9465
+ const key = params.urlPath.trim().toLowerCase();
9466
+ const existing = this.records.get(key);
9467
+ const now = new Date().toISOString();
9468
+ const country = params.country || existing?.country || "United States";
9469
+ const language = params.language || existing?.language || "en";
9470
+ const service = params.service || existing?.service || "General Service";
9471
+ const location = params.location || existing?.location || "National";
9472
+ const mode = params.mode || "standard";
9473
+ const tokens = params.tokensConsumed || 0;
9474
+ if (existing) {
9475
+ existing.generationCount += 1;
9476
+ existing.mode = mode;
9477
+ existing.tokensConsumed += tokens;
9478
+ existing.lastGeneratedAt = now;
9479
+ this.records.set(key, existing);
9480
+ return existing;
9481
+ }
9482
+ const newRecord = {
9483
+ urlPath: key,
9484
+ service,
9485
+ location,
9486
+ country,
9487
+ language,
9488
+ generationCount: 1,
9489
+ mode,
9490
+ tokensConsumed: tokens,
9491
+ firstGeneratedAt: now,
9492
+ lastGeneratedAt: now
9493
+ };
9494
+ this.records.set(key, newRecord);
9495
+ const countryKey = country.toLowerCase();
9496
+ const currentSignal = this.demandSignals.get(countryKey) || { requests: 0, country };
9497
+ currentSignal.requests += 1;
9498
+ this.demandSignals.set(countryKey, currentSignal);
9499
+ return newRecord;
9500
+ }
9501
+ recordMarketDemand(country, requestVolume = 1) {
9502
+ const countryKey = country.trim().toLowerCase();
9503
+ const current = this.demandSignals.get(countryKey) || { requests: 0, country };
9504
+ current.requests += requestVolume;
9505
+ this.demandSignals.set(countryKey, current);
9506
+ }
9507
+ getMetricsReport() {
9508
+ let singleGen = 0;
9509
+ let doubleGen = 0;
9510
+ let multiGen = 0;
9511
+ let standardCount = 0;
9512
+ let aiCount = 0;
9513
+ let totalTokens = 0;
9514
+ const countriesSet = new Set;
9515
+ const countryPageCounts = new Map;
9516
+ for (const record of this.records.values()) {
9517
+ if (record.generationCount === 1)
9518
+ singleGen++;
9519
+ else if (record.generationCount === 2)
9520
+ doubleGen++;
9521
+ else
9522
+ multiGen++;
9523
+ if (record.mode === "ai-enhanced") {
9524
+ aiCount++;
9525
+ totalTokens += record.tokensConsumed;
9526
+ } else {
9527
+ standardCount++;
9528
+ }
9529
+ countriesSet.add(record.country);
9530
+ const cKey = record.country.toLowerCase();
9531
+ countryPageCounts.set(cKey, (countryPageCounts.get(cKey) || 0) + 1);
9532
+ }
9533
+ const marketOpportunities = [];
9534
+ for (const [countryKey, signal] of this.demandSignals.entries()) {
9535
+ const indexedPages = countryPageCounts.get(countryKey) || 0;
9536
+ const countryFormatted = signal.country.charAt(0).toUpperCase() + signal.country.slice(1);
9537
+ if (signal.requests > 100 && indexedPages < 20) {
9538
+ marketOpportunities.push({
9539
+ country: countryFormatted,
9540
+ countryCode: countryKey.slice(0, 2).toUpperCase(),
9541
+ detectedRequests: signal.requests,
9542
+ activeIndexedPages: indexedPages,
9543
+ coverageStatus: "opportunity_detected",
9544
+ estimatedMonthlyTrafficUpside: Math.round(signal.requests * 3.4),
9545
+ recommendation: `High demand detected in ${countryFormatted} (${signal.requests} hits). Upgrade to Pro Growth or activate ${countryFormatted} in SEO_CONFIG to capture +${Math.round(signal.requests * 3.4)} visits/month.`
9546
+ });
9547
+ }
9548
+ }
9549
+ return {
9550
+ uniquePagesCount: this.records.size,
9551
+ totalGenerationCycles: singleGen + doubleGen * 2 + multiGen * 3,
9552
+ regenerationFrequency: {
9553
+ singleGeneration: singleGen,
9554
+ doubleGeneration: doubleGen,
9555
+ multiGeneration: multiGen
9556
+ },
9557
+ modeDistribution: {
9558
+ standardDeterministicCount: standardCount,
9559
+ aiEnhancedCount: aiCount
9560
+ },
9561
+ totalAiTokensConsumed: totalTokens,
9562
+ activeCountriesCount: countriesSet.size,
9563
+ marketOpportunities
9564
+ };
9565
+ }
9566
+ }
9567
+
9460
9568
  // src/index.ts
9461
9569
  function createLynxSeoEngine(config) {
9462
9570
  return new LynxSeoEngine(config);
@@ -9506,7 +9614,8 @@ var LynxSeo = {
9506
9614
  translator: LynxRateLimitedTranslator,
9507
9615
  pageRankGraph: InternalPageRankEngine,
9508
9616
  geoCitation: GeoCitationScorer,
9509
- marketingSkills: MarketingSkillsEngine
9617
+ marketingSkills: MarketingSkillsEngine,
9618
+ regenerationTracker: PageRegenerationTracker
9510
9619
  };
9511
9620
  var src_default = LynxSeo;
9512
9621
  export {
@@ -9546,6 +9655,7 @@ export {
9546
9655
  PublicRoutesManifestEngine,
9547
9656
  PseoMatrixEngine,
9548
9657
  PowerWordsPsychologyEngine,
9658
+ PageRegenerationTracker,
9549
9659
  PSEO_AGENT_SYSTEM_PROMPT,
9550
9660
  OgImageGenerator,
9551
9661
  NGramDensityAnalyzer,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lynxflow/seo-engine",
3
- "version": "2.0.1",
3
+ "version": "2.1.0",
4
4
  "description": "High-Performance Universal Programmatic SEO & AI Search Engine SDK",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",