@goodandready/dsh-model-sync 0.3.2 → 0.3.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.
@@ -33,7 +33,7 @@ const PROVIDER_ADAPTERS = Object.freeze({
33
33
  'xiaomi-token-plan-sgp': { endpoint: 'https://token-plan-sgp.xiaomimimo.com/v1/models', auth: 'bearer' },
34
34
  zai: { endpoint: 'https://api.z.ai/api/coding/paas/v4/models', auth: 'bearer' },
35
35
  'zai-coding-cn': { endpoint: 'https://open.bigmodel.cn/api/coding/paas/v4/models', auth: 'bearer' },
36
- 'kimi-coding': { endpoint: 'https://api.kimi.com/coding/v1/models', auth: 'bearer' },
36
+ 'kimi-coding': { endpoint: 'https://api.kimi.com/coding/v1/models', auth: 'bearer', defaultModels: ['kimi-k2.6', 'kimi-k2.5', 'kimi-k2.7-code', 'kimi-k3'] },
37
37
  minimax: { endpoint: 'https://api.minimax.io/v1/models', auth: 'bearer' },
38
38
  })
39
39
 
@@ -141,20 +141,32 @@ async function requestSpecific(profile, descriptor, { resolveCredential, fetchIm
141
141
  }
142
142
 
143
143
  async function fetchSpecific(profile, descriptor, options) {
144
- const response = await requestSpecific(profile, descriptor, options)
145
- const text = await response.text()
146
- if (Buffer.byteLength(text, 'utf8') > MAX_RESPONSE_BYTES) {
147
- const error = new Error('model catalog response is too large')
148
- error.adapterCode = 'schema'
149
- throw error
150
- }
151
144
  let payload
152
- try { payload = JSON.parse(text) } catch {
153
- const error = new Error('model catalog response is not valid JSON')
154
- error.adapterCode = 'schema'
145
+ try {
146
+ const response = await requestSpecific(profile, descriptor, options)
147
+ const text = await response.text()
148
+ if (Buffer.byteLength(text, 'utf8') > MAX_RESPONSE_BYTES) {
149
+ const error = new Error('model catalog response is too large')
150
+ error.adapterCode = 'schema'
151
+ throw error
152
+ }
153
+ try { payload = JSON.parse(text) } catch {
154
+ const error = new Error('model catalog response is not valid JSON')
155
+ error.adapterCode = 'schema'
156
+ throw error
157
+ }
158
+ const rows = parseRows(profile.provider, payload, descriptor)
159
+ if (Array.isArray(rows) && rows.length > 0) return rows
160
+ } catch (error) {
161
+ if (descriptor.defaultModels && Array.isArray(descriptor.defaultModels) && descriptor.defaultModels.length > 0) {
162
+ return normalizeModels(profile.provider, descriptor.defaultModels.map((id) => ({ id })))
163
+ }
155
164
  throw error
156
165
  }
157
- return parseRows(profile.provider, payload, descriptor)
166
+ if (descriptor.defaultModels && Array.isArray(descriptor.defaultModels) && descriptor.defaultModels.length > 0) {
167
+ return normalizeModels(profile.provider, descriptor.defaultModels.map((id) => ({ id })))
168
+ }
169
+ return []
158
170
  }
159
171
 
160
172
  async function probeSpecific(profile, descriptor, options) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@goodandready/dsh-model-sync",
3
- "version": "0.3.2",
3
+ "version": "0.3.3",
4
4
  "description": "Automatic model catalog synchronization for API-key DeepSeek Harness providers.",
5
5
  "keywords": [
6
6
  "deepseek-harness",