lex-agentic-homeostasis 0.1.1 → 0.1.2

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bf2a2cd9fe0d18fe828d06eec1c26f0e106bc43141cad4857e78fa9bb54abbd1
4
- data.tar.gz: d69e887bd9a9081e4e3dbf604f102c732a806a319c187f09f15856f2c879c04e
3
+ metadata.gz: 7b524356046e0a3d53d0dd87c57336b0dd6a46b8e9118c8eb09cf5c00da68e68
4
+ data.tar.gz: a19593d5527e336267943345a00d34e9a66dfc13e22bcd5ea2bf4aaf3c2b7c1e
5
5
  SHA512:
6
- metadata.gz: 8f363868f9d48f7825ea8c6f754d5b1d48f6cdb21a4454bce405032215a1ef51c275f54ef15b4d8a8b55b7d6e4782e3df0e63312e006a7e683c0417d0fe26612
7
- data.tar.gz: adb010bd024d1910a1bd2b83688ac1f1f3daee2f74492ef117fd334f1f473311d5629c0a3dc3f13a0a14843f2ad3471c942f278b94d0dbb1f93cfe94c6f9216c
6
+ metadata.gz: bd1611f91fa989cf28aa4a9e6d843120df9a6e08b282575ac2131f9a6497af461311ee50e76b304213e92801afea6fa72a308e2f197923445a0694167eca4c4b
7
+ data.tar.gz: 9aeb9734946ad799790aeeacba393b638bc14299cbb71ec239eeef1332707c1ad8bd29546e1b44a9fc62a86ebb5a7640fb20e14256cf4890476eea3f3f6a0b47
data/CHANGELOG.md CHANGED
@@ -2,6 +2,14 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## [0.1.2] - 2026-03-18
6
+
7
+ ### Changed
8
+ - Enforce VARIABLE_CATEGORIES validation in HomeostasisEngine#create_variable (returns nil for invalid category)
9
+ - Add :general to VARIABLE_CATEGORIES to support default category value
10
+ - Enforce RHYTHM_TYPES validation in RhythmEngine#add_rhythm (returns nil for invalid rhythm_type)
11
+ - Enforce COGNITIVE_DIMENSIONS validation in RhythmEngine#add_rhythm (returns nil for invalid dimension)
12
+
5
13
  ## [0.1.1] - 2026-03-18
6
14
 
7
15
  ### Changed
data/README.md CHANGED
@@ -1,13 +1,61 @@
1
1
  # lex-agentic-homeostasis
2
2
 
3
- LEX agentic homeostasis domain: self-regulation, balance, resource management
3
+ Domain consolidation gem for homeostasis, self-regulation, and internal state maintenance. Bundles 20 source extensions into one loadable unit under `Legion::Extensions::Agentic::Homeostasis`.
4
4
 
5
- ## Sub-modules
5
+ ## Overview
6
6
 
7
- *(populated as extensions are consolidated)*
7
+ **Gem**: `lex-agentic-homeostasis`
8
+ **Version**: 0.1.2
9
+ **Namespace**: `Legion::Extensions::Agentic::Homeostasis`
10
+
11
+ ## Sub-Modules
12
+
13
+ | Sub-Module | Source Gem | Purpose |
14
+ |---|---|---|
15
+ | `Homeostasis::Homeostasis` | `lex-homeostasis` | Seven-setpoint negative feedback regulation, allostatic load |
16
+ | `Homeostasis::FatigueModel` | `lex-cognitive-fatigue-model` | Cognitive resource depletion curves across session time |
17
+ | `Homeostasis::Metabolism` | `lex-cognitive-metabolism` | Energy budget allocation and cognitive metabolic rate |
18
+ | `Homeostasis::Rhythm` | `lex-cognitive-rhythm` | Circadian-like cognitive rhythm — sinusoidal oscillators, peak/low tide |
19
+ | `Homeostasis::Tempo` | `lex-cognitive-tempo` | Processing speed modulation |
20
+ | `Homeostasis::Tide` | `lex-cognitive-tide` | Tidal pool maintenance — periodic tide cycle |
21
+ | `Homeostasis::Weathering` | `lex-cognitive-weathering` | Gradual wear on cognitive structures |
22
+ | `Homeostasis::Weather` | `lex-cognitive-weather` | Unpredictable environmental cognitive conditions |
23
+ | `Homeostasis::Pendulum` | `lex-cognitive-pendulum` | Oscillation between cognitive states |
24
+ | `Homeostasis::Cocoon` | `lex-cognitive-cocoon` | Protective withdrawal and recovery state |
25
+ | `Homeostasis::FossilFuel` | `lex-cognitive-fossil-fuel` | Stored energy from past experience |
26
+ | `Homeostasis::Hourglass` | `lex-cognitive-hourglass` | Time-based resource depletion tracking |
27
+ | `Homeostasis::Core` | `lex-homeostasis` | Core homeostasis regulation engine — seven setpoints, allostatic load, negative feedback regulator |
28
+ | `Homeostasis::Neuromodulation` | `lex-neuromodulation` | Dopamine/serotonin/norepinephrine/acetylcholine analogs |
29
+ | `Homeostasis::NeuralOscillation` | `lex-neural-oscillation` | Gamma/beta/alpha/theta/delta bands, cross-frequency coupling |
30
+ | `Homeostasis::Temporal` | `lex-temporal` | Temporal reasoning — event ordering, duration estimation |
31
+ | `Homeostasis::TemporalDiscounting` | `lex-temporal-discounting` | Hyperbolic discounting of future rewards |
32
+ | `Homeostasis::Surplus` | `lex-cognitive-surplus` | Excess cognitive capacity allocation |
33
+ | `Homeostasis::Tectonics` | `lex-cognitive-tectonics` | Deep structural cognitive shifts |
34
+ | `Homeostasis::Furnace` | `lex-cognitive-furnace` | High-intensity cognitive processing — ore to alloy smelting metaphor |
35
+
36
+ ## Actors
37
+
38
+ - `Homeostasis::NeuralOscillation::Actors::Tick` — interval actor, advances oscillation bands
39
+ - `Homeostasis::Neuromodulation::Actors::Drift` — interval actor, applies neuromodulator drift
40
+ - `Homeostasis::Surplus::Actors::Replenish` — interval actor, replenishes cognitive surplus
41
+ - `Homeostasis::Tectonics::Actors::DriftTick` — interval actor, advances tectonic drift
42
+ - `Homeostasis::Tempo::Actors::Adapt` — interval actor, adapts processing tempo
43
+ - `Homeostasis::Tide::Actors::TideCycle` — runs every 60s, executes `tide_maintenance`
8
44
 
9
45
  ## Installation
10
46
 
11
47
  ```ruby
12
48
  gem 'lex-agentic-homeostasis'
13
49
  ```
50
+
51
+ ## Development
52
+
53
+ ```bash
54
+ bundle install
55
+ bundle exec rspec # 2270 examples, 0 failures
56
+ bundle exec rubocop # 0 offenses
57
+ ```
58
+
59
+ ## License
60
+
61
+ MIT
@@ -32,7 +32,7 @@ module Legion
32
32
  }.freeze
33
33
 
34
34
  VARIABLE_CATEGORIES = %i[
35
- arousal attention cognitive_load emotional_valence
35
+ general arousal attention cognitive_load emotional_valence
36
36
  confidence curiosity fatigue motivation
37
37
  social_engagement uncertainty
38
38
  ].freeze
@@ -16,6 +16,8 @@ module Legion
16
16
  def create_variable(name:, category: :general, setpoint: DEFAULT_SETPOINT,
17
17
  tolerance: DEFAULT_TOLERANCE, correction_rate: CORRECTION_RATE,
18
18
  initial_value: nil)
19
+ return nil unless VARIABLE_CATEGORIES.include?(category.to_sym)
20
+
19
21
  prune_if_needed
20
22
  variable = CognitiveVariable.new(
21
23
  name: name,
@@ -5,7 +5,7 @@ module Legion
5
5
  module Agentic
6
6
  module Homeostasis
7
7
  module Homeostasis
8
- VERSION = '0.1.0'
8
+ VERSION = '0.1.1'
9
9
  end
10
10
  end
11
11
  end
@@ -16,6 +16,8 @@ module Legion
16
16
  end
17
17
 
18
18
  def add_rhythm(name:, rhythm_type:, dimension:, period: nil, amplitude: 0.5, phase_offset: 0.0)
19
+ return nil unless RHYTHM_TYPES.include?(rhythm_type.to_sym)
20
+ return nil unless COGNITIVE_DIMENSIONS.include?(dimension.to_sym)
19
21
  return nil if @rhythms.size >= MAX_RHYTHMS
20
22
 
21
23
  resolved_period = resolve_period(rhythm_type, period)
@@ -5,7 +5,7 @@ module Legion
5
5
  module Agentic
6
6
  module Homeostasis
7
7
  module Rhythm
8
- VERSION = '0.1.0'
8
+ VERSION = '0.1.1'
9
9
  end
10
10
  end
11
11
  end
@@ -4,7 +4,7 @@ module Legion
4
4
  module Extensions
5
5
  module Agentic
6
6
  module Homeostasis
7
- VERSION = '0.1.1'
7
+ VERSION = '0.1.2'
8
8
  end
9
9
  end
10
10
  end
@@ -14,6 +14,18 @@ RSpec.describe Legion::Extensions::Agentic::Homeostasis::Homeostasis::Helpers::H
14
14
  expect(var.category).to eq(:cognitive_load)
15
15
  expect(var.setpoint).to eq(0.3)
16
16
  end
17
+
18
+ it 'rejects invalid category' do
19
+ expect(engine.create_variable(name: 'bad', category: :nonexistent_category)).to be_nil
20
+ end
21
+
22
+ it 'accepts all VARIABLE_CATEGORIES' do
23
+ constants = Legion::Extensions::Agentic::Homeostasis::Homeostasis::Helpers::Constants::VARIABLE_CATEGORIES
24
+ constants.each do |cat|
25
+ var = engine.create_variable(name: "var_#{cat}", category: cat)
26
+ expect(var).not_to be_nil, "Expected category #{cat.inspect} to be accepted"
27
+ end
28
+ end
17
29
  end
18
30
 
19
31
  describe '#perturb' do
@@ -56,6 +56,33 @@ RSpec.describe Legion::Extensions::Agentic::Homeostasis::Rhythm::Helpers::Rhythm
56
56
  r2 = add_alertness_rhythm
57
57
  expect(r1.id).not_to eq(r2.id)
58
58
  end
59
+
60
+ it 'rejects invalid rhythm_type' do
61
+ result = engine.add_rhythm(name: 'bad', rhythm_type: :nonexistent, dimension: :focus, amplitude: 0.5)
62
+ expect(result).to be_nil
63
+ end
64
+
65
+ it 'accepts all RHYTHM_TYPES' do
66
+ constants = Legion::Extensions::Agentic::Homeostasis::Rhythm::Helpers::Constants::RHYTHM_TYPES
67
+ constants.each do |rt|
68
+ period = rt == :custom ? 1000 : nil
69
+ result = engine.add_rhythm(name: "r_#{rt}", rhythm_type: rt, dimension: :focus, period: period)
70
+ expect(result).not_to be_nil, "Expected rhythm_type #{rt.inspect} to be accepted"
71
+ end
72
+ end
73
+
74
+ it 'rejects invalid dimension' do
75
+ result = engine.add_rhythm(name: 'bad', rhythm_type: :ultradian, dimension: :nonexistent, amplitude: 0.5)
76
+ expect(result).to be_nil
77
+ end
78
+
79
+ it 'accepts all COGNITIVE_DIMENSIONS' do
80
+ constants = Legion::Extensions::Agentic::Homeostasis::Rhythm::Helpers::Constants::COGNITIVE_DIMENSIONS
81
+ constants.each do |dim|
82
+ result = engine.add_rhythm(name: "r_#{dim}", rhythm_type: :ultradian, dimension: dim)
83
+ expect(result).not_to be_nil, "Expected dimension #{dim.inspect} to be accepted"
84
+ end
85
+ end
59
86
  end
60
87
 
61
88
  describe '#remove_rhythm' do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lex-agentic-homeostasis
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Esity