dsh-ustc-quota 1.1.16 → 1.1.17

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/README.md CHANGED
@@ -37,13 +37,13 @@ github:Awenforever/dsh-ustc-quota
37
37
  固定版本(推荐,避免默认分支后续变动):
38
38
 
39
39
  ```text
40
- github:Awenforever/dsh-ustc-quota#v1.1.16
40
+ github:Awenforever/dsh-ustc-quota#v1.1.17
41
41
  ```
42
42
 
43
43
  也可以直接从 npm 安装(这样 DSH 的插件页能用官方渠道检查新版本,并直接更新):
44
44
 
45
45
  ```text
46
- dsh-ustc-quota@1.1.16
46
+ dsh-ustc-quota@1.1.17
47
47
  ```
48
48
 
49
49
  或者用你已有的安装方式指定同一目录/仓库:
@@ -62,13 +62,13 @@ target = github:Awenforever/dsh-ustc-quota
62
62
  TokenWorks 是 USTC 基于 DSH 的发行版,自带 **插件** 页面和 `@deepseek-ai/dsh-plugin-manager`:
63
63
 
64
64
  1. 在左侧栏打开 **插件** → 点右上角 **+ 添加插件**;
65
- 2. 填入 `dsh-ustc-quota@1.1.16`(npm)或 `github:Awenforever/dsh-ustc-quota#v1.1.16`(GitHub);
65
+ 2. 填入 `dsh-ustc-quota@1.1.17`(npm)或 `github:Awenforever/dsh-ustc-quota#v1.1.17`(GitHub);
66
66
  3. **全新安装**后只需让插件页加载/刷新一次;**从旧版本升级**则必须完全退出并重新打开词元工坊。TokenWorks 的插件页「更新」只应用 Host bundle,页面刷新不能清掉 DSH client-module 缓存;若刷新后插件仍未恢复,请完全退出并重开词元工坊;
67
67
  4. 用学校统一身份登录后,卡片会自动出现。
68
68
 
69
69
  > 词元工坊插件页的「官方」只列出发行版自带的插件;第三方插件(包括本插件)不会出现在「官方」里,安装后会出现在「已安装」区域。这是正常的,不是没有装上。
70
70
 
71
- > 如果之前装过旧版本并看到「插件异常」,先在插件页移除旧条目,再安装上面的 v1.1.16;v1.1.16 已包含旧包 `package.json` 的 BOM 修复、额度接口错误文案修正、报警图标出现时自动加宽 Key 列、更新器令牌/重试修复、DSH 0.2.2 热更新适配、分屏焦点跟随、深色主题适配,以及官方插件更新通道。安装/刷新后若仍未恢复,请完全退出并重开词元工坊,不要只凭一次页面刷新判断安装失败。
71
+ > 如果之前装过旧版本并看到「插件异常」,先在插件页移除旧条目,再安装上面的 v1.1.17;v1.1.17 已包含旧包 `package.json` 的 BOM 修复、额度接口错误文案修正、报警图标出现时自动加宽 Key 列、更新器令牌/重试修复、DSH 0.2.2 热更新适配、分屏焦点跟随、深色主题适配,以及官方插件更新通道。安装/刷新后若仍未恢复,请完全退出并重开词元工坊,不要只凭一次页面刷新判断安装失败。
72
72
 
73
73
  TokenWorks 的额度来自它内置的 `tokenworksUsage` 服务,因此:
74
74
 
@@ -84,7 +84,7 @@ TokenWorks 的额度来自它内置的 `tokenworksUsage` 服务,因此:
84
84
 
85
85
  卡片独占侧边栏底部的一整行:TokenWorks 的「更新」按钮或 DSH 的 Cordis 按钮留在上一行,不会被并排挤压;卡片内部的三列也不会被截断。
86
86
 
87
- > v1.1.6 起不再依赖 `<style>`/`:has`:客户端挂载后直接找到 `footerActions`,折叠只包含本卡片的 slot cell,并让 footer 换行。若仍看到并排,确认装的是 v1.1.16,并刷新一次页面让新的 client bundle 生效。
87
+ > v1.1.6 起不再依赖 `<style>`/`:has`:客户端挂载后直接找到 `footerActions`,折叠只包含本卡片的 slot cell,并让 footer 换行。若仍看到并排,确认装的是 v1.1.17,并刷新一次页面让新的 client bundle 生效。
88
88
 
89
89
  每把 Key(TokenWorks 下是当前账户)一行,三列:
90
90
 
@@ -195,7 +195,8 @@ tokenworksUsage.snapshot({language})
195
195
  - 从 v1.1.15 起,分屏视图中的星号跟随当前焦点 pane:每个 `conversation.composer.dock` 注册隐藏 session marker,按 `focusin` / `pointerdown` 和 pane 的 `data-focused` 解析;共享 split 容器不会误切。`dsh-multiview` 0.1.4 已验证;其他分屏插件采用同一通用逻辑,best-effort。
196
196
  - 从 v1.1.15 起,深色主题完全跟随 DSH token:卡片、弹窗、边框、文字和状态色不写死浅色值,警告/重启底色用 `color-mix` 从 DSH state token 派生;不需要手动开关。
197
197
  - 从 v1.1.16 起,更新检查优先走 DSH 官方通道:先问宿主 `pluginManager.listVersions`(只对 npm 安装的副本有效),没结果再回退 GitHub Release;安装动作也优先用 `pluginManager.updateBundle`,宿主拒绝时回退到 release tarball 的 `installBundle`,两者都不可用时才显示可复制的安装 spec。插件版本已发布到 npm(`dsh-ustc-quota`),每个版本由 GitHub Actions 用 OIDC 可信发布自动上传。
198
- - **首次从 v1.1.11/v1.1.12 升级到 v1.1.13–v1.1.16 仍由旧更新器执行。** 如果自动更新失败,请在插件页直接安装 `github:Awenforever/dsh-ustc-quota#v1.1.16` 或 `dsh-ustc-quota@1.1.16`;装到新版后,后续自动更新才使用新的令牌/重试逻辑。
198
+ - 从 v1.1.17 起,升级后的重启 banner 只在“宿主安装的版本比页面已加载的 client 版本更新”时出现:更新后第一次启动不会再误报“请完全退出并重开”(旧载体 0.2.1-rc.5 上尤其明显),降级时也不会误报。
199
+ - **首次从 v1.1.11/v1.1.12 升级到 v1.1.13–v1.1.17 仍由旧更新器执行。** 如果自动更新失败,请在插件页直接安装 `github:Awenforever/dsh-ustc-quota#v1.1.17` 或 `dsh-ustc-quota@1.1.17`;装到新版后,后续自动更新才使用新的令牌/重试逻辑。
199
200
  - 24h 可能是用户级预算,同一用户多把 Key 会共享;24h 单元格会标注“密钥级 / 用户级 / 上次查询”。
200
201
  - 12:00 / 00:00 边界上平台可能短暂返回旧用量;插件把过期窗口标成“重置中”,8 秒后重查。
201
202
  - 额度数值是平台额度单位(当前 3h/12h/24h 为 30/70/100),不是 DSH token 数;插件不擅自换算。
package/client.js CHANGED
@@ -11,7 +11,7 @@ window.__ModuleLoader__.load({
11
11
  const UPDATE_ENDPOINT = 'plugins/dsh-ustc-quota/update';
12
12
  const UPDATE_APPLY_ENDPOINT = 'plugins/dsh-ustc-quota/update/apply';
13
13
  const WINDOW_IDS = ['3h', '12h', '24h'];
14
- const CLIENT_VERSION = '1.1.16';
14
+ const CLIENT_VERSION = '1.1.17';
15
15
  const UPDATE_INTERVAL_MS = 24 * 60 * 60 * 1000;
16
16
  const CLIENT_VERSION_KEY = `${NS}:client-version`;
17
17
  const CLIENT_RELOAD_KEY = `${NS}:client-reload`;
@@ -41,7 +41,6 @@ window.__ModuleLoader__.load({
41
41
  let clientCtx = null;
42
42
  let activeSessionId = null;
43
43
  let holdHostReload = false;
44
- let previousClientVersion = null;
45
44
  const activeSessionListeners = new Set();
46
45
 
47
46
  function setActiveSession(id) {
@@ -1014,9 +1013,7 @@ window.__ModuleLoader__.load({
1014
1013
  const [updateChecking, setUpdateChecking] = React.useState(false);
1015
1014
  const [updateApplying, setUpdateApplying] = React.useState(false);
1016
1015
  const [updateRestartPending, setUpdateRestartPending] = React.useState(false);
1017
- const [restartNotice, setRestartNotice] = React.useState(
1018
- () => !DSH_HOT_UPDATE && previousClientVersion !== null && previousClientVersion !== CLIENT_VERSION,
1019
- );
1016
+ const [restartNotice, setRestartNotice] = React.useState(false);
1020
1017
  const [updateNotice, setUpdateNotice] = React.useState('');
1021
1018
  const [updateError, setUpdateError] = React.useState('');
1022
1019
  const [updateResult, setUpdateResult] = React.useState('');
@@ -1054,6 +1051,7 @@ window.__ModuleLoader__.load({
1054
1051
  if (!body || !Array.isArray(body.keys)) throw new Error('invalid snapshot');
1055
1052
  if (seq !== requestSeq.current || cancelledRef.current) return null;
1056
1053
  reloadForHostVersion(body.pluginVersion);
1054
+ setRestartNotice(needsRestartForStaleClient(body));
1057
1055
  setSnapshot(body);
1058
1056
  setError(null);
1059
1057
  setLoading(false);
@@ -1702,6 +1700,17 @@ window.__ModuleLoader__.load({
1702
1700
  return false;
1703
1701
  }
1704
1702
 
1703
+ // The restart banner is for carriers that keep serving the client bundle the
1704
+ // page booted with: only a host package newer than the loaded client proves
1705
+ // the page still runs stale code. A fresh launch carries the same version in
1706
+ // both places, and a downgraded package is not newer, so neither asks for a
1707
+ // restart that already happened.
1708
+ function needsRestartForStaleClient(snapshot) {
1709
+ if (DSH_HOT_UPDATE) return false;
1710
+ const hostVersion = snapshot && typeof snapshot.pluginVersion === 'string' ? snapshot.pluginVersion : '';
1711
+ return hostVersion ? isNewerVersion(hostVersion, CLIENT_VERSION) : false;
1712
+ }
1713
+
1705
1714
  function normalizeUpdateInfo(value) {
1706
1715
  if (!value || typeof value !== 'object' || typeof value.latestVersion !== 'string') return null;
1707
1716
  const latest = value.latestVersion.trim().replace(/^v/i, '');
@@ -1758,8 +1767,6 @@ window.__ModuleLoader__.load({
1758
1767
  function reloadOnceAfterClientUpdate() {
1759
1768
  if (typeof window === 'undefined' || typeof localStorage === 'undefined') return;
1760
1769
  try {
1761
- const storedVersion = localStorage.getItem(CLIENT_VERSION_KEY);
1762
- if (storedVersion && storedVersion !== CLIENT_VERSION) previousClientVersion = storedVersion;
1763
1770
  if (localStorage.getItem(CLIENT_VERSION_KEY) === CLIENT_VERSION) return;
1764
1771
  localStorage.setItem(CLIENT_VERSION_KEY, CLIENT_VERSION);
1765
1772
  if (typeof performance !== 'undefined' && performance.now() < 10000) return;
package/index.js CHANGED
@@ -22,7 +22,7 @@ const ROUTE_PATH = '/plugins/dsh-ustc-quota/snapshot';
22
22
  const UPDATE_PATH = '/plugins/dsh-ustc-quota/update';
23
23
  const UPDATE_APPLY_PATH = '/plugins/dsh-ustc-quota/update/apply';
24
24
  const UPDATE_TOKEN_TTL_MS = 30 * 60 * 1000;
25
- const PLUGIN_VERSION = '1.1.16';
25
+ const PLUGIN_VERSION = '1.1.17';
26
26
  const KEY_INFO_PATH = 'key/info';
27
27
  const USER_INFO_PATH = 'user/info';
28
28
  const DISCOVERY_TTL_MS = 30000;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-ustc-quota",
3
- "version": "1.1.16",
3
+ "version": "1.1.17",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "Live 3h/12h/24h USTC token quota card in the DSH sidebar (works with the USTC TokenWorks distribution).",