robot_lab-web 0.2.7 → 0.2.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: f3c762ddd67a080be8d37822e42f985b6175797b304b3440eff9950745780df8
4
- data.tar.gz: efb42d17168124f61859f6aada1d55a83850a4798a19db2a5ea1aa2f4b70eea1
3
+ metadata.gz: 6f6722eba1efc89ffadf06fb4757b17992704b5e152c6e93610f420505bc7a62
4
+ data.tar.gz: e416fb9603ebe0e3a8bef300623ad0b638d4fc580b2555aa336f0245202e87db
5
5
  SHA512:
6
- metadata.gz: e6f14f830591f9d32b5fcbf6f81011e386644e01dd9f84695266efb003d0b7b8a2b1440506acb92dedcfbb7cda319362bf0363e8f2b5697812e94384bcb87851
7
- data.tar.gz: 8311fe686bf0bcf9e0c52200bc638044d38d30ef3e7ab41dee3acf272af60b2cc42f68fceb2c8764de5733b4e630b5ebc5ac04ffc61216e16c02d285691d9144
6
+ metadata.gz: 13d2ffb486bbdcdcddc38bb639f2330d54634f230786c11933cba029adfa9d2bb4f2589caf86ed2fa1d75b39af5ced548a06ba494761a583d103897f6630841c
7
+ data.tar.gz: 216cf0740d673be16c993cfc9f9456bc52fb67c5a9cbb7273deed8a95401f3664ea1ffac6c104228a421b5206f5621d51cbfca1633797ba1a461f51287715456
data/.envrc CHANGED
@@ -1,3 +1,6 @@
1
+ # robot_lab_project/robot_lab-web/.envrc
2
+
1
3
  source_up
4
+
2
5
  export RR=`pwd`
3
6
  export BUNDLE_GEMFILE=Gemfile
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.2.8] - 2026-09-09
4
+
5
+ Released in lockstep with `robot_lab` core v0.2.8: this gem now resolves the released core gem from RubyGems instead of the local sibling checkout (local-path development remains available via `BUNDLE_GEMFILE=Gemfile.local`). Also in this release: reek warnings triaged to zero, reek added to the development bundle, and the Rakefile slimmed down to the tasks asgard delegates to.
6
+
3
7
  ### Changed
4
8
  - Use **Falcon** as the application server (replacing Puma). Its async/fiber
5
9
  reactor is the right fit for the long-lived SSE streams this console serves —
data/Rakefile CHANGED
@@ -1,6 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'bundler/gem_tasks'
4
3
  require 'rake/testtask'
5
4
 
6
5
  Rake::TestTask.new(:test) do |t|
data/_typos.toml ADDED
@@ -0,0 +1,7 @@
1
+ # False-positive suppressions for the typos quality gate (asgard).
2
+ # Everything here was reviewed by hand — see git history for context.
3
+
4
+ [default.extend-identifiers]
5
+ # test_run.rb streams "Hello!" as the fragments %w[Hel lo!] to exercise
6
+ # token-delta streaming; "Hel" is a deliberate partial token, not a typo.
7
+ Hel = "Hel"
@@ -10,6 +10,7 @@ module RobotLab
10
10
  @name = name
11
11
  end
12
12
 
13
+ # :reek:TooManyStatements -- a Phlex template is one linear markup sequence; splitting it would scatter the page structure.
13
14
  def view_template
14
15
  h1(class: "flex items-center gap-2") do
15
16
  a(href: "/", class: "inline-flex") do
@@ -10,6 +10,7 @@ module RobotLab
10
10
  @activity = activity
11
11
  end
12
12
 
13
+ # :reek:TooManyStatements -- a Phlex template is one linear markup sequence; splitting it would scatter the page structure.
13
14
  def view_template
14
15
  h1 { "Robots" }
15
16
  if @robots.empty?
@@ -11,6 +11,7 @@ module RobotLab
11
11
  @content = content
12
12
  end
13
13
 
14
+ # :reek:TooManyStatements -- a Phlex template is one linear markup sequence; splitting it would scatter the page structure.
14
15
  def view_template
15
16
  doctype
16
17
  html(lang: "en", class: "dark") do
@@ -25,11 +25,12 @@ module RobotLab
25
25
 
26
26
  def body_text
27
27
  c = @event.content
28
+ name = @event.tool_name
28
29
  case @event.role
29
30
  when :tool_call
30
- "#{@event.tool_name}(#{c[:args].to_json})"
31
+ "#{name}(#{c[:args].to_json})"
31
32
  when :tool_result
32
- c[:error] ? "#{@event.tool_name} → error: #{c[:error]}" : "#{@event.tool_name} → #{c[:result]}"
33
+ c[:error] ? "#{name} → error: #{c[:error]}" : "#{name} → #{c[:result]}"
33
34
  when :error
34
35
  @event.error_message.to_s
35
36
  else
@@ -22,6 +22,7 @@ module RobotLab
22
22
  Event = Struct.new(:role, :content, :robot_name, :timestamp, :event_id, keyword_init: true) do
23
23
  ROLES = %i[user delta robot tool_call tool_result error].freeze # rubocop:disable Lint/ConstantDefinitionInBlock
24
24
 
25
+ # :reek:ControlParameter -- nil timestamp/event_id mean "generate one"; `|| default` also covers explicit nils from .from_h.
25
26
  def initialize(role:, content:, robot_name: nil, timestamp: nil, event_id: nil)
26
27
  role = role.to_sym
27
28
  raise ArgumentError, "invalid role: #{role.inspect} (expected one of #{ROLES.inspect})" unless ROLES.include?(role)
@@ -87,6 +88,8 @@ module RobotLab
87
88
 
88
89
  private
89
90
 
91
+ # :reek:DuplicateMethodCall -- one freeze per case branch; exactly one executes per call.
92
+ # :reek:FeatureEnvy -- a recursive freeze necessarily walks the argument, not self.
90
93
  def deep_freeze(obj)
91
94
  case obj
92
95
  when Hash
@@ -22,11 +22,12 @@ module RobotLab
22
22
  # Run the block with +sink+ (any callable taking an Event) installed as
23
23
  # the current consumer. Restores the previous sink afterward.
24
24
  def capture(sink)
25
- previous = Thread.current[KEY]
26
- Thread.current[KEY] = sink
25
+ thread = Thread.current
26
+ previous = thread[KEY]
27
+ thread[KEY] = sink
27
28
  yield
28
29
  ensure
29
- Thread.current[KEY] = previous
30
+ thread[KEY] = previous
30
31
  end
31
32
 
32
33
  def current
@@ -12,6 +12,7 @@ module RobotLab
12
12
  end
13
13
 
14
14
  # Register a robot (anything responding to #run and #name).
15
+ # :reek:ControlParameter -- nil name means "use the robot's own name", an override default, not a mode switch.
15
16
  def register(robot, name: nil)
16
17
  key = (name || robot.name).to_s
17
18
  store[key] = robot
@@ -2,6 +2,6 @@
2
2
 
3
3
  module RobotLab
4
4
  module Web
5
- VERSION = "0.2.7"
5
+ VERSION = "0.2.8"
6
6
  end
7
7
  end
data/lib/robot_lab/web.rb CHANGED
@@ -51,6 +51,7 @@ module RobotLab
51
51
  #
52
52
  # events = []
53
53
  # RobotLab::Web.run(robot, "hello") { |event| events << event }
54
+ # :reek:TooManyStatements -- the one linear sink-install/run/stream orchestration the web routes wrap.
54
55
  def run(robot, message, sink = nil, &block)
55
56
  sink ||= block
56
57
  name = robot.respond_to?(:name) ? robot.name : nil
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: robot_lab-web
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.7
4
+ version: 0.2.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dewayne VanHoozer
@@ -126,6 +126,7 @@ files:
126
126
  - LICENSE.txt
127
127
  - README.md
128
128
  - Rakefile
129
+ - _typos.toml
129
130
  - config.ru
130
131
  - docs/api_reference.md
131
132
  - docs/getting_started.md
@@ -171,7 +172,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
171
172
  - !ruby/object:Gem::Version
172
173
  version: '0'
173
174
  requirements: []
174
- rubygems_version: 4.0.19
175
+ rubygems_version: 4.0.20
175
176
  specification_version: 4
176
177
  summary: 'Browser console for robot_lab: stream a robot''s run over Server-Sent Events.'
177
178
  test_files: []