lex-agentic-executive 0.2.0 → 0.2.1

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: aaa8f955fd551b961fd735e5bbf9a0dc33b54134b4d5e2ab1506221687aa3195
4
- data.tar.gz: 862042eb5a340dcacce8ec8f2c7cb5f2b9501640ca3d0f39e3307ab69c87d571
3
+ metadata.gz: a52da834db3ad024167228f957b019bfc33bb0a1cc86cc1cb58feabe4aa1bec4
4
+ data.tar.gz: 16f3a79dee77a608932cb3b837ee55aac9bc4cfbd596beb42f29582b530c1b54
5
5
  SHA512:
6
- metadata.gz: 51cbce9e25c1edb78855eeb7304663855d5f3b4cfc0072b074476f16c230786ea9bd7dfff15c43f10a55558463642218835d3ed3e9f1fcc7a444fbcce1893a74
7
- data.tar.gz: 69f0e5e91e4f98c9b2a46d518301674bedf0bedf7ee04adb4a8b5117c450afedf0ebbe8dc2eef73143a6773e96df5bf2a13e6cdf0ab9c4a590b97c4af821559a
6
+ metadata.gz: e44439bae29cbf8793b0f69ece036bb097051f0434b4d33f4e373f661c5203b51beabb58d9b9f78f17ab9b0fc0041c0565dfbd7d6b11804707e39aa0ef78784a
7
+ data.tar.gz: 596a167041a980a4151babe00df9b876a0ebe647929fcea48e0cebe8b9b6704621a5499fcebde0494a8a9c3fff3000b22b2e29ce2da658f481a3ad1350400cd3
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.2.1] - 2026-05-07
4
+ ### Fixed
5
+ - Goal decomposer LLM strategy now parses native `Legion::LLM.chat` hash responses without requiring a legacy chat session.
6
+ - Added regression coverage for cognition-domain dispatch to the MindGrowth analyzer.
7
+
3
8
  ## [0.2.0] - 2026-04-21
4
9
  ### Added
5
10
  - **Autonomous Goal-Setting Pipeline (G1-G5)** — GAIA can now convert intentions into goals, decompose them, dispatch execution, and receive feedback with no human intervention
@@ -48,9 +48,10 @@ module Legion
48
48
 
49
49
  prompt = build_decomposition_prompt(goal)
50
50
  response = Legion::LLM.chat(
51
- caller: { extension: 'lex-agentic-executive', operation: 'decompose' }
52
- ).ask(prompt)
53
- parse_sub_goals(response.content, goal[:domain])
51
+ message: prompt,
52
+ caller: { extension: 'lex-agentic-executive', operation: 'decompose' }
53
+ )
54
+ parse_sub_goals(extract_response_content(response, prompt), goal[:domain])
54
55
  rescue StandardError => e
55
56
  log.error "Decomposer#decompose_with_llm: #{e.message}"
56
57
  nil
@@ -83,6 +84,8 @@ module Legion
83
84
  end
84
85
 
85
86
  def parse_sub_goals(content, domain)
87
+ return nil unless content
88
+
86
89
  cleaned = content.gsub(/```(?:json)?\s*\n?/, '').strip
87
90
  data = json_load(cleaned)
88
91
  return nil unless data.is_a?(Array) && !data.empty?
@@ -98,6 +101,22 @@ module Legion
98
101
  log.error "Decomposer#parse_sub_goals: #{e.message}"
99
102
  nil
100
103
  end
104
+
105
+ def extract_response_content(response, prompt)
106
+ return response.strip if response.is_a?(String)
107
+ return response.content if response.respond_to?(:content)
108
+
109
+ if response.respond_to?(:ask)
110
+ asked = response.ask(prompt)
111
+ return extract_response_content(asked, prompt)
112
+ end
113
+
114
+ return nil unless response.is_a?(Hash)
115
+
116
+ response[:content] || response['content'] ||
117
+ response.dig(:message, :content) || response.dig('message', 'content') ||
118
+ response[:response] || response['response']
119
+ end
101
120
  end
102
121
  end
103
122
  end
@@ -4,7 +4,7 @@ module Legion
4
4
  module Extensions
5
5
  module Agentic
6
6
  module Executive
7
- VERSION = '0.2.0'
7
+ VERSION = '0.2.1'
8
8
  end
9
9
  end
10
10
  end
@@ -33,6 +33,21 @@ RSpec.describe Legion::Extensions::Agentic::Executive::GoalManagement::Helpers::
33
33
  expect(result[:success]).to be true
34
34
  expect(result[:strategy_used]).to eq(:heuristic)
35
35
  end
36
+
37
+ it 'parses native hash responses from Legion::LLM.chat' do
38
+ llm = Module.new
39
+ llm.define_singleton_method(:chat) do |message:, **|
40
+ raise 'missing prompt' if message.to_s.empty?
41
+
42
+ { content: '[{"content":"inspect controls","domain":"safety","priority":0.8}]' }
43
+ end
44
+ stub_const('Legion::LLM', llm)
45
+
46
+ result = described_class.decompose(goal: goal_hash, strategy: :llm)
47
+
48
+ expect(result[:strategy_used]).to eq(:llm)
49
+ expect(result[:sub_goals].first[:content]).to eq('inspect controls')
50
+ end
36
51
  end
37
52
 
38
53
  context 'with default strategy' do
@@ -80,6 +80,14 @@ RSpec.describe Legion::Extensions::Agentic::Executive::GoalManagement::Helpers::
80
80
  expect(result[:runner_mapping]).to eq('Legion::Extensions::MindGrowth::Runners::Monitor')
81
81
  end
82
82
 
83
+ it 'dispatches cognition goals to the current MindGrowth analyzer runner' do
84
+ stub_const('Legion::Extensions::MindGrowth::Runners::Analyzer', Module.new)
85
+ result = dispatcher.dispatch_goal(goal: goal_hash.merge(domain: :cognition))
86
+
87
+ expect(result[:dispatched]).to be true
88
+ expect(result[:runner_mapping]).to eq('Legion::Extensions::MindGrowth::Runners::Analyzer')
89
+ end
90
+
83
91
  it 'includes goal_id in the response' do
84
92
  result = dispatcher.dispatch_goal(goal: goal_hash)
85
93
  expect(result[:goal_id]).to eq('goal-123')
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lex-agentic-executive
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Esity