@goodandready/dsh-key-rotation 0.7.32 → 0.7.34

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.
package/README.md CHANGED
@@ -28,7 +28,7 @@
28
28
 
29
29
  ## ⚡ Overview & The Problem
30
30
 
31
- ### 🛠️ What's New in v0.7.32 (Stability & Bugfix Release)
31
+ ### 🛠️ What's New in v0.7.33 (Stability & Bugfix Release)
32
32
  - **🔍 Resolved Key Probing BaseURL**: Fixed `resolveBaseUrl` to map key credential refs to owning provider pools, restoring live `probeModels` testing.
33
33
  - **🛡️ Guarded Cascade Recursion**: Prevented call stack overflow in cross-provider failover when circular cascade chains occur.
34
34
  - **🕒 Accurate Midnight PST Resets**: Corrected UTC-8 timezone calculation offset sign for calendar quota reset windows.
package/README.ru.md CHANGED
@@ -28,7 +28,7 @@
28
28
 
29
29
  ## ⚡ Обзор и решаемая проблема
30
30
 
31
- ### 🛠️ Что нового в версии 0.7.32 (Хотфикс и повышение стабильности)
31
+ ### 🛠️ Что нового в версии 0.7.33 (Хотфикс и повышение стабильности)
32
32
  - **🔍 Исправление проверки ключей**: Функция `resolveBaseUrl` теперь сопоставляет ref ключа с его пулом, восстанавливая работу живого тестирования моделей.
33
33
  - **🛡️ Защита от зацикливания каскада**: Устранена возможность переполнения стека при взаимных кольцевых цепочках failover.
34
34
  - **🕒 Точный сброс квот по PST**: Исправлен знак часового смещения UTC-8 для корректного сброса лимитов в полночь по тихоокеанскому времени.
package/README.zh.md CHANGED
@@ -28,7 +28,7 @@
28
28
 
29
29
  ## ⚡ 概述与核心痛点
30
30
 
31
- ### 🛠️ v0.7.32 版本新特性 (稳定性与问题修复)
31
+ ### 🛠️ v0.7.33 版本新特性 (稳定性与问题修复)
32
32
  - **🔍 修复密钥探测 BaseURL 解析**:`resolveBaseUrl` 现已支持从密钥 ref 反查归属提供商池,恢复在线模型连通性探测。
33
33
  - **🛡️ 防御级联无限递归**:在跨提供商故障转移中增加递归深度防护,彻底杜绝循环级联导致的堆栈溢出。
34
34
  - **🕒 纠正 PST 太平洋时间配额重置**:修复 UTC-8 时区偏移符号,确保日配额在太平洋时间午夜准时重置。
package/lib/index.js CHANGED
@@ -134,6 +134,7 @@ const agentBudget = new AgentBudget();
134
134
  const regionMap = new RegionMap();
135
135
  // Global config accessor safe against early initialization
136
136
  let getConfig = () => null;
137
+ let getRuntime = () => null;
137
138
 
138
139
  // IncidentReporter: lazily built when Config provides incidentGitHubToken + incidentGitHubBaseUrl.
139
140
  // ponytail: never bake the token into source; repo is hardcoded (this plugin's home repo) but token is per-deploy.
@@ -157,19 +158,30 @@ function ensureSandboxRunner(ctx) {
157
158
  function resolveBaseUrl(providerOrRef) {
158
159
  try {
159
160
  let provider = providerOrRef;
160
- const rt = buildRuntime();
161
+ const rt = typeof getRuntime === 'function' ? getRuntime() : null;
161
162
  const pool = rt?.poolByRef?.get(providerOrRef);
162
163
  if (pool?.base) provider = pool.base;
163
164
  else if (pool?.provider) provider = pool.provider;
164
165
 
165
166
  const c = ctx || lastTestCacheRunnerCtx;
167
+ const pInfo = c?.llm?.getProvider?.(provider);
168
+ if (pInfo && (pInfo.baseUrl || pInfo.endpoint || pInfo.url)) {
169
+ return String(pInfo.baseUrl || pInfo.endpoint || pInfo.url);
170
+ }
171
+ for (const info of (c?.llm?.listProviders?.() || [])) {
172
+ if (info && (info.id === provider || info.name === provider)) {
173
+ const u = info.baseUrl || info.endpoint || info.url;
174
+ if (u) return String(u);
175
+ }
176
+ }
166
177
  const ns = c?.get ? c.get(PIAI_NS) : null;
167
178
  const list = ns && (ns.providers || (ns.config && ns.config.providers) || []);
168
- if (!Array.isArray(list)) return null;
169
- // ponytail: match by id OR name OR alias; pick first hit
170
- const hit = list.find((p) => p && (p.id === provider || p.name === provider || (Array.isArray(p.aliases) && p.aliases.includes(provider))));
171
- const base = hit && (hit.baseUrl || hit.endpoint || hit.url);
172
- return base ? String(base) : null;
179
+ if (Array.isArray(list)) {
180
+ const hit = list.find((p) => p && (p.id === provider || p.name === provider || (Array.isArray(p.aliases) && p.aliases.includes(provider))));
181
+ const base = hit && (hit.baseUrl || hit.endpoint || hit.url);
182
+ if (base) return String(base);
183
+ }
184
+ return null;
173
185
  } catch (_) {
174
186
  return null;
175
187
  }
@@ -707,6 +719,7 @@ export function apply(ctx, config = {}) {
707
719
  }, 'dsh-key-rotation: sweep expired cooldowns');
708
720
 
709
721
  // ── runtime snapshot: config + llm-pi-ai profile mapping ──
722
+ getRuntime = buildRuntime;
710
723
  function buildRuntime() {
711
724
  // Deep-clone before resolving: the frozen snapshot from settings.register
712
725
  // must never be written to by schemastery's dict resolver.
package/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "@goodandready/dsh-key-rotation",
3
- "version": "0.7.32",
3
+ "version": "0.7.34",
4
+ "packageManager": "pnpm@10.33.2",
4
5
  "description": "Per-provider API key rotation for DeepSeek Harness: a key pool per provider, auto-created clone routes, and switching to the next key on quota/rate-limit errors. Includes a Settings section (Key Rotation) to edit the key pools, cooldown and switch codes.",
5
6
  "keywords": [
6
7
  "deepseek-harness",
@@ -40,13 +41,13 @@
40
41
  },
41
42
  "client": {
42
43
  "platform": "web",
43
- "inject": [
44
- "@deepseek-ai/dsh-client-runtime",
45
- "@deepseek-ai/dsh-client-ui-slots"
46
- ]
44
+ "inject": []
47
45
  }
48
46
  },
49
47
  "license": "MIT",
48
+ "engines": {
49
+ "node": ">=18"
50
+ },
50
51
  "peerDependencies": {
51
52
  "@deepseek-ai/cordis": "^4.0.1",
52
53
  "@deepseek-ai/schemastery": "^3.18.1",