lex-llm 0.6.4 → 0.6.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6401d7f1b284c2cee7577ff84c1ee099f5a8ae872c51e8a8410c8627c8514a16
4
- data.tar.gz: 1ae7e5ff99ee54f5aae6dcc1a8cad4c65c9537d6c2ede8992cdd93d4c2933b9c
3
+ metadata.gz: 5613f655c5743be588ec5030535de96dc998cb8f03ffb8f8b2be21c95dc55b84
4
+ data.tar.gz: cba342c0f0662d7612b2d8647791149ddb716878e79e487e84a640dbcd3582cc
5
5
  SHA512:
6
- metadata.gz: 7575751b784ebe46be8c03591d748fc81e62695ea3142972bc3257f72e44c1822b8d9438ed1f2958c27287f10bcb0ebe4af5081e85f08e57f6ecf10e47c6c253
7
- data.tar.gz: 5a7a68f00cce655fe2912e64350c302044cbabc2bafd874d03683d40502e9edfdfc2a987bb7c591ee9d302df0e2a89cae1040c6b22f71e72f1c5700988dd57eb
6
+ metadata.gz: b2eb4840e8f1f39d65690dc9226387d6fecbcc9352845cc796d2421b56b660fddae35e2373abdbb88e5c3b127a5b5a6ba621c33682762bbf2eeb271809ec2beb
7
+ data.tar.gz: 7cce383baa60095d03479240c16076624706d56d605200efee5943d3de290ba96c5c18c58e7ada252572966657d846107a3f55945d9f95aa278f553c31ac82a2
data/CHANGELOG.md CHANGED
@@ -1,5 +1,25 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.6.8 - 2026-07-03
4
+
5
+ ### Changed
6
+ - Version bump to publish the `MeteringFlush` actor (0.6.5). Versions 0.6.5–0.6.7 tagged and created GitHub releases but never reached RubyGems: 0.6.5/0.6.6 failed `gem push` on a revoked API key, and 0.6.7 failed because the replacement API key was created with per-key MFA enabled (`gem push` prompted for an OTP a CI runner can't provide). The API key has been recreated without per-key MFA. Because the release workflow skips publishing when a version's tag/release already exists, each failed version must be superseded by a fresh one. No functional changes since 0.6.5.
7
+
8
+ ## 0.6.7 - 2026-07-03
9
+
10
+ ### Changed
11
+ - Version bump attempting to publish the `MeteringFlush` actor. Did not reach RubyGems — the replacement API key carried a per-key MFA requirement, so `gem push` demanded an OTP (superseded by 0.6.8). No functional changes.
12
+
13
+ ## 0.6.6 - 2026-07-03
14
+
15
+ ### Changed
16
+ - Version bump attempting to re-trigger the release pipeline. Did not publish to RubyGems — the `gem push` step failed on a revoked API key (superseded by 0.6.7). No functional changes.
17
+
18
+ ## 0.6.5 - 2026-07-03
19
+
20
+ ### Added
21
+ - **`MeteringFlush` actor drains the LLM metering spool back into RabbitMQ.** legion-llm's `Legion::LLM::Metering` spools metering events to `~/.legionio/data/spool/metering/events.jsonl` whenever transport is down at emit time. Nothing had been draining that spool since `lex-llm-gateway` was retired, so events (chat, embeddings, skills — all funnel through `Legion::LLM::Metering.emit`) accumulated indefinitely. This `Legion::Extensions::Actors::Every` actor ticks every 60s and calls `Legion::LLM::Metering.flush_spool`, which republishes each spooled event to the `llm.metering` exchange and truncates the file. It is a no-op while transport is unavailable, so it is safe to tick continuously. Runs on every node (not a singleton) because each node owns its own spool file and must drain it locally. References legion-llm by string (`'Legion::LLM::Metering'`) so lex-llm — the lower gem — avoids a circular dependency; the constant is resolved at tick time.
22
+
3
23
  ## 0.6.4 - 2026-06-30
4
24
 
5
25
  ### Fixed
@@ -0,0 +1,60 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Legion
4
+ module Extensions
5
+ module Llm
6
+ module Actor
7
+ # Periodically drains the LLM metering spool.
8
+ #
9
+ # Metering events are emitted by legion-llm's Legion::LLM::Metering. When
10
+ # transport is down at emit time they are appended to a durable JSONL
11
+ # spool (~/.legionio/data/spool/metering/events.jsonl) instead of being
12
+ # published to the `llm.metering` exchange. Nothing was draining that
13
+ # spool after lex-llm-gateway was retired, so events accumulated forever.
14
+ #
15
+ # flush_spool reads every spooled event — chat, embeddings, skills, all
16
+ # funnel through Legion::LLM::Metering.emit into the same file — and
17
+ # republishes each to the exchange, then truncates. It is a no-op when
18
+ # transport is unavailable, so it is safe to tick every minute.
19
+ #
20
+ # runner_class points at legion-llm (the higher gem, always loaded at
21
+ # full boot). lex-llm must not require legion-llm — that would be circular
22
+ # (legion-llm depends on lex-llm) — so we reference it by string and let
23
+ # the actor base resolve the constant at tick time via const_get.
24
+ #
25
+ # NOT a singleton actor: every node runs LegionIO independently and owns
26
+ # its own spool file, so each node must drain its own spool. Leader
27
+ # election would strand every non-leader node's spool.
28
+ class MeteringFlush < Legion::Extensions::Actors::Every
29
+ def runner_class
30
+ 'Legion::LLM::Metering'
31
+ end
32
+
33
+ def runner_function
34
+ 'flush_spool'
35
+ end
36
+
37
+ def time
38
+ 60
39
+ end
40
+
41
+ def run_now?
42
+ false
43
+ end
44
+
45
+ def use_runner?
46
+ false
47
+ end
48
+
49
+ def check_subtask?
50
+ false
51
+ end
52
+
53
+ def generate_task?
54
+ false
55
+ end
56
+ end
57
+ end
58
+ end
59
+ end
60
+ end
@@ -3,7 +3,7 @@
3
3
  module Legion
4
4
  module Extensions
5
5
  module Llm
6
- VERSION = '0.6.4'
6
+ VERSION = '0.6.8'
7
7
  end
8
8
  end
9
9
  end
@@ -0,0 +1,64 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Stub the actor base class before requiring the real actor — the concrete
4
+ # Legion::Extensions::Actors::Every lives in LegionIO, which lex-llm does not
5
+ # depend on (lex-llm is the lower gem).
6
+ unless defined?(Legion::Extensions::Actors::Every)
7
+ module Legion
8
+ module Extensions
9
+ module Actors
10
+ class Every; end # rubocop:disable Lint/EmptyClass
11
+ end
12
+ end
13
+ end
14
+ end
15
+
16
+ $LOADED_FEATURES << 'legion/extensions/actors/every'
17
+
18
+ require_relative '../../../../../lib/legion/extensions/llm/actors/metering_flush'
19
+
20
+ RSpec.describe Legion::Extensions::Llm::Actor::MeteringFlush do
21
+ subject(:actor) { described_class.new }
22
+
23
+ describe '#runner_class' do
24
+ it 'targets the legion-llm metering module that owns the spool' do
25
+ expect(actor.runner_class).to eq('Legion::LLM::Metering')
26
+ end
27
+ end
28
+
29
+ describe '#runner_function' do
30
+ it 'returns flush_spool' do
31
+ expect(actor.runner_function).to eq('flush_spool')
32
+ end
33
+ end
34
+
35
+ describe '#time' do
36
+ it 'flushes once per minute' do
37
+ expect(actor.time).to eq(60)
38
+ end
39
+ end
40
+
41
+ describe '#run_now?' do
42
+ it 'returns false so it does not fire during boot' do
43
+ expect(actor.run_now?).to be false
44
+ end
45
+ end
46
+
47
+ describe '#use_runner?' do
48
+ it 'returns false so it calls the module directly (no AMQP round-trip)' do
49
+ expect(actor.use_runner?).to be false
50
+ end
51
+ end
52
+
53
+ describe '#check_subtask?' do
54
+ it 'returns false' do
55
+ expect(actor.check_subtask?).to be false
56
+ end
57
+ end
58
+
59
+ describe '#generate_task?' do
60
+ it 'returns false' do
61
+ expect(actor.generate_task?).to be false
62
+ end
63
+ end
64
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lex-llm
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.4
4
+ version: 0.6.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - LegionIO
@@ -255,6 +255,7 @@ files:
255
255
  - README.md
256
256
  - lex-llm.gemspec
257
257
  - lib/legion/extensions/llm.rb
258
+ - lib/legion/extensions/llm/actors/metering_flush.rb
258
259
  - lib/legion/extensions/llm/agent.rb
259
260
  - lib/legion/extensions/llm/aliases.json
260
261
  - lib/legion/extensions/llm/aliases.rb
@@ -347,6 +348,7 @@ files:
347
348
  - spec/fixtures/ruby.wav
348
349
  - spec/fixtures/ruby.xml
349
350
  - spec/fixtures/sample.pdf
351
+ - spec/legion/extensions/llm/actor/metering_flush_spec.rb
350
352
  - spec/legion/extensions/llm/agent_spec.rb
351
353
  - spec/legion/extensions/llm/attachment_spec.rb
352
354
  - spec/legion/extensions/llm/auto_registration_spec.rb