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,407 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CRM Export Integration
|
|
3
|
+
* Export sales-ready leads to Salesforce/HubSpot via Composio
|
|
4
|
+
* Queues actions with human approval gates (Phase 7C)
|
|
5
|
+
* Phase 8C Task 9
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
9
|
+
import { AuditLogger } from '../core/auditLogger.js';
|
|
10
|
+
import { EnrichedLead } from '../intelligence/leadEnrichmentTypes.js';
|
|
11
|
+
import { RevenueProjection } from '../metrics/revenueTypes.js';
|
|
12
|
+
import ComposioClient from './composioClient.js';
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* CRM opportunity record
|
|
16
|
+
*/
|
|
17
|
+
export interface CRMOpportunity {
|
|
18
|
+
id: string;
|
|
19
|
+
name: string;
|
|
20
|
+
accountName: string;
|
|
21
|
+
value: number;
|
|
22
|
+
probability: number;
|
|
23
|
+
stage: string;
|
|
24
|
+
closeDate: string;
|
|
25
|
+
description: string;
|
|
26
|
+
metadata: {
|
|
27
|
+
leadScore: number;
|
|
28
|
+
signalCount: number;
|
|
29
|
+
threatLevel: string;
|
|
30
|
+
sources: string[];
|
|
31
|
+
enrichedAt: string;
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Export history entry
|
|
37
|
+
*/
|
|
38
|
+
export interface ExportHistoryEntry {
|
|
39
|
+
id: string;
|
|
40
|
+
leadId: string;
|
|
41
|
+
crmSystem: 'salesforce' | 'hubspot';
|
|
42
|
+
recordId?: string;
|
|
43
|
+
status: 'queued' | 'approved' | 'executed' | 'failed';
|
|
44
|
+
exportedAt: string;
|
|
45
|
+
approvedAt?: string;
|
|
46
|
+
executedAt?: string;
|
|
47
|
+
error?: string;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* CRM Configuration
|
|
52
|
+
*/
|
|
53
|
+
export interface CRMConfig {
|
|
54
|
+
system: 'salesforce' | 'hubspot';
|
|
55
|
+
workspaceId: string;
|
|
56
|
+
accountMapping?: Record<string, string>;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* CRM Exporter: Manages lead export to CRM systems
|
|
61
|
+
*/
|
|
62
|
+
export class CRMExporter {
|
|
63
|
+
private auditLogger: AuditLogger;
|
|
64
|
+
private composioClient?: ComposioClient;
|
|
65
|
+
private exportHistory: Map<string, ExportHistoryEntry> = new Map();
|
|
66
|
+
private crmConfig?: CRMConfig;
|
|
67
|
+
|
|
68
|
+
constructor(composioApiKey?: string, crmConfig?: CRMConfig) {
|
|
69
|
+
this.auditLogger = new AuditLogger();
|
|
70
|
+
this.crmConfig = crmConfig;
|
|
71
|
+
|
|
72
|
+
if (composioApiKey) {
|
|
73
|
+
this.composioClient = new ComposioClient({
|
|
74
|
+
apiKey: composioApiKey,
|
|
75
|
+
baseUrl: 'https://api.composio.dev/api/v1',
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Set CRM configuration
|
|
82
|
+
*/
|
|
83
|
+
setCRMConfig(config: CRMConfig): void {
|
|
84
|
+
this.crmConfig = config;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Export a single lead to CRM
|
|
89
|
+
*/
|
|
90
|
+
async exportLead(
|
|
91
|
+
enrichedLead: EnrichedLead,
|
|
92
|
+
projection?: RevenueProjection,
|
|
93
|
+
crmConfig?: CRMConfig
|
|
94
|
+
): Promise<ExportHistoryEntry> {
|
|
95
|
+
const config = crmConfig || this.crmConfig;
|
|
96
|
+
if (!config) {
|
|
97
|
+
throw new Error('CRM configuration not set');
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
const exportId = uuidv4();
|
|
101
|
+
|
|
102
|
+
// Validate lead is sales-ready (score >= 75 required)
|
|
103
|
+
if (enrichedLead.score < 75) {
|
|
104
|
+
this.auditLogger.log({
|
|
105
|
+
event: 'export:validation_failed',
|
|
106
|
+
leadId: enrichedLead.id,
|
|
107
|
+
reason: 'Lead not sales-ready (score < 75)',
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
throw new Error(`Lead ${enrichedLead.id} is not sales-ready`);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
// Format opportunity based on CRM system
|
|
114
|
+
let opportunity: any;
|
|
115
|
+
if (config.system === 'salesforce') {
|
|
116
|
+
opportunity = this.formatForSalesforce(enrichedLead, projection);
|
|
117
|
+
} else if (config.system === 'hubspot') {
|
|
118
|
+
opportunity = this.formatForHubSpot(enrichedLead, projection);
|
|
119
|
+
} else {
|
|
120
|
+
throw new Error(`Unsupported CRM system: ${config.system}`);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
// Redact sensitive data
|
|
124
|
+
this.redactSensitiveData(opportunity);
|
|
125
|
+
|
|
126
|
+
const historyEntry: ExportHistoryEntry = {
|
|
127
|
+
id: exportId,
|
|
128
|
+
leadId: enrichedLead.id,
|
|
129
|
+
crmSystem: config.system,
|
|
130
|
+
status: 'queued',
|
|
131
|
+
exportedAt: new Date().toISOString(),
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
this.exportHistory.set(exportId, historyEntry);
|
|
135
|
+
|
|
136
|
+
this.auditLogger.log({
|
|
137
|
+
event: 'export:queued',
|
|
138
|
+
exportId,
|
|
139
|
+
leadId: enrichedLead.id,
|
|
140
|
+
crmSystem: config.system,
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
// Queue action via Composio (no autonomous execution)
|
|
144
|
+
if (this.composioClient) {
|
|
145
|
+
try {
|
|
146
|
+
const actionResult = await this.queueComposioAction(
|
|
147
|
+
config.system,
|
|
148
|
+
config.workspaceId,
|
|
149
|
+
opportunity
|
|
150
|
+
);
|
|
151
|
+
|
|
152
|
+
historyEntry.recordId = actionResult.recordId;
|
|
153
|
+
historyEntry.status = 'approved';
|
|
154
|
+
historyEntry.approvedAt = new Date().toISOString();
|
|
155
|
+
|
|
156
|
+
this.auditLogger.log({
|
|
157
|
+
event: 'export:approved',
|
|
158
|
+
exportId,
|
|
159
|
+
leadId: enrichedLead.id,
|
|
160
|
+
recordId: actionResult.recordId,
|
|
161
|
+
});
|
|
162
|
+
} catch (error) {
|
|
163
|
+
const errorMsg = error instanceof Error ? error.message : String(error);
|
|
164
|
+
historyEntry.status = 'failed';
|
|
165
|
+
historyEntry.error = errorMsg;
|
|
166
|
+
|
|
167
|
+
this.auditLogger.log({
|
|
168
|
+
event: 'export:failed',
|
|
169
|
+
exportId,
|
|
170
|
+
leadId: enrichedLead.id,
|
|
171
|
+
error: errorMsg,
|
|
172
|
+
});
|
|
173
|
+
|
|
174
|
+
throw error;
|
|
175
|
+
}
|
|
176
|
+
} else {
|
|
177
|
+
this.auditLogger.log({
|
|
178
|
+
event: 'export:no_composio',
|
|
179
|
+
exportId,
|
|
180
|
+
leadId: enrichedLead.id,
|
|
181
|
+
message: 'Composio client not configured - action queued for manual execution',
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
return historyEntry;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* Export multiple sales-ready leads
|
|
190
|
+
*/
|
|
191
|
+
async exportSalesReadyLeads(
|
|
192
|
+
enrichedLeads: EnrichedLead[],
|
|
193
|
+
projections?: Map<string, RevenueProjection>,
|
|
194
|
+
crmConfig?: CRMConfig
|
|
195
|
+
): Promise<ExportHistoryEntry[]> {
|
|
196
|
+
const results: ExportHistoryEntry[] = [];
|
|
197
|
+
|
|
198
|
+
for (const lead of enrichedLeads) {
|
|
199
|
+
try {
|
|
200
|
+
const projection = projections?.get(lead.id);
|
|
201
|
+
const entry = await this.exportLead(lead, projection, crmConfig);
|
|
202
|
+
results.push(entry);
|
|
203
|
+
} catch (error) {
|
|
204
|
+
this.auditLogger.log({
|
|
205
|
+
event: 'export:batch_error',
|
|
206
|
+
leadId: lead.id,
|
|
207
|
+
error: String(error),
|
|
208
|
+
});
|
|
209
|
+
// Continue with next lead
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
return results;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
/**
|
|
217
|
+
* Format lead as Salesforce Opportunity
|
|
218
|
+
*/
|
|
219
|
+
formatForSalesforce(
|
|
220
|
+
enrichedLead: EnrichedLead,
|
|
221
|
+
projection?: RevenueProjection
|
|
222
|
+
): CRMOpportunity {
|
|
223
|
+
const opportunity: CRMOpportunity = {
|
|
224
|
+
id: uuidv4(),
|
|
225
|
+
name: `${enrichedLead.name} - ${enrichedLead.company || 'Prospect'}`,
|
|
226
|
+
accountName: enrichedLead.company || enrichedLead.name,
|
|
227
|
+
value: projection?.projectedRevenue || enrichedLead.score * 500,
|
|
228
|
+
probability: (enrichedLead.score / 100) * 0.8, // 80% max confidence
|
|
229
|
+
stage: 'Prospecting',
|
|
230
|
+
closeDate: new Date(Date.now() + 30 * 24 * 60 * 60 * 1000).toISOString().split('T')[0],
|
|
231
|
+
description: `Lead from market intelligence pipeline.\nIndustry: ${enrichedLead.industry || 'Unknown'}\nPain Point: ${enrichedLead.pain_point || 'TBD'}\nQuality Score: ${enrichedLead.score}%`,
|
|
232
|
+
metadata: {
|
|
233
|
+
leadScore: enrichedLead.score,
|
|
234
|
+
signalCount: enrichedLead.signalCount,
|
|
235
|
+
threatLevel: enrichedLead.threatLevel,
|
|
236
|
+
sources: enrichedLead.source ? [enrichedLead.source] : [],
|
|
237
|
+
enrichedAt: enrichedLead.enrichedAt || new Date().toISOString(),
|
|
238
|
+
},
|
|
239
|
+
};
|
|
240
|
+
|
|
241
|
+
return opportunity;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
/**
|
|
245
|
+
* Format lead as HubSpot Deal
|
|
246
|
+
*/
|
|
247
|
+
formatForHubSpot(
|
|
248
|
+
enrichedLead: EnrichedLead,
|
|
249
|
+
projection?: RevenueProjection
|
|
250
|
+
): CRMOpportunity {
|
|
251
|
+
const opportunity: CRMOpportunity = {
|
|
252
|
+
id: uuidv4(),
|
|
253
|
+
name: `${enrichedLead.name} - ${enrichedLead.company || 'Prospect'}`,
|
|
254
|
+
accountName: enrichedLead.company || enrichedLead.name,
|
|
255
|
+
value: projection?.projectedRevenue || enrichedLead.score * 500,
|
|
256
|
+
probability: (enrichedLead.score / 100) * 0.75, // 75% max confidence
|
|
257
|
+
stage: 'Negotiation/Review',
|
|
258
|
+
closeDate: new Date(Date.now() + 21 * 24 * 60 * 60 * 1000).toISOString().split('T')[0],
|
|
259
|
+
description: `Lead from market intelligence pipeline.\nIndustry: ${enrichedLead.industry || 'Unknown'}\nPain Point: ${enrichedLead.pain_point || 'TBD'}\nQuality Score: ${enrichedLead.score}%`,
|
|
260
|
+
metadata: {
|
|
261
|
+
leadScore: enrichedLead.score,
|
|
262
|
+
signalCount: enrichedLead.signalCount,
|
|
263
|
+
threatLevel: enrichedLead.threatLevel,
|
|
264
|
+
sources: enrichedLead.source ? [enrichedLead.source] : [],
|
|
265
|
+
enrichedAt: enrichedLead.enrichedAt || new Date().toISOString(),
|
|
266
|
+
},
|
|
267
|
+
};
|
|
268
|
+
|
|
269
|
+
return opportunity;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
/**
|
|
273
|
+
* Redact sensitive data before export
|
|
274
|
+
*/
|
|
275
|
+
private redactSensitiveData(opportunity: any): void {
|
|
276
|
+
// Remove internal metadata that shouldn't go to CRM
|
|
277
|
+
if (opportunity.metadata) {
|
|
278
|
+
delete opportunity.metadata.internalRiskFlags;
|
|
279
|
+
delete opportunity.metadata.internalConfidenceDetails;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
// Ensure PII is minimal
|
|
283
|
+
if (opportunity.description) {
|
|
284
|
+
// Remove email patterns
|
|
285
|
+
opportunity.description = opportunity.description.replace(
|
|
286
|
+
/[\w\.-]+@[\w\.-]+\.\w+/g,
|
|
287
|
+
'[EMAIL_REDACTED]'
|
|
288
|
+
);
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
/**
|
|
293
|
+
* Queue a Composio action
|
|
294
|
+
*/
|
|
295
|
+
private async queueComposioAction(
|
|
296
|
+
crmSystem: string,
|
|
297
|
+
workspaceId: string,
|
|
298
|
+
opportunity: CRMOpportunity
|
|
299
|
+
): Promise<{ recordId: string }> {
|
|
300
|
+
if (!this.composioClient) {
|
|
301
|
+
throw new Error('Composio client not configured');
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
// Map CRM system to Composio actions
|
|
305
|
+
const actionMap: Record<string, string> = {
|
|
306
|
+
salesforce: 'salesforce.create_opportunity',
|
|
307
|
+
hubspot: 'hubspot.create_deal',
|
|
308
|
+
};
|
|
309
|
+
|
|
310
|
+
const action = actionMap[crmSystem];
|
|
311
|
+
if (!action) {
|
|
312
|
+
throw new Error(`No Composio action mapping for ${crmSystem}`);
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
// Queue action via Composio (returns immediately, no execution)
|
|
316
|
+
const result = await this.composioClient.execute(
|
|
317
|
+
action,
|
|
318
|
+
{
|
|
319
|
+
workspace_id: workspaceId,
|
|
320
|
+
name: opportunity.name,
|
|
321
|
+
value: opportunity.value,
|
|
322
|
+
probability: opportunity.probability,
|
|
323
|
+
stage: opportunity.stage,
|
|
324
|
+
close_date: opportunity.closeDate,
|
|
325
|
+
description: opportunity.description,
|
|
326
|
+
metadata: JSON.stringify(opportunity.metadata),
|
|
327
|
+
},
|
|
328
|
+
{ require_approval: true } // Human gate enforced
|
|
329
|
+
);
|
|
330
|
+
|
|
331
|
+
return {
|
|
332
|
+
recordId: result.id || uuidv4(),
|
|
333
|
+
};
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
/**
|
|
337
|
+
* Get export history
|
|
338
|
+
*/
|
|
339
|
+
getExportHistory(filter?: {
|
|
340
|
+
leadId?: string;
|
|
341
|
+
crmSystem?: string;
|
|
342
|
+
status?: string;
|
|
343
|
+
}): ExportHistoryEntry[] {
|
|
344
|
+
let entries = Array.from(this.exportHistory.values());
|
|
345
|
+
|
|
346
|
+
if (filter?.leadId) {
|
|
347
|
+
entries = entries.filter((e) => e.leadId === filter.leadId);
|
|
348
|
+
}
|
|
349
|
+
if (filter?.crmSystem) {
|
|
350
|
+
entries = entries.filter((e) => e.crmSystem === filter.crmSystem);
|
|
351
|
+
}
|
|
352
|
+
if (filter?.status) {
|
|
353
|
+
entries = entries.filter((e) => e.status === filter.status);
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
return entries.sort((a, b) => new Date(b.exportedAt).getTime() - new Date(a.exportedAt).getTime());
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
/**
|
|
360
|
+
* Get export status by ID
|
|
361
|
+
*/
|
|
362
|
+
getExportStatus(exportId: string): ExportHistoryEntry | undefined {
|
|
363
|
+
return this.exportHistory.get(exportId);
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
/**
|
|
367
|
+
* Mark export as executed
|
|
368
|
+
*/
|
|
369
|
+
async markExecuted(exportId: string): Promise<void> {
|
|
370
|
+
const entry = this.exportHistory.get(exportId);
|
|
371
|
+
if (!entry) {
|
|
372
|
+
throw new Error(`Export not found: ${exportId}`);
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
entry.status = 'executed';
|
|
376
|
+
entry.executedAt = new Date().toISOString();
|
|
377
|
+
|
|
378
|
+
this.auditLogger.log({
|
|
379
|
+
event: 'export:executed',
|
|
380
|
+
exportId,
|
|
381
|
+
leadId: entry.leadId,
|
|
382
|
+
recordId: entry.recordId,
|
|
383
|
+
});
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
/**
|
|
387
|
+
* Get statistics
|
|
388
|
+
*/
|
|
389
|
+
getStats(): {
|
|
390
|
+
total: number;
|
|
391
|
+
queued: number;
|
|
392
|
+
approved: number;
|
|
393
|
+
executed: number;
|
|
394
|
+
failed: number;
|
|
395
|
+
} {
|
|
396
|
+
const entries = Array.from(this.exportHistory.values());
|
|
397
|
+
return {
|
|
398
|
+
total: entries.length,
|
|
399
|
+
queued: entries.filter((e) => e.status === 'queued').length,
|
|
400
|
+
approved: entries.filter((e) => e.status === 'approved').length,
|
|
401
|
+
executed: entries.filter((e) => e.status === 'executed').length,
|
|
402
|
+
failed: entries.filter((e) => e.status === 'failed').length,
|
|
403
|
+
};
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
export default CRMExporter;
|
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CRM Integration via Composio
|
|
3
|
+
* Support for Salesforce and HubSpot.
|
|
4
|
+
* Auto-create and score leads based on market intelligence findings.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import ComposioClient from './composioClient.js';
|
|
8
|
+
|
|
9
|
+
export type CRMPlatform = 'salesforce' | 'hubspot';
|
|
10
|
+
|
|
11
|
+
export interface CRMLead {
|
|
12
|
+
name: string;
|
|
13
|
+
email: string;
|
|
14
|
+
company: string;
|
|
15
|
+
industry?: string;
|
|
16
|
+
painPoint: string;
|
|
17
|
+
source: string; // e.g., "reddit_analysis", "hackernews_scan", "competitor_tracking"
|
|
18
|
+
signalStrength: number; // 0-100 score
|
|
19
|
+
customFields?: Record<string, any>;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
interface CRMLeadResponse {
|
|
23
|
+
leadId: string;
|
|
24
|
+
name: string;
|
|
25
|
+
company: string;
|
|
26
|
+
score: number;
|
|
27
|
+
status: 'created' | 'updated';
|
|
28
|
+
timestamp: string;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
interface LeadScoring {
|
|
32
|
+
baseScore: number;
|
|
33
|
+
signals: Record<string, number>;
|
|
34
|
+
totalScore: number;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* CRM integration for automated lead creation and management
|
|
39
|
+
*/
|
|
40
|
+
export class CRMIntegration {
|
|
41
|
+
private composio: ComposioClient;
|
|
42
|
+
private platform: CRMPlatform;
|
|
43
|
+
|
|
44
|
+
// Signal weights for auto-scoring (0-100)
|
|
45
|
+
private scoreWeights = {
|
|
46
|
+
signalStrength: 0.4, // 40% weight on provided signal strength
|
|
47
|
+
companySize: 0.2, // 20% for company scale
|
|
48
|
+
industryFit: 0.2, // 20% for industry relevance
|
|
49
|
+
urgency: 0.2 // 20% for urgency indicators
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
constructor(composio: ComposioClient, platform: CRMPlatform = 'salesforce') {
|
|
53
|
+
this.composio = composio;
|
|
54
|
+
this.platform = platform;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Create a new lead in CRM
|
|
59
|
+
* Auto-scores based on signal strength and context
|
|
60
|
+
*/
|
|
61
|
+
async createLead(lead: CRMLead): Promise<CRMLeadResponse> {
|
|
62
|
+
const score = this.calculateScore(lead);
|
|
63
|
+
|
|
64
|
+
const endpoint = `/integrations/${this.platform}/leads`;
|
|
65
|
+
const payload = this.formatLeadPayload(lead, score);
|
|
66
|
+
|
|
67
|
+
try {
|
|
68
|
+
const response = await this.composio.request(endpoint, 'POST', payload);
|
|
69
|
+
|
|
70
|
+
return {
|
|
71
|
+
leadId: response.id || response.leadId,
|
|
72
|
+
name: lead.name,
|
|
73
|
+
company: lead.company,
|
|
74
|
+
score: score.totalScore,
|
|
75
|
+
status: response.isNew ? 'created' : 'updated',
|
|
76
|
+
timestamp: new Date().toISOString()
|
|
77
|
+
};
|
|
78
|
+
} catch (error) {
|
|
79
|
+
throw new Error(`Failed to create lead in ${this.platform}: ${(error as Error).message}`);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Calculate lead score based on signals and context
|
|
85
|
+
*/
|
|
86
|
+
private calculateScore(lead: CRMLead): LeadScoring {
|
|
87
|
+
const signals: Record<string, number> = {};
|
|
88
|
+
|
|
89
|
+
// Signal strength (0-100)
|
|
90
|
+
signals.signalStrength = lead.signalStrength;
|
|
91
|
+
|
|
92
|
+
// Company size multiplier (rough estimation from company name patterns)
|
|
93
|
+
signals.companySize = this.estimateCompanySize(lead.company);
|
|
94
|
+
|
|
95
|
+
// Industry relevance (if known)
|
|
96
|
+
signals.industryFit = lead.industry ? 75 : 50;
|
|
97
|
+
|
|
98
|
+
// Urgency from pain point keywords
|
|
99
|
+
signals.urgency = this.extractUrgency(lead.painPoint);
|
|
100
|
+
|
|
101
|
+
// Calculate weighted total
|
|
102
|
+
const baseScore = 50; // Start at 50
|
|
103
|
+
let totalScore = baseScore;
|
|
104
|
+
|
|
105
|
+
for (const [key, weight] of Object.entries(this.scoreWeights)) {
|
|
106
|
+
const signalKey = key.replace(/([A-Z])/g, '_$1').toLowerCase().substring(1); // camelCase to snake_case
|
|
107
|
+
if (signalKey in signals) {
|
|
108
|
+
totalScore += (signals[signalKey] * weight) - 50 * weight;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
return {
|
|
113
|
+
baseScore,
|
|
114
|
+
signals,
|
|
115
|
+
totalScore: Math.min(100, Math.max(0, Math.round(totalScore)))
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Estimate company size from company name (rough heuristic)
|
|
121
|
+
*/
|
|
122
|
+
private estimateCompanySize(companyName: string): number {
|
|
123
|
+
const enterprise = ['Inc', 'Corp', 'Inc.', 'Corp.', 'Ltd'];
|
|
124
|
+
const startup = ['Startup', 'Labs', 'AI', 'io'];
|
|
125
|
+
|
|
126
|
+
const isEnterprise = enterprise.some(e => companyName.includes(e));
|
|
127
|
+
const isStartup = startup.some(s => companyName.includes(s));
|
|
128
|
+
|
|
129
|
+
if (isEnterprise) return 80;
|
|
130
|
+
if (isStartup) return 60;
|
|
131
|
+
return 50;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* Extract urgency score from pain point text
|
|
136
|
+
*/
|
|
137
|
+
private extractUrgency(painPoint: string): number {
|
|
138
|
+
const urgentKeywords = [
|
|
139
|
+
'critical', 'urgent', 'breaking', 'crisis', 'emergency',
|
|
140
|
+
'costly', 'revenue', 'security', 'compliance', 'legal'
|
|
141
|
+
];
|
|
142
|
+
|
|
143
|
+
const matchCount = urgentKeywords.filter(kw =>
|
|
144
|
+
painPoint.toLowerCase().includes(kw)
|
|
145
|
+
).length;
|
|
146
|
+
|
|
147
|
+
return Math.min(100, 50 + matchCount * 10);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* Format lead data for specific CRM platform
|
|
152
|
+
*/
|
|
153
|
+
private formatLeadPayload(lead: CRMLead, score: LeadScoring): any {
|
|
154
|
+
if (this.platform === 'salesforce') {
|
|
155
|
+
return {
|
|
156
|
+
FirstName: lead.name.split(' ')[0],
|
|
157
|
+
LastName: lead.name.split(' ').slice(1).join(' ') || 'Lead',
|
|
158
|
+
Email: lead.email,
|
|
159
|
+
Company: lead.company,
|
|
160
|
+
Industry: lead.industry || 'Technology',
|
|
161
|
+
Description: lead.painPoint,
|
|
162
|
+
LeadSource: lead.source,
|
|
163
|
+
Rating: this.scoreToRating(score.totalScore),
|
|
164
|
+
Lean_Claudient_Score__c: score.totalScore,
|
|
165
|
+
Custom_Fields__c: JSON.stringify(lead.customFields || {}),
|
|
166
|
+
...lead.customFields
|
|
167
|
+
};
|
|
168
|
+
} else if (this.platform === 'hubspot') {
|
|
169
|
+
return {
|
|
170
|
+
properties: [
|
|
171
|
+
{ name: 'firstname', value: lead.name.split(' ')[0] },
|
|
172
|
+
{ name: 'lastname', value: lead.name.split(' ').slice(1).join(' ') || 'Lead' },
|
|
173
|
+
{ name: 'email', value: lead.email },
|
|
174
|
+
{ name: 'company', value: lead.company },
|
|
175
|
+
{ name: 'industry', value: lead.industry || 'Technology' },
|
|
176
|
+
{ name: 'hs_lead_status', value: 'NEW' },
|
|
177
|
+
{ name: 'notes', value: lead.painPoint },
|
|
178
|
+
{ name: 'source', value: lead.source },
|
|
179
|
+
{ name: 'lean_claudient_score', value: score.totalScore.toString() }
|
|
180
|
+
]
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
throw new Error(`Unsupported CRM platform: ${this.platform}`);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* Convert numeric score to HubSpot/Salesforce rating
|
|
189
|
+
*/
|
|
190
|
+
private scoreToRating(score: number): string {
|
|
191
|
+
if (score >= 80) return 'Hot';
|
|
192
|
+
if (score >= 60) return 'Warm';
|
|
193
|
+
if (score >= 40) return 'Cold';
|
|
194
|
+
return 'Unqualified';
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* Batch create multiple leads
|
|
199
|
+
*/
|
|
200
|
+
async createLeadsBatch(leads: CRMLead[]): Promise<CRMLeadResponse[]> {
|
|
201
|
+
const results: CRMLeadResponse[] = [];
|
|
202
|
+
|
|
203
|
+
for (const lead of leads) {
|
|
204
|
+
try {
|
|
205
|
+
const result = await this.createLead(lead);
|
|
206
|
+
results.push(result);
|
|
207
|
+
} catch (error) {
|
|
208
|
+
console.error(`Failed to create lead for ${lead.name}:`, (error as Error).message);
|
|
209
|
+
results.push({
|
|
210
|
+
leadId: 'ERROR',
|
|
211
|
+
name: lead.name,
|
|
212
|
+
company: lead.company,
|
|
213
|
+
score: 0,
|
|
214
|
+
status: 'created',
|
|
215
|
+
timestamp: new Date().toISOString()
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
return results;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
/**
|
|
224
|
+
* Get lead details
|
|
225
|
+
*/
|
|
226
|
+
async getLead(leadId: string): Promise<any> {
|
|
227
|
+
try {
|
|
228
|
+
const response = await this.composio.request(
|
|
229
|
+
`/integrations/${this.platform}/leads/${leadId}`
|
|
230
|
+
);
|
|
231
|
+
return response;
|
|
232
|
+
} catch (error) {
|
|
233
|
+
throw new Error(`Failed to retrieve lead: ${(error as Error).message}`);
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
/**
|
|
238
|
+
* Update lead status
|
|
239
|
+
*/
|
|
240
|
+
async updateLeadStatus(leadId: string, status: string): Promise<{ success: boolean }> {
|
|
241
|
+
try {
|
|
242
|
+
await this.composio.request(
|
|
243
|
+
`/integrations/${this.platform}/leads/${leadId}`,
|
|
244
|
+
'PATCH',
|
|
245
|
+
{ status }
|
|
246
|
+
);
|
|
247
|
+
return { success: true };
|
|
248
|
+
} catch (error) {
|
|
249
|
+
throw new Error(`Failed to update lead: ${(error as Error).message}`);
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
/**
|
|
254
|
+
* Switch CRM platform
|
|
255
|
+
*/
|
|
256
|
+
switchPlatform(platform: CRMPlatform): void {
|
|
257
|
+
this.platform = platform;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
/**
|
|
261
|
+
* Get current platform
|
|
262
|
+
*/
|
|
263
|
+
getPlatform(): CRMPlatform {
|
|
264
|
+
return this.platform;
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
export default CRMIntegration;
|