@omdp/dsh-key-fallback 1.0.6 → 1.0.7

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 (2) hide show
  1. package/lib/index.js +6 -1
  2. package/package.json +13 -5
package/lib/index.js CHANGED
@@ -13,7 +13,7 @@ import * as dshSettings from '@deepseek-ai/dsh-settings'
13
13
  import * as zs from '@deepseek-ai/schemastery'
14
14
 
15
15
  export const name = 'key-fallback'
16
- export const inject = ['llm', 'settings', 'webServer']
16
+ export const inject = ['llm', 'settings', 'webServer', 'credentials']
17
17
  const API_BASE = '/dsh-key-fallback'
18
18
  const SETTINGS_FILE = join(homedir(), '.dsh', 'settings.yaml')
19
19
  // 与客户端 slots.register key 保持一致的命名空间名。
@@ -128,6 +128,11 @@ export function apply(ctx) {
128
128
  const key = pickKey(provider)
129
129
  if (!key) return config
130
130
  process.env[pool.env] = key
131
+ // ninerouter 这类 llm-pi-ai provider 凭据走 credentials 域(apiKeyEnv),
132
+ // 只写 env 不会生效 — 同步覆盖 credentials,使真实请求用池中 key。
133
+ if (ctx.credentials) {
134
+ try { await ctx.credentials.set(pool.env, key) } catch (e) {}
135
+ }
131
136
  return config
132
137
  })
133
138
 
package/package.json CHANGED
@@ -1,12 +1,16 @@
1
1
  {
2
2
  "name": "@omdp/dsh-key-fallback",
3
3
  "description": "Minimal API key fallback for DeepSeek Harness: on a retryable request error, silently retry the same call with the next key in the pool.",
4
- "version": "1.0.6",
4
+ "version": "1.0.7",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
7
7
  "exports": {
8
- ".": { "default": "./lib/index.js" },
9
- "./client": { "default": "./lib/client.js" },
8
+ ".": {
9
+ "default": "./lib/index.js"
10
+ },
11
+ "./client": {
12
+ "default": "./lib/client.js"
13
+ },
10
14
  "./package.json": "./package.json"
11
15
  },
12
16
  "files": [
@@ -23,10 +27,14 @@
23
27
  "access": "public"
24
28
  },
25
29
  "dsh": {
26
- "bundle": { "patch": "./cordis.patch.yml" },
30
+ "bundle": {
31
+ "patch": "./cordis.patch.yml"
32
+ },
27
33
  "client": {
28
34
  "platform": "web",
29
- "inject": ["@deepseek-ai/dsh-client-ui-settings"]
35
+ "inject": [
36
+ "@deepseek-ai/dsh-client-ui-settings"
37
+ ]
30
38
  }
31
39
  },
32
40
  "peerDependencies": {