@jxgame2020/dsh-token-quota 0.1.7 → 0.1.11

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
@@ -35,6 +35,10 @@ window.__ModuleLoader__.load({
35
35
  error: null,
36
36
  monitored: null,
37
37
  onFull: "stop",
38
+ checkUpdates: true,
39
+ upgrade: null,
40
+ upgradeDismissed: false,
41
+ checkingUpdates: false,
38
42
  dialogOpen: false,
39
43
  fullNotice: null,
40
44
  reset: null,
@@ -59,6 +63,19 @@ window.__ModuleLoader__.load({
59
63
  d.monitored = monitored;
60
64
  d.onFull = onFull;
61
65
  },
66
+ setCheckUpdates: (d, checkUpdates) => {
67
+ d.checkUpdates = checkUpdates;
68
+ },
69
+ setUpgrade: (d, upgrade) => {
70
+ if (d.upgrade === null || d.upgrade.latestVersion !== upgrade?.latestVersion) d.upgradeDismissed = false;
71
+ d.upgrade = upgrade;
72
+ },
73
+ setUpgradeDismissed: (d, dismissed) => {
74
+ d.upgradeDismissed = dismissed;
75
+ },
76
+ setCheckingUpdates: (d, checking) => {
77
+ d.checkingUpdates = checking;
78
+ },
62
79
  setDialogOpen: (d, open) => {
63
80
  d.dialogOpen = open;
64
81
  },
@@ -119,7 +136,7 @@ window.__ModuleLoader__.load({
119
136
  }
120
137
  //#endregion
121
138
  //#region \0dsh-css:/Users/jxgame/Desktop/works/deepseek-harness-package/dsh-token-quota/packages/token-quota/src/client/TokenQuotaPanel.module.css.mjs
122
- const css = ".NPLLIq_panel{box-sizing:border-box;background:var(--dsw-alias-bg-overlay);border:1px solid var(--dsw-alias-border-l1);pointer-events:auto;z-index:40;border-radius:12px;flex-direction:column;width:320px;max-height:min(72vh,560px);display:flex;position:fixed;top:56px;right:12px;overflow:hidden;box-shadow:0 8px 28px #0000002e}.NPLLIq_header{border-bottom:1px solid var(--dsw-alias-border-l1);cursor:grab;user-select:none;touch-action:none;justify-content:space-between;align-items:flex-start;gap:8px;padding:10px 12px;display:flex}.NPLLIq_header:active{cursor:grabbing}.NPLLIq_headerText{flex-direction:column;gap:2px;min-width:0;display:flex}.NPLLIq_title{color:var(--dsw-alias-label-primary);font-size:13px;font-weight:600}.NPLLIq_subtitle{color:var(--dsw-alias-label-secondary);font-size:11px}.NPLLIq_collapse{color:var(--dsw-alias-label-secondary);cursor:pointer;background:0 0;border:none;border-radius:6px;flex:none;padding:2px 6px;font-size:11px}.NPLLIq_collapse:hover{color:var(--dsw-alias-label-primary);background:var(--dsw-alias-bg-layer-1)}.NPLLIq_body{padding:4px 0;overflow-y:auto}.NPLLIq_row{border-bottom:1px solid var(--dsw-alias-border-l1);flex-direction:column;gap:6px;padding:8px 12px;display:flex}.NPLLIq_rowHeader{justify-content:space-between;align-items:center;gap:8px;display:flex}.NPLLIq_rowName{color:var(--dsw-alias-label-primary);text-overflow:ellipsis;white-space:nowrap;align-items:center;gap:6px;font-size:12px;font-weight:500;display:inline-flex;overflow:hidden}.NPLLIq_currentBadge{color:var(--dsw-alias-state-success-primary);border:1px solid var(--dsw-alias-state-success-primary);border-radius:8px;flex:none;padding:1px 6px;font-size:10px}.NPLLIq_rowMeta{color:var(--dsw-alias-label-secondary);font-variant-numeric:tabular-nums;flex:none;font-size:11px}.NPLLIq_bar{background:var(--dsw-alias-bg-layer-1);border-radius:3px;height:6px;overflow:hidden}.NPLLIq_fillIdle{background:var(--dsw-alias-brand-primary);height:100%;transition:width .2s}.NPLLIq_fillWarn{background:var(--dsw-alias-state-warn-primary);height:100%;transition:width .2s}.NPLLIq_fillOver{background:var(--dsw-alias-state-error-primary);height:100%;transition:width .2s}.NPLLIq_controls{align-items:center;gap:6px;display:flex}.NPLLIq_input{border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-layer-1);min-width:0;color:var(--dsw-alias-label-primary);border-radius:6px;flex:1;padding:4px 8px;font-size:11px}.NPLLIq_input::placeholder{color:var(--dsw-alias-label-secondary)}.NPLLIq_save,.NPLLIq_switch{border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-layer-1);color:var(--dsw-alias-label-primary);cursor:pointer;border-radius:6px;flex:none;padding:4px 10px;font-size:11px}.NPLLIq_save:hover,.NPLLIq_switch:hover:not(:disabled){background:var(--dsw-alias-bg-layer-2)}.NPLLIq_switch:disabled{opacity:.5;cursor:default}.NPLLIq_notice,.NPLLIq_noticeError{color:var(--dsw-alias-label-secondary);padding:10px 12px;font-size:12px}.NPLLIq_noticeError{color:var(--dsw-alias-state-error-primary)}.NPLLIq_tab{background:var(--dsw-alias-brand-primary);border:1px solid var(--dsw-alias-brand-primary);color:var(--dsw-alias-bg-overlay);pointer-events:auto;cursor:pointer;z-index:90;border-radius:10px;align-items:center;gap:6px;padding:9px 14px;font-size:12px;font-weight:600;display:inline-flex;position:fixed;top:56px;right:12px;box-shadow:0 6px 20px #00000040}.NPLLIq_tab:hover{filter:brightness(1.08)}.NPLLIq_tabIcon{font-size:12px;line-height:1}.NPLLIq_tabLabel{white-space:nowrap}.NPLLIq_headerActions{flex:none;align-items:center;gap:4px;display:flex}.NPLLIq_settingsBtn{color:var(--dsw-alias-label-secondary);cursor:pointer;background:0 0;border:none;border-radius:6px;flex:none;padding:2px 6px;font-size:11px}.NPLLIq_settingsBtn:hover{color:var(--dsw-alias-label-primary);background:var(--dsw-alias-bg-layer-1)}.NPLLIq_selectBtn{border:1px solid var(--dsw-alias-border-l1);color:var(--dsw-alias-brand-primary);cursor:pointer;background:0 0;border-radius:6px;flex:none;padding:1px 6px;font-size:10px}.NPLLIq_selectBtn:hover{background:var(--dsw-alias-bg-layer-1)}.NPLLIq_gearBtn{color:var(--dsw-alias-label-secondary);cursor:pointer;background:0 0;border:none;flex:none;margin-left:6px;padding:0 2px;font-size:12px;line-height:1}.NPLLIq_gearBtn:hover{color:var(--dsw-alias-label-primary)}.NPLLIq_fullNotice{color:var(--dsw-alias-state-error-primary);background:var(--dsw-alias-bg-layer-1);border:1px solid var(--dsw-alias-state-error-primary);border-radius:8px;margin:6px 12px;padding:8px 10px;font-size:12px}.NPLLIq_dialog{z-index:100;box-sizing:border-box;background:var(--dsw-alias-bg-overlay);border:1px solid var(--dsw-alias-border-l1);border-radius:12px;flex-direction:column;gap:12px;width:280px;max-height:80vh;padding:14px;display:flex;position:fixed;top:50%;left:50%;overflow-y:auto;transform:translate(-50%,-50%);box-shadow:0 8px 28px #00000040}.NPLLIq_dialogTitle{color:var(--dsw-alias-label-primary);font-size:13px;font-weight:600}.NPLLIq_dialogSection{flex-direction:column;gap:6px;display:flex}.NPLLIq_dialogLabel{color:var(--dsw-alias-label-primary);font-size:12px;font-weight:500}.NPLLIq_monitorHint{color:var(--dsw-alias-label-secondary);font-size:11px}.NPLLIq_monitorList{flex-direction:column;gap:2px;max-height:180px;display:flex;overflow-y:auto}.NPLLIq_monitorRow{color:var(--dsw-alias-label-primary);cursor:pointer;border-radius:6px;align-items:center;gap:6px;padding:2px 4px;font-size:12px;display:flex}.NPLLIq_monitorRow:hover{background:var(--dsw-alias-bg-layer-1)}.NPLLIq_monitorName{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.NPLLIq_radioRow{color:var(--dsw-alias-label-primary);cursor:pointer;border-radius:6px;align-items:center;gap:6px;padding:3px 4px;font-size:12px;display:flex}.NPLLIq_radioRow:hover{background:var(--dsw-alias-bg-layer-1)}.NPLLIq_dialogActions{justify-content:flex-end;gap:6px;display:flex}.NPLLIq_dialogBtn,.NPLLIq_dialogBtnPrimary{border:1px solid var(--dsw-alias-border-l1);cursor:pointer;border-radius:6px;padding:4px 12px;font-size:11px}.NPLLIq_dialogBtn{background:var(--dsw-alias-bg-layer-1);color:var(--dsw-alias-label-primary)}.NPLLIq_dialogBtnPrimary{background:var(--dsw-alias-brand-primary);border-color:var(--dsw-alias-brand-primary);color:var(--dsw-alias-bg-overlay)}.NPLLIq_dialogHeader{z-index:2;background:var(--dsw-alias-bg-overlay);cursor:grab;user-select:none;touch-action:none;justify-content:space-between;align-items:center;gap:8px;margin:-14px -14px 0;padding:14px 14px 8px;display:flex;position:sticky;top:-14px}.NPLLIq_dialogHeader:active{cursor:grabbing}.NPLLIq_dialogClose{width:28px;height:28px;color:var(--dsw-alias-label-secondary);cursor:pointer;background:0 0;border:none;border-radius:8px;flex:none;justify-content:center;align-items:center;font-size:18px;line-height:1;display:flex}.NPLLIq_dialogClose:hover{color:var(--dsw-alias-label-primary);background:var(--dsw-alias-bg-layer-1)}.NPLLIq_resetRow{flex-wrap:wrap;align-items:center;gap:6px;display:flex}.NPLLIq_resetSelect{border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-layer-1);color:var(--dsw-alias-label-primary);border-radius:6px;padding:3px 6px;font-size:12px}.NPLLIq_logTable{border-collapse:collapse;width:100%;font-size:11px}.NPLLIq_logTable th{text-align:left;color:var(--dsw-alias-label-secondary);border-bottom:1px solid var(--dsw-alias-border-l1);padding:4px 6px;font-weight:500}.NPLLIq_logTable td{color:var(--dsw-alias-label-primary);border-bottom:1px solid var(--dsw-alias-border-l1);font-variant-numeric:tabular-nums;padding:4px 6px}.NPLLIq_logDayCol{white-space:nowrap;color:var(--dsw-alias-label-secondary)}.NPLLIq_logModelCol{text-overflow:ellipsis;white-space:nowrap;max-width:160px;overflow:hidden}.NPLLIq_logUsedCol{text-align:right}.NPLLIq_logDialog{gap:0;width:380px;max-height:min(72vh,480px);padding:0}.NPLLIq_logHeader{background:var(--dsw-alias-bg-overlay);cursor:grab;user-select:none;touch-action:none;flex:none;justify-content:space-between;align-items:center;gap:8px;padding:14px 14px 8px;display:flex}.NPLLIq_logHeader:active{cursor:grabbing}.NPLLIq_logScroll{flex:1;min-height:0;padding:0 14px 14px;overflow:auto}";
139
+ const css = ".NPLLIq_panel{box-sizing:border-box;background:var(--dsw-alias-bg-overlay);border:1px solid var(--dsw-alias-border-l1);pointer-events:auto;z-index:40;border-radius:12px;flex-direction:column;width:320px;max-height:min(72vh,560px);display:flex;position:fixed;top:56px;right:12px;overflow:hidden;box-shadow:0 8px 28px #0000002e}.NPLLIq_header{border-bottom:1px solid var(--dsw-alias-border-l1);cursor:grab;user-select:none;touch-action:none;justify-content:space-between;align-items:flex-start;gap:8px;padding:10px 12px;display:flex}.NPLLIq_header:active{cursor:grabbing}.NPLLIq_headerText{flex-direction:column;gap:2px;min-width:0;display:flex}.NPLLIq_title{color:var(--dsw-alias-label-primary);align-items:baseline;gap:6px;font-size:13px;font-weight:600;display:flex}.NPLLIq_version{color:var(--dsw-alias-label-secondary);white-space:nowrap;font-size:10px;font-weight:500}.NPLLIq_versionNew{color:var(--dsw-alias-status-warning-foreground,#b56900);background:var(--dsw-alias-status-warning-background,#fff6d7);cursor:default;border-radius:4px;padding:1px 6px}.NPLLIq_subtitle{color:var(--dsw-alias-label-secondary);font-size:11px}.NPLLIq_collapse{color:var(--dsw-alias-label-secondary);cursor:pointer;background:0 0;border:none;border-radius:6px;flex:none;padding:2px 6px;font-size:11px}.NPLLIq_collapse:hover{color:var(--dsw-alias-label-primary);background:var(--dsw-alias-bg-layer-1)}.NPLLIq_body{padding:4px 0;overflow-y:auto}.NPLLIq_row{border-bottom:1px solid var(--dsw-alias-border-l1);flex-direction:column;gap:6px;padding:8px 12px;display:flex}.NPLLIq_rowHeader{justify-content:space-between;align-items:center;gap:8px;display:flex}.NPLLIq_rowName{color:var(--dsw-alias-label-primary);text-overflow:ellipsis;white-space:nowrap;align-items:center;gap:6px;font-size:12px;font-weight:500;display:inline-flex;overflow:hidden}.NPLLIq_currentBadge{color:var(--dsw-alias-state-success-primary);border:1px solid var(--dsw-alias-state-success-primary);border-radius:8px;flex:none;padding:1px 6px;font-size:10px}.NPLLIq_rowMeta{color:var(--dsw-alias-label-secondary);font-variant-numeric:tabular-nums;flex:none;font-size:11px}.NPLLIq_bar{background:var(--dsw-alias-bg-layer-1);border-radius:3px;height:6px;overflow:hidden}.NPLLIq_fillIdle{background:var(--dsw-alias-brand-primary);height:100%;transition:width .2s}.NPLLIq_fillWarn{background:var(--dsw-alias-state-warn-primary);height:100%;transition:width .2s}.NPLLIq_fillOver{background:var(--dsw-alias-state-error-primary);height:100%;transition:width .2s}.NPLLIq_controls{align-items:center;gap:6px;display:flex}.NPLLIq_input{border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-layer-1);min-width:0;color:var(--dsw-alias-label-primary);border-radius:6px;flex:1;padding:4px 8px;font-size:11px}.NPLLIq_input::placeholder{color:var(--dsw-alias-label-secondary)}.NPLLIq_save,.NPLLIq_switch{border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-layer-1);color:var(--dsw-alias-label-primary);cursor:pointer;border-radius:6px;flex:none;padding:4px 10px;font-size:11px}.NPLLIq_save:hover,.NPLLIq_switch:hover:not(:disabled){background:var(--dsw-alias-bg-layer-2)}.NPLLIq_switch:disabled{opacity:.5;cursor:default}.NPLLIq_notice,.NPLLIq_noticeError{color:var(--dsw-alias-label-secondary);padding:10px 12px;font-size:12px}.NPLLIq_noticeError{color:var(--dsw-alias-state-error-primary)}.NPLLIq_tab{background:var(--dsw-alias-brand-primary);border:1px solid var(--dsw-alias-brand-primary);color:var(--dsw-alias-bg-overlay);pointer-events:auto;cursor:pointer;z-index:90;border-radius:10px;align-items:center;gap:6px;padding:9px 14px;font-size:12px;font-weight:600;display:inline-flex;position:fixed;top:56px;right:12px;box-shadow:0 6px 20px #00000040}.NPLLIq_tab:hover{filter:brightness(1.08)}.NPLLIq_tabIcon{font-size:12px;line-height:1}.NPLLIq_tabLabel{white-space:nowrap}.NPLLIq_headerActions{flex:none;align-items:center;gap:4px;display:flex}.NPLLIq_settingsBtn{color:var(--dsw-alias-label-secondary);cursor:pointer;background:0 0;border:none;border-radius:6px;flex:none;padding:2px 6px;font-size:11px}.NPLLIq_settingsBtn:hover{color:var(--dsw-alias-label-primary);background:var(--dsw-alias-bg-layer-1)}.NPLLIq_selectBtn{border:1px solid var(--dsw-alias-border-l1);color:var(--dsw-alias-brand-primary);cursor:pointer;background:0 0;border-radius:6px;flex:none;padding:1px 6px;font-size:10px}.NPLLIq_selectBtn:hover{background:var(--dsw-alias-bg-layer-1)}.NPLLIq_gearBtn{color:var(--dsw-alias-label-secondary);cursor:pointer;background:0 0;border:none;flex:none;margin-left:6px;padding:0 2px;font-size:12px;line-height:1}.NPLLIq_gearBtn:hover{color:var(--dsw-alias-label-primary)}.NPLLIq_fullNotice{color:var(--dsw-alias-state-error-primary);background:var(--dsw-alias-bg-layer-1);border:1px solid var(--dsw-alias-state-error-primary);border-radius:8px;margin:6px 12px;padding:8px 10px;font-size:12px}.NPLLIq_upgradeBanner{color:var(--dsw-alias-label-primary);background:var(--dsw-alias-bg-layer-1);border:1px solid var(--dsw-alias-divider-1,#0000001a);border-radius:8px;margin:6px 12px;padding:10px 30px 10px 10px;font-size:12px;position:relative}.NPLLIq_upgradeBannerText{margin-bottom:6px;font-weight:600}.NPLLIq_upgradeCommands{flex-direction:column;gap:4px;display:flex}.NPLLIq_upgradeCommandRow{align-items:center;gap:6px;display:flex}.NPLLIq_upgradeCommand{background:var(--dsw-alias-bg-layer-2,#0000000a);white-space:nowrap;border-radius:4px;flex:1;min-width:0;padding:4px 6px;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:11px;overflow-x:auto}.NPLLIq_copyBtn{border:1px solid var(--dsw-alias-divider-1,#00000026);background:var(--dsw-alias-bg-layer-2,#0000000a);color:var(--dsw-alias-label-primary);cursor:pointer;border-radius:4px;flex:none;padding:3px 8px;font-size:11px}.NPLLIq_copyBtn:hover{background:var(--dsw-alias-bg-layer-3,#00000014)}.NPLLIq_upgradeHint{color:var(--dsw-alias-label-secondary);margin-top:6px;font-size:11px}.NPLLIq_upgradeClose{width:20px;height:20px;color:var(--dsw-alias-label-secondary);cursor:pointer;background:0 0;border:none;border-radius:4px;font-size:16px;line-height:1;position:absolute;top:4px;right:6px}.NPLLIq_upgradeClose:hover{background:var(--dsw-alias-bg-layer-2,#0000000a);color:var(--dsw-alias-label-primary)}.NPLLIq_checkUpdatesRow{align-items:center;gap:8px;margin-top:8px;display:flex}.NPLLIq_checkBtn{border:1px solid var(--dsw-alias-divider-1,#00000026);background:var(--dsw-alias-bg-layer-2,#0000000a);color:var(--dsw-alias-label-primary);cursor:pointer;border-radius:4px;padding:4px 10px;font-size:12px}.NPLLIq_checkBtn:hover:not(:disabled){background:var(--dsw-alias-bg-layer-3,#00000014)}.NPLLIq_checkBtn:disabled{opacity:.6;cursor:default}.NPLLIq_dialog{z-index:100;box-sizing:border-box;background:var(--dsw-alias-bg-overlay);border:1px solid var(--dsw-alias-border-l1);border-radius:12px;flex-direction:column;gap:12px;width:280px;max-height:80vh;padding:14px;display:flex;position:fixed;top:50%;left:50%;overflow-y:auto;transform:translate(-50%,-50%);box-shadow:0 8px 28px #00000040}.NPLLIq_dialogTitle{color:var(--dsw-alias-label-primary);font-size:13px;font-weight:600}.NPLLIq_dialogSection{flex-direction:column;gap:6px;display:flex}.NPLLIq_dialogLabel{color:var(--dsw-alias-label-primary);font-size:12px;font-weight:500}.NPLLIq_monitorHint{color:var(--dsw-alias-label-secondary);font-size:11px}.NPLLIq_monitorList{flex-direction:column;gap:2px;max-height:180px;display:flex;overflow-y:auto}.NPLLIq_monitorRow{color:var(--dsw-alias-label-primary);cursor:pointer;border-radius:6px;align-items:center;gap:6px;padding:2px 4px;font-size:12px;display:flex}.NPLLIq_monitorRow:hover{background:var(--dsw-alias-bg-layer-1)}.NPLLIq_monitorName{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.NPLLIq_radioRow{color:var(--dsw-alias-label-primary);cursor:pointer;border-radius:6px;align-items:center;gap:6px;padding:3px 4px;font-size:12px;display:flex}.NPLLIq_radioRow:hover{background:var(--dsw-alias-bg-layer-1)}.NPLLIq_dialogActions{justify-content:flex-end;gap:6px;display:flex}.NPLLIq_dialogBtn,.NPLLIq_dialogBtnPrimary{border:1px solid var(--dsw-alias-border-l1);cursor:pointer;border-radius:6px;padding:4px 12px;font-size:11px}.NPLLIq_dialogBtn{background:var(--dsw-alias-bg-layer-1);color:var(--dsw-alias-label-primary)}.NPLLIq_dialogBtnPrimary{background:var(--dsw-alias-brand-primary);border-color:var(--dsw-alias-brand-primary);color:var(--dsw-alias-bg-overlay)}.NPLLIq_dialogHeader{z-index:2;background:var(--dsw-alias-bg-overlay);cursor:grab;user-select:none;touch-action:none;justify-content:space-between;align-items:center;gap:8px;margin:-14px -14px 0;padding:14px 14px 8px;display:flex;position:sticky;top:-14px}.NPLLIq_dialogHeader:active{cursor:grabbing}.NPLLIq_dialogClose{width:28px;height:28px;color:var(--dsw-alias-label-secondary);cursor:pointer;background:0 0;border:none;border-radius:8px;flex:none;justify-content:center;align-items:center;font-size:18px;line-height:1;display:flex}.NPLLIq_dialogClose:hover{color:var(--dsw-alias-label-primary);background:var(--dsw-alias-bg-layer-1)}.NPLLIq_resetRow{flex-wrap:wrap;align-items:center;gap:6px;display:flex}.NPLLIq_resetSelect{border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-layer-1);color:var(--dsw-alias-label-primary);border-radius:6px;padding:3px 6px;font-size:12px}.NPLLIq_logTable{border-collapse:collapse;width:100%;font-size:11px}.NPLLIq_logTable th{text-align:left;color:var(--dsw-alias-label-secondary);border-bottom:1px solid var(--dsw-alias-border-l1);padding:4px 6px;font-weight:500}.NPLLIq_logTable td{color:var(--dsw-alias-label-primary);border-bottom:1px solid var(--dsw-alias-border-l1);font-variant-numeric:tabular-nums;padding:4px 6px}.NPLLIq_logDayCol{white-space:nowrap;color:var(--dsw-alias-label-secondary)}.NPLLIq_logModelCol{text-overflow:ellipsis;white-space:nowrap;max-width:160px;overflow:hidden}.NPLLIq_logUsedCol{text-align:right}.NPLLIq_logDialog{gap:0;width:380px;max-height:min(72vh,480px);padding:0}.NPLLIq_logHeader{background:var(--dsw-alias-bg-overlay);cursor:grab;user-select:none;touch-action:none;flex:none;justify-content:space-between;align-items:center;gap:8px;padding:14px 14px 8px;display:flex}.NPLLIq_logHeader:active{cursor:grabbing}.NPLLIq_logScroll{flex:1;min-height:0;padding:0 14px 14px;overflow:auto}";
123
140
  const tagId = "@jxgame2020/dsh-token-quota/TokenQuotaPanel.module.css";
124
141
  if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId) + "]") === null) {
125
142
  const tag = document.createElement("style");
@@ -129,59 +146,71 @@ window.__ModuleLoader__.load({
129
146
  document.head.appendChild(tag);
130
147
  }
131
148
  var TokenQuotaPanel_module_css_default = {
132
- "fillOver": "NPLLIq_fillOver",
133
- "fillIdle": "NPLLIq_fillIdle",
134
149
  "monitorList": "NPLLIq_monitorList",
135
- "switch": "NPLLIq_switch",
136
- "subtitle": "NPLLIq_subtitle",
137
- "monitorName": "NPLLIq_monitorName",
138
- "currentBadge": "NPLLIq_currentBadge",
139
- "collapse": "NPLLIq_collapse",
140
- "row": "NPLLIq_row",
141
- "fillWarn": "NPLLIq_fillWarn",
142
- "rowHeader": "NPLLIq_rowHeader",
143
- "input": "NPLLIq_input",
144
- "radioRow": "NPLLIq_radioRow",
145
- "logHeader": "NPLLIq_logHeader",
150
+ "dialogClose": "NPLLIq_dialogClose",
151
+ "controls": "NPLLIq_controls",
152
+ "tabIcon": "NPLLIq_tabIcon",
146
153
  "logModelCol": "NPLLIq_logModelCol",
147
- "logDayCol": "NPLLIq_logDayCol",
148
- "dialogBtn": "NPLLIq_dialogBtn",
149
- "dialogActions": "NPLLIq_dialogActions",
150
- "logDialog": "NPLLIq_logDialog",
151
- "notice": "NPLLIq_notice",
152
- "tabLabel": "NPLLIq_tabLabel",
153
- "dialog": "NPLLIq_dialog",
154
- "logScroll": "NPLLIq_logScroll",
155
- "resetRow": "NPLLIq_resetRow",
156
154
  "rowMeta": "NPLLIq_rowMeta",
157
- "tab": "NPLLIq_tab",
155
+ "fillOver": "NPLLIq_fillOver",
156
+ "copyBtn": "NPLLIq_copyBtn",
157
+ "checkBtn": "NPLLIq_checkBtn",
158
+ "radioRow": "NPLLIq_radioRow",
159
+ "headerText": "NPLLIq_headerText",
160
+ "dialogBtn": "NPLLIq_dialogBtn",
161
+ "checkUpdatesRow": "NPLLIq_checkUpdatesRow",
162
+ "currentBadge": "NPLLIq_currentBadge",
163
+ "header": "NPLLIq_header",
158
164
  "monitorHint": "NPLLIq_monitorHint",
159
- "title": "NPLLIq_title",
160
- "noticeError": "NPLLIq_noticeError",
165
+ "resetRow": "NPLLIq_resetRow",
166
+ "subtitle": "NPLLIq_subtitle",
167
+ "logTable": "NPLLIq_logTable",
168
+ "selectBtn": "NPLLIq_selectBtn",
169
+ "logHeader": "NPLLIq_logHeader",
170
+ "dialog": "NPLLIq_dialog",
161
171
  "monitorRow": "NPLLIq_monitorRow",
162
- "dialogBtnPrimary": "NPLLIq_dialogBtnPrimary",
163
- "tabIcon": "NPLLIq_tabIcon",
172
+ "tab": "NPLLIq_tab",
173
+ "settingsBtn": "NPLLIq_settingsBtn",
174
+ "upgradeBanner": "NPLLIq_upgradeBanner",
164
175
  "rowName": "NPLLIq_rowName",
165
- "save": "NPLLIq_save",
176
+ "dialogLabel": "NPLLIq_dialogLabel",
177
+ "fillIdle": "NPLLIq_fillIdle",
178
+ "dialogActions": "NPLLIq_dialogActions",
179
+ "collapse": "NPLLIq_collapse",
180
+ "panel": "NPLLIq_panel",
181
+ "resetSelect": "NPLLIq_resetSelect",
182
+ "fillWarn": "NPLLIq_fillWarn",
166
183
  "fullNotice": "NPLLIq_fullNotice",
167
- "dialogClose": "NPLLIq_dialogClose",
168
- "header": "NPLLIq_header",
184
+ "monitorName": "NPLLIq_monitorName",
185
+ "switch": "NPLLIq_switch",
186
+ "dialogBtnPrimary": "NPLLIq_dialogBtnPrimary",
187
+ "versionNew": "NPLLIq_versionNew",
188
+ "row": "NPLLIq_row",
189
+ "input": "NPLLIq_input",
169
190
  "bar": "NPLLIq_bar",
170
- "dialogHeader": "NPLLIq_dialogHeader",
171
- "headerText": "NPLLIq_headerText",
172
- "selectBtn": "NPLLIq_selectBtn",
173
- "resetSelect": "NPLLIq_resetSelect",
174
- "logTable": "NPLLIq_logTable",
175
- "panel": "NPLLIq_panel",
176
- "controls": "NPLLIq_controls",
191
+ "noticeError": "NPLLIq_noticeError",
192
+ "tabLabel": "NPLLIq_tabLabel",
193
+ "dialogTitle": "NPLLIq_dialogTitle",
177
194
  "headerActions": "NPLLIq_headerActions",
195
+ "upgradeCommands": "NPLLIq_upgradeCommands",
196
+ "upgradeBannerText": "NPLLIq_upgradeBannerText",
197
+ "upgradeHint": "NPLLIq_upgradeHint",
198
+ "save": "NPLLIq_save",
199
+ "version": "NPLLIq_version",
200
+ "rowHeader": "NPLLIq_rowHeader",
178
201
  "body": "NPLLIq_body",
179
- "settingsBtn": "NPLLIq_settingsBtn",
202
+ "upgradeCommand": "NPLLIq_upgradeCommand",
203
+ "logDialog": "NPLLIq_logDialog",
204
+ "title": "NPLLIq_title",
205
+ "dialogHeader": "NPLLIq_dialogHeader",
206
+ "upgradeCommandRow": "NPLLIq_upgradeCommandRow",
180
207
  "gearBtn": "NPLLIq_gearBtn",
208
+ "upgradeClose": "NPLLIq_upgradeClose",
209
+ "logScroll": "NPLLIq_logScroll",
181
210
  "logUsedCol": "NPLLIq_logUsedCol",
182
- "dialogTitle": "NPLLIq_dialogTitle",
211
+ "notice": "NPLLIq_notice",
183
212
  "dialogSection": "NPLLIq_dialogSection",
184
- "dialogLabel": "NPLLIq_dialogLabel"
213
+ "logDayCol": "NPLLIq_logDayCol"
185
214
  };
186
215
  //#endregion
187
216
  //#region lib/types/client/TokenQuotaPanel.js
@@ -268,7 +297,7 @@ window.__ModuleLoader__.load({
268
297
  * @param props - composed slot props.
269
298
  * @returns the panel element tree.
270
299
  */
271
- function TokenQuotaPanel({ t, load, setLimit, selectModel, setMonitored, setOnFull, setReset, useStore, actions, useSessions }) {
300
+ function TokenQuotaPanel({ t, load, setLimit, selectModel, setMonitored, setOnFull, setReset, setCheckUpdates, checkUpdatesNow, useStore, actions, useSessions }) {
272
301
  const [collapsed, setCollapsed] = (0, react.useState)(false);
273
302
  const [drafts, setDrafts] = (0, react.useState)({});
274
303
  const [editingKey, setEditingKey] = (0, react.useState)(null);
@@ -290,6 +319,10 @@ window.__ModuleLoader__.load({
290
319
  const current = useStore((s) => s.current);
291
320
  const monitored = useStore((s) => s.monitored);
292
321
  const onFull = useStore((s) => s.onFull);
322
+ const checkUpdates = useStore((s) => s.checkUpdates);
323
+ const upgrade = useStore((s) => s.upgrade);
324
+ const upgradeDismissed = useStore((s) => s.upgradeDismissed);
325
+ const checkingUpdates = useStore((s) => s.checkingUpdates);
293
326
  const reset = useStore((s) => s.reset);
294
327
  const dialogOpen = useStore((s) => s.dialogOpen);
295
328
  const logOpen = useStore((s) => s.logOpen);
@@ -310,6 +343,23 @@ window.__ModuleLoader__.load({
310
343
  name: model.name
311
344
  }))).sort((a, b) => a.key.localeCompare(b.key)), [groups]);
312
345
  const isMonitoredKey = (key) => monitored === null || monitored.includes(key);
346
+ /** Copy text to the clipboard (clipboard API with execCommand fallback). */
347
+ const copyToClipboard = async (text) => {
348
+ try {
349
+ await navigator.clipboard.writeText(text);
350
+ } catch {
351
+ const el = document.createElement("textarea");
352
+ el.value = text;
353
+ el.style.position = "fixed";
354
+ el.style.opacity = "0";
355
+ document.body.appendChild(el);
356
+ el.select();
357
+ try {
358
+ document.execCommand("copy");
359
+ } catch {}
360
+ document.body.removeChild(el);
361
+ }
362
+ };
313
363
  (0, react.useEffect)(() => {
314
364
  if (!logOpen) return;
315
365
  let cancelled = false;
@@ -376,9 +426,21 @@ window.__ModuleLoader__.load({
376
426
  },
377
427
  children: [(0, react_jsx_runtime.jsxs)("div", {
378
428
  className: TokenQuotaPanel_module_css_default.headerText,
379
- children: [(0, react_jsx_runtime.jsx)("div", {
429
+ children: [(0, react_jsx_runtime.jsxs)("div", {
380
430
  className: TokenQuotaPanel_module_css_default.title,
381
- children: t("title")
431
+ children: [t("title"), upgrade !== null ? (0, react_jsx_runtime.jsxs)("span", {
432
+ className: `${TokenQuotaPanel_module_css_default.version} ${TokenQuotaPanel_module_css_default.versionNew}`,
433
+ title: t("upgradeAvailableHint"),
434
+ children: [
435
+ "v",
436
+ "0.1.11",
437
+ " → v",
438
+ upgrade.latestVersion
439
+ ]
440
+ }) : (0, react_jsx_runtime.jsxs)("span", {
441
+ className: TokenQuotaPanel_module_css_default.version,
442
+ children: ["v", "0.1.11"]
443
+ })]
382
444
  }), (0, react_jsx_runtime.jsx)("div", {
383
445
  className: TokenQuotaPanel_module_css_default.subtitle,
384
446
  children: t("subtitle")
@@ -430,6 +492,46 @@ window.__ModuleLoader__.load({
430
492
  role: "alert",
431
493
  children: fullNotice
432
494
  }),
495
+ upgrade !== null && !upgradeDismissed && (0, react_jsx_runtime.jsxs)("div", {
496
+ className: TokenQuotaPanel_module_css_default.upgradeBanner,
497
+ role: "alert",
498
+ children: [
499
+ (0, react_jsx_runtime.jsx)("div", {
500
+ className: TokenQuotaPanel_module_css_default.upgradeBannerText,
501
+ children: t("upgradeAvailable").replace("{version}", upgrade.latestVersion)
502
+ }),
503
+ (0, react_jsx_runtime.jsx)("div", {
504
+ className: TokenQuotaPanel_module_css_default.upgradeCommands,
505
+ children: upgrade.commands.map((cmd) => (0, react_jsx_runtime.jsxs)("div", {
506
+ className: TokenQuotaPanel_module_css_default.upgradeCommandRow,
507
+ children: [(0, react_jsx_runtime.jsx)("code", {
508
+ className: TokenQuotaPanel_module_css_default.upgradeCommand,
509
+ children: cmd
510
+ }), (0, react_jsx_runtime.jsx)("button", {
511
+ type: "button",
512
+ className: TokenQuotaPanel_module_css_default.copyBtn,
513
+ onClick: () => {
514
+ copyToClipboard(cmd);
515
+ },
516
+ children: t("copy")
517
+ })]
518
+ }, cmd))
519
+ }),
520
+ (0, react_jsx_runtime.jsx)("div", {
521
+ className: TokenQuotaPanel_module_css_default.upgradeHint,
522
+ children: t("upgradeHint")
523
+ }),
524
+ (0, react_jsx_runtime.jsx)("button", {
525
+ type: "button",
526
+ className: TokenQuotaPanel_module_css_default.upgradeClose,
527
+ onClick: () => {
528
+ actions.setUpgradeDismissed(true);
529
+ },
530
+ "aria-label": t("close"),
531
+ children: "×"
532
+ })
533
+ ]
534
+ }),
433
535
  !loading && error === null && visibleRows.length === 0 && (0, react_jsx_runtime.jsx)("div", {
434
536
  className: TokenQuotaPanel_module_css_default.notice,
435
537
  children: monitored !== null && monitored.length === 0 ? t("noMonitored") : t("waiting")
@@ -657,6 +759,28 @@ window.__ModuleLoader__.load({
657
759
  ]
658
760
  })
659
761
  ]
762
+ }),
763
+ (0, react_jsx_runtime.jsxs)("div", {
764
+ className: TokenQuotaPanel_module_css_default.dialogSection,
765
+ children: [(0, react_jsx_runtime.jsxs)("label", {
766
+ className: TokenQuotaPanel_module_css_default.radioRow,
767
+ children: [(0, react_jsx_runtime.jsx)("input", {
768
+ type: "checkbox",
769
+ checked: checkUpdates,
770
+ onChange: (event) => {
771
+ setCheckUpdates(event.target.checked);
772
+ }
773
+ }), (0, react_jsx_runtime.jsx)("span", { children: t("checkUpdatesLabel") })]
774
+ }), (0, react_jsx_runtime.jsx)("div", {
775
+ className: TokenQuotaPanel_module_css_default.checkUpdatesRow,
776
+ children: (0, react_jsx_runtime.jsx)("button", {
777
+ type: "button",
778
+ className: TokenQuotaPanel_module_css_default.checkBtn,
779
+ disabled: checkingUpdates,
780
+ onClick: checkUpdatesNow,
781
+ children: checkingUpdates ? t("checkingUpdates") : t("checkUpdatesNow")
782
+ })
783
+ })]
660
784
  })
661
785
  ]
662
786
  }),
@@ -775,7 +899,14 @@ window.__ModuleLoader__.load({
775
899
  resetLabel: "每日重置时间",
776
900
  resetHint: "选择时区与时间,到点自动清零当日计数",
777
901
  resetOffset: "时区",
778
- resetTime: "时间"
902
+ resetTime: "时间",
903
+ upgradeAvailableHint: "有新版本可用",
904
+ upgradeAvailable: "发现新版本 v{version},请在终端执行以下命令升级:",
905
+ copy: "复制",
906
+ upgradeHint: "升级后请重启 dsh web 并刷新浏览器页面",
907
+ checkUpdatesLabel: "自动检查更新",
908
+ checkUpdatesNow: "立即检查",
909
+ checkingUpdates: "检查中…"
779
910
  };
780
911
  /** English copy. */
781
912
  const en = {
@@ -820,7 +951,14 @@ window.__ModuleLoader__.load({
820
951
  resetLabel: "Daily reset",
821
952
  resetHint: "Pick a timezone and time; counters reset there",
822
953
  resetOffset: "Timezone",
823
- resetTime: "Time"
954
+ resetTime: "Time",
955
+ upgradeAvailableHint: "A new version is available",
956
+ upgradeAvailable: "A new version v{version} is available. Run one of the following commands in your terminal to upgrade:",
957
+ copy: "Copy",
958
+ upgradeHint: "After upgrading, restart dsh web and refresh the browser",
959
+ checkUpdatesLabel: "Check for updates automatically",
960
+ checkUpdatesNow: "Check now",
961
+ checkingUpdates: "Checking…"
824
962
  };
825
963
  //#endregion
826
964
  //#region lib/types/client/index.js
@@ -957,6 +1095,7 @@ window.__ModuleLoader__.load({
957
1095
  lastOnFull = rawOnFull === "switchPriority" ? "switchAll" : rawOnFull;
958
1096
  lastReset = doc?.reset !== void 0 && doc.reset !== null && typeof doc.reset === "object" && typeof doc.reset.offsetHours === "number" ? doc.reset : null;
959
1097
  bound?.setSettings(lastMonitored, lastOnFull);
1098
+ bound?.setCheckUpdates(doc?.checkUpdates ?? true);
960
1099
  bound?.setReset(lastReset);
961
1100
  fetch("/token-quota", { headers: { accept: "application/json" } }).then((response) => {
962
1101
  if (!response.ok) {
@@ -969,6 +1108,7 @@ window.__ModuleLoader__.load({
969
1108
  }).then((snapshot) => {
970
1109
  if (snapshot === void 0) return;
971
1110
  bound?.setSnapshot(snapshot);
1111
+ bound?.setUpgrade(snapshot.upgrade ?? null);
972
1112
  actOnFull(snapshot);
973
1113
  });
974
1114
  if (pullCount % 2 === 0) refreshCurrent();
@@ -1016,6 +1156,30 @@ window.__ModuleLoader__.load({
1016
1156
  bound?.setSettings(lastMonitored, lastOnFull);
1017
1157
  scope.set("onFull", action);
1018
1158
  };
1159
+ const setCheckUpdates = (enabled) => {
1160
+ bound?.setCheckUpdates(enabled);
1161
+ scope.set("checkUpdates", enabled);
1162
+ };
1163
+ /** Ask the Host to check the registry right now, then refresh the snapshot. */
1164
+ const checkUpdatesNow = () => {
1165
+ bound?.setCheckingUpdates(true);
1166
+ fetch("/token-quota/check-updates", { method: "POST" }).then((response) => {
1167
+ if (!response.ok) {
1168
+ bound?.setError(`check-updates route: ${String(response.status)}`);
1169
+ return;
1170
+ }
1171
+ return response.json();
1172
+ }, () => {
1173
+ bound?.setError("update check failed");
1174
+ }).then((snapshot) => {
1175
+ if (snapshot !== void 0) {
1176
+ bound?.setSnapshot(snapshot);
1177
+ bound?.setUpgrade(snapshot.upgrade ?? null);
1178
+ actOnFull(snapshot);
1179
+ }
1180
+ bound?.setCheckingUpdates(false);
1181
+ });
1182
+ };
1019
1183
  const setReset = (reset) => {
1020
1184
  lastReset = reset;
1021
1185
  bound?.setReset(reset);
@@ -1045,7 +1209,9 @@ window.__ModuleLoader__.load({
1045
1209
  selectModel,
1046
1210
  setMonitored,
1047
1211
  setOnFull,
1048
- setReset
1212
+ setReset,
1213
+ setCheckUpdates,
1214
+ checkUpdatesNow
1049
1215
  };
1050
1216
  };
1051
1217
  ctx.slots.inject("shell.overlay", () => ctx.slots.register({