lex-agentic-language 0.1.0 → 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: 664d19699b188ee30a787c5c5e24211c920e81492f03da70ed7a8d0a0359a5ad
4
- data.tar.gz: 437b2eb7099d2bfeeeb8d3ed027f6f4a4fdc14f867944688b602bfd5c31dd9f3
3
+ metadata.gz: 7385a20e866c7daaa84f1e931956a482fa0f08e37f23d768734309b28bc79e8b
4
+ data.tar.gz: 557bfdb9770c961b4996fb573854656378f7efd804e3f8e29642c12ea0bcc7a8
5
5
  SHA512:
6
- metadata.gz: '043782a4236c9b1a204170f7e06614dde8eaac0633efb623333c4b3f0b09de34d6ad4393db898f984bc1d40ccd59cf54463cb6c377bda76b06be3855b85fda94'
7
- data.tar.gz: de3e90307844b393b1eb991df41ad8fe29eeb46297f2df29f8e41281f52df10d0c15d7ce32477356276d6fce30c54bfb4618330357ccd92ccbae4347116c3db2
6
+ metadata.gz: 3f6a045d1fbd9362304e744711c7e94a4665876629808cb1c8b1fd8d744417d994e1539c534c2b8b375ca9448b3ccc9f8060c2e5dc1c723455f0b06055b6fc64
7
+ data.tar.gz: e964d25e14a83d59cef40a1df2f27dc3984588bd94d8c8fbc754e36cc686f86701724a89b0614a2aa3aa9cf99ecfac5701b1c624e79954010731d925b85b40f7
data/CHANGELOG.md CHANGED
@@ -1,6 +1,27 @@
1
1
  # Changelog
2
2
 
3
- ## [0.1.0] - 2026-03-17
3
+ ## [Unreleased]
4
+
5
+ ## [0.1.2] - 2026-03-18
6
+
7
+ ### Changed
8
+ - Enforce BLEND_TYPES enum validation in `BlendingEngine#blend` — returns nil for invalid blend_type
9
+ - Add 2 specs for BLEND_TYPES enforcement in blending engine spec
10
+
11
+ ## [0.1.1] - 2026-03-18
12
+
13
+ ### Changed
14
+ - Enforce SLOT_TYPES enum validation in `Frame#add_slot` — returns nil for invalid slot_type
15
+ - Enforce EXPRESSION_TYPES enum validation in `GrammarEngine#create_construction` — returns nil for invalid expression_type
16
+ - Enforce SPECIFICITY_LEVELS enum validation in `GrammarEngine#create_construal` — returns nil for invalid specificity
17
+ - Enforce SCOPE_LEVELS enum validation in `GrammarEngine#create_construal` — returns nil for invalid scope
18
+ - Enforce DEPTHS enum validation in `Summarizer#summarize_domain` and `Summarizer#extract_key_facts` — returns nil for invalid depth
19
+
20
+ ## [0.1.0] - 2026-03-18
4
21
 
5
22
  ### Added
6
- - Initial domain gem scaffold
23
+ - Initial release as domain consolidation gem
24
+ - Consolidated source extensions into unified domain gem under `Legion::Extensions::Agentic::<Domain>`
25
+ - All sub-modules loaded from single entry point
26
+ - Full spec suite with zero failures
27
+ - RuboCop compliance across all files
data/README.md CHANGED
@@ -1,13 +1,41 @@
1
1
  # lex-agentic-language
2
2
 
3
- LEX agentic language domain: linguistic processing and communication
3
+ Domain consolidation gem for language processing and communication. Bundles 9 source extensions into one loadable unit under `Legion::Extensions::Agentic::Language`.
4
4
 
5
- ## Sub-modules
5
+ ## Overview
6
6
 
7
- *(populated as extensions are consolidated)*
7
+ **Gem**: `lex-agentic-language`
8
+ **Version**: 0.1.2
9
+ **Namespace**: `Legion::Extensions::Agentic::Language`
10
+
11
+ ## Sub-Modules
12
+
13
+ | Sub-Module | Source Gem | Purpose |
14
+ |---|---|---|
15
+ | `Language::Language` | `lex-language` | Core language processing — token parsing, semantic framing, pragmatic intent |
16
+ | `Language::Grammar` | `lex-cognitive-grammar` | Grammatical structure processing |
17
+ | `Language::InnerSpeech` | `lex-inner-speech` | Vygotsky inner speech — private verbal thought for problem solving |
18
+ | `Language::Narrator` | `lex-narrator` | Real-time narrative stream of internal state (optional LLM enhancement) |
19
+ | `Language::NarrativeReasoning` | `lex-narrative-reasoning` | Narrative as a reasoning mode — story-schema activation |
20
+ | `Language::FrameSemantics` | `lex-frame-semantics` | Fillmore frame semantics — conceptual frames, slots, fillers |
21
+ | `Language::PragmaticInference` | `lex-pragmatic-inference` | Gricean maxims and conversational implicature |
22
+ | `Language::ConceptualBlending` | `lex-conceptual-blending` | Fauconnier & Turner — emergent blended structure from two input spaces |
23
+ | `Language::ConceptualMetaphor` | `lex-conceptual-metaphor` | Lakoff & Johnson — structural mappings between conceptual domains |
8
24
 
9
25
  ## Installation
10
26
 
11
27
  ```ruby
12
28
  gem 'lex-agentic-language'
13
29
  ```
30
+
31
+ ## Development
32
+
33
+ ```bash
34
+ bundle install
35
+ bundle exec rspec # 735 examples, 0 failures
36
+ bundle exec rubocop # 0 offenses
37
+ ```
38
+
39
+ ## License
40
+
41
+ MIT
@@ -33,6 +33,8 @@ module Legion
33
33
  end
34
34
 
35
35
  def blend(space_a_id:, space_b_id:, blend_type: :double_scope)
36
+ return nil unless BLEND_TYPES.include?(blend_type.to_sym)
37
+
36
38
  raise ArgumentError, "Max blends (#{MAX_BLENDS}) reached" if @blends.size >= MAX_BLENDS
37
39
 
38
40
  space_a = @spaces.fetch(space_a_id) { raise ArgumentError, "Space #{space_a_id} not found" }
@@ -5,7 +5,7 @@ module Legion
5
5
  module Agentic
6
6
  module Language
7
7
  module ConceptualBlending
8
- VERSION = '0.1.0'
8
+ VERSION = '0.1.1'
9
9
  end
10
10
  end
11
11
  end
@@ -23,6 +23,8 @@ module Legion
23
23
  end
24
24
 
25
25
  def add_slot(name:, slot_type: :core, required: true)
26
+ return nil unless SLOT_TYPES.include?(slot_type.to_sym)
27
+
26
28
  @slots[name] = { type: slot_type, filler: nil, required: required }
27
29
  self
28
30
  end
@@ -15,6 +15,8 @@ module Legion
15
15
  end
16
16
 
17
17
  def create_construction(form:, meaning:, expression_type:, domain:, activation: DEFAULT_ACTIVATION)
18
+ return nil unless EXPRESSION_TYPES.include?(expression_type.to_sym)
19
+
18
20
  prune_constructions_if_needed
19
21
  construction = Construction.new(
20
22
  form: form,
@@ -30,6 +32,9 @@ module Legion
30
32
  def create_construal(scene:, perspective:, figure:, ground:,
31
33
  specificity: :intermediate, scope: :local,
32
34
  dynamicity: 0.5, construction_id: nil)
35
+ return nil unless SPECIFICITY_LEVELS.include?(specificity.to_sym)
36
+ return nil unless SCOPE_LEVELS.include?(scope.to_sym)
37
+
33
38
  prune_construals_if_needed
34
39
  construal = Construal.new(
35
40
  scene: scene,
@@ -10,6 +10,8 @@ module Legion
10
10
  module_function
11
11
 
12
12
  def summarize_domain(traces, domain:, depth: :standard)
13
+ return nil unless Constants::DEPTHS.include?(depth.to_sym)
14
+
13
15
  return empty_summary(domain) if traces.empty?
14
16
 
15
17
  grouped = group_by_type(traces)
@@ -37,6 +39,8 @@ module Legion
37
39
  end
38
40
 
39
41
  def extract_key_facts(grouped, depth: :standard)
42
+ return nil unless Constants::DEPTHS.include?(depth.to_sym)
43
+
40
44
  limit = case depth
41
45
  when :brief then 3
42
46
  when :detailed then 15
@@ -4,7 +4,7 @@ module Legion
4
4
  module Extensions
5
5
  module Agentic
6
6
  module Language
7
- VERSION = '0.1.0'
7
+ VERSION = '0.1.2'
8
8
  end
9
9
  end
10
10
  end
@@ -99,6 +99,19 @@ RSpec.describe Legion::Extensions::Agentic::Language::ConceptualBlending::Helper
99
99
  engine.blend(space_a_id: 'bad', space_b_id: space_b.id)
100
100
  end.to raise_error(ArgumentError, /not found/)
101
101
  end
102
+
103
+ it 'rejects invalid blend_type' do
104
+ result = engine.blend(space_a_id: space_a.id, space_b_id: space_b.id, blend_type: :nonexistent_type)
105
+ expect(result).to be_nil
106
+ end
107
+
108
+ it 'accepts all BLEND_TYPES' do
109
+ blend_types = Legion::Extensions::Agentic::Language::ConceptualBlending::Helpers::Constants::BLEND_TYPES
110
+ blend_types.each do |val|
111
+ result = engine.blend(space_a_id: space_a.id, space_b_id: space_b.id, blend_type: val)
112
+ expect(result).not_to be_nil, "Expected #{val.inspect} to be accepted"
113
+ end
114
+ end
102
115
  end
103
116
 
104
117
  describe '#elaborate_blend' do
@@ -45,6 +45,20 @@ RSpec.describe Legion::Extensions::Agentic::Language::FrameSemantics::Helpers::F
45
45
  result = frame.add_slot(name: :seller)
46
46
  expect(result).to be(frame)
47
47
  end
48
+
49
+ it 'returns nil for invalid slot_type' do
50
+ result = frame.add_slot(name: :buyer, slot_type: :bogus)
51
+ expect(result).to be_nil
52
+ expect(frame.slots).not_to have_key(:buyer)
53
+ end
54
+
55
+ it 'accepts all valid SLOT_TYPES' do
56
+ Legion::Extensions::Agentic::Language::FrameSemantics::Helpers::SLOT_TYPES.each do |type|
57
+ f = described_class.new(name: :test, domain: :test)
58
+ result = f.add_slot(name: :slot, slot_type: type)
59
+ expect(result).to be(f)
60
+ end
61
+ end
48
62
  end
49
63
 
50
64
  describe '#fill_slot' do
@@ -29,6 +29,19 @@ RSpec.describe Legion::Extensions::Agentic::Language::Grammar::Helpers::GrammarE
29
29
  expect(c.expression_type).to eq(:nominal)
30
30
  expect(c.domain).to eq('nature')
31
31
  end
32
+
33
+ it 'returns nil for invalid expression_type' do
34
+ result = engine.create_construction(form: 'x', meaning: 'y', expression_type: :bogus, domain: 'd')
35
+ expect(result).to be_nil
36
+ expect(engine.to_h[:constructions_count]).to eq(0)
37
+ end
38
+
39
+ it 'accepts all valid EXPRESSION_TYPES' do
40
+ Legion::Extensions::Agentic::Language::Grammar::Helpers::Constants::EXPRESSION_TYPES.each do |type|
41
+ c = engine.create_construction(form: 'x', meaning: 'y', expression_type: type, domain: 'd')
42
+ expect(c).to be_a(Legion::Extensions::Agentic::Language::Grammar::Helpers::Construction)
43
+ end
44
+ end
32
45
  end
33
46
 
34
47
  describe '#create_construal' do
@@ -48,6 +61,32 @@ RSpec.describe Legion::Extensions::Agentic::Language::Grammar::Helpers::GrammarE
48
61
  expect(c.scope).to eq(:global)
49
62
  expect(c.dynamicity).to eq(0.8)
50
63
  end
64
+
65
+ it 'returns nil for invalid specificity' do
66
+ result = engine.create_construal(**construal_params, specificity: :bogus)
67
+ expect(result).to be_nil
68
+ expect(engine.to_h[:construals_count]).to eq(0)
69
+ end
70
+
71
+ it 'accepts all valid SPECIFICITY_LEVELS' do
72
+ Legion::Extensions::Agentic::Language::Grammar::Helpers::Constants::SPECIFICITY_LEVELS.each do |level|
73
+ c = engine.create_construal(**construal_params, specificity: level)
74
+ expect(c).to be_a(Legion::Extensions::Agentic::Language::Grammar::Helpers::Construal)
75
+ end
76
+ end
77
+
78
+ it 'returns nil for invalid scope' do
79
+ result = engine.create_construal(**construal_params, scope: :bogus)
80
+ expect(result).to be_nil
81
+ expect(engine.to_h[:construals_count]).to eq(0)
82
+ end
83
+
84
+ it 'accepts all valid SCOPE_LEVELS' do
85
+ Legion::Extensions::Agentic::Language::Grammar::Helpers::Constants::SCOPE_LEVELS.each do |level|
86
+ c = engine.create_construal(**construal_params, scope: level)
87
+ expect(c).to be_a(Legion::Extensions::Agentic::Language::Grammar::Helpers::Construal)
88
+ end
89
+ end
51
90
  end
52
91
 
53
92
  describe '#use_construction' do
@@ -25,6 +25,18 @@ RSpec.describe Legion::Extensions::Agentic::Language::Language::Helpers::Summari
25
25
  end
26
26
 
27
27
  describe '.summarize_domain' do
28
+ it 'returns nil for invalid depth' do
29
+ result = described_class.summarize_domain([], domain: :networking, depth: :bogus)
30
+ expect(result).to be_nil
31
+ end
32
+
33
+ it 'accepts all valid DEPTHS' do
34
+ Legion::Extensions::Agentic::Language::Language::Helpers::Constants::DEPTHS.each do |depth|
35
+ result = described_class.summarize_domain([], domain: :networking, depth: depth)
36
+ expect(result).not_to be_nil
37
+ end
38
+ end
39
+
28
40
  it 'returns empty summary for no traces' do
29
41
  result = described_class.summarize_domain([], domain: :networking)
30
42
  expect(result[:knowledge_level]).to eq(:none)
@@ -92,6 +104,18 @@ RSpec.describe Legion::Extensions::Agentic::Language::Language::Helpers::Summari
92
104
  { semantic: make_traces(10) }
93
105
  end
94
106
 
107
+ it 'returns nil for invalid depth' do
108
+ result = described_class.extract_key_facts(grouped, depth: :bogus)
109
+ expect(result).to be_nil
110
+ end
111
+
112
+ it 'accepts all valid DEPTHS' do
113
+ Legion::Extensions::Agentic::Language::Language::Helpers::Constants::DEPTHS.each do |depth|
114
+ result = described_class.extract_key_facts(grouped, depth: depth)
115
+ expect(result).not_to be_nil
116
+ end
117
+ end
118
+
95
119
  it 'limits facts by depth :brief' do
96
120
  facts = described_class.extract_key_facts(grouped, depth: :brief)
97
121
  expect(facts.size).to be <= 3
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.0
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Esity