@higher.archi/boe 1.0.27 → 1.0.29

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.
Files changed (56) hide show
  1. package/dist/engines/decay/compiler.d.ts +11 -0
  2. package/dist/engines/decay/compiler.d.ts.map +1 -0
  3. package/dist/engines/decay/compiler.js +216 -0
  4. package/dist/engines/decay/compiler.js.map +1 -0
  5. package/dist/engines/decay/engine.d.ts +79 -0
  6. package/dist/engines/decay/engine.d.ts.map +1 -0
  7. package/dist/engines/decay/engine.js +159 -0
  8. package/dist/engines/decay/engine.js.map +1 -0
  9. package/dist/engines/decay/index.d.ts +9 -0
  10. package/dist/engines/decay/index.d.ts.map +1 -0
  11. package/dist/engines/decay/index.js +21 -0
  12. package/dist/engines/decay/index.js.map +1 -0
  13. package/dist/engines/decay/strategy.d.ts +21 -0
  14. package/dist/engines/decay/strategy.d.ts.map +1 -0
  15. package/dist/engines/decay/strategy.js +308 -0
  16. package/dist/engines/decay/strategy.js.map +1 -0
  17. package/dist/engines/decay/types.d.ts +157 -0
  18. package/dist/engines/decay/types.d.ts.map +1 -0
  19. package/dist/engines/decay/types.js +39 -0
  20. package/dist/engines/decay/types.js.map +1 -0
  21. package/dist/engines/negotiation/compiler.d.ts +11 -0
  22. package/dist/engines/negotiation/compiler.d.ts.map +1 -0
  23. package/dist/engines/negotiation/compiler.js +177 -0
  24. package/dist/engines/negotiation/compiler.js.map +1 -0
  25. package/dist/engines/negotiation/engine.d.ts +46 -0
  26. package/dist/engines/negotiation/engine.d.ts.map +1 -0
  27. package/dist/engines/negotiation/engine.js +88 -0
  28. package/dist/engines/negotiation/engine.js.map +1 -0
  29. package/dist/engines/negotiation/index.d.ts +8 -0
  30. package/dist/engines/negotiation/index.d.ts.map +1 -0
  31. package/dist/engines/negotiation/index.js +17 -0
  32. package/dist/engines/negotiation/index.js.map +1 -0
  33. package/dist/engines/negotiation/strategy.d.ts +18 -0
  34. package/dist/engines/negotiation/strategy.d.ts.map +1 -0
  35. package/dist/engines/negotiation/strategy.js +439 -0
  36. package/dist/engines/negotiation/strategy.js.map +1 -0
  37. package/dist/engines/negotiation/types.d.ts +179 -0
  38. package/dist/engines/negotiation/types.d.ts.map +1 -0
  39. package/dist/engines/negotiation/types.js +10 -0
  40. package/dist/engines/negotiation/types.js.map +1 -0
  41. package/dist/index.d.ts +6 -0
  42. package/dist/index.d.ts.map +1 -1
  43. package/dist/index.js +22 -6
  44. package/dist/index.js.map +1 -1
  45. package/package.json +1 -1
  46. package/src/engines/decay/compiler.ts +276 -0
  47. package/src/engines/decay/engine.ts +211 -0
  48. package/src/engines/decay/index.ts +43 -0
  49. package/src/engines/decay/strategy.ts +433 -0
  50. package/src/engines/decay/types.ts +231 -0
  51. package/src/engines/negotiation/compiler.ts +229 -0
  52. package/src/engines/negotiation/engine.ts +117 -0
  53. package/src/engines/negotiation/index.ts +42 -0
  54. package/src/engines/negotiation/strategy.ts +587 -0
  55. package/src/engines/negotiation/types.ts +244 -0
  56. package/src/index.ts +69 -0
package/dist/index.d.ts CHANGED
@@ -26,6 +26,8 @@ export { UtilityEngine } from './engines/utility';
26
26
  export { PricingEngine } from './engines/pricing';
27
27
  export { EnsembleEngine } from './engines/ensemble';
28
28
  export { SentimentEngine } from './engines/sentiment';
29
+ export { NegotiationEngine } from './engines/negotiation';
30
+ export { DecayEngine } from './engines/decay';
29
31
  export * from './core';
30
32
  export { ForwardChainingStrategy, compileForwardRuleSet, compileForwardRule, forwardStrategy } from './engines/forward';
31
33
  export type { ForwardRule, ForwardRuleSet, ForwardConfig, CompiledForwardRuleSet, CompiledForwardRule, ForwardOptions, ForwardResult, ActionRegistry, ActionHandler } from './engines/forward';
@@ -62,6 +64,10 @@ export { PredictionEngine, PredictionExecutor, compilePredictionRuleSet, predict
62
64
  export type { PredictionStrategy, TrendDirection, SmoothingPreset, HorizonPreset, ConfidenceBracket, FieldMapping, ThresholdDefinition, LinearRegressionConfig, ExponentialSmoothingConfig, WeightedMovingAverageConfig, LinearRegressionRuleSet, ExponentialSmoothingRuleSet, WeightedMovingAverageRuleSet, PredictionRuleSet, CompiledLinearRegressionRuleSet, CompiledExponentialSmoothingRuleSet, CompiledWeightedMovingAverageRuleSet, CompiledPredictionRuleSet, ThresholdCrossing, Forecast, EntityPrediction, PredictionResult, PredictionOptions } from './engines/prediction';
63
65
  export { SentimentExecutor, compileSentimentRuleSet, sentimentStrategy, SENTIMENT_DEFAULTS, resolveSentimentLabel } from './engines/sentiment';
64
66
  export type { SentimentStrategy, SentimentLabel, SentimentLexicon, CompiledSentimentLexicon, SentimentConfig, TokenLevelSentimentRuleSet, DocumentLevelSentimentRuleSet, AspectBasedSentimentRuleSet, SentimentRuleSet, CompiledTokenLevelSentimentRuleSet, CompiledDocumentLevelSentimentRuleSet, CompiledAspectBasedSentimentRuleSet, CompiledSentimentRuleSet, TokenModifier, TokenScore, SentenceResult, AspectResult, SentimentResult, SentimentOptions, IngestResult } from './engines/sentiment';
67
+ export { NegotiationExecutor, compileNegotiationRuleSet, negotiationStrategy } from './engines/negotiation';
68
+ export type { NegotiationStrategy, ConcessionStyle, DealOutcome, DimensionDirection, NegotiationDimension, PartyPosition, PartyProfile, ValueFunction, CompiledValueFunction, CompiledPartyProfile, ZopaAnalysisConfig, ConcessionPlanningConfig, PackageOptimizationConfig, ZopaAnalysisRuleSet, ConcessionPlanningRuleSet, PackageOptimizationRuleSet, NegotiationRuleSet, CompiledZopaAnalysisRuleSet, CompiledConcessionPlanningRuleSet, CompiledPackageOptimizationRuleSet, CompiledNegotiationRuleSet, ZopaRange, ConcessionStep, PackageCandidate, NegotiationResult, NegotiationOptions } from './engines/negotiation';
69
+ export { DecayExecutor, compileDecayRuleSet, decayStrategy, URGENCY_THRESHOLDS, resolveUrgencyTier } from './engines/decay';
70
+ export type { DecayStrategy, UrgencyTier, ReEngagementEffect, DecayAggregation, DecayDimension, CompiledDecayDimension, ReEngagementRule, SingleDimensionDecayRuleSet, MultiDimensionDecayRuleSet, EventDrivenDecayRuleSet, DecayRuleSet, CompiledSingleDimensionDecayRuleSet, CompiledMultiDimensionDecayRuleSet, CompiledEventDrivenDecayRuleSet, CompiledDecayRuleSet, DimensionDecayResult, ReEngagementEvent, EntityDecayResult, DecayResult, DecayOptions, DecayIngestResult } from './engines/decay';
65
71
  export { soundex, nysiis, caverphone2, cosineSimilarity } from './functions';
66
72
  export { BOEError, CompilationError, RuntimeError } from './core/errors';
67
73
  export type { ErrorContext } from './core/errors';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAOH,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAMtD,cAAc,QAAQ,CAAC;AAOvB,OAAO,EACL,uBAAuB,EACvB,qBAAqB,EACrB,kBAAkB,EAClB,eAAe,EAChB,MAAM,mBAAmB,CAAC;AAC3B,YAAY,EACV,WAAW,EACX,cAAc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;AAM5B,cAAc,WAAW,CAAC;AAM1B,cAAc,aAAa,CAAC"}
package/dist/index.js CHANGED
@@ -29,9 +29,9 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
29
29
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
30
30
  };
31
31
  Object.defineProperty(exports, "__esModule", { value: true });
32
- exports.SEMANTIC_WEIGHTS = exports.constraintStrategy = exports.compileConstraintRuleSet = exports.ConstraintStrategy = exports.stateMachineStrategy = exports.compileStateMachineDefinition = exports.compileStateMachine = exports.StateMachineStrategy = exports.monteCarloStrategy = exports.compileMonteCarloRuleSet = exports.MonteCarloStrategy = exports.SEMANTIC_LIKELIHOODS = exports.parseLikelihood = exports.bayesianStrategy = exports.compileBayesianRule = exports.compileBayesianRuleSet = exports.BayesianStrategy = exports.autoAdjustCoverage = exports.analyzeCoverage = exports.compileFuzzyVariable = exports.fuzzyStrategy = exports.compileFuzzyRuleSet = exports.FuzzyStrategy = exports.sequentialStrategy = exports.compileSequentialRuleSet = exports.SequentialStrategy = exports.createScoreFunction = exports.scoringStrategy = exports.compileScoringRuleSet = exports.ScoringStrategy = exports.backwardStrategy = exports.compileBackwardRuleSet = exports.BackwardChainingStrategy = exports.forwardStrategy = exports.compileForwardRule = exports.compileForwardRuleSet = exports.ForwardChainingStrategy = exports.SentimentEngine = exports.EnsembleEngine = exports.PricingEngine = exports.UtilityEngine = exports.ConstraintEngine = exports.StateMachineEngine = exports.MonteCarloEngine = exports.BayesianEngine = exports.FuzzyEngine = exports.SequentialEngine = exports.ScoringEngine = exports.BackwardEngine = exports.ForwardEngine = void 0;
33
- exports.compilePredictionRuleSet = exports.PredictionExecutor = exports.PredictionEngine = exports.resolveMovement = exports.resolvePercentileLabel = exports.isKFactorPreset = exports.K_FACTOR_VALUES = exports.rankingStrategy = exports.compileRankingRuleSet = exports.RankingExecutor = exports.RankingEngine = exports.scoringMember = exports.expertMember = exports.monteCarloMember = exports.fuzzyMember = exports.bayesianMember = exports.summarizeEnsemble = exports.ensembleStrategy = exports.compileEnsembleRuleSet = exports.EnsembleStrategy = exports.getCurrencyInfo = exports.CURRENCIES = exports.applyMinMax = exports.calculateDiscount = exports.round = exports.formatPercent = exports.formatNumber = exports.formatCurrency = exports.calculateVolume = exports.calculateGraduated = exports.calculateFlat = exports.pricingEngine = exports.pricingStrategy = exports.compilePricingRule = exports.compilePricingRuleSet = exports.PricingStrategy = exports.buildAvailableRefs = exports.hasInterpolation = exports.interpolate = exports.compileTemplate = exports.expertStrategy = exports.compileExpertRuleSet = exports.ExpertStrategy = exports.ExpertEngine = exports.compileDefeasibleRuleSet = exports.DefeasibleEngine = exports.utilityStrategy = exports.compileUtilityRule = exports.compileUtilityRuleSet = exports.UtilityStrategy = void 0;
34
- exports.resolveDecayTimestamp = exports.calculateDecayMultiplier = exports.RuntimeError = exports.CompilationError = exports.BOEError = exports.cosineSimilarity = exports.caverphone2 = exports.nysiis = exports.soundex = exports.resolveSentimentLabel = exports.SENTIMENT_DEFAULTS = exports.sentimentStrategy = exports.compileSentimentRuleSet = exports.SentimentExecutor = exports.resolveTrendDirection = exports.resolveConfidenceBracket = exports.isHorizonPreset = exports.isSmoothingPreset = exports.HORIZON_PRESET_VALUES = exports.SMOOTHING_PRESET_VALUES = exports.predictionStrategy = void 0;
32
+ exports.compileConstraintRuleSet = exports.ConstraintStrategy = exports.stateMachineStrategy = exports.compileStateMachineDefinition = exports.compileStateMachine = exports.StateMachineStrategy = exports.monteCarloStrategy = exports.compileMonteCarloRuleSet = exports.MonteCarloStrategy = exports.SEMANTIC_LIKELIHOODS = exports.parseLikelihood = exports.bayesianStrategy = exports.compileBayesianRule = exports.compileBayesianRuleSet = exports.BayesianStrategy = exports.autoAdjustCoverage = exports.analyzeCoverage = exports.compileFuzzyVariable = exports.fuzzyStrategy = exports.compileFuzzyRuleSet = exports.FuzzyStrategy = exports.sequentialStrategy = exports.compileSequentialRuleSet = exports.SequentialStrategy = exports.createScoreFunction = exports.scoringStrategy = exports.compileScoringRuleSet = exports.ScoringStrategy = exports.backwardStrategy = exports.compileBackwardRuleSet = exports.BackwardChainingStrategy = exports.forwardStrategy = exports.compileForwardRule = exports.compileForwardRuleSet = exports.ForwardChainingStrategy = exports.DecayEngine = exports.NegotiationEngine = exports.SentimentEngine = exports.EnsembleEngine = exports.PricingEngine = exports.UtilityEngine = exports.ConstraintEngine = exports.StateMachineEngine = exports.MonteCarloEngine = exports.BayesianEngine = exports.FuzzyEngine = exports.SequentialEngine = exports.ScoringEngine = exports.BackwardEngine = exports.ForwardEngine = void 0;
33
+ exports.PredictionEngine = exports.resolveMovement = exports.resolvePercentileLabel = exports.isKFactorPreset = exports.K_FACTOR_VALUES = exports.rankingStrategy = exports.compileRankingRuleSet = exports.RankingExecutor = exports.RankingEngine = exports.scoringMember = exports.expertMember = exports.monteCarloMember = exports.fuzzyMember = exports.bayesianMember = exports.summarizeEnsemble = exports.ensembleStrategy = exports.compileEnsembleRuleSet = exports.EnsembleStrategy = exports.getCurrencyInfo = exports.CURRENCIES = exports.applyMinMax = exports.calculateDiscount = exports.round = exports.formatPercent = exports.formatNumber = exports.formatCurrency = exports.calculateVolume = exports.calculateGraduated = exports.calculateFlat = exports.pricingEngine = exports.pricingStrategy = exports.compilePricingRule = exports.compilePricingRuleSet = exports.PricingStrategy = exports.buildAvailableRefs = exports.hasInterpolation = exports.interpolate = exports.compileTemplate = exports.expertStrategy = exports.compileExpertRuleSet = exports.ExpertStrategy = exports.ExpertEngine = exports.compileDefeasibleRuleSet = exports.DefeasibleEngine = exports.utilityStrategy = exports.compileUtilityRule = exports.compileUtilityRuleSet = exports.UtilityStrategy = exports.SEMANTIC_WEIGHTS = exports.constraintStrategy = void 0;
34
+ exports.resolveDecayTimestamp = exports.calculateDecayMultiplier = exports.RuntimeError = exports.CompilationError = exports.BOEError = exports.cosineSimilarity = exports.caverphone2 = exports.nysiis = exports.soundex = exports.resolveUrgencyTier = exports.URGENCY_THRESHOLDS = exports.decayStrategy = exports.compileDecayRuleSet = exports.DecayExecutor = exports.negotiationStrategy = exports.compileNegotiationRuleSet = exports.NegotiationExecutor = exports.resolveSentimentLabel = exports.SENTIMENT_DEFAULTS = exports.sentimentStrategy = exports.compileSentimentRuleSet = exports.SentimentExecutor = exports.resolveTrendDirection = exports.resolveConfidenceBracket = exports.isHorizonPreset = exports.isSmoothingPreset = exports.HORIZON_PRESET_VALUES = exports.SMOOTHING_PRESET_VALUES = exports.predictionStrategy = exports.compilePredictionRuleSet = exports.PredictionExecutor = void 0;
35
35
  // ========================================
36
36
  // Engines
37
37
  // ========================================
@@ -62,6 +62,10 @@ var ensemble_1 = require("./engines/ensemble");
62
62
  Object.defineProperty(exports, "EnsembleEngine", { enumerable: true, get: function () { return ensemble_1.EnsembleEngine; } });
63
63
  var sentiment_1 = require("./engines/sentiment");
64
64
  Object.defineProperty(exports, "SentimentEngine", { enumerable: true, get: function () { return sentiment_1.SentimentEngine; } });
65
+ var negotiation_1 = require("./engines/negotiation");
66
+ Object.defineProperty(exports, "NegotiationEngine", { enumerable: true, get: function () { return negotiation_1.NegotiationEngine; } });
67
+ var decay_1 = require("./engines/decay");
68
+ Object.defineProperty(exports, "DecayEngine", { enumerable: true, get: function () { return decay_1.DecayEngine; } });
65
69
  // ========================================
66
70
  // Core Types & Utilities
67
71
  // ========================================
@@ -207,6 +211,18 @@ Object.defineProperty(exports, "compileSentimentRuleSet", { enumerable: true, ge
207
211
  Object.defineProperty(exports, "sentimentStrategy", { enumerable: true, get: function () { return sentiment_2.sentimentStrategy; } });
208
212
  Object.defineProperty(exports, "SENTIMENT_DEFAULTS", { enumerable: true, get: function () { return sentiment_2.SENTIMENT_DEFAULTS; } });
209
213
  Object.defineProperty(exports, "resolveSentimentLabel", { enumerable: true, get: function () { return sentiment_2.resolveSentimentLabel; } });
214
+ // Negotiation
215
+ var negotiation_2 = require("./engines/negotiation");
216
+ Object.defineProperty(exports, "NegotiationExecutor", { enumerable: true, get: function () { return negotiation_2.NegotiationExecutor; } });
217
+ Object.defineProperty(exports, "compileNegotiationRuleSet", { enumerable: true, get: function () { return negotiation_2.compileNegotiationRuleSet; } });
218
+ Object.defineProperty(exports, "negotiationStrategy", { enumerable: true, get: function () { return negotiation_2.negotiationStrategy; } });
219
+ // Decay
220
+ var decay_2 = require("./engines/decay");
221
+ Object.defineProperty(exports, "DecayExecutor", { enumerable: true, get: function () { return decay_2.DecayExecutor; } });
222
+ Object.defineProperty(exports, "compileDecayRuleSet", { enumerable: true, get: function () { return decay_2.compileDecayRuleSet; } });
223
+ Object.defineProperty(exports, "decayStrategy", { enumerable: true, get: function () { return decay_2.decayStrategy; } });
224
+ Object.defineProperty(exports, "URGENCY_THRESHOLDS", { enumerable: true, get: function () { return decay_2.URGENCY_THRESHOLDS; } });
225
+ Object.defineProperty(exports, "resolveUrgencyTier", { enumerable: true, get: function () { return decay_2.resolveUrgencyTier; } });
210
226
  // ========================================
211
227
  // Utility Functions (from old modules, re-exported for convenience)
212
228
  // ========================================
@@ -221,9 +237,9 @@ Object.defineProperty(exports, "BOEError", { enumerable: true, get: function ()
221
237
  Object.defineProperty(exports, "CompilationError", { enumerable: true, get: function () { return errors_1.CompilationError; } });
222
238
  Object.defineProperty(exports, "RuntimeError", { enumerable: true, get: function () { return errors_1.RuntimeError; } });
223
239
  // Temporal Decay (re-exported from core for convenience)
224
- var decay_1 = require("./core/evaluation/decay");
225
- Object.defineProperty(exports, "calculateDecayMultiplier", { enumerable: true, get: function () { return decay_1.calculateDecayMultiplier; } });
226
- Object.defineProperty(exports, "resolveDecayTimestamp", { enumerable: true, get: function () { return decay_1.resolveDecayTimestamp; } });
240
+ var decay_3 = require("./core/evaluation/decay");
241
+ Object.defineProperty(exports, "calculateDecayMultiplier", { enumerable: true, get: function () { return decay_3.calculateDecayMultiplier; } });
242
+ Object.defineProperty(exports, "resolveDecayTimestamp", { enumerable: true, get: function () { return decay_3.resolveDecayTimestamp; } });
227
243
  // ========================================
228
244
  // QFacts - Probabilistic Fact Hydration
229
245
  // ========================================
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;;;;;;;;;;;;;;;;;AAEH,2CAA2C;AAC3C,UAAU;AACV,2CAA2C;AAE3C,iEAAiE;AACjE,6CAAkD;AAAzC,wGAAA,aAAa,OAAA;AACtB,+CAAoD;AAA3C,0GAAA,cAAc,OAAA;AACvB,6CAAkD;AAAzC,wGAAA,aAAa,OAAA;AACtB,mDAAwD;AAA/C,8GAAA,gBAAgB,OAAA;AACzB,yCAA8C;AAArC,oGAAA,WAAW,OAAA;AACpB,+CAAoD;AAA3C,0GAAA,cAAc,OAAA;AACvB,qDAAyD;AAAhD,+GAAA,gBAAgB,OAAA;AACzB,yDAA6D;AAApD,mHAAA,kBAAkB,OAAA;AAC3B,mDAAwD;AAA/C,8GAAA,gBAAgB,OAAA;AACzB,6CAAkD;AAAzC,wGAAA,aAAa,OAAA;AACtB,6CAAkD;AAAzC,wGAAA,aAAa,OAAA;AACtB,+CAAoD;AAA3C,0GAAA,cAAc,OAAA;AACvB,iDAAsD;AAA7C,4GAAA,eAAe,OAAA;AAExB,2CAA2C;AAC3C,yBAAyB;AACzB,2CAA2C;AAE3C,yCAAuB;AAEvB,2CAA2C;AAC3C,UAAU;AACV,2CAA2C;AAE3C,mBAAmB;AACnB,6CAK2B;AAJzB,kHAAA,uBAAuB,OAAA;AACvB,gHAAA,qBAAqB,OAAA;AACrB,6GAAA,kBAAkB,OAAA;AAClB,0GAAA,eAAe,OAAA;AAcjB,oBAAoB;AACpB,+CAI4B;AAH1B,oHAAA,wBAAwB,OAAA;AACxB,kHAAA,sBAAsB,OAAA;AACtB,4GAAA,gBAAgB,OAAA;AAalB,UAAU;AACV,6CAK2B;AAJzB,0GAAA,eAAe,OAAA;AACf,gHAAA,qBAAqB,OAAA;AACrB,0GAAA,eAAe,OAAA;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ACZ,iDAM6B;AAL3B,8GAAA,iBAAiB,OAAA;AACjB,oHAAA,uBAAuB,OAAA;AACvB,8GAAA,iBAAiB,OAAA;AACjB,+GAAA,kBAAkB,OAAA;AAClB,kHAAA,qBAAqB,OAAA;AAyBvB,cAAc;AACd,qDAI+B;AAH7B,kHAAA,mBAAmB,OAAA;AACnB,wHAAA,yBAAyB,OAAA;AACzB,kHAAA,mBAAmB,OAAA;AA+BrB,QAAQ;AACR,yCAMyB;AALvB,sGAAA,aAAa,OAAA;AACb,4GAAA,mBAAmB,OAAA;AACnB,sGAAA,aAAa,OAAA;AACb,2GAAA,kBAAkB,OAAA;AAClB,2GAAA,kBAAkB,OAAA;AA0BpB,2CAA2C;AAC3C,oEAAoE;AACpE,2CAA2C;AAE3C,yCAA6E;AAApE,oGAAA,OAAO,OAAA;AAAE,mGAAA,MAAM,OAAA;AAAE,wGAAA,WAAW,OAAA;AAAE,6GAAA,gBAAgB,OAAA;AAEvD,uDAAuD;AACvD,wCAAyE;AAAhE,kGAAA,QAAQ,OAAA;AAAE,0GAAA,gBAAgB,OAAA;AAAE,sGAAA,YAAY,OAAA;AAGjD,yDAAyD;AACzD,iDAGiC;AAF/B,iHAAA,wBAAwB,OAAA;AACxB,8GAAA,qBAAqB,OAAA;AASvB,2CAA2C;AAC3C,wCAAwC;AACxC,2CAA2C;AAE3C,2CAAyB;AAEzB,2CAA2C;AAC3C,iDAAiD;AACjD,2CAA2C;AAE3C,8CAA4B;AAE5B,2CAA2C;AAC3C,uCAAuC;AACvC,2CAA2C;AAE3C,4CAA0B;AAE1B,2CAA2C;AAC3C,8CAA8C;AAC9C,2CAA2C;AAE3C,8CAA4B"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@higher.archi/boe",
3
- "version": "1.0.27",
3
+ "version": "1.0.29",
4
4
  "description": "A multi-strategy rule engine supporting forward chaining, backward chaining, scoring, sequential, fuzzy logic, and Bayesian inference",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -0,0 +1,276 @@
1
+ /**
2
+ * Decay Engine Compiler
3
+ *
4
+ * Validates decay rulesets and resolves defaults.
5
+ */
6
+
7
+ import { CompilationError } from '../../core/errors';
8
+ import { SEMANTIC_PRIORITY_VALUES, isSemanticPriority, type SemanticPriority } from '../utility/types';
9
+
10
+ import type {
11
+ DecayRuleSet,
12
+ CompiledDecayRuleSet,
13
+ CompiledSingleDimensionDecayRuleSet,
14
+ CompiledMultiDimensionDecayRuleSet,
15
+ CompiledEventDrivenDecayRuleSet,
16
+ CompiledDecayDimension,
17
+ DecayDimension,
18
+ ReEngagementRule,
19
+ UrgencyTier
20
+ } from './types';
21
+ import { URGENCY_THRESHOLDS } from './types';
22
+
23
+ /**
24
+ * Compile and validate a decay ruleset.
25
+ */
26
+ export function compileDecayRuleSet(
27
+ ruleSet: DecayRuleSet
28
+ ): CompiledDecayRuleSet {
29
+ if (!ruleSet.id) {
30
+ throw new CompilationError('Decay ruleset requires an id');
31
+ }
32
+
33
+ if (ruleSet.mode !== 'decay') {
34
+ throw new CompilationError(`Expected mode 'decay', got '${ruleSet.mode}'`);
35
+ }
36
+
37
+ if (!ruleSet.entityType || ruleSet.entityType.trim() === '') {
38
+ throw new CompilationError('entityType is required and must be non-empty');
39
+ }
40
+
41
+ const entityIdField = ruleSet.entityIdField ?? 'id';
42
+ const urgencyThresholds = resolveUrgencyThresholds(ruleSet.urgencyThresholds);
43
+
44
+ switch (ruleSet.strategy) {
45
+ case 'single-dimension':
46
+ return compileSingleDimension(ruleSet, entityIdField, urgencyThresholds);
47
+ case 'multi-dimension':
48
+ return compileMultiDimension(ruleSet, entityIdField, urgencyThresholds);
49
+ case 'event-driven':
50
+ return compileEventDriven(ruleSet, entityIdField, urgencyThresholds);
51
+ default:
52
+ throw new CompilationError(`Unknown decay strategy: '${(ruleSet as any).strategy}'`);
53
+ }
54
+ }
55
+
56
+ // ========================================
57
+ // Strategy-Specific Compilers
58
+ // ========================================
59
+
60
+ function compileSingleDimension(
61
+ ruleSet: DecayRuleSet & { strategy: 'single-dimension' },
62
+ entityIdField: string,
63
+ urgencyThresholds: Record<UrgencyTier, number>
64
+ ): CompiledSingleDimensionDecayRuleSet {
65
+ const dimension = ruleSet.dimension;
66
+ if (!dimension) {
67
+ throw new CompilationError('Single-dimension strategy requires a dimension');
68
+ }
69
+
70
+ validateDimension(dimension);
71
+
72
+ return {
73
+ id: ruleSet.id,
74
+ name: ruleSet.name,
75
+ mode: 'decay',
76
+ strategy: 'single-dimension',
77
+ entityType: ruleSet.entityType,
78
+ entityIdField,
79
+ urgencyThresholds,
80
+ dimension: compileDimension(dimension, 1.0)
81
+ };
82
+ }
83
+
84
+ function compileMultiDimension(
85
+ ruleSet: DecayRuleSet & { strategy: 'multi-dimension' },
86
+ entityIdField: string,
87
+ urgencyThresholds: Record<UrgencyTier, number>
88
+ ): CompiledMultiDimensionDecayRuleSet {
89
+ const { dimensions } = ruleSet;
90
+
91
+ if (!dimensions || !Array.isArray(dimensions) || dimensions.length === 0) {
92
+ throw new CompilationError('Multi-dimension strategy requires at least one dimension');
93
+ }
94
+
95
+ validateDimensionIds(dimensions);
96
+ for (const dim of dimensions) {
97
+ validateDimension(dim);
98
+ }
99
+
100
+ const compiledDimensions = compileDimensions(dimensions);
101
+
102
+ return {
103
+ id: ruleSet.id,
104
+ name: ruleSet.name,
105
+ mode: 'decay',
106
+ strategy: 'multi-dimension',
107
+ entityType: ruleSet.entityType,
108
+ entityIdField,
109
+ urgencyThresholds,
110
+ dimensions: compiledDimensions,
111
+ aggregation: ruleSet.aggregation ?? 'weighted-average'
112
+ };
113
+ }
114
+
115
+ function compileEventDriven(
116
+ ruleSet: DecayRuleSet & { strategy: 'event-driven' },
117
+ entityIdField: string,
118
+ urgencyThresholds: Record<UrgencyTier, number>
119
+ ): CompiledEventDrivenDecayRuleSet {
120
+ const { dimensions, reEngagementRules } = ruleSet;
121
+
122
+ if (!dimensions || !Array.isArray(dimensions) || dimensions.length === 0) {
123
+ throw new CompilationError('Event-driven strategy requires at least one dimension');
124
+ }
125
+
126
+ validateDimensionIds(dimensions);
127
+ for (const dim of dimensions) {
128
+ validateDimension(dim);
129
+ }
130
+
131
+ if (!reEngagementRules || !Array.isArray(reEngagementRules) || reEngagementRules.length === 0) {
132
+ throw new CompilationError('Event-driven strategy requires at least one re-engagement rule');
133
+ }
134
+
135
+ validateReEngagementRules(reEngagementRules);
136
+
137
+ const compiledDimensions = compileDimensions(dimensions);
138
+
139
+ return {
140
+ id: ruleSet.id,
141
+ name: ruleSet.name,
142
+ mode: 'decay',
143
+ strategy: 'event-driven',
144
+ entityType: ruleSet.entityType,
145
+ entityIdField,
146
+ urgencyThresholds,
147
+ dimensions: compiledDimensions,
148
+ aggregation: ruleSet.aggregation ?? 'weighted-average',
149
+ reEngagementRules
150
+ };
151
+ }
152
+
153
+ // ========================================
154
+ // Validation Helpers
155
+ // ========================================
156
+
157
+ function validateDimension(dim: DecayDimension): void {
158
+ if (!dim.id) {
159
+ throw new CompilationError('Each dimension requires an id');
160
+ }
161
+
162
+ if (!dim.timestampField) {
163
+ throw new CompilationError(`Dimension '${dim.id}' requires a timestampField`);
164
+ }
165
+
166
+ switch (dim.curve) {
167
+ case 'exponential':
168
+ if (dim.halfLife === undefined || dim.halfLife <= 0) {
169
+ throw new CompilationError(`Dimension '${dim.id}' with exponential curve requires a positive halfLife`);
170
+ }
171
+ break;
172
+ case 'linear':
173
+ if (dim.maxAge === undefined || dim.maxAge <= 0) {
174
+ throw new CompilationError(`Dimension '${dim.id}' with linear curve requires a positive maxAge`);
175
+ }
176
+ break;
177
+ case 'step':
178
+ if (dim.threshold === undefined || dim.threshold <= 0) {
179
+ throw new CompilationError(`Dimension '${dim.id}' with step curve requires a positive threshold`);
180
+ }
181
+ break;
182
+ default:
183
+ throw new CompilationError(`Dimension '${dim.id}' has unknown curve: '${dim.curve}'`);
184
+ }
185
+ }
186
+
187
+ function validateDimensionIds(dimensions: DecayDimension[]): void {
188
+ const ids = new Set<string>();
189
+ for (const dim of dimensions) {
190
+ if (!dim.id) {
191
+ throw new CompilationError('Each dimension requires an id');
192
+ }
193
+ if (ids.has(dim.id)) {
194
+ throw new CompilationError(`Duplicate dimension id: '${dim.id}'`);
195
+ }
196
+ ids.add(dim.id);
197
+ }
198
+ }
199
+
200
+ function validateReEngagementRules(rules: ReEngagementRule[]): void {
201
+ const ids = new Set<string>();
202
+ for (const rule of rules) {
203
+ if (!rule.id) {
204
+ throw new CompilationError('Each re-engagement rule requires an id');
205
+ }
206
+ if (ids.has(rule.id)) {
207
+ throw new CompilationError(`Duplicate re-engagement rule id: '${rule.id}'`);
208
+ }
209
+ ids.add(rule.id);
210
+
211
+ if (!rule.eventType || rule.eventType.trim() === '') {
212
+ throw new CompilationError(`Re-engagement rule '${rule.id}' requires a non-empty eventType`);
213
+ }
214
+
215
+ const validEffects = ['reset', 'boost', 'extend'];
216
+ if (!validEffects.includes(rule.effect)) {
217
+ throw new CompilationError(`Re-engagement rule '${rule.id}' has invalid effect: '${rule.effect}'`);
218
+ }
219
+
220
+ if (rule.effect === 'boost' && (rule.boostAmount === undefined || rule.boostAmount <= 0)) {
221
+ throw new CompilationError(`Re-engagement rule '${rule.id}' with boost effect requires a positive boostAmount`);
222
+ }
223
+
224
+ if (rule.effect === 'extend' && (rule.extensionDays === undefined || rule.extensionDays <= 0)) {
225
+ throw new CompilationError(`Re-engagement rule '${rule.id}' with extend effect requires a positive extensionDays`);
226
+ }
227
+ }
228
+ }
229
+
230
+ // ========================================
231
+ // Compilation Helpers
232
+ // ========================================
233
+
234
+ function compileDimension(dim: DecayDimension, weight: number): CompiledDecayDimension {
235
+ return {
236
+ id: dim.id,
237
+ name: dim.name,
238
+ timestampField: dim.timestampField,
239
+ curve: dim.curve,
240
+ timeUnit: dim.timeUnit,
241
+ halfLife: dim.halfLife,
242
+ maxAge: dim.maxAge,
243
+ threshold: dim.threshold,
244
+ floor: dim.floor,
245
+ weight
246
+ };
247
+ }
248
+
249
+ function compileDimensions(dimensions: DecayDimension[]): CompiledDecayDimension[] {
250
+ // Resolve semantic weights to numeric
251
+ const resolved: { dim: DecayDimension; weight: number }[] = dimensions.map(dim => {
252
+ let weight: number;
253
+ if (isSemanticPriority(dim.weight)) {
254
+ weight = SEMANTIC_PRIORITY_VALUES[dim.weight as SemanticPriority];
255
+ } else if (typeof dim.weight === 'number') {
256
+ weight = dim.weight;
257
+ } else {
258
+ throw new CompilationError(`Invalid weight for dimension '${dim.id}': '${dim.weight}'`);
259
+ }
260
+ return { dim, weight };
261
+ });
262
+
263
+ // Normalize weights to sum to 1.0
264
+ const totalWeight = resolved.reduce((sum, r) => sum + r.weight, 0);
265
+ if (totalWeight === 0) {
266
+ throw new CompilationError('Dimension weights must not all be zero');
267
+ }
268
+
269
+ return resolved.map(r => compileDimension(r.dim, r.weight / totalWeight));
270
+ }
271
+
272
+ function resolveUrgencyThresholds(
273
+ overrides?: Partial<Record<UrgencyTier, number>>
274
+ ): Record<UrgencyTier, number> {
275
+ return { ...URGENCY_THRESHOLDS, ...overrides };
276
+ }
@@ -0,0 +1,211 @@
1
+ /**
2
+ * Decay Engine
3
+ *
4
+ * Temporal decay engine that computes freshness scores for entities based
5
+ * on how recently their data was updated. Supports single-dimension,
6
+ * multi-dimension, and event-driven decay strategies.
7
+ *
8
+ * @example
9
+ * ```typescript
10
+ * const engine = new DecayEngine();
11
+ * engine.add({ type: 'Lead', data: { id: 'l1', lastContact: '2024-01-15' } });
12
+ * engine.add({ type: 'Lead', data: { id: 'l2', lastContact: '2024-03-01' } });
13
+ *
14
+ * const result = engine.execute(compiledDecay);
15
+ * console.log(result.entities[0]); // { entityId: 'l1', compositeFreshness: 0.42, urgencyTier: 'medium', ... }
16
+ * ```
17
+ */
18
+
19
+ import {
20
+ WorkingMemory,
21
+ Fact,
22
+ FactInput,
23
+ FactChange
24
+ } from '../../core';
25
+
26
+ import type {
27
+ CompiledDecayRuleSet,
28
+ DecayOptions,
29
+ DecayResult,
30
+ DecayIngestResult,
31
+ UrgencyTier
32
+ } from './types';
33
+
34
+ import { DecayExecutor } from './strategy';
35
+
36
+ /** Internal accumulator for streaming ingest */
37
+ type DecayStreamState = {
38
+ ruleSetId: string;
39
+ freshnessSum: number;
40
+ count: number;
41
+ tierDistribution: Record<UrgencyTier, number>;
42
+ lastResult: DecayResult | null;
43
+ };
44
+
45
+ export class DecayEngine {
46
+ private wm: WorkingMemory;
47
+ private strategy: DecayExecutor;
48
+ private _stream: DecayStreamState | null = null;
49
+
50
+ constructor(workingMemory?: WorkingMemory) {
51
+ this.wm = workingMemory ?? new WorkingMemory();
52
+ this.strategy = new DecayExecutor();
53
+ }
54
+
55
+ // ========================================
56
+ // IWorkingMemory Implementation
57
+ // ========================================
58
+
59
+ add<T = Record<string, any>>(input: FactInput<T>): Fact<T> {
60
+ return this.wm.add(input);
61
+ }
62
+
63
+ remove(factId: string): Fact | undefined {
64
+ return this.wm.remove(factId);
65
+ }
66
+
67
+ update<T = Record<string, any>>(input: FactInput<T>): Fact<T> {
68
+ return this.wm.update(input);
69
+ }
70
+
71
+ get(factId: string): Fact | undefined {
72
+ return this.wm.get(factId);
73
+ }
74
+
75
+ getByType(type: string): Fact[] {
76
+ return this.wm.getByType(type);
77
+ }
78
+
79
+ getAll(): Fact[] {
80
+ return this.wm.getAll();
81
+ }
82
+
83
+ has(factId: string): boolean {
84
+ return this.wm.has(factId);
85
+ }
86
+
87
+ size(): number {
88
+ return this.wm.size();
89
+ }
90
+
91
+ clear(): void {
92
+ this.wm.clear();
93
+ }
94
+
95
+ getChanges(): FactChange[] {
96
+ return this.wm.getChanges();
97
+ }
98
+
99
+ clearChanges(): void {
100
+ this.wm.clearChanges();
101
+ }
102
+
103
+ // ========================================
104
+ // Engine Execution
105
+ // ========================================
106
+
107
+ /**
108
+ * Execute a decay ruleset.
109
+ *
110
+ * Computes freshness scores for all entities of the configured type
111
+ * and maps each to an urgency tier.
112
+ *
113
+ * @param ruleSet - Compiled decay ruleset
114
+ * @param options - Runtime options (asOf date, onEntity callback)
115
+ * @returns Decay result with per-entity freshness and tier distribution
116
+ */
117
+ execute(
118
+ ruleSet: CompiledDecayRuleSet,
119
+ options: DecayOptions = {}
120
+ ): DecayResult {
121
+ return this.strategy.run(ruleSet, this.wm, options);
122
+ }
123
+
124
+ // ========================================
125
+ // Streaming Ingest
126
+ // ========================================
127
+
128
+ /**
129
+ * Score a single entity incrementally without touching working memory.
130
+ *
131
+ * Each call computes the entity's freshness, updates a running accumulator
132
+ * (tier distribution, average freshness), and returns both the individual
133
+ * result and the aggregate. The compiled ruleset must stay the same across
134
+ * calls (matched by id). Call `resetStream()` to start a new stream.
135
+ *
136
+ * Note: event-driven re-engagement requires facts in working memory,
137
+ * so ingest() uses multi-dimension scoring without re-engagement events.
138
+ *
139
+ * @param entityData - The entity's data object (same shape as fact.data)
140
+ * @param ruleSet - Compiled decay ruleset
141
+ * @param asOf - Reference time (default: now)
142
+ * @returns DecayIngestResult with entity-level and aggregate stats
143
+ */
144
+ ingest(
145
+ entityData: Record<string, any>,
146
+ ruleSet: CompiledDecayRuleSet,
147
+ asOf: Date = new Date()
148
+ ): DecayIngestResult {
149
+ if (!this._stream || this._stream.ruleSetId !== ruleSet.id) {
150
+ this._stream = {
151
+ ruleSetId: ruleSet.id,
152
+ freshnessSum: 0,
153
+ count: 0,
154
+ tierDistribution: { critical: 0, high: 0, medium: 0, low: 0, stale: 0 },
155
+ lastResult: null
156
+ };
157
+ }
158
+
159
+ // Build a temporary fact for the executor
160
+ const tempFact: Fact = {
161
+ id: entityData[ruleSet.entityIdField] ?? `ingest:${this._stream.count + 1}`,
162
+ type: ruleSet.entityType,
163
+ data: entityData
164
+ };
165
+
166
+ const entityResult = this.strategy.scoreEntity(tempFact, ruleSet, asOf);
167
+
168
+ // Update accumulator
169
+ const s = this._stream;
170
+ s.freshnessSum += entityResult.compositeFreshness;
171
+ s.count++;
172
+ s.tierDistribution[entityResult.urgencyTier]++;
173
+
174
+ const averageFreshness = Math.round((s.freshnessSum / s.count) * 10000) / 10000;
175
+
176
+ return {
177
+ ...entityResult,
178
+ tierDistribution: { ...s.tierDistribution },
179
+ averageFreshness,
180
+ totalIngested: s.count
181
+ };
182
+ }
183
+
184
+ /**
185
+ * Get the current streaming aggregate without ingesting a new entity.
186
+ * Returns null if no entities have been ingested yet.
187
+ */
188
+ getStreamResult(): { tierDistribution: Record<UrgencyTier, number>; averageFreshness: number; totalIngested: number } | null {
189
+ if (!this._stream || this._stream.count === 0) return null;
190
+ return {
191
+ tierDistribution: { ...this._stream.tierDistribution },
192
+ averageFreshness: Math.round((this._stream.freshnessSum / this._stream.count) * 10000) / 10000,
193
+ totalIngested: this._stream.count
194
+ };
195
+ }
196
+
197
+ /**
198
+ * Reset the streaming accumulator. Does not affect working memory.
199
+ */
200
+ resetStream(): void {
201
+ this._stream = null;
202
+ }
203
+
204
+ // ========================================
205
+ // Utility Methods
206
+ // ========================================
207
+
208
+ getWorkingMemory(): WorkingMemory {
209
+ return this.wm;
210
+ }
211
+ }