Skip to content
dsh.fish
Bundle

dsh-role-cards

DSH web plugin: role-card pickers on the new-session screen — role presets and workspaces as compact cards with hover-expand details, wheel switching, and a collapsible pill header

Source
wwwangzilin
License
MIT
Updated
Updated 21 hours ago

Readme

# dsh-role-cards

DSH Web 插件:新建会话界面(hero)的组合角色卡 + 工作区卡选择器。

折叠时是一排小胶囊按钮(🎭 角色 / 📂 工作区);展开时是两行紧凑卡片(角色预设、
系统预设,然后工作区),支持悬停展开详情、滚轮切换、点击选择。

## 结构

- `src/client/ComboPanel.tsx` — 组合面板组件(角色卡 + 工作区卡)
- `src/client/index.ts` — 客户端插件入口:注册两个 hero slot
- `src/index.ts` — host half(空 apply 占位)
- `src/invariant.ts` — invariant 伴随插件
- `lib/` — tsdown 构建产物(`lib/client.js` 是浏览器 bundle)
- `cordis.patch.yml` — bundle patch(profile boot 挂载)
- `tsdown.config.ts` — 独立 tsdown 配置(node half + client half)

## 安装

在 `~/.dsh/profiles/web/package.json`:

```json
"dependencies": {
  "dsh-role-cards": "link:D://projects//ds//dsh-role-cards"
}
```

并把 `"dsh-role-cards"` 加入 `dsh.profile.bundles`,然后重启:

```sh
pnpm dsh web
```

## 构建

```sh
pnpm install   # 安装 tsdown / react 等 devDependencies
pnpm build     # tsdown 产出 lib/(index.js + invariant.js + client.js)
```

也可以直接用 harness 仓库里的 tsdown(无需本地 node_modules):

```sh
node D:\projects\ds\deepseek-harness\node_modules\.bin\tsdown.cmd
```

## 说明

- 客户端注册 `conversation.hero.agentPreset`(渲染 null,顶掉官方 chip)与
  `conversation.hero.workspace`(渲染 `ComboPanel`);不传 `priority`,由
  client-runner facade 自动分配更低优先级从而胜出。
- 角色卡显示预设 `id` 属于 `ROLE_IDS`(nekomode / luna / akane / rin / mei)时
  使用 `ROLE_META` 的 emoji + tag;其余预设归入「系统模式 / 自定义」系统卡片。
- 「添加工作区」按钮需要 `pickDirectory` 注入才可用(当前版本未注入,保持禁用)。

Install

dsh plugin --profile web add github:wwwangzilin/dsh-role-cards

Profile: web

  • This package builds from source on install. pnpm will ask you to allow its build script — that is permission to run the package’s code on your machine, outside the agent sandbox. Only allow sources you trust.
  • This source has no pinned commit, so a later push upstream changes what installs. Prefer pinning a commit.
Source