dsh-zspace 0.3.2 → 0.3.3
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 +10 -0
- package/lib/tools/write.js +12 -7
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# 变更日志
|
|
2
2
|
|
|
3
|
+
## 0.3.3 — 2026-10-11
|
|
4
|
+
|
|
5
|
+
修 `zspace_write` 的**覆盖语义**(自 0.1.2 起工具描述承诺"默认覆盖",实际在全网盘根级会失败——NAS 的 `/v2/file/create` 只做新建,同名返回"存在同名文件(夹),创建失败"):
|
|
6
|
+
|
|
7
|
+
- **中转通道**:覆盖前先 `remove`(旧版进 NAS 回收站)再写;
|
|
8
|
+
- **WebDAV 直连通道**:PUT 本身就是覆盖语义,**不做**删除(避免把"覆盖"变成永久删除);
|
|
9
|
+
- 目标不存在时不触发任何删除;`overwrite: false` 行为不变(存在即拒绝);
|
|
10
|
+
- 工具 description 同步写清两条通道不同的覆盖语义(按 `dsh-plugin` 的教训:给模型的文案也是对外契约)。
|
|
11
|
+
- 验证:37 项单测(新增覆盖三分支:中转先删、WebDAV 不删、新文件不删)+ 真机自检新增「覆盖已有文件」步骤(两版写同一路径,读回第二版)。
|
|
12
|
+
|
|
3
13
|
## 0.3.2 — 2026-10-11
|
|
4
14
|
|
|
5
15
|
修正**注入给模型的指南**滞后于工具演进的问题(只影响文档文案,行为不变):
|
package/lib/tools/write.js
CHANGED
|
@@ -15,7 +15,7 @@ export function createWriteTool(ctx) {
|
|
|
15
15
|
return {
|
|
16
16
|
name: "zspace_write",
|
|
17
17
|
description:
|
|
18
|
-
"Write text straight to a file on the 极空间 / ZSpace NAS (跨网络可用) — no local temp file needed. Use it to park generated notes, reports or config onto the NAS. Overwrites an existing file by default; pass overwrite=false to refuse replacing one. Size is capped by the writeMaxBytes config.",
|
|
18
|
+
"Write text straight to a file on the 极空间 / ZSpace NAS (跨网络可用) — no local temp file needed. Use it to park generated notes, reports or config onto the NAS. Overwrites an existing file by default (relay transport: the previous version goes to the NAS recycle bin, since its create API only creates; WebDAV transport: the NAS overwrites in place); pass overwrite=false to refuse replacing one. Size is capped by the writeMaxBytes config.",
|
|
19
19
|
parameters: {
|
|
20
20
|
path: { type: "string", required: true, description: "Remote file path (absolute, home:/, public:/, or relative to the personal space)." },
|
|
21
21
|
content: { type: "string", required: true, description: "UTF-8 text to write. Use zspace_upload for binary or large files." },
|
|
@@ -47,12 +47,17 @@ export function createWriteTool(ctx) {
|
|
|
47
47
|
if (bytes > config.writeMaxBytes) {
|
|
48
48
|
throw new Error(`zspace_write: 内容 ${bytes} 字节超过 writeMaxBytes=${config.writeMaxBytes};大文件请用 zspace_upload`);
|
|
49
49
|
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
if (
|
|
50
|
+
const exists = await client
|
|
51
|
+
.info(target)
|
|
52
|
+
.then(() => true)
|
|
53
|
+
.catch(() => false);
|
|
54
|
+
if (exists) {
|
|
55
|
+
if (args.overwrite === false) throw new Error(`zspace_write: ${target} 已存在(overwrite=false 时拒绝覆盖)`);
|
|
56
|
+
// 中转通道的 /v2/file/create 只做「新建」,同名会被拒("存在同名文件(夹)"),
|
|
57
|
+
// 所以先删(进 NAS 回收站)再写;直连 WebDAV 的 PUT 本身就是覆盖语义,
|
|
58
|
+
// 在那儿先删反而可能变成永久删除,故只在中转通道这么做。
|
|
59
|
+
const { transport } = await client.transportReport();
|
|
60
|
+
if (transport === "relay") await client.remove([target]);
|
|
56
61
|
}
|
|
57
62
|
|
|
58
63
|
// 上传接口只吃本地文件,所以落一个临时文件再走同一条上传路径
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-zspace",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.3",
|
|
4
4
|
"description": "极空间(ZSpace)NAS plugin for DeepSeek Harness: cross-network agent tools for browsing, searching, reading, uploading and organizing NAS files through the desktop client's relay — no LAN, no WebDAV, no SSH, no Python.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|