Skip to content
dsh.fish
Bundle

@jw-king/dsh-plugin-workspaces-extra

DeepSeek Harness UI plugin: session deletion (删除会话). Adds a header action on the current session with a confirm dialog; on confirm it terminates the session's agent and removes the session's files and local data.

License
MIT
Updated
Updated 22 hours ago

Readme

# @jw-king/dsh-plugin-workspaces-extra

DeepSeek Harness 组合包插件:**删除会话**。

在会话头部「Session 日志」按钮右边增加一个「删除」动作(官方增量插槽 `conversation.session.header.utilities`,order 排在其后),点击后弹出全屏二次确认框(`shell.overlay` 插槽)。确认后插件会:

1. **终止会话** — 取消该会话正在运行的 agent、flush 未落盘事件,并把会话从内存 store 中驱逐(`session/disposed` 广播后侧栏列表自动移除该行);
2. **删除文件与数据** — 删除该会话在 DSH home 下的全部磁盘数据:
   - `~/.dsh/sessions/<项目key>/session-<id>/`(会话日志)
   - `~/.dsh/storages/session_projcache/sessions/session-<id>.json`(投影缓存)

> 说明:官方各版本(master / npm 0.1.2-rc.1)均不存在 `sidebar.workspaces.row-menu` 插槽,向未声明插槽注册会抛错,因此本插件采用官方增量插槽 `conversation.session.header.actions` + `shell.overlay` 实现同等能力。

## 安装

```bash
dsh plugin --profile web add @jw-king/dsh-plugin-workspaces-extra
# 或本地目录 / tarball
dsh plugin --profile web add ./dsh-plugin-workspaces-extra
```

重启 Web UI 后,打开任意会话,标题旁出现「删除」按钮。

## 结构

```
src/index.js           宿主半插件:注册 HTTP 路由
src/route-handler.js   POST /jwk-session-delete/api/delete 处理器
src/delete-session.js  终止 + 驱逐 + 文件收集/删除(纯函数,可测)
lib/client.js          浏览器半(dsh.client bundle,手写、免构建)
tests/                 node --test 单元测试
```

## 请求策略

路由仅接受携带自定义头 `x-jwk-session-delete: 1` 的同源 JSON POST(跨源需预检而本路由不应答预检,浏览器会直接拦截),且 `sessionId` 必须是 UUID 形态,杜绝路径穿越。

## 已知边界

- `~/.dsh/attachments/` 为内容寻址的跨会话共享存储,不做按会话清理。
- 浏览器半依赖 `slots` 服务;插件注册包裹在 `ctx.slots.inject()` 中,随宿主插槽声明自动重挂。

## 开发

```bash
npm run check   # 语法检查
npm test        # 单元测试
```

Install

dsh plugin --profile web add @jw-king/dsh-plugin-workspaces-extra@0.1.0

Profile: web

Source