lex-agentic-inference 0.1.6 → 0.1.8

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 (24) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +9 -0
  3. data/README.md +14 -5
  4. data/lib/legion/extensions/agentic/inference/abductive/actors/update_abductive_reasoning.rb +45 -0
  5. data/lib/legion/extensions/agentic/inference/belief_revision/actors/update_belief_revision.rb +45 -0
  6. data/lib/legion/extensions/agentic/inference/coherence/actors/update_cognitive_coherence.rb +45 -0
  7. data/lib/legion/extensions/agentic/inference/expectation_violation/actors/decay_violations.rb +45 -0
  8. data/lib/legion/extensions/agentic/inference/expectation_violation/helpers/violation_engine.rb +6 -0
  9. data/lib/legion/extensions/agentic/inference/expectation_violation/runners/expectation_violation.rb +10 -0
  10. data/lib/legion/extensions/agentic/inference/free_energy/actors/update_free_energy.rb +45 -0
  11. data/lib/legion/extensions/agentic/inference/momentum/actors/update_cognitive_momentum.rb +45 -0
  12. data/lib/legion/extensions/agentic/inference/reality_testing/actors/decay_beliefs.rb +45 -0
  13. data/lib/legion/extensions/agentic/inference/version.rb +1 -1
  14. data/lib/legion/extensions/agentic/inference.rb +12 -0
  15. data/spec/legion/extensions/agentic/inference/abductive/actors/update_abductive_reasoning_spec.rb +50 -0
  16. data/spec/legion/extensions/agentic/inference/belief_revision/actors/update_belief_revision_spec.rb +48 -0
  17. data/spec/legion/extensions/agentic/inference/coherence/actors/update_cognitive_coherence_spec.rb +48 -0
  18. data/spec/legion/extensions/agentic/inference/expectation_violation/actors/decay_violations_spec.rb +50 -0
  19. data/spec/legion/extensions/agentic/inference/expectation_violation/helpers/violation_engine_spec.rb +17 -0
  20. data/spec/legion/extensions/agentic/inference/expectation_violation/runners/expectation_violation_spec.rb +13 -0
  21. data/spec/legion/extensions/agentic/inference/free_energy/actors/update_free_energy_spec.rb +46 -0
  22. data/spec/legion/extensions/agentic/inference/momentum/actors/update_cognitive_momentum_spec.rb +50 -0
  23. data/spec/legion/extensions/agentic/inference/reality_testing/actors/decay_beliefs_spec.rb +48 -0
  24. metadata +15 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 38c9c211a959db08d213260c1fc227c569fff0d29605e75a16df70358e88f804
4
- data.tar.gz: d534c51b3876207e980897ab036b6a6732adf82f4b6fd2cc71c1b24356083e86
3
+ metadata.gz: 9464eb037323572427ed2bde52b57de8f9024896e512babfb4874e84c061f1a7
4
+ data.tar.gz: 30343f620c001416c037c6083d52a283b821eb562c167e38e5d32662e9fcd036
5
5
  SHA512:
6
- metadata.gz: 3d7a4635346ccf5f7d8dbee814514ca1ac6776ece7ee5192b3d8944f61a988f118d3632f64366977fb34ba1712b87d7b9b067f55900acf68fe01de1f5939e2cc
7
- data.tar.gz: 71b6339e87a599a1956c50a73a8aa7e74a61037d4cb98d8a11c702b7a27392ade2ad6ed5d8217b74169157040220ff57d75c2b743da1d541930dae03fb44a7da
6
+ metadata.gz: 4771d2b480c7465685af5eae93b338423ab573a68849761f62d733d5aae564c1c30e5e0589fe637b7ece96160ff81208a10cca58b880703bae2523e48831f1c0
7
+ data.tar.gz: 2d6e614af682bd2f7a887a7693204df0ce74ac4e8e32fc49338d578c77f137d50f9190665e77eafbdccfaa1526acca4ab687a029c238bb02273d2e77f73a2007
data/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.1.8] - 2026-04-22
4
+ ### Added
5
+ - 7 new maintenance actors: FreeEnergy::Update (30s), BeliefRevision::Update (120s), RealityTesting::DecayBeliefs (300s), CognitiveCoherence::Update (120s), ExpectationViolation::DecayViolations (300s), AbductiveReasoning::Update (60s), CognitiveMomentum::Update (60s)
6
+ - `ExpectationViolation#decay_violations` method with configurable stale threshold
7
+
8
+ ## [0.1.7] - 2026-04-15
9
+ ### Changed
10
+ - Set `mcp_tools?`, `mcp_tools_deferred?`, and `transport_required?` to `false` — internal cognitive pipeline extension
11
+
3
12
  ## [Unreleased]
4
13
 
5
14
  ### Fixed
data/README.md CHANGED
@@ -5,7 +5,7 @@ Domain consolidation gem for reasoning, inference, and belief management. Bundle
5
5
  ## Overview
6
6
 
7
7
  **Gem**: `lex-agentic-inference`
8
- **Version**: 0.1.0
8
+ **Version**: 0.1.8
9
9
  **Namespace**: `Legion::Extensions::Agentic::Inference`
10
10
 
11
11
  ## Sub-Modules
@@ -42,10 +42,19 @@ Domain consolidation gem for reasoning, inference, and belief management. Bundle
42
42
 
43
43
  ## Actors
44
44
 
45
- - `Inference::Affordance::Actors::Scan` interval actor, scans for available affordances
46
- - `Inference::Horizon::Actors::Adjust` — interval actor, adjusts reasoning horizon bounds
47
- - `Inference::Prediction::Actors::ExpirePredictions` runs every 300s, expires stale predictions
48
- - `Inference::PredictiveCoding::Actors::Decay` interval actor, decays precision weights
45
+ | Actor | Interval | What It Does |
46
+ |-------|----------|--------------|
47
+ | `Abductive::Actor::UpdateAbductiveReasoning` | Every 60s | Prunes low-probability hypotheses |
48
+ | `Affordance::Actors::Scan` | interval | Scans for available affordances in current context |
49
+ | `BeliefRevision::Actor::UpdateBeliefRevision` | Every 120s | AGM contraction on low-confidence beliefs |
50
+ | `Coherence::Actor::UpdateCognitiveCoherence` | Every 120s | Recomputes coherence scores across belief graph |
51
+ | `ExpectationViolation::Actor::DecayViolations` | Every 300s | Decays stale expectation violation records |
52
+ | `FreeEnergy::Actor::UpdateFreeEnergy` | Every 30s | Minimizes free energy — updates variational estimates |
53
+ | `Horizon::Actors::Adjust` | interval | Adjusts reasoning horizon bounds |
54
+ | `Momentum::Actor::UpdateCognitiveMomentum` | Every 60s | Decays inference momentum, updates continuation bias |
55
+ | `Prediction::Actors::ExpirePredictions` | Every 300s | Expires stale predictions |
56
+ | `PredictiveCoding::Actors::Decay` | interval | Decays precision weights in predictive coding hierarchy |
57
+ | `RealityTesting::Actor::DecayBeliefs` | Every 300s | Decays beliefs that are no longer supported by evidence |
49
58
 
50
59
  ## Installation
51
60
 
@@ -0,0 +1,45 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'legion/extensions/actors/every'
4
+
5
+ module Legion
6
+ module Extensions
7
+ module Agentic
8
+ module Inference
9
+ module Abductive
10
+ module Actor
11
+ class UpdateAbductiveReasoning < Legion::Extensions::Actors::Every
12
+ def runner_class
13
+ Legion::Extensions::Agentic::Inference::Abductive::Runners::AbductiveReasoning
14
+ end
15
+
16
+ def runner_function
17
+ 'update_abductive_reasoning'
18
+ end
19
+
20
+ def time
21
+ 60
22
+ end
23
+
24
+ def run_now?
25
+ false
26
+ end
27
+
28
+ def use_runner?
29
+ false
30
+ end
31
+
32
+ def check_subtask?
33
+ false
34
+ end
35
+
36
+ def generate_task?
37
+ false
38
+ end
39
+ end
40
+ end
41
+ end
42
+ end
43
+ end
44
+ end
45
+ end
@@ -0,0 +1,45 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'legion/extensions/actors/every'
4
+
5
+ module Legion
6
+ module Extensions
7
+ module Agentic
8
+ module Inference
9
+ module BeliefRevision
10
+ module Actor
11
+ class UpdateBeliefRevision < Legion::Extensions::Actors::Every
12
+ def runner_class
13
+ Legion::Extensions::Agentic::Inference::BeliefRevision::Runners::BeliefRevision
14
+ end
15
+
16
+ def runner_function
17
+ 'update_belief_revision'
18
+ end
19
+
20
+ def time
21
+ 120
22
+ end
23
+
24
+ def run_now?
25
+ false
26
+ end
27
+
28
+ def use_runner?
29
+ false
30
+ end
31
+
32
+ def check_subtask?
33
+ false
34
+ end
35
+
36
+ def generate_task?
37
+ false
38
+ end
39
+ end
40
+ end
41
+ end
42
+ end
43
+ end
44
+ end
45
+ end
@@ -0,0 +1,45 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'legion/extensions/actors/every'
4
+
5
+ module Legion
6
+ module Extensions
7
+ module Agentic
8
+ module Inference
9
+ module Coherence
10
+ module Actor
11
+ class UpdateCognitiveCoherence < Legion::Extensions::Actors::Every
12
+ def runner_class
13
+ Legion::Extensions::Agentic::Inference::Coherence::Runners::CognitiveCoherence
14
+ end
15
+
16
+ def runner_function
17
+ 'update_cognitive_coherence'
18
+ end
19
+
20
+ def time
21
+ 120
22
+ end
23
+
24
+ def run_now?
25
+ false
26
+ end
27
+
28
+ def use_runner?
29
+ false
30
+ end
31
+
32
+ def check_subtask?
33
+ false
34
+ end
35
+
36
+ def generate_task?
37
+ false
38
+ end
39
+ end
40
+ end
41
+ end
42
+ end
43
+ end
44
+ end
45
+ end
@@ -0,0 +1,45 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'legion/extensions/actors/every'
4
+
5
+ module Legion
6
+ module Extensions
7
+ module Agentic
8
+ module Inference
9
+ module ExpectationViolation
10
+ module Actor
11
+ class DecayViolations < Legion::Extensions::Actors::Every
12
+ def runner_class
13
+ Legion::Extensions::Agentic::Inference::ExpectationViolation::Runners::ExpectationViolation
14
+ end
15
+
16
+ def runner_function
17
+ 'decay_violations'
18
+ end
19
+
20
+ def time
21
+ 300
22
+ end
23
+
24
+ def run_now?
25
+ false
26
+ end
27
+
28
+ def use_runner?
29
+ false
30
+ end
31
+
32
+ def check_subtask?
33
+ false
34
+ end
35
+
36
+ def generate_task?
37
+ false
38
+ end
39
+ end
40
+ end
41
+ end
42
+ end
43
+ end
44
+ end
45
+ end
@@ -77,6 +77,12 @@ module Legion
77
77
  @expectations.values.sort_by { |exp| -exp.violation_count }.first(limit)
78
78
  end
79
79
 
80
+ def prune_stale_violations(cutoff:)
81
+ before = @violations.size
82
+ @violations.reject! { |vio| vio[:at] < cutoff }
83
+ before - @violations.size
84
+ end
85
+
80
86
  def violation_rate
81
87
  total = @expectations.values.sum(&:violation_count)
82
88
  evals = @history.count { |entry| entry[:event] == :evaluated }
@@ -55,6 +55,16 @@ module Legion
55
55
  { success: true, expectations: exps.map(&:to_h), count: exps.size }
56
56
  end
57
57
 
58
+ def decay_violations(threshold_seconds: 3600, **)
59
+ cutoff = Time.now.utc - threshold_seconds
60
+ pruned = engine.prune_stale_violations(cutoff: cutoff)
61
+ log.debug "[expectation_violation] decay_violations pruned=#{pruned} threshold=#{threshold_seconds}s"
62
+ { success: true, pruned: pruned }
63
+ rescue StandardError => e
64
+ log.error "[expectation_violation] decay_violations error=#{e.message}"
65
+ { success: false, error: e.message }
66
+ end
67
+
58
68
  def expectation_violation_stats(**)
59
69
  stats = engine.to_h
60
70
  log.debug '[expectation_violation] stats ' \
@@ -0,0 +1,45 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'legion/extensions/actors/every'
4
+
5
+ module Legion
6
+ module Extensions
7
+ module Agentic
8
+ module Inference
9
+ module FreeEnergy
10
+ module Actor
11
+ class UpdateFreeEnergy < Legion::Extensions::Actors::Every
12
+ def runner_class
13
+ Legion::Extensions::Agentic::Inference::FreeEnergy::Runners::FreeEnergy
14
+ end
15
+
16
+ def runner_function
17
+ 'update_free_energy'
18
+ end
19
+
20
+ def time
21
+ 30
22
+ end
23
+
24
+ def run_now?
25
+ false
26
+ end
27
+
28
+ def use_runner?
29
+ false
30
+ end
31
+
32
+ def check_subtask?
33
+ false
34
+ end
35
+
36
+ def generate_task?
37
+ false
38
+ end
39
+ end
40
+ end
41
+ end
42
+ end
43
+ end
44
+ end
45
+ end
@@ -0,0 +1,45 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'legion/extensions/actors/every'
4
+
5
+ module Legion
6
+ module Extensions
7
+ module Agentic
8
+ module Inference
9
+ module Momentum
10
+ module Actor
11
+ class UpdateCognitiveMomentum < Legion::Extensions::Actors::Every
12
+ def runner_class
13
+ Legion::Extensions::Agentic::Inference::Momentum::Runners::CognitiveMomentum
14
+ end
15
+
16
+ def runner_function
17
+ 'update_cognitive_momentum'
18
+ end
19
+
20
+ def time
21
+ 60
22
+ end
23
+
24
+ def run_now?
25
+ false
26
+ end
27
+
28
+ def use_runner?
29
+ false
30
+ end
31
+
32
+ def check_subtask?
33
+ false
34
+ end
35
+
36
+ def generate_task?
37
+ false
38
+ end
39
+ end
40
+ end
41
+ end
42
+ end
43
+ end
44
+ end
45
+ end
@@ -0,0 +1,45 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'legion/extensions/actors/every'
4
+
5
+ module Legion
6
+ module Extensions
7
+ module Agentic
8
+ module Inference
9
+ module RealityTesting
10
+ module Actor
11
+ class DecayBeliefs < Legion::Extensions::Actors::Every
12
+ def runner_class
13
+ Legion::Extensions::Agentic::Inference::RealityTesting::Runners::RealityTesting
14
+ end
15
+
16
+ def runner_function
17
+ 'decay_beliefs'
18
+ end
19
+
20
+ def time
21
+ 300
22
+ end
23
+
24
+ def run_now?
25
+ false
26
+ end
27
+
28
+ def use_runner?
29
+ false
30
+ end
31
+
32
+ def check_subtask?
33
+ false
34
+ end
35
+
36
+ def generate_task?
37
+ false
38
+ end
39
+ end
40
+ end
41
+ end
42
+ end
43
+ end
44
+ end
45
+ end
@@ -4,7 +4,7 @@ module Legion
4
4
  module Extensions
5
5
  module Agentic
6
6
  module Inference
7
- VERSION = '0.1.6'
7
+ VERSION = '0.1.8'
8
8
  end
9
9
  end
10
10
  end
@@ -38,6 +38,18 @@ module Legion
38
38
  def self.remote_invocable?
39
39
  false
40
40
  end
41
+
42
+ def self.mcp_tools?
43
+ false
44
+ end
45
+
46
+ def self.mcp_tools_deferred?
47
+ false
48
+ end
49
+
50
+ def self.transport_required?
51
+ false
52
+ end
41
53
  end
42
54
  end
43
55
  end
@@ -0,0 +1,50 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Stub the base class before loading the actor
4
+ module Legion
5
+ module Extensions
6
+ module Actors
7
+ class Every; end # rubocop:disable Lint/EmptyClass
8
+ end
9
+ end
10
+ end
11
+
12
+ $LOADED_FEATURES << 'legion/extensions/actors/every'
13
+
14
+ require_relative '../../../../../../../lib/legion/extensions/agentic/inference/abductive/actors/update_abductive_reasoning'
15
+
16
+ RSpec.describe Legion::Extensions::Agentic::Inference::Abductive::Actor::UpdateAbductiveReasoning do
17
+ subject(:actor) { described_class.new }
18
+
19
+ describe '#runner_class' do
20
+ it do
21
+ expect(actor.runner_class).to eq(
22
+ Legion::Extensions::Agentic::Inference::Abductive::Runners::AbductiveReasoning
23
+ )
24
+ end
25
+ end
26
+
27
+ describe '#runner_function' do
28
+ it { expect(actor.runner_function).to eq 'update_abductive_reasoning' }
29
+ end
30
+
31
+ describe '#time' do
32
+ it { expect(actor.time).to eq 60 }
33
+ end
34
+
35
+ describe '#run_now?' do
36
+ it { expect(actor.run_now?).to be false }
37
+ end
38
+
39
+ describe '#use_runner?' do
40
+ it { expect(actor.use_runner?).to be false }
41
+ end
42
+
43
+ describe '#check_subtask?' do
44
+ it { expect(actor.check_subtask?).to be false }
45
+ end
46
+
47
+ describe '#generate_task?' do
48
+ it { expect(actor.generate_task?).to be false }
49
+ end
50
+ end
@@ -0,0 +1,48 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Stub the base class before loading the actor
4
+ module Legion
5
+ module Extensions
6
+ module Actors
7
+ class Every; end # rubocop:disable Lint/EmptyClass
8
+ end
9
+ end
10
+ end
11
+
12
+ $LOADED_FEATURES << 'legion/extensions/actors/every'
13
+
14
+ require_relative '../../../../../../../lib/legion/extensions/agentic/inference/belief_revision/actors/update_belief_revision'
15
+
16
+ RSpec.describe Legion::Extensions::Agentic::Inference::BeliefRevision::Actor::UpdateBeliefRevision do
17
+ subject(:actor) { described_class.new }
18
+
19
+ describe '#runner_class' do
20
+ it do
21
+ expect(actor.runner_class).to eq Legion::Extensions::Agentic::Inference::BeliefRevision::Runners::BeliefRevision
22
+ end
23
+ end
24
+
25
+ describe '#runner_function' do
26
+ it { expect(actor.runner_function).to eq 'update_belief_revision' }
27
+ end
28
+
29
+ describe '#time' do
30
+ it { expect(actor.time).to eq 120 }
31
+ end
32
+
33
+ describe '#run_now?' do
34
+ it { expect(actor.run_now?).to be false }
35
+ end
36
+
37
+ describe '#use_runner?' do
38
+ it { expect(actor.use_runner?).to be false }
39
+ end
40
+
41
+ describe '#check_subtask?' do
42
+ it { expect(actor.check_subtask?).to be false }
43
+ end
44
+
45
+ describe '#generate_task?' do
46
+ it { expect(actor.generate_task?).to be false }
47
+ end
48
+ end
@@ -0,0 +1,48 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Stub the base class before loading the actor
4
+ module Legion
5
+ module Extensions
6
+ module Actors
7
+ class Every; end # rubocop:disable Lint/EmptyClass
8
+ end
9
+ end
10
+ end
11
+
12
+ $LOADED_FEATURES << 'legion/extensions/actors/every'
13
+
14
+ require_relative '../../../../../../../lib/legion/extensions/agentic/inference/coherence/actors/update_cognitive_coherence'
15
+
16
+ RSpec.describe Legion::Extensions::Agentic::Inference::Coherence::Actor::UpdateCognitiveCoherence do
17
+ subject(:actor) { described_class.new }
18
+
19
+ describe '#runner_class' do
20
+ it do
21
+ expect(actor.runner_class).to eq Legion::Extensions::Agentic::Inference::Coherence::Runners::CognitiveCoherence
22
+ end
23
+ end
24
+
25
+ describe '#runner_function' do
26
+ it { expect(actor.runner_function).to eq 'update_cognitive_coherence' }
27
+ end
28
+
29
+ describe '#time' do
30
+ it { expect(actor.time).to eq 120 }
31
+ end
32
+
33
+ describe '#run_now?' do
34
+ it { expect(actor.run_now?).to be false }
35
+ end
36
+
37
+ describe '#use_runner?' do
38
+ it { expect(actor.use_runner?).to be false }
39
+ end
40
+
41
+ describe '#check_subtask?' do
42
+ it { expect(actor.check_subtask?).to be false }
43
+ end
44
+
45
+ describe '#generate_task?' do
46
+ it { expect(actor.generate_task?).to be false }
47
+ end
48
+ end
@@ -0,0 +1,50 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Stub the base class before loading the actor
4
+ module Legion
5
+ module Extensions
6
+ module Actors
7
+ class Every; end # rubocop:disable Lint/EmptyClass
8
+ end
9
+ end
10
+ end
11
+
12
+ $LOADED_FEATURES << 'legion/extensions/actors/every'
13
+
14
+ require_relative '../../../../../../../lib/legion/extensions/agentic/inference/expectation_violation/actors/decay_violations'
15
+
16
+ RSpec.describe Legion::Extensions::Agentic::Inference::ExpectationViolation::Actor::DecayViolations do
17
+ subject(:actor) { described_class.new }
18
+
19
+ describe '#runner_class' do
20
+ it do
21
+ expect(actor.runner_class).to eq(
22
+ Legion::Extensions::Agentic::Inference::ExpectationViolation::Runners::ExpectationViolation
23
+ )
24
+ end
25
+ end
26
+
27
+ describe '#runner_function' do
28
+ it { expect(actor.runner_function).to eq 'decay_violations' }
29
+ end
30
+
31
+ describe '#time' do
32
+ it { expect(actor.time).to eq 300 }
33
+ end
34
+
35
+ describe '#run_now?' do
36
+ it { expect(actor.run_now?).to be false }
37
+ end
38
+
39
+ describe '#use_runner?' do
40
+ it { expect(actor.use_runner?).to be false }
41
+ end
42
+
43
+ describe '#check_subtask?' do
44
+ it { expect(actor.check_subtask?).to be false }
45
+ end
46
+
47
+ describe '#generate_task?' do
48
+ it { expect(actor.generate_task?).to be false }
49
+ end
50
+ end
@@ -118,4 +118,21 @@ RSpec.describe Legion::Extensions::Agentic::Inference::ExpectationViolation::Hel
118
118
  :violation_rate, :positive_ratio, :history_count)
119
119
  end
120
120
  end
121
+
122
+ describe '#prune_stale_violations' do
123
+ it 'removes violations older than the cutoff' do
124
+ engine.evaluate_against(expectation_id: exp.id, actual_value: 0.9)
125
+ expect(engine.recent_violations.size).to eq(1)
126
+ pruned = engine.prune_stale_violations(cutoff: Time.now.utc + 1)
127
+ expect(pruned).to eq(1)
128
+ expect(engine.recent_violations.size).to eq(0)
129
+ end
130
+
131
+ it 'keeps violations newer than the cutoff' do
132
+ engine.evaluate_against(expectation_id: exp.id, actual_value: 0.9)
133
+ pruned = engine.prune_stale_violations(cutoff: Time.now.utc - 3600)
134
+ expect(pruned).to eq(0)
135
+ expect(engine.recent_violations.size).to eq(1)
136
+ end
137
+ end
121
138
  end
@@ -56,4 +56,17 @@ RSpec.describe Legion::Extensions::Agentic::Inference::ExpectationViolation::Run
56
56
  expect(result).to include(:total_expectations, :total_violations)
57
57
  end
58
58
  end
59
+
60
+ describe '#decay_violations' do
61
+ it 'prunes stale violations with default threshold' do
62
+ result = client.decay_violations
63
+ expect(result[:success]).to be true
64
+ expect(result[:pruned]).to be_a(Integer)
65
+ end
66
+
67
+ it 'accepts a custom threshold_seconds' do
68
+ result = client.decay_violations(threshold_seconds: 0)
69
+ expect(result[:success]).to be true
70
+ end
71
+ end
59
72
  end
@@ -0,0 +1,46 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Stub the base class before loading the actor
4
+ module Legion
5
+ module Extensions
6
+ module Actors
7
+ class Every; end # rubocop:disable Lint/EmptyClass
8
+ end
9
+ end
10
+ end
11
+
12
+ $LOADED_FEATURES << 'legion/extensions/actors/every'
13
+
14
+ require_relative '../../../../../../../lib/legion/extensions/agentic/inference/free_energy/actors/update_free_energy'
15
+
16
+ RSpec.describe Legion::Extensions::Agentic::Inference::FreeEnergy::Actor::UpdateFreeEnergy do
17
+ subject(:actor) { described_class.new }
18
+
19
+ describe '#runner_class' do
20
+ it { expect(actor.runner_class).to eq Legion::Extensions::Agentic::Inference::FreeEnergy::Runners::FreeEnergy }
21
+ end
22
+
23
+ describe '#runner_function' do
24
+ it { expect(actor.runner_function).to eq 'update_free_energy' }
25
+ end
26
+
27
+ describe '#time' do
28
+ it { expect(actor.time).to eq 30 }
29
+ end
30
+
31
+ describe '#run_now?' do
32
+ it { expect(actor.run_now?).to be false }
33
+ end
34
+
35
+ describe '#use_runner?' do
36
+ it { expect(actor.use_runner?).to be false }
37
+ end
38
+
39
+ describe '#check_subtask?' do
40
+ it { expect(actor.check_subtask?).to be false }
41
+ end
42
+
43
+ describe '#generate_task?' do
44
+ it { expect(actor.generate_task?).to be false }
45
+ end
46
+ end
@@ -0,0 +1,50 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Stub the base class before loading the actor
4
+ module Legion
5
+ module Extensions
6
+ module Actors
7
+ class Every; end # rubocop:disable Lint/EmptyClass
8
+ end
9
+ end
10
+ end
11
+
12
+ $LOADED_FEATURES << 'legion/extensions/actors/every'
13
+
14
+ require_relative '../../../../../../../lib/legion/extensions/agentic/inference/momentum/actors/update_cognitive_momentum'
15
+
16
+ RSpec.describe Legion::Extensions::Agentic::Inference::Momentum::Actor::UpdateCognitiveMomentum do
17
+ subject(:actor) { described_class.new }
18
+
19
+ describe '#runner_class' do
20
+ it do
21
+ expect(actor.runner_class).to eq(
22
+ Legion::Extensions::Agentic::Inference::Momentum::Runners::CognitiveMomentum
23
+ )
24
+ end
25
+ end
26
+
27
+ describe '#runner_function' do
28
+ it { expect(actor.runner_function).to eq 'update_cognitive_momentum' }
29
+ end
30
+
31
+ describe '#time' do
32
+ it { expect(actor.time).to eq 60 }
33
+ end
34
+
35
+ describe '#run_now?' do
36
+ it { expect(actor.run_now?).to be false }
37
+ end
38
+
39
+ describe '#use_runner?' do
40
+ it { expect(actor.use_runner?).to be false }
41
+ end
42
+
43
+ describe '#check_subtask?' do
44
+ it { expect(actor.check_subtask?).to be false }
45
+ end
46
+
47
+ describe '#generate_task?' do
48
+ it { expect(actor.generate_task?).to be false }
49
+ end
50
+ end
@@ -0,0 +1,48 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Stub the base class before loading the actor
4
+ module Legion
5
+ module Extensions
6
+ module Actors
7
+ class Every; end # rubocop:disable Lint/EmptyClass
8
+ end
9
+ end
10
+ end
11
+
12
+ $LOADED_FEATURES << 'legion/extensions/actors/every'
13
+
14
+ require_relative '../../../../../../../lib/legion/extensions/agentic/inference/reality_testing/actors/decay_beliefs'
15
+
16
+ RSpec.describe Legion::Extensions::Agentic::Inference::RealityTesting::Actor::DecayBeliefs do
17
+ subject(:actor) { described_class.new }
18
+
19
+ describe '#runner_class' do
20
+ it do
21
+ expect(actor.runner_class).to eq Legion::Extensions::Agentic::Inference::RealityTesting::Runners::RealityTesting
22
+ end
23
+ end
24
+
25
+ describe '#runner_function' do
26
+ it { expect(actor.runner_function).to eq 'decay_beliefs' }
27
+ end
28
+
29
+ describe '#time' do
30
+ it { expect(actor.time).to eq 300 }
31
+ end
32
+
33
+ describe '#run_now?' do
34
+ it { expect(actor.run_now?).to be false }
35
+ end
36
+
37
+ describe '#use_runner?' do
38
+ it { expect(actor.use_runner?).to be false }
39
+ end
40
+
41
+ describe '#check_subtask?' do
42
+ it { expect(actor.check_subtask?).to be false }
43
+ end
44
+
45
+ describe '#generate_task?' do
46
+ it { expect(actor.generate_task?).to be false }
47
+ end
48
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lex-agentic-inference
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Esity
@@ -177,6 +177,7 @@ files:
177
177
  - lex-agentic-inference.gemspec
178
178
  - lib/legion/extensions/agentic/inference.rb
179
179
  - lib/legion/extensions/agentic/inference/abductive.rb
180
+ - lib/legion/extensions/agentic/inference/abductive/actors/update_abductive_reasoning.rb
180
181
  - lib/legion/extensions/agentic/inference/abductive/client.rb
181
182
  - lib/legion/extensions/agentic/inference/abductive/helpers/abduction_engine.rb
182
183
  - lib/legion/extensions/agentic/inference/abductive/helpers/constants.rb
@@ -214,6 +215,7 @@ files:
214
215
  - lib/legion/extensions/agentic/inference/bayesian/runners/bayesian_belief.rb
215
216
  - lib/legion/extensions/agentic/inference/bayesian/version.rb
216
217
  - lib/legion/extensions/agentic/inference/belief_revision.rb
218
+ - lib/legion/extensions/agentic/inference/belief_revision/actors/update_belief_revision.rb
217
219
  - lib/legion/extensions/agentic/inference/belief_revision/client.rb
218
220
  - lib/legion/extensions/agentic/inference/belief_revision/helpers/belief.rb
219
221
  - lib/legion/extensions/agentic/inference/belief_revision/helpers/belief_network.rb
@@ -235,6 +237,7 @@ files:
235
237
  - lib/legion/extensions/agentic/inference/causal_reasoning/runners/causal_reasoning.rb
236
238
  - lib/legion/extensions/agentic/inference/causal_reasoning/version.rb
237
239
  - lib/legion/extensions/agentic/inference/coherence.rb
240
+ - lib/legion/extensions/agentic/inference/coherence/actors/update_cognitive_coherence.rb
238
241
  - lib/legion/extensions/agentic/inference/coherence/client.rb
239
242
  - lib/legion/extensions/agentic/inference/coherence/helpers/coherence_engine.rb
240
243
  - lib/legion/extensions/agentic/inference/coherence/helpers/constants.rb
@@ -264,6 +267,7 @@ files:
264
267
  - lib/legion/extensions/agentic/inference/enactive_cognition/runners/enactive_cognition.rb
265
268
  - lib/legion/extensions/agentic/inference/enactive_cognition/version.rb
266
269
  - lib/legion/extensions/agentic/inference/expectation_violation.rb
270
+ - lib/legion/extensions/agentic/inference/expectation_violation/actors/decay_violations.rb
267
271
  - lib/legion/extensions/agentic/inference/expectation_violation/helpers/client.rb
268
272
  - lib/legion/extensions/agentic/inference/expectation_violation/helpers/constants.rb
269
273
  - lib/legion/extensions/agentic/inference/expectation_violation/helpers/expectation.rb
@@ -271,6 +275,7 @@ files:
271
275
  - lib/legion/extensions/agentic/inference/expectation_violation/runners/expectation_violation.rb
272
276
  - lib/legion/extensions/agentic/inference/expectation_violation/version.rb
273
277
  - lib/legion/extensions/agentic/inference/free_energy.rb
278
+ - lib/legion/extensions/agentic/inference/free_energy/actors/update_free_energy.rb
274
279
  - lib/legion/extensions/agentic/inference/free_energy/client.rb
275
280
  - lib/legion/extensions/agentic/inference/free_energy/helpers/belief.rb
276
281
  - lib/legion/extensions/agentic/inference/free_energy/helpers/constants.rb
@@ -317,6 +322,7 @@ files:
317
322
  - lib/legion/extensions/agentic/inference/magnet/runners/cognitive_magnet.rb
318
323
  - lib/legion/extensions/agentic/inference/magnet/version.rb
319
324
  - lib/legion/extensions/agentic/inference/momentum.rb
325
+ - lib/legion/extensions/agentic/inference/momentum/actors/update_cognitive_momentum.rb
320
326
  - lib/legion/extensions/agentic/inference/momentum/helpers/client.rb
321
327
  - lib/legion/extensions/agentic/inference/momentum/helpers/constants.rb
322
328
  - lib/legion/extensions/agentic/inference/momentum/helpers/idea.rb
@@ -353,6 +359,7 @@ files:
353
359
  - lib/legion/extensions/agentic/inference/predictive_processing/runners/predictive_processing.rb
354
360
  - lib/legion/extensions/agentic/inference/predictive_processing/version.rb
355
361
  - lib/legion/extensions/agentic/inference/reality_testing.rb
362
+ - lib/legion/extensions/agentic/inference/reality_testing/actors/decay_beliefs.rb
356
363
  - lib/legion/extensions/agentic/inference/reality_testing/client.rb
357
364
  - lib/legion/extensions/agentic/inference/reality_testing/helpers/belief.rb
358
365
  - lib/legion/extensions/agentic/inference/reality_testing/helpers/constants.rb
@@ -374,6 +381,7 @@ files:
374
381
  - lib/legion/extensions/agentic/inference/uncertainty_tolerance/runners/uncertainty_tolerance.rb
375
382
  - lib/legion/extensions/agentic/inference/uncertainty_tolerance/version.rb
376
383
  - lib/legion/extensions/agentic/inference/version.rb
384
+ - spec/legion/extensions/agentic/inference/abductive/actors/update_abductive_reasoning_spec.rb
377
385
  - spec/legion/extensions/agentic/inference/abductive/client_spec.rb
378
386
  - spec/legion/extensions/agentic/inference/abductive/runners/abductive_reasoning_spec.rb
379
387
  - spec/legion/extensions/agentic/inference/affordance/client_spec.rb
@@ -392,6 +400,7 @@ files:
392
400
  - spec/legion/extensions/agentic/inference/bayesian/helpers/belief_network_spec.rb
393
401
  - spec/legion/extensions/agentic/inference/bayesian/helpers/belief_spec.rb
394
402
  - spec/legion/extensions/agentic/inference/bayesian/runners/bayesian_belief_spec.rb
403
+ - spec/legion/extensions/agentic/inference/belief_revision/actors/update_belief_revision_spec.rb
395
404
  - spec/legion/extensions/agentic/inference/belief_revision/client_spec.rb
396
405
  - spec/legion/extensions/agentic/inference/belief_revision/helpers/belief_network_spec.rb
397
406
  - spec/legion/extensions/agentic/inference/belief_revision/helpers/belief_spec.rb
@@ -405,6 +414,7 @@ files:
405
414
  - spec/legion/extensions/agentic/inference/causal_reasoning/helpers/causal_edge_spec.rb
406
415
  - spec/legion/extensions/agentic/inference/causal_reasoning/helpers/causal_graph_spec.rb
407
416
  - spec/legion/extensions/agentic/inference/causal_reasoning/runners/causal_reasoning_spec.rb
417
+ - spec/legion/extensions/agentic/inference/coherence/actors/update_cognitive_coherence_spec.rb
408
418
  - spec/legion/extensions/agentic/inference/coherence/client_spec.rb
409
419
  - spec/legion/extensions/agentic/inference/coherence/runners/cognitive_coherence_spec.rb
410
420
  - spec/legion/extensions/agentic/inference/counterfactual/client_spec.rb
@@ -423,10 +433,12 @@ files:
423
433
  - spec/legion/extensions/agentic/inference/enactive_cognition/helpers/enaction_engine_spec.rb
424
434
  - spec/legion/extensions/agentic/inference/enactive_cognition/helpers/sensorimotor_loop_spec.rb
425
435
  - spec/legion/extensions/agentic/inference/enactive_cognition/runners/enactive_cognition_spec.rb
436
+ - spec/legion/extensions/agentic/inference/expectation_violation/actors/decay_violations_spec.rb
426
437
  - spec/legion/extensions/agentic/inference/expectation_violation/expectation_violation_spec.rb
427
438
  - spec/legion/extensions/agentic/inference/expectation_violation/helpers/expectation_spec.rb
428
439
  - spec/legion/extensions/agentic/inference/expectation_violation/helpers/violation_engine_spec.rb
429
440
  - spec/legion/extensions/agentic/inference/expectation_violation/runners/expectation_violation_spec.rb
441
+ - spec/legion/extensions/agentic/inference/free_energy/actors/update_free_energy_spec.rb
430
442
  - spec/legion/extensions/agentic/inference/free_energy/client_spec.rb
431
443
  - spec/legion/extensions/agentic/inference/free_energy/helpers/belief_spec.rb
432
444
  - spec/legion/extensions/agentic/inference/free_energy/helpers/free_energy_engine_spec.rb
@@ -458,6 +470,7 @@ files:
458
470
  - spec/legion/extensions/agentic/inference/magnet/helpers/magnet_engine_spec.rb
459
471
  - spec/legion/extensions/agentic/inference/magnet/helpers/pole_spec.rb
460
472
  - spec/legion/extensions/agentic/inference/magnet/runners/cognitive_magnet_spec.rb
473
+ - spec/legion/extensions/agentic/inference/momentum/actors/update_cognitive_momentum_spec.rb
461
474
  - spec/legion/extensions/agentic/inference/momentum/cognitive_momentum_spec.rb
462
475
  - spec/legion/extensions/agentic/inference/momentum/helpers/idea_spec.rb
463
476
  - spec/legion/extensions/agentic/inference/momentum/helpers/momentum_engine_spec.rb
@@ -480,6 +493,7 @@ files:
480
493
  - spec/legion/extensions/agentic/inference/predictive_processing/helpers/generative_model_spec.rb
481
494
  - spec/legion/extensions/agentic/inference/predictive_processing/helpers/predictive_processor_spec.rb
482
495
  - spec/legion/extensions/agentic/inference/predictive_processing/runners/predictive_processing_spec.rb
496
+ - spec/legion/extensions/agentic/inference/reality_testing/actors/decay_beliefs_spec.rb
483
497
  - spec/legion/extensions/agentic/inference/reality_testing/client_spec.rb
484
498
  - spec/legion/extensions/agentic/inference/reality_testing/helpers/belief_spec.rb
485
499
  - spec/legion/extensions/agentic/inference/reality_testing/helpers/constants_spec.rb