ask-agent 0.4.1 → 0.4.3

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: 16f5dbe983536b338fe5231296ff64a48777d230d782cb81ba14d11a8505ac91
4
- data.tar.gz: 4d5c8f49e66ce01dd41807c298c86f9ff9b0547c0636d18a61b38567a56e4ca1
3
+ metadata.gz: 23e169387a3dfe5b2f74e623ebe467d11a51518f7258aff69467955d7cd8b006
4
+ data.tar.gz: 1953b7ad69838440837864b8d39b56cced33ab4959eea3ffdc5eaa479dc8946a
5
5
  SHA512:
6
- metadata.gz: d03ce2a1ec7461b5087e96014ac5b21689ce5fb41a7d8a161bfe5505839930fbf0e6fdfaad129d506ba3fbead429b52a12b854ab5c06f173aa6aae3ef2d9e4ad
7
- data.tar.gz: 76019686018d278a9ac50bc3259775424be29208b8e345e12574a130b8bcdca47a242172ddeff2a59817780418101d71051eb90130b6ef3f406a895e3e89bbab
6
+ metadata.gz: be8d999d26b967e996b8f3b72e5a1bbdf34b79446d3903e91e3d2ff1e65ba102cdd63a77a5abf40bcbbb5b9855b969cd79e6509c42c491ef749c0e2437474ed6
7
+ data.tar.gz: 3e96cd7d4bbebddf7ef7131a7adae6f086fd57c84740f88c50f21175f482e6d29a366936c174953e4217302721d565cb1b7f1dfeaf83206d3652202527cb4333
data/CHANGELOG.md CHANGED
@@ -1,9 +1,3 @@
1
- ## [0.4.1] — 2026-07-18
2
-
3
- ### Fixed
4
-
5
- - **`Chat#provider_config` now falls back to base provider name for credential lookup** — When a provider slug has a compound name like `opencode_go`, the method first tries `Ask::Auth.resolve(:opencode_go_api_key)` and if that returns nil, falls back to `Ask::Auth.resolve(:opencode_api_key)`. This lets users store credentials under the canonical provider name (e.g., `opencode.api_key` in Rails credentials) while using a specific variant provider (e.g., `opencode_go`).
6
-
7
1
  ## [0.4.0] — 2026-07-17
8
2
 
9
3
  ### Added
@@ -119,15 +119,23 @@ module Ask
119
119
  end
120
120
 
121
121
  def provider_config(slug)
122
- key = Ask::Auth.resolve(:"#{slug}_api_key") rescue nil
123
- # For compound provider slugs (e.g., opencode_go), fall back to the
124
- # base name (e.g., opencode) for credential lookup. This lets users
125
- # store credentials under the canonical provider name while using a
126
- # specific variant provider.
127
- if key.nil? && slug.to_s.include?("_")
128
- base = slug.to_s.split("_").first
129
- key = Ask::Auth.resolve(:"#{base}_api_key") rescue nil
122
+ # Try credential names from most to least specific:
123
+ # 1. Flat key with full slug (opencode_go_api_key)
124
+ # 2. Nested path with full slug ([:opencode, :go, :api_key])
125
+ # 3. Flat key with base slug (opencode_api_key)
126
+ # 4. Nested path with base slug ([:opencode, :api_key])
127
+ slug_s = slug.to_s
128
+ base_s = slug_s.include?("_") ? slug_s.split("_").first : nil
129
+
130
+ cred_names = [:"#{slug_s}_api_key"]
131
+ cred_names << slug_s.split("_").map(&:to_sym).push(:api_key) if slug_s.include?("_")
132
+ if base_s
133
+ cred_names << :"#{base_s}_api_key"
134
+ cred_names << [base_s.to_sym, :api_key]
130
135
  end
136
+
137
+ key = Ask::Auth.resolve(*cred_names) rescue nil
138
+
131
139
  base_url = Ask::Auth.resolve(:"#{slug}_api_base") rescue nil
132
140
  config = { api_key: key }
133
141
  config[:"#{slug}_api_key"] = key
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Ask
4
4
  module Agent
5
- VERSION = "0.4.1"
5
+ VERSION = "0.4.3"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ask-agent
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kaka Ruto