dsh-plugin-greeting-bubble 1.4.0-beta.1 → 1.4.0-beta.3

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
@@ -31,8 +31,9 @@
31
31
  - 页面加载约 0.35 秒后,右下角(距右 20px、距底 84px,即输入框发送按钮上方)淡入气泡:👋 早上好/中午好/下午好/晚上好,腾盛 ×(按当前时间变化)
32
32
  - **第二行显示账号余额**:`余额 ¥12.34`,来自当前登录的 DeepSeek 账号;每 60 秒刷新一次。
33
33
  - **余额低于 3 元**时,这一行变橙并显示「余额不足」提醒。
34
- - **点余额这一行展开详情**:账户名/联系方式、**当前会话标题与模型**、**连接状态(断开时可一键重连)**、**今日消耗估算(标注“估算”)**、充值余额、赠送余额、最近更新时间、插件版本,以及「用量」「充值」快捷入口;再点一次收起。
35
- - 今日估算的基准:优先用**昨天最后一次读到的余额**(≈ 0 点余额),没有昨天数据则用**今天第一次读到的余额**;充值会使基准同步抬高,不计入消费;详情里会显示基准时间。
34
+ - **点余额这一行展开详情**:账户名/联系方式、**连接状态(断开时可一键重连)**、**今日使用估算**、充值余额、最近更新时间,以及「用量」「充值」快捷入口;再点一次收起。
35
+ - 今日使用 = 基准余额 − 当前余额;优先用**昨天最后一次读到的余额**(≈ 0 点余额),没有昨天数据则用**今天第一次读到的余额**;充值会使基准同步抬高,不计入消费;详情里会显示基准时间。
36
+ - **安装插件之前、或 DSH 未运行期间**的消费无法统计,所以这是“自基准时间起”的估算,不是平台账单。
36
37
  - 详情里可以**隐藏金额(隐私模式)**:金额变为 `••••` 并记住,适合截图/录屏。
37
38
  - 未登录、账号服务不可用或请求失败时显示 `余额 --`,不影响气泡的其他功能。
38
39
  - 点气泡右侧的 **×** 关闭;关闭只对当前页面生效,**刷新页面后会再次出现**。
@@ -163,7 +164,6 @@ const BALANCE_MAX_BACKOFF_MS = 300_000; // 连续失败后的最大退避
163
164
 
164
165
  ```js
165
166
  const LOW_BALANCE_CNY = 3; // 低于这个金额显示“余额不足”
166
- const PLUGIN_VERSION = '1.3.0'; // 每次发版同步修改
167
167
  ```
168
168
 
169
169
  隐私模式的状态保存在 localStorage 的 `dsh-greeting-bubble:privacy:v1`;想强制恢复“显示金额”,在控制台执行:
package/client.js CHANGED
@@ -30,9 +30,6 @@ window.__ModuleLoader__.load({
30
30
  /** Locale namespace owned by this plugin (registered in `apply`). */
31
31
  const NS = 'greetingBubble';
32
32
 
33
- /** Keep in sync with package.json's version on every release. */
34
- const PLUGIN_VERSION = '1.3.0';
35
-
36
33
  /** Where the reader last dropped the bubble, as viewport px. */
37
34
  const POSITION_KEY = 'dsh-greeting-bubble:position:v1';
38
35
 
@@ -220,27 +217,6 @@ window.__ModuleLoader__.load({
220
217
  return 'greetingEvening';
221
218
  }
222
219
 
223
- /** Latest session title/model reported by the probe mounted in a session slot. */
224
- const sessionInfoStore = (() => {
225
- let value = null;
226
- const listeners = new Set();
227
- return {
228
- get: () => value,
229
- set(next) {
230
- const same = next === null
231
- ? value === null
232
- : value !== null && next.sessionId === value.sessionId && next.title === value.title && next.model === value.model;
233
- if (same) return;
234
- value = next;
235
- for (const listener of listeners) listener();
236
- },
237
- subscribe(listener) {
238
- listeners.add(listener);
239
- return () => { listeners.delete(listener); };
240
- },
241
- };
242
- })();
243
-
244
220
  /** Subscribe to a host observable (or read it once when unavailable). */
245
221
  function useObservable(source) {
246
222
  const subscribe = source && typeof source.subscribe === 'function' ? source.subscribe.bind(source) : null;
@@ -251,24 +227,6 @@ window.__ModuleLoader__.load({
251
227
  return get();
252
228
  }
253
229
 
254
- /**
255
- * Session-scoped probe: reports the current session title and selected
256
- * model to the overlay. Rendered inside `conversation.input.dock`, so it
257
- * mounts only while a session is open and costs no visible space.
258
- */
259
- function SessionProbe({ sessionId, useProjection, useSessions }) {
260
- const modelSelection = typeof useProjection === 'function' ? useProjection('modelSelection') : null;
261
- const list = typeof useSessions === 'function' ? useSessions((state) => state) : null;
262
- const summary = list && list.byId && sessionId ? list.byId[sessionId] : null;
263
- const title = summary && summary.displayTitle ? summary.displayTitle : null;
264
- const model = modelSelection && typeof modelSelection.model === 'string' ? modelSelection.model : null;
265
- React.useEffect(() => {
266
- sessionInfoStore.set(sessionId ? { sessionId, title, model } : null);
267
- return () => { sessionInfoStore.set(null); };
268
- }, [sessionId, title, model]);
269
- return null;
270
- }
271
-
272
230
  /**
273
231
  * Component-local stylesheet; unmounting the entry removes it with the
274
232
  * node.
@@ -478,7 +436,6 @@ window.__ModuleLoader__.load({
478
436
  const cancelledRef = React.useRef(false);
479
437
 
480
438
  const label = (key, fallback) => (typeof t === 'function' ? t(key) : fallback);
481
- const sessionInfo = useObservable(sessionInfoStore);
482
439
  const connectionState = useObservable(connection && connection.state);
483
440
  const canReconnect = Boolean(connection && typeof connection.reconnect === 'function');
484
441
 
@@ -579,7 +536,6 @@ window.__ModuleLoader__.load({
579
536
  const greeting = label(greetingKeyForHour(new Date().getHours()), '你好,腾盛');
580
537
  const dismissLabel = label('dismiss', '关闭问候气泡');
581
538
  const normalText = balance === null ? null : formatWallets(balance.normal);
582
- const bonusText = balance === null ? null : formatWallets(balance.bonus);
583
539
  const low = balance !== null && isLowBalance(balance.normal);
584
540
  const amountText = privacy
585
541
  ? label('hidden', '••••')
@@ -587,9 +543,6 @@ window.__ModuleLoader__.load({
587
543
  const accountText = profile && (profile.name || profile.contact)
588
544
  ? [profile.name, profile.contact].filter(Boolean).join(' · ')
589
545
  : label('unavailable', '--');
590
- const sessionText = sessionInfo && (sessionInfo.title || sessionInfo.model)
591
- ? [sessionInfo.title, sessionInfo.model].filter(Boolean).join(' · ')
592
- : label('unavailable', '--');
593
546
  const connectionText = connectionState === 'connected'
594
547
  ? label('connected', '已连接')
595
548
  : connectionState === 'connecting'
@@ -762,29 +715,17 @@ window.__ModuleLoader__.load({
762
715
  h('span', { className: 'dsh-greeting-row-label' }, label('account', '账户')),
763
716
  h('span', { className: 'dsh-greeting-row-value' }, accountText),
764
717
  ),
765
- h(
766
- 'div',
767
- { className: 'dsh-greeting-row' },
768
- h('span', { className: 'dsh-greeting-row-label' }, label('session', '会话')),
769
- h('span', { className: 'dsh-greeting-row-value' }, sessionText),
770
- ),
771
718
  h(
772
719
  'div',
773
720
  { className: 'dsh-greeting-row' },
774
721
  h('span', { className: 'dsh-greeting-row-label' }, label('topUpBalance', '充值')),
775
722
  h('span', { className: 'dsh-greeting-row-value' }, privacy ? label('hidden', '••••') : (normalText ?? label('unavailable', '--'))),
776
723
  ),
777
- h(
778
- 'div',
779
- { className: 'dsh-greeting-row' },
780
- h('span', { className: 'dsh-greeting-row-label' }, label('bonusBalance', '赠送')),
781
- h('span', { className: 'dsh-greeting-row-value' }, privacy ? label('hidden', '••••') : (bonusText ?? label('unavailable', '--'))),
782
- ),
783
724
  h(
784
725
  'div',
785
726
  { className: 'dsh-greeting-row' },
786
727
  h('span', { className: 'dsh-greeting-row-label' }, label('updated', '更新')),
787
- h('span', { className: 'dsh-greeting-row-value' }, formatTime(updatedAt) + ' · v' + PLUGIN_VERSION),
728
+ h('span', { className: 'dsh-greeting-row-value' }, formatTime(updatedAt)),
788
729
  ),
789
730
  h(
790
731
  'div',
@@ -795,7 +736,7 @@ window.__ModuleLoader__.load({
795
736
  h(
796
737
  'div',
797
738
  { className: 'dsh-greeting-row' },
798
- h('span', { className: 'dsh-greeting-row-label' }, label('today', '今日')),
739
+ h('span', { className: 'dsh-greeting-row-label' }, label('today', '今日使用')),
799
740
  h('span', { className: 'dsh-greeting-row-value' }, spentText),
800
741
  ),
801
742
  h(
@@ -848,16 +789,14 @@ window.__ModuleLoader__.load({
848
789
  balance: '余额',
849
790
  bonus: '赠送',
850
791
  topUpBalance: '充值',
851
- bonusBalance: '赠送',
852
792
  account: '账户',
853
- session: '会话',
854
793
  connection: '连接',
855
794
  connected: '已连接',
856
795
  connecting: '重连中',
857
796
  disconnected: '已断开',
858
797
  reconnect: '重连',
859
798
  updated: '更新',
860
- today: '今日',
799
+ today: '今日使用',
861
800
  estimate: '(估算)',
862
801
  baseline: '基准',
863
802
  hidden: '••••',
@@ -880,16 +819,14 @@ window.__ModuleLoader__.load({
880
819
  balance: 'Balance',
881
820
  bonus: 'Bonus',
882
821
  topUpBalance: 'Top-up',
883
- bonusBalance: 'Bonus',
884
822
  account: 'Account',
885
- session: 'Session',
886
823
  connection: 'Connection',
887
824
  connected: 'Connected',
888
825
  connecting: 'Reconnecting',
889
826
  disconnected: 'Disconnected',
890
827
  reconnect: 'Reconnect',
891
828
  updated: 'Updated',
892
- today: 'Today',
829
+ today: "Today's usage",
893
830
  estimate: '(estimate)',
894
831
  baseline: 'baseline',
895
832
  hidden: '••••',
@@ -934,11 +871,6 @@ window.__ModuleLoader__.load({
934
871
  if (typeof account.getProfile !== 'function') throw new Error('profile unavailable');
935
872
  return account.getProfile(metadata());
936
873
  };
937
- ctx.slots.inject('conversation.input.dock', () => ctx.slots.register({
938
- name: 'conversation.input.dock',
939
- id: 'greeting-bubble.session',
940
- order: 100,
941
- }, SessionProbe));
942
874
  ctx.slots.inject('shell.overlay', () => ctx.slots.register({
943
875
  name: 'shell.overlay',
944
876
  id: 'greeting-bubble',
package/locale/en.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "meta": {
3
- "description": "Shows a time-aware “你好,腾盛” speech bubble near the bottom-right corner of the window, just above the message composer (morning/noon/afternoon/evening variants), plus the signed-in DeepSeek account balance refreshed every 60 seconds. A balance below 3 CNY is flagged. Click the balance line to expand details: account, current session title and model, connection state with a one-click reconnect, today's spending estimate (marked as an estimate; baseline is the last balance seen yesterday or the first seen today, ignoring top-ups), wallet breakdown, last update, plugin version, and shortcuts to the Platform usage/top-up pages; a privacy toggle hides amounts, and drag remembers the bubble position. Click × to dismiss it; it appears again on the next page load. Control labels are localized; the greeting stays Chinese. Balance is read through the DSH account service, so the browser never sees the account token; a signed-out or failed read shows “--”. The plugin makes no network requests of its own and collects no data. Disable or remove the bundle under Plugins to remove it.",
3
+ "description": "Shows a time-aware “你好,腾盛” speech bubble near the bottom-right corner of the window, just above the message composer (morning/noon/afternoon/evening variants), plus the signed-in DeepSeek account balance refreshed every 60 seconds. A balance below 3 CNY is flagged. Click the balance line to expand details: account, connection state with a one-click reconnect, today's usage estimate (balance delta, ignoring top-ups; spending before the plugin was installed cannot be counted, and the baseline time is shown), top-up balance, last update, and shortcuts to the Platform usage/top-up pages; a privacy toggle hides amounts, and drag remembers the bubble position. Click × to dismiss it; it appears again on the next page load. Control labels are localized; the greeting stays Chinese. Balance is read through the DSH account service, so the browser never sees the account token; a signed-out or failed read shows “--”. The plugin makes no network requests of its own and collects no data. Disable or remove the bundle under Plugins to remove it.",
4
4
  "detail": "docs/DETAIL.md"
5
5
  }
6
6
  }
package/locale/zh.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "meta": {
3
- "description": "页面加载后,在窗口右下角、输入框上方弹出按时间变化的问候气泡(早上好/中午好/下午好/晚上好,腾盛),并显示当前 DeepSeek 账号余额(充值 + 赠送),每 60 秒刷新一次。余额低于 3 元会显示提醒;点击余额行展开详情:账户信息、当前会话标题与模型、连接状态(断开时可一键重连)、今日消耗估算(标注估算,基准取昨日最后一次或今日首次读到的余额,忽略充值)、充值/赠送明细、更新时间、插件版本,以及「用量」「充值」快捷入口。支持隐藏金额(隐私模式),按住气泡可拖动并记住位置。点 × 关闭,下次页面加载会再次出现。界面文案跟随语言,问候语保持中文。余额通过 DSH 账号服务读取,浏览器不接触账号令牌;未登录或读取失败时显示「--」。插件不联网、不收集数据。在「插件」页停用或移除本插件即可彻底去掉。",
3
+ "description": "页面加载后,在窗口右下角、输入框上方弹出按时间变化的问候气泡(早上好/中午好/下午好/晚上好,腾盛),并显示当前 DeepSeek 账号余额(充值 + 赠送),每 60 秒刷新一次。余额低于 3 元会显示提醒;点击余额行展开详情:账户信息、连接状态(断开时可一键重连)、今日使用估算(基于余额差,忽略充值;安装插件之前的消费无法统计,详情里会显示基准时间)、充值余额、更新时间,以及「用量」「充值」快捷入口。支持隐藏金额(隐私模式),按住气泡可拖动并记住位置。点 × 关闭,下次页面加载会再次出现。界面文案跟随语言,问候语保持中文。余额通过 DSH 账号服务读取,浏览器不接触账号令牌;未登录或读取失败时显示「--」。插件不联网、不收集数据。在「插件」页停用或移除本插件即可彻底去掉。",
4
4
  "detail": "docs/DETAIL.zh.md"
5
5
  }
6
6
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-plugin-greeting-bubble",
3
- "version": "1.4.0-beta.1",
3
+ "version": "1.4.0-beta.3",
4
4
  "description": "Shows a “你好,腾盛” speech bubble in the bottom-right corner of the DeepSeek Harness Web GUI.",
5
5
  "license": "MIT",
6
6
  "publishConfig": {