brute 6.0.0 → 6.0.2
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/eval/transcript.rb +1 -1
- data/lib/brute/hooks.rb +11 -2
- data/lib/brute/turn/agent_pipeline.rb +1 -1
- data/lib/brute/turn/pipeline.rb +10 -4
- data/lib/brute/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4197c46dd001a197da4f187e2729c21dc462355def0d458deb3a6341196fec67
|
|
4
|
+
data.tar.gz: 27453e69fbeff9fa2958502ea366843466c9347335127f593b76f2cd60ea1629
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: bcb85717124bd3b7f4272eb7809a51d240adbcb1ad27aff3e5b67de53b4b1088ba14d7becdeb658b349f350f5247c82119c6e024799ab36ffc38f7fd74630ddf
|
|
7
|
+
data.tar.gz: 46dbd653dbde8e6edea254440b6b793d99766567402164181e7c4b9b780ed28aa85602a6ae8033febedb5858a75659278b69878782beab0a10d30ee9d8ec7668
|
data/lib/brute/hooks.rb
CHANGED
|
@@ -46,7 +46,10 @@ module Brute
|
|
|
46
46
|
TOOL_FAILURE_EVENT = :tool_failure
|
|
47
47
|
|
|
48
48
|
# The env, wrapped, for as long as one call lasts. Everything emitted
|
|
49
|
-
# through it carries
|
|
49
|
+
# through it carries the trace itself as its last argument -- so a
|
|
50
|
+
# subscriber that wants the call's identity asks it for an id, and one
|
|
51
|
+
# that wants anything else about the call has it -- and a call opened
|
|
52
|
+
# inside another
|
|
50
53
|
# delegates to it -- so the wrapper is the parent and unwrapping ends the
|
|
51
54
|
# call. It is still the env: SimpleDelegator forwards the rest.
|
|
52
55
|
class Trace < SimpleDelegator
|
|
@@ -64,11 +67,17 @@ module Brute
|
|
|
64
67
|
|
|
65
68
|
def current_trace = self
|
|
66
69
|
|
|
70
|
+
# The trace this one was opened inside, if any: emit_trace wraps, so the
|
|
71
|
+
# thing wrapped is the call that was already running.
|
|
72
|
+
def parent
|
|
73
|
+
__getobj__ if __getobj__.is_a?(Trace)
|
|
74
|
+
end
|
|
75
|
+
|
|
67
76
|
def emit(event, *extras, &work) = @hooks.emit(
|
|
68
77
|
event,
|
|
69
78
|
self,
|
|
70
79
|
*extras,
|
|
71
|
-
|
|
80
|
+
self,
|
|
72
81
|
&work
|
|
73
82
|
)
|
|
74
83
|
|
data/lib/brute/turn/pipeline.rb
CHANGED
|
@@ -180,15 +180,21 @@ describe "brute/turn/pipeline" do
|
|
|
180
180
|
end
|
|
181
181
|
|
|
182
182
|
pipeline = Brute::Turn::Pipeline.new
|
|
183
|
-
pipeline.on(:ping) { |env, extra,
|
|
183
|
+
pipeline.on(:ping) { |env, extra, trace| seen << [env, extra, trace] }
|
|
184
184
|
pipeline.use quiet
|
|
185
185
|
pipeline.run Object.new.tap { |o| o.define_singleton_method(:call) { |env| env } }
|
|
186
186
|
pipeline.call({ said: "hello" })
|
|
187
187
|
|
|
188
|
-
|
|
189
|
-
said.should == "hello"
|
|
188
|
+
env, extra, trace = seen.first
|
|
189
|
+
env[:said].should == "hello"
|
|
190
190
|
extra.should == :from_layer
|
|
191
|
-
|
|
191
|
+
|
|
192
|
+
# The trace itself comes last, not just its id: a subscriber that wants
|
|
193
|
+
# the call's identity asks it for one, and everything else about the call
|
|
194
|
+
# is on the same object -- which is the env it was handed first.
|
|
195
|
+
trace.id.should.not.be.nil
|
|
196
|
+
trace.__getobj__.should == { said: "hello" }
|
|
197
|
+
trace.__id__.should == env.__id__
|
|
192
198
|
|
|
193
199
|
# A lambda is a layer like any other now: it is handed the trace as its env.
|
|
194
200
|
answered = []
|
data/lib/brute/version.rb
CHANGED