robot_lab-ractor 0.2.7 → 0.3.0
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 +4 -4
- data/.envrc +5 -2
- data/CHANGELOG.md +4 -0
- data/Rakefile +0 -1
- data/examples/01_ractor_tools.rb +4 -4
- data/examples/02_ractor_network.rb +6 -5
- data/examples/common.rb +6 -6
- data/lib/robot_lab/ractor/version.rb +1 -1
- data/lib/robot_lab/ractor_boundary.rb +1 -0
- data/lib/robot_lab/ractor_network_scheduler.rb +2 -0
- data/lib/robot_lab/ractor_worker_pool.rb +1 -0
- metadata +4 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4754c04890445a0232b92465476a3bc02b5270f909e98437f1e8d3204ec16c86
|
|
4
|
+
data.tar.gz: 02d0ff814962d5c0c24b194f1ff140ad3cbaabcefeee2aa93c5e9b1f07723326
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 16270e905bbe3e8ee05dcc2451d0c235dfb979ba080244ff0daef9901dda698c8eec8f4c5aa84bfb66f2af8901172d08d09789e4b20a1afc40ef92a891a34e30
|
|
7
|
+
data.tar.gz: ce628aaac0d74a69a3e82ea88afad52a91437af80b4e887b8f0c95366eed7f26c404f25b1d6d1fc316e3a5d0f7b4544921f8cf40621a21b4fa981a85093472d5
|
data/.envrc
CHANGED
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: 5 reek false positives annotated inline, reek added to the development bundle, and gem lifecycle tasks moved to asgard.
|
|
6
|
+
|
|
3
7
|
### Added
|
|
4
8
|
- `.loki` Asgard task file: `test`, `rubocop`, `rubocop_fix`, `flog`, `flay`, `quality`, `build`, `install`, `release`, and `console` tasks via the Asgard task runner
|
|
5
9
|
- `flay_check` Rake task: structural code duplication gate (mass threshold 50); integrated into the `quality` Rake task
|
data/Rakefile
CHANGED
data/examples/01_ractor_tools.rb
CHANGED
|
@@ -45,7 +45,7 @@ end
|
|
|
45
45
|
class WordStatsTool < TextTool
|
|
46
46
|
description "Count words, sentences, and average word length"
|
|
47
47
|
|
|
48
|
-
|
|
48
|
+
parameter :text, type: :string, description: "Text to analyze"
|
|
49
49
|
|
|
50
50
|
def execute(text:)
|
|
51
51
|
words = text.scan(/\b\w+\b/)
|
|
@@ -60,7 +60,7 @@ end
|
|
|
60
60
|
class ReadabilityTool < TextTool
|
|
61
61
|
description "Estimate words-per-sentence and long-word density"
|
|
62
62
|
|
|
63
|
-
|
|
63
|
+
parameter :text, type: :string, description: "Text to analyze"
|
|
64
64
|
|
|
65
65
|
def execute(text:)
|
|
66
66
|
words = text.scan(/\b\w+\b/)
|
|
@@ -85,7 +85,7 @@ class HeavyDigestTool < TextTool
|
|
|
85
85
|
|
|
86
86
|
ROUNDS = 500_000
|
|
87
87
|
|
|
88
|
-
|
|
88
|
+
parameter :text, type: :string, description: "Seed text"
|
|
89
89
|
|
|
90
90
|
def execute(text:)
|
|
91
91
|
digest = text
|
|
@@ -101,7 +101,7 @@ class RequestCounterTool < RobotLab::Tool
|
|
|
101
101
|
|
|
102
102
|
@@hits = 0 # mutable class variable — Ractor workers cannot access this
|
|
103
103
|
|
|
104
|
-
|
|
104
|
+
parameter :text, type: :string, description: "Text to count"
|
|
105
105
|
|
|
106
106
|
def execute(text:)
|
|
107
107
|
@@hits += 1
|
|
@@ -138,27 +138,28 @@ section("Part 2: Network.new(parallel_mode: :ractor)")
|
|
|
138
138
|
# routes through RactorNetworkScheduler instead of SimpleFlow::Pipeline.
|
|
139
139
|
# The default mode is :async (unchanged SimpleFlow behavior).
|
|
140
140
|
|
|
141
|
-
model
|
|
141
|
+
model = "qwen/qwen3.8-27b"
|
|
142
|
+
provider = "lms"
|
|
142
143
|
|
|
143
144
|
network = RobotLab::Network.new(name: "research_pipeline", parallel_mode: :ractor) do
|
|
144
145
|
task :headline_finder, RobotLab.build(name: "headline_finder",
|
|
145
146
|
system_prompt: "Find the 3 most relevant news headlines. Be concise.",
|
|
146
|
-
model: model),
|
|
147
|
+
model: model, provider: provider),
|
|
147
148
|
depends_on: :none
|
|
148
149
|
|
|
149
150
|
task :background_brief, RobotLab.build(name: "background_brief",
|
|
150
151
|
system_prompt: "Provide a 2-sentence background on the topic.",
|
|
151
|
-
model: model),
|
|
152
|
+
model: model, provider: provider),
|
|
152
153
|
depends_on: :none
|
|
153
154
|
|
|
154
155
|
task :fact_checker, RobotLab.build(name: "fact_checker",
|
|
155
156
|
system_prompt: "List 3 verifiable facts about the topic.",
|
|
156
|
-
model: model),
|
|
157
|
+
model: model, provider: provider),
|
|
157
158
|
depends_on: :none
|
|
158
159
|
|
|
159
160
|
task :report_writer, RobotLab.build(name: "report_writer",
|
|
160
161
|
system_prompt: "Synthesize the provided context into a 3-sentence report.",
|
|
161
|
-
model: model),
|
|
162
|
+
model: model, provider: provider),
|
|
162
163
|
depends_on: ["headline_finder", "background_brief", "fact_checker"]
|
|
163
164
|
end
|
|
164
165
|
|
data/examples/common.rb
CHANGED
|
@@ -7,6 +7,7 @@ $LOAD_PATH.unshift File.expand_path("../lib", __dir__)
|
|
|
7
7
|
|
|
8
8
|
require "robot_lab"
|
|
9
9
|
require "robot_lab/ractor"
|
|
10
|
+
require "ruby_llm/providers/lms"
|
|
10
11
|
|
|
11
12
|
# Unbuffered stdout so Ractor-generated output interleaves correctly with
|
|
12
13
|
# main-thread headers when viewed in a terminal or redirected to a pipe.
|
|
@@ -15,13 +16,12 @@ $stdout.sync = true
|
|
|
15
16
|
# Fallback for when direnv has not activated examples/.envrc
|
|
16
17
|
ENV["ROBOT_LAB_TEMPLATE_PATH"] ||= File.join(__dir__, "prompts")
|
|
17
18
|
|
|
19
|
+
# Local models via LM Studio (ruby_llm-providers-lms). qwen3.8 for the
|
|
20
|
+
# tool-heavy demos; no API keys needed.
|
|
18
21
|
RubyLLM.configure do |c|
|
|
19
|
-
c.logger
|
|
20
|
-
c.default_model
|
|
21
|
-
c.
|
|
22
|
-
c.openai_api_key = ENV["OPENAI_API_KEY"]
|
|
23
|
-
c.openai_organization_id = ENV["OPENAI_ORGANIZATION_ID"]
|
|
24
|
-
c.openai_project_id = ENV["OPENAI_PROJECT_ID"]
|
|
22
|
+
c.logger = Logger.new(File::NULL)
|
|
23
|
+
c.default_model = "qwen/qwen3.8-27b"
|
|
24
|
+
c.lms_api_base = ENV.fetch("LMS_API_BASE", "http://localhost:1234/v1")
|
|
25
25
|
end
|
|
26
26
|
|
|
27
27
|
RobotLab.configure do |c|
|
|
@@ -16,6 +16,7 @@ module RobotLab
|
|
|
16
16
|
# @param obj [Object] the value to freeze
|
|
17
17
|
# @return [Object] a frozen, Ractor-shareable copy
|
|
18
18
|
# @raise [RactorBoundaryError] if the value cannot be made shareable
|
|
19
|
+
# :reek:TooManyStatements -- recursive case dispatch per container type plus dup/error fallback; splitting obscures the recursion.
|
|
19
20
|
def self.freeze_deep(obj)
|
|
20
21
|
return obj if Ractor.shareable?(obj)
|
|
21
22
|
|
|
@@ -63,6 +63,7 @@ module RobotLab
|
|
|
63
63
|
end
|
|
64
64
|
|
|
65
65
|
# Gracefully shut down worker Ractors.
|
|
66
|
+
# :reek:UncommunicativeVariableName -- single-char block param (w = worker) is accepted project convention.
|
|
66
67
|
def shutdown
|
|
67
68
|
return if @closed
|
|
68
69
|
|
|
@@ -136,6 +137,7 @@ module RobotLab
|
|
|
136
137
|
end
|
|
137
138
|
end
|
|
138
139
|
|
|
140
|
+
# :reek:FeatureEnvy :reek:NestedIterators -- readiness predicate over each entry's depends_on list; the inner all? defines "ready".
|
|
139
141
|
def partition_ready(remaining, completed)
|
|
140
142
|
remaining.partition do |entry|
|
|
141
143
|
deps = entry[:depends_on]
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: robot_lab-ractor
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.3.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Dewayne VanHoozer
|
|
@@ -43,14 +43,14 @@ dependencies:
|
|
|
43
43
|
requirements:
|
|
44
44
|
- - "~>"
|
|
45
45
|
- !ruby/object:Gem::Version
|
|
46
|
-
version: 0.
|
|
46
|
+
version: 0.3.0
|
|
47
47
|
type: :runtime
|
|
48
48
|
prerelease: false
|
|
49
49
|
version_requirements: !ruby/object:Gem::Requirement
|
|
50
50
|
requirements:
|
|
51
51
|
- - "~>"
|
|
52
52
|
- !ruby/object:Gem::Version
|
|
53
|
-
version: 0.
|
|
53
|
+
version: 0.3.0
|
|
54
54
|
description: Provides RobotLab::RactorWorkerPool — a pool of Ruby Ractor workers for
|
|
55
55
|
executing CPU-bound, Ractor-safe tools in parallel. Includes RactorBoundary (deep-freeze
|
|
56
56
|
utility for crossing Ractor boundaries), RactorJob/RactorJobError/RobotSpec (frozen
|
|
@@ -111,7 +111,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
111
111
|
- !ruby/object:Gem::Version
|
|
112
112
|
version: '0'
|
|
113
113
|
requirements: []
|
|
114
|
-
rubygems_version: 4.0.
|
|
114
|
+
rubygems_version: 4.0.21
|
|
115
115
|
specification_version: 4
|
|
116
116
|
summary: Ractor-based parallel tool execution for RobotLab agents
|
|
117
117
|
test_files: []
|