@jxgame2020/dsh-token-quota 0.1.20 → 0.1.22
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/client.js +79 -76
- package/lib/index.js +1 -1
- package/lib/types/client/index.d.ts +1 -1
- package/lib/types/client/index.js +7 -3
- package/package.json +1 -1
package/lib/client.js
CHANGED
|
@@ -79,7 +79,7 @@ window.__ModuleLoader__.load({
|
|
|
79
79
|
d.dimWhenIdle = dimWhenIdle;
|
|
80
80
|
},
|
|
81
81
|
setUpgrade: (d, upgrade) => {
|
|
82
|
-
const normalized = upgrade !== null && upgrade.latestVersion !== "" && upgrade.latestVersion !== "0.1.
|
|
82
|
+
const normalized = upgrade !== null && upgrade.latestVersion !== "" && upgrade.latestVersion !== "0.1.22" ? upgrade : null;
|
|
83
83
|
if (d.upgrade === null || d.upgrade.latestVersion !== normalized?.latestVersion) d.upgradeDismissed = false;
|
|
84
84
|
d.upgrade = normalized;
|
|
85
85
|
},
|
|
@@ -185,91 +185,91 @@ window.__ModuleLoader__.load({
|
|
|
185
185
|
document.head.appendChild(tag);
|
|
186
186
|
}
|
|
187
187
|
var TokenQuotaPanel_module_css_default = {
|
|
188
|
-
"
|
|
189
|
-
"
|
|
190
|
-
"
|
|
191
|
-
"
|
|
192
|
-
"
|
|
193
|
-
"logPagerInfo": "NPLLIq_logPagerInfo",
|
|
194
|
-
"fillWarn": "NPLLIq_fillWarn",
|
|
195
|
-
"headerText": "NPLLIq_headerText",
|
|
196
|
-
"dialogLabel": "NPLLIq_dialogLabel",
|
|
197
|
-
"dialogBtn": "NPLLIq_dialogBtn",
|
|
198
|
-
"monitorHint": "NPLLIq_monitorHint",
|
|
199
|
-
"logPagerPages": "NPLLIq_logPagerPages",
|
|
200
|
-
"subtitle": "NPLLIq_subtitle",
|
|
201
|
-
"upgradeCommands": "NPLLIq_upgradeCommands",
|
|
202
|
-
"dialogActions": "NPLLIq_dialogActions",
|
|
188
|
+
"logUsedCol": "NPLLIq_logUsedCol",
|
|
189
|
+
"controls": "NPLLIq_controls",
|
|
190
|
+
"save": "NPLLIq_save",
|
|
191
|
+
"upgradeCommand": "NPLLIq_upgradeCommand",
|
|
192
|
+
"versionNew": "NPLLIq_versionNew",
|
|
203
193
|
"title": "NPLLIq_title",
|
|
204
|
-
"
|
|
205
|
-
"monitorRow": "NPLLIq_monitorRow",
|
|
206
|
-
"panelDimStrong": "NPLLIq_panelDimStrong",
|
|
194
|
+
"rowName": "NPLLIq_rowName",
|
|
207
195
|
"currentBadge": "NPLLIq_currentBadge",
|
|
208
|
-
"
|
|
209
|
-
"
|
|
210
|
-
"
|
|
211
|
-
"dialogOverlay": "NPLLIq_dialogOverlay",
|
|
212
|
-
"tabLabel": "NPLLIq_tabLabel",
|
|
213
|
-
"upgradeClose": "NPLLIq_upgradeClose",
|
|
214
|
-
"dialogClose": "NPLLIq_dialogClose",
|
|
215
|
-
"logScroll": "NPLLIq_logScroll",
|
|
216
|
-
"fullNotice": "NPLLIq_fullNotice",
|
|
196
|
+
"resetSelect": "NPLLIq_resetSelect",
|
|
197
|
+
"checkBtn": "NPLLIq_checkBtn",
|
|
198
|
+
"panel": "NPLLIq_panel",
|
|
217
199
|
"settingsBtn": "NPLLIq_settingsBtn",
|
|
218
|
-
"upgradeBanner": "NPLLIq_upgradeBanner",
|
|
219
|
-
"upgradeBannerFlash": "NPLLIq_upgradeBannerFlash",
|
|
220
200
|
"logPager": "NPLLIq_logPager",
|
|
201
|
+
"upgradeClose": "NPLLIq_upgradeClose",
|
|
202
|
+
"logSearch": "NPLLIq_logSearch",
|
|
203
|
+
"fullNotice": "NPLLIq_fullNotice",
|
|
204
|
+
"dialogClose": "NPLLIq_dialogClose",
|
|
205
|
+
"fillIdle": "NPLLIq_fillIdle",
|
|
206
|
+
"logPagerPages": "NPLLIq_logPagerPages",
|
|
207
|
+
"logClearBtn": "NPLLIq_logClearBtn",
|
|
208
|
+
"header": "NPLLIq_header",
|
|
209
|
+
"dialogOverlay": "NPLLIq_dialogOverlay",
|
|
210
|
+
"dialogHeader": "NPLLIq_dialogHeader",
|
|
211
|
+
"upgradeCommands": "NPLLIq_upgradeCommands",
|
|
212
|
+
"dialog": "NPLLIq_dialog",
|
|
213
|
+
"logHeader": "NPLLIq_logHeader",
|
|
221
214
|
"logPageSizeSelect": "NPLLIq_logPageSizeSelect",
|
|
222
|
-
"
|
|
215
|
+
"dialogActions": "NPLLIq_dialogActions",
|
|
216
|
+
"subtitle": "NPLLIq_subtitle",
|
|
217
|
+
"rowHeader": "NPLLIq_rowHeader",
|
|
218
|
+
"copyBtn": "NPLLIq_copyBtn",
|
|
219
|
+
"headerActions": "NPLLIq_headerActions",
|
|
220
|
+
"selectBtn": "NPLLIq_selectBtn",
|
|
221
|
+
"upgradeHint": "NPLLIq_upgradeHint",
|
|
222
|
+
"resetRow": "NPLLIq_resetRow",
|
|
223
223
|
"logClearDate": "NPLLIq_logClearDate",
|
|
224
|
-
"
|
|
225
|
-
"bar": "NPLLIq_bar",
|
|
226
|
-
"controls": "NPLLIq_controls",
|
|
224
|
+
"input": "NPLLIq_input",
|
|
227
225
|
"copyBtnDone": "NPLLIq_copyBtnDone",
|
|
226
|
+
"bar": "NPLLIq_bar",
|
|
227
|
+
"version": "NPLLIq_version",
|
|
228
|
+
"tabIcon": "NPLLIq_tabIcon",
|
|
229
|
+
"dialogTitle": "NPLLIq_dialogTitle",
|
|
230
|
+
"logDialog": "NPLLIq_logDialog",
|
|
231
|
+
"checkErrorHint": "NPLLIq_checkErrorHint",
|
|
228
232
|
"body": "NPLLIq_body",
|
|
229
|
-
"
|
|
230
|
-
"
|
|
231
|
-
"
|
|
232
|
-
"logClearBtn": "NPLLIq_logClearBtn",
|
|
233
|
+
"rowMeta": "NPLLIq_rowMeta",
|
|
234
|
+
"collapse": "NPLLIq_collapse",
|
|
235
|
+
"dialogSection": "NPLLIq_dialogSection",
|
|
233
236
|
"dialogBody": "NPLLIq_dialogBody",
|
|
234
|
-
"
|
|
235
|
-
"
|
|
236
|
-
"panelDim": "NPLLIq_panelDim",
|
|
237
|
-
"logDialog": "NPLLIq_logDialog",
|
|
238
|
-
"tab": "NPLLIq_tab",
|
|
239
|
-
"upgradeHint": "NPLLIq_upgradeHint",
|
|
240
|
-
"header": "NPLLIq_header",
|
|
241
|
-
"switch": "NPLLIq_switch",
|
|
242
|
-
"noticeError": "NPLLIq_noticeError",
|
|
243
|
-
"upgradeCommand": "NPLLIq_upgradeCommand",
|
|
237
|
+
"logScroll": "NPLLIq_logScroll",
|
|
238
|
+
"upgradeBanner": "NPLLIq_upgradeBanner",
|
|
244
239
|
"row": "NPLLIq_row",
|
|
245
|
-
"
|
|
240
|
+
"panelDimStrong": "NPLLIq_panelDimStrong",
|
|
241
|
+
"monitorRow": "NPLLIq_monitorRow",
|
|
242
|
+
"tabLabel": "NPLLIq_tabLabel",
|
|
243
|
+
"upgradeBannerText": "NPLLIq_upgradeBannerText",
|
|
244
|
+
"checkUpdatesRow": "NPLLIq_checkUpdatesRow",
|
|
245
|
+
"dialogLabel": "NPLLIq_dialogLabel",
|
|
246
|
+
"gearBtn": "NPLLIq_gearBtn",
|
|
247
|
+
"dialogBtnPrimary": "NPLLIq_dialogBtnPrimary",
|
|
248
|
+
"notice": "NPLLIq_notice",
|
|
249
|
+
"fillWarn": "NPLLIq_fillWarn",
|
|
250
|
+
"fillOver": "NPLLIq_fillOver",
|
|
246
251
|
"checkUpdatesLabel": "NPLLIq_checkUpdatesLabel",
|
|
247
|
-
"
|
|
248
|
-
"
|
|
252
|
+
"radioRow": "NPLLIq_radioRow",
|
|
253
|
+
"panelDim": "NPLLIq_panelDim",
|
|
254
|
+
"logDayCol": "NPLLIq_logDayCol",
|
|
249
255
|
"logModelCol": "NPLLIq_logModelCol",
|
|
250
|
-
"
|
|
251
|
-
"logSearch": "NPLLIq_logSearch",
|
|
256
|
+
"monitorHint": "NPLLIq_monitorHint",
|
|
252
257
|
"logPagerControls": "NPLLIq_logPagerControls",
|
|
253
|
-
"
|
|
258
|
+
"upgradeBannerFlash": "NPLLIq_upgradeBannerFlash",
|
|
259
|
+
"switch": "NPLLIq_switch",
|
|
260
|
+
"headerText": "NPLLIq_headerText",
|
|
261
|
+
"upgradeCommandRow": "NPLLIq_upgradeCommandRow",
|
|
262
|
+
"dialogHint": "NPLLIq_dialogHint",
|
|
263
|
+
"dialogBtn": "NPLLIq_dialogBtn",
|
|
264
|
+
"logTable": "NPLLIq_logTable",
|
|
254
265
|
"monitorList": "NPLLIq_monitorList",
|
|
255
|
-
"
|
|
256
|
-
"
|
|
257
|
-
"
|
|
258
|
-
"
|
|
259
|
-
"
|
|
260
|
-
"checkBtn": "NPLLIq_checkBtn",
|
|
261
|
-
"save": "NPLLIq_save",
|
|
262
|
-
"selectBtn": "NPLLIq_selectBtn",
|
|
263
|
-
"logDayCol": "NPLLIq_logDayCol",
|
|
264
|
-
"resetSelect": "NPLLIq_resetSelect",
|
|
265
|
-
"copyBtn": "NPLLIq_copyBtn",
|
|
266
|
+
"noticeError": "NPLLIq_noticeError",
|
|
267
|
+
"tab": "NPLLIq_tab",
|
|
268
|
+
"monitorName": "NPLLIq_monitorName",
|
|
269
|
+
"logPagerInfo": "NPLLIq_logPagerInfo",
|
|
270
|
+
"logPagerBtn": "NPLLIq_logPagerBtn",
|
|
266
271
|
"logClearDialog": "NPLLIq_logClearDialog",
|
|
267
|
-
"
|
|
268
|
-
"versionNew": "NPLLIq_versionNew",
|
|
269
|
-
"tabIcon": "NPLLIq_tabIcon",
|
|
270
|
-
"logTable": "NPLLIq_logTable",
|
|
271
|
-
"logHeader": "NPLLIq_logHeader",
|
|
272
|
-
"headerActions": "NPLLIq_headerActions"
|
|
272
|
+
"logToolbar": "NPLLIq_logToolbar"
|
|
273
273
|
};
|
|
274
274
|
//#endregion
|
|
275
275
|
//#region lib/types/client/TokenQuotaPanel.js
|
|
@@ -571,13 +571,13 @@ window.__ModuleLoader__.load({
|
|
|
571
571
|
title: t("upgradeAvailableHint"),
|
|
572
572
|
children: [
|
|
573
573
|
"v",
|
|
574
|
-
"0.1.
|
|
574
|
+
"0.1.22",
|
|
575
575
|
" → v",
|
|
576
576
|
upgrade.latestVersion
|
|
577
577
|
]
|
|
578
578
|
}) : (0, react_jsx_runtime.jsxs)("span", {
|
|
579
579
|
className: TokenQuotaPanel_module_css_default.version,
|
|
580
|
-
children: ["v", "0.1.
|
|
580
|
+
children: ["v", "0.1.22"]
|
|
581
581
|
})]
|
|
582
582
|
}), (0, react_jsx_runtime.jsx)("div", {
|
|
583
583
|
className: TokenQuotaPanel_module_css_default.subtitle,
|
|
@@ -1278,12 +1278,14 @@ window.__ModuleLoader__.load({
|
|
|
1278
1278
|
const TOKEN_QUOTA_NAMESPACE = "token-quota";
|
|
1279
1279
|
/** Snapshot pull cadence in milliseconds. */
|
|
1280
1280
|
const POLL_INTERVAL_MS = 3e3;
|
|
1281
|
-
/** Required services: slot registry, sessions, locale, settings scope. */
|
|
1281
|
+
/** Required services: slot registry, sessions, locale, settings scope, and the Host remote faces. */
|
|
1282
1282
|
const inject = [
|
|
1283
1283
|
"slots",
|
|
1284
1284
|
"sessions",
|
|
1285
1285
|
"locale",
|
|
1286
|
-
"settingsScope"
|
|
1286
|
+
"settingsScope",
|
|
1287
|
+
"remote",
|
|
1288
|
+
"remote.session"
|
|
1287
1289
|
];
|
|
1288
1290
|
/**
|
|
1289
1291
|
* Client plugin body: poll the Host snapshot route, run the full-quota
|
|
@@ -1384,7 +1386,8 @@ window.__ModuleLoader__.load({
|
|
|
1384
1386
|
const currentOf = (sessionId) => {
|
|
1385
1387
|
const binding = sessions.binding(sessionId);
|
|
1386
1388
|
if (binding === void 0) return null;
|
|
1387
|
-
|
|
1389
|
+
const state = binding.session.projections.faceOf("modelSelection").getSnapshot();
|
|
1390
|
+
return state?.next ?? state?.lastUsed ?? null;
|
|
1388
1391
|
};
|
|
1389
1392
|
const refreshCurrent = () => {
|
|
1390
1393
|
if (lastSessionId === void 0) return;
|
package/lib/index.js
CHANGED
|
@@ -453,7 +453,7 @@ var TokenQuotaService = class TokenQuotaService extends Service {
|
|
|
453
453
|
return this.upgradeCheck;
|
|
454
454
|
}
|
|
455
455
|
async doRefreshUpgrade() {
|
|
456
|
-
const current = "0.1.
|
|
456
|
+
const current = "0.1.22";
|
|
457
457
|
let latest;
|
|
458
458
|
try {
|
|
459
459
|
const response = await fetch(REGISTRY_LATEST_URL, {
|
|
@@ -24,7 +24,7 @@ declare module '@deepseek-ai/dsh-client-ui-slots' {
|
|
|
24
24
|
'token-quota': TokenQuotaKey;
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
|
-
/** Required services: slot registry, sessions, locale, settings scope. */
|
|
27
|
+
/** Required services: slot registry, sessions, locale, settings scope, and the Host remote faces. */
|
|
28
28
|
export declare const inject: string[];
|
|
29
29
|
/**
|
|
30
30
|
* Client plugin body: poll the Host snapshot route, run the full-quota
|
|
@@ -8,8 +8,8 @@ const NS = 'token-quota';
|
|
|
8
8
|
const TOKEN_QUOTA_NAMESPACE = 'token-quota';
|
|
9
9
|
/** Snapshot pull cadence in milliseconds. */
|
|
10
10
|
const POLL_INTERVAL_MS = 3000;
|
|
11
|
-
/** Required services: slot registry, sessions, locale, settings scope. */
|
|
12
|
-
export const inject = ['slots', 'sessions', 'locale', 'settingsScope'];
|
|
11
|
+
/** Required services: slot registry, sessions, locale, settings scope, and the Host remote faces. */
|
|
12
|
+
export const inject = ['slots', 'sessions', 'locale', 'settingsScope', 'remote', 'remote.session'];
|
|
13
13
|
/**
|
|
14
14
|
* Client plugin body: poll the Host snapshot route, run the full-quota
|
|
15
15
|
* strategy, wire the injected face (directory load, limit write, model
|
|
@@ -140,7 +140,11 @@ export function apply(ctx) {
|
|
|
140
140
|
return null;
|
|
141
141
|
const face = binding.session.projections.faceOf('modelSelection');
|
|
142
142
|
const state = face.getSnapshot();
|
|
143
|
-
|
|
143
|
+
// `next` (pending) is a selection made but not yet consumed by a request;
|
|
144
|
+
// `lastUsed` is the previous request's actual model. Show the pending
|
|
145
|
+
// selection first so the panel doesn't snap back before the next request
|
|
146
|
+
// retires it — matches ui-model-selection (`projected.next ?? default`).
|
|
147
|
+
return state?.next ?? state?.lastUsed ?? null;
|
|
144
148
|
};
|
|
145
149
|
const refreshCurrent = () => {
|
|
146
150
|
if (lastSessionId === undefined)
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jxgame2020/dsh-token-quota",
|
|
3
3
|
"description": "Daily per-model token quota accounting, enforcement, and a floating quota panel for the DeepSeek Harness — a fully self-contained plugin (no core-Harness wiring, no generated RPC contract)",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.22",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|