Module: Legion::Extensions::Agentic::Social::Consent::Helpers::Tiers
- Defined in:
- lib/legion/extensions/agentic/social/consent/helpers/tiers.rb
Constant Summary collapse
- TIERS =
Four consent tiers (spec: consent-gradient-spec.md)
%i[autonomous act_notify consult human_only].freeze
- DEFAULT_TIER =
Default starting tier for new domains
:consult- PROMOTION_THRESHOLD =
Thresholds for tier promotion/demotion
0.8- DEMOTION_THRESHOLD =
success rate needed to promote
0.5- MIN_ACTIONS_TO_PROMOTE =
success rate below which demotion occurs
10- PROMOTION_COOLDOWN =
minimum actions before tier change
86_400- TIER_ORDER =
Tier ordering (lower index = more autonomy)
{ autonomous: 0, act_notify: 1, consult: 2, human_only: 3 }.freeze
Class Method Summary collapse
- .demote(current_tier) ⇒ Object
- .more_autonomous?(tier_a, tier_b) ⇒ Boolean
- .promote(current_tier) ⇒ Object
- .valid_tier?(tier) ⇒ Boolean
Class Method Details
.demote(current_tier) ⇒ Object
42 43 44 45 46 47 |
# File 'lib/legion/extensions/agentic/social/consent/helpers/tiers.rb', line 42 def demote(current_tier) idx = TIER_ORDER.fetch(current_tier, 2) return current_tier if idx >= 3 TIER_ORDER.key(idx + 1) || current_tier end |
.more_autonomous?(tier_a, tier_b) ⇒ Boolean
31 32 33 |
# File 'lib/legion/extensions/agentic/social/consent/helpers/tiers.rb', line 31 def more_autonomous?(tier_a, tier_b) TIER_ORDER.fetch(tier_a, 99) < TIER_ORDER.fetch(tier_b, 99) end |
.promote(current_tier) ⇒ Object
35 36 37 38 39 40 |
# File 'lib/legion/extensions/agentic/social/consent/helpers/tiers.rb', line 35 def promote(current_tier) idx = TIER_ORDER.fetch(current_tier, 2) return current_tier if idx.zero? TIER_ORDER.key(idx - 1) || current_tier end |
.valid_tier?(tier) ⇒ Boolean
27 28 29 |
# File 'lib/legion/extensions/agentic/social/consent/helpers/tiers.rb', line 27 def valid_tier?(tier) TIERS.include?(tier) end |