brute 4.2.0 → 4.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6016495cc66cb0d8c5b7b33aaef14eee694960355bb2d772c2d75b1aaacca844
4
- data.tar.gz: 137446fd33a37736993e2d067d75169d8ca1ce83c109511054b73e768550fda5
3
+ metadata.gz: f3ccdff7358171494bf69f8a71b61dc12e6c256c8fa34501d9eab9852173ea49
4
+ data.tar.gz: 81882a81b997e09d91de4e121a194bca501d1504d829d4ed711bdd3a7937e6a8
5
5
  SHA512:
6
- metadata.gz: 4098f01a58d7d6946fb4f362aab7d37db86cb1f6e77def51f96e08b86eddbaa8c5462e8a613d9e74ff84731baf5ed65076abd010c2ab854b5e838279b3801ee3
7
- data.tar.gz: 25c4986d4beed8103eb6c0f527ad737b98de3f7c3d1e562c83f956afcc3b3267eb5c6cb669ac488cf9ffdf97c6a446888f9363a2d01bd6f3913701d7cc46c313
6
+ metadata.gz: 42711f6b308d9954bf6d92f762ac2b871a31c5629c6f5d83e47dca8f3fd17c8eca40b5b2668cec1ebd147310e3d4349b3ff77b3394be768482ba81d918ce249b
7
+ data.tar.gz: eac8529b0158efcd494e8fce53c185a0cdc88177065397695b6dc3fe766b7a46f081b053d8c56f463ebf865a4f7845f06747d5d67721883df6f010f2dd7dc26d
@@ -71,6 +71,24 @@ module Brute
71
71
  super(app, CONDITION)
72
72
  end
73
73
  end
74
+
75
+ # Keeps the turn alive while background jobs are running. Sit it
76
+ # OUTSIDE the tool loop: the inner loop ends when the model answers
77
+ # with text, and this one sends control back in for another pass while
78
+ # jobs are still running — which is how a finished job gets reported.
79
+ # Whatever spawns the jobs (say, a middleware running a subagent in
80
+ # the background) keeps env[:background_jobs] current.
81
+ #
82
+ # use Brute::Middleware::Loop::BackgroundJobs
83
+ # use Brute::Middleware::Loop::ToolResult
84
+ #
85
+ class BackgroundJobs < Loop
86
+ CONDITION = ->(env) { env[:background_jobs] }
87
+
88
+ def initialize(app)
89
+ super(app, CONDITION)
90
+ end
91
+ end
74
92
  end
75
93
  end
76
94
  end
@@ -166,4 +184,31 @@ describe "brute/middleware/006_loop" do
166
184
  call_count.should == 1
167
185
  env[:current_iteration].should == 1
168
186
  end
187
+
188
+ # --- Loop::BackgroundJobs ---
189
+
190
+ it "BackgroundJobs runs the inner stack once when nothing is running" do
191
+ calls = 0
192
+ Brute::Middleware::Loop::BackgroundJobs.new(->(_env) { calls += 1 }).call({})
193
+
194
+ calls.should == 1
195
+ end
196
+
197
+ it "BackgroundJobs loops while jobs are running" do
198
+ calls = 0
199
+ inner = ->(env) do
200
+ calls += 1
201
+ env[:background_jobs] = calls < 3
202
+ end
203
+ Brute::Middleware::Loop::BackgroundJobs.new(inner).call({})
204
+
205
+ calls.should == 3
206
+ end
207
+
208
+ it "BackgroundJobs stops once the jobs are done" do
209
+ env = { background_jobs: true }
210
+ Brute::Middleware::Loop::BackgroundJobs.new(->(e) { e[:background_jobs] = false }).call(env)
211
+
212
+ env[:background_jobs].should.be.false
213
+ end
169
214
  end
data/lib/brute/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Brute
4
- VERSION = "4.2.0"
4
+ VERSION = "4.3.0"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: brute
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.2.0
4
+ version: 4.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brute Contributors
@@ -197,14 +197,14 @@ dependencies:
197
197
  requirements:
198
198
  - - "~>"
199
199
  - !ruby/object:Gem::Version
200
- version: '0.2'
200
+ version: '0.3'
201
201
  type: :development
202
202
  prerelease: false
203
203
  version_requirements: !ruby/object:Gem::Requirement
204
204
  requirements:
205
205
  - - "~>"
206
206
  - !ruby/object:Gem::Version
207
- version: '0.2'
207
+ version: '0.3'
208
208
  description: Production-grade coding agent with tool execution, middleware pipeline,
209
209
  context compaction, session persistence, and multi-provider LLM support.
210
210
  executables: []