@jxgame2020/dsh-token-quota 0.1.54 → 0.1.55
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 +132 -132
- package/lib/index.js +56 -31
- package/lib/types/index.d.ts +2 -0
- package/lib/types/index.js +64 -34
- package/package.json +1 -1
package/lib/client.js
CHANGED
|
@@ -132,7 +132,7 @@ window.__ModuleLoader__.load({
|
|
|
132
132
|
d.transcribe = settings;
|
|
133
133
|
},
|
|
134
134
|
setUpgrade: (d, upgrade) => {
|
|
135
|
-
const normalized = upgrade !== null && upgrade.latestVersion !== "" && upgrade.latestVersion !== "0.1.
|
|
135
|
+
const normalized = upgrade !== null && upgrade.latestVersion !== "" && upgrade.latestVersion !== "0.1.55" ? upgrade : null;
|
|
136
136
|
if (d.upgrade === null || d.upgrade.latestVersion !== normalized?.latestVersion) d.upgradeDismissed = false;
|
|
137
137
|
d.upgrade = normalized;
|
|
138
138
|
},
|
|
@@ -262,147 +262,147 @@ window.__ModuleLoader__.load({
|
|
|
262
262
|
document.head.appendChild(tag);
|
|
263
263
|
}
|
|
264
264
|
var TokenQuotaPanel_module_css_default = {
|
|
265
|
-
"
|
|
266
|
-
"
|
|
267
|
-
"
|
|
268
|
-
"
|
|
269
|
-
"balanceWinHeader": "NPLLIq_balanceWinHeader",
|
|
270
|
-
"balanceValueOk": "NPLLIq_balanceValueOk",
|
|
265
|
+
"noteWinTitleText": "NPLLIq_noteWinTitleText",
|
|
266
|
+
"upgradeCommands": "NPLLIq_upgradeCommands",
|
|
267
|
+
"monitorName": "NPLLIq_monitorName",
|
|
268
|
+
"keyError": "NPLLIq_keyError",
|
|
271
269
|
"balanceBarError": "NPLLIq_balanceBarError",
|
|
270
|
+
"settingsBtn": "NPLLIq_settingsBtn",
|
|
271
|
+
"fillOver": "NPLLIq_fillOver",
|
|
272
|
+
"dialogHint": "NPLLIq_dialogHint",
|
|
273
|
+
"panel": "NPLLIq_panel",
|
|
274
|
+
"noteWinTitle": "NPLLIq_noteWinTitle",
|
|
275
|
+
"dialogTabs": "NPLLIq_dialogTabs",
|
|
276
|
+
"logPager": "NPLLIq_logPager",
|
|
277
|
+
"dialogBtnPrimary": "NPLLIq_dialogBtnPrimary",
|
|
278
|
+
"checkErrorHint": "NPLLIq_checkErrorHint",
|
|
279
|
+
"title": "NPLLIq_title",
|
|
280
|
+
"header": "NPLLIq_header",
|
|
281
|
+
"balanceStateHint": "NPLLIq_balanceStateHint",
|
|
282
|
+
"balanceWinTitle": "NPLLIq_balanceWinTitle",
|
|
283
|
+
"dialogTab": "NPLLIq_dialogTab",
|
|
284
|
+
"logPagerPages": "NPLLIq_logPagerPages",
|
|
285
|
+
"logHeader": "NPLLIq_logHeader",
|
|
286
|
+
"balanceLastLine": "NPLLIq_balanceLastLine",
|
|
287
|
+
"dialogActions": "NPLLIq_dialogActions",
|
|
288
|
+
"monitorList": "NPLLIq_monitorList",
|
|
289
|
+
"balanceSortBtn": "NPLLIq_balanceSortBtn",
|
|
290
|
+
"noteWinBar": "NPLLIq_noteWinBar",
|
|
272
291
|
"dialogSection": "NPLLIq_dialogSection",
|
|
273
|
-
"
|
|
292
|
+
"balanceBarBadge": "NPLLIq_balanceBarBadge",
|
|
293
|
+
"bar": "NPLLIq_bar",
|
|
274
294
|
"logPagerBtn": "NPLLIq_logPagerBtn",
|
|
295
|
+
"logPageSizeSelect": "NPLLIq_logPageSizeSelect",
|
|
296
|
+
"dialogBody": "NPLLIq_dialogBody",
|
|
297
|
+
"noteMenuItem": "NPLLIq_noteMenuItem",
|
|
298
|
+
"copyBtn": "NPLLIq_copyBtn",
|
|
275
299
|
"headerText": "NPLLIq_headerText",
|
|
276
|
-
"
|
|
277
|
-
"
|
|
278
|
-
"
|
|
279
|
-
"
|
|
280
|
-
"
|
|
281
|
-
"title": "NPLLIq_title",
|
|
282
|
-
"dialogTitle": "NPLLIq_dialogTitle",
|
|
283
|
-
"tabLabel": "NPLLIq_tabLabel",
|
|
284
|
-
"logClearDialog": "NPLLIq_logClearDialog",
|
|
285
|
-
"dialogBtnPrimary": "NPLLIq_dialogBtnPrimary",
|
|
300
|
+
"upgradeBannerFlash": "NPLLIq_upgradeBannerFlash",
|
|
301
|
+
"logDayCol": "NPLLIq_logDayCol",
|
|
302
|
+
"balanceBarLow": "NPLLIq_balanceBarLow",
|
|
303
|
+
"keyBadgeOk": "NPLLIq_keyBadgeOk",
|
|
304
|
+
"balanceRowName": "NPLLIq_balanceRowName",
|
|
286
305
|
"logTable": "NPLLIq_logTable",
|
|
287
|
-
"
|
|
288
|
-
"
|
|
289
|
-
"
|
|
290
|
-
"
|
|
291
|
-
"
|
|
292
|
-
"
|
|
293
|
-
"
|
|
294
|
-
"
|
|
295
|
-
"
|
|
296
|
-
"noteWinTitleText": "NPLLIq_noteWinTitleText",
|
|
297
|
-
"checkUpdatesLabel": "NPLLIq_checkUpdatesLabel",
|
|
298
|
-
"version": "NPLLIq_version",
|
|
299
|
-
"noteMenu": "NPLLIq_noteMenu",
|
|
300
|
-
"copyBtn": "NPLLIq_copyBtn",
|
|
301
|
-
"checkBtn": "NPLLIq_checkBtn",
|
|
302
|
-
"monitorHint": "NPLLIq_monitorHint",
|
|
303
|
-
"checkErrorHint": "NPLLIq_checkErrorHint",
|
|
304
|
-
"save": "NPLLIq_save",
|
|
305
|
-
"logPageSizeSelect": "NPLLIq_logPageSizeSelect",
|
|
306
|
-
"balanceRefreshAll": "NPLLIq_balanceRefreshAll",
|
|
307
|
-
"noticeError": "NPLLIq_noticeError",
|
|
308
|
-
"rowDrag": "NPLLIq_rowDrag",
|
|
309
|
-
"monitorList": "NPLLIq_monitorList",
|
|
310
|
-
"keyRow": "NPLLIq_keyRow",
|
|
311
|
-
"notesBar": "NPLLIq_notesBar",
|
|
312
|
-
"fillIdle": "NPLLIq_fillIdle",
|
|
313
|
-
"balanceWinBody": "NPLLIq_balanceWinBody",
|
|
314
|
-
"checkUpdatesRow": "NPLLIq_checkUpdatesRow",
|
|
306
|
+
"noteNewPlus": "NPLLIq_noteNewPlus",
|
|
307
|
+
"balanceWin": "NPLLIq_balanceWin",
|
|
308
|
+
"rowHeader": "NPLLIq_rowHeader",
|
|
309
|
+
"balanceRow": "NPLLIq_balanceRow",
|
|
310
|
+
"dialogBtn": "NPLLIq_dialogBtn",
|
|
311
|
+
"fullNotice": "NPLLIq_fullNotice",
|
|
312
|
+
"noteChipOpen": "NPLLIq_noteChipOpen",
|
|
313
|
+
"settingsDialog": "NPLLIq_settingsDialog",
|
|
314
|
+
"rowDragging": "NPLLIq_rowDragging",
|
|
315
315
|
"balanceBarDim": "NPLLIq_balanceBarDim",
|
|
316
|
-
"
|
|
317
|
-
"balanceToggleOpen": "NPLLIq_balanceToggleOpen",
|
|
318
|
-
"balanceBarLow": "NPLLIq_balanceBarLow",
|
|
319
|
-
"selectBtn": "NPLLIq_selectBtn",
|
|
316
|
+
"resetRow": "NPLLIq_resetRow",
|
|
320
317
|
"tabIcon": "NPLLIq_tabIcon",
|
|
321
|
-
"
|
|
322
|
-
"
|
|
323
|
-
"upgradeCommands": "NPLLIq_upgradeCommands",
|
|
324
|
-
"resetSelect": "NPLLIq_resetSelect",
|
|
325
|
-
"notice": "NPLLIq_notice",
|
|
318
|
+
"balanceRefreshAll": "NPLLIq_balanceRefreshAll",
|
|
319
|
+
"panelDim": "NPLLIq_panelDim",
|
|
326
320
|
"logUsedCol": "NPLLIq_logUsedCol",
|
|
321
|
+
"balanceToggleOpen": "NPLLIq_balanceToggleOpen",
|
|
322
|
+
"logPagerInfo": "NPLLIq_logPagerInfo",
|
|
323
|
+
"dialogOverlay": "NPLLIq_dialogOverlay",
|
|
324
|
+
"logClearDialog": "NPLLIq_logClearDialog",
|
|
327
325
|
"keyBadgeOff": "NPLLIq_keyBadgeOff",
|
|
328
|
-
"logHeader": "NPLLIq_logHeader",
|
|
329
326
|
"monitorRow": "NPLLIq_monitorRow",
|
|
330
|
-
"
|
|
327
|
+
"subtitle": "NPLLIq_subtitle",
|
|
328
|
+
"noteWinGripBar": "NPLLIq_noteWinGripBar",
|
|
331
329
|
"row": "NPLLIq_row",
|
|
332
|
-
"
|
|
333
|
-
"gearBtn": "NPLLIq_gearBtn",
|
|
334
|
-
"versionNew": "NPLLIq_versionNew",
|
|
335
|
-
"switch": "NPLLIq_switch",
|
|
336
|
-
"balanceRowValue": "NPLLIq_balanceRowValue",
|
|
337
|
-
"keySaveBtn": "NPLLIq_keySaveBtn",
|
|
338
|
-
"keyError": "NPLLIq_keyError",
|
|
339
|
-
"headerActions": "NPLLIq_headerActions",
|
|
330
|
+
"fillIdle": "NPLLIq_fillIdle",
|
|
340
331
|
"noteWinCollapsed": "NPLLIq_noteWinCollapsed",
|
|
341
|
-
"
|
|
342
|
-
"
|
|
343
|
-
"
|
|
344
|
-
"
|
|
345
|
-
"
|
|
332
|
+
"noteWinText": "NPLLIq_noteWinText",
|
|
333
|
+
"switch": "NPLLIq_switch",
|
|
334
|
+
"controls": "NPLLIq_controls",
|
|
335
|
+
"checkBtn": "NPLLIq_checkBtn",
|
|
336
|
+
"logSearch": "NPLLIq_logSearch",
|
|
337
|
+
"rowDrag": "NPLLIq_rowDrag",
|
|
338
|
+
"monitorHint": "NPLLIq_monitorHint",
|
|
339
|
+
"version": "NPLLIq_version",
|
|
340
|
+
"fillWarn": "NPLLIq_fillWarn",
|
|
341
|
+
"body": "NPLLIq_body",
|
|
342
|
+
"balanceRowHeader": "NPLLIq_balanceRowHeader",
|
|
343
|
+
"dialogHeader": "NPLLIq_dialogHeader",
|
|
344
|
+
"logPagerControls": "NPLLIq_logPagerControls",
|
|
345
|
+
"dialogTabActive": "NPLLIq_dialogTabActive",
|
|
346
|
+
"balanceRowRefresh": "NPLLIq_balanceRowRefresh",
|
|
347
|
+
"noteWinResize": "NPLLIq_noteWinResize",
|
|
348
|
+
"currentBadge": "NPLLIq_currentBadge",
|
|
346
349
|
"noteWinBtn": "NPLLIq_noteWinBtn",
|
|
347
|
-
"
|
|
350
|
+
"selectBtn": "NPLLIq_selectBtn",
|
|
351
|
+
"panelDimStrong": "NPLLIq_panelDimStrong",
|
|
352
|
+
"logClearBtn": "NPLLIq_logClearBtn",
|
|
353
|
+
"noteMenuBackdrop": "NPLLIq_noteMenuBackdrop",
|
|
354
|
+
"balanceStateError": "NPLLIq_balanceStateError",
|
|
355
|
+
"input": "NPLLIq_input",
|
|
356
|
+
"balanceBarRefresh": "NPLLIq_balanceBarRefresh",
|
|
357
|
+
"upgradeClose": "NPLLIq_upgradeClose",
|
|
358
|
+
"notice": "NPLLIq_notice",
|
|
348
359
|
"rowMeta": "NPLLIq_rowMeta",
|
|
360
|
+
"checkUpdatesRow": "NPLLIq_checkUpdatesRow",
|
|
349
361
|
"logScroll": "NPLLIq_logScroll",
|
|
350
|
-
"noteMenuBackdrop": "NPLLIq_noteMenuBackdrop",
|
|
351
|
-
"bar": "NPLLIq_bar",
|
|
352
|
-
"balanceRowName": "NPLLIq_balanceRowName",
|
|
353
|
-
"copyBtnDone": "NPLLIq_copyBtnDone",
|
|
354
362
|
"logToolbar": "NPLLIq_logToolbar",
|
|
355
|
-
"
|
|
356
|
-
"
|
|
357
|
-
"
|
|
358
|
-
"
|
|
359
|
-
"rowDragging": "NPLLIq_rowDragging",
|
|
360
|
-
"dialogBtn": "NPLLIq_dialogBtn",
|
|
361
|
-
"logPagerPages": "NPLLIq_logPagerPages",
|
|
363
|
+
"notesBar": "NPLLIq_notesBar",
|
|
364
|
+
"noteMenu": "NPLLIq_noteMenu",
|
|
365
|
+
"balanceBar": "NPLLIq_balanceBar",
|
|
366
|
+
"rowDropTarget": "NPLLIq_rowDropTarget",
|
|
362
367
|
"logClearDate": "NPLLIq_logClearDate",
|
|
368
|
+
"upgradeCommandRow": "NPLLIq_upgradeCommandRow",
|
|
369
|
+
"balanceBarText": "NPLLIq_balanceBarText",
|
|
370
|
+
"dialogLabel": "NPLLIq_dialogLabel",
|
|
363
371
|
"logModelCol": "NPLLIq_logModelCol",
|
|
364
|
-
"
|
|
365
|
-
"
|
|
366
|
-
"
|
|
367
|
-
"
|
|
368
|
-
"
|
|
369
|
-
"
|
|
370
|
-
"logDayCol": "NPLLIq_logDayCol",
|
|
371
|
-
"keyBadgeOk": "NPLLIq_keyBadgeOk",
|
|
372
|
-
"controls": "NPLLIq_controls",
|
|
373
|
-
"balanceWin": "NPLLIq_balanceWin",
|
|
374
|
-
"settingsDialog": "NPLLIq_settingsDialog",
|
|
375
|
-
"balanceRow": "NPLLIq_balanceRow",
|
|
376
|
-
"balanceBarBadge": "NPLLIq_balanceBarBadge",
|
|
377
|
-
"dialogTabActive": "NPLLIq_dialogTabActive",
|
|
378
|
-
"dialogHeader": "NPLLIq_dialogHeader",
|
|
379
|
-
"upgradeBannerText": "NPLLIq_upgradeBannerText",
|
|
380
|
-
"collapse": "NPLLIq_collapse",
|
|
381
|
-
"rowName": "NPLLIq_rowName",
|
|
372
|
+
"upgradeBanner": "NPLLIq_upgradeBanner",
|
|
373
|
+
"balanceValueLow": "NPLLIq_balanceValueLow",
|
|
374
|
+
"headerActions": "NPLLIq_headerActions",
|
|
375
|
+
"gearBtn": "NPLLIq_gearBtn",
|
|
376
|
+
"noteNew": "NPLLIq_noteNew",
|
|
377
|
+
"versionNew": "NPLLIq_versionNew",
|
|
382
378
|
"noteWin": "NPLLIq_noteWin",
|
|
383
|
-
"
|
|
384
|
-
"
|
|
385
|
-
"
|
|
386
|
-
"
|
|
387
|
-
"
|
|
388
|
-
"
|
|
389
|
-
"
|
|
390
|
-
"
|
|
391
|
-
"
|
|
392
|
-
"upgradeCommandRow": "NPLLIq_upgradeCommandRow",
|
|
393
|
-
"fullNotice": "NPLLIq_fullNotice",
|
|
394
|
-
"dialogBody": "NPLLIq_dialogBody",
|
|
395
|
-
"dialog": "NPLLIq_dialog",
|
|
396
|
-
"rowDropTarget": "NPLLIq_rowDropTarget",
|
|
379
|
+
"balanceWinBody": "NPLLIq_balanceWinBody",
|
|
380
|
+
"keySaveBtn": "NPLLIq_keySaveBtn",
|
|
381
|
+
"upgradeCommand": "NPLLIq_upgradeCommand",
|
|
382
|
+
"balanceRowValue": "NPLLIq_balanceRowValue",
|
|
383
|
+
"balanceValueError": "NPLLIq_balanceValueError",
|
|
384
|
+
"settingsBtnActive": "NPLLIq_settingsBtnActive",
|
|
385
|
+
"balanceValueOk": "NPLLIq_balanceValueOk",
|
|
386
|
+
"noteChip": "NPLLIq_noteChip",
|
|
387
|
+
"save": "NPLLIq_save",
|
|
397
388
|
"radioRow": "NPLLIq_radioRow",
|
|
398
|
-
"
|
|
389
|
+
"keyRow": "NPLLIq_keyRow",
|
|
390
|
+
"rowName": "NPLLIq_rowName",
|
|
391
|
+
"balanceToggle": "NPLLIq_balanceToggle",
|
|
392
|
+
"balanceWinHeader": "NPLLIq_balanceWinHeader",
|
|
393
|
+
"dialogTitle": "NPLLIq_dialogTitle",
|
|
394
|
+
"collapse": "NPLLIq_collapse",
|
|
395
|
+
"noticeError": "NPLLIq_noticeError",
|
|
396
|
+
"tabLabel": "NPLLIq_tabLabel",
|
|
397
|
+
"tab": "NPLLIq_tab",
|
|
398
|
+
"dialog": "NPLLIq_dialog",
|
|
399
399
|
"upgradeHint": "NPLLIq_upgradeHint",
|
|
400
|
-
"
|
|
401
|
-
"
|
|
402
|
-
"
|
|
403
|
-
"
|
|
404
|
-
"
|
|
405
|
-
"
|
|
400
|
+
"checkUpdatesLabel": "NPLLIq_checkUpdatesLabel",
|
|
401
|
+
"dialogClose": "NPLLIq_dialogClose",
|
|
402
|
+
"resetSelect": "NPLLIq_resetSelect",
|
|
403
|
+
"logDialog": "NPLLIq_logDialog",
|
|
404
|
+
"copyBtnDone": "NPLLIq_copyBtnDone",
|
|
405
|
+
"upgradeBannerText": "NPLLIq_upgradeBannerText"
|
|
406
406
|
};
|
|
407
407
|
//#endregion
|
|
408
408
|
//#region lib/types/client/TokenQuotaPanel.js
|
|
@@ -1139,13 +1139,13 @@ window.__ModuleLoader__.load({
|
|
|
1139
1139
|
title: t("upgradeAvailableHint"),
|
|
1140
1140
|
children: [
|
|
1141
1141
|
"v",
|
|
1142
|
-
"0.1.
|
|
1142
|
+
"0.1.55",
|
|
1143
1143
|
" → v",
|
|
1144
1144
|
upgrade.latestVersion
|
|
1145
1145
|
]
|
|
1146
1146
|
}) : (0, react_jsx_runtime.jsxs)("span", {
|
|
1147
1147
|
className: TokenQuotaPanel_module_css_default.version,
|
|
1148
|
-
children: ["v", "0.1.
|
|
1148
|
+
children: ["v", "0.1.55"]
|
|
1149
1149
|
})]
|
|
1150
1150
|
})
|
|
1151
1151
|
}),
|
|
@@ -3005,13 +3005,13 @@ window.__ModuleLoader__.load({
|
|
|
3005
3005
|
document.head.appendChild(tag);
|
|
3006
3006
|
}
|
|
3007
3007
|
var mic_module_css_default = {
|
|
3008
|
-
"micWrap": "KCoVpa_micWrap",
|
|
3009
|
-
"micPulse": "KCoVpa_micPulse",
|
|
3010
|
-
"micErr": "KCoVpa_micErr",
|
|
3011
3008
|
"micBtn": "KCoVpa_micBtn",
|
|
3012
3009
|
"micBusy": "KCoVpa_micBusy",
|
|
3013
|
-
"
|
|
3014
|
-
"micErrTip": "KCoVpa_micErrTip"
|
|
3010
|
+
"micErr": "KCoVpa_micErr",
|
|
3011
|
+
"micErrTip": "KCoVpa_micErrTip",
|
|
3012
|
+
"micWrap": "KCoVpa_micWrap",
|
|
3013
|
+
"micPulse": "KCoVpa_micPulse",
|
|
3014
|
+
"micRec": "KCoVpa_micRec"
|
|
3015
3015
|
};
|
|
3016
3016
|
//#endregion
|
|
3017
3017
|
//#region lib/types/client/mic.js
|
|
@@ -3205,12 +3205,12 @@ window.__ModuleLoader__.load({
|
|
|
3205
3205
|
document.head.appendChild(tag);
|
|
3206
3206
|
}
|
|
3207
3207
|
var TokenQuotaStash_module_css_default = {
|
|
3208
|
-
"
|
|
3208
|
+
"selBtn": "x_tEcG_selBtn",
|
|
3209
3209
|
"stashTip": "x_tEcG_stashTip",
|
|
3210
|
+
"selDivider": "x_tEcG_selDivider",
|
|
3211
|
+
"stashRow": "x_tEcG_stashRow",
|
|
3210
3212
|
"stashChip": "x_tEcG_stashChip",
|
|
3211
|
-
"
|
|
3212
|
-
"selPopup": "x_tEcG_selPopup",
|
|
3213
|
-
"selDivider": "x_tEcG_selDivider"
|
|
3213
|
+
"selPopup": "x_tEcG_selPopup"
|
|
3214
3214
|
};
|
|
3215
3215
|
//#endregion
|
|
3216
3216
|
//#region lib/types/client/TokenQuotaStash.js
|
package/lib/index.js
CHANGED
|
@@ -199,18 +199,21 @@ function isNewer(latest, current) {
|
|
|
199
199
|
return false;
|
|
200
200
|
}
|
|
201
201
|
/** Settings schema resolving the per-model daily caps document. */
|
|
202
|
+
/** Settings fields. Every one is `volatile`: the Harness settings contract only
|
|
203
|
+
* allows a form edit to write a node declared live, and these are exactly the
|
|
204
|
+
* values the panel edits at runtime. */
|
|
202
205
|
const TOKEN_QUOTA_SETTINGS_FIELDS = {
|
|
203
|
-
limits: z.dict(z.number().step(1).min(0)).default({}),
|
|
204
|
-
monitored: z.array(z.string()).default([]),
|
|
206
|
+
limits: z.dict(z.number().step(1).min(0)).default({}).volatile(),
|
|
207
|
+
monitored: z.array(z.string()).default([]).volatile(),
|
|
205
208
|
onFull: z.union([
|
|
206
209
|
"stop",
|
|
207
210
|
"switchQuota",
|
|
208
211
|
"switchAll",
|
|
209
212
|
"switchPriority"
|
|
210
|
-
]).default("stop"),
|
|
211
|
-
checkUpdates: z.boolean().default(true),
|
|
212
|
-
dimWhenIdle: z.boolean().default(false),
|
|
213
|
-
order: z.array(z.string()).default([]),
|
|
213
|
+
]).default("stop").volatile(),
|
|
214
|
+
checkUpdates: z.boolean().default(true).volatile(),
|
|
215
|
+
dimWhenIdle: z.boolean().default(false).volatile(),
|
|
216
|
+
order: z.array(z.string()).default([]).volatile(),
|
|
214
217
|
notes: z.array(z.object({
|
|
215
218
|
id: z.string(),
|
|
216
219
|
title: z.string().default(""),
|
|
@@ -221,8 +224,8 @@ const TOKEN_QUOTA_SETTINGS_FIELDS = {
|
|
|
221
224
|
height: z.number().default(220),
|
|
222
225
|
collapsed: z.boolean().default(false),
|
|
223
226
|
visible: z.boolean().default(true)
|
|
224
|
-
})).default([]),
|
|
225
|
-
reset: z.any().default(null),
|
|
227
|
+
})).default([]).volatile(),
|
|
228
|
+
reset: z.any().default(null).volatile(),
|
|
226
229
|
music: z.object({
|
|
227
230
|
enabled: z.boolean().default(TOKEN_QUOTA_DEFAULT_MUSIC.enabled),
|
|
228
231
|
volume: z.number().min(0).max(1).default(TOKEN_QUOTA_DEFAULT_MUSIC.volume),
|
|
@@ -232,17 +235,17 @@ const TOKEN_QUOTA_SETTINGS_FIELDS = {
|
|
|
232
235
|
"pentatonic"
|
|
233
236
|
]).default(TOKEN_QUOTA_DEFAULT_MUSIC.style),
|
|
234
237
|
onlyCurrentSession: z.boolean().default(TOKEN_QUOTA_DEFAULT_MUSIC.onlyCurrentSession)
|
|
235
|
-
}).default({ ...TOKEN_QUOTA_DEFAULT_MUSIC }),
|
|
238
|
+
}).default({ ...TOKEN_QUOTA_DEFAULT_MUSIC }).volatile(),
|
|
236
239
|
balance: z.object({
|
|
237
240
|
enabled: z.boolean().default(TOKEN_QUOTA_DEFAULT_BALANCE.enabled),
|
|
238
241
|
pollMinutes: z.number().min(1).max(120).default(TOKEN_QUOTA_DEFAULT_BALANCE.pollMinutes)
|
|
239
|
-
}).default({ ...TOKEN_QUOTA_DEFAULT_BALANCE }),
|
|
242
|
+
}).default({ ...TOKEN_QUOTA_DEFAULT_BALANCE }).volatile(),
|
|
240
243
|
transcribe: z.object({
|
|
241
244
|
enabled: z.boolean().default(TOKEN_QUOTA_DEFAULT_TRANSCRIBE.enabled),
|
|
242
245
|
baseURL: z.string().default(TOKEN_QUOTA_DEFAULT_TRANSCRIBE.baseURL),
|
|
243
246
|
apiKeyEnv: z.string().default(TOKEN_QUOTA_DEFAULT_TRANSCRIBE.apiKeyEnv),
|
|
244
247
|
model: z.string().default(TOKEN_QUOTA_DEFAULT_TRANSCRIBE.model)
|
|
245
|
-
}).default({ ...TOKEN_QUOTA_DEFAULT_TRANSCRIBE })
|
|
248
|
+
}).default({ ...TOKEN_QUOTA_DEFAULT_TRANSCRIBE }).volatile()
|
|
246
249
|
};
|
|
247
250
|
/** Two-digit zero-pad helper. */
|
|
248
251
|
function pad2(value) {
|
|
@@ -288,6 +291,12 @@ const DEFAULT_BALANCE_KEY_ENV = {
|
|
|
288
291
|
deepseek: "DEEPSEEK_API_KEY",
|
|
289
292
|
teamorouter: "TEAMO_ROUTER_API_KEY"
|
|
290
293
|
};
|
|
294
|
+
/** Read a config field that may be a live volatile accessor. */
|
|
295
|
+
function readField(field) {
|
|
296
|
+
if (field === void 0 || field === null) return void 0;
|
|
297
|
+
const accessor = field;
|
|
298
|
+
return typeof accessor.get === "function" ? accessor.get() : field;
|
|
299
|
+
}
|
|
291
300
|
/** Fallback currency per family, used before the first successful fetch. */
|
|
292
301
|
const BALANCE_DEFAULT_CURRENCY = {
|
|
293
302
|
deepseek: "CNY",
|
|
@@ -371,6 +380,8 @@ var TokenQuotaService = class TokenQuotaService extends Service {
|
|
|
371
380
|
history = {};
|
|
372
381
|
limits = {};
|
|
373
382
|
monitored = void 0;
|
|
383
|
+
/** The live config object this instance runs with (volatile fields update in place). */
|
|
384
|
+
runtimeConfig;
|
|
374
385
|
/** Settings resolved from this plugin entry's own config (see applySettings). */
|
|
375
386
|
resolvedSettings = {
|
|
376
387
|
limits: {},
|
|
@@ -394,32 +405,43 @@ var TokenQuotaService = class TokenQuotaService extends Service {
|
|
|
394
405
|
* @param config - the plugin entry config (Config schema, defaults applied).
|
|
395
406
|
*/
|
|
396
407
|
applySettings(config) {
|
|
397
|
-
|
|
408
|
+
this.runtimeConfig = config;
|
|
409
|
+
const raw = config;
|
|
410
|
+
const field = (key) => readField(raw[key]);
|
|
411
|
+
const limits = field("limits") ?? {};
|
|
412
|
+
const monitored = field("monitored") ?? [];
|
|
413
|
+
const onFullRaw = field("onFull");
|
|
414
|
+
const order = field("order") ?? [];
|
|
415
|
+
const notes = field("notes") ?? [];
|
|
416
|
+
const balance = field("balance");
|
|
417
|
+
const transcribe = field("transcribe");
|
|
418
|
+
const music = field("music");
|
|
419
|
+
const resetValue = field("reset");
|
|
398
420
|
const settings = {
|
|
399
|
-
limits
|
|
400
|
-
monitored
|
|
401
|
-
onFull:
|
|
402
|
-
checkUpdates:
|
|
403
|
-
dimWhenIdle:
|
|
404
|
-
order: Array.isArray(
|
|
421
|
+
limits,
|
|
422
|
+
monitored,
|
|
423
|
+
onFull: onFullRaw === "switchPriority" ? "switchAll" : onFullRaw ?? "stop",
|
|
424
|
+
checkUpdates: field("checkUpdates") ?? true,
|
|
425
|
+
dimWhenIdle: field("dimWhenIdle") ?? false,
|
|
426
|
+
order: Array.isArray(order) ? order : [],
|
|
405
427
|
balance: {
|
|
406
|
-
enabled:
|
|
407
|
-
pollMinutes: typeof
|
|
428
|
+
enabled: balance?.enabled ?? TOKEN_QUOTA_DEFAULT_BALANCE.enabled,
|
|
429
|
+
pollMinutes: typeof balance?.pollMinutes === "number" ? Math.max(1, Math.min(120, Math.round(balance.pollMinutes))) : TOKEN_QUOTA_DEFAULT_BALANCE.pollMinutes
|
|
408
430
|
},
|
|
409
431
|
transcribe: {
|
|
410
|
-
enabled:
|
|
411
|
-
baseURL: typeof
|
|
412
|
-
apiKeyEnv: typeof
|
|
413
|
-
model: typeof
|
|
432
|
+
enabled: transcribe?.enabled ?? TOKEN_QUOTA_DEFAULT_TRANSCRIBE.enabled,
|
|
433
|
+
baseURL: typeof transcribe?.baseURL === "string" && transcribe.baseURL !== "" ? transcribe.baseURL.replace(/\/+$/, "") : TOKEN_QUOTA_DEFAULT_TRANSCRIBE.baseURL,
|
|
434
|
+
apiKeyEnv: typeof transcribe?.apiKeyEnv === "string" && transcribe.apiKeyEnv !== "" ? transcribe.apiKeyEnv : TOKEN_QUOTA_DEFAULT_TRANSCRIBE.apiKeyEnv,
|
|
435
|
+
model: typeof transcribe?.model === "string" && transcribe.model !== "" ? transcribe.model : TOKEN_QUOTA_DEFAULT_TRANSCRIBE.model
|
|
414
436
|
},
|
|
415
437
|
music: {
|
|
416
|
-
enabled:
|
|
417
|
-
volume:
|
|
418
|
-
style:
|
|
419
|
-
onlyCurrentSession:
|
|
438
|
+
enabled: music?.enabled ?? TOKEN_QUOTA_DEFAULT_MUSIC.enabled,
|
|
439
|
+
volume: music?.volume ?? TOKEN_QUOTA_DEFAULT_MUSIC.volume,
|
|
440
|
+
style: music?.style ?? TOKEN_QUOTA_DEFAULT_MUSIC.style,
|
|
441
|
+
onlyCurrentSession: music?.onlyCurrentSession ?? TOKEN_QUOTA_DEFAULT_MUSIC.onlyCurrentSession
|
|
420
442
|
},
|
|
421
|
-
notes: Array.isArray(
|
|
422
|
-
...
|
|
443
|
+
notes: Array.isArray(notes) ? notes.slice(0, 5) : [],
|
|
444
|
+
...resetValue !== void 0 && resetValue !== null ? { reset: resetValue } : {}
|
|
423
445
|
};
|
|
424
446
|
this.resolvedSettings = settings;
|
|
425
447
|
this.limits = { ...settings.limits };
|
|
@@ -496,6 +518,9 @@ var TokenQuotaService = class TokenQuotaService extends Service {
|
|
|
496
518
|
this.storagePath = config.storagePath !== void 0 && config.storagePath.length > 0 ? config.storagePath : defaultStoragePath();
|
|
497
519
|
this.load();
|
|
498
520
|
this.applySettings(config);
|
|
521
|
+
ctx.on("loader/volatile-update", () => {
|
|
522
|
+
if (this.runtimeConfig !== void 0) this.applySettings(this.runtimeConfig);
|
|
523
|
+
});
|
|
499
524
|
this.tryMountRoute();
|
|
500
525
|
if (this.disposeRoute === void 0) this.disposeRouteWatcher = ctx.on("internal/service", (name) => {
|
|
501
526
|
if (name === "webServer") this.tryMountRoute();
|
|
@@ -697,7 +722,7 @@ var TokenQuotaService = class TokenQuotaService extends Service {
|
|
|
697
722
|
return this.upgradeCheck;
|
|
698
723
|
}
|
|
699
724
|
async doRefreshUpgrade() {
|
|
700
|
-
const current = "0.1.
|
|
725
|
+
const current = "0.1.55";
|
|
701
726
|
let latest;
|
|
702
727
|
try {
|
|
703
728
|
const response = await fetch(REGISTRY_LATEST_URL, {
|
package/lib/types/index.d.ts
CHANGED
|
@@ -48,6 +48,8 @@ export declare class TokenQuotaService extends Service {
|
|
|
48
48
|
private history;
|
|
49
49
|
private limits;
|
|
50
50
|
private monitored;
|
|
51
|
+
/** The live config object this instance runs with (volatile fields update in place). */
|
|
52
|
+
private runtimeConfig;
|
|
51
53
|
/** Settings resolved from this plugin entry's own config (see applySettings). */
|
|
52
54
|
private resolvedSettings;
|
|
53
55
|
/** The settings document this instance runs with. */
|
package/lib/types/index.js
CHANGED
|
@@ -191,19 +191,22 @@ function isNewer(latest, current) {
|
|
|
191
191
|
return false;
|
|
192
192
|
}
|
|
193
193
|
/** Settings schema resolving the per-model daily caps document. */
|
|
194
|
+
/** Settings fields. Every one is `volatile`: the Harness settings contract only
|
|
195
|
+
* allows a form edit to write a node declared live, and these are exactly the
|
|
196
|
+
* values the panel edits at runtime. */
|
|
194
197
|
const TOKEN_QUOTA_SETTINGS_FIELDS = {
|
|
195
|
-
limits: z.dict(z.number().step(1).min(0)).default({}),
|
|
196
|
-
monitored: z.array(z.string()).default([]),
|
|
198
|
+
limits: z.dict(z.number().step(1).min(0)).default({}).volatile(),
|
|
199
|
+
monitored: z.array(z.string()).default([]).volatile(),
|
|
197
200
|
// `switchPriority` is a legacy value accepted for documents saved by older
|
|
198
201
|
// plugin versions; the runtime normalizes it to `switchAll` (see
|
|
199
202
|
// settingsSource below) so existing users keep auto-switching behavior
|
|
200
203
|
// without reconfiguring.
|
|
201
|
-
onFull: z.union(['stop', 'switchQuota', 'switchAll', 'switchPriority']).default('stop'),
|
|
202
|
-
checkUpdates: z.boolean().default(true),
|
|
204
|
+
onFull: z.union(['stop', 'switchQuota', 'switchAll', 'switchPriority']).default('stop').volatile(),
|
|
205
|
+
checkUpdates: z.boolean().default(true).volatile(),
|
|
203
206
|
// Client-side appearance preference; the host only stores it.
|
|
204
|
-
dimWhenIdle: z.boolean().default(false),
|
|
207
|
+
dimWhenIdle: z.boolean().default(false).volatile(),
|
|
205
208
|
// Drag-to-reorder: display order of model keys, written by the panel.
|
|
206
|
-
order: z.array(z.string()).default([]),
|
|
209
|
+
order: z.array(z.string()).default([]).volatile(),
|
|
207
210
|
// Floating scratchpad notes: the panel owns them, the host stores them.
|
|
208
211
|
notes: z.array(z.object({
|
|
209
212
|
id: z.string(),
|
|
@@ -215,23 +218,23 @@ const TOKEN_QUOTA_SETTINGS_FIELDS = {
|
|
|
215
218
|
height: z.number().default(220),
|
|
216
219
|
collapsed: z.boolean().default(false),
|
|
217
220
|
visible: z.boolean().default(true),
|
|
218
|
-
})).default([]),
|
|
221
|
+
})).default([]).volatile(),
|
|
219
222
|
// `reset` is a user-facing preference outside the validated surface: the
|
|
220
223
|
// panel writes it and the host validates the shape at runtime. `z.any` with
|
|
221
224
|
// a null default keeps it out of the strict fields above.
|
|
222
|
-
reset: z.any().default(null),
|
|
225
|
+
reset: z.any().default(null).volatile(),
|
|
223
226
|
// Live music: host persists the document, the browser half plays it.
|
|
224
227
|
music: z.object({
|
|
225
228
|
enabled: z.boolean().default(TOKEN_QUOTA_DEFAULT_MUSIC.enabled),
|
|
226
229
|
volume: z.number().min(0).max(1).default(TOKEN_QUOTA_DEFAULT_MUSIC.volume),
|
|
227
230
|
style: z.union(['major', 'minor', 'pentatonic']).default(TOKEN_QUOTA_DEFAULT_MUSIC.style),
|
|
228
231
|
onlyCurrentSession: z.boolean().default(TOKEN_QUOTA_DEFAULT_MUSIC.onlyCurrentSession),
|
|
229
|
-
}).default({ ...TOKEN_QUOTA_DEFAULT_MUSIC }),
|
|
232
|
+
}).default({ ...TOKEN_QUOTA_DEFAULT_MUSIC }).volatile(),
|
|
230
233
|
// Account balance: host polls the provider endpoint, panel displays it.
|
|
231
234
|
balance: z.object({
|
|
232
235
|
enabled: z.boolean().default(TOKEN_QUOTA_DEFAULT_BALANCE.enabled),
|
|
233
236
|
pollMinutes: z.number().min(1).max(120).default(TOKEN_QUOTA_DEFAULT_BALANCE.pollMinutes),
|
|
234
|
-
}).default({ ...TOKEN_QUOTA_DEFAULT_BALANCE }),
|
|
237
|
+
}).default({ ...TOKEN_QUOTA_DEFAULT_BALANCE }).volatile(),
|
|
235
238
|
// Voice transcription: the browser records and the host forwards the audio
|
|
236
239
|
// to an OpenAI-compatible endpoint.
|
|
237
240
|
transcribe: z.object({
|
|
@@ -239,7 +242,7 @@ const TOKEN_QUOTA_SETTINGS_FIELDS = {
|
|
|
239
242
|
baseURL: z.string().default(TOKEN_QUOTA_DEFAULT_TRANSCRIBE.baseURL),
|
|
240
243
|
apiKeyEnv: z.string().default(TOKEN_QUOTA_DEFAULT_TRANSCRIBE.apiKeyEnv),
|
|
241
244
|
model: z.string().default(TOKEN_QUOTA_DEFAULT_TRANSCRIBE.model),
|
|
242
|
-
}).default({ ...TOKEN_QUOTA_DEFAULT_TRANSCRIBE }),
|
|
245
|
+
}).default({ ...TOKEN_QUOTA_DEFAULT_TRANSCRIBE }).volatile(),
|
|
243
246
|
};
|
|
244
247
|
/** Two-digit zero-pad helper. */
|
|
245
248
|
function pad2(value) {
|
|
@@ -293,6 +296,13 @@ const DEFAULT_BALANCE_KEY_ENV = {
|
|
|
293
296
|
deepseek: 'DEEPSEEK_API_KEY',
|
|
294
297
|
teamorouter: 'TEAMO_ROUTER_API_KEY',
|
|
295
298
|
};
|
|
299
|
+
/** Read a config field that may be a live volatile accessor. */
|
|
300
|
+
function readField(field) {
|
|
301
|
+
if (field === undefined || field === null)
|
|
302
|
+
return undefined;
|
|
303
|
+
const accessor = field;
|
|
304
|
+
return typeof accessor.get === 'function' ? accessor.get() : field;
|
|
305
|
+
}
|
|
296
306
|
/** Fallback currency per family, used before the first successful fetch. */
|
|
297
307
|
const BALANCE_DEFAULT_CURRENCY = {
|
|
298
308
|
deepseek: 'CNY',
|
|
@@ -389,6 +399,8 @@ export class TokenQuotaService extends Service {
|
|
|
389
399
|
history = {};
|
|
390
400
|
limits = {};
|
|
391
401
|
monitored = undefined;
|
|
402
|
+
/** The live config object this instance runs with (volatile fields update in place). */
|
|
403
|
+
runtimeConfig;
|
|
392
404
|
/** Settings resolved from this plugin entry's own config (see applySettings). */
|
|
393
405
|
resolvedSettings = { limits: {}, monitored: [], onFull: 'stop', checkUpdates: true, dimWhenIdle: false, music: { ...TOKEN_QUOTA_DEFAULT_MUSIC }, order: [], notes: [], balance: { ...TOKEN_QUOTA_DEFAULT_BALANCE }, transcribe: { ...TOKEN_QUOTA_DEFAULT_TRANSCRIBE } };
|
|
394
406
|
/** The settings document this instance runs with. */
|
|
@@ -401,40 +413,53 @@ export class TokenQuotaService extends Service {
|
|
|
401
413
|
* @param config - the plugin entry config (Config schema, defaults applied).
|
|
402
414
|
*/
|
|
403
415
|
applySettings(config) {
|
|
404
|
-
|
|
416
|
+
// Volatile config fields are live accessors, so read through readField()
|
|
417
|
+
// rather than assuming plain values.
|
|
418
|
+
this.runtimeConfig = config;
|
|
419
|
+
const raw = config;
|
|
420
|
+
const field = (key) => readField(raw[key]);
|
|
421
|
+
const limits = field('limits') ?? {};
|
|
422
|
+
const monitored = field('monitored') ?? [];
|
|
423
|
+
const onFullRaw = field('onFull');
|
|
424
|
+
const order = field('order') ?? [];
|
|
425
|
+
const notes = field('notes') ?? [];
|
|
426
|
+
const balance = field('balance');
|
|
427
|
+
const transcribe = field('transcribe');
|
|
428
|
+
const music = field('music');
|
|
429
|
+
const resetValue = field('reset');
|
|
405
430
|
const settings = {
|
|
406
|
-
limits
|
|
407
|
-
monitored
|
|
408
|
-
onFull:
|
|
409
|
-
checkUpdates:
|
|
410
|
-
dimWhenIdle:
|
|
411
|
-
order: Array.isArray(
|
|
431
|
+
limits,
|
|
432
|
+
monitored,
|
|
433
|
+
onFull: onFullRaw === 'switchPriority' ? 'switchAll' : (onFullRaw ?? 'stop'),
|
|
434
|
+
checkUpdates: field('checkUpdates') ?? true,
|
|
435
|
+
dimWhenIdle: field('dimWhenIdle') ?? false,
|
|
436
|
+
order: Array.isArray(order) ? order : [],
|
|
412
437
|
balance: {
|
|
413
|
-
enabled:
|
|
414
|
-
pollMinutes: typeof
|
|
415
|
-
? Math.max(1, Math.min(120, Math.round(
|
|
438
|
+
enabled: balance?.enabled ?? TOKEN_QUOTA_DEFAULT_BALANCE.enabled,
|
|
439
|
+
pollMinutes: typeof balance?.pollMinutes === 'number'
|
|
440
|
+
? Math.max(1, Math.min(120, Math.round(balance.pollMinutes)))
|
|
416
441
|
: TOKEN_QUOTA_DEFAULT_BALANCE.pollMinutes,
|
|
417
442
|
},
|
|
418
443
|
transcribe: {
|
|
419
|
-
enabled:
|
|
420
|
-
baseURL: typeof
|
|
421
|
-
?
|
|
444
|
+
enabled: transcribe?.enabled ?? TOKEN_QUOTA_DEFAULT_TRANSCRIBE.enabled,
|
|
445
|
+
baseURL: typeof transcribe?.baseURL === 'string' && transcribe.baseURL !== ''
|
|
446
|
+
? transcribe.baseURL.replace(/\/+$/, '')
|
|
422
447
|
: TOKEN_QUOTA_DEFAULT_TRANSCRIBE.baseURL,
|
|
423
|
-
apiKeyEnv: typeof
|
|
424
|
-
?
|
|
448
|
+
apiKeyEnv: typeof transcribe?.apiKeyEnv === 'string' && transcribe.apiKeyEnv !== ''
|
|
449
|
+
? transcribe.apiKeyEnv
|
|
425
450
|
: TOKEN_QUOTA_DEFAULT_TRANSCRIBE.apiKeyEnv,
|
|
426
|
-
model: typeof
|
|
427
|
-
?
|
|
451
|
+
model: typeof transcribe?.model === 'string' && transcribe.model !== ''
|
|
452
|
+
? transcribe.model
|
|
428
453
|
: TOKEN_QUOTA_DEFAULT_TRANSCRIBE.model,
|
|
429
454
|
},
|
|
430
455
|
music: {
|
|
431
|
-
enabled:
|
|
432
|
-
volume:
|
|
433
|
-
style:
|
|
434
|
-
onlyCurrentSession:
|
|
456
|
+
enabled: music?.enabled ?? TOKEN_QUOTA_DEFAULT_MUSIC.enabled,
|
|
457
|
+
volume: music?.volume ?? TOKEN_QUOTA_DEFAULT_MUSIC.volume,
|
|
458
|
+
style: music?.style ?? TOKEN_QUOTA_DEFAULT_MUSIC.style,
|
|
459
|
+
onlyCurrentSession: music?.onlyCurrentSession ?? TOKEN_QUOTA_DEFAULT_MUSIC.onlyCurrentSession,
|
|
435
460
|
},
|
|
436
|
-
notes: Array.isArray(
|
|
437
|
-
...
|
|
461
|
+
notes: Array.isArray(notes) ? notes.slice(0, TOKEN_QUOTA_MAX_NOTES) : [],
|
|
462
|
+
...resetValue !== undefined && resetValue !== null ? { reset: resetValue } : {},
|
|
438
463
|
};
|
|
439
464
|
this.resolvedSettings = settings;
|
|
440
465
|
// Live-apply the parts the service acts on.
|
|
@@ -526,6 +551,11 @@ export class TokenQuotaService extends Service {
|
|
|
526
551
|
// entry, and the live-apply work that used to hang off `installSection`'s
|
|
527
552
|
// onChange callback happens once per instantiation instead.
|
|
528
553
|
this.applySettings(config);
|
|
554
|
+
ctx
|
|
555
|
+
.on('loader/volatile-update', () => {
|
|
556
|
+
if (this.runtimeConfig !== undefined)
|
|
557
|
+
this.applySettings(this.runtimeConfig);
|
|
558
|
+
});
|
|
529
559
|
// Snapshot route: optional — only mounted when a webServer service exists
|
|
530
560
|
// (the Web profile); headless deployments keep the enforcement without it.
|
|
531
561
|
this.tryMountRoute();
|
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.55",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|