lex-agentic-language 0.1.8 → 0.1.9

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: b04c9da9a6fcda5c086ee1e27fd8c2a2007faa556737be3d88219a2e505663ba
4
- data.tar.gz: fa94cc1d6fda5c3b9fe38a2e6aa9254ee238a9af4f2f3802aeeb94813e98f352
3
+ metadata.gz: 2388849ad378d8489580d4638dc181111798e6ce0a153e99fe40f2c441152b96
4
+ data.tar.gz: 05c2295ad8bf6a17e2592cce376b6c15408c4bf5f0a35786cdfe650ecd50ffa1
5
5
  SHA512:
6
- metadata.gz: 0b08cdd7dc45ec57422597aa41d7a75a6c375b4f5f70cacc8a6abfcb14e6326528dda67ec4c6392596cfcd19b05fdd0bf244cb8a48b3be3d7d84921e5e38b453
7
- data.tar.gz: 59f6320175d8e48918b8d45ff9e3b8ea25796205f5d23703d12a978bd722441f48d1f91253178f237b9cde97aad458478eb06de288f1913489775a9934ea7089
6
+ metadata.gz: 4b68a01ec6173f4ad3bcb486ed33c9ffe87c269da569c6615e49d96366f79a6f997a1265827f511343a735f15cfdc3464f032a0a9db825556b6b38d2519af96d
7
+ data.tar.gz: 9baccb232491d12120647c84aa5aaae42a2936f2aec7f83b681fab2226af871f13433277c964fc612afbef07c17275e4c2a5231168f2f158545658d07469e5b1
data/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.1.9] - 2026-04-22
4
+ ### Added
5
+ - InnerSpeech::Actor::DecayInnerSpeech (60s) — first actor in the extension, enables autonomous salience decay
6
+ ### Fixed
7
+ - LlmEnhancer `available?` now logs errors at debug level instead of swallowing silently
8
+ - Documented PragmaticInference::Utterance vs InnerSpeech::Utterance schema distinctions
9
+
3
10
  ## [0.1.8] - 2026-04-15
4
11
  ### Changed
5
12
  - Set `mcp_tools?`, `mcp_tools_deferred?`, and `transport_required?` to `false` — internal cognitive pipeline extension
data/README.md CHANGED
@@ -1,26 +1,50 @@
1
1
  # lex-agentic-language
2
2
 
3
- Domain consolidation gem for language processing and communication. Bundles 9 source extensions into one loadable unit under `Legion::Extensions::Agentic::Language`.
3
+ Domain consolidation gem for language processing and communication. Bundles 9 sub-modules into one loadable unit under `Legion::Extensions::Agentic::Language`.
4
4
 
5
5
  ## Overview
6
6
 
7
7
  **Gem**: `lex-agentic-language`
8
- **Version**: 0.1.8
8
+ **Version**: 0.1.9
9
9
  **Namespace**: `Legion::Extensions::Agentic::Language`
10
10
 
11
11
  ## Sub-Modules
12
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 |
13
+ | Sub-Module | Purpose |
14
+ |---|---|
15
+ | `Language::Language` | Core language processing — token parsing, semantic framing, pragmatic intent |
16
+ | `Language::Grammar` | Grammatical construction processing (construal, construction, grammar engine) |
17
+ | `Language::InnerSpeech` | Vygotsky inner speech — private verbal thought for problem solving |
18
+ | `Language::Narrator` | Real-time narrative stream of internal state (optional LLM enhancement) |
19
+ | `Language::NarrativeReasoning` | Narrative as a reasoning mode — story-schema activation |
20
+ | `Language::FrameSemantics` | Fillmore frame semantics — conceptual frames, slots, fillers |
21
+ | `Language::PragmaticInference` | Gricean maxims and conversational implicature |
22
+ | `Language::ConceptualBlending` | Fauconnier & Turner — emergent blended structure from two input spaces |
23
+ | `Language::ConceptualMetaphor` | Lakoff & Johnson — structural mappings between conceptual domains |
24
+
25
+ ## Actors
26
+
27
+ - `Language::InnerSpeech::Actor::DecayInnerSpeech` — every 60s, decays utterance salience in the inner voice stream via `update_inner_speech`
28
+
29
+ This is the first actor added to this gem. Without it the inner speech stream grows indefinitely.
30
+
31
+ ## Quick Usage
32
+
33
+ ```ruby
34
+ require 'legion/extensions/agentic/language'
35
+
36
+ # Use the InnerSpeech runner
37
+ include Legion::Extensions::Agentic::Language::InnerSpeech::Runners::InnerSpeech
38
+
39
+ inner_speak(content: "Should I accept this task?", mode: :questioning, topic: :task_eval)
40
+ # => { success: true, utterance_id: "...", mode: :questioning }
41
+
42
+ inner_plan(content: "First verify the input, then transform")
43
+ # => { success: true, utterance_id: "..." }
44
+
45
+ recent_inner_speech(count: 3)
46
+ # => { success: true, utterances: [...], count: 3 }
47
+ ```
24
48
 
25
49
  ## Installation
26
50
 
@@ -32,8 +56,8 @@ gem 'lex-agentic-language'
32
56
 
33
57
  ```bash
34
58
  bundle install
35
- bundle exec rspec # 735 examples, 0 failures
36
- bundle exec rubocop # 0 offenses
59
+ bundle exec rspec
60
+ bundle exec rubocop
37
61
  ```
38
62
 
39
63
  ## License
@@ -0,0 +1,50 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'legion/extensions/actors/every'
4
+
5
+ module Legion
6
+ module Extensions
7
+ module Agentic
8
+ module Language
9
+ module InnerSpeech
10
+ module Actor
11
+ # DecayInnerSpeech runs every 60 seconds and ticks the inner voice stream,
12
+ # decaying the salience of all queued utterances. Without this actor the
13
+ # stream would grow indefinitely and old utterances would remain at full
14
+ # salience, distorting urgency calculations.
15
+ #
16
+ # Delegates to Runners::InnerSpeech#update_inner_speech, which calls
17
+ # InnerVoice#tick → SpeechStream#decay_all.
18
+ class DecayInnerSpeech < Legion::Extensions::Actors::Every
19
+ time 60
20
+
21
+ def runner_class
22
+ Legion::Extensions::Agentic::Language::InnerSpeech::Runners::InnerSpeech
23
+ end
24
+
25
+ def runner_function
26
+ 'update_inner_speech'
27
+ end
28
+
29
+ def run_now?
30
+ false
31
+ end
32
+
33
+ def use_runner?
34
+ false
35
+ end
36
+
37
+ def check_subtask?
38
+ false
39
+ end
40
+
41
+ def generate_task?
42
+ false
43
+ end
44
+ end
45
+ end
46
+ end
47
+ end
48
+ end
49
+ end
50
+ end
@@ -1,5 +1,16 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ # InnerSpeech::Helpers::Utterance — represents a single token of inner-voice activity.
4
+ #
5
+ # Key fields: mode (narrating/planning/questioning/…), voice (rational/bold/cautious/…),
6
+ # urgency (0–1), salience (0–1, subject to temporal decay via #decay_salience!).
7
+ # Salience decays over time via the InnerSpeech decay actor (every 60 s), which calls
8
+ # Runners::InnerSpeech#update_inner_speech → InnerVoice#tick → SpeechStream#decay_all.
9
+ #
10
+ # Compare with PragmaticInference::Helpers::Utterance, which models an external
11
+ # communicative act scored against Gricean maxims with implicature accumulation.
12
+ # That class carries NO urgency, salience, or decay logic.
13
+
3
14
  module Legion
4
15
  module Extensions
5
16
  module Agentic
@@ -16,9 +16,15 @@ module Legion
16
16
 
17
17
  module_function
18
18
 
19
+ def log
20
+ Legion::Logging
21
+ end
22
+ private_class_method :log
23
+
19
24
  def available?
20
25
  !!(defined?(Legion::LLM) && Legion::LLM.respond_to?(:started?) && Legion::LLM.started?)
21
- rescue StandardError => _e
26
+ rescue StandardError => e
27
+ log.debug("[narrator:llm] available? check failed: #{e.class}: #{e.message}")
22
28
  false
23
29
  end
24
30
 
@@ -27,8 +33,8 @@ module Legion
27
33
  response = llm_ask(prompt)
28
34
  parse_narrate_response(response)
29
35
  rescue StandardError => e
30
- Legion::Logging.warn("[narrator:llm] narrate failed: #{e.message}") # rubocop:disable Legion/HelperMigration/DirectLogging
31
- Legion::Logging.warn(e.backtrace) # rubocop:disable Legion/HelperMigration/DirectLogging
36
+ log.warn("[narrator:llm] narrate failed: #{e.message}")
37
+ log.warn(e.backtrace)
32
38
  nil
33
39
  end
34
40
 
@@ -57,7 +63,7 @@ module Legion
57
63
  Legion::LLM.respond_to?(:pipeline_enabled?) &&
58
64
  Legion::LLM.pipeline_enabled?)
59
65
  rescue StandardError => e
60
- Legion::Logging.warn("pipeline_available? #{e.class}: #{e.message}") # rubocop:disable Legion/HelperMigration/DirectLogging
66
+ log.warn("[narrator:llm] pipeline_available? #{e.class}: #{e.message}")
61
67
  false
62
68
  end
63
69
 
@@ -1,5 +1,15 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ # PragmaticInference::Helpers::Utterance — represents a single communicative act
4
+ # evaluated through Gricean maxims (quantity, quality, relation, manner).
5
+ #
6
+ # Key fields: speaker, speech_act, literal_meaning, maxim_scores, implicatures, confidence.
7
+ # Maxim compliance is scored per-maxim and aggregated via #overall_compliance.
8
+ # Violations and implicatures are accumulated after construction via mutation methods.
9
+ #
10
+ # Compare with InnerSpeech::Helpers::Utterance, which models inner-voice tokens
11
+ # (mode, urgency, salience, decay) and carries NO maxim or implicature logic.
12
+
3
13
  require 'securerandom'
4
14
 
5
15
  module Legion
@@ -4,7 +4,7 @@ module Legion
4
4
  module Extensions
5
5
  module Agentic
6
6
  module Language
7
- VERSION = '0.1.8'
7
+ VERSION = '0.1.9'
8
8
  end
9
9
  end
10
10
  end
@@ -0,0 +1,66 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Stub the base class before loading the actor so the spec can run in isolation
4
+ # without requiring the full Legion framework.
5
+ #
6
+ # The stub must support the `time` DSL accessor used by Every actors: a class-level
7
+ # setter (time 60) and an instance-level reader that delegates to the class method.
8
+ module Legion
9
+ module Extensions
10
+ module Actors
11
+ class Every
12
+ def self.time(val = :_unset)
13
+ if val == :_unset
14
+ @time || 1
15
+ else
16
+ @time = val
17
+ end
18
+ end
19
+
20
+ def time
21
+ self.class.time
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
27
+
28
+ $LOADED_FEATURES << 'legion/extensions/actors/every'
29
+
30
+ require_relative '../../../../../../../lib/legion/extensions/agentic/language/inner_speech/actors/decay_inner_speech'
31
+
32
+ RSpec.describe Legion::Extensions::Agentic::Language::InnerSpeech::Actor::DecayInnerSpeech do
33
+ subject(:actor) { described_class.new }
34
+
35
+ describe '#runner_class' do
36
+ it do
37
+ expect(actor.runner_class).to eq(
38
+ Legion::Extensions::Agentic::Language::InnerSpeech::Runners::InnerSpeech
39
+ )
40
+ end
41
+ end
42
+
43
+ describe '#runner_function' do
44
+ it { expect(actor.runner_function).to eq 'update_inner_speech' }
45
+ end
46
+
47
+ describe '#time' do
48
+ it { expect(actor.time).to eq 60 }
49
+ end
50
+
51
+ describe '#run_now?' do
52
+ it { expect(actor.run_now?).to be false }
53
+ end
54
+
55
+ describe '#use_runner?' do
56
+ it { expect(actor.use_runner?).to be false }
57
+ end
58
+
59
+ describe '#check_subtask?' do
60
+ it { expect(actor.check_subtask?).to be false }
61
+ end
62
+
63
+ describe '#generate_task?' do
64
+ it { expect(actor.generate_task?).to be false }
65
+ end
66
+ 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.8
4
+ version: 0.1.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Esity
@@ -208,6 +208,7 @@ files:
208
208
  - lib/legion/extensions/agentic/language/grammar/runners/cognitive_grammar.rb
209
209
  - lib/legion/extensions/agentic/language/grammar/version.rb
210
210
  - lib/legion/extensions/agentic/language/inner_speech.rb
211
+ - lib/legion/extensions/agentic/language/inner_speech/actors/decay_inner_speech.rb
211
212
  - lib/legion/extensions/agentic/language/inner_speech/client.rb
212
213
  - lib/legion/extensions/agentic/language/inner_speech/helpers/constants.rb
213
214
  - lib/legion/extensions/agentic/language/inner_speech/helpers/inner_voice.rb
@@ -266,6 +267,7 @@ files:
266
267
  - spec/legion/extensions/agentic/language/grammar/helpers/construction_spec.rb
267
268
  - spec/legion/extensions/agentic/language/grammar/helpers/grammar_engine_spec.rb
268
269
  - spec/legion/extensions/agentic/language/grammar/runners/cognitive_grammar_spec.rb
270
+ - spec/legion/extensions/agentic/language/inner_speech/actors/decay_inner_speech_spec.rb
269
271
  - spec/legion/extensions/agentic/language/inner_speech/client_spec.rb
270
272
  - spec/legion/extensions/agentic/language/inner_speech/helpers/inner_voice_spec.rb
271
273
  - spec/legion/extensions/agentic/language/inner_speech/helpers/speech_stream_spec.rb