coolhand 0.5.1 → 0.7.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.
data/lib/coolhand.rb CHANGED
@@ -6,6 +6,7 @@ require "json"
6
6
  require "base64"
7
7
  require "time"
8
8
 
9
+ require_relative "coolhand/errors"
9
10
  require_relative "coolhand/version"
10
11
  require_relative "coolhand/configuration"
11
12
  require_relative "coolhand/collector"
@@ -14,13 +15,12 @@ require_relative "coolhand/net_http_interceptor"
14
15
  require_relative "coolhand/api_service"
15
16
  require_relative "coolhand/logger_service"
16
17
  require_relative "coolhand/feedback_service"
18
+ require_relative "coolhand/template_service"
17
19
  require_relative "coolhand/webhook_interceptor"
18
20
 
19
21
  # The main module for the Coolhand gem.
20
22
  # It provides the configuration interface and initializes the patching.
21
23
  module Coolhand
22
- class Error < StandardError; end
23
-
24
24
  # Class-level instance variables to hold the configuration
25
25
  @configuration = Configuration.new
26
26
 
@@ -62,12 +62,11 @@ module Coolhand
62
62
 
63
63
  return yield unless configuration.enabled
64
64
 
65
- patched = NetHttpInterceptor.patched?
66
65
  NetHttpInterceptor.patch!
67
66
  begin
68
67
  yield
69
68
  ensure
70
- NetHttpInterceptor.unpatch! unless patched
69
+ NetHttpInterceptor.unpatch!
71
70
  end
72
71
  end
73
72
 
@@ -92,6 +91,10 @@ module Coolhand
92
91
  return if configuration.silent
93
92
 
94
93
  puts "COOLHAND: #{message}"
94
+ rescue StandardError
95
+ # Logging must never raise into the host app (e.g. a closed stdout) — least of all from
96
+ # the interceptor's ensure block, where it would replace the host's own response.
97
+ nil
95
98
  end
96
99
 
97
100
  # Creates a new FeedbackService instance
@@ -104,6 +107,12 @@ module Coolhand
104
107
  LoggerService.new
105
108
  end
106
109
 
110
+ # Creates a new TemplateService instance, for reading LLM request templates back out of
111
+ # Coolhand. Needs the private API key - the public key is write-only on this API.
112
+ def template_service
113
+ TemplateService.new
114
+ end
115
+
107
116
  def required_field?(value)
108
117
  return false if value.nil?
109
118
  return false if value.respond_to?(:empty?) && value.empty?
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: coolhand
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Carroll
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2026-08-02 00:00:00.000000000 Z
12
+ date: 2026-09-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: base64
@@ -39,6 +39,7 @@ files:
39
39
  - ".rspec"
40
40
  - ".rubocop.yml"
41
41
  - ".simplecov"
42
+ - AGENTS.harness.md
42
43
  - CHANGELOG.md
43
44
  - LICENSE
44
45
  - README.md
@@ -49,6 +50,7 @@ files:
49
50
  - docs/elevenlabs.md
50
51
  - docs/feedback.md
51
52
  - docs/openai.md
53
+ - docs/template-search.md
52
54
  - docs/vertex.md
53
55
  - lib/coolhand.rb
54
56
  - lib/coolhand/api_service.rb
@@ -57,11 +59,17 @@ files:
57
59
  - lib/coolhand/configuration.rb
58
60
  - lib/coolhand/default_exclude_api_patterns.yml
59
61
  - lib/coolhand/default_intercept_addresses.yml
62
+ - lib/coolhand/default_intercept_path_patterns.yml
63
+ - lib/coolhand/errors.rb
60
64
  - lib/coolhand/feedback_service.rb
61
65
  - lib/coolhand/logger_service.rb
62
66
  - lib/coolhand/net_http_interceptor.rb
63
67
  - lib/coolhand/open_ai/batch_result_processor.rb
68
+ - lib/coolhand/open_ai/webhook_id_store.rb
64
69
  - lib/coolhand/open_ai/webhook_validator.rb
70
+ - lib/coolhand/pagination.rb
71
+ - lib/coolhand/read_requests.rb
72
+ - lib/coolhand/template_service.rb
65
73
  - lib/coolhand/version.rb
66
74
  - lib/coolhand/vertex/batch_result_processor.rb
67
75
  - lib/coolhand/webhook_interceptor.rb