@mofeng2223/dsh-claude-provider 0.6.10 → 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.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@mofeng2223/dsh-claude-provider",
3
- "version": "0.6.10",
4
- "description": "Custom Claude provider support for DeepSeek Harness 0.2.2-rc.5",
3
+ "version": "0.7.0",
4
+ "description": "Custom Claude provider support for DeepSeek Harness 0.2.3-alpha.3",
5
5
  "author": "mofeng2223",
6
6
  "license": "MIT",
7
7
  "repository": {
@@ -24,7 +24,7 @@
24
24
  },
25
25
  "type": "module",
26
26
  "dependencies": {
27
- "@deepseek-ai/schemastery": "3.18.4",
27
+ "@deepseek-ai/schemastery": "3.20.0-alpha.2",
28
28
  "js-yaml": "^4.3.2"
29
29
  },
30
30
  "exports": {
@@ -62,7 +62,7 @@
62
62
  }
63
63
  },
64
64
  "devDependencies": {
65
- "@deepseek-ai/dsh-client-ui-settings-models": "0.2.2-rc.5",
65
+ "@deepseek-ai/dsh-client-ui-settings-models": "0.2.3-alpha.3",
66
66
  "acorn": "8.19.0",
67
67
  "prettier": "3.10.1"
68
68
  }
package/src/index.js CHANGED
@@ -7,6 +7,7 @@ export const CLAUDE_PROVIDER_TYPE = 'claude-adaptive'
7
7
  export const CLAUDE_PROVIDER_SETTINGS_NS = 'dsh-claude-provider'
8
8
 
9
9
  export const Config = z.object({
10
+ credentialOnboarding: z.boolean().default(true).volatile(),
10
11
  providerTypes: z.dict(z.const(CLAUDE_PROVIDER_TYPE)).default({}).volatile(),
11
12
  })
12
13
 
@@ -215,8 +216,10 @@ export async function discoverAnthropicModels({ baseURL, apiKey, signal, fetchIm
215
216
 
216
217
  function configuredCredentialRef(ctx, provider) {
217
218
  if (typeof provider !== 'string' || provider.length === 0) return undefined
218
- const section = ctx.get('settings')?.describe().find(entry => entry.ns === PI_AI_SETTINGS_NS)?.value
219
- const profile = section?.providers?.[provider]
219
+ const route = ctx.llm.listConfigurableProviders().find(entry => entry.provider === provider)
220
+ if (route === undefined) return undefined
221
+ const section = ctx.get('settings')?.describe().find(entry => entry.ns === route.settingsNs)?.value
222
+ const profile = route.settingsPath.reduce((value, key) => value?.[key], section)
220
223
  const ref = profile?.apiKeyEnv
221
224
  return typeof ref === 'string' && ref.length > 0 ? ref : undefined
222
225
  }
@@ -225,7 +228,11 @@ async function discoveryApiKey(ctx, request) {
225
228
  if (typeof request.apiKey === 'string' && request.apiKey.trim().length > 0) return request.apiKey
226
229
  const ref = configuredCredentialRef(ctx, request.provider)
227
230
  if (ref === undefined) throw new Error('Claude 模型目录:请先填写 API 密钥')
228
- const value = (await ctx.get('credentials')?.resolve(ref))?.value ?? process.env[ref]
231
+ const credentials = ctx.get('credentials')
232
+ const environment = ctx.get('launchEnvironment')
233
+ const value = credentials !== undefined
234
+ ? (await credentials.resolve(ref))?.value
235
+ : environment !== undefined ? environment.get(ref)?.value : process.env[ref]
229
236
  if (typeof value !== 'string' || value.trim().length === 0) {
230
237
  throw new Error(`Claude 模型目录:未找到已保存的凭据 ${ref}`)
231
238
  }