@goodandready/dsh-model-sync 0.3.12 → 0.3.13

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.
@@ -132,6 +132,7 @@ export function createModelSynchronizer(ctx, { getConfig = () => ({}), saveConfi
132
132
  const credentialOutcomes = new Map()
133
133
  let lastReport = null
134
134
  let transientNotifications = []
135
+ const providerHttpMeta = new Map()
135
136
 
136
137
  function recordCredentialOutcome(provider, outcome) {
137
138
  credentialOutcomes.set(provider, { ...outcome, at: Date.now() })
@@ -240,11 +241,12 @@ export function createModelSynchronizer(ctx, { getConfig = () => ({}), saveConfi
240
241
  }
241
242
  }
242
243
  let retries = 0
244
+ const existingMeta = providerHttpMeta.get(row.provider)
243
245
  try {
244
- const models = await retryWithBackoff(async () => {
246
+ const result = await retryWithBackoff(async () => {
245
247
  const timed = createTimeoutSignal(signal, reliability.timeoutMs)
246
248
  try {
247
- return await adapter.discover(profile, { signal: timed.signal })
249
+ return await adapter.discover(profile, { signal: timed.signal, etag: existingMeta?.etag, lastModified: existingMeta?.lastModified })
248
250
  } finally {
249
251
  timed.cleanup()
250
252
  }
@@ -257,6 +259,15 @@ export function createModelSynchronizer(ctx, { getConfig = () => ({}), saveConfi
257
259
  })
258
260
  circuits.delete(row.provider)
259
261
  recordCredentialOutcome(row.provider, { status: 'ok', retries })
262
+ if (result && result.notModified) {
263
+ const config = getConfig() ?? {}
264
+ const cached = normalizeModels(row.provider, config.modelCatalogs?.[row.provider] ?? row.models ?? [])
265
+ return { provider: row.provider, status: 'ok', models: cached, retries, notModified: true }
266
+ }
267
+ const models = Array.isArray(result) ? result : []
268
+ if (result?.__httpMeta) {
269
+ providerHttpMeta.set(row.provider, result.__httpMeta)
270
+ }
260
271
  return { provider: row.provider, status: 'ok', models, retries }
261
272
  } catch (error) {
262
273
  if (!signal?.aborted) recordFailure(row.provider, reliability, error)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@goodandready/dsh-model-sync",
3
- "version": "0.3.12",
3
+ "version": "0.3.13",
4
4
  "description": "Automatic model catalog synchronization for API-key DeepSeek Harness providers.",
5
5
  "keywords": [
6
6
  "deepseek-harness",