lex-agentic-language 0.1.2 → 0.1.3

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: 7385a20e866c7daaa84f1e931956a482fa0f08e37f23d768734309b28bc79e8b
4
- data.tar.gz: 557bfdb9770c961b4996fb573854656378f7efd804e3f8e29642c12ea0bcc7a8
3
+ metadata.gz: 10d9347e7d48c6e3313371b8641970bcb9d13c05642dbdd98ae0f025f2e7e02c
4
+ data.tar.gz: b6c2684ee724f7674b9623def4bd54be8191c7cb000c38e1e0adda121f63f402
5
5
  SHA512:
6
- metadata.gz: 3f6a045d1fbd9362304e744711c7e94a4665876629808cb1c8b1fd8d744417d994e1539c534c2b8b375ca9448b3ccc9f8060c2e5dc1c723455f0b06055b6fc64
7
- data.tar.gz: e964d25e14a83d59cef40a1df2f27dc3984588bd94d8c8fbc754e36cc686f86701724a89b0614a2aa3aa9cf99ecfac5701b1c624e79954010731d925b85b40f7
6
+ metadata.gz: 22fbde5b49cfafbe968284d29c8ee9596128efbe4977dddc5b76d5affae44c8d93873c4eeb92a10371a7924de23e7113eb1b2c77a2c19ef7a6e6620c5c65e056
7
+ data.tar.gz: 73a363fc2b6a5f0b60b4a9725d18cb632abcce3f2c4f5b79f7977679fcebbe50f19dcb858b2e8260a32c0c949bff80ba62889f13d4616a53b822b41e1504cc96
data/CHANGELOG.md CHANGED
@@ -2,6 +2,13 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## [0.1.3] - 2026-03-22
6
+
7
+ ### Changed
8
+ - Add legion-logging, legion-settings, legion-json, legion-cache, legion-crypt, legion-data, legion-transport as runtime dependencies
9
+ - Replace direct Legion::Logging calls with injected log helper in runner modules
10
+ - Update spec_helper with real sub-gem helper stubs
11
+
5
12
  ## [0.1.2] - 2026-03-18
6
13
 
7
14
  ### Changed
@@ -24,6 +24,14 @@ Gem::Specification.new do |spec|
24
24
  end
25
25
  spec.require_paths = ['lib']
26
26
 
27
+ spec.add_dependency 'legion-cache', '>= 1.3.11'
28
+ spec.add_dependency 'legion-crypt', '>= 1.4.9'
29
+ spec.add_dependency 'legion-data', '>= 1.4.17'
30
+ spec.add_dependency 'legion-json', '>= 1.2.1'
31
+ spec.add_dependency 'legion-logging', '>= 1.3.2'
32
+ spec.add_dependency 'legion-settings', '>= 1.3.14'
33
+ spec.add_dependency 'legion-transport', '>= 1.3.9'
34
+
27
35
  spec.add_development_dependency 'rspec', '~> 3.13'
28
36
  spec.add_development_dependency 'rubocop', '~> 1.60'
29
37
  spec.add_development_dependency 'rubocop-rspec', '~> 2.26'
@@ -11,83 +11,83 @@ module Legion
11
11
  Legion::Extensions::Helpers.const_defined?(:Lex)
12
12
 
13
13
  def create_mental_space(name:, domain:, **)
14
- Legion::Logging.debug "[conceptual_blending] create_space: name=#{name} domain=#{domain}"
14
+ log.debug "[conceptual_blending] create_space: name=#{name} domain=#{domain}"
15
15
  space = engine.create_space(name: name, domain: domain)
16
16
  { success: true, space: space.to_h }
17
17
  rescue ArgumentError => e
18
- Legion::Logging.debug "[conceptual_blending] create_space failed: #{e.message}"
18
+ log.debug "[conceptual_blending] create_space failed: #{e.message}"
19
19
  { success: false, error: e.message }
20
20
  end
21
21
 
22
22
  def add_space_element(space_id:, name:, properties: {}, **)
23
- Legion::Logging.debug "[conceptual_blending] add_element: space=#{space_id} name=#{name}"
23
+ log.debug "[conceptual_blending] add_element: space=#{space_id} name=#{name}"
24
24
  engine.add_element_to_space(space_id: space_id, name: name, properties: properties)
25
25
  { success: true, space_id: space_id, element: name }
26
26
  rescue ArgumentError => e
27
- Legion::Logging.debug "[conceptual_blending] add_element failed: #{e.message}"
27
+ log.debug "[conceptual_blending] add_element failed: #{e.message}"
28
28
  { success: false, error: e.message }
29
29
  end
30
30
 
31
31
  def add_space_relation(space_id:, from:, to:, type:, **)
32
- Legion::Logging.debug "[conceptual_blending] add_relation: space=#{space_id} #{from}->#{to} type=#{type}"
32
+ log.debug "[conceptual_blending] add_relation: space=#{space_id} #{from}->#{to} type=#{type}"
33
33
  engine.add_relation_to_space(space_id: space_id, from: from, to: to, type: type)
34
34
  { success: true, space_id: space_id, relation: { from: from, to: to, type: type } }
35
35
  rescue ArgumentError => e
36
- Legion::Logging.debug "[conceptual_blending] add_relation failed: #{e.message}"
36
+ log.debug "[conceptual_blending] add_relation failed: #{e.message}"
37
37
  { success: false, error: e.message }
38
38
  end
39
39
 
40
40
  def create_blend(space_a_id:, space_b_id:, blend_type: :double_scope, **)
41
- Legion::Logging.debug "[conceptual_blending] blend: a=#{space_a_id} b=#{space_b_id} type=#{blend_type}"
41
+ log.debug "[conceptual_blending] blend: a=#{space_a_id} b=#{space_b_id} type=#{blend_type}"
42
42
  blend = engine.blend(space_a_id: space_a_id, space_b_id: space_b_id, blend_type: blend_type)
43
43
  { success: true, blend: blend.to_h }
44
44
  rescue ArgumentError => e
45
- Legion::Logging.debug "[conceptual_blending] blend failed: #{e.message}"
45
+ log.debug "[conceptual_blending] blend failed: #{e.message}"
46
46
  { success: false, error: e.message }
47
47
  end
48
48
 
49
49
  def elaborate_blend(blend_id:, emergent_property:, **)
50
- Legion::Logging.debug "[conceptual_blending] elaborate: blend=#{blend_id} property=#{emergent_property}"
50
+ log.debug "[conceptual_blending] elaborate: blend=#{blend_id} property=#{emergent_property}"
51
51
  blend = engine.elaborate_blend(blend_id: blend_id, emergent_property: emergent_property)
52
52
  { success: true, blend: blend.to_h }
53
53
  rescue ArgumentError => e
54
- Legion::Logging.debug "[conceptual_blending] elaborate failed: #{e.message}"
54
+ log.debug "[conceptual_blending] elaborate failed: #{e.message}"
55
55
  { success: false, error: e.message }
56
56
  end
57
57
 
58
58
  def compress_blend(blend_id:, removed_element:, **)
59
- Legion::Logging.debug "[conceptual_blending] compress: blend=#{blend_id} remove=#{removed_element}"
59
+ log.debug "[conceptual_blending] compress: blend=#{blend_id} remove=#{removed_element}"
60
60
  blend = engine.compress_blend(blend_id: blend_id, removed_element: removed_element)
61
61
  { success: true, blend: blend.to_h }
62
62
  rescue ArgumentError => e
63
- Legion::Logging.debug "[conceptual_blending] compress failed: #{e.message}"
63
+ log.debug "[conceptual_blending] compress failed: #{e.message}"
64
64
  { success: false, error: e.message }
65
65
  end
66
66
 
67
67
  def best_blends(limit: 5, **)
68
- Legion::Logging.debug "[conceptual_blending] best_blends: limit=#{limit}"
68
+ log.debug "[conceptual_blending] best_blends: limit=#{limit}"
69
69
  blends = engine.best_blends(limit: limit)
70
70
  { success: true, blends: blends.map(&:to_h), count: blends.size }
71
71
  end
72
72
 
73
73
  def blend_quality(blend_id:, **)
74
- Legion::Logging.debug "[conceptual_blending] blend_quality: blend=#{blend_id}"
74
+ log.debug "[conceptual_blending] blend_quality: blend=#{blend_id}"
75
75
  quality = engine.blend_quality(blend_id: blend_id)
76
76
  { success: true }.merge(quality)
77
77
  rescue ArgumentError => e
78
- Legion::Logging.debug "[conceptual_blending] blend_quality failed: #{e.message}"
78
+ log.debug "[conceptual_blending] blend_quality failed: #{e.message}"
79
79
  { success: false, error: e.message }
80
80
  end
81
81
 
82
82
  def update_conceptual_blending(**)
83
- Legion::Logging.debug '[conceptual_blending] update: decay + prune cycle'
83
+ log.debug '[conceptual_blending] update: decay + prune cycle'
84
84
  decayed = engine.decay_stale
85
85
  pruned = engine.prune_weak
86
86
  { success: true, decayed: decayed, pruned: pruned }
87
87
  end
88
88
 
89
89
  def conceptual_blending_stats(**)
90
- Legion::Logging.debug '[conceptual_blending] stats'
90
+ log.debug '[conceptual_blending] stats'
91
91
  stats = engine.to_h
92
92
  { success: true }.merge(stats)
93
93
  end
@@ -28,8 +28,8 @@ module Legion
28
28
 
29
29
  return result unless result.is_a?(Helpers::Metaphor)
30
30
 
31
- Legion::Logging.debug "[conceptual_metaphor] created #{source_domain}->#{target_domain} " \
32
- "type=#{metaphor_type} id=#{result.id[0..7]}"
31
+ log.debug "[conceptual_metaphor] created #{source_domain}->#{target_domain} " \
32
+ "type=#{metaphor_type} id=#{result.id[0..7]}"
33
33
  { success: true, metaphor_id: result.id, source_domain: source_domain,
34
34
  target_domain: target_domain, metaphor_type: metaphor_type,
35
35
  strength: result.strength, conventionality: result.conventionality }
@@ -37,45 +37,45 @@ module Legion
37
37
 
38
38
  def apply_metaphor(metaphor_id:, source_concept:, **)
39
39
  result = engine.apply_metaphor(metaphor_id: metaphor_id, source_concept: source_concept)
40
- Legion::Logging.debug "[conceptual_metaphor] apply id=#{metaphor_id[0..7]} " \
41
- "concept=#{source_concept} mapped=#{result[:mapped]}"
40
+ log.debug "[conceptual_metaphor] apply id=#{metaphor_id[0..7]} " \
41
+ "concept=#{source_concept} mapped=#{result[:mapped]}"
42
42
  { success: true }.merge(result)
43
43
  end
44
44
 
45
45
  def add_metaphor_entailment(metaphor_id:, entailment:, **)
46
46
  result = engine.add_entailment(metaphor_id: metaphor_id, entailment: entailment)
47
- Legion::Logging.debug "[conceptual_metaphor] entailment id=#{metaphor_id[0..7]} " \
48
- "success=#{result[:success]}"
47
+ log.debug "[conceptual_metaphor] entailment id=#{metaphor_id[0..7]} " \
48
+ "success=#{result[:success]}"
49
49
  result
50
50
  end
51
51
 
52
52
  def find_metaphors_for(domain:, **)
53
53
  metaphors = engine.find_by_domain(domain: domain)
54
- Legion::Logging.debug "[conceptual_metaphor] find domain=#{domain} count=#{metaphors.size}"
54
+ log.debug "[conceptual_metaphor] find domain=#{domain} count=#{metaphors.size}"
55
55
  { success: true, domain: domain, metaphors: metaphors.map(&:to_h), count: metaphors.size }
56
56
  end
57
57
 
58
58
  def conventional_metaphors(**)
59
59
  metaphors = engine.conventional_metaphors
60
- Legion::Logging.debug "[conceptual_metaphor] conventional count=#{metaphors.size}"
60
+ log.debug "[conceptual_metaphor] conventional count=#{metaphors.size}"
61
61
  { success: true, metaphors: metaphors.map(&:to_h), count: metaphors.size }
62
62
  end
63
63
 
64
64
  def novel_metaphors(**)
65
65
  metaphors = engine.novel_metaphors
66
- Legion::Logging.debug "[conceptual_metaphor] novel count=#{metaphors.size}"
66
+ log.debug "[conceptual_metaphor] novel count=#{metaphors.size}"
67
67
  { success: true, metaphors: metaphors.map(&:to_h), count: metaphors.size }
68
68
  end
69
69
 
70
70
  def strongest_metaphors(limit: 5, **)
71
71
  metaphors = engine.strongest(limit: limit)
72
- Legion::Logging.debug "[conceptual_metaphor] strongest limit=#{limit} count=#{metaphors.size}"
72
+ log.debug "[conceptual_metaphor] strongest limit=#{limit} count=#{metaphors.size}"
73
73
  { success: true, metaphors: metaphors.map(&:to_h), count: metaphors.size }
74
74
  end
75
75
 
76
76
  def metaphors_by_type(metaphor_type:, **)
77
77
  metaphors = engine.by_type(metaphor_type: metaphor_type)
78
- Legion::Logging.debug "[conceptual_metaphor] by_type=#{metaphor_type} count=#{metaphors.size}"
78
+ log.debug "[conceptual_metaphor] by_type=#{metaphor_type} count=#{metaphors.size}"
79
79
  { success: true, metaphor_type: metaphor_type, metaphors: metaphors.map(&:to_h),
80
80
  count: metaphors.size }
81
81
  end
@@ -83,13 +83,13 @@ module Legion
83
83
  def update_conceptual_metaphor(**)
84
84
  engine.decay_all
85
85
  pruned = engine.prune_weak
86
- Legion::Logging.debug "[conceptual_metaphor] decay+prune pruned=#{pruned}"
86
+ log.debug "[conceptual_metaphor] decay+prune pruned=#{pruned}"
87
87
  { success: true, pruned: pruned }
88
88
  end
89
89
 
90
90
  def conceptual_metaphor_stats(**)
91
91
  stats = engine.to_h
92
- Legion::Logging.debug "[conceptual_metaphor] stats total=#{stats[:total_metaphors]}"
92
+ log.debug "[conceptual_metaphor] stats total=#{stats[:total_metaphors]}"
93
93
  { success: true }.merge(stats)
94
94
  end
95
95
 
@@ -17,7 +17,7 @@ module Legion
17
17
  expression_type: expression_type,
18
18
  domain: domain
19
19
  )
20
- Legion::Logging.debug "[cognitive_grammar] created construction form=#{form} type=#{expression_type} domain=#{domain}"
20
+ log.debug "[cognitive_grammar] created construction form=#{form} type=#{expression_type} domain=#{domain}"
21
21
  construction.to_h
22
22
  end
23
23
 
@@ -34,7 +34,7 @@ module Legion
34
34
  dynamicity: dynamicity,
35
35
  construction_id: construction_id
36
36
  )
37
- Legion::Logging.debug "[cognitive_grammar] created construal scene=#{scene} figure=#{figure}"
37
+ log.debug "[cognitive_grammar] created construal scene=#{scene} figure=#{figure}"
38
38
  construal.to_h
39
39
  end
40
40
 
@@ -44,31 +44,31 @@ module Legion
44
44
 
45
45
  msg = "[cognitive_grammar] used construction id=#{construction_id[0..7]} " \
46
46
  "usage_count=#{construction.usage_count} activation=#{construction.activation.round(3)}"
47
- Legion::Logging.debug msg
47
+ log.debug msg
48
48
  { found: true, construction: construction.to_h }
49
49
  end
50
50
 
51
51
  def construals_for_scene_report(scene:, **)
52
52
  construals = engine.construals_for_scene(scene: scene)
53
- Legion::Logging.debug "[cognitive_grammar] construals_for_scene scene=#{scene} count=#{construals.size}"
53
+ log.debug "[cognitive_grammar] construals_for_scene scene=#{scene} count=#{construals.size}"
54
54
  { scene: scene, count: construals.size, construals: construals.map(&:to_h) }
55
55
  end
56
56
 
57
57
  def entrenched_constructions_report(**)
58
58
  constructions = engine.entrenched_constructions
59
- Legion::Logging.debug "[cognitive_grammar] entrenched constructions count=#{constructions.size}"
59
+ log.debug "[cognitive_grammar] entrenched constructions count=#{constructions.size}"
60
60
  { count: constructions.size, constructions: constructions.map(&:to_h) }
61
61
  end
62
62
 
63
63
  def constructions_by_domain_report(domain:, **)
64
64
  constructions = engine.constructions_by_domain(domain: domain)
65
- Legion::Logging.debug "[cognitive_grammar] constructions_by_domain domain=#{domain} count=#{constructions.size}"
65
+ log.debug "[cognitive_grammar] constructions_by_domain domain=#{domain} count=#{constructions.size}"
66
66
  { domain: domain, count: constructions.size, constructions: constructions.map(&:to_h) }
67
67
  end
68
68
 
69
69
  def most_used_constructions(limit: 5, **)
70
70
  constructions = engine.most_used(limit: limit)
71
- Legion::Logging.debug "[cognitive_grammar] most_used limit=#{limit} count=#{constructions.size}"
71
+ log.debug "[cognitive_grammar] most_used limit=#{limit} count=#{constructions.size}"
72
72
  { limit: limit, count: constructions.size, constructions: constructions.map(&:to_h) }
73
73
  end
74
74
 
@@ -76,13 +76,13 @@ module Legion
76
76
  engine.decay_all
77
77
  pruned = engine.prune_inactive
78
78
  stats = engine.to_h
79
- Legion::Logging.debug "[cognitive_grammar] update: pruned=#{pruned} remaining=#{stats[:constructions_count]}"
79
+ log.debug "[cognitive_grammar] update: pruned=#{pruned} remaining=#{stats[:constructions_count]}"
80
80
  { pruned: pruned, stats: stats }
81
81
  end
82
82
 
83
83
  def cognitive_grammar_stats(**)
84
84
  stats = engine.to_h
85
- Legion::Logging.debug "[cognitive_grammar] stats constructions=#{stats[:constructions_count]} construals=#{stats[:construals_count]}"
85
+ log.debug "[cognitive_grammar] stats constructions=#{stats[:constructions_count]} construals=#{stats[:construals_count]}"
86
86
  stats
87
87
  end
88
88
 
@@ -15,8 +15,8 @@ module Legion
15
15
  summary = Helpers::Summarizer.summarize_domain(traces, domain: domain.to_sym, depth: depth.to_sym)
16
16
  lexicon.store_summary(domain, summary)
17
17
 
18
- Legion::Logging.debug "[language] summarize domain=#{domain} traces=#{traces.size} " \
19
- "knowledge=#{summary[:knowledge_level]}"
18
+ log.debug "[language] summarize domain=#{domain} traces=#{traces.size} " \
19
+ "knowledge=#{summary[:knowledge_level]}"
20
20
  summary
21
21
  end
22
22
 
@@ -12,7 +12,7 @@ module Legion
12
12
 
13
13
  def create_narrative(title:, domain: nil, **)
14
14
  narrative = narrative_engine.create_narrative(title: title, domain: domain)
15
- Legion::Logging.debug "[narrative_reasoning] created narrative id=#{narrative.id[0..7]} title=#{title}"
15
+ log.debug "[narrative_reasoning] created narrative id=#{narrative.id[0..7]} title=#{title}"
16
16
  { success: true, narrative_id: narrative.id, title: narrative.title, arc_stage: narrative.arc_stage }
17
17
  end
18
18
 
@@ -30,10 +30,10 @@ module Legion
30
30
  )
31
31
 
32
32
  if event
33
- Legion::Logging.debug "[narrative_reasoning] event added id=#{event.id[0..7]} type=#{event_type}"
33
+ log.debug "[narrative_reasoning] event added id=#{event.id[0..7]} type=#{event_type}"
34
34
  { success: true, event_id: event.id, event_type: event_type, narrative_id: narrative_id }
35
35
  else
36
- Legion::Logging.debug "[narrative_reasoning] add_event failed: narrative #{narrative_id[0..7]} not found"
36
+ log.debug "[narrative_reasoning] add_event failed: narrative #{narrative_id[0..7]} not found"
37
37
  { success: false, error: :narrative_not_found }
38
38
  end
39
39
  end
@@ -41,7 +41,7 @@ module Legion
41
41
  def add_narrative_theme(narrative_id:, theme:, **)
42
42
  result = narrative_engine.add_narrative_theme(narrative_id: narrative_id, theme: theme)
43
43
  if result
44
- Legion::Logging.debug "[narrative_reasoning] theme added theme=#{theme} to #{narrative_id[0..7]}"
44
+ log.debug "[narrative_reasoning] theme added theme=#{theme} to #{narrative_id[0..7]}"
45
45
  { success: true, narrative_id: narrative_id, theme: theme }
46
46
  else
47
47
  { success: false, error: :narrative_not_found }
@@ -51,7 +51,7 @@ module Legion
51
51
  def advance_narrative_arc(narrative_id:, **)
52
52
  new_stage = narrative_engine.advance_narrative(narrative_id: narrative_id)
53
53
  if new_stage
54
- Legion::Logging.debug "[narrative_reasoning] arc advanced to #{new_stage} for #{narrative_id[0..7]}"
54
+ log.debug "[narrative_reasoning] arc advanced to #{new_stage} for #{narrative_id[0..7]}"
55
55
  { success: true, narrative_id: narrative_id, arc_stage: new_stage }
56
56
  else
57
57
  { success: false, error: :narrative_not_found }
@@ -63,33 +63,33 @@ module Legion
63
63
  narrative = narrative_engine.get(narrative_id)
64
64
  return { success: false, error: :narrative_not_found } unless narrative
65
65
 
66
- Legion::Logging.debug "[narrative_reasoning] causal chain length=#{chain.size} for #{narrative_id[0..7]}"
66
+ log.debug "[narrative_reasoning] causal chain length=#{chain.size} for #{narrative_id[0..7]}"
67
67
  { success: true, narrative_id: narrative_id, chain: chain, link_count: chain.size }
68
68
  end
69
69
 
70
70
  def complete_narratives(**)
71
71
  narratives = narrative_engine.complete_narratives
72
- Legion::Logging.debug "[narrative_reasoning] complete narratives count=#{narratives.size}"
72
+ log.debug "[narrative_reasoning] complete narratives count=#{narratives.size}"
73
73
  { success: true, narratives: narratives.map(&:to_h), count: narratives.size }
74
74
  end
75
75
 
76
76
  def domain_narratives(domain:, **)
77
77
  narratives = narrative_engine.by_domain(domain: domain)
78
- Legion::Logging.debug "[narrative_reasoning] domain=#{domain} count=#{narratives.size}"
78
+ log.debug "[narrative_reasoning] domain=#{domain} count=#{narratives.size}"
79
79
  { success: true, domain: domain, narratives: narratives.map(&:to_h), count: narratives.size }
80
80
  end
81
81
 
82
82
  def most_coherent_narratives(limit: 5, **)
83
83
  lim = limit.to_i.clamp(1, 50)
84
84
  narratives = narrative_engine.most_coherent(limit: lim)
85
- Legion::Logging.debug "[narrative_reasoning] most_coherent limit=#{lim} returned=#{narratives.size}"
85
+ log.debug "[narrative_reasoning] most_coherent limit=#{lim} returned=#{narratives.size}"
86
86
  { success: true, narratives: narratives.map(&:to_h), count: narratives.size }
87
87
  end
88
88
 
89
89
  def update_narrative_reasoning(**)
90
90
  narrative_engine.decay_all
91
91
  count = narrative_engine.count
92
- Legion::Logging.debug "[narrative_reasoning] decay cycle complete narratives=#{count}"
92
+ log.debug "[narrative_reasoning] decay cycle complete narratives=#{count}"
93
93
  { success: true, narratives_updated: count }
94
94
  end
95
95
 
@@ -97,7 +97,7 @@ module Legion
97
97
  engine = narrative_engine
98
98
  complete = engine.complete_narratives.size
99
99
  most_coh = engine.most_coherent(limit: 1).first
100
- Legion::Logging.debug "[narrative_reasoning] stats count=#{engine.count} complete=#{complete}"
100
+ log.debug "[narrative_reasoning] stats count=#{engine.count} complete=#{complete}"
101
101
  {
102
102
  success: true,
103
103
  total_narratives: engine.count,
@@ -19,7 +19,7 @@ module Legion
19
19
  if llm_result
20
20
  entry = entry.merge(narrative: llm_result, source: :llm)
21
21
  journal.append(entry)
22
- Legion::Logging.debug "[narrator] mood=#{entry[:mood]} source=llm sections=#{entry[:sections].keys.size}"
22
+ log.debug "[narrator] mood=#{entry[:mood]} source=llm sections=#{entry[:sections].keys.size}"
23
23
  return {
24
24
  narrative: entry[:narrative],
25
25
  mood: entry[:mood],
@@ -31,7 +31,7 @@ module Legion
31
31
  end
32
32
 
33
33
  journal.append(entry)
34
- Legion::Logging.debug "[narrator] mood=#{entry[:mood]} sections=#{entry[:sections].keys.size}"
34
+ log.debug "[narrator] mood=#{entry[:mood]} sections=#{entry[:sections].keys.size}"
35
35
 
36
36
  {
37
37
  narrative: entry[:narrative],
@@ -23,9 +23,9 @@ module Legion
23
23
  maxim_scores: maxim_scores
24
24
  )
25
25
 
26
- Legion::Logging.debug "[pragmatic_inference] analyzed utterance id=#{utterance.id[0..7]} " \
27
- "speaker=#{speaker} speech_act=#{speech_act} " \
28
- "compliance=#{utterance.overall_compliance.round(2)}"
26
+ log.debug "[pragmatic_inference] analyzed utterance id=#{utterance.id[0..7]} " \
27
+ "speaker=#{speaker} speech_act=#{speech_act} " \
28
+ "compliance=#{utterance.overall_compliance.round(2)}"
29
29
 
30
30
  { success: true, utterance_id: utterance.id, overall_compliance: utterance.overall_compliance,
31
31
  violated_maxims: utterance.violated_maxims }
@@ -36,7 +36,7 @@ module Legion
36
36
 
37
37
  violations = engine.detect_violations(utterance_id: utterance_id)
38
38
 
39
- Legion::Logging.debug "[pragmatic_inference] violations detected id=#{utterance_id[0..7]} count=#{violations.size}"
39
+ log.debug "[pragmatic_inference] violations detected id=#{utterance_id[0..7]} count=#{violations.size}"
40
40
 
41
41
  { success: true, utterance_id: utterance_id, violations: violations, violation_count: violations.size }
42
42
  end
@@ -48,10 +48,10 @@ module Legion
48
48
  result = engine.generate_implicature(utterance_id: utterance_id, inferred_meaning: inferred_meaning)
49
49
 
50
50
  if result
51
- Legion::Logging.debug "[pragmatic_inference] implicature added id=#{utterance_id[0..7]}"
51
+ log.debug "[pragmatic_inference] implicature added id=#{utterance_id[0..7]}"
52
52
  { success: true, utterance_id: utterance_id, inferred_meaning: result }
53
53
  else
54
- Legion::Logging.debug "[pragmatic_inference] implicature failed: utterance not found id=#{utterance_id[0..7]}"
54
+ log.debug "[pragmatic_inference] implicature failed: utterance not found id=#{utterance_id[0..7]}"
55
55
  { success: false, error: :utterance_not_found }
56
56
  end
57
57
  end
@@ -61,8 +61,8 @@ module Legion
61
61
 
62
62
  profile = engine.speaker_profile(speaker: speaker)
63
63
 
64
- Legion::Logging.debug "[pragmatic_inference] speaker profile speaker=#{speaker} " \
65
- "utterances=#{profile[:utterance_count]}"
64
+ log.debug "[pragmatic_inference] speaker profile speaker=#{speaker} " \
65
+ "utterances=#{profile[:utterance_count]}"
66
66
 
67
67
  { success: true, **profile }
68
68
  end
@@ -72,7 +72,7 @@ module Legion
72
72
 
73
73
  utterances = engine.by_speech_act(speech_act: speech_act)
74
74
 
75
- Legion::Logging.debug "[pragmatic_inference] by_speech_act act=#{speech_act} count=#{utterances.size}"
75
+ log.debug "[pragmatic_inference] by_speech_act act=#{speech_act} count=#{utterances.size}"
76
76
 
77
77
  { success: true, speech_act: speech_act, utterances: utterances.map(&:to_h), count: utterances.size }
78
78
  end
@@ -82,7 +82,7 @@ module Legion
82
82
 
83
83
  utterances = engine.by_speaker(speaker: speaker)
84
84
 
85
- Legion::Logging.debug "[pragmatic_inference] by_speaker speaker=#{speaker} count=#{utterances.size}"
85
+ log.debug "[pragmatic_inference] by_speaker speaker=#{speaker} count=#{utterances.size}"
86
86
 
87
87
  { success: true, speaker: speaker, utterances: utterances.map(&:to_h), count: utterances.size }
88
88
  end
@@ -90,7 +90,7 @@ module Legion
90
90
  def most_violated_maxim(**)
91
91
  maxim = engine.most_violated_maxim
92
92
 
93
- Legion::Logging.debug "[pragmatic_inference] most violated maxim=#{maxim.inspect}"
93
+ log.debug "[pragmatic_inference] most violated maxim=#{maxim.inspect}"
94
94
 
95
95
  { success: true, maxim: maxim,
96
96
  description: maxim ? Helpers::Constants::MAXIM_DESCRIPTIONS[maxim] : nil }
@@ -100,7 +100,7 @@ module Legion
100
100
  cooperation = engine.overall_cooperation
101
101
  total = engine.count
102
102
 
103
- Legion::Logging.debug "[pragmatic_inference] cooperation=#{cooperation.round(2)} total=#{total}"
103
+ log.debug "[pragmatic_inference] cooperation=#{cooperation.round(2)} total=#{total}"
104
104
 
105
105
  { success: true, cooperation: cooperation, utterance_count: total }
106
106
  end
@@ -108,7 +108,7 @@ module Legion
108
108
  def update_pragmatic_inference(**)
109
109
  engine.decay_all
110
110
 
111
- Legion::Logging.debug "[pragmatic_inference] decay applied to #{engine.count} utterances"
111
+ log.debug "[pragmatic_inference] decay applied to #{engine.count} utterances"
112
112
 
113
113
  { success: true, decayed_count: engine.count, decay_rate: Helpers::Constants::DECAY_RATE }
114
114
  end
@@ -116,8 +116,8 @@ module Legion
116
116
  def pragmatic_inference_stats(**)
117
117
  stats = engine.to_h
118
118
 
119
- Legion::Logging.debug "[pragmatic_inference] stats: utterances=#{stats[:utterance_count]} " \
120
- "cooperation=#{stats[:overall_cooperation]}"
119
+ log.debug "[pragmatic_inference] stats: utterances=#{stats[:utterance_count]} " \
120
+ "cooperation=#{stats[:overall_cooperation]}"
121
121
 
122
122
  { success: true, **stats }
123
123
  end
@@ -4,7 +4,7 @@ module Legion
4
4
  module Extensions
5
5
  module Agentic
6
6
  module Language
7
- VERSION = '0.1.2'
7
+ VERSION = '0.1.3'
8
8
  end
9
9
  end
10
10
  end
data/spec/spec_helper.rb CHANGED
@@ -1,24 +1,35 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'bundler/setup'
4
+ require 'legion/logging'
5
+ require 'legion/settings'
6
+ require 'legion/cache/helper'
7
+ require 'legion/crypt/helper'
8
+ require 'legion/data/helper'
9
+ require 'legion/json/helper'
10
+ require 'legion/transport/helper'
4
11
 
5
12
  module Legion
6
- module Logging
7
- def self.debug(_msg); end
8
- def self.info(_msg); end
9
- def self.warn(_msg); end
10
- def self.error(_msg); end
11
- def self.fatal(_msg); end
12
- end
13
-
14
13
  module Extensions
15
- module Core
16
- def self.extended(_base); end
17
- end
18
-
19
14
  module Helpers
20
15
  module Lex
21
- def self.included(_base); end
16
+ include Legion::Logging::Helper
17
+ include Legion::Settings::Helper
18
+ include Legion::Cache::Helper
19
+ include Legion::Crypt::Helper
20
+ include Legion::Data::Helper
21
+ include Legion::JSON::Helper
22
+ include Legion::Transport::Helper
23
+ end
24
+ end
25
+
26
+ module Actors
27
+ class Every
28
+ include Helpers::Lex
29
+ end
30
+
31
+ class Once
32
+ include Helpers::Lex
22
33
  end
23
34
  end
24
35
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lex-agentic-language
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Esity
@@ -9,6 +9,104 @@ bindir: bin
9
9
  cert_chain: []
10
10
  date: 1980-01-02 00:00:00.000000000 Z
11
11
  dependencies:
12
+ - !ruby/object:Gem::Dependency
13
+ name: legion-cache
14
+ requirement: !ruby/object:Gem::Requirement
15
+ requirements:
16
+ - - ">="
17
+ - !ruby/object:Gem::Version
18
+ version: 1.3.11
19
+ type: :runtime
20
+ prerelease: false
21
+ version_requirements: !ruby/object:Gem::Requirement
22
+ requirements:
23
+ - - ">="
24
+ - !ruby/object:Gem::Version
25
+ version: 1.3.11
26
+ - !ruby/object:Gem::Dependency
27
+ name: legion-crypt
28
+ requirement: !ruby/object:Gem::Requirement
29
+ requirements:
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: 1.4.9
33
+ type: :runtime
34
+ prerelease: false
35
+ version_requirements: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ version: 1.4.9
40
+ - !ruby/object:Gem::Dependency
41
+ name: legion-data
42
+ requirement: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: 1.4.17
47
+ type: :runtime
48
+ prerelease: false
49
+ version_requirements: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ version: 1.4.17
54
+ - !ruby/object:Gem::Dependency
55
+ name: legion-json
56
+ requirement: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: 1.2.1
61
+ type: :runtime
62
+ prerelease: false
63
+ version_requirements: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - ">="
66
+ - !ruby/object:Gem::Version
67
+ version: 1.2.1
68
+ - !ruby/object:Gem::Dependency
69
+ name: legion-logging
70
+ requirement: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ version: 1.3.2
75
+ type: :runtime
76
+ prerelease: false
77
+ version_requirements: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - ">="
80
+ - !ruby/object:Gem::Version
81
+ version: 1.3.2
82
+ - !ruby/object:Gem::Dependency
83
+ name: legion-settings
84
+ requirement: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - ">="
87
+ - !ruby/object:Gem::Version
88
+ version: 1.3.14
89
+ type: :runtime
90
+ prerelease: false
91
+ version_requirements: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - ">="
94
+ - !ruby/object:Gem::Version
95
+ version: 1.3.14
96
+ - !ruby/object:Gem::Dependency
97
+ name: legion-transport
98
+ requirement: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - ">="
101
+ - !ruby/object:Gem::Version
102
+ version: 1.3.9
103
+ type: :runtime
104
+ prerelease: false
105
+ version_requirements: !ruby/object:Gem::Requirement
106
+ requirements:
107
+ - - ">="
108
+ - !ruby/object:Gem::Version
109
+ version: 1.3.9
12
110
  - !ruby/object:Gem::Dependency
13
111
  name: rspec
14
112
  requirement: !ruby/object:Gem::Requirement