brute 4.3.2 → 5.0.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.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/lib/brute/completion/async_faraday.rb +38 -0
  3. data/lib/brute/completion/lang_chain.rb +185 -0
  4. data/lib/brute/completion/llmrb.rb +182 -0
  5. data/lib/brute/completion/open_router.rb +54 -42
  6. data/lib/brute/completion/ruby_llm.rb +198 -0
  7. data/lib/brute/contrib/otel.rb +208 -0
  8. data/lib/brute/hooks.rb +149 -31
  9. data/lib/brute/message_transport/lang_chain.rb +36 -0
  10. data/lib/brute/message_transport/llm.rb +6 -0
  11. data/lib/brute/message_transport/open_router.rb +6 -0
  12. data/lib/brute/message_transport/ruby_llm.rb +6 -0
  13. data/lib/brute/message_transport.rb +8 -0
  14. data/lib/brute/middleware/000_base.rb +61 -0
  15. data/lib/brute/middleware/002_session_log.rb +1 -1
  16. data/lib/brute/middleware/004_summarize.rb +1 -1
  17. data/lib/brute/middleware/005_tracing.rb +1 -1
  18. data/lib/brute/middleware/006_loop.rb +1 -1
  19. data/lib/brute/middleware/008_checkpoint.rb +1 -1
  20. data/lib/brute/middleware/010_max_iterations.rb +1 -1
  21. data/lib/brute/middleware/020_system_prompt.rb +1 -1
  22. data/lib/brute/middleware/025_skills.rb +1 -1
  23. data/lib/brute/middleware/040_compaction_check.rb +1 -1
  24. data/lib/brute/middleware/060_questions.rb +1 -1
  25. data/lib/brute/middleware/070_tool_pipeline.rb +60 -47
  26. data/lib/brute/middleware/event_handler.rb +1 -1
  27. data/lib/brute/middleware/user_queue.rb +1 -1
  28. data/lib/brute/turn/agent_pipeline.rb +3 -4
  29. data/lib/brute/turn/pipeline.rb +151 -2
  30. data/lib/brute/usage_detection/lang_chain.rb +44 -0
  31. data/lib/brute/usage_detection/llmrb.rb +53 -0
  32. data/lib/brute/usage_detection/open_router.rb +62 -0
  33. data/lib/brute/usage_detection/ruby_llm.rb +55 -0
  34. data/lib/brute/usage_detection/usage.rb +51 -0
  35. data/lib/brute/version.rb +1 -1
  36. data/lib/brute.rb +95 -3
  37. metadata +83 -8
  38. data/lib/brute/changelog.rb +0 -322
  39. data/lib/brute/deprecate.rb +0 -132
  40. data/lib/brute/middleware/001_otel_span.rb +0 -79
  41. data/lib/brute/middleware/015_otel_token_usage.rb +0 -44
  42. data/lib/brute/middleware/073_otel_tool_call.rb +0 -51
  43. data/lib/brute/middleware/075_otel_tool_results.rb +0 -48
  44. data/lib/brute/middleware/open_router.rb +0 -56
@@ -1,56 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "gem_kit"
4
-
5
- require_relative "../completion/open_router"
6
-
7
- module Brute
8
- module Middleware
9
- module OpenRouter
10
- # Deprecated. Completion middlewares now live under Brute::Completion,
11
- # which names them for what they do (call one provider) rather than for
12
- # where they happened to sit in the stack:
13
- #
14
- # Brute::Middleware::OpenRouter::Completion -> Brute::Completion::OpenRouter
15
- #
16
- # The old name stays a working subclass of the new one until the deadline
17
- # below; see DEPRECATIONS.md and `gem kit deprecations`.
18
- class Completion < Brute::Completion::OpenRouter
19
- extend GemKit::Deprecate
20
- superseded_by "Brute::Completion::OpenRouter", "5.0"
21
- end
22
- end
23
- end
24
- end
25
-
26
- __END__
27
-
28
- describe "brute/middleware/open_router" do
29
- require "brute/completion/open_router"
30
-
31
- it "is the new Completion class under the old name" do
32
- Brute::Middleware::OpenRouter::Completion.superclass.should == Brute::Completion::OpenRouter
33
- end
34
-
35
- it "warns on use, naming the replacement and the removal version" do
36
- captured = []
37
- original = GemKit::Deprecate.method(:warn)
38
- GemKit::Deprecate.define_singleton_method(:warn) { |message| captured << message }
39
- begin
40
- Brute::Middleware::OpenRouter::Completion.new(->(env) { env })
41
- ensure
42
- GemKit::Deprecate.define_singleton_method(:warn, original)
43
- end
44
-
45
- captured.size.should == 1
46
- captured.first.should.match(/Brute::Middleware::OpenRouter::Completion is deprecated/)
47
- captured.first.should.match(/use Brute::Completion::OpenRouter instead/)
48
- captured.first.should.match(/removed in 5\.0/)
49
- end
50
-
51
- it "is registered with its removal deadline" do
52
- entry = GemKit::Deprecate.registry.find { |e| e.name == "Brute::Middleware::OpenRouter::Completion" }
53
- entry.should.not.be.nil
54
- entry.removed_in.should == Gem::Version.new("5.0")
55
- end
56
- end