@michengai/dsh-archive-manager 1.0.1 → 1.0.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 +6 -4
- package/CHANGELOG.zh-CN.md +6 -4
- package/lib/session-repair.js +14 -3
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -6,12 +6,14 @@ Published release notes are retained below; new versions are added without remov
|
|
|
6
6
|
|
|
7
7
|
## Unreleased
|
|
8
8
|
|
|
9
|
+
## 1.0.2 - 2026-09-21
|
|
10
|
+
|
|
11
|
+
- Fix legacy session repair incorrectly rejecting Windows short and extended paths while retaining protection against directory links.
|
|
12
|
+
|
|
9
13
|
## 1.0.1 - 2026-09-21
|
|
10
14
|
|
|
11
|
-
-
|
|
12
|
-
-
|
|
13
|
-
- Crop the personal filename strip from both screenshots, ship smaller WebP assets and DSH support badges, and remove the unused menu screenshot.
|
|
14
|
-
- Check all 11 runtime modules before packaging and build before standalone compatibility tests. Release notes are generated from the bilingual changelogs for GitHub Releases; the stale standalone notes file is no longer included in npm packages.
|
|
15
|
+
- Fix navigation errors and incorrect turn counts when session data is malformed.
|
|
16
|
+
- Remove personal information from documentation screenshots and reduce package size.
|
|
15
17
|
|
|
16
18
|
## 1.0.0 - 2026-09-21
|
|
17
19
|
|
package/CHANGELOG.zh-CN.md
CHANGED
|
@@ -6,12 +6,14 @@
|
|
|
6
6
|
|
|
7
7
|
## Unreleased
|
|
8
8
|
|
|
9
|
+
## 1.0.2 - 2026-09-21
|
|
10
|
+
|
|
11
|
+
- 修复 Windows 短路径和扩展路径导致旧会话修复被误拦截的问题,保留目录链接安全防护。
|
|
12
|
+
|
|
9
13
|
## 1.0.1 - 2026-09-21
|
|
10
14
|
|
|
11
|
-
-
|
|
12
|
-
-
|
|
13
|
-
- 裁掉两张截图底部的个人文件名条,发布体积更小的 WebP 图片和 DSH 支持徽章,移除未使用的菜单截图。
|
|
14
|
-
- 打包前检查全部 11 个运行模块,独立兼容测试先构建。GitHub 发行说明由双语更新日志生成;npm 包不再包含容易过期的独立发行说明文件。
|
|
15
|
+
- 修复会话数据异常时的导航报错和轮次统计问题。
|
|
16
|
+
- 移除文档截图中的个人信息,缩小安装包体积。
|
|
15
17
|
|
|
16
18
|
## 1.0.0 - 2026-09-21
|
|
17
19
|
|
package/lib/session-repair.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { record } from "./contracts.js";
|
|
2
2
|
import { createHash, randomUUID } from "node:crypto";
|
|
3
|
-
import { lstat, readFile, readdir, open, link, unlink,
|
|
4
|
-
import { join, resolve, basename } from "node:path";
|
|
3
|
+
import { lstat, readFile, readdir, open, link, unlink, rename } from "node:fs/promises";
|
|
4
|
+
import { join, resolve, basename, dirname } from "node:path";
|
|
5
5
|
import * as zlib from "node:zlib";
|
|
6
6
|
import { classifySessionError } from "./archive-discovery.js";
|
|
7
7
|
const LIMIT = 32 * 1024 * 1024;
|
|
@@ -58,9 +58,20 @@ async function regularFile(path) {
|
|
|
58
58
|
const stat = await lstat(path);
|
|
59
59
|
if (!stat.isFile() || stat.isSymbolicLink() || stat.size > LIMIT) throw new Error("\u5DE5\u4EF6\u4E0D\u662F\u53EF\u5B89\u5168\u5904\u7406\u7684\u5E38\u89C4\u65E5\u5FD7\u6587\u4EF6");
|
|
60
60
|
}
|
|
61
|
+
async function regularDirectory(directory) {
|
|
62
|
+
let current = resolve(directory);
|
|
63
|
+
while (true) {
|
|
64
|
+
const parent = dirname(current);
|
|
65
|
+
if (parent === current) return;
|
|
66
|
+
const stat = await lstat(current);
|
|
67
|
+
if (stat.isSymbolicLink()) throw new Error("\u4F1A\u8BDD\u76EE\u5F55\u5B58\u5728\u94FE\u63A5\u91CD\u5B9A\u5411\uFF0C\u9700\u4EBA\u5DE5\u5904\u7406");
|
|
68
|
+
if (!stat.isDirectory()) throw new Error("\u4F1A\u8BDD\u8DEF\u5F84\u4E0D\u662F\u5E38\u89C4\u76EE\u5F55\uFF0C\u9700\u4EBA\u5DE5\u5904\u7406");
|
|
69
|
+
current = parent;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
61
72
|
async function prepareAutomationRepair({ directory, target, sessionId, format }) {
|
|
62
73
|
if (!format || format.currentVersion !== 3 || typeof format.createRestore !== "function") throw new Error("\u5F53\u524D\u5BBF\u4E3B\u4E0D\u652F\u6301\u6B64\u4FEE\u590D\uFF0C\u8BF7\u5347\u7EA7 DSH \u540E\u91CD\u8BD5");
|
|
63
|
-
|
|
74
|
+
await regularDirectory(directory);
|
|
64
75
|
const names = (await readdir(directory)).filter((name) => /^session(?:\.v[1-9][0-9]*)?\.jsonl(?:\.zstd)?$/.test(name));
|
|
65
76
|
const sources = names.filter((name) => /^session\.jsonl(?:\.zstd)?$/.test(name));
|
|
66
77
|
if (sources.length !== 1 || names.some((name) => name !== sources[0] && name !== basename(target))) throw new Error("\u53D1\u73B0\u591A\u4E2A\u6216\u975E\u65E7\u7248\u65E5\u5FD7\u5DE5\u4EF6\uFF0C\u8BF7\u5148\u68C0\u67E5\u4EE3\u9645\u72B6\u6001");
|