@goodandready/dsh-model-sync 0.2.2 → 0.2.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.
Files changed (2) hide show
  1. package/lib/index.js +13 -4
  2. package/package.json +1 -1
package/lib/index.js CHANGED
@@ -23,8 +23,14 @@ export const Config = Schema.object({
23
23
  export function apply(ctx, config) {
24
24
  let liveConfig = Config(structuredClone(config || {}))
25
25
  let reconfigure = () => {}
26
- let saveConfig = async () => {
27
- throw Object.assign(new Error('dsh-model-sync settings are not writable'), { code: 'CONFIG_UNAVAILABLE' })
26
+ let saveConfigImpl
27
+ // ctx.inject starts a child fiber; keep a stable function reference for the
28
+ // synchronizer while that fiber connects to the Settings service.
29
+ const saveConfig = async (patch) => {
30
+ if (!saveConfigImpl) {
31
+ throw Object.assign(new Error('dsh-model-sync settings are not writable'), { code: 'CONFIG_UNAVAILABLE' })
32
+ }
33
+ return saveConfigImpl(patch)
28
34
  }
29
35
 
30
36
  // The settings capability is injected as sctx.settings; ctx.get('settings')
@@ -36,14 +42,17 @@ export function apply(ctx, config) {
36
42
  liveConfig = Config(next || config)
37
43
  reconfigure()
38
44
  })
39
- saveConfig = async (patch) => {
45
+ saveConfigImpl = async (patch) => {
40
46
  const result = await scope.update(patch)
41
47
  // Settings watchers are serialized asynchronously; refresh the snapshot
42
48
  // synchronously as well so a following request sees the new allowlist.
43
49
  liveConfig = Config(scope.get() || config)
44
50
  return result
45
51
  }
46
- sctx.effect(() => () => stop(), 'dsh-model-sync: settings')
52
+ sctx.effect(() => () => {
53
+ saveConfigImpl = undefined
54
+ stop()
55
+ }, 'dsh-model-sync: settings')
47
56
  })
48
57
 
49
58
  const service = createProviderService(ctx)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@goodandready/dsh-model-sync",
3
- "version": "0.2.2",
3
+ "version": "0.2.3",
4
4
  "description": "Automatic model catalog synchronization for API-key DeepSeek Harness providers.",
5
5
  "keywords": [
6
6
  "deepseek-harness",