@dsh-cc/session-cwd 0.6.0 → 0.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/README.i18n.yaml +6 -0
- package/README.md +2 -0
- package/README.zh.md +41 -0
- package/package.json +2 -2
package/README.i18n.yaml
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
# Bilingual-pair consistency record (docs/i18n/README.md): the git blob hash of each
|
|
2
|
+
# side as of the last confirmed-consistent state. Both languages carry equal authority;
|
|
3
|
+
# after editing either side, bring the other along and re-record with:
|
|
4
|
+
# pnpm check:readme --write
|
|
5
|
+
README.md: 60cddf3df2b7829f4172802a0d5c941d39a01b58
|
|
6
|
+
README.zh.md: efae0e7943f4c8e2f4a4f35a6522e116fb36b521
|
package/README.md
CHANGED
package/README.zh.md
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# @dsh-cc/session-cwd
|
|
2
|
+
|
|
3
|
+
[English](README.md) | 中文
|
|
4
|
+
|
|
5
|
+
面向 DeepSeek Harness CC 的会话级工作目录——[worktree-session-isolation 设计](../../../docs/plans/worktree-session-isolation.md)的
|
|
6
|
+
WS1 + WS2 基础。
|
|
7
|
+
|
|
8
|
+
## 拥有什么
|
|
9
|
+
|
|
10
|
+
- **`worktree/entered` 会话事件**(WS1):在模块加载时注册进持久化层的
|
|
11
|
+
`KNOWN_SESSION_EVENT_TYPES`,因此含它的日志可干净恢复。载荷:`{ path }`——
|
|
12
|
+
新的绝对会话 cwd。
|
|
13
|
+
`ExitWorktree` 经同一事件恢复上一个目录(last-wins 折叠)。
|
|
14
|
+
- **可折叠状态**(`src/state.ts`):`foldSessionCwd` 把当前 cwd 从事件日志折叠出来;
|
|
15
|
+
进程内的 `SessionCwdStore` overlay 叠放实时值,读取即时生效,且同进程内各会话
|
|
16
|
+
相互独立。
|
|
17
|
+
- **API**(`src/api.ts`):`getSessionCwd(agent)`(实时 overlay → 持久折叠 →
|
|
18
|
+
会话头部 → 回退)和 `setSessionCwd(agent, path)`(持久事件 + overlay;仅接受
|
|
19
|
+
绝对路径)。
|
|
20
|
+
- **workspace 边界守卫**(WS2,`src/listener.ts`):一个以 `{ prepend: true }`
|
|
21
|
+
注册的 `tools/pre-execute` 监听器——排在权限规则瀑布之前——把每个 fs 家族调用的
|
|
22
|
+
目标路径对照会话 cwd 校验。workspace 之外的目标在除 `bypassPermissions` 外的
|
|
23
|
+
所有模式返回 `{ kind: 'ask' }`("Operation targets path outside session workspace"),
|
|
24
|
+
该模式允许(既有审计痕迹覆盖它)。非 fs 工具、无路径调用、以及无法解析出 cwd 的
|
|
25
|
+
agent 原样放行;该守卫是 pre-execute 便利设施,不是硬性安全边界。
|
|
26
|
+
|
|
27
|
+
## 消费方
|
|
28
|
+
|
|
29
|
+
- `tool-git-worktree`:`EnterWorktree` 调用 `setSessionCwd(worktreePath)`;
|
|
30
|
+
`ExitWorktree` 以同样方式恢复 `session.originalCwd`。
|
|
31
|
+
- TUI 驱动器:项目/历史解析优先用持久折叠而非启动时头部的 cwd。
|
|
32
|
+
- CC 预设(`packages/preset/cc/agent.cordis.yml`)组合本插件,由其安装边界守卫。
|
|
33
|
+
|
|
34
|
+
## 测试
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
cd packages/workspace/session-cwd && npx vitest run tests/
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
(在根 `node_modules` 是沙箱不可写符号链接的 worktree 中,加 `--configLoader runner`
|
|
41
|
+
跳过 `.vite-temp` 打包步骤。)
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dsh-cc/session-cwd",
|
|
3
3
|
"description": "Session-scoped working directory state for DeepSeek Harness CC: durable worktree/entered session events, foldable cwd state, getSessionCwd/setSessionCwd APIs, and a pre-execute workspace boundary guard",
|
|
4
|
-
"version": "0.6.
|
|
4
|
+
"version": "0.6.2",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "git+https://github.com/dsh-cc/dsh-cc.git",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"@deepseek-ai/dsh-llm": ">=0.1.2-rc.1",
|
|
27
27
|
"@deepseek-ai/dsh-session": ">=0.1.2-rc.1",
|
|
28
28
|
"@deepseek-ai/schemastery": "^3.18.1",
|
|
29
|
-
"@dsh-cc/tools": "^0.6.
|
|
29
|
+
"@dsh-cc/tools": "^0.6.2"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@deepseek-ai/cordis": "link:../../../../deepseek-harness/vendor/cordis",
|