@alexpeng/dsh-custom-plugin 0.4.1 → 0.4.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/CHANGELOG.md +25 -0
- package/lib/client.js +75 -53
- package/lib/client.js.map +1 -1
- package/lib/index.js +31 -5
- package/lib/types/host-service.d.ts +9 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,31 @@ All notable changes to this project are documented here. The format loosely
|
|
|
4
4
|
follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/); versions
|
|
5
5
|
follow [Semantic Versioning](https://semver.org/).
|
|
6
6
|
|
|
7
|
+
## 0.4.2 — 2026-09-12
|
|
8
|
+
|
|
9
|
+
### Fixed
|
|
10
|
+
|
|
11
|
+
- **Exports fail on forked/resumed sessions with "读取会话失败: seeded
|
|
12
|
+
session constructor seed must equal its inherited prefix".** Newer dsh
|
|
13
|
+
builds replay-validate inside `sessionQuery.readSession()` through a
|
|
14
|
+
snapshot-mode constructor that rejects any seeded (forked or resumed) session
|
|
15
|
+
whose log outgrew its seed boundary, so timeline, export, in-session
|
|
16
|
+
search, and usage scans all failed on those sessions. Every read now goes
|
|
17
|
+
through a shared helper that falls back to `observeSession()` (the live and
|
|
18
|
+
restore paths dsh's own session page uses) when `readSession()` rejects, and
|
|
19
|
+
surfaces the original error only when no fallback exists.
|
|
20
|
+
- **The "PDF(含图片)" export button produced an `.html` file.** The button and
|
|
21
|
+
its description now say what actually lands on disk: "HTML(含图片)", a
|
|
22
|
+
print-ready HTML document you turn into a PDF via the browser print dialog.
|
|
23
|
+
- **Weather FX are invisible on light backgrounds.** Snow, rain, and sakura
|
|
24
|
+
colors were tuned for the dark theme only — pure-white flakes, 6%-alpha pale
|
|
25
|
+
rain, and 90%-lightness pink petals all vanish over the near-white palette
|
|
26
|
+
backgrounds. The FX canvas now picks a darker particle palette (cool slate
|
|
27
|
+
snow, steel-blue rain, deeper rose petals, each with a lifted alpha floor)
|
|
28
|
+
whenever the resolved theme is light or the saturated aurora background is
|
|
29
|
+
active, and swaps palettes live on theme/background changes without
|
|
30
|
+
rebuilding the particle field.
|
|
31
|
+
|
|
7
32
|
## 0.4.1 — 2026-09-09
|
|
8
33
|
|
|
9
34
|
### Fixed
|
package/lib/client.js
CHANGED
|
@@ -2482,8 +2482,20 @@ window.__ModuleLoader__.load({
|
|
|
2482
2482
|
"hsla(352, 55%, 93%, 0.8)",
|
|
2483
2483
|
"hsla(348, 40%, 88%, 0.8)"
|
|
2484
2484
|
];
|
|
2485
|
-
|
|
2485
|
+
/** 浅色背景变体:90% 亮度的淡粉在近白的调色板背景上会消失,
|
|
2486
|
+
* 换成更深的玫瑰粉保持可辨识度。 */
|
|
2487
|
+
const SAKURA_PALETTE_LIGHT = [
|
|
2488
|
+
"hsla(340, 60%, 72%, 0.9)",
|
|
2489
|
+
"hsla(342, 64%, 70%, 0.9)",
|
|
2490
|
+
"hsla(344, 66%, 68%, 0.9)",
|
|
2491
|
+
"hsla(346, 68%, 66%, 0.9)",
|
|
2492
|
+
"hsla(348, 70%, 64%, 0.9)",
|
|
2493
|
+
"hsla(350, 66%, 66%, 0.9)",
|
|
2494
|
+
"hsla(352, 60%, 68%, 0.9)",
|
|
2495
|
+
"hsla(348, 52%, 70%, 0.9)"
|
|
2496
|
+
];
|
|
2486
2497
|
const SAKURA_IMAGES = [];
|
|
2498
|
+
const SAKURA_IMAGES_LIGHT = [];
|
|
2487
2499
|
function rand(a, b) {
|
|
2488
2500
|
return a + Math.random() * (b - a);
|
|
2489
2501
|
}
|
|
@@ -2499,32 +2511,30 @@ window.__ModuleLoader__.load({
|
|
|
2499
2511
|
g.closePath();
|
|
2500
2512
|
g.restore();
|
|
2501
2513
|
}
|
|
2502
|
-
function
|
|
2503
|
-
if (
|
|
2514
|
+
function buildSakuraSpriteSet(palette, target) {
|
|
2515
|
+
if (target.length > 0) return;
|
|
2504
2516
|
const cvs = (typeof document !== "undefined" ? document : null)?.createElement("canvas");
|
|
2505
2517
|
if (cvs === void 0 || cvs === null) return;
|
|
2506
2518
|
cvs.width = 48;
|
|
2507
2519
|
cvs.height = 48;
|
|
2508
2520
|
const g = cvs.getContext("2d");
|
|
2509
2521
|
if (g === null) return;
|
|
2510
|
-
for (
|
|
2522
|
+
for (const color of palette) {
|
|
2511
2523
|
g.clearRect(0, 0, 48, 48);
|
|
2512
|
-
g.fillStyle =
|
|
2524
|
+
g.fillStyle = color;
|
|
2513
2525
|
tracePetal(g, 24, 24, 10, 0);
|
|
2514
2526
|
g.fill();
|
|
2515
2527
|
try {
|
|
2516
|
-
|
|
2517
|
-
|
|
2518
|
-
|
|
2519
|
-
}
|
|
2520
|
-
}
|
|
2521
|
-
for (const sprite of SAKURA_SPRITES) {
|
|
2522
|
-
if (sprite === null) continue;
|
|
2523
|
-
const image = new Image();
|
|
2524
|
-
image.src = sprite;
|
|
2525
|
-
SAKURA_IMAGES.push(image);
|
|
2528
|
+
const image = new Image();
|
|
2529
|
+
image.src = cvs.toDataURL();
|
|
2530
|
+
target.push(image);
|
|
2531
|
+
} catch {}
|
|
2526
2532
|
}
|
|
2527
2533
|
}
|
|
2534
|
+
function buildSakuraSprites() {
|
|
2535
|
+
buildSakuraSpriteSet(SAKURA_PALETTE, SAKURA_IMAGES);
|
|
2536
|
+
buildSakuraSpriteSet(SAKURA_PALETTE_LIGHT, SAKURA_IMAGES_LIGHT);
|
|
2537
|
+
}
|
|
2528
2538
|
function initFx(weather, w, h) {
|
|
2529
2539
|
FX.snow = [];
|
|
2530
2540
|
FX.rain = [];
|
|
@@ -2661,7 +2671,7 @@ window.__ModuleLoader__.load({
|
|
|
2661
2671
|
h: rand(.4, 1.1)
|
|
2662
2672
|
});
|
|
2663
2673
|
}
|
|
2664
|
-
function fxFrame(g, cvs, weather, time) {
|
|
2674
|
+
function fxFrame(g, cvs, weather, time, light) {
|
|
2665
2675
|
const w = cvs.clientWidth || 0;
|
|
2666
2676
|
const h = cvs.clientHeight || 0;
|
|
2667
2677
|
if (w === 0 || h === 0) return;
|
|
@@ -2682,10 +2692,10 @@ window.__ModuleLoader__.load({
|
|
|
2682
2692
|
}
|
|
2683
2693
|
if (f.x > w + f.radius) f.x = -f.radius;
|
|
2684
2694
|
else if (f.x < -f.radius) f.x = w + f.radius;
|
|
2685
|
-
const q = Math.round(f.opacity * 50) / 50;
|
|
2695
|
+
const q = Math.round((light ? Math.min(.9, f.opacity + .15) : f.opacity) * 50) / 50;
|
|
2686
2696
|
if (q !== currentOpacity) {
|
|
2687
2697
|
currentOpacity = q;
|
|
2688
|
-
g.fillStyle = `rgba(255,255,255,${q})`;
|
|
2698
|
+
g.fillStyle = light ? `rgba(125,146,170,${q})` : `rgba(255,255,255,${q})`;
|
|
2689
2699
|
}
|
|
2690
2700
|
g.beginPath();
|
|
2691
2701
|
g.arc(f.x, f.y, f.radius, 0, Math.PI * 2);
|
|
@@ -2708,10 +2718,10 @@ window.__ModuleLoader__.load({
|
|
|
2708
2718
|
d.x = Math.random() * (w + 100) - 50;
|
|
2709
2719
|
}
|
|
2710
2720
|
if (d.x > w + 50) d.x = -50;
|
|
2711
|
-
const qo = Math.round(d.opacity * 30) / 30;
|
|
2721
|
+
const qo = Math.round((light ? Math.min(.5, d.opacity + .08) : d.opacity) * 30) / 30;
|
|
2712
2722
|
if (qo !== currentOpacity) {
|
|
2713
2723
|
currentOpacity = qo;
|
|
2714
|
-
g.strokeStyle = `rgba(180,200,220,${qo})`;
|
|
2724
|
+
g.strokeStyle = light ? `rgba(104,130,156,${qo})` : `rgba(180,200,220,${qo})`;
|
|
2715
2725
|
}
|
|
2716
2726
|
const qw = Math.round(d.lineWidth * 4) / 4;
|
|
2717
2727
|
if (qw !== currentWidth) {
|
|
@@ -2735,48 +2745,60 @@ window.__ModuleLoader__.load({
|
|
|
2735
2745
|
}
|
|
2736
2746
|
g.save();
|
|
2737
2747
|
g.globalAlpha = Math.max(0, sp.life);
|
|
2738
|
-
g.strokeStyle = "rgba(180,200,220,0.8)";
|
|
2748
|
+
g.strokeStyle = light ? "rgba(104,130,156,0.8)" : "rgba(180,200,220,0.8)";
|
|
2739
2749
|
g.lineWidth = .8;
|
|
2740
2750
|
g.beginPath();
|
|
2741
2751
|
g.ellipse(sp.x, sp.y, sp.w, sp.h, 0, 0, Math.PI * 2);
|
|
2742
2752
|
g.stroke();
|
|
2743
2753
|
g.restore();
|
|
2744
2754
|
}
|
|
2745
|
-
} else if (weather === "sakura")
|
|
2746
|
-
|
|
2747
|
-
f
|
|
2748
|
-
|
|
2749
|
-
f.y
|
|
2750
|
-
f.x
|
|
2751
|
-
|
|
2752
|
-
|
|
2753
|
-
|
|
2754
|
-
|
|
2755
|
-
|
|
2756
|
-
|
|
2757
|
-
|
|
2758
|
-
|
|
2759
|
-
|
|
2760
|
-
|
|
2761
|
-
|
|
2762
|
-
|
|
2763
|
-
|
|
2764
|
-
|
|
2765
|
-
|
|
2766
|
-
|
|
2767
|
-
|
|
2768
|
-
|
|
2769
|
-
|
|
2770
|
-
|
|
2771
|
-
|
|
2772
|
-
|
|
2773
|
-
|
|
2755
|
+
} else if (weather === "sakura") {
|
|
2756
|
+
const imgs = light ? SAKURA_IMAGES_LIGHT : SAKURA_IMAGES;
|
|
2757
|
+
const alpha = (f) => light ? Math.min(1, f.opacity + .2) : f.opacity;
|
|
2758
|
+
for (const f of FX.sakura) {
|
|
2759
|
+
f.y += f.speedY;
|
|
2760
|
+
f.x += Math.sin(f.phase + time * f.swayFreq) * f.drift;
|
|
2761
|
+
if (f.y > h + f.size) {
|
|
2762
|
+
f.y = -f.size;
|
|
2763
|
+
f.x = Math.random() * w;
|
|
2764
|
+
}
|
|
2765
|
+
if (f.x > w + f.size) f.x = -f.size;
|
|
2766
|
+
else if (f.x < -f.size) f.x = w + f.size;
|
|
2767
|
+
const rot = Math.sin(f.phase + time * f.swayFreq * 1.7) * .9 + time * f.spin;
|
|
2768
|
+
const wob = 1 + .12 * Math.sin(f.phase * 2 + time * f.swayFreq * 2.3);
|
|
2769
|
+
const img = f.spriteIndex >= 0 ? imgs[f.spriteIndex] : void 0;
|
|
2770
|
+
if (img !== void 0) {
|
|
2771
|
+
g.save();
|
|
2772
|
+
g.globalAlpha = alpha(f);
|
|
2773
|
+
g.translate(f.x, f.y);
|
|
2774
|
+
g.rotate(rot);
|
|
2775
|
+
g.scale(f.size * f.wobble * wob / 18, f.size * f.wobble / 18);
|
|
2776
|
+
g.drawImage(img, -18, -18, 36, 36);
|
|
2777
|
+
g.restore();
|
|
2778
|
+
} else {
|
|
2779
|
+
g.save();
|
|
2780
|
+
g.globalAlpha = alpha(f);
|
|
2781
|
+
g.translate(f.x, f.y);
|
|
2782
|
+
g.rotate(rot);
|
|
2783
|
+
g.scale(f.size * f.wobble * wob / 10, f.size * f.wobble / 10);
|
|
2784
|
+
g.fillStyle = light ? SAKURA_PALETTE_LIGHT[0] : SAKURA_PALETTE[0];
|
|
2785
|
+
tracePetal(g, 0, 0, 1, 0);
|
|
2786
|
+
g.fill();
|
|
2787
|
+
g.restore();
|
|
2788
|
+
}
|
|
2774
2789
|
}
|
|
2775
2790
|
}
|
|
2776
2791
|
}
|
|
2777
2792
|
function FxCanvas() {
|
|
2778
2793
|
const s = useS();
|
|
2779
2794
|
const ref = react.useRef(null);
|
|
2795
|
+
/** 粒子配色跟随背景亮度:浅色主题(以及任何主题下的高饱和极光)
|
|
2796
|
+
* 需要更深的粒子颜色才可辨识。ref 让 RAF 循环每帧读到最新值,
|
|
2797
|
+
* 主题/背景切换时无需重建粒子场。 */
|
|
2798
|
+
const lightRef = react.useRef(!(s.dark === true) || s.cfg.bg === "aurora");
|
|
2799
|
+
react.useEffect(() => {
|
|
2800
|
+
lightRef.current = !(s.dark === true) || s.cfg.bg === "aurora";
|
|
2801
|
+
}, [s.dark, s.cfg.bg]);
|
|
2780
2802
|
react.useEffect(() => {
|
|
2781
2803
|
const cvs = ref.current;
|
|
2782
2804
|
if (cvs === null) return;
|
|
@@ -2796,7 +2818,7 @@ window.__ModuleLoader__.load({
|
|
|
2796
2818
|
return;
|
|
2797
2819
|
}
|
|
2798
2820
|
raf = requestAnimationFrame(loop);
|
|
2799
|
-
fxFrame(g, cvs, weather, Date.now() - t0);
|
|
2821
|
+
fxFrame(g, cvs, weather, Date.now() - t0, lightRef.current);
|
|
2800
2822
|
};
|
|
2801
2823
|
loop();
|
|
2802
2824
|
return () => {
|
|
@@ -4893,7 +4915,7 @@ window.__ModuleLoader__.load({
|
|
|
4893
4915
|
}
|
|
4894
4916
|
function ExportTab() {
|
|
4895
4917
|
const s = useS();
|
|
4896
|
-
return react.createElement("div", { className: "vx-col" }, react.createElement("div", { className: "vx-muted" }, "将当前会话导出为文件:JSON 可导入其他工具,Markdown 便于阅读分享,
|
|
4918
|
+
return react.createElement("div", { className: "vx-col" }, react.createElement("div", { className: "vx-muted" }, "将当前会话导出为文件:JSON 可导入其他工具,Markdown 便于阅读分享,HTML 内嵌图片(导出 .html 文件,浏览器打开后打印即可另存为 PDF)。"), react.createElement("div", { className: "vx-row wrap" }, react.createElement("button", {
|
|
4897
4919
|
className: "vx-btn big",
|
|
4898
4920
|
disabled: s.exporting === true,
|
|
4899
4921
|
onClick: () => runExport("json")
|
|
@@ -4914,7 +4936,7 @@ window.__ModuleLoader__.load({
|
|
|
4914
4936
|
}, react.createElement(Icon, {
|
|
4915
4937
|
n: "download",
|
|
4916
4938
|
size: 14
|
|
4917
|
-
}), "
|
|
4939
|
+
}), " HTML(含图片)")), s.exporting === true ? react.createElement("div", { className: "vx-muted vx-pad-sm" }, "导出中…") : null, react.createElement(BackupControls, null));
|
|
4918
4940
|
}
|
|
4919
4941
|
function MermaidTab() {
|
|
4920
4942
|
const [engine, setEngine] = react.useState(mermaidState.status);
|