dsh-workspace-heal 0.1.0 → 0.1.1
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/README.md +14 -6
- package/package.json +6 -3
package/README.md
CHANGED
|
@@ -17,14 +17,19 @@ DSH 按「会话头里的 `cwd`」把会话归属到工作区。文件夹被改
|
|
|
17
17
|
|
|
18
18
|
## 安装
|
|
19
19
|
|
|
20
|
+
从 npm 安装(推荐):
|
|
21
|
+
|
|
20
22
|
```bash
|
|
21
|
-
|
|
22
|
-
|
|
23
|
+
dsh plugin --profile <你的 profile> add dsh-workspace-heal
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
改本地代码时,从目录安装(`link:` 方式,改动即时生效):
|
|
23
27
|
|
|
24
|
-
|
|
28
|
+
```bash
|
|
29
|
+
dsh plugin --profile <你的 profile> add /absolute/path/to/dsh-workspace-heal
|
|
25
30
|
```
|
|
26
31
|
|
|
27
|
-
也可以在 DSH
|
|
32
|
+
也可以在 DSH 的插件管理器里安装。装完无需重启即可激活(HMR)。
|
|
28
33
|
|
|
29
34
|
## 使用
|
|
30
35
|
|
|
@@ -50,7 +55,7 @@ dsh plugin --profile <profile> add /absolute/path/to/dsh-workspace-heal
|
|
|
50
55
|
模型 → workspace_heal({ action: 'import', sessionId: 'session-…' })
|
|
51
56
|
```
|
|
52
57
|
|
|
53
|
-
](https://gcore.jsdelivr.net/gh/nlflora/dsh-workspace-heal@main/docs/preview.png)
|
|
54
59
|
|
|
55
60
|
上图两段都是工具的原始返回:`status` 说明三个工作区的判定结果(`notes` 缺失且有会话 → 会重建;`scratch` 缺失但没有会话 → 永不重建),`preview` 就是交给用户确认的摘要正文。
|
|
56
61
|
|
|
@@ -61,11 +66,13 @@ dsh plugin --profile <profile> add /absolute/path/to/dsh-workspace-heal
|
|
|
61
66
|
```yaml
|
|
62
67
|
- id: workspace-heal
|
|
63
68
|
config:
|
|
64
|
-
autoHeal: true #
|
|
69
|
+
autoHeal: true # 关掉就只保留工具(拿不准时先设 false)
|
|
65
70
|
intervalSeconds: 60 # 检查间隔,最少 10 秒
|
|
66
71
|
digestMaxChars: 1800 # 单个摘要的字符上限
|
|
67
72
|
```
|
|
68
73
|
|
|
74
|
+
> ⚠️ **`autoHeal` 默认是 `true`**:插件每 60 秒检查一次,命中条件时会**真的往磁盘 `mkdir`**。三重条件很窄,但如果你希望"我没明确要求之前什么都别写",先把 `autoHeal` 设成 `false`,需要时手动调 `workspace_heal({ action: 'heal' })`。
|
|
75
|
+
|
|
69
76
|
## 判定规则(重要)
|
|
70
77
|
|
|
71
78
|
**什么时候重建目录**:三个条件同时成立才动手。
|
|
@@ -87,6 +94,7 @@ dsh plugin --profile <profile> add /absolute/path/to/dsh-workspace-heal
|
|
|
87
94
|
- 摘要是**有损**的:用于接着干活,不是逐字恢复。
|
|
88
95
|
- 摘要来自会话日志里的 `user/message` / `assistant/message` / `tool/call`;**运行时注入块会被剔除**(`<system-reminder>`、`[MNEMON]` 快照、`Current runtime context` 等),所以「最近的请求」里不会出现系统塞进去的上下文。
|
|
89
96
|
- 读会话走 `sessionPersistence` 的只读句柄,取头尾各一段,不会把 13 MB 的日志整个读进内存。
|
|
97
|
+
- **卸载插件不会删掉它建出来的目录。** 重建出来的目录属于你的文件系统,卸载后照旧存在;要清理请手动删。
|
|
90
98
|
|
|
91
99
|
## 测试
|
|
92
100
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-workspace-heal",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Recreate deleted workspace folders that still own sessions, and import another session's context as a summary. Never rewrites session logs.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -22,10 +22,13 @@
|
|
|
22
22
|
"check": "node --check index.js"
|
|
23
23
|
},
|
|
24
24
|
"dsh": {
|
|
25
|
-
"bundle": {
|
|
25
|
+
"bundle": {
|
|
26
|
+
"patch": "./cordis.patch.yml"
|
|
27
|
+
}
|
|
26
28
|
},
|
|
27
29
|
"engines": {
|
|
28
|
-
"node": ">=18"
|
|
30
|
+
"node": ">=18",
|
|
31
|
+
"dsh": ">=0.2.1-rc.1"
|
|
29
32
|
},
|
|
30
33
|
"keywords": [
|
|
31
34
|
"dsh",
|