dsh-long-plugins 2.6.0 → 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 +7 -4
- package/client/vendor/chart.umd.min.js +0 -0
- package/client/vendor/docx-preview.min.js +0 -0
- package/client/vendor/jszip.min.js +0 -0
- package/client/vendor/pptxviewjs.min.js +0 -0
- package/dsh.plugin.json +1 -1
- package/lib/index.js +16 -4
- package/package.json +1 -1
- package/skill/dsh-common-plugins-install/SKILL.md +0 -0
- package/skill/dsh-web-start-panel-install/SKILL.md +0 -0
- package/skill/dsh-web-win-service-install/SKILL.md +0 -0
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
|
|
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
|
]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
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.
|
|
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 {
|
|
@@ -2778,13 +2778,25 @@ export async function apply(ctx, config = {}) {
|
|
|
2778
2778
|
}
|
|
2779
2779
|
const session = ctx.sessions?.get(sessionId);
|
|
2780
2780
|
let events;
|
|
2781
|
-
if (session !== undefined) {
|
|
2781
|
+
if (session !== undefined && typeof session.snapshotEvents === "function") {
|
|
2782
|
+
// DSH 0.1.2-alpha.5 Session exposes snapshotEvents() (the the .events
|
|
2783
|
+
// property is not part of the live Session surface). The legacy
|
|
2784
|
+
// .events array is kept as a fallback for older DSH builds.
|
|
2785
|
+
events = session.snapshotEvents();
|
|
2786
|
+
} else if (session !== undefined && Array.isArray(session.events)) {
|
|
2782
2787
|
events = session.events;
|
|
2783
2788
|
} else if (ctx.sessionPersistence !== undefined) {
|
|
2784
2789
|
// Cold (historical) session: restore through the durable persistence
|
|
2785
2790
|
// backend. inspect() prefers the live store and falls back to disk.
|
|
2786
|
-
|
|
2787
|
-
|
|
2791
|
+
// It throws for a session whose live turn is still open; treat that
|
|
2792
|
+
// as "no usable events" instead of a 500 so the chip degrades to
|
|
2793
|
+
// balance-only rather than erroring.
|
|
2794
|
+
try {
|
|
2795
|
+
const inspected = await ctx.sessionPersistence.inspect(sessionId);
|
|
2796
|
+
events = inspected && Array.isArray(inspected.events) ? inspected.events : undefined;
|
|
2797
|
+
} catch {
|
|
2798
|
+
events = undefined;
|
|
2799
|
+
}
|
|
2788
2800
|
}
|
|
2789
2801
|
if (events === undefined) {
|
|
2790
2802
|
sendJson(res, 404, { ok: false, error: "session not found" });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-long-plugins",
|
|
3
|
-
"version": "2.6.
|
|
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",
|
|
File without changes
|
|
File without changes
|
|
File without changes
|