@linxin666/dsh-usage 0.3.14 → 0.3.16
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/lib/index.js +16 -6
- package/package.json +2 -2
- package/src/index.ts +15 -4
package/lib/index.js
CHANGED
|
@@ -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
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
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
|
-
|
|
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.
|
|
4
|
+
"version": "0.3.16",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
7
7
|
"node": "^22.19.0 || >=24.0.0"
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
"@deepseek-ai/dsh-llm": "^0.1.2-rc.1",
|
|
67
67
|
"@deepseek-ai/dsh-session": "^0.1.2-rc.1",
|
|
68
68
|
"@deepseek-ai/dsh-settings": "^0.1.2-rc.1",
|
|
69
|
-
"@linxin666/dsh-pet": "0.3.
|
|
69
|
+
"@linxin666/dsh-pet": "0.3.16",
|
|
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
|
-
|
|
90
|
-
|
|
91
|
-
|
|
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(() => {
|