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,100 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Competitive Intelligence Data Types
|
|
3
|
+
* Lean Claudient Phase 7B: Autonomous Market Analysis
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
export interface Competitor {
|
|
7
|
+
id: string;
|
|
8
|
+
name: string;
|
|
9
|
+
website?: string;
|
|
10
|
+
github_repo?: string;
|
|
11
|
+
github_org?: string;
|
|
12
|
+
linkedin_page?: string;
|
|
13
|
+
twitter_handle?: string;
|
|
14
|
+
description?: string;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface GithubEvent {
|
|
18
|
+
date: string;
|
|
19
|
+
type: 'commit' | 'release' | 'pr' | 'issue';
|
|
20
|
+
feature: string;
|
|
21
|
+
impact_level: 'low' | 'medium' | 'high';
|
|
22
|
+
details: string;
|
|
23
|
+
url?: string;
|
|
24
|
+
commit_count?: number;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface HiringSignal {
|
|
28
|
+
date: string;
|
|
29
|
+
competitor_id: string;
|
|
30
|
+
role: string;
|
|
31
|
+
role_type: 'engineering' | 'sales' | 'operations' | 'product' | 'leadership';
|
|
32
|
+
count: number;
|
|
33
|
+
location: string[];
|
|
34
|
+
trend: 'increasing' | 'stable' | 'decreasing';
|
|
35
|
+
source: 'linkedin' | 'indeed' | 'glassdoor' | 'other';
|
|
36
|
+
details: string;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export interface UserComplaint {
|
|
40
|
+
date: string;
|
|
41
|
+
competitor_id: string;
|
|
42
|
+
complaint: string;
|
|
43
|
+
frequency: number;
|
|
44
|
+
sentiment: 'negative' | 'neutral' | 'positive';
|
|
45
|
+
category: 'performance' | 'cost' | 'ux' | 'features' | 'support' | 'privacy' | 'other';
|
|
46
|
+
source: 'reddit' | 'twitter' | 'review_site' | 'github' | 'other';
|
|
47
|
+
keywords: string[];
|
|
48
|
+
url?: string;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export interface CompetitorThreat {
|
|
52
|
+
competitor_id: string;
|
|
53
|
+
competitor_name: string;
|
|
54
|
+
threat_score: number; // 0-100
|
|
55
|
+
threat_level: 'critical' | 'high' | 'medium' | 'low';
|
|
56
|
+
feature_velocity: number; // releases per month
|
|
57
|
+
hiring_velocity: number; // hiring increase rate per month
|
|
58
|
+
market_sentiment: 'very_negative' | 'negative' | 'neutral' | 'positive' | 'very_positive';
|
|
59
|
+
strengths: string[];
|
|
60
|
+
weaknesses: string[];
|
|
61
|
+
opportunities: string[];
|
|
62
|
+
risks: string[];
|
|
63
|
+
confidence: number; // 0-100
|
|
64
|
+
updated: string;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export interface CompetitorIntelligence {
|
|
68
|
+
competitor_id: string;
|
|
69
|
+
competitor_name: string;
|
|
70
|
+
github_activity: GithubEvent[];
|
|
71
|
+
hiring_signals: HiringSignal[];
|
|
72
|
+
user_feedback: UserComplaint[];
|
|
73
|
+
threat_assessment: CompetitorThreat;
|
|
74
|
+
last_updated: string;
|
|
75
|
+
data_points: number; // Total data points collected
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export interface IntelligenceReport {
|
|
79
|
+
period_start: string;
|
|
80
|
+
period_end: string;
|
|
81
|
+
total_competitors_tracked: number;
|
|
82
|
+
highest_threat: string;
|
|
83
|
+
key_findings: string[];
|
|
84
|
+
feature_releases_detected: number;
|
|
85
|
+
hiring_signals_detected: number;
|
|
86
|
+
user_complaints_aggregated: number;
|
|
87
|
+
competitor_data: CompetitorIntelligence[];
|
|
88
|
+
summary: string;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export interface TrackingConfig {
|
|
92
|
+
enabled: boolean;
|
|
93
|
+
interval_hours: number;
|
|
94
|
+
data_retention_days: number;
|
|
95
|
+
sources: string[];
|
|
96
|
+
auto_append_findings: boolean;
|
|
97
|
+
include_scoring: boolean;
|
|
98
|
+
weekly_summary: boolean;
|
|
99
|
+
slack_notifications: boolean;
|
|
100
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
{
|
|
2
|
+
"competitors": [
|
|
3
|
+
{
|
|
4
|
+
"id": "cursor",
|
|
5
|
+
"name": "Cursor",
|
|
6
|
+
"website": "https://cursor.sh",
|
|
7
|
+
"github_repo": "anysphere/cursor",
|
|
8
|
+
"github_org": "anysphere",
|
|
9
|
+
"linkedin_page": "cursor-ai",
|
|
10
|
+
"twitter_handle": "@cursoriscode",
|
|
11
|
+
"description": "AI code editor with Claude integration"
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
"id": "codeium",
|
|
15
|
+
"name": "Codeium",
|
|
16
|
+
"website": "https://codeium.com",
|
|
17
|
+
"github_repo": "Exafunction/codeium",
|
|
18
|
+
"github_org": "Exafunction",
|
|
19
|
+
"linkedin_page": "codeium",
|
|
20
|
+
"twitter_handle": "@codeiumdev",
|
|
21
|
+
"description": "Free code completion with multi-language support"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"id": "github_copilot",
|
|
25
|
+
"name": "GitHub Copilot",
|
|
26
|
+
"website": "https://github.com/features/copilot",
|
|
27
|
+
"github_org": "github",
|
|
28
|
+
"linkedin_page": "github",
|
|
29
|
+
"twitter_handle": "@github",
|
|
30
|
+
"description": "OpenAI-powered code completion integrated with GitHub"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"id": "tabnine",
|
|
34
|
+
"name": "Tabnine",
|
|
35
|
+
"website": "https://www.tabnine.com",
|
|
36
|
+
"github_repo": "codota/TabNine",
|
|
37
|
+
"github_org": "codota",
|
|
38
|
+
"linkedin_page": "tabnine",
|
|
39
|
+
"twitter_handle": "@tabnine",
|
|
40
|
+
"description": "AI code completion with privacy-first approach"
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"id": "aws_codewhisperer",
|
|
44
|
+
"name": "AWS CodeWhisperer",
|
|
45
|
+
"website": "https://aws.amazon.com/codewhisperer",
|
|
46
|
+
"linkedin_page": "aws",
|
|
47
|
+
"twitter_handle": "@awscloud",
|
|
48
|
+
"description": "AWS-native code generation for enterprise"
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"id": "jetbrains_ai",
|
|
52
|
+
"name": "JetBrains AI Assistant",
|
|
53
|
+
"website": "https://www.jetbrains.com/help/idea/ai-assistant.html",
|
|
54
|
+
"linkedin_page": "jetbrains",
|
|
55
|
+
"twitter_handle": "@jetbrains",
|
|
56
|
+
"description": "Built-in AI for JetBrains IDEs"
|
|
57
|
+
}
|
|
58
|
+
],
|
|
59
|
+
"tracking": {
|
|
60
|
+
"enabled": true,
|
|
61
|
+
"interval_hours": 24,
|
|
62
|
+
"data_retention_days": 90,
|
|
63
|
+
"sources": [
|
|
64
|
+
"github",
|
|
65
|
+
"hiring",
|
|
66
|
+
"social",
|
|
67
|
+
"funding"
|
|
68
|
+
]
|
|
69
|
+
},
|
|
70
|
+
"report_settings": {
|
|
71
|
+
"auto_append_findings": true,
|
|
72
|
+
"include_scoring": true,
|
|
73
|
+
"weekly_summary": true,
|
|
74
|
+
"slack_notifications": false
|
|
75
|
+
}
|
|
76
|
+
}
|
|
@@ -0,0 +1,538 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lead Feedback Loop
|
|
3
|
+
* Tracks conversion outcomes and reweights scoring model based on accuracy
|
|
4
|
+
* Phase 8C Task 10
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { z } from 'zod';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Feedback record for a converted lead
|
|
11
|
+
*/
|
|
12
|
+
export interface LeadFeedback {
|
|
13
|
+
id: string;
|
|
14
|
+
leadId: string;
|
|
15
|
+
projectedRevenue: number;
|
|
16
|
+
actualRevenue: number;
|
|
17
|
+
errorPercent: number;
|
|
18
|
+
closedDate: string;
|
|
19
|
+
stage: 'cold' | 'warm' | 'hot' | 'sales-ready' | 'won' | 'lost';
|
|
20
|
+
createdAt: string;
|
|
21
|
+
metadata?: {
|
|
22
|
+
signalCount?: number;
|
|
23
|
+
threatLevel?: string;
|
|
24
|
+
source?: string;
|
|
25
|
+
conversionRateFactored?: number;
|
|
26
|
+
acvFactored?: number;
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Accuracy analysis result
|
|
32
|
+
*/
|
|
33
|
+
export interface AccuracyAnalysis {
|
|
34
|
+
mape: number; // Mean Absolute Percentage Error
|
|
35
|
+
mae: number; // Mean Absolute Error
|
|
36
|
+
rmse: number; // Root Mean Squared Error
|
|
37
|
+
totalSamples: number;
|
|
38
|
+
overestimateCount: number;
|
|
39
|
+
underestimateCount: number;
|
|
40
|
+
avgOverestimate: number;
|
|
41
|
+
avgUnderestimate: number;
|
|
42
|
+
errorDistribution: {
|
|
43
|
+
veryAccurate: number; // 0-5% error
|
|
44
|
+
accurate: number; // 5-15% error
|
|
45
|
+
acceptable: number; // 15-30% error
|
|
46
|
+
poor: number; // >30% error
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Factor accuracy analysis
|
|
52
|
+
*/
|
|
53
|
+
export interface FactorAccuracy {
|
|
54
|
+
factor: string;
|
|
55
|
+
contribution: number; // 0-100%
|
|
56
|
+
accuracy: number; // 0-100%
|
|
57
|
+
trend: 'improving' | 'stable' | 'degrading';
|
|
58
|
+
samples: number;
|
|
59
|
+
recommendation?: string;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Model weight update recommendation
|
|
64
|
+
*/
|
|
65
|
+
export interface WeightUpdate {
|
|
66
|
+
factor: string;
|
|
67
|
+
currentWeight: number;
|
|
68
|
+
recommendedWeight: number;
|
|
69
|
+
change: number; // percentage point
|
|
70
|
+
rationale: string;
|
|
71
|
+
confidence: number; // 0-100%
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Validation schemas
|
|
76
|
+
*/
|
|
77
|
+
const LeadFeedbackSchema = z.object({
|
|
78
|
+
id: z.string().min(1),
|
|
79
|
+
leadId: z.string().min(1),
|
|
80
|
+
projectedRevenue: z.number().nonnegative(),
|
|
81
|
+
actualRevenue: z.number().nonnegative(),
|
|
82
|
+
errorPercent: z.number().min(-100).max(500),
|
|
83
|
+
closedDate: z.string().datetime(),
|
|
84
|
+
stage: z.enum(['cold', 'warm', 'hot', 'sales-ready', 'won', 'lost']),
|
|
85
|
+
createdAt: z.string().datetime(),
|
|
86
|
+
metadata: z
|
|
87
|
+
.object({
|
|
88
|
+
signalCount: z.number().nonnegative().optional(),
|
|
89
|
+
threatLevel: z.string().optional(),
|
|
90
|
+
source: z.string().optional(),
|
|
91
|
+
conversionRateFactored: z.number().min(0).max(1).optional(),
|
|
92
|
+
acvFactored: z.number().nonnegative().optional(),
|
|
93
|
+
})
|
|
94
|
+
.optional(),
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* FeedbackLoop class
|
|
99
|
+
* Manages conversion feedback and model reweighting
|
|
100
|
+
*/
|
|
101
|
+
export class FeedbackLoop {
|
|
102
|
+
private feedbackHistory: LeadFeedback[] = [];
|
|
103
|
+
private scoringWeights: Map<string, number> = new Map();
|
|
104
|
+
private lastMonthlyUpdate: Date;
|
|
105
|
+
|
|
106
|
+
constructor(initialWeights?: Record<string, number>, lastUpdateDate?: Date) {
|
|
107
|
+
this.lastMonthlyUpdate = lastUpdateDate || new Date(Date.now() - 30 * 24 * 60 * 60 * 1000); // Default: 30 days ago
|
|
108
|
+
// Initialize with default weights
|
|
109
|
+
this.scoringWeights.set('signalCount', 0.3);
|
|
110
|
+
this.scoringWeights.set('threatMultiplier', 0.2);
|
|
111
|
+
this.scoringWeights.set('conversionRate', 0.25);
|
|
112
|
+
this.scoringWeights.set('acvEstimation', 0.15);
|
|
113
|
+
this.scoringWeights.set('sourceQuality', 0.1);
|
|
114
|
+
|
|
115
|
+
// Override with initial weights if provided
|
|
116
|
+
if (initialWeights) {
|
|
117
|
+
Object.entries(initialWeights).forEach(([key, value]) => {
|
|
118
|
+
this.scoringWeights.set(key, value);
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Log a conversion event
|
|
125
|
+
*/
|
|
126
|
+
logConversion(
|
|
127
|
+
leadId: string,
|
|
128
|
+
projectedRevenue: number,
|
|
129
|
+
actualRevenue: number,
|
|
130
|
+
closedDate: string,
|
|
131
|
+
stage: 'cold' | 'warm' | 'hot' | 'sales-ready' | 'won' | 'lost' = 'won',
|
|
132
|
+
metadata?: LeadFeedback['metadata']
|
|
133
|
+
): LeadFeedback {
|
|
134
|
+
const errorPercent =
|
|
135
|
+
projectedRevenue > 0
|
|
136
|
+
? ((projectedRevenue - actualRevenue) / projectedRevenue) * 100
|
|
137
|
+
: 0;
|
|
138
|
+
|
|
139
|
+
const feedback: LeadFeedback = {
|
|
140
|
+
id: `feedback_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`,
|
|
141
|
+
leadId,
|
|
142
|
+
projectedRevenue,
|
|
143
|
+
actualRevenue,
|
|
144
|
+
errorPercent,
|
|
145
|
+
closedDate,
|
|
146
|
+
stage,
|
|
147
|
+
createdAt: new Date().toISOString(),
|
|
148
|
+
metadata,
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
// Validate feedback
|
|
152
|
+
LeadFeedbackSchema.parse(feedback);
|
|
153
|
+
|
|
154
|
+
this.feedbackHistory.push(feedback);
|
|
155
|
+
return feedback;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* Calculate MAPE (Mean Absolute Percentage Error)
|
|
160
|
+
*/
|
|
161
|
+
calculateAccuracy(
|
|
162
|
+
samples?: LeadFeedback[]
|
|
163
|
+
): AccuracyAnalysis {
|
|
164
|
+
const data = samples || this.feedbackHistory;
|
|
165
|
+
|
|
166
|
+
if (data.length === 0) {
|
|
167
|
+
return {
|
|
168
|
+
mape: 0,
|
|
169
|
+
mae: 0,
|
|
170
|
+
rmse: 0,
|
|
171
|
+
totalSamples: 0,
|
|
172
|
+
overestimateCount: 0,
|
|
173
|
+
underestimateCount: 0,
|
|
174
|
+
avgOverestimate: 0,
|
|
175
|
+
avgUnderestimate: 0,
|
|
176
|
+
errorDistribution: {
|
|
177
|
+
veryAccurate: 0,
|
|
178
|
+
accurate: 0,
|
|
179
|
+
acceptable: 0,
|
|
180
|
+
poor: 0,
|
|
181
|
+
},
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
// Calculate error metrics
|
|
186
|
+
let sumAbsPercentError = 0;
|
|
187
|
+
let sumAbsError = 0;
|
|
188
|
+
let sumSquaredError = 0;
|
|
189
|
+
let overestimateCount = 0;
|
|
190
|
+
let underestimateCount = 0;
|
|
191
|
+
let sumOverestimate = 0;
|
|
192
|
+
let sumUnderestimate = 0;
|
|
193
|
+
|
|
194
|
+
const errorDistribution = {
|
|
195
|
+
veryAccurate: 0,
|
|
196
|
+
accurate: 0,
|
|
197
|
+
acceptable: 0,
|
|
198
|
+
poor: 0,
|
|
199
|
+
};
|
|
200
|
+
|
|
201
|
+
data.forEach((feedback) => {
|
|
202
|
+
const error = feedback.projectedRevenue - feedback.actualRevenue;
|
|
203
|
+
const absError = Math.abs(error);
|
|
204
|
+
const percentError = feedback.actualRevenue
|
|
205
|
+
? Math.abs(error / feedback.actualRevenue) * 100
|
|
206
|
+
: 0;
|
|
207
|
+
|
|
208
|
+
sumAbsPercentError += percentError;
|
|
209
|
+
sumAbsError += absError;
|
|
210
|
+
sumSquaredError += error * error;
|
|
211
|
+
|
|
212
|
+
if (feedback.projectedRevenue > feedback.actualRevenue) {
|
|
213
|
+
overestimateCount++;
|
|
214
|
+
sumOverestimate += absError;
|
|
215
|
+
} else {
|
|
216
|
+
underestimateCount++;
|
|
217
|
+
sumUnderestimate += absError;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
// Categorize error
|
|
221
|
+
if (percentError <= 5) errorDistribution.veryAccurate++;
|
|
222
|
+
else if (percentError <= 15) errorDistribution.accurate++;
|
|
223
|
+
else if (percentError <= 30) errorDistribution.acceptable++;
|
|
224
|
+
else errorDistribution.poor++;
|
|
225
|
+
});
|
|
226
|
+
|
|
227
|
+
const mape = sumAbsPercentError / data.length;
|
|
228
|
+
const mae = sumAbsError / data.length;
|
|
229
|
+
const rmse = Math.sqrt(sumSquaredError / data.length);
|
|
230
|
+
|
|
231
|
+
return {
|
|
232
|
+
mape,
|
|
233
|
+
mae,
|
|
234
|
+
rmse,
|
|
235
|
+
totalSamples: data.length,
|
|
236
|
+
overestimateCount,
|
|
237
|
+
underestimateCount,
|
|
238
|
+
avgOverestimate:
|
|
239
|
+
overestimateCount > 0 ? sumOverestimate / overestimateCount : 0,
|
|
240
|
+
avgUnderestimate:
|
|
241
|
+
underestimateCount > 0 ? sumUnderestimate / underestimateCount : 0,
|
|
242
|
+
errorDistribution: {
|
|
243
|
+
veryAccurate: Math.round(
|
|
244
|
+
(errorDistribution.veryAccurate / data.length) * 100
|
|
245
|
+
),
|
|
246
|
+
accurate: Math.round(
|
|
247
|
+
(errorDistribution.accurate / data.length) * 100
|
|
248
|
+
),
|
|
249
|
+
acceptable: Math.round(
|
|
250
|
+
(errorDistribution.acceptable / data.length) * 100
|
|
251
|
+
),
|
|
252
|
+
poor: Math.round((errorDistribution.poor / data.length) * 100),
|
|
253
|
+
},
|
|
254
|
+
};
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
/**
|
|
258
|
+
* Analyze which factors were accurate vs inaccurate
|
|
259
|
+
*/
|
|
260
|
+
analyzeFactorAccuracy(
|
|
261
|
+
samples?: LeadFeedback[]
|
|
262
|
+
): FactorAccuracy[] {
|
|
263
|
+
const data = samples || this.feedbackHistory;
|
|
264
|
+
|
|
265
|
+
if (data.length === 0) {
|
|
266
|
+
return [];
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
// Group feedback by metadata characteristics
|
|
270
|
+
const bySignalCount = this.groupByKey(data, (f) =>
|
|
271
|
+
f.metadata?.signalCount ? 'signal-based' : 'no-signal'
|
|
272
|
+
);
|
|
273
|
+
const byThreatLevel = this.groupByKey(
|
|
274
|
+
data,
|
|
275
|
+
(f) => f.metadata?.threatLevel || 'unknown'
|
|
276
|
+
);
|
|
277
|
+
const bySource = this.groupByKey(data, (f) => f.metadata?.source || 'unknown');
|
|
278
|
+
|
|
279
|
+
const factors: FactorAccuracy[] = [];
|
|
280
|
+
|
|
281
|
+
// Analyze signal count factor
|
|
282
|
+
const signalAccuracy = this.calculateGroupAccuracy(bySignalCount);
|
|
283
|
+
factors.push({
|
|
284
|
+
factor: 'signalCount',
|
|
285
|
+
contribution: 30,
|
|
286
|
+
accuracy: signalAccuracy.avgAccuracy,
|
|
287
|
+
trend: this.determineTrend(signalAccuracy, bySignalCount),
|
|
288
|
+
samples: signalAccuracy.totalSamples,
|
|
289
|
+
recommendation:
|
|
290
|
+
signalAccuracy.avgAccuracy < 70
|
|
291
|
+
? 'Recalibrate signal weighting in scoring'
|
|
292
|
+
: undefined,
|
|
293
|
+
});
|
|
294
|
+
|
|
295
|
+
// Analyze threat multiplier factor
|
|
296
|
+
const threatAccuracy = this.calculateGroupAccuracy(byThreatLevel);
|
|
297
|
+
factors.push({
|
|
298
|
+
factor: 'threatMultiplier',
|
|
299
|
+
contribution: 20,
|
|
300
|
+
accuracy: threatAccuracy.avgAccuracy,
|
|
301
|
+
trend: this.determineTrend(threatAccuracy, byThreatLevel),
|
|
302
|
+
samples: threatAccuracy.totalSamples,
|
|
303
|
+
recommendation:
|
|
304
|
+
threatAccuracy.avgAccuracy < 70
|
|
305
|
+
? 'Adjust threat level multipliers'
|
|
306
|
+
: undefined,
|
|
307
|
+
});
|
|
308
|
+
|
|
309
|
+
// Analyze conversion rate factor
|
|
310
|
+
const conversionAccuracy = this.calculateGroupAccuracy(bySource);
|
|
311
|
+
factors.push({
|
|
312
|
+
factor: 'conversionRate',
|
|
313
|
+
contribution: 25,
|
|
314
|
+
accuracy: conversionAccuracy.avgAccuracy,
|
|
315
|
+
trend: this.determineTrend(conversionAccuracy, bySource),
|
|
316
|
+
samples: conversionAccuracy.totalSamples,
|
|
317
|
+
recommendation:
|
|
318
|
+
conversionAccuracy.avgAccuracy < 70
|
|
319
|
+
? 'Retrain conversion rate model by source'
|
|
320
|
+
: undefined,
|
|
321
|
+
});
|
|
322
|
+
|
|
323
|
+
// ACV estimation
|
|
324
|
+
const acvAccuracy = data
|
|
325
|
+
.filter((f) => f.metadata?.acvFactored)
|
|
326
|
+
.reduce((acc, f) => {
|
|
327
|
+
const error = Math.abs(
|
|
328
|
+
f.projectedRevenue - f.actualRevenue
|
|
329
|
+
) / Math.max(f.actualRevenue, 1);
|
|
330
|
+
return acc + error;
|
|
331
|
+
}, 0) / Math.max(data.filter((f) => f.metadata?.acvFactored).length, 1);
|
|
332
|
+
|
|
333
|
+
factors.push({
|
|
334
|
+
factor: 'acvEstimation',
|
|
335
|
+
contribution: 15,
|
|
336
|
+
accuracy: Math.max(0, 100 - acvAccuracy * 100),
|
|
337
|
+
trend:
|
|
338
|
+
acvAccuracy < 0.2
|
|
339
|
+
? 'improving'
|
|
340
|
+
: acvAccuracy < 0.35
|
|
341
|
+
? 'stable'
|
|
342
|
+
: 'degrading',
|
|
343
|
+
samples: data.filter((f) => f.metadata?.acvFactored).length,
|
|
344
|
+
recommendation:
|
|
345
|
+
acvAccuracy > 0.3
|
|
346
|
+
? 'Review ACV estimation assumptions'
|
|
347
|
+
: undefined,
|
|
348
|
+
});
|
|
349
|
+
|
|
350
|
+
return factors;
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
/**
|
|
354
|
+
* Get recommended model weight updates (conservative: max 5% change)
|
|
355
|
+
*/
|
|
356
|
+
getModelUpdateRecommendations(
|
|
357
|
+
samples?: LeadFeedback[]
|
|
358
|
+
): WeightUpdate[] {
|
|
359
|
+
const factorAccuracy = this.analyzeFactorAccuracy(samples);
|
|
360
|
+
const maxChangePercent = 5; // Conservative: max 5% per month
|
|
361
|
+
|
|
362
|
+
return factorAccuracy
|
|
363
|
+
.map((factor) => {
|
|
364
|
+
const currentWeight = this.scoringWeights.get(factor.factor) || 0;
|
|
365
|
+
|
|
366
|
+
// Only recommend change if accuracy is significantly off
|
|
367
|
+
if (factor.accuracy < 65) {
|
|
368
|
+
// Needs improvement
|
|
369
|
+
const recommendedChange = Math.min(
|
|
370
|
+
maxChangePercent,
|
|
371
|
+
(100 - factor.accuracy) / 10
|
|
372
|
+
);
|
|
373
|
+
return {
|
|
374
|
+
factor: factor.factor,
|
|
375
|
+
currentWeight,
|
|
376
|
+
recommendedWeight: Math.max(
|
|
377
|
+
0.05,
|
|
378
|
+
Math.min(0.95, currentWeight + recommendedChange / 100)
|
|
379
|
+
),
|
|
380
|
+
change: Math.min(maxChangePercent, recommendedChange),
|
|
381
|
+
rationale: `Factor accuracy ${factor.accuracy.toFixed(1)}% suggests weight adjustment`,
|
|
382
|
+
confidence: Math.min(100, factor.samples * 5),
|
|
383
|
+
};
|
|
384
|
+
} else if (factor.accuracy > 85) {
|
|
385
|
+
// Already performing well
|
|
386
|
+
const recommendedChange = Math.max(
|
|
387
|
+
-maxChangePercent,
|
|
388
|
+
-(factor.accuracy - 85) / 10
|
|
389
|
+
);
|
|
390
|
+
return {
|
|
391
|
+
factor: factor.factor,
|
|
392
|
+
currentWeight,
|
|
393
|
+
recommendedWeight: Math.max(
|
|
394
|
+
0.05,
|
|
395
|
+
Math.min(0.95, currentWeight + recommendedChange / 100)
|
|
396
|
+
),
|
|
397
|
+
change: Math.max(-maxChangePercent, recommendedChange),
|
|
398
|
+
rationale: `Factor performing well at ${factor.accuracy.toFixed(1)}% accuracy`,
|
|
399
|
+
confidence: Math.min(100, factor.samples * 5),
|
|
400
|
+
};
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
return null;
|
|
404
|
+
})
|
|
405
|
+
.filter((u) => u !== null && Math.abs(u.change) > 0.1) as WeightUpdate[];
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
/**
|
|
409
|
+
* Apply monthly update to scoring model weights
|
|
410
|
+
*/
|
|
411
|
+
applyMonthlyUpdate(recommendations?: WeightUpdate[]): Map<string, number> {
|
|
412
|
+
const now = new Date();
|
|
413
|
+
const lastUpdate = this.lastMonthlyUpdate;
|
|
414
|
+
const daysSinceUpdate = Math.floor(
|
|
415
|
+
(now.getTime() - lastUpdate.getTime()) / (1000 * 60 * 60 * 24)
|
|
416
|
+
);
|
|
417
|
+
|
|
418
|
+
if (daysSinceUpdate < 25) {
|
|
419
|
+
throw new Error('Monthly update can only be applied once per 25 days');
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
const updates = recommendations || this.getModelUpdateRecommendations();
|
|
423
|
+
|
|
424
|
+
// Apply high-confidence updates
|
|
425
|
+
let updateCount = 0;
|
|
426
|
+
updates.forEach((update) => {
|
|
427
|
+
if (update.confidence > 50) {
|
|
428
|
+
// Only apply high-confidence updates
|
|
429
|
+
this.scoringWeights.set(update.factor, update.recommendedWeight);
|
|
430
|
+
updateCount++;
|
|
431
|
+
}
|
|
432
|
+
});
|
|
433
|
+
|
|
434
|
+
// Normalize weights to sum to 1.0
|
|
435
|
+
const sum = Array.from(this.scoringWeights.values()).reduce(
|
|
436
|
+
(a, b) => a + b,
|
|
437
|
+
0
|
|
438
|
+
);
|
|
439
|
+
if (sum > 0) {
|
|
440
|
+
this.scoringWeights.forEach((value, key) => {
|
|
441
|
+
this.scoringWeights.set(key, value / sum);
|
|
442
|
+
});
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
this.lastMonthlyUpdate = now;
|
|
446
|
+
return this.scoringWeights;
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
/**
|
|
450
|
+
* Get complete feedback history
|
|
451
|
+
*/
|
|
452
|
+
getFeedbackHistory(leadId?: string, limit?: number): LeadFeedback[] {
|
|
453
|
+
let results = this.feedbackHistory;
|
|
454
|
+
|
|
455
|
+
if (leadId) {
|
|
456
|
+
results = results.filter((f) => f.leadId === leadId);
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
if (limit) {
|
|
460
|
+
results = results.slice(-limit);
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
return results;
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
/**
|
|
467
|
+
* Get current scoring weights
|
|
468
|
+
*/
|
|
469
|
+
getScoringWeights(): Record<string, number> {
|
|
470
|
+
const result: Record<string, number> = {};
|
|
471
|
+
this.scoringWeights.forEach((value, key) => {
|
|
472
|
+
result[key] = value;
|
|
473
|
+
});
|
|
474
|
+
return result;
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
/**
|
|
478
|
+
* Private helper: Group feedback by key function
|
|
479
|
+
*/
|
|
480
|
+
private groupByKey(
|
|
481
|
+
data: LeadFeedback[],
|
|
482
|
+
keyFn: (f: LeadFeedback) => string
|
|
483
|
+
): Map<string, LeadFeedback[]> {
|
|
484
|
+
const groups = new Map<string, LeadFeedback[]>();
|
|
485
|
+
data.forEach((item) => {
|
|
486
|
+
const key = keyFn(item);
|
|
487
|
+
if (!groups.has(key)) {
|
|
488
|
+
groups.set(key, []);
|
|
489
|
+
}
|
|
490
|
+
groups.get(key)!.push(item);
|
|
491
|
+
});
|
|
492
|
+
return groups;
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
/**
|
|
496
|
+
* Private helper: Calculate accuracy for grouped feedback
|
|
497
|
+
*/
|
|
498
|
+
private calculateGroupAccuracy(
|
|
499
|
+
groups: Map<string, LeadFeedback[]>
|
|
500
|
+
): { avgAccuracy: number; totalSamples: number } {
|
|
501
|
+
let totalAccuracy = 0;
|
|
502
|
+
let totalSamples = 0;
|
|
503
|
+
|
|
504
|
+
groups.forEach((group) => {
|
|
505
|
+
const accuracy = this.calculateAccuracy(group);
|
|
506
|
+
totalAccuracy += 100 - accuracy.mape; // Accuracy is inverse of error
|
|
507
|
+
totalSamples += group.length;
|
|
508
|
+
});
|
|
509
|
+
|
|
510
|
+
return {
|
|
511
|
+
avgAccuracy:
|
|
512
|
+
groups.size > 0 ? totalAccuracy / groups.size : 0,
|
|
513
|
+
totalSamples,
|
|
514
|
+
};
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
/**
|
|
518
|
+
* Private helper: Determine trend for a factor
|
|
519
|
+
*/
|
|
520
|
+
private determineTrend(
|
|
521
|
+
accuracy: { avgAccuracy: number },
|
|
522
|
+
groups: Map<string, LeadFeedback[]>
|
|
523
|
+
): 'improving' | 'stable' | 'degrading' {
|
|
524
|
+
// Simple heuristic: if accuracy is improving month-over-month
|
|
525
|
+
// For now, use static determination based on current state
|
|
526
|
+
if (accuracy.avgAccuracy > 80) return 'improving';
|
|
527
|
+
if (accuracy.avgAccuracy > 60) return 'stable';
|
|
528
|
+
return 'degrading';
|
|
529
|
+
}
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
// Export factory function
|
|
533
|
+
export function createFeedbackLoop(
|
|
534
|
+
initialWeights?: Record<string, number>,
|
|
535
|
+
lastUpdateDate?: Date
|
|
536
|
+
): FeedbackLoop {
|
|
537
|
+
return new FeedbackLoop(initialWeights, lastUpdateDate);
|
|
538
|
+
}
|