@jxgame2020/dsh-token-quota 0.1.52 → 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 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.52" ? upgrade : null;
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
- "balanceBarDim": "NPLLIq_balanceBarDim",
266
- "logPageSizeSelect": "NPLLIq_logPageSizeSelect",
267
- "upgradeBannerFlash": "NPLLIq_upgradeBannerFlash",
268
- "rowDragging": "NPLLIq_rowDragging",
269
- "noteWin": "NPLLIq_noteWin",
270
- "row": "NPLLIq_row",
271
- "balanceBarBadge": "NPLLIq_balanceBarBadge",
272
- "fullNotice": "NPLLIq_fullNotice",
273
- "tabIcon": "NPLLIq_tabIcon",
274
- "upgradeBanner": "NPLLIq_upgradeBanner",
275
- "logSearch": "NPLLIq_logSearch",
276
- "resetRow": "NPLLIq_resetRow",
277
- "noteWinTitle": "NPLLIq_noteWinTitle",
278
- "balanceToggleOpen": "NPLLIq_balanceToggleOpen",
265
+ "noteWinTitleText": "NPLLIq_noteWinTitleText",
266
+ "upgradeCommands": "NPLLIq_upgradeCommands",
267
+ "monitorName": "NPLLIq_monitorName",
268
+ "keyError": "NPLLIq_keyError",
279
269
  "balanceBarError": "NPLLIq_balanceBarError",
280
- "balanceValueError": "NPLLIq_balanceValueError",
281
- "monitorList": "NPLLIq_monitorList",
282
- "noteChip": "NPLLIq_noteChip",
283
- "rowName": "NPLLIq_rowName",
284
- "balanceLastLine": "NPLLIq_balanceLastLine",
285
- "dialogSection": "NPLLIq_dialogSection",
286
- "balanceWinTitle": "NPLLIq_balanceWinTitle",
287
- "logClearDate": "NPLLIq_logClearDate",
288
- "rowDropTarget": "NPLLIq_rowDropTarget",
270
+ "settingsBtn": "NPLLIq_settingsBtn",
271
+ "fillOver": "NPLLIq_fillOver",
272
+ "dialogHint": "NPLLIq_dialogHint",
273
+ "panel": "NPLLIq_panel",
274
+ "noteWinTitle": "NPLLIq_noteWinTitle",
289
275
  "dialogTabs": "NPLLIq_dialogTabs",
290
- "rowDrag": "NPLLIq_rowDrag",
291
- "logDayCol": "NPLLIq_logDayCol",
292
- "monitorRow": "NPLLIq_monitorRow",
293
- "keyRow": "NPLLIq_keyRow",
276
+ "logPager": "NPLLIq_logPager",
277
+ "dialogBtnPrimary": "NPLLIq_dialogBtnPrimary",
278
+ "checkErrorHint": "NPLLIq_checkErrorHint",
294
279
  "title": "NPLLIq_title",
295
- "fillIdle": "NPLLIq_fillIdle",
296
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",
297
290
  "noteWinBar": "NPLLIq_noteWinBar",
291
+ "dialogSection": "NPLLIq_dialogSection",
292
+ "balanceBarBadge": "NPLLIq_balanceBarBadge",
293
+ "bar": "NPLLIq_bar",
294
+ "logPagerBtn": "NPLLIq_logPagerBtn",
295
+ "logPageSizeSelect": "NPLLIq_logPageSizeSelect",
296
+ "dialogBody": "NPLLIq_dialogBody",
297
+ "noteMenuItem": "NPLLIq_noteMenuItem",
298
+ "copyBtn": "NPLLIq_copyBtn",
299
+ "headerText": "NPLLIq_headerText",
300
+ "upgradeBannerFlash": "NPLLIq_upgradeBannerFlash",
301
+ "logDayCol": "NPLLIq_logDayCol",
302
+ "balanceBarLow": "NPLLIq_balanceBarLow",
303
+ "keyBadgeOk": "NPLLIq_keyBadgeOk",
304
+ "balanceRowName": "NPLLIq_balanceRowName",
305
+ "logTable": "NPLLIq_logTable",
306
+ "noteNewPlus": "NPLLIq_noteNewPlus",
307
+ "balanceWin": "NPLLIq_balanceWin",
308
+ "rowHeader": "NPLLIq_rowHeader",
298
309
  "balanceRow": "NPLLIq_balanceRow",
299
- "checkErrorHint": "NPLLIq_checkErrorHint",
300
- "dialogLabel": "NPLLIq_dialogLabel",
301
- "monitorHint": "NPLLIq_monitorHint",
302
- "collapse": "NPLLIq_collapse",
303
- "dialogClose": "NPLLIq_dialogClose",
304
- "keyBadgeOff": "NPLLIq_keyBadgeOff",
305
- "balanceValueLow": "NPLLIq_balanceValueLow",
306
- "checkUpdatesRow": "NPLLIq_checkUpdatesRow",
307
- "balanceToggle": "NPLLIq_balanceToggle",
308
- "checkBtn": "NPLLIq_checkBtn",
309
- "fillOver": "NPLLIq_fillOver",
310
- "balanceBar": "NPLLIq_balanceBar",
311
- "balanceValueOk": "NPLLIq_balanceValueOk",
312
- "upgradeCommandRow": "NPLLIq_upgradeCommandRow",
313
- "upgradeClose": "NPLLIq_upgradeClose",
314
310
  "dialogBtn": "NPLLIq_dialogBtn",
315
- "logPagerControls": "NPLLIq_logPagerControls",
316
- "tabLabel": "NPLLIq_tabLabel",
317
- "noteWinGripBar": "NPLLIq_noteWinGripBar",
318
- "noteWinCollapsed": "NPLLIq_noteWinCollapsed",
319
- "upgradeHint": "NPLLIq_upgradeHint",
320
- "controls": "NPLLIq_controls",
321
- "dialog": "NPLLIq_dialog",
322
- "upgradeBannerText": "NPLLIq_upgradeBannerText",
323
- "logModelCol": "NPLLIq_logModelCol",
311
+ "fullNotice": "NPLLIq_fullNotice",
312
+ "noteChipOpen": "NPLLIq_noteChipOpen",
313
+ "settingsDialog": "NPLLIq_settingsDialog",
314
+ "rowDragging": "NPLLIq_rowDragging",
315
+ "balanceBarDim": "NPLLIq_balanceBarDim",
316
+ "resetRow": "NPLLIq_resetRow",
317
+ "tabIcon": "NPLLIq_tabIcon",
324
318
  "balanceRefreshAll": "NPLLIq_balanceRefreshAll",
325
- "logPagerPages": "NPLLIq_logPagerPages",
326
- "logClearDialog": "NPLLIq_logClearDialog",
327
319
  "panelDim": "NPLLIq_panelDim",
328
- "body": "NPLLIq_body",
329
- "settingsDialog": "NPLLIq_settingsDialog",
330
- "logPagerBtn": "NPLLIq_logPagerBtn",
331
- "noteWinResize": "NPLLIq_noteWinResize",
332
- "versionNew": "NPLLIq_versionNew",
333
- "logDialog": "NPLLIq_logDialog",
334
- "panel": "NPLLIq_panel",
335
- "noteNewPlus": "NPLLIq_noteNewPlus",
336
- "balanceBarRefresh": "NPLLIq_balanceBarRefresh",
337
- "balanceWin": "NPLLIq_balanceWin",
338
- "gearBtn": "NPLLIq_gearBtn",
339
- "logHeader": "NPLLIq_logHeader",
340
- "keyBadgeOk": "NPLLIq_keyBadgeOk",
320
+ "logUsedCol": "NPLLIq_logUsedCol",
321
+ "balanceToggleOpen": "NPLLIq_balanceToggleOpen",
341
322
  "logPagerInfo": "NPLLIq_logPagerInfo",
342
- "input": "NPLLIq_input",
343
- "keyError": "NPLLIq_keyError",
344
- "keySaveBtn": "NPLLIq_keySaveBtn",
345
- "noticeError": "NPLLIq_noticeError",
323
+ "dialogOverlay": "NPLLIq_dialogOverlay",
324
+ "logClearDialog": "NPLLIq_logClearDialog",
325
+ "keyBadgeOff": "NPLLIq_keyBadgeOff",
326
+ "monitorRow": "NPLLIq_monitorRow",
346
327
  "subtitle": "NPLLIq_subtitle",
347
- "noteMenu": "NPLLIq_noteMenu",
348
- "fillWarn": "NPLLIq_fillWarn",
349
- "noteWinBtn": "NPLLIq_noteWinBtn",
350
- "logToolbar": "NPLLIq_logToolbar",
351
- "copyBtn": "NPLLIq_copyBtn",
328
+ "noteWinGripBar": "NPLLIq_noteWinGripBar",
329
+ "row": "NPLLIq_row",
330
+ "fillIdle": "NPLLIq_fillIdle",
331
+ "noteWinCollapsed": "NPLLIq_noteWinCollapsed",
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",
352
339
  "version": "NPLLIq_version",
353
- "dialogTab": "NPLLIq_dialogTab",
354
- "logTable": "NPLLIq_logTable",
355
- "tab": "NPLLIq_tab",
356
- "save": "NPLLIq_save",
357
- "settingsBtn": "NPLLIq_settingsBtn",
358
- "balanceRowName": "NPLLIq_balanceRowName",
359
- "noteMenuItem": "NPLLIq_noteMenuItem",
360
- "dialogHint": "NPLLIq_dialogHint",
361
- "noteNew": "NPLLIq_noteNew",
362
- "currentBadge": "NPLLIq_currentBadge",
363
- "upgradeCommand": "NPLLIq_upgradeCommand",
364
- "upgradeCommands": "NPLLIq_upgradeCommands",
365
- "checkUpdatesLabel": "NPLLIq_checkUpdatesLabel",
366
- "noteChipOpen": "NPLLIq_noteChipOpen",
367
- "dialogBody": "NPLLIq_dialogBody",
368
- "balanceRowRefresh": "NPLLIq_balanceRowRefresh",
340
+ "fillWarn": "NPLLIq_fillWarn",
341
+ "body": "NPLLIq_body",
369
342
  "balanceRowHeader": "NPLLIq_balanceRowHeader",
370
- "headerActions": "NPLLIq_headerActions",
371
- "headerText": "NPLLIq_headerText",
372
- "dialogOverlay": "NPLLIq_dialogOverlay",
373
- "resetSelect": "NPLLIq_resetSelect",
374
- "notice": "NPLLIq_notice",
343
+ "dialogHeader": "NPLLIq_dialogHeader",
344
+ "logPagerControls": "NPLLIq_logPagerControls",
345
+ "dialogTabActive": "NPLLIq_dialogTabActive",
346
+ "balanceRowRefresh": "NPLLIq_balanceRowRefresh",
347
+ "noteWinResize": "NPLLIq_noteWinResize",
348
+ "currentBadge": "NPLLIq_currentBadge",
349
+ "noteWinBtn": "NPLLIq_noteWinBtn",
375
350
  "selectBtn": "NPLLIq_selectBtn",
376
- "noteMenuBackdrop": "NPLLIq_noteMenuBackdrop",
377
- "balanceBarText": "NPLLIq_balanceBarText",
378
351
  "panelDimStrong": "NPLLIq_panelDimStrong",
379
- "logPager": "NPLLIq_logPager",
380
- "monitorName": "NPLLIq_monitorName",
381
- "balanceSortBtn": "NPLLIq_balanceSortBtn",
382
- "balanceBarLow": "NPLLIq_balanceBarLow",
383
- "dialogHeader": "NPLLIq_dialogHeader",
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",
359
+ "rowMeta": "NPLLIq_rowMeta",
360
+ "checkUpdatesRow": "NPLLIq_checkUpdatesRow",
384
361
  "logScroll": "NPLLIq_logScroll",
362
+ "logToolbar": "NPLLIq_logToolbar",
385
363
  "notesBar": "NPLLIq_notesBar",
364
+ "noteMenu": "NPLLIq_noteMenu",
365
+ "balanceBar": "NPLLIq_balanceBar",
366
+ "rowDropTarget": "NPLLIq_rowDropTarget",
367
+ "logClearDate": "NPLLIq_logClearDate",
368
+ "upgradeCommandRow": "NPLLIq_upgradeCommandRow",
369
+ "balanceBarText": "NPLLIq_balanceBarText",
370
+ "dialogLabel": "NPLLIq_dialogLabel",
371
+ "logModelCol": "NPLLIq_logModelCol",
372
+ "upgradeBanner": "NPLLIq_upgradeBanner",
373
+ "balanceValueLow": "NPLLIq_balanceValueLow",
374
+ "headerActions": "NPLLIq_headerActions",
375
+ "gearBtn": "NPLLIq_gearBtn",
376
+ "noteNew": "NPLLIq_noteNew",
377
+ "versionNew": "NPLLIq_versionNew",
378
+ "noteWin": "NPLLIq_noteWin",
386
379
  "balanceWinBody": "NPLLIq_balanceWinBody",
387
- "dialogTitle": "NPLLIq_dialogTitle",
388
- "logUsedCol": "NPLLIq_logUsedCol",
389
- "logClearBtn": "NPLLIq_logClearBtn",
390
- "rowMeta": "NPLLIq_rowMeta",
391
- "radioRow": "NPLLIq_radioRow",
392
- "balanceStateError": "NPLLIq_balanceStateError",
393
- "dialogBtnPrimary": "NPLLIq_dialogBtnPrimary",
394
- "copyBtnDone": "NPLLIq_copyBtnDone",
395
- "settingsBtnActive": "NPLLIq_settingsBtnActive",
396
- "switch": "NPLLIq_switch",
397
- "rowHeader": "NPLLIq_rowHeader",
380
+ "keySaveBtn": "NPLLIq_keySaveBtn",
381
+ "upgradeCommand": "NPLLIq_upgradeCommand",
398
382
  "balanceRowValue": "NPLLIq_balanceRowValue",
399
- "balanceStateHint": "NPLLIq_balanceStateHint",
400
- "dialogTabActive": "NPLLIq_dialogTabActive",
401
- "noteWinText": "NPLLIq_noteWinText",
402
- "dialogActions": "NPLLIq_dialogActions",
383
+ "balanceValueError": "NPLLIq_balanceValueError",
384
+ "settingsBtnActive": "NPLLIq_settingsBtnActive",
385
+ "balanceValueOk": "NPLLIq_balanceValueOk",
386
+ "noteChip": "NPLLIq_noteChip",
387
+ "save": "NPLLIq_save",
388
+ "radioRow": "NPLLIq_radioRow",
389
+ "keyRow": "NPLLIq_keyRow",
390
+ "rowName": "NPLLIq_rowName",
391
+ "balanceToggle": "NPLLIq_balanceToggle",
403
392
  "balanceWinHeader": "NPLLIq_balanceWinHeader",
404
- "noteWinTitleText": "NPLLIq_noteWinTitleText",
405
- "bar": "NPLLIq_bar"
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
+ "upgradeHint": "NPLLIq_upgradeHint",
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.52",
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.52"]
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
- "micErr": "KCoVpa_micErr",
3009
3008
  "micBtn": "KCoVpa_micBtn",
3009
+ "micBusy": "KCoVpa_micBusy",
3010
+ "micErr": "KCoVpa_micErr",
3010
3011
  "micErrTip": "KCoVpa_micErrTip",
3011
3012
  "micWrap": "KCoVpa_micWrap",
3012
- "micRec": "KCoVpa_micRec",
3013
3013
  "micPulse": "KCoVpa_micPulse",
3014
- "micBusy": "KCoVpa_micBusy"
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
- "selPopup": "x_tEcG_selPopup",
3209
- "stashRow": "x_tEcG_stashRow",
3210
- "selDivider": "x_tEcG_selDivider",
3211
3208
  "selBtn": "x_tEcG_selBtn",
3212
3209
  "stashTip": "x_tEcG_stashTip",
3213
- "stashChip": "x_tEcG_stashChip"
3210
+ "selDivider": "x_tEcG_selDivider",
3211
+ "stashRow": "x_tEcG_stashRow",
3212
+ "stashChip": "x_tEcG_stashChip",
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) {
@@ -278,6 +281,22 @@ function usageTokens(usage) {
278
281
  const DEEPSEEK_BALANCE_HOST = "api.deepseek.com";
279
282
  /** TeamoRouter's host; its model and billing endpoints share this domain. */
280
283
  const TEAMOROUTER_HOST = "teamorouter.cn";
284
+ /**
285
+ * Credential reference each family's adapter falls back to when the provider
286
+ * entry declares no `apiKeyEnv` (e.g. `llm-deepseek`, whose adapter resolves
287
+ * DEEPSEEK_API_KEY internally). Querying that same reference is what makes such
288
+ * a provider represent the same account the model calls are billed to.
289
+ */
290
+ const DEFAULT_BALANCE_KEY_ENV = {
291
+ deepseek: "DEEPSEEK_API_KEY",
292
+ teamorouter: "TEAMO_ROUTER_API_KEY"
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
+ }
281
300
  /** Fallback currency per family, used before the first successful fetch. */
282
301
  const BALANCE_DEFAULT_CURRENCY = {
283
302
  deepseek: "CNY",
@@ -361,6 +380,8 @@ var TokenQuotaService = class TokenQuotaService extends Service {
361
380
  history = {};
362
381
  limits = {};
363
382
  monitored = void 0;
383
+ /** The live config object this instance runs with (volatile fields update in place). */
384
+ runtimeConfig;
364
385
  /** Settings resolved from this plugin entry's own config (see applySettings). */
365
386
  resolvedSettings = {
366
387
  limits: {},
@@ -384,32 +405,43 @@ var TokenQuotaService = class TokenQuotaService extends Service {
384
405
  * @param config - the plugin entry config (Config schema, defaults applied).
385
406
  */
386
407
  applySettings(config) {
387
- const doc = config;
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");
388
420
  const settings = {
389
- limits: doc.limits ?? {},
390
- monitored: doc.monitored ?? [],
391
- onFull: doc.onFull === "switchPriority" ? "switchAll" : doc.onFull ?? "stop",
392
- checkUpdates: doc.checkUpdates ?? true,
393
- dimWhenIdle: doc.dimWhenIdle ?? false,
394
- order: Array.isArray(doc.order) ? doc.order : [],
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 : [],
395
427
  balance: {
396
- enabled: doc.balance?.enabled ?? TOKEN_QUOTA_DEFAULT_BALANCE.enabled,
397
- pollMinutes: typeof doc.balance?.pollMinutes === "number" ? Math.max(1, Math.min(120, Math.round(doc.balance.pollMinutes))) : TOKEN_QUOTA_DEFAULT_BALANCE.pollMinutes
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
398
430
  },
399
431
  transcribe: {
400
- enabled: doc.transcribe?.enabled ?? TOKEN_QUOTA_DEFAULT_TRANSCRIBE.enabled,
401
- baseURL: typeof doc.transcribe?.baseURL === "string" && doc.transcribe.baseURL !== "" ? doc.transcribe.baseURL.replace(/\/+$/, "") : TOKEN_QUOTA_DEFAULT_TRANSCRIBE.baseURL,
402
- apiKeyEnv: typeof doc.transcribe?.apiKeyEnv === "string" && doc.transcribe.apiKeyEnv !== "" ? doc.transcribe.apiKeyEnv : TOKEN_QUOTA_DEFAULT_TRANSCRIBE.apiKeyEnv,
403
- model: typeof doc.transcribe?.model === "string" && doc.transcribe.model !== "" ? doc.transcribe.model : TOKEN_QUOTA_DEFAULT_TRANSCRIBE.model
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
404
436
  },
405
437
  music: {
406
- enabled: doc.music?.enabled ?? TOKEN_QUOTA_DEFAULT_MUSIC.enabled,
407
- volume: doc.music?.volume ?? TOKEN_QUOTA_DEFAULT_MUSIC.volume,
408
- style: doc.music?.style ?? TOKEN_QUOTA_DEFAULT_MUSIC.style,
409
- onlyCurrentSession: doc.music?.onlyCurrentSession ?? TOKEN_QUOTA_DEFAULT_MUSIC.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
410
442
  },
411
- notes: Array.isArray(doc.notes) ? doc.notes.slice(0, 5) : [],
412
- ...doc.reset !== void 0 && doc.reset !== null ? { reset: doc.reset } : {}
443
+ notes: Array.isArray(notes) ? notes.slice(0, 5) : [],
444
+ ...resetValue !== void 0 && resetValue !== null ? { reset: resetValue } : {}
413
445
  };
414
446
  this.resolvedSettings = settings;
415
447
  this.limits = { ...settings.limits };
@@ -486,6 +518,9 @@ var TokenQuotaService = class TokenQuotaService extends Service {
486
518
  this.storagePath = config.storagePath !== void 0 && config.storagePath.length > 0 ? config.storagePath : defaultStoragePath();
487
519
  this.load();
488
520
  this.applySettings(config);
521
+ ctx.on("loader/volatile-update", () => {
522
+ if (this.runtimeConfig !== void 0) this.applySettings(this.runtimeConfig);
523
+ });
489
524
  this.tryMountRoute();
490
525
  if (this.disposeRoute === void 0) this.disposeRouteWatcher = ctx.on("internal/service", (name) => {
491
526
  if (name === "webServer") this.tryMountRoute();
@@ -687,7 +722,7 @@ var TokenQuotaService = class TokenQuotaService extends Service {
687
722
  return this.upgradeCheck;
688
723
  }
689
724
  async doRefreshUpgrade() {
690
- const current = "0.1.52";
725
+ const current = "0.1.55";
691
726
  let latest;
692
727
  try {
693
728
  const response = await fetch(REGISTRY_LATEST_URL, {
@@ -775,11 +810,21 @@ var TokenQuotaService = class TokenQuotaService extends Service {
775
810
  const found = /* @__PURE__ */ new Map();
776
811
  const llm = this.ctx.get("llm");
777
812
  const configEditor = this.ctx.get("configEditor");
813
+ const profileOf = (row) => {
814
+ const layers = [
815
+ row.override,
816
+ row.inherited,
817
+ row.entry?.fiber?.config,
818
+ row.entry?.options?.config
819
+ ];
820
+ for (const layer of layers) if (layer !== null && typeof layer === "object" && "providers" in layer) return layer;
821
+ for (const layer of layers) if (layer !== null && typeof layer === "object") return layer;
822
+ };
778
823
  const liveConfigs = /* @__PURE__ */ new Map();
779
824
  try {
780
825
  for (const row of configEditor?.configuration() ?? []) {
781
- const id = row.entry.options.id;
782
- if (id !== void 0) liveConfigs.set(id, row.entry.options.config);
826
+ const id = row.entry?.options?.id;
827
+ if (id !== void 0) liveConfigs.set(id, profileOf(row));
783
828
  }
784
829
  } catch {}
785
830
  const fallback = () => ({
@@ -800,15 +845,19 @@ var TokenQuotaService = class TokenQuotaService extends Service {
800
845
  const keyEnv = typeof record.apiKeyEnv === "string" && record.apiKeyEnv !== "" ? record.apiKeyEnv : void 0;
801
846
  const baseURL = typeof record.baseURL === "string" && record.baseURL !== "" ? record.baseURL : void 0;
802
847
  const kind = balanceKindOf(entry.provider, keyEnv, baseURL);
803
- if (kind === void 0 || keyEnv === void 0) continue;
848
+ if (kind === void 0) continue;
849
+ const balanceKeyEnv = keyEnv ?? DEFAULT_BALANCE_KEY_ENV[kind];
804
850
  found.set(entry.provider, {
805
851
  provider: entry.provider,
806
- keyEnv,
852
+ keyEnv: balanceKeyEnv,
807
853
  baseURL: baseURL ?? (kind === "deepseek" ? `https://${DEEPSEEK_BALANCE_HOST}` : `https://${TEAMOROUTER_HOST}`),
808
854
  kind
809
855
  });
810
856
  } catch {}
811
857
  if (found.size === 0) found.set("deepseek", fallback());
858
+ try {
859
+ this.ctx.logger?.info(`token-quota: balance sources = ${[...found.values()].map((source) => `${source.provider}(${source.kind})`).join(", ")}`);
860
+ } catch {}
812
861
  return found;
813
862
  }
814
863
  /**
@@ -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. */
@@ -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) {
@@ -283,6 +286,23 @@ function usageTokens(usage) {
283
286
  const DEEPSEEK_BALANCE_HOST = 'api.deepseek.com';
284
287
  /** TeamoRouter's host; its model and billing endpoints share this domain. */
285
288
  const TEAMOROUTER_HOST = 'teamorouter.cn';
289
+ /**
290
+ * Credential reference each family's adapter falls back to when the provider
291
+ * entry declares no `apiKeyEnv` (e.g. `llm-deepseek`, whose adapter resolves
292
+ * DEEPSEEK_API_KEY internally). Querying that same reference is what makes such
293
+ * a provider represent the same account the model calls are billed to.
294
+ */
295
+ const DEFAULT_BALANCE_KEY_ENV = {
296
+ deepseek: 'DEEPSEEK_API_KEY',
297
+ teamorouter: 'TEAMO_ROUTER_API_KEY',
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
+ }
286
306
  /** Fallback currency per family, used before the first successful fetch. */
287
307
  const BALANCE_DEFAULT_CURRENCY = {
288
308
  deepseek: 'CNY',
@@ -379,6 +399,8 @@ export class TokenQuotaService extends Service {
379
399
  history = {};
380
400
  limits = {};
381
401
  monitored = undefined;
402
+ /** The live config object this instance runs with (volatile fields update in place). */
403
+ runtimeConfig;
382
404
  /** Settings resolved from this plugin entry's own config (see applySettings). */
383
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 } };
384
406
  /** The settings document this instance runs with. */
@@ -391,40 +413,53 @@ export class TokenQuotaService extends Service {
391
413
  * @param config - the plugin entry config (Config schema, defaults applied).
392
414
  */
393
415
  applySettings(config) {
394
- const doc = config;
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');
395
430
  const settings = {
396
- limits: doc.limits ?? {},
397
- monitored: doc.monitored ?? [],
398
- onFull: doc.onFull === 'switchPriority' ? 'switchAll' : (doc.onFull ?? 'stop'),
399
- checkUpdates: doc.checkUpdates ?? true,
400
- dimWhenIdle: doc.dimWhenIdle ?? false,
401
- order: Array.isArray(doc.order) ? doc.order : [],
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 : [],
402
437
  balance: {
403
- enabled: doc.balance?.enabled ?? TOKEN_QUOTA_DEFAULT_BALANCE.enabled,
404
- pollMinutes: typeof doc.balance?.pollMinutes === 'number'
405
- ? Math.max(1, Math.min(120, Math.round(doc.balance.pollMinutes)))
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)))
406
441
  : TOKEN_QUOTA_DEFAULT_BALANCE.pollMinutes,
407
442
  },
408
443
  transcribe: {
409
- enabled: doc.transcribe?.enabled ?? TOKEN_QUOTA_DEFAULT_TRANSCRIBE.enabled,
410
- baseURL: typeof doc.transcribe?.baseURL === 'string' && doc.transcribe.baseURL !== ''
411
- ? doc.transcribe.baseURL.replace(/\/+$/, '')
444
+ enabled: transcribe?.enabled ?? TOKEN_QUOTA_DEFAULT_TRANSCRIBE.enabled,
445
+ baseURL: typeof transcribe?.baseURL === 'string' && transcribe.baseURL !== ''
446
+ ? transcribe.baseURL.replace(/\/+$/, '')
412
447
  : TOKEN_QUOTA_DEFAULT_TRANSCRIBE.baseURL,
413
- apiKeyEnv: typeof doc.transcribe?.apiKeyEnv === 'string' && doc.transcribe.apiKeyEnv !== ''
414
- ? doc.transcribe.apiKeyEnv
448
+ apiKeyEnv: typeof transcribe?.apiKeyEnv === 'string' && transcribe.apiKeyEnv !== ''
449
+ ? transcribe.apiKeyEnv
415
450
  : TOKEN_QUOTA_DEFAULT_TRANSCRIBE.apiKeyEnv,
416
- model: typeof doc.transcribe?.model === 'string' && doc.transcribe.model !== ''
417
- ? doc.transcribe.model
451
+ model: typeof transcribe?.model === 'string' && transcribe.model !== ''
452
+ ? transcribe.model
418
453
  : TOKEN_QUOTA_DEFAULT_TRANSCRIBE.model,
419
454
  },
420
455
  music: {
421
- enabled: doc.music?.enabled ?? TOKEN_QUOTA_DEFAULT_MUSIC.enabled,
422
- volume: doc.music?.volume ?? TOKEN_QUOTA_DEFAULT_MUSIC.volume,
423
- style: doc.music?.style ?? TOKEN_QUOTA_DEFAULT_MUSIC.style,
424
- onlyCurrentSession: doc.music?.onlyCurrentSession ?? TOKEN_QUOTA_DEFAULT_MUSIC.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,
425
460
  },
426
- notes: Array.isArray(doc.notes) ? doc.notes.slice(0, TOKEN_QUOTA_MAX_NOTES) : [],
427
- ...doc.reset !== undefined && doc.reset !== null ? { reset: doc.reset } : {},
461
+ notes: Array.isArray(notes) ? notes.slice(0, TOKEN_QUOTA_MAX_NOTES) : [],
462
+ ...resetValue !== undefined && resetValue !== null ? { reset: resetValue } : {},
428
463
  };
429
464
  this.resolvedSettings = settings;
430
465
  // Live-apply the parts the service acts on.
@@ -516,6 +551,11 @@ export class TokenQuotaService extends Service {
516
551
  // entry, and the live-apply work that used to hang off `installSection`'s
517
552
  // onChange callback happens once per instantiation instead.
518
553
  this.applySettings(config);
554
+ ctx
555
+ .on('loader/volatile-update', () => {
556
+ if (this.runtimeConfig !== undefined)
557
+ this.applySettings(this.runtimeConfig);
558
+ });
519
559
  // Snapshot route: optional — only mounted when a webServer service exists
520
560
  // (the Web profile); headless deployments keep the enforcement without it.
521
561
  this.tryMountRoute();
@@ -850,12 +890,29 @@ export class TokenQuotaService extends Service {
850
890
  // version dropped `settings.get(ns)`, so read the composed configuration
851
891
  // once from the config editor and index it by profile entry id.
852
892
  const configEditor = this.ctx.get('configEditor');
893
+ // Provider profiles live in another plugin entry's config (the profile's
894
+ // `providers` map). Which of the composed layers carries it depends on the
895
+ // deployment (user patch layer vs inherited base), so take the first layer
896
+ // that actually has a `providers` map and fall back to the entry's own
897
+ // config. Reading only one layer silently finds no providers at all.
898
+ const profileOf = (row) => {
899
+ const layers = [row.override, row.inherited, row.entry?.fiber?.config, row.entry?.options?.config];
900
+ for (const layer of layers) {
901
+ if (layer !== null && typeof layer === 'object' && 'providers' in layer)
902
+ return layer;
903
+ }
904
+ for (const layer of layers) {
905
+ if (layer !== null && typeof layer === 'object')
906
+ return layer;
907
+ }
908
+ return undefined;
909
+ };
853
910
  const liveConfigs = new Map();
854
911
  try {
855
912
  for (const row of configEditor?.configuration() ?? []) {
856
- const id = row.entry.options.id;
913
+ const id = row.entry?.options?.id;
857
914
  if (id !== undefined)
858
- liveConfigs.set(id, row.entry.options.config);
915
+ liveConfigs.set(id, profileOf(row));
859
916
  }
860
917
  }
861
918
  catch {
@@ -889,11 +946,15 @@ export class TokenQuotaService extends Service {
889
946
  ? record.baseURL
890
947
  : undefined;
891
948
  const kind = balanceKindOf(entry.provider, keyEnv, baseURL);
892
- if (kind === undefined || keyEnv === undefined)
949
+ if (kind === undefined)
893
950
  continue;
951
+ // A provider may legitimately declare no apiKeyEnv (the adapter then
952
+ // resolves its family default); query that same reference rather than
953
+ // dropping the provider from the balance window.
954
+ const balanceKeyEnv = keyEnv ?? DEFAULT_BALANCE_KEY_ENV[kind];
894
955
  found.set(entry.provider, {
895
956
  provider: entry.provider,
896
- keyEnv,
957
+ keyEnv: balanceKeyEnv,
897
958
  baseURL: baseURL ?? (kind === 'deepseek' ? `https://${DEEPSEEK_BALANCE_HOST}` : `https://${TEAMOROUTER_HOST}`),
898
959
  kind,
899
960
  });
@@ -904,6 +965,14 @@ export class TokenQuotaService extends Service {
904
965
  }
905
966
  if (found.size === 0)
906
967
  found.set('deepseek', fallback());
968
+ // One line per discovery pass, so a deployment can be checked from the
969
+ // terminal that runs `dsh web` instead of guessing from the panel.
970
+ try {
971
+ this.ctx.logger?.info(`token-quota: balance sources = ${[...found.values()].map(source => `${source.provider}(${source.kind})`).join(', ')}`);
972
+ }
973
+ catch {
974
+ // Logging is best-effort.
975
+ }
907
976
  return found;
908
977
  }
909
978
  /**
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.52",
4
+ "version": "0.1.55",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },