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,278 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Job Queue for Background Tasks
|
|
3
|
+
* In-memory queue for pending jobs with execution logging
|
|
4
|
+
* Phase 8C Task 7
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
8
|
+
import { AuditLogger } from '../core/auditLogger.js';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Queued job
|
|
12
|
+
*/
|
|
13
|
+
export interface QueuedJob {
|
|
14
|
+
id: string;
|
|
15
|
+
name: string;
|
|
16
|
+
priority: 'high' | 'normal' | 'low';
|
|
17
|
+
payload?: Record<string, any>;
|
|
18
|
+
fn: () => Promise<void> | void;
|
|
19
|
+
createdAt: number;
|
|
20
|
+
executedAt?: number;
|
|
21
|
+
status: 'pending' | 'executing' | 'completed' | 'failed';
|
|
22
|
+
error?: string;
|
|
23
|
+
retryCount: number;
|
|
24
|
+
maxRetries: number;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Job queue statistics
|
|
29
|
+
*/
|
|
30
|
+
export interface QueueStats {
|
|
31
|
+
total: number;
|
|
32
|
+
pending: number;
|
|
33
|
+
executing: number;
|
|
34
|
+
completed: number;
|
|
35
|
+
failed: number;
|
|
36
|
+
avgExecutionTime: number;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Job Queue: Manages pending job execution
|
|
41
|
+
*/
|
|
42
|
+
export class JobQueue {
|
|
43
|
+
private queue: Map<string, QueuedJob> = new Map();
|
|
44
|
+
private executingJobs: Set<string> = new Set();
|
|
45
|
+
private completedJobs: Map<string, QueuedJob> = new Map();
|
|
46
|
+
private failedJobs: Map<string, QueuedJob> = new Map();
|
|
47
|
+
private auditLogger: AuditLogger;
|
|
48
|
+
private executionTimes: number[] = [];
|
|
49
|
+
|
|
50
|
+
constructor() {
|
|
51
|
+
this.auditLogger = new AuditLogger();
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Enqueue a new job
|
|
56
|
+
*/
|
|
57
|
+
enqueue(
|
|
58
|
+
name: string,
|
|
59
|
+
fn: () => Promise<void> | void,
|
|
60
|
+
options?: {
|
|
61
|
+
priority?: 'high' | 'normal' | 'low';
|
|
62
|
+
payload?: Record<string, any>;
|
|
63
|
+
maxRetries?: number;
|
|
64
|
+
}
|
|
65
|
+
): string {
|
|
66
|
+
const jobId = uuidv4();
|
|
67
|
+
const job: QueuedJob = {
|
|
68
|
+
id: jobId,
|
|
69
|
+
name,
|
|
70
|
+
priority: options?.priority || 'normal',
|
|
71
|
+
payload: options?.payload,
|
|
72
|
+
fn,
|
|
73
|
+
createdAt: Date.now(),
|
|
74
|
+
status: 'pending',
|
|
75
|
+
retryCount: 0,
|
|
76
|
+
maxRetries: options?.maxRetries || 3,
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
this.queue.set(jobId, job);
|
|
80
|
+
|
|
81
|
+
this.auditLogger.log({
|
|
82
|
+
event: 'job:enqueued',
|
|
83
|
+
jobId,
|
|
84
|
+
name,
|
|
85
|
+
priority: job.priority,
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
return jobId;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Dequeue and execute the next job
|
|
93
|
+
*/
|
|
94
|
+
async dequeue(): Promise<string | null> {
|
|
95
|
+
// Find next job by priority
|
|
96
|
+
let nextJobId: string | null = null;
|
|
97
|
+
let nextPriority: 'high' | 'normal' | 'low' | null = null;
|
|
98
|
+
|
|
99
|
+
for (const [id, job] of this.queue) {
|
|
100
|
+
if (job.status !== 'pending') continue;
|
|
101
|
+
|
|
102
|
+
const priority = job.priority;
|
|
103
|
+
if (!nextPriority || priority === 'high' || (priority === 'normal' && nextPriority === 'low')) {
|
|
104
|
+
nextJobId = id;
|
|
105
|
+
nextPriority = priority;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
if (!nextJobId) return null;
|
|
110
|
+
|
|
111
|
+
const job = this.queue.get(nextJobId)!;
|
|
112
|
+
job.status = 'executing';
|
|
113
|
+
this.executingJobs.add(nextJobId);
|
|
114
|
+
|
|
115
|
+
const startTime = Date.now();
|
|
116
|
+
|
|
117
|
+
try {
|
|
118
|
+
this.auditLogger.log({
|
|
119
|
+
event: 'job:executing',
|
|
120
|
+
jobId: nextJobId,
|
|
121
|
+
name: job.name,
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
await Promise.resolve(job.fn());
|
|
125
|
+
|
|
126
|
+
const executionTime = Date.now() - startTime;
|
|
127
|
+
this.executionTimes.push(executionTime);
|
|
128
|
+
|
|
129
|
+
// Trim execution times to last 100
|
|
130
|
+
if (this.executionTimes.length > 100) {
|
|
131
|
+
this.executionTimes.shift();
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
job.status = 'completed';
|
|
135
|
+
job.executedAt = Date.now();
|
|
136
|
+
this.executingJobs.delete(nextJobId);
|
|
137
|
+
this.completedJobs.set(nextJobId, job);
|
|
138
|
+
|
|
139
|
+
this.auditLogger.log({
|
|
140
|
+
event: 'job:completed',
|
|
141
|
+
jobId: nextJobId,
|
|
142
|
+
name: job.name,
|
|
143
|
+
executionTime,
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
// Remove from queue
|
|
147
|
+
this.queue.delete(nextJobId);
|
|
148
|
+
return nextJobId;
|
|
149
|
+
} catch (error) {
|
|
150
|
+
const errorMsg = error instanceof Error ? error.message : String(error);
|
|
151
|
+
job.retryCount++;
|
|
152
|
+
|
|
153
|
+
if (job.retryCount < job.maxRetries) {
|
|
154
|
+
job.status = 'pending';
|
|
155
|
+
this.auditLogger.log({
|
|
156
|
+
event: 'job:retry',
|
|
157
|
+
jobId: nextJobId,
|
|
158
|
+
name: job.name,
|
|
159
|
+
retryCount: job.retryCount,
|
|
160
|
+
error: errorMsg,
|
|
161
|
+
});
|
|
162
|
+
} else {
|
|
163
|
+
job.status = 'failed';
|
|
164
|
+
job.error = errorMsg;
|
|
165
|
+
this.executingJobs.delete(nextJobId);
|
|
166
|
+
this.failedJobs.set(nextJobId, job);
|
|
167
|
+
this.queue.delete(nextJobId);
|
|
168
|
+
|
|
169
|
+
this.auditLogger.log({
|
|
170
|
+
event: 'job:failed',
|
|
171
|
+
jobId: nextJobId,
|
|
172
|
+
name: job.name,
|
|
173
|
+
retryCount: job.retryCount,
|
|
174
|
+
error: errorMsg,
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
throw error;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* Get queue size by status
|
|
184
|
+
*/
|
|
185
|
+
getQueueSize(): { total: number; pending: number; executing: number } {
|
|
186
|
+
const pending = Array.from(this.queue.values()).filter((j) => j.status === 'pending').length;
|
|
187
|
+
const executing = this.executingJobs.size;
|
|
188
|
+
const total = this.queue.size;
|
|
189
|
+
|
|
190
|
+
return { total, pending, executing };
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* Get queue statistics
|
|
195
|
+
*/
|
|
196
|
+
getStats(): QueueStats {
|
|
197
|
+
const avgExecutionTime =
|
|
198
|
+
this.executionTimes.length > 0
|
|
199
|
+
? this.executionTimes.reduce((a, b) => a + b, 0) / this.executionTimes.length
|
|
200
|
+
: 0;
|
|
201
|
+
|
|
202
|
+
return {
|
|
203
|
+
total: this.queue.size + this.completedJobs.size + this.failedJobs.size,
|
|
204
|
+
pending: Array.from(this.queue.values()).filter((j) => j.status === 'pending').length,
|
|
205
|
+
executing: this.executingJobs.size,
|
|
206
|
+
completed: this.completedJobs.size,
|
|
207
|
+
failed: this.failedJobs.size,
|
|
208
|
+
avgExecutionTime,
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* Get job by ID
|
|
214
|
+
*/
|
|
215
|
+
getJob(jobId: string): QueuedJob | undefined {
|
|
216
|
+
return this.queue.get(jobId) || this.completedJobs.get(jobId) || this.failedJobs.get(jobId);
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* Clear all completed jobs
|
|
221
|
+
*/
|
|
222
|
+
clearCompleted(): number {
|
|
223
|
+
const count = this.completedJobs.size;
|
|
224
|
+
this.completedJobs.clear();
|
|
225
|
+
return count;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
* Clear all failed jobs
|
|
230
|
+
*/
|
|
231
|
+
clearFailed(): number {
|
|
232
|
+
const count = this.failedJobs.size;
|
|
233
|
+
this.failedJobs.clear();
|
|
234
|
+
return count;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
/**
|
|
238
|
+
* Cancel a pending job
|
|
239
|
+
*/
|
|
240
|
+
cancel(jobId: string): boolean {
|
|
241
|
+
const job = this.queue.get(jobId);
|
|
242
|
+
if (!job || job.status !== 'pending') {
|
|
243
|
+
return false;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
this.queue.delete(jobId);
|
|
247
|
+
this.auditLogger.log({
|
|
248
|
+
event: 'job:cancelled',
|
|
249
|
+
jobId,
|
|
250
|
+
name: job.name,
|
|
251
|
+
});
|
|
252
|
+
|
|
253
|
+
return true;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
/**
|
|
257
|
+
* Is job executing
|
|
258
|
+
*/
|
|
259
|
+
isExecuting(jobId: string): boolean {
|
|
260
|
+
return this.executingJobs.has(jobId);
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
/**
|
|
264
|
+
* Get all completed jobs
|
|
265
|
+
*/
|
|
266
|
+
getCompleted(): QueuedJob[] {
|
|
267
|
+
return Array.from(this.completedJobs.values());
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
/**
|
|
271
|
+
* Get all failed jobs
|
|
272
|
+
*/
|
|
273
|
+
getFailed(): QueuedJob[] {
|
|
274
|
+
return Array.from(this.failedJobs.values());
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
export default JobQueue;
|
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lead Qualification Workflow
|
|
3
|
+
* Automated stage transitions (cold → warm → hot → sales-ready)
|
|
4
|
+
* Composio integration for CRM export with human approval gate
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
8
|
+
import { AuditLogger } from '../core/auditLogger.js';
|
|
9
|
+
import ComposioClient from './composioClient.js';
|
|
10
|
+
import {
|
|
11
|
+
QualificationStage,
|
|
12
|
+
EnrichedLead,
|
|
13
|
+
RevenueProjection,
|
|
14
|
+
QualificationResult,
|
|
15
|
+
StageTransition,
|
|
16
|
+
evaluateStage,
|
|
17
|
+
calculateConfidence,
|
|
18
|
+
getNextAction,
|
|
19
|
+
identifyBlockers,
|
|
20
|
+
getComposioActionsForTransition,
|
|
21
|
+
isValidTransition,
|
|
22
|
+
getTransitionReason,
|
|
23
|
+
stageDefinitions,
|
|
24
|
+
} from './qualificationRules.js';
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Lead Qualifier: Main qualification engine
|
|
28
|
+
*/
|
|
29
|
+
export class LeadQualifier {
|
|
30
|
+
private auditLogger: AuditLogger;
|
|
31
|
+
private composioClient?: ComposioClient;
|
|
32
|
+
private transitions: Map<string, StageTransition> = new Map();
|
|
33
|
+
|
|
34
|
+
constructor(composioApiKey?: string) {
|
|
35
|
+
this.auditLogger = new AuditLogger();
|
|
36
|
+
|
|
37
|
+
if (composioApiKey) {
|
|
38
|
+
this.composioClient = new ComposioClient({
|
|
39
|
+
apiKey: composioApiKey,
|
|
40
|
+
baseUrl: 'https://api.composio.dev/api/v1',
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Qualify a single lead
|
|
47
|
+
*/
|
|
48
|
+
qualifyLead(
|
|
49
|
+
enrichedLead: EnrichedLead,
|
|
50
|
+
projection?: RevenueProjection
|
|
51
|
+
): QualificationResult {
|
|
52
|
+
const blockers = identifyBlockers(enrichedLead, projection);
|
|
53
|
+
const stage = evaluateStage(enrichedLead, projection, blockers);
|
|
54
|
+
const confidence = calculateConfidence(enrichedLead, stage);
|
|
55
|
+
const nextAction = getNextAction(stage);
|
|
56
|
+
|
|
57
|
+
const result: QualificationResult = {
|
|
58
|
+
leadId: enrichedLead.id,
|
|
59
|
+
stage,
|
|
60
|
+
confidence,
|
|
61
|
+
nextAction,
|
|
62
|
+
signals: enrichedLead.signals?.map((s) => s.type) || [],
|
|
63
|
+
blockers: blockers.length > 0 ? blockers : undefined,
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
// Log qualification
|
|
67
|
+
this.auditLogger.log({
|
|
68
|
+
event: 'lead:qualified',
|
|
69
|
+
leadId: enrichedLead.id,
|
|
70
|
+
stage,
|
|
71
|
+
confidence,
|
|
72
|
+
signalCount: enrichedLead.signalCount,
|
|
73
|
+
quality: enrichedLead.quality,
|
|
74
|
+
competitorThreat: enrichedLead.competitorThreat,
|
|
75
|
+
blockers,
|
|
76
|
+
nextAction,
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
return result;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Batch qualify multiple leads
|
|
84
|
+
*/
|
|
85
|
+
batchQualify(
|
|
86
|
+
enrichedLeads: EnrichedLead[],
|
|
87
|
+
projections?: Map<string, RevenueProjection>
|
|
88
|
+
): QualificationResult[] {
|
|
89
|
+
return enrichedLeads.map((lead) => {
|
|
90
|
+
const projection = projections?.get(lead.id);
|
|
91
|
+
return this.qualifyLead(lead, projection);
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Transition a lead to a new stage with validation
|
|
97
|
+
*/
|
|
98
|
+
async transitionLead(
|
|
99
|
+
leadId: string,
|
|
100
|
+
fromStage: QualificationStage,
|
|
101
|
+
toStage: QualificationStage,
|
|
102
|
+
lead: EnrichedLead,
|
|
103
|
+
reason?: string
|
|
104
|
+
): Promise<{ success: boolean; transition?: StageTransition; error?: string }> {
|
|
105
|
+
// Validate transition
|
|
106
|
+
if (!isValidTransition(fromStage, toStage)) {
|
|
107
|
+
const error = `Invalid transition from ${fromStage} to ${toStage}`;
|
|
108
|
+
this.auditLogger.log({
|
|
109
|
+
event: 'lead:transition-failed',
|
|
110
|
+
leadId,
|
|
111
|
+
fromStage,
|
|
112
|
+
toStage,
|
|
113
|
+
reason: error,
|
|
114
|
+
});
|
|
115
|
+
return { success: false, error };
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
// Create transition record
|
|
119
|
+
const transition: StageTransition = {
|
|
120
|
+
leadId,
|
|
121
|
+
fromStage,
|
|
122
|
+
toStage,
|
|
123
|
+
timestamp: new Date().toISOString(),
|
|
124
|
+
reason: reason || getTransitionReason(lead, fromStage, toStage),
|
|
125
|
+
composioActionsQueued: [],
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
try {
|
|
129
|
+
// Queue Composio actions if transitioning to hot or sales-ready
|
|
130
|
+
if (toStage === 'hot' || toStage === 'sales-ready') {
|
|
131
|
+
const actions = getComposioActionsForTransition(fromStage, toStage, lead);
|
|
132
|
+
transition.composioActionsQueued = actions;
|
|
133
|
+
|
|
134
|
+
if (this.composioClient && toStage === 'sales-ready') {
|
|
135
|
+
// Queue CRM export (no autonomous execution - human gate)
|
|
136
|
+
await this.queueComposioActions(leadId, actions, lead);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
// Store transition
|
|
141
|
+
this.transitions.set(leadId, transition);
|
|
142
|
+
|
|
143
|
+
// Log transition
|
|
144
|
+
this.auditLogger.log({
|
|
145
|
+
event: 'lead:transitioned',
|
|
146
|
+
leadId,
|
|
147
|
+
fromStage,
|
|
148
|
+
toStage,
|
|
149
|
+
reason: transition.reason,
|
|
150
|
+
composioActionsQueued: transition.composioActionsQueued,
|
|
151
|
+
timestamp: transition.timestamp,
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
return { success: true, transition };
|
|
155
|
+
} catch (error) {
|
|
156
|
+
const errorMsg = (error as Error).message;
|
|
157
|
+
this.auditLogger.log({
|
|
158
|
+
event: 'lead:transition-error',
|
|
159
|
+
leadId,
|
|
160
|
+
fromStage,
|
|
161
|
+
toStage,
|
|
162
|
+
error: errorMsg,
|
|
163
|
+
});
|
|
164
|
+
return { success: false, error: errorMsg };
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* Queue Composio actions for a lead (no execution, human approval required)
|
|
170
|
+
*/
|
|
171
|
+
private async queueComposioActions(
|
|
172
|
+
leadId: string,
|
|
173
|
+
actions: string[],
|
|
174
|
+
lead: EnrichedLead
|
|
175
|
+
): Promise<void> {
|
|
176
|
+
if (!this.composioClient) {
|
|
177
|
+
throw new Error('Composio client not configured');
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
for (const action of actions) {
|
|
181
|
+
if (action.startsWith('composio:')) {
|
|
182
|
+
const actionType = action.replace('composio:', '');
|
|
183
|
+
|
|
184
|
+
this.auditLogger.log({
|
|
185
|
+
event: 'composio:action-queued',
|
|
186
|
+
leadId,
|
|
187
|
+
actionType,
|
|
188
|
+
leadName: lead.name,
|
|
189
|
+
leadEmail: lead.email,
|
|
190
|
+
status: 'pending-approval',
|
|
191
|
+
timestamp: new Date().toISOString(),
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* Get transition history for a lead
|
|
199
|
+
*/
|
|
200
|
+
getTransitionHistory(leadId: string): StageTransition | undefined {
|
|
201
|
+
return this.transitions.get(leadId);
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* Get all transition records
|
|
206
|
+
*/
|
|
207
|
+
getAllTransitions(): StageTransition[] {
|
|
208
|
+
return Array.from(this.transitions.values());
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* Get stage definition metadata
|
|
213
|
+
*/
|
|
214
|
+
getStageDefinition(stage: QualificationStage): typeof stageDefinitions[QualificationStage] {
|
|
215
|
+
return stageDefinitions[stage];
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
/**
|
|
219
|
+
* Get summary of qualification stats
|
|
220
|
+
*/
|
|
221
|
+
getQualificationStats(results: QualificationResult[]): {
|
|
222
|
+
total: number;
|
|
223
|
+
byStageCounts: Record<QualificationStage, number>;
|
|
224
|
+
averageConfidence: number;
|
|
225
|
+
withBlockers: number;
|
|
226
|
+
} {
|
|
227
|
+
const byStageCounts: Record<QualificationStage, number> = {
|
|
228
|
+
cold: 0,
|
|
229
|
+
warm: 0,
|
|
230
|
+
hot: 0,
|
|
231
|
+
'sales-ready': 0,
|
|
232
|
+
};
|
|
233
|
+
|
|
234
|
+
let totalConfidence = 0;
|
|
235
|
+
let withBlockers = 0;
|
|
236
|
+
|
|
237
|
+
results.forEach((result) => {
|
|
238
|
+
byStageCounts[result.stage]++;
|
|
239
|
+
totalConfidence += result.confidence;
|
|
240
|
+
if (result.blockers && result.blockers.length > 0) {
|
|
241
|
+
withBlockers++;
|
|
242
|
+
}
|
|
243
|
+
});
|
|
244
|
+
|
|
245
|
+
return {
|
|
246
|
+
total: results.length,
|
|
247
|
+
byStageCounts,
|
|
248
|
+
averageConfidence: results.length > 0 ? totalConfidence / results.length : 0,
|
|
249
|
+
withBlockers,
|
|
250
|
+
};
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
/**
|
|
255
|
+
* Export singleton instance
|
|
256
|
+
*/
|
|
257
|
+
let qualifierInstance: LeadQualifier | null = null;
|
|
258
|
+
|
|
259
|
+
export function getLeadQualifier(composioApiKey?: string): LeadQualifier {
|
|
260
|
+
if (!qualifierInstance) {
|
|
261
|
+
qualifierInstance = new LeadQualifier(composioApiKey);
|
|
262
|
+
}
|
|
263
|
+
return qualifierInstance;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
export function resetLeadQualifier(): void {
|
|
267
|
+
qualifierInstance = null;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
export default LeadQualifier;
|