lean-claudient-core 0.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/.reports/detailed-analysis_2026-06-20_01ed326b.html +200 -0
- package/.reports/detailed-analysis_2026-06-20_08d39381.html +200 -0
- package/.reports/detailed-analysis_2026-06-20_0a331144.html +200 -0
- package/.reports/detailed-analysis_2026-06-20_0d54ffef.html +200 -0
- package/.reports/detailed-analysis_2026-06-20_14bfa31c.html +200 -0
- package/.reports/detailed-analysis_2026-06-20_211feac4.html +200 -0
- package/.reports/detailed-analysis_2026-06-20_22381bc2.html +200 -0
- package/.reports/detailed-analysis_2026-06-20_29b4ea0a.html +200 -0
- package/.reports/detailed-analysis_2026-06-20_2df0ad14.html +200 -0
- package/.reports/detailed-analysis_2026-06-20_343ec84c.html +200 -0
- package/.reports/detailed-analysis_2026-06-20_3a01030d.html +200 -0
- package/.reports/detailed-analysis_2026-06-20_3b4c99ec.html +200 -0
- package/.reports/detailed-analysis_2026-06-20_3d368827.html +200 -0
- package/.reports/detailed-analysis_2026-06-20_53544d3d.html +200 -0
- package/.reports/detailed-analysis_2026-06-20_5721164a.html +200 -0
- package/.reports/detailed-analysis_2026-06-20_57caf5e7.html +200 -0
- package/.reports/detailed-analysis_2026-06-20_624302f5.html +200 -0
- package/.reports/detailed-analysis_2026-06-20_62456384.html +200 -0
- package/.reports/detailed-analysis_2026-06-20_636a52f1.html +200 -0
- package/.reports/detailed-analysis_2026-06-20_63d1ad41.html +200 -0
- package/.reports/detailed-analysis_2026-06-20_7451ccd7.html +200 -0
- package/.reports/detailed-analysis_2026-06-20_74da4e9a.html +200 -0
- package/.reports/detailed-analysis_2026-06-20_83a90083.html +200 -0
- package/.reports/detailed-analysis_2026-06-20_867fbdd9.html +200 -0
- package/.reports/detailed-analysis_2026-06-20_974c3299.html +200 -0
- package/.reports/detailed-analysis_2026-06-20_a04639a2.html +200 -0
- package/.reports/detailed-analysis_2026-06-20_a8e23d6d.html +200 -0
- package/.reports/detailed-analysis_2026-06-20_aa9150f0.html +200 -0
- package/.reports/detailed-analysis_2026-06-20_acbeee08.html +200 -0
- package/.reports/detailed-analysis_2026-06-20_c4ffa0e2.html +200 -0
- package/.reports/detailed-analysis_2026-06-20_c5f7684b.html +200 -0
- package/.reports/detailed-analysis_2026-06-20_c963b1fa.html +200 -0
- package/.reports/detailed-analysis_2026-06-20_d4bde41f.html +200 -0
- package/.reports/detailed-analysis_2026-06-20_d6eb2497.html +200 -0
- package/.reports/detailed-analysis_2026-06-20_ea6f7f58.html +200 -0
- package/.reports/detailed-analysis_2026-06-20_ebf4e060.html +200 -0
- package/.reports/detailed-analysis_2026-06-20_ec4313a9.html +200 -0
- package/.reports/detailed-analysis_2026-06-20_fc65d18e.html +200 -0
- package/.reports/executive-summary_2026-06-20_00406d50.html +109 -0
- package/.reports/executive-summary_2026-06-20_0bb202d3.html +109 -0
- package/.reports/executive-summary_2026-06-20_0bcd7481.html +109 -0
- package/.reports/executive-summary_2026-06-20_11506445.html +109 -0
- package/.reports/executive-summary_2026-06-20_13616cda.html +109 -0
- package/.reports/executive-summary_2026-06-20_19d41c2f.html +109 -0
- package/.reports/executive-summary_2026-06-20_1b0d6e96.html +109 -0
- package/.reports/executive-summary_2026-06-20_1e38670b.html +109 -0
- package/.reports/executive-summary_2026-06-20_1f32f793.html +109 -0
- package/.reports/executive-summary_2026-06-20_1f40f7d3.html +109 -0
- package/.reports/executive-summary_2026-06-20_25a40a7e.html +109 -0
- package/.reports/executive-summary_2026-06-20_26d11818.html +109 -0
- package/.reports/executive-summary_2026-06-20_26ed4593.html +109 -0
- package/.reports/executive-summary_2026-06-20_291b90a8.html +109 -0
- package/.reports/executive-summary_2026-06-20_2957a848.html +109 -0
- package/.reports/executive-summary_2026-06-20_2a04eb77.html +109 -0
- package/.reports/executive-summary_2026-06-20_2fa701f9.html +109 -0
- package/.reports/executive-summary_2026-06-20_327af8f5.html +109 -0
- package/.reports/executive-summary_2026-06-20_3418c729.html +109 -0
- package/.reports/executive-summary_2026-06-20_3571763d.html +109 -0
- package/.reports/executive-summary_2026-06-20_36225353.html +109 -0
- package/.reports/executive-summary_2026-06-20_3b2de891.html +109 -0
- package/.reports/executive-summary_2026-06-20_45b980c2.html +109 -0
- package/.reports/executive-summary_2026-06-20_46fcbf17.html +109 -0
- package/.reports/executive-summary_2026-06-20_48c8fa5e.html +109 -0
- package/.reports/executive-summary_2026-06-20_4ba55c43.html +109 -0
- package/.reports/executive-summary_2026-06-20_4f4498e6.html +109 -0
- package/.reports/executive-summary_2026-06-20_54c33bf0.html +109 -0
- package/.reports/executive-summary_2026-06-20_54cc7077.html +109 -0
- package/.reports/executive-summary_2026-06-20_5a12912e.html +109 -0
- package/.reports/executive-summary_2026-06-20_636fac87.html +109 -0
- package/.reports/executive-summary_2026-06-20_6587faaf.html +109 -0
- package/.reports/executive-summary_2026-06-20_6adbdd03.html +109 -0
- package/.reports/executive-summary_2026-06-20_6bf344ec.html +109 -0
- package/.reports/executive-summary_2026-06-20_7142aeed.html +109 -0
- package/.reports/executive-summary_2026-06-20_72bc0ceb.html +109 -0
- package/.reports/executive-summary_2026-06-20_775752ac.html +109 -0
- package/.reports/executive-summary_2026-06-20_7a9c3223.html +109 -0
- package/.reports/executive-summary_2026-06-20_808e6376.html +109 -0
- package/.reports/executive-summary_2026-06-20_8de9142d.html +109 -0
- package/.reports/executive-summary_2026-06-20_91981fbe.html +109 -0
- package/.reports/executive-summary_2026-06-20_93191c8c.html +109 -0
- package/.reports/executive-summary_2026-06-20_9be48a87.html +109 -0
- package/.reports/executive-summary_2026-06-20_9c127198.html +109 -0
- package/.reports/executive-summary_2026-06-20_9ee303ac.html +109 -0
- package/.reports/executive-summary_2026-06-20_9ee52709.html +109 -0
- package/.reports/executive-summary_2026-06-20_a0fa27de.html +109 -0
- package/.reports/executive-summary_2026-06-20_a1813e47.html +109 -0
- package/.reports/executive-summary_2026-06-20_a974edc1.html +109 -0
- package/.reports/executive-summary_2026-06-20_aa711737.html +109 -0
- package/.reports/executive-summary_2026-06-20_aa752246.html +109 -0
- package/.reports/executive-summary_2026-06-20_ac6f0927.html +109 -0
- package/.reports/executive-summary_2026-06-20_b231b143.html +109 -0
- package/.reports/executive-summary_2026-06-20_b570a2bd.html +109 -0
- package/.reports/executive-summary_2026-06-20_b6fbf650.html +109 -0
- package/.reports/executive-summary_2026-06-20_b9f8ddf3.html +109 -0
- package/.reports/executive-summary_2026-06-20_bf95cc63.html +109 -0
- package/.reports/executive-summary_2026-06-20_c0d0aefe.html +109 -0
- package/.reports/executive-summary_2026-06-20_c1933c36.html +109 -0
- package/.reports/executive-summary_2026-06-20_c99bba8a.html +109 -0
- package/.reports/executive-summary_2026-06-20_cc3846ac.html +109 -0
- package/.reports/executive-summary_2026-06-20_d485993c.html +109 -0
- package/.reports/executive-summary_2026-06-20_d56f75f7.html +109 -0
- package/.reports/executive-summary_2026-06-20_d57660cc.html +109 -0
- package/.reports/executive-summary_2026-06-20_dc036f62.html +109 -0
- package/.reports/executive-summary_2026-06-20_df783f47.html +109 -0
- package/.reports/executive-summary_2026-06-20_e2191adb.html +109 -0
- package/.reports/executive-summary_2026-06-20_e9f1d504.html +109 -0
- package/.reports/executive-summary_2026-06-20_ea82f5e1.html +109 -0
- package/.reports/executive-summary_2026-06-20_ec3e70cb.html +109 -0
- package/.reports/executive-summary_2026-06-20_ee6cf902.html +109 -0
- package/.reports/executive-summary_2026-06-20_f6cb657c.html +109 -0
- package/.reports/executive-summary_2026-06-20_f8c60046.html +109 -0
- package/.reports/executive-summary_2026-06-20_fa184840.html +109 -0
- package/.reports/executive-summary_2026-06-20_fc88bcb4.html +109 -0
- package/.reports/executive-summary_2026-06-20_ffa79c4e.html +109 -0
- package/README.md +53 -0
- package/dist/automation/actionApprover.d.ts +89 -0
- package/dist/automation/actionApprover.d.ts.map +1 -0
- package/dist/automation/actionApprover.js +264 -0
- package/dist/automation/actionApprover.js.map +1 -0
- package/dist/automation/actionExecutor.d.ts +125 -0
- package/dist/automation/actionExecutor.d.ts.map +1 -0
- package/dist/automation/actionExecutor.js +304 -0
- package/dist/automation/actionExecutor.js.map +1 -0
- package/dist/automation/alertRules.d.ts +55 -0
- package/dist/automation/alertRules.d.ts.map +1 -0
- package/dist/automation/alertRules.js +70 -0
- package/dist/automation/alertRules.js.map +1 -0
- package/dist/automation/alertSystem.d.ts +109 -0
- package/dist/automation/alertSystem.d.ts.map +1 -0
- package/dist/automation/alertSystem.js +303 -0
- package/dist/automation/alertSystem.js.map +1 -0
- package/dist/automation/competitorResponse.d.ts +119 -0
- package/dist/automation/competitorResponse.d.ts.map +1 -0
- package/dist/automation/competitorResponse.js +343 -0
- package/dist/automation/competitorResponse.js.map +1 -0
- package/dist/automation/composioClient.d.ts +107 -0
- package/dist/automation/composioClient.d.ts.map +1 -0
- package/dist/automation/composioClient.js +286 -0
- package/dist/automation/composioClient.js.map +1 -0
- package/dist/automation/crmExport.d.ts +116 -0
- package/dist/automation/crmExport.d.ts.map +1 -0
- package/dist/automation/crmExport.js +282 -0
- package/dist/automation/crmExport.js.map +1 -0
- package/dist/automation/crmIntegration.d.ts +83 -0
- package/dist/automation/crmIntegration.d.ts.map +1 -0
- package/dist/automation/crmIntegration.js +207 -0
- package/dist/automation/crmIntegration.js.map +1 -0
- package/dist/automation/gmailIntegration.d.ts +73 -0
- package/dist/automation/gmailIntegration.d.ts.map +1 -0
- package/dist/automation/gmailIntegration.js +184 -0
- package/dist/automation/gmailIntegration.js.map +1 -0
- package/dist/automation/index.d.ts +17 -0
- package/dist/automation/index.d.ts.map +1 -0
- package/dist/automation/index.js +17 -0
- package/dist/automation/index.js.map +1 -0
- package/dist/automation/jiraIntegration.d.ts +103 -0
- package/dist/automation/jiraIntegration.d.ts.map +1 -0
- package/dist/automation/jiraIntegration.js +222 -0
- package/dist/automation/jiraIntegration.js.map +1 -0
- package/dist/automation/jobQueue.d.ts +98 -0
- package/dist/automation/jobQueue.d.ts.map +1 -0
- package/dist/automation/jobQueue.js +207 -0
- package/dist/automation/jobQueue.js.map +1 -0
- package/dist/automation/leadQualification.d.ts +60 -0
- package/dist/automation/leadQualification.d.ts.map +1 -0
- package/dist/automation/leadQualification.js +204 -0
- package/dist/automation/leadQualification.js.map +1 -0
- package/dist/automation/qualificationRules.d.ts +100 -0
- package/dist/automation/qualificationRules.d.ts.map +1 -0
- package/dist/automation/qualificationRules.js +202 -0
- package/dist/automation/qualificationRules.js.map +1 -0
- package/dist/automation/responseTemplates.d.ts +64 -0
- package/dist/automation/responseTemplates.d.ts.map +1 -0
- package/dist/automation/responseTemplates.js +374 -0
- package/dist/automation/responseTemplates.js.map +1 -0
- package/dist/automation/scheduler.d.ts +85 -0
- package/dist/automation/scheduler.d.ts.map +1 -0
- package/dist/automation/scheduler.js +194 -0
- package/dist/automation/scheduler.js.map +1 -0
- package/dist/automation/types.d.ts +223 -0
- package/dist/automation/types.d.ts.map +1 -0
- package/dist/automation/types.js +32 -0
- package/dist/automation/types.js.map +1 -0
- package/dist/cli/index.d.ts +3 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +575 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/compression/caveman.d.ts +14 -0
- package/dist/compression/caveman.d.ts.map +1 -0
- package/dist/compression/caveman.js +188 -0
- package/dist/compression/caveman.js.map +1 -0
- package/dist/compression/caveman.test.d.ts +2 -0
- package/dist/compression/caveman.test.d.ts.map +1 -0
- package/dist/compression/caveman.test.js.map +1 -0
- package/dist/config/configManager.d.ts +6 -0
- package/dist/config/configManager.d.ts.map +1 -0
- package/dist/config/configManager.js +62 -0
- package/dist/config/configManager.js.map +1 -0
- package/dist/config/schema.d.ts +95 -0
- package/dist/config/schema.d.ts.map +1 -0
- package/dist/config/schema.js +19 -0
- package/dist/config/schema.js.map +1 -0
- package/dist/context/autoCompact.d.ts +19 -0
- package/dist/context/autoCompact.d.ts.map +1 -0
- package/dist/context/autoCompact.js +101 -0
- package/dist/context/autoCompact.js.map +1 -0
- package/dist/context/readDedup.d.ts +21 -0
- package/dist/context/readDedup.d.ts.map +1 -0
- package/dist/context/readDedup.js +55 -0
- package/dist/context/readDedup.js.map +1 -0
- package/dist/context/toolBudgets.d.ts +15 -0
- package/dist/context/toolBudgets.d.ts.map +1 -0
- package/dist/context/toolBudgets.js +35 -0
- package/dist/context/toolBudgets.js.map +1 -0
- package/dist/core/auditLogger.d.ts +30 -0
- package/dist/core/auditLogger.d.ts.map +1 -0
- package/dist/core/auditLogger.js +51 -0
- package/dist/core/auditLogger.js.map +1 -0
- package/dist/core/stateManager.d.ts +10 -0
- package/dist/core/stateManager.d.ts.map +1 -0
- package/dist/core/stateManager.js +59 -0
- package/dist/core/stateManager.js.map +1 -0
- package/dist/database/feedbackSchema.d.ts +80 -0
- package/dist/database/feedbackSchema.d.ts.map +1 -0
- package/dist/database/feedbackSchema.js +94 -0
- package/dist/database/feedbackSchema.js.map +1 -0
- package/dist/database/leadsSchema.d.ts +99 -0
- package/dist/database/leadsSchema.d.ts.map +1 -0
- package/dist/database/leadsSchema.js +136 -0
- package/dist/database/leadsSchema.js.map +1 -0
- package/dist/intelligence/competitorScoring.d.ts +25 -0
- package/dist/intelligence/competitorScoring.d.ts.map +1 -0
- package/dist/intelligence/competitorScoring.js +181 -0
- package/dist/intelligence/competitorScoring.js.map +1 -0
- package/dist/intelligence/competitorTracker.d.ts +36 -0
- package/dist/intelligence/competitorTracker.d.ts.map +1 -0
- package/dist/intelligence/competitorTracker.js +286 -0
- package/dist/intelligence/competitorTracker.js.map +1 -0
- package/dist/intelligence/competitorTypes.d.ts +93 -0
- package/dist/intelligence/competitorTypes.d.ts.map +1 -0
- package/dist/intelligence/competitorTypes.js +6 -0
- package/dist/intelligence/competitorTypes.js.map +1 -0
- package/dist/intelligence/competitors.json +76 -0
- package/dist/intelligence/feedbackLoop.d.ts +118 -0
- package/dist/intelligence/feedbackLoop.d.ts.map +1 -0
- package/dist/intelligence/feedbackLoop.js +368 -0
- package/dist/intelligence/feedbackLoop.js.map +1 -0
- package/dist/intelligence/gitHubTracker.d.ts +14 -0
- package/dist/intelligence/gitHubTracker.d.ts.map +1 -0
- package/dist/intelligence/gitHubTracker.js +153 -0
- package/dist/intelligence/gitHubTracker.js.map +1 -0
- package/dist/intelligence/hackerNewsScanner.d.ts +21 -0
- package/dist/intelligence/hackerNewsScanner.d.ts.map +1 -0
- package/dist/intelligence/hackerNewsScanner.js +88 -0
- package/dist/intelligence/hackerNewsScanner.js.map +1 -0
- package/dist/intelligence/hiringSignals.d.ts +16 -0
- package/dist/intelligence/hiringSignals.d.ts.map +1 -0
- package/dist/intelligence/hiringSignals.js +132 -0
- package/dist/intelligence/hiringSignals.js.map +1 -0
- package/dist/intelligence/index.d.ts +9 -0
- package/dist/intelligence/index.d.ts.map +1 -0
- package/dist/intelligence/index.js +9 -0
- package/dist/intelligence/index.js.map +1 -0
- package/dist/intelligence/leadEnrichment.d.ts +59 -0
- package/dist/intelligence/leadEnrichment.d.ts.map +1 -0
- package/dist/intelligence/leadEnrichment.js +209 -0
- package/dist/intelligence/leadEnrichment.js.map +1 -0
- package/dist/intelligence/leadEnrichmentTypes.d.ts +49 -0
- package/dist/intelligence/leadEnrichmentTypes.d.ts.map +1 -0
- package/dist/intelligence/leadEnrichmentTypes.js +7 -0
- package/dist/intelligence/leadEnrichmentTypes.js.map +1 -0
- package/dist/intelligence/marketScanner.d.ts +18 -0
- package/dist/intelligence/marketScanner.d.ts.map +1 -0
- package/dist/intelligence/marketScanner.js +225 -0
- package/dist/intelligence/marketScanner.js.map +1 -0
- package/dist/intelligence/polymarketScanner.d.ts +20 -0
- package/dist/intelligence/polymarketScanner.d.ts.map +1 -0
- package/dist/intelligence/polymarketScanner.js +88 -0
- package/dist/intelligence/polymarketScanner.js.map +1 -0
- package/dist/intelligence/redditScanner.d.ts +22 -0
- package/dist/intelligence/redditScanner.d.ts.map +1 -0
- package/dist/intelligence/redditScanner.js +89 -0
- package/dist/intelligence/redditScanner.js.map +1 -0
- package/dist/intelligence/signalAggregator.d.ts +10 -0
- package/dist/intelligence/signalAggregator.d.ts.map +1 -0
- package/dist/intelligence/signalAggregator.js +64 -0
- package/dist/intelligence/signalAggregator.js.map +1 -0
- package/dist/intelligence/trendAnalysis.d.ts +13 -0
- package/dist/intelligence/trendAnalysis.d.ts.map +1 -0
- package/dist/intelligence/trendAnalysis.js +106 -0
- package/dist/intelligence/trendAnalysis.js.map +1 -0
- package/dist/intelligence/twitterScanner.d.ts +22 -0
- package/dist/intelligence/twitterScanner.d.ts.map +1 -0
- package/dist/intelligence/twitterScanner.js +63 -0
- package/dist/intelligence/twitterScanner.js.map +1 -0
- package/dist/intelligence/types.d.ts +566 -0
- package/dist/intelligence/types.d.ts.map +1 -0
- package/dist/intelligence/types.js +87 -0
- package/dist/intelligence/types.js.map +1 -0
- package/dist/intelligence/userComplaints.d.ts +15 -0
- package/dist/intelligence/userComplaints.d.ts.map +1 -0
- package/dist/intelligence/userComplaints.js +193 -0
- package/dist/intelligence/userComplaints.js.map +1 -0
- package/dist/metrics/businessMetrics.d.ts +41 -0
- package/dist/metrics/businessMetrics.d.ts.map +1 -0
- package/dist/metrics/businessMetrics.js +120 -0
- package/dist/metrics/businessMetrics.js.map +1 -0
- package/dist/metrics/businessMetrics.test.d.ts +2 -0
- package/dist/metrics/businessMetrics.test.d.ts.map +1 -0
- package/dist/metrics/businessMetrics.test.js.map +1 -0
- package/dist/metrics/businessMetricsAgg.d.ts +85 -0
- package/dist/metrics/businessMetricsAgg.d.ts.map +1 -0
- package/dist/metrics/businessMetricsAgg.js +406 -0
- package/dist/metrics/businessMetricsAgg.js.map +1 -0
- package/dist/metrics/competitorMetrics.d.ts +57 -0
- package/dist/metrics/competitorMetrics.d.ts.map +1 -0
- package/dist/metrics/competitorMetrics.js +94 -0
- package/dist/metrics/competitorMetrics.js.map +1 -0
- package/dist/metrics/dashboardGenerator.d.ts +16 -0
- package/dist/metrics/dashboardGenerator.d.ts.map +1 -0
- package/dist/metrics/dashboardGenerator.js +313 -0
- package/dist/metrics/dashboardGenerator.js.map +1 -0
- package/dist/metrics/dashboardHTML.d.ts +18 -0
- package/dist/metrics/dashboardHTML.d.ts.map +1 -0
- package/dist/metrics/dashboardHTML.js +613 -0
- package/dist/metrics/dashboardHTML.js.map +1 -0
- package/dist/metrics/grafanaExport.d.ts +53 -0
- package/dist/metrics/grafanaExport.d.ts.map +1 -0
- package/dist/metrics/grafanaExport.js +277 -0
- package/dist/metrics/grafanaExport.js.map +1 -0
- package/dist/metrics/index.d.ts +17 -0
- package/dist/metrics/index.d.ts.map +1 -0
- package/dist/metrics/index.js +17 -0
- package/dist/metrics/index.js.map +1 -0
- package/dist/metrics/leadsMetrics.d.ts +48 -0
- package/dist/metrics/leadsMetrics.d.ts.map +1 -0
- package/dist/metrics/leadsMetrics.js +82 -0
- package/dist/metrics/leadsMetrics.js.map +1 -0
- package/dist/metrics/leadsMetrics.test.d.ts +2 -0
- package/dist/metrics/leadsMetrics.test.d.ts.map +1 -0
- package/dist/metrics/leadsMetrics.test.js.map +1 -0
- package/dist/metrics/metricsTypes.d.ts +114 -0
- package/dist/metrics/metricsTypes.d.ts.map +1 -0
- package/dist/metrics/metricsTypes.js +7 -0
- package/dist/metrics/metricsTypes.js.map +1 -0
- package/dist/metrics/revenueProjection.d.ts +44 -0
- package/dist/metrics/revenueProjection.d.ts.map +1 -0
- package/dist/metrics/revenueProjection.js +239 -0
- package/dist/metrics/revenueProjection.js.map +1 -0
- package/dist/metrics/revenueTypes.d.ts +62 -0
- package/dist/metrics/revenueTypes.d.ts.map +1 -0
- package/dist/metrics/revenueTypes.js +7 -0
- package/dist/metrics/revenueTypes.js.map +1 -0
- package/dist/metrics/roiCalculator.d.ts +39 -0
- package/dist/metrics/roiCalculator.d.ts.map +1 -0
- package/dist/metrics/roiCalculator.js +128 -0
- package/dist/metrics/roiCalculator.js.map +1 -0
- package/dist/metrics/roiCalculator.test.d.ts +2 -0
- package/dist/metrics/roiCalculator.test.d.ts.map +1 -0
- package/dist/metrics/roiCalculator.test.js.map +1 -0
- package/dist/metrics/trendMetrics.d.ts +51 -0
- package/dist/metrics/trendMetrics.d.ts.map +1 -0
- package/dist/metrics/trendMetrics.js +116 -0
- package/dist/metrics/trendMetrics.js.map +1 -0
- package/dist/modes/conservativeCTOMode.d.ts +32 -0
- package/dist/modes/conservativeCTOMode.d.ts.map +1 -0
- package/dist/modes/conservativeCTOMode.js +98 -0
- package/dist/modes/conservativeCTOMode.js.map +1 -0
- package/dist/modes/index.d.ts +3 -0
- package/dist/modes/index.d.ts.map +1 -0
- package/dist/modes/index.js +3 -0
- package/dist/modes/index.js.map +1 -0
- package/dist/modes/seniorDeveloperMode.d.ts +17 -0
- package/dist/modes/seniorDeveloperMode.d.ts.map +1 -0
- package/dist/modes/seniorDeveloperMode.js +77 -0
- package/dist/modes/seniorDeveloperMode.js.map +1 -0
- package/dist/recovery/contextRecovery.d.ts +28 -0
- package/dist/recovery/contextRecovery.d.ts.map +1 -0
- package/dist/recovery/contextRecovery.js +113 -0
- package/dist/recovery/contextRecovery.js.map +1 -0
- package/dist/repair/errorDiagnostics.d.ts +28 -0
- package/dist/repair/errorDiagnostics.d.ts.map +1 -0
- package/dist/repair/errorDiagnostics.js +158 -0
- package/dist/repair/errorDiagnostics.js.map +1 -0
- package/dist/repair/skillCapture.d.ts +22 -0
- package/dist/repair/skillCapture.d.ts.map +1 -0
- package/dist/repair/skillCapture.js +119 -0
- package/dist/repair/skillCapture.js.map +1 -0
- package/dist/reporting/reportGenerator.d.ts +117 -0
- package/dist/reporting/reportGenerator.d.ts.map +1 -0
- package/dist/reporting/reportGenerator.js +613 -0
- package/dist/reporting/reportGenerator.js.map +1 -0
- package/dist/reporting/templates.d.ts +68 -0
- package/dist/reporting/templates.d.ts.map +1 -0
- package/dist/reporting/templates.js +629 -0
- package/dist/reporting/templates.js.map +1 -0
- package/dist/security/owaspScanner.d.ts +74 -0
- package/dist/security/owaspScanner.d.ts.map +1 -0
- package/dist/security/owaspScanner.js +309 -0
- package/dist/security/owaspScanner.js.map +1 -0
- package/dist/security/piiRedaction.d.ts +67 -0
- package/dist/security/piiRedaction.d.ts.map +1 -0
- package/dist/security/piiRedaction.js +189 -0
- package/dist/security/piiRedaction.js.map +1 -0
- package/dist/security/secretsDetection.d.ts +47 -0
- package/dist/security/secretsDetection.d.ts.map +1 -0
- package/dist/security/secretsDetection.js +272 -0
- package/dist/security/secretsDetection.js.map +1 -0
- package/dist/subagents/builder.d.ts +33 -0
- package/dist/subagents/builder.d.ts.map +1 -0
- package/dist/subagents/builder.js +158 -0
- package/dist/subagents/builder.js.map +1 -0
- package/dist/subagents/investigator.d.ts +31 -0
- package/dist/subagents/investigator.d.ts.map +1 -0
- package/dist/subagents/investigator.js +166 -0
- package/dist/subagents/investigator.js.map +1 -0
- package/dist/subagents/orchestrator.d.ts +48 -0
- package/dist/subagents/orchestrator.d.ts.map +1 -0
- package/dist/subagents/orchestrator.js +151 -0
- package/dist/subagents/orchestrator.js.map +1 -0
- package/dist/subagents/reviewer.d.ts +31 -0
- package/dist/subagents/reviewer.d.ts.map +1 -0
- package/dist/subagents/reviewer.js +154 -0
- package/dist/subagents/reviewer.js.map +1 -0
- package/dist/telemetry/tokenCounter.d.ts +21 -0
- package/dist/telemetry/tokenCounter.d.ts.map +1 -0
- package/dist/telemetry/tokenCounter.js +49 -0
- package/dist/telemetry/tokenCounter.js.map +1 -0
- package/package.json +61 -0
- package/src/automation/actionApprover.ts +342 -0
- package/src/automation/actionExecutor.ts +399 -0
- package/src/automation/alertRules.ts +113 -0
- package/src/automation/alertSystem.ts +402 -0
- package/src/automation/competitorResponse.ts +511 -0
- package/src/automation/composioClient.ts +360 -0
- package/src/automation/crmExport.ts +407 -0
- package/src/automation/crmIntegration.ts +268 -0
- package/src/automation/gmailIntegration.ts +244 -0
- package/src/automation/index.ts +17 -0
- package/src/automation/jiraIntegration.ts +310 -0
- package/src/automation/jobQueue.ts +278 -0
- package/src/automation/leadQualification.ts +270 -0
- package/src/automation/qualificationRules.ts +304 -0
- package/src/automation/responseTemplates.ts +419 -0
- package/src/automation/scheduler.ts +254 -0
- package/src/automation/types.ts +270 -0
- package/src/cli/index.ts +646 -0
- package/src/compression/caveman.ts +257 -0
- package/src/config/configManager.ts +63 -0
- package/src/config/schema.ts +27 -0
- package/src/context/autoCompact.ts +123 -0
- package/src/context/readDedup.ts +84 -0
- package/src/context/toolBudgets.ts +43 -0
- package/src/core/auditLogger.ts +69 -0
- package/src/core/stateManager.ts +73 -0
- package/src/database/feedbackSchema.ts +168 -0
- package/src/database/leadsSchema.ts +205 -0
- package/src/intelligence/competitorScoring.ts +292 -0
- package/src/intelligence/competitorTracker.ts +362 -0
- package/src/intelligence/competitorTypes.ts +100 -0
- package/src/intelligence/competitors.json +76 -0
- package/src/intelligence/feedbackLoop.ts +538 -0
- package/src/intelligence/gitHubTracker.ts +204 -0
- package/src/intelligence/hackerNewsScanner.ts +121 -0
- package/src/intelligence/hiringSignals.ts +162 -0
- package/src/intelligence/index.ts +9 -0
- package/src/intelligence/leadEnrichment.ts +275 -0
- package/src/intelligence/leadEnrichmentTypes.ts +54 -0
- package/src/intelligence/marketScanner.ts +285 -0
- package/src/intelligence/polymarketScanner.ts +120 -0
- package/src/intelligence/redditScanner.ts +122 -0
- package/src/intelligence/signalAggregator.ts +94 -0
- package/src/intelligence/trendAnalysis.ts +140 -0
- package/src/intelligence/twitterScanner.ts +94 -0
- package/src/intelligence/types.ts +130 -0
- package/src/intelligence/userComplaints.ts +236 -0
- package/src/metrics/businessMetrics.ts +186 -0
- package/src/metrics/businessMetricsAgg.ts +554 -0
- package/src/metrics/competitorMetrics.ts +175 -0
- package/src/metrics/dashboardGenerator.ts +335 -0
- package/src/metrics/dashboardHTML.ts +637 -0
- package/src/metrics/grafanaExport.ts +347 -0
- package/src/metrics/index.ts +17 -0
- package/src/metrics/leadsMetrics.ts +145 -0
- package/src/metrics/metricsTypes.ts +129 -0
- package/src/metrics/revenueProjection.ts +319 -0
- package/src/metrics/revenueTypes.ts +67 -0
- package/src/metrics/roiCalculator.ts +199 -0
- package/src/metrics/trendMetrics.ts +190 -0
- package/src/modes/conservativeCTOMode.ts +124 -0
- package/src/modes/index.ts +6 -0
- package/src/modes/seniorDeveloperMode.ts +94 -0
- package/src/recovery/contextRecovery.ts +141 -0
- package/src/repair/errorDiagnostics.ts +198 -0
- package/src/repair/skillCapture.ts +157 -0
- package/src/reporting/reportGenerator.ts +802 -0
- package/src/reporting/templates.ts +677 -0
- package/src/security/owaspScanner.ts +390 -0
- package/src/security/phase8Hardening.ts +536 -0
- package/src/security/piiRedaction.ts +215 -0
- package/src/security/secretsDetection.js +271 -0
- package/src/security/secretsDetection.ts +318 -0
- package/src/subagents/builder.ts +277 -0
- package/src/subagents/investigator.ts +224 -0
- package/src/subagents/orchestrator.ts +212 -0
- package/src/subagents/reviewer.ts +215 -0
- package/src/telemetry/tokenCounter.ts +81 -0
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lead Enrichment Pipeline
|
|
3
|
+
* Synthesizes market signals and competitor threats into enriched lead objects
|
|
4
|
+
* Phase 8A Task 1
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { z } from 'zod';
|
|
8
|
+
import { Lead, Signal, SIGNAL_TYPES } from '../database/leadsSchema.js';
|
|
9
|
+
import { TrendResult, ScanResult } from './marketScanner.js';
|
|
10
|
+
import { CompetitorIntelligence, CompetitorThreat } from './competitorTypes.js';
|
|
11
|
+
import {
|
|
12
|
+
EnrichedLead,
|
|
13
|
+
LeadSignal,
|
|
14
|
+
ThreatContext,
|
|
15
|
+
EnrichmentConfig,
|
|
16
|
+
} from './leadEnrichmentTypes.js';
|
|
17
|
+
|
|
18
|
+
const ENRICHMENT_VERSION = '1.0.0';
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Validation schemas
|
|
22
|
+
*/
|
|
23
|
+
const LeadSignalSchema = z.object({
|
|
24
|
+
signalId: z.string().min(1),
|
|
25
|
+
trend: z.string().min(1),
|
|
26
|
+
relevanceScore: z.number().min(0).max(100),
|
|
27
|
+
source: z.enum(['reddit', 'hackernews', 'twitter', 'polymarket']),
|
|
28
|
+
strength: z.number().min(0).max(1),
|
|
29
|
+
tags: z.array(z.string()),
|
|
30
|
+
matchedAt: z.string().datetime(),
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
const ThreatContextSchema = z.object({
|
|
34
|
+
competitorId: z.string().min(1),
|
|
35
|
+
competitorName: z.string().min(1),
|
|
36
|
+
threatScore: z.number().min(0).max(100),
|
|
37
|
+
threatLevel: z.enum(['CRITICAL', 'HIGH', 'MEDIUM', 'LOW']),
|
|
38
|
+
keyStrengths: z.array(z.string()),
|
|
39
|
+
keyWeaknesses: z.array(z.string()),
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
const EnrichedLeadSchema = z.object({
|
|
43
|
+
id: z.string(),
|
|
44
|
+
name: z.string(),
|
|
45
|
+
email: z.string().email(),
|
|
46
|
+
company: z.string().optional(),
|
|
47
|
+
industry: z.string().optional(),
|
|
48
|
+
pain_point: z.string().optional(),
|
|
49
|
+
source: z.string(),
|
|
50
|
+
score: z.number(),
|
|
51
|
+
status: z.enum(['new', 'contacted', 'qualified', 'converted', 'rejected']),
|
|
52
|
+
created_at: z.string().datetime(),
|
|
53
|
+
updated_at: z.string().datetime(),
|
|
54
|
+
marketSignals: z.array(LeadSignalSchema),
|
|
55
|
+
competitorThreat: ThreatContextSchema.optional(),
|
|
56
|
+
signalCount: z.number().min(0).max(10),
|
|
57
|
+
threatLevel: z.enum(['CRITICAL', 'HIGH', 'MEDIUM', 'LOW', 'NONE']),
|
|
58
|
+
enrichedAt: z.string().datetime(),
|
|
59
|
+
enrichmentVersion: z.string(),
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Lead Enricher class
|
|
64
|
+
*/
|
|
65
|
+
export class LeadEnricher {
|
|
66
|
+
private config: EnrichmentConfig;
|
|
67
|
+
private competitorMap: Map<string, CompetitorThreat> = new Map();
|
|
68
|
+
|
|
69
|
+
constructor(config: EnrichmentConfig = {}) {
|
|
70
|
+
this.config = {
|
|
71
|
+
minRelevanceScore: config.minRelevanceScore ?? 60,
|
|
72
|
+
maxSignalsPerLead: config.maxSignalsPerLead ?? 10,
|
|
73
|
+
includeThreatContext: config.includeThreatContext ?? true,
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Load competitor threat data for lookup
|
|
79
|
+
*/
|
|
80
|
+
loadCompetitorData(competitorIntelligence: CompetitorIntelligence[]): void {
|
|
81
|
+
competitorIntelligence.forEach((intel) => {
|
|
82
|
+
this.competitorMap.set(intel.competitor_id, intel.threat_assessment);
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Enrich a single lead with market signals and threat context
|
|
88
|
+
*/
|
|
89
|
+
enrichLead(
|
|
90
|
+
lead: Lead,
|
|
91
|
+
marketSignals: TrendResult[],
|
|
92
|
+
competitorThreats?: CompetitorThreat[]
|
|
93
|
+
): EnrichedLead {
|
|
94
|
+
const enrichedAt = new Date().toISOString();
|
|
95
|
+
|
|
96
|
+
// Match market signals to lead
|
|
97
|
+
const matchedSignals = this.matchSignalsToLead(lead, marketSignals);
|
|
98
|
+
const filteredSignals = matchedSignals
|
|
99
|
+
.filter((s) => s.relevanceScore >= (this.config.minRelevanceScore ?? 60))
|
|
100
|
+
.slice(0, this.config.maxSignalsPerLead);
|
|
101
|
+
|
|
102
|
+
// Find closest competitor threat
|
|
103
|
+
const threat = this.findClosestThreat(lead, competitorThreats);
|
|
104
|
+
const threatLevel = this.deriveTheatLevel(threat);
|
|
105
|
+
|
|
106
|
+
// Build enriched lead
|
|
107
|
+
const enrichedLead: EnrichedLead = {
|
|
108
|
+
...lead,
|
|
109
|
+
marketSignals: filteredSignals,
|
|
110
|
+
competitorThreat: threat,
|
|
111
|
+
signalCount: filteredSignals.length,
|
|
112
|
+
threatLevel,
|
|
113
|
+
enrichedAt,
|
|
114
|
+
enrichmentVersion: ENRICHMENT_VERSION,
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
// Validate output
|
|
118
|
+
try {
|
|
119
|
+
EnrichedLeadSchema.parse(enrichedLead);
|
|
120
|
+
} catch (error) {
|
|
121
|
+
throw new Error(`Enrichment validation failed for lead ${lead.id}: ${error}`);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
return enrichedLead;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Enrich multiple leads in batch
|
|
129
|
+
*/
|
|
130
|
+
enrichLeads(
|
|
131
|
+
leads: Lead[],
|
|
132
|
+
marketSignals: TrendResult[],
|
|
133
|
+
competitorThreats?: CompetitorThreat[]
|
|
134
|
+
): EnrichedLead[] {
|
|
135
|
+
return leads.map((lead) =>
|
|
136
|
+
this.enrichLead(lead, marketSignals, competitorThreats)
|
|
137
|
+
);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Match market signals to lead based on company, industry, pain point
|
|
142
|
+
*/
|
|
143
|
+
private matchSignalsToLead(lead: Lead, signals: TrendResult[]): LeadSignal[] {
|
|
144
|
+
const matched: LeadSignal[] = [];
|
|
145
|
+
const now = new Date().toISOString();
|
|
146
|
+
|
|
147
|
+
for (const signal of signals) {
|
|
148
|
+
// Check if signal is relevant to lead
|
|
149
|
+
const relevanceScore = this.calculateSignalRelevance(lead, signal);
|
|
150
|
+
|
|
151
|
+
if (relevanceScore > 0) {
|
|
152
|
+
const leadSignal: LeadSignal = {
|
|
153
|
+
signalId: `${lead.id}-${signal.trend.replace(/\s+/g, '-')}`,
|
|
154
|
+
trend: signal.trend,
|
|
155
|
+
relevanceScore,
|
|
156
|
+
source: this.inferSource(signal),
|
|
157
|
+
strength: signal.strength,
|
|
158
|
+
tags: signal.relatedKeywords || [],
|
|
159
|
+
matchedAt: now,
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
try {
|
|
163
|
+
LeadSignalSchema.parse(leadSignal);
|
|
164
|
+
matched.push(leadSignal);
|
|
165
|
+
} catch {
|
|
166
|
+
// Skip invalid signal
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
return matched;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* Calculate relevance score between signal and lead (0-100)
|
|
176
|
+
*/
|
|
177
|
+
private calculateSignalRelevance(lead: Lead, signal: TrendResult): number {
|
|
178
|
+
let score = 0;
|
|
179
|
+
|
|
180
|
+
// Always add base relevance from signal strength
|
|
181
|
+
score += Math.round(signal.strength * 40);
|
|
182
|
+
|
|
183
|
+
// Industry match (increase scoring)
|
|
184
|
+
if (lead.industry && signal.relatedKeywords) {
|
|
185
|
+
const industryMatch = signal.relatedKeywords.some((k) =>
|
|
186
|
+
k.toLowerCase().includes(lead.industry!.toLowerCase())
|
|
187
|
+
);
|
|
188
|
+
if (industryMatch) score += 35;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
// Pain point alignment
|
|
192
|
+
if (lead.pain_point && signal.opportunities) {
|
|
193
|
+
const painMatch = signal.opportunities.some((o) =>
|
|
194
|
+
o.toLowerCase().includes(lead.pain_point!.toLowerCase())
|
|
195
|
+
);
|
|
196
|
+
if (painMatch) score += 25;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
// Cap at 100
|
|
200
|
+
return Math.min(score, 100);
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
/**
|
|
204
|
+
* Infer signal source from trend analysis
|
|
205
|
+
*/
|
|
206
|
+
private inferSource(
|
|
207
|
+
signal: TrendResult
|
|
208
|
+
): 'reddit' | 'hackernews' | 'twitter' | 'polymarket' {
|
|
209
|
+
// In production, inspect signal.metadata or keywords for source hints
|
|
210
|
+
const sources = ['reddit', 'hackernews', 'twitter', 'polymarket'] as const;
|
|
211
|
+
return sources[Math.floor(Math.random() * sources.length)];
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
/**
|
|
215
|
+
* Find closest competitor threat to lead
|
|
216
|
+
*/
|
|
217
|
+
private findClosestThreat(
|
|
218
|
+
lead: Lead,
|
|
219
|
+
competitorThreats?: CompetitorThreat[]
|
|
220
|
+
): ThreatContext | undefined {
|
|
221
|
+
if (!competitorThreats || competitorThreats.length === 0) {
|
|
222
|
+
return undefined;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
// Find competitor with highest threat score in lead's industry
|
|
226
|
+
const relevant = competitorThreats
|
|
227
|
+
.filter((t) => t.threat_level !== 'low')
|
|
228
|
+
.sort((a, b) => b.threat_score - a.threat_score);
|
|
229
|
+
|
|
230
|
+
if (relevant.length === 0) return undefined;
|
|
231
|
+
|
|
232
|
+
const threat = relevant[0];
|
|
233
|
+
return {
|
|
234
|
+
competitorId: threat.competitor_id,
|
|
235
|
+
competitorName: threat.competitor_name,
|
|
236
|
+
threatScore: threat.threat_score,
|
|
237
|
+
threatLevel: threat.threat_level.toUpperCase() as 'CRITICAL' | 'HIGH' | 'MEDIUM' | 'LOW',
|
|
238
|
+
keyStrengths: threat.strengths || [],
|
|
239
|
+
keyWeaknesses: threat.weaknesses || [],
|
|
240
|
+
};
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
/**
|
|
244
|
+
* Derive threat level from competitor context
|
|
245
|
+
*/
|
|
246
|
+
private deriveTheatLevel(
|
|
247
|
+
threat: ThreatContext | undefined
|
|
248
|
+
): 'CRITICAL' | 'HIGH' | 'MEDIUM' | 'LOW' | 'NONE' {
|
|
249
|
+
if (!threat) return 'NONE';
|
|
250
|
+
return threat.threatLevel;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
/**
|
|
254
|
+
* Clear competitor cache
|
|
255
|
+
*/
|
|
256
|
+
clearCache(): void {
|
|
257
|
+
this.competitorMap.clear();
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
/**
|
|
262
|
+
* Factory function for creating enricher instances
|
|
263
|
+
*/
|
|
264
|
+
export function createLeadEnricher(
|
|
265
|
+
config?: EnrichmentConfig
|
|
266
|
+
): LeadEnricher {
|
|
267
|
+
return new LeadEnricher(config);
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
export {
|
|
271
|
+
EnrichedLead,
|
|
272
|
+
LeadSignal,
|
|
273
|
+
ThreatContext,
|
|
274
|
+
EnrichmentConfig,
|
|
275
|
+
};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lead Enrichment Type Definitions
|
|
3
|
+
* Structures for enriched leads with market signals and competitive context
|
|
4
|
+
* Phase 8A Task 1
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { Lead, Signal } from '../database/leadsSchema.js';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Market signal matched to a lead
|
|
11
|
+
*/
|
|
12
|
+
export interface LeadSignal {
|
|
13
|
+
signalId: string;
|
|
14
|
+
trend: string;
|
|
15
|
+
relevanceScore: number; // 0-100
|
|
16
|
+
source: 'reddit' | 'hackernews' | 'twitter' | 'polymarket';
|
|
17
|
+
strength: number; // 0-1
|
|
18
|
+
tags: string[];
|
|
19
|
+
matchedAt: string;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Competitive threat context
|
|
24
|
+
*/
|
|
25
|
+
export interface ThreatContext {
|
|
26
|
+
competitorId: string;
|
|
27
|
+
competitorName: string;
|
|
28
|
+
threatScore: number; // 0-100
|
|
29
|
+
threatLevel: 'CRITICAL' | 'HIGH' | 'MEDIUM' | 'LOW';
|
|
30
|
+
keyStrengths: string[];
|
|
31
|
+
keyWeaknesses: string[];
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Enriched lead with market and competitive context
|
|
36
|
+
*/
|
|
37
|
+
export interface EnrichedLead extends Lead {
|
|
38
|
+
// Enrichment metadata
|
|
39
|
+
marketSignals: LeadSignal[];
|
|
40
|
+
competitorThreat?: ThreatContext;
|
|
41
|
+
signalCount: number;
|
|
42
|
+
threatLevel: 'CRITICAL' | 'HIGH' | 'MEDIUM' | 'LOW' | 'NONE';
|
|
43
|
+
enrichedAt: string;
|
|
44
|
+
enrichmentVersion: string;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Lead enrichment configuration
|
|
49
|
+
*/
|
|
50
|
+
export interface EnrichmentConfig {
|
|
51
|
+
minRelevanceScore?: number; // Default: 60
|
|
52
|
+
maxSignalsPerLead?: number; // Default: 10
|
|
53
|
+
includeThreatContext?: boolean; // Default: true
|
|
54
|
+
}
|
|
@@ -0,0 +1,285 @@
|
|
|
1
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
2
|
+
import { scanReddit } from './redditScanner.js';
|
|
3
|
+
import { scanHackerNews } from './hackerNewsScanner.js';
|
|
4
|
+
import { scanTwitter } from './twitterScanner.js';
|
|
5
|
+
import { scanPolymarket } from './polymarketScanner.js';
|
|
6
|
+
import { analyzeTrends } from './trendAnalysis.js';
|
|
7
|
+
import { aggregateSignals } from './signalAggregator.js';
|
|
8
|
+
import {
|
|
9
|
+
Finding,
|
|
10
|
+
FindingSchema,
|
|
11
|
+
MarketScanResult,
|
|
12
|
+
MarketScanResultSchema,
|
|
13
|
+
ScanOptions,
|
|
14
|
+
ScannerConfig,
|
|
15
|
+
RedditPost,
|
|
16
|
+
HNStory,
|
|
17
|
+
TwitterTweet,
|
|
18
|
+
PolymarketMarket,
|
|
19
|
+
} from './types.js';
|
|
20
|
+
|
|
21
|
+
export class MarketScanner {
|
|
22
|
+
private config: ScannerConfig;
|
|
23
|
+
|
|
24
|
+
constructor(config?: Partial<ScannerConfig>) {
|
|
25
|
+
this.config = {
|
|
26
|
+
redditSubreddits: ['devops', 'programming', 'OpenAI', 'ClaudeAI'],
|
|
27
|
+
redditMinUpvotes: 10,
|
|
28
|
+
redditMinComments: 5,
|
|
29
|
+
hnMinPoints: 20,
|
|
30
|
+
twitterMinLikes: 100,
|
|
31
|
+
twitterVerifiedOnly: false,
|
|
32
|
+
polymarketMinVolume: 10000,
|
|
33
|
+
defaultDays: 30,
|
|
34
|
+
defaultTopN: 20,
|
|
35
|
+
defaultMinScore: 0.5,
|
|
36
|
+
...config,
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
async scan(options: ScanOptions): Promise<MarketScanResult> {
|
|
41
|
+
const startTime = Date.now();
|
|
42
|
+
const days = options.days || this.config.defaultDays;
|
|
43
|
+
const topN = options.topN || this.config.defaultTopN;
|
|
44
|
+
const minScore = options.minScore || this.config.defaultMinScore;
|
|
45
|
+
|
|
46
|
+
const allFindings: Finding[] = [];
|
|
47
|
+
|
|
48
|
+
// Parallel scanning across platforms
|
|
49
|
+
const scanPromises = [];
|
|
50
|
+
|
|
51
|
+
if (options.platforms.includes('reddit')) {
|
|
52
|
+
scanPromises.push(
|
|
53
|
+
this.scanRedditPlatform(options.keywords, days)
|
|
54
|
+
.then((posts) => {
|
|
55
|
+
allFindings.push(...posts);
|
|
56
|
+
})
|
|
57
|
+
.catch((error) => console.warn('Reddit scan failed:', error))
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
if (options.platforms.includes('hackernews')) {
|
|
62
|
+
scanPromises.push(
|
|
63
|
+
this.scanHackerNewsPlatform(options.keywords, days)
|
|
64
|
+
.then((stories) => {
|
|
65
|
+
allFindings.push(...stories);
|
|
66
|
+
})
|
|
67
|
+
.catch((error) => console.warn('HackerNews scan failed:', error))
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
if (options.platforms.includes('twitter')) {
|
|
72
|
+
scanPromises.push(
|
|
73
|
+
this.scanTwitterPlatform(options.keywords, days)
|
|
74
|
+
.then((tweets) => {
|
|
75
|
+
allFindings.push(...tweets);
|
|
76
|
+
})
|
|
77
|
+
.catch((error) => console.warn('Twitter scan failed:', error))
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
if (options.platforms.includes('polymarket')) {
|
|
82
|
+
scanPromises.push(
|
|
83
|
+
this.scanPolymarketPlatform(options.keywords, days)
|
|
84
|
+
.then((markets) => {
|
|
85
|
+
allFindings.push(...markets);
|
|
86
|
+
})
|
|
87
|
+
.catch((error) => console.warn('Polymarket scan failed:', error))
|
|
88
|
+
);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
await Promise.all(scanPromises);
|
|
92
|
+
|
|
93
|
+
// Filter by minimum score
|
|
94
|
+
const filteredFindings = allFindings.filter((f) => f.metrics.score >= minScore);
|
|
95
|
+
|
|
96
|
+
// Analyze trends
|
|
97
|
+
const trends = await analyzeTrends(filteredFindings);
|
|
98
|
+
|
|
99
|
+
// Aggregate top signals
|
|
100
|
+
const topSignals = await aggregateSignals(filteredFindings, topN);
|
|
101
|
+
|
|
102
|
+
const duration = Date.now() - startTime;
|
|
103
|
+
|
|
104
|
+
const result: MarketScanResult = {
|
|
105
|
+
timestamp: new Date(),
|
|
106
|
+
platforms: options.platforms,
|
|
107
|
+
keywords: options.keywords,
|
|
108
|
+
total_findings: filteredFindings.length,
|
|
109
|
+
top_signals: topSignals.slice(0, 10).map((f) => ({
|
|
110
|
+
trend: f.title,
|
|
111
|
+
strength: f.metrics.score,
|
|
112
|
+
category: this.categorizeSignal(f),
|
|
113
|
+
signal_count: 1,
|
|
114
|
+
})),
|
|
115
|
+
findings: topSignals,
|
|
116
|
+
trends: trends.sort((a, b) => b.strength - a.strength).slice(0, 10),
|
|
117
|
+
scan_duration_ms: duration,
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
return MarketScanResultSchema.parse(result);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
private async scanRedditPlatform(keywords: string[], days: number): Promise<Finding[]> {
|
|
124
|
+
const posts = await scanReddit(keywords, {
|
|
125
|
+
subreddits: this.config.redditSubreddits,
|
|
126
|
+
minUpvotes: this.config.redditMinUpvotes,
|
|
127
|
+
minComments: this.config.redditMinComments,
|
|
128
|
+
days,
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
return posts.map((post) => this.redditPostToFinding(post));
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
private async scanHackerNewsPlatform(keywords: string[], days: number): Promise<Finding[]> {
|
|
135
|
+
const stories = await scanHackerNews(keywords, {
|
|
136
|
+
minPoints: this.config.hnMinPoints,
|
|
137
|
+
days,
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
return stories.map((story) => this.hnStoryToFinding(story));
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
private async scanTwitterPlatform(keywords: string[], days: number): Promise<Finding[]> {
|
|
144
|
+
const tweets = await scanTwitter(keywords, {
|
|
145
|
+
minLikes: this.config.twitterMinLikes,
|
|
146
|
+
verifiedOnly: this.config.twitterVerifiedOnly,
|
|
147
|
+
days,
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
return tweets.map((tweet) => this.tweetToFinding(tweet));
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
private async scanPolymarketPlatform(keywords: string[], days: number): Promise<Finding[]> {
|
|
154
|
+
const markets = await scanPolymarket(keywords, {
|
|
155
|
+
minVolume: this.config.polymarketMinVolume,
|
|
156
|
+
days,
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
return markets.map((market) => this.polymarketToFinding(market));
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
private redditPostToFinding(post: RedditPost): Finding {
|
|
163
|
+
const engagement = post.upvotes + post.comments * 2;
|
|
164
|
+
const score = Math.min(
|
|
165
|
+
(post.upvotes / 100 + post.comments / 50) / 2,
|
|
166
|
+
1.0
|
|
167
|
+
);
|
|
168
|
+
|
|
169
|
+
const finding: Finding = {
|
|
170
|
+
id: uuidv4(),
|
|
171
|
+
title: post.title,
|
|
172
|
+
url: post.url,
|
|
173
|
+
platform: 'reddit',
|
|
174
|
+
content: post.title,
|
|
175
|
+
metrics: {
|
|
176
|
+
engagement,
|
|
177
|
+
score,
|
|
178
|
+
},
|
|
179
|
+
keywords: this.extractKeywords(post.title),
|
|
180
|
+
timestamp: post.timestamp,
|
|
181
|
+
source: post.subreddit,
|
|
182
|
+
author: post.author,
|
|
183
|
+
};
|
|
184
|
+
|
|
185
|
+
return FindingSchema.parse(finding);
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
private hnStoryToFinding(story: HNStory): Finding {
|
|
189
|
+
const engagement = story.points + story.comments * 2;
|
|
190
|
+
const score = Math.min((story.points / 100 + story.comments / 50) / 2, 1.0);
|
|
191
|
+
|
|
192
|
+
const finding: Finding = {
|
|
193
|
+
id: uuidv4(),
|
|
194
|
+
title: story.title,
|
|
195
|
+
url: story.url,
|
|
196
|
+
platform: 'hackernews',
|
|
197
|
+
content: story.title,
|
|
198
|
+
metrics: {
|
|
199
|
+
engagement,
|
|
200
|
+
score,
|
|
201
|
+
},
|
|
202
|
+
keywords: this.extractKeywords(story.title),
|
|
203
|
+
timestamp: story.timestamp,
|
|
204
|
+
source: 'hackernews',
|
|
205
|
+
author: story.author,
|
|
206
|
+
};
|
|
207
|
+
|
|
208
|
+
return FindingSchema.parse(finding);
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
private tweetToFinding(tweet: TwitterTweet): Finding {
|
|
212
|
+
const engagement = tweet.likes + tweet.retweets * 2;
|
|
213
|
+
const score = Math.min((tweet.likes / 500 + tweet.retweets / 250) / 2, 1.0);
|
|
214
|
+
|
|
215
|
+
const finding: Finding = {
|
|
216
|
+
id: uuidv4(),
|
|
217
|
+
title: tweet.text.substring(0, 100),
|
|
218
|
+
url: tweet.url,
|
|
219
|
+
platform: 'twitter',
|
|
220
|
+
content: tweet.text,
|
|
221
|
+
metrics: {
|
|
222
|
+
engagement,
|
|
223
|
+
score,
|
|
224
|
+
},
|
|
225
|
+
keywords: [...tweet.hashtags, ...this.extractKeywords(tweet.text)],
|
|
226
|
+
timestamp: tweet.timestamp,
|
|
227
|
+
source: 'twitter',
|
|
228
|
+
author: tweet.author,
|
|
229
|
+
};
|
|
230
|
+
|
|
231
|
+
return FindingSchema.parse(finding);
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
private polymarketToFinding(market: PolymarketMarket): Finding {
|
|
235
|
+
// Higher volume and more extreme odds = stronger signal
|
|
236
|
+
const volumeScore = Math.min(market.volume / 100000, 1.0);
|
|
237
|
+
const oddScore = Math.abs(market.odds - 0.5) * 2; // 0-1, peaks at 0 or 1
|
|
238
|
+
const score = (volumeScore + oddScore) / 2;
|
|
239
|
+
|
|
240
|
+
const finding: Finding = {
|
|
241
|
+
id: uuidv4(),
|
|
242
|
+
title: market.title,
|
|
243
|
+
url: market.url,
|
|
244
|
+
platform: 'polymarket',
|
|
245
|
+
content: market.description || market.title,
|
|
246
|
+
metrics: {
|
|
247
|
+
engagement: market.volume,
|
|
248
|
+
score: Math.min(Math.max(score, 0), 1.0),
|
|
249
|
+
},
|
|
250
|
+
keywords: this.extractKeywords(market.title),
|
|
251
|
+
timestamp: market.timestamp,
|
|
252
|
+
source: 'polymarket',
|
|
253
|
+
};
|
|
254
|
+
|
|
255
|
+
return FindingSchema.parse(finding);
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
private extractKeywords(text: string): string[] {
|
|
259
|
+
// Simple keyword extraction: words > 3 chars, exclude common words
|
|
260
|
+
const stopWords = new Set([
|
|
261
|
+
'the', 'a', 'an', 'and', 'or', 'but', 'in', 'on', 'at', 'to', 'for', 'of',
|
|
262
|
+
'with', 'by', 'from', 'is', 'are', 'was', 'were', 'be', 'been', 'being',
|
|
263
|
+
]);
|
|
264
|
+
|
|
265
|
+
return text
|
|
266
|
+
.toLowerCase()
|
|
267
|
+
.split(/\W+/)
|
|
268
|
+
.filter((word) => word.length > 3 && !stopWords.has(word))
|
|
269
|
+
.slice(0, 10);
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
private categorizeSignal(finding: Finding): string {
|
|
273
|
+
const content = `${finding.title} ${finding.content}`.toLowerCase();
|
|
274
|
+
|
|
275
|
+
if (/issue|bug|problem|break/i.test(content)) return 'pain_point';
|
|
276
|
+
if (/need|want|request|feature/i.test(content)) return 'feature_request';
|
|
277
|
+
if (/competitor|threat|better/i.test(content)) return 'competitive_threat';
|
|
278
|
+
return 'opportunity';
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
export async function scanMarkets(options: ScanOptions): Promise<MarketScanResult> {
|
|
283
|
+
const scanner = new MarketScanner();
|
|
284
|
+
return scanner.scan(options);
|
|
285
|
+
}
|