dsh-long-plugins 2.6.1 → 2.6.2

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/client/client.js CHANGED
@@ -2063,10 +2063,11 @@ window.__ModuleLoader__.load({
2063
2063
  /** Poll the backend session-cost route (peak/off-peak aware, V4-Flash
2064
2064
  * official pricing) for the given session id. Returns the parsed JSON
2065
2065
  * `{tokens, cny:{peak,offPeak,total}}` or null while unavailable. */
2066
- function useSessionCost(sessionId) {
2066
+ function useSessionCost(sessionId, enabled) {
2067
2067
  const [cost, setCost] = react.useState(null);
2068
2068
  react.useEffect(() => {
2069
2069
  let cancelled = false;
2070
+ if (!enabled) { setCost(null); return void 0; }
2070
2071
  if (!sessionId) { setCost(null); return void 0; }
2071
2072
  const load = async () => {
2072
2073
  try {
@@ -2094,7 +2095,7 @@ window.__ModuleLoader__.load({
2094
2095
  cancelled = true;
2095
2096
  clearInterval(interval);
2096
2097
  };
2097
- }, [sessionId]);
2098
+ }, [sessionId, enabled]);
2098
2099
  return cost;
2099
2100
  }
2100
2101
  /** Composer-dock balance chip: one muted line under the input card,
@@ -2105,9 +2106,10 @@ window.__ModuleLoader__.load({
2105
2106
  const balance = useApiBalance();
2106
2107
  const text = balanceSummaryText(balance);
2107
2108
  const sessionId = useSession((s) => s.sessionId);
2108
- const cost = useSessionCost(sessionId);
2109
+ const sessionCostOn = window.__dshLongModules ? window.__dshLongModules.sessionCost === true : false;
2110
+ const cost = useSessionCost(sessionId, sessionCostOn);
2109
2111
  const spendCny = cost && cost.cny && Number.isFinite(cost.cny.total) ? cost.cny.total : null;
2110
- const spendText = spendCny === null || spendCny <= 0 ? null : `${t("spend")}${formatCny(spendCny)}`;
2112
+ const spendText = !sessionCostOn || spendCny === null || spendCny <= 0 ? null : `${t("spend")}${formatCny(spendCny)}`;
2111
2113
  if (text === void 0 && spendText === null) return null;
2112
2114
  return react_jsx_runtime.jsx("div", {
2113
2115
  style: {
@@ -3173,6 +3175,7 @@ window.__ModuleLoader__.load({
3173
3175
  ['uploadPreview', '上传文件预览/管理'],
3174
3176
  ['skillDocs', '技能管理'],
3175
3177
  ['balance', '账户余额'],
3178
+ ['sessionCost', '会话成本'],
3176
3179
  ['workspace', '输出文件预览/管理'],
3177
3180
  ['mobile', '移动端布局'],
3178
3181
  ]
package/dsh.plugin.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "dsh-long-plugins",
3
3
  "description": "Merged DSH web plugins: upload manager (drag-and-drop attach any file to the message), workspace output files, skill docs, account balance, Markdown-to-Word (md2docx), and polished file preview (Word & PowerPoint real preview with zoom/pan, rendered Markdown), plus an auto-repair install for DSH core patches (reverse-proxy WebSocket heartbeat, upgrade relink). | 一个插件整合 DSH Web 的常用增强:上传管理(拖放上传:拖任意文件到会话框直接附加)、工作区「输出文件」面板、技能文档浏览、账户余额显示、Markdown 转 Word(md2docx)、Word/PowerPoint 真实预览(可缩放、翻页);并自带修复安装,自动重连 DSH 核心补丁(反代 WebSocket 心跳、升级重连)。",
4
- "version": "2.6.1",
4
+ "version": "2.6.2",
5
5
  "entry": {
6
6
  "name": "dsh-long-plugins",
7
7
  "inject": [
package/lib/index.js CHANGED
@@ -1649,7 +1649,7 @@ window.addEventListener('resize',function(){ try{ if(fitMode) zoomFit(); else ap
1649
1649
  };
1650
1650
 
1651
1651
  // 各模块开关(dsh-long 设置区):读写 ~/.dsh-long-plugins/modules.json(独立于 dsh-span 的 RA-Span 配置)。
1652
- const MODULES_DEFAULTS = { uploadAttach: true, uploadDragDrop: true, uploadPaste: true, uploadPreview: true, skillDocs: true, balance: true, mobile: true, workspace: true, turnRuler: false };
1652
+ const MODULES_DEFAULTS = { uploadAttach: true, uploadDragDrop: true, uploadPaste: true, uploadPreview: true, skillDocs: true, balance: true, mobile: true, workspace: true, turnRuler: false, sessionCost: false };
1653
1653
  const modulesFile = join(homedir(), ".dsh-long-plugins", "modules.json");
1654
1654
  async function readModulesJSON() {
1655
1655
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-long-plugins",
3
- "version": "2.6.1",
3
+ "version": "2.6.2",
4
4
  "description": "Merged DSH web plugins: upload manager (drag-and-drop attach any file to the message), workspace output files, skill docs, account balance, and polished file preview (Word & PowerPoint real preview with zoom/pan, rendered Markdown), plus an auto-repair install for DSH core patches (reverse-proxy WebSocket heartbeat, upgrade relink). | 一个插件整合 DSH Web 的常用增强:上传管理(拖放上传:拖任意文件到会话框直接附加)、工作区「输出文件」面板、技能文档浏览、账户余额显示、Word/PowerPoint 真实预览(可缩放、翻页);并自带修复安装,自动重连 DSH 核心补丁(反代 WebSocket 心跳、升级重连)。Office 读取/生成已独立到 dsh-office-reader;RA-Span 已独立到 dsh-span。",
5
5
  "type": "module",
6
6
  "license": "MIT",