brute 0.3.0 → 0.4.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/lib/brute/agent_stream.rb +8 -2
- data/lib/brute/middleware/tool_use_guard.rb +1 -1
- data/lib/brute/orchestrator.rb +9 -2
- data/lib/brute/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e6fa4c53a825578634b110724522c021f089595e75e80faea05b5c53697010dd
|
|
4
|
+
data.tar.gz: 1cff09cf5e255928aada4f09a11c2f77ccf873839ee4f6d0ba24bc12beaefeba
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 795a6b851f47daba23755f8791f98c4c54f1c738704748767e70ff0bf25b797dca15fc25892642b7b46c7f6c8acab83d5dd110b0741e4252e8e8b1ce8798ffa1
|
|
7
|
+
data.tar.gz: 827d9628e7d5142fe1eaabc5e3de47cf04468afa5e1985a9af6b7ccc16e471ce35236953d3b746e988ef34a779df3cd4b1e6821ca9cd45815fc302785d8d1a00
|
data/lib/brute/agent_stream.rb
CHANGED
|
@@ -48,9 +48,15 @@ module Brute
|
|
|
48
48
|
@pending_tools << [tool, error]
|
|
49
49
|
end
|
|
50
50
|
|
|
51
|
-
# Clear
|
|
52
|
-
|
|
51
|
+
# Clear only the tool call metadata (used by ToolUseGuard after it
|
|
52
|
+
# has consumed the data for synthetic message injection).
|
|
53
|
+
def clear_pending_tool_calls!
|
|
53
54
|
@pending_tool_calls.clear
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
# Clear the deferred execution queue after the orchestrator has
|
|
58
|
+
# consumed and dispatched all tool calls.
|
|
59
|
+
def clear_pending_tools!
|
|
54
60
|
@pending_tools.clear
|
|
55
61
|
end
|
|
56
62
|
end
|
data/lib/brute/orchestrator.rb
CHANGED
|
@@ -167,7 +167,7 @@ module Brute
|
|
|
167
167
|
@request_count += 1
|
|
168
168
|
|
|
169
169
|
# Check limits
|
|
170
|
-
break if
|
|
170
|
+
break if !has_pending_tools?
|
|
171
171
|
break if @request_count >= MAX_REQUESTS_PER_TURN
|
|
172
172
|
break if @env[:metadata][:tool_error_limit_reached]
|
|
173
173
|
end
|
|
@@ -242,13 +242,20 @@ module Brute
|
|
|
242
242
|
# Pending tool collection
|
|
243
243
|
# ------------------------------------------------------------------
|
|
244
244
|
|
|
245
|
+
# Check whether there are pending tools without consuming them.
|
|
246
|
+
def has_pending_tools?
|
|
247
|
+
return true if @stream&.pending_tools&.any?
|
|
248
|
+
return true if @context.functions.any?
|
|
249
|
+
false
|
|
250
|
+
end
|
|
251
|
+
|
|
245
252
|
# Collect pending tools from the stream (streaming) or context (non-streaming).
|
|
246
253
|
# Returns an array of [tool, error_or_nil] pairs.
|
|
247
254
|
# Clears the stream's deferred state after consumption.
|
|
248
255
|
def collect_pending_tools
|
|
249
256
|
if @stream&.pending_tools&.any?
|
|
250
257
|
tools = @stream.pending_tools.dup
|
|
251
|
-
@stream.
|
|
258
|
+
@stream.clear_pending_tools!
|
|
252
259
|
tools
|
|
253
260
|
elsif @context.functions.any?
|
|
254
261
|
@context.functions.to_a.map { |fn| [fn, nil] }
|
data/lib/brute/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: brute
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.4.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Brute Contributors
|
|
8
8
|
bindir: bin
|
|
9
9
|
cert_chain: []
|
|
10
|
-
date: 1980-01-
|
|
10
|
+
date: 1980-01-01 00:00:00.000000000 Z
|
|
11
11
|
dependencies:
|
|
12
12
|
- !ruby/object:Gem::Dependency
|
|
13
13
|
name: async
|