@linxin666/dsh-usage 0.3.13 → 0.3.15

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 (3) hide show
  1. package/lib/index.js +18 -8
  2. package/package.json +14 -14
  3. package/src/index.ts +15 -4
package/lib/index.js CHANGED
@@ -45,7 +45,7 @@ function mountOnce(packageName, fn) {
45
45
  });
46
46
  }
47
47
  //#endregion
48
- //#region ../../node_modules/.pnpm/@deepseek-ai+dsh-brand@0.1.2-alpha.4_@deepseek-ai+cordis@4.0.2/node_modules/@deepseek-ai/dsh-brand/lib/index.js
48
+ //#region ../../node_modules/.pnpm/@deepseek-ai+dsh-brand@0.1.2-rc.1_@deepseek-ai+cordis@4.0.2/node_modules/@deepseek-ai/dsh-brand/lib/index.js
49
49
  /**
50
50
  * Duplicate-install-safe nominal primitive helpers.
51
51
  *
@@ -68,7 +68,7 @@ function brandString(value) {
68
68
  return value;
69
69
  }
70
70
  //#endregion
71
- //#region ../../node_modules/.pnpm/@deepseek-ai+dsh-credentials@0.1.2-alpha.4_@deepseek-ai+cordis@4.0.2_@deepseek-ai+dsh-i_ad5a26965a03bf1fe09a43c4b0035529/node_modules/@deepseek-ai/dsh-credentials/lib/index.js
71
+ //#region ../../node_modules/.pnpm/@deepseek-ai+dsh-credentials@0.1.2-rc.1_@deepseek-ai+cordis@4.0.2_@deepseek-ai+dsh-inva_7154e6091d592d1e221d261808e96e55/node_modules/@deepseek-ai/dsh-credentials/lib/index.js
72
72
  /**
73
73
  * Service Definition for the credential-reference capability seam (`ctx.credentials`). Settings and composition files carry
74
74
  * *references* to secrets — environment-variable names — while providers own
@@ -1668,13 +1668,23 @@ const apply = mountOnce("@linxin666/dsh-usage", (ctx, config) => {
1668
1668
  } else service.applyOptions(value);
1669
1669
  };
1670
1670
  ctx.inject(["settings"], (settingsCtx) => {
1671
- settingsCtx.settings.installSection(ctx, USAGE_SETTINGS_NAMESPACE, Config, config ?? {}, {
1672
- setSource: (next) => {
1673
- source = next;
1671
+ try {
1672
+ if (typeof settingsCtx.settings?.installSection === "function") settingsCtx.settings.installSection(ctx, USAGE_SETTINGS_NAMESPACE, Config, config ?? {}, {
1673
+ setSource: (next) => {
1674
+ source = next;
1675
+ rearm();
1676
+ },
1677
+ onChange: rearm
1678
+ });
1679
+ else if (typeof settingsCtx.settings?.register === "function") {
1680
+ const scope = settingsCtx.settings.register(USAGE_SETTINGS_NAMESPACE, Config, { base: config ?? {} });
1681
+ source = () => scope?.get?.() ?? config ?? {};
1682
+ scope?.watch?.(() => {
1683
+ rearm();
1684
+ });
1674
1685
  rearm();
1675
- },
1676
- onChange: rearm
1677
- });
1686
+ }
1687
+ } catch {}
1678
1688
  });
1679
1689
  ctx.effect(() => {
1680
1690
  rearm();
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@linxin666/dsh-usage",
3
3
  "description": "Usage statistics plugin for the dsh web GUI: per-provider balance and coding-plan quota detection plus a live token usage ledger, with a dedicated pet bubble for the current provider",
4
- "version": "0.3.13",
4
+ "version": "0.3.15",
5
5
  "type": "module",
6
6
  "engines": {
7
7
  "node": "^22.19.0 || >=24.0.0"
@@ -31,7 +31,7 @@
31
31
  "license": "Apache-2.0",
32
32
  "dsh": {
33
33
  "engines": {
34
- "dsh": ">=0.1.2-alpha.4"
34
+ "dsh": ">=0.1.2-rc.1"
35
35
  },
36
36
  "bundle": {
37
37
  "patch": "./cordis.patch.yml"
@@ -55,18 +55,18 @@
55
55
  },
56
56
  "devDependencies": {
57
57
  "@deepseek-ai/cordis": "^4.0.2",
58
- "@deepseek-ai/dsh-credentials": "^0.1.2-alpha.4",
59
- "@deepseek-ai/dsh-client-connection": "^0.1.2-alpha.4",
60
- "@deepseek-ai/dsh-client-locale": "^0.1.2-alpha.4",
61
- "@deepseek-ai/dsh-client-store": "^0.1.2-alpha.4",
62
- "@deepseek-ai/dsh-client-ui-renderer": "^0.1.2-alpha.4",
63
- "@deepseek-ai/dsh-client-ui-settings": "^0.1.2-alpha.4",
64
- "@deepseek-ai/dsh-client-ui-slots": "^0.1.2-alpha.4",
65
- "@deepseek-ai/dsh-host-webserver": "^0.1.2-alpha.4",
66
- "@deepseek-ai/dsh-llm": "^0.1.2-alpha.4",
67
- "@deepseek-ai/dsh-session": "^0.1.2-alpha.4",
68
- "@deepseek-ai/dsh-settings": "^0.1.2-alpha.4",
69
- "@linxin666/dsh-pet": "0.3.13",
58
+ "@deepseek-ai/dsh-credentials": "^0.1.2-rc.1",
59
+ "@deepseek-ai/dsh-client-connection": "^0.1.2-rc.1",
60
+ "@deepseek-ai/dsh-client-locale": "^0.1.2-rc.1",
61
+ "@deepseek-ai/dsh-client-store": "^0.1.2-rc.1",
62
+ "@deepseek-ai/dsh-client-ui-renderer": "^0.1.2-rc.1",
63
+ "@deepseek-ai/dsh-client-ui-settings": "^0.1.2-rc.1",
64
+ "@deepseek-ai/dsh-client-ui-slots": "^0.1.2-rc.1",
65
+ "@deepseek-ai/dsh-host-webserver": "^0.1.2-rc.1",
66
+ "@deepseek-ai/dsh-llm": "^0.1.2-rc.1",
67
+ "@deepseek-ai/dsh-session": "^0.1.2-rc.1",
68
+ "@deepseek-ai/dsh-settings": "^0.1.2-rc.1",
69
+ "@linxin666/dsh-pet": "0.3.15",
70
70
  "@testing-library/dom": "^10.4.1",
71
71
  "@testing-library/react": "^16.3.2",
72
72
  "@types/node": "^22.20.0",
package/src/index.ts CHANGED
@@ -86,10 +86,21 @@ export const apply = mountOnce('@linxin666/dsh-usage', (ctx: Context, config?: C
86
86
  }
87
87
 
88
88
  ctx.inject(['settings'], (settingsCtx) => {
89
- settingsCtx.settings.installSection(ctx, USAGE_SETTINGS_NAMESPACE, Config, config ?? {}, {
90
- setSource: (next) => { source = next; rearm() },
91
- onChange: rearm,
92
- })
89
+ try {
90
+ if (typeof settingsCtx.settings?.installSection === 'function') {
91
+ settingsCtx.settings.installSection(ctx, USAGE_SETTINGS_NAMESPACE, Config, config ?? {}, {
92
+ setSource: (next) => { source = next; rearm() },
93
+ onChange: rearm,
94
+ })
95
+ } else if (typeof settingsCtx.settings?.register === 'function') {
96
+ const scope = settingsCtx.settings.register(USAGE_SETTINGS_NAMESPACE, Config, { base: config ?? {} })
97
+ source = () => scope?.get?.() ?? (config ?? {})
98
+ scope?.watch?.(() => { rearm() })
99
+ rearm()
100
+ }
101
+ } catch {
102
+ // Defensive fallback against settings registration differences
103
+ }
93
104
  })
94
105
 
95
106
  ctx.effect(() => {