dsh-plugin-greeting-bubble 1.4.0-beta.2 → 1.4.0

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
  - 点气泡右侧的 **×** 关闭;关闭只对当前页面生效,**刷新页面后会再次出现**。
package/client.js CHANGED
@@ -217,27 +217,6 @@ window.__ModuleLoader__.load({
217
217
  return 'greetingEvening';
218
218
  }
219
219
 
220
- /** Latest session title/model reported by the probe mounted in a session slot. */
221
- const sessionInfoStore = (() => {
222
- let value = null;
223
- const listeners = new Set();
224
- return {
225
- get: () => value,
226
- set(next) {
227
- const same = next === null
228
- ? value === null
229
- : value !== null && next.sessionId === value.sessionId && next.title === value.title && next.model === value.model;
230
- if (same) return;
231
- value = next;
232
- for (const listener of listeners) listener();
233
- },
234
- subscribe(listener) {
235
- listeners.add(listener);
236
- return () => { listeners.delete(listener); };
237
- },
238
- };
239
- })();
240
-
241
220
  /** Subscribe to a host observable (or read it once when unavailable). */
242
221
  function useObservable(source) {
243
222
  const subscribe = source && typeof source.subscribe === 'function' ? source.subscribe.bind(source) : null;
@@ -248,24 +227,6 @@ window.__ModuleLoader__.load({
248
227
  return get();
249
228
  }
250
229
 
251
- /**
252
- * Session-scoped probe: reports the current session title and selected
253
- * model to the overlay. Rendered inside `conversation.input.dock`, so it
254
- * mounts only while a session is open and costs no visible space.
255
- */
256
- function SessionProbe({ sessionId, useProjection, useSessions }) {
257
- const modelSelection = typeof useProjection === 'function' ? useProjection('modelSelection') : null;
258
- const list = typeof useSessions === 'function' ? useSessions((state) => state) : null;
259
- const summary = list && list.byId && sessionId ? list.byId[sessionId] : null;
260
- const title = summary && summary.displayTitle ? summary.displayTitle : null;
261
- const model = modelSelection && typeof modelSelection.model === 'string' ? modelSelection.model : null;
262
- React.useEffect(() => {
263
- sessionInfoStore.set(sessionId ? { sessionId, title, model } : null);
264
- return () => { sessionInfoStore.set(null); };
265
- }, [sessionId, title, model]);
266
- return null;
267
- }
268
-
269
230
  /**
270
231
  * Component-local stylesheet; unmounting the entry removes it with the
271
232
  * node.
@@ -475,7 +436,6 @@ window.__ModuleLoader__.load({
475
436
  const cancelledRef = React.useRef(false);
476
437
 
477
438
  const label = (key, fallback) => (typeof t === 'function' ? t(key) : fallback);
478
- const sessionInfo = useObservable(sessionInfoStore);
479
439
  const connectionState = useObservable(connection && connection.state);
480
440
  const canReconnect = Boolean(connection && typeof connection.reconnect === 'function');
481
441
 
@@ -576,7 +536,6 @@ window.__ModuleLoader__.load({
576
536
  const greeting = label(greetingKeyForHour(new Date().getHours()), '你好,腾盛');
577
537
  const dismissLabel = label('dismiss', '关闭问候气泡');
578
538
  const normalText = balance === null ? null : formatWallets(balance.normal);
579
- const bonusText = balance === null ? null : formatWallets(balance.bonus);
580
539
  const low = balance !== null && isLowBalance(balance.normal);
581
540
  const amountText = privacy
582
541
  ? label('hidden', '••••')
@@ -584,9 +543,6 @@ window.__ModuleLoader__.load({
584
543
  const accountText = profile && (profile.name || profile.contact)
585
544
  ? [profile.name, profile.contact].filter(Boolean).join(' · ')
586
545
  : label('unavailable', '--');
587
- const sessionText = sessionInfo && (sessionInfo.title || sessionInfo.model)
588
- ? [sessionInfo.title, sessionInfo.model].filter(Boolean).join(' · ')
589
- : label('unavailable', '--');
590
546
  const connectionText = connectionState === 'connected'
591
547
  ? label('connected', '已连接')
592
548
  : connectionState === 'connecting'
@@ -759,24 +715,12 @@ window.__ModuleLoader__.load({
759
715
  h('span', { className: 'dsh-greeting-row-label' }, label('account', '账户')),
760
716
  h('span', { className: 'dsh-greeting-row-value' }, accountText),
761
717
  ),
762
- h(
763
- 'div',
764
- { className: 'dsh-greeting-row' },
765
- h('span', { className: 'dsh-greeting-row-label' }, label('session', '会话')),
766
- h('span', { className: 'dsh-greeting-row-value' }, sessionText),
767
- ),
768
718
  h(
769
719
  'div',
770
720
  { className: 'dsh-greeting-row' },
771
721
  h('span', { className: 'dsh-greeting-row-label' }, label('topUpBalance', '充值')),
772
722
  h('span', { className: 'dsh-greeting-row-value' }, privacy ? label('hidden', '••••') : (normalText ?? label('unavailable', '--'))),
773
723
  ),
774
- h(
775
- 'div',
776
- { className: 'dsh-greeting-row' },
777
- h('span', { className: 'dsh-greeting-row-label' }, label('bonusBalance', '赠送')),
778
- h('span', { className: 'dsh-greeting-row-value' }, privacy ? label('hidden', '••••') : (bonusText ?? label('unavailable', '--'))),
779
- ),
780
724
  h(
781
725
  'div',
782
726
  { className: 'dsh-greeting-row' },
@@ -792,7 +736,7 @@ window.__ModuleLoader__.load({
792
736
  h(
793
737
  'div',
794
738
  { className: 'dsh-greeting-row' },
795
- h('span', { className: 'dsh-greeting-row-label' }, label('today', '今日')),
739
+ h('span', { className: 'dsh-greeting-row-label' }, label('today', '今日使用')),
796
740
  h('span', { className: 'dsh-greeting-row-value' }, spentText),
797
741
  ),
798
742
  h(
@@ -845,16 +789,14 @@ window.__ModuleLoader__.load({
845
789
  balance: '余额',
846
790
  bonus: '赠送',
847
791
  topUpBalance: '充值',
848
- bonusBalance: '赠送',
849
792
  account: '账户',
850
- session: '会话',
851
793
  connection: '连接',
852
794
  connected: '已连接',
853
795
  connecting: '重连中',
854
796
  disconnected: '已断开',
855
797
  reconnect: '重连',
856
798
  updated: '更新',
857
- today: '今日',
799
+ today: '今日使用',
858
800
  estimate: '(估算)',
859
801
  baseline: '基准',
860
802
  hidden: '••••',
@@ -877,16 +819,14 @@ window.__ModuleLoader__.load({
877
819
  balance: 'Balance',
878
820
  bonus: 'Bonus',
879
821
  topUpBalance: 'Top-up',
880
- bonusBalance: 'Bonus',
881
822
  account: 'Account',
882
- session: 'Session',
883
823
  connection: 'Connection',
884
824
  connected: 'Connected',
885
825
  connecting: 'Reconnecting',
886
826
  disconnected: 'Disconnected',
887
827
  reconnect: 'Reconnect',
888
828
  updated: 'Updated',
889
- today: 'Today',
829
+ today: "Today's usage",
890
830
  estimate: '(estimate)',
891
831
  baseline: 'baseline',
892
832
  hidden: '••••',
@@ -931,11 +871,6 @@ window.__ModuleLoader__.load({
931
871
  if (typeof account.getProfile !== 'function') throw new Error('profile unavailable');
932
872
  return account.getProfile(metadata());
933
873
  };
934
- ctx.slots.inject('conversation.input.dock', () => ctx.slots.register({
935
- name: 'conversation.input.dock',
936
- id: 'greeting-bubble.session',
937
- order: 100,
938
- }, SessionProbe));
939
874
  ctx.slots.inject('shell.overlay', () => ctx.slots.register({
940
875
  name: 'shell.overlay',
941
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, 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.2",
3
+ "version": "1.4.0",
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": {