Skip to content
dsh.fish
Bundle

dsh-conversation-folders

DeepSeek Harness plugin: folders in the sidebar — project → folder → conversation. Create, rename, and move conversations into folders.

Source
choocoo
stars
1 stars
License
MIT
Updated
Updated 5 days ago

Readme

# dsh-conversation-folders

DeepSeek Harness 第三方插件:在左侧栏内嵌「项目 → 文件夹 → 对话」层级。

- 📁 新建文件夹、重命名、删除
- 对话改名、把对话移入/移出文件夹
- 🔍 对话内容搜索(侧栏顶部搜索框,按消息内容搜索)
- 🗄 归档会话(日志保留,从侧栏隐藏)
- 数据持久化在 `~/.dsh/storages/convfolders.json`

## 文件

| 文件 | 说明 |
|---|---|
| `package.json` | 包声明;`dsh.client`(浏览器半部)+ `dsh.bundle.patch`(profile 自动挂载) |
| `lib/index.js` | Host 半部(ESM named-export):`storageDomain` 持久化 + `webServer` 注册 `POST /folders-rpc` |
| `lib/client.js` | Client 半部:`window.__ModuleLoader__.load({ id, factory })` classic script,`require('react')`,`fetch` 调 `/folders-rpc` |
| `cordis.patch.yml` | bundle 挂载层:`- insert: { id: conversation-folders, name: dsh-conversation-folders }` |

本包按官方 client bundle 约定编写(Client 半部 `window.__ModuleLoader__.load`,React 经 `require('react')` 解析;Host 半部 ESM named-export)。纯 JS,无 TypeScript/typert 构建链,schema 用恒等 parse(不校验,兼容已有数据)。

## 安装与挂载(profile 插件机制,无需自建部署)

> 原理:DSH 的 `web` profile(`~/.dsh/profiles/web/`)通过 `dsh.profile.bundles` 列出启动时自动加载的插件。装进 profile 的包只要声明 `dsh.bundle.patch`,启动即自动挂载——**不需要** clone 源码 / 自建部署 / 那套几 GB 环境。

1. **安装 pnpm**:`npm install -g pnpm`(或 `corepack enable`)
2. **安装插件**:
   ```sh
   dsh plugin --profile web add <本目录绝对路径>
   # 发布到 npm 后:dsh plugin --profile web add dsh-conversation-folders
   ```
   该命令会把包装进 `~/.dsh/profiles/web/node_modules/`,并自动加入 `dsh.profile.bundles`。
3. **若遇到 `ERR_PNPM_EPERM`**(`@img/sharp-win32-x64` 目录被正在运行的 DSH 进程锁定,Windows 常见):
   - 把本目录 junction 到 `~/.dsh/profiles/web/node_modules/dsh-conversation-folders`
     (`cmd /c mklink /J "<profile>\node_modules\dsh-conversation-folders" "<本目录>"`)
   - 在 `~/.dsh/profiles/web/package.json` 的 `dependencies` 与 `dsh.profile.bundles` 各加上 `dsh-conversation-folders`
4. **重启 DSH**:之后每次开机自动挂载,无需手动操作。

## 与同类插件的差异

| | 本包 | `dsh-session-move` | `dsh-plugin-dated-folders` |
|---|---|---|---|
| 项目内二级文件夹(新建/改名) | ✅ | ❌(其"文件夹"= workspace,只能跨项目搬) | ❌ |
| 项目内分组对话 | ✅ | ❌ | ❌ |
| 跨项目移动会话 | ❌ | ✅ | ❌ |
| 会话删除 / AI 改名 | ❌ | ✅ | ❌ |
| 归档 agent 生成的文件 | ❌ | ❌ | ✅(按日期) |

定位:**项目内手动自由分组的唯一实现**;与 dsh-session-move(跨项目搬运+删除)互补,可共存安装。

## 数据模型

`convfolders` 域(`storageDomain`),`folders` 表,每条记录:

```json
{
  "id": "f-<id>",
  "workspaceId": "<workspace uuid>",
  "title": "UI",
  "sessionIds": ["session-…"],
  "createdAt": "ISO-8601",
  "updatedAt": "ISO-8601"
}
```

约束:一个会话在同一项目内最多属于一个文件夹(`moveSession` 会先从其他文件夹移除)。

## 已知限制

- 接管了原生 `sidebar.workspaces`:**fork、workspace 新增/删除/排序** 未复刻。
- **归档无恢复入口**:本插件只提供归档(隐藏),未提供已归档视图/恢复;需要恢复时请配合社区归档管理插件(如 `dsh-archived-sessions`)。
- 相比规范的 `@Remote`(typert) RPC,本方案用裸 HTTP 路由 `POST /folders-rpc`,缺少 wire schema 校验,是刻意的最简取舍(第三方包无构建链)。
- `peerDependencies` 用 `>=0.1.0-rc.5`;若你的 DSH 版本不同,可能需要调整。

## 从动态插件到正式包的改动对照

| 动态插件 | 正式包 |
|---|---|
| `harness.handle('folders.*')` | `webServer.register({ path: '/folders-rpc' })` |
| `host.call('folders.*')` | `fetch('/folders-rpc')` |
| 恒等 `{ parse: v => v }` | 恒等 `{ parse: v => v }`(不引入 zod/schemastery 依赖) |
| `return { apply }` | ESM `export const name/inject` + `export function apply` |
| Builtin `styles.insert` | `document.createElement('style')` |
| Client Builtin `React` / `import` | `require('react')` + `window.__ModuleLoader__.load` |

Install

dsh plugin --profile web add github:choocoo/conversation-folders-package

Profile: web

  • This source has no pinned commit, so a later push upstream changes what installs. Prefer pinning a commit.
Source