Back to home

seekerwxy

dsh-workspace-pin

DSH (DeepSeek Harness) dynamic Cordis plugin: pin/unpin workspaces from the sidebar three-dot menu. 置顶工作区插件。

Stars
0
Language
JavaScript
Created
Aug 15, 2026
Updated
Aug 15, 2026

Introduction

DSH Workspace Pin(置顶工作区)

A dynamic Cordis plugin for DeepSeek Harness (DSH) that adds Pin to top / Unpin actions to the project (workspace) rows in the sidebar, right inside the existing "⋯" (three-dot) menu. Pinned workspaces are fixed at the top of the workspace list and the state persists across reloads.

为 DeepSeek Harness 侧边栏工作区列表增加置顶 / 取消置顶能力:左键点击项目(工作区)行的"三个点"菜单即可置顶,置顶的工作区固定在列表顶部,状态持久化,刷新页面依然生效。

Features(功能)

  • Pin / Unpin from the three-dot menu — 左键点击工作区行"⋯"菜单 → 置顶 / 取消置顶(保留原有 重命名、删除)
  • Pinned-first ordering — 置顶的工作区按置顶先后固定在列表最顶部(最新置顶在最前)
  • Pin badge — 置顶的项目标题旁显示图钉标记;侧边栏 rail 图标模式下也有图钉角标
  • Persistent state — 置顶列表持久化在工作区根目录 .dsh-workspace-pins.json
  • Fully reversible — 插件以 priority: -1 shadow 内置浏览器,停止/卸载插件后内置界面自动恢复
  • Core interactions preserved — 分组/展开收起、会话行(状态点、相对时间、重命名/分叉/归档菜单)、新建会话、rail 模式

How it works(工作原理)

DSH 的 sidebar.workspaces 区域是一个 single slot,其"⋯"菜单项硬编码在内置 ui-workspace 包中,没有菜单注入点。本插件注册一个 priority: -1 的替换条目 shadow 内置浏览器(内置为 priority: 0),以同样的数据源(useWorkspaces / useSessions)重新渲染工作区列表,并在菜单中加入"置顶"项。

  • Host half:通过 harness.handle 暴露 get-pins / set-pin 私有 RPC,将置顶 id 列表持久化到工作区根 .dsh-workspace-pins.json(使用 fs 服务)
  • Client half:注册 sidebar.workspaces 替换浏览器 + 置顶排序 + 菜单 UI(纯 React,无第三方依赖)

Install & Run(安装与运行)

This is a dynamic Cordis plugin: it lives in a DSH session, not on disk as a traditional file. Use the DSH tool cordis_define with the code below, then cordis_run the returned package.

本插件是动态 Cordis 插件(会话级临时扩展)。在 DSH 会话中使用 cordis_define 工具定义,然后 cordis_run 激活:

  1. cordis_define(kind: new,idPrefix 如 wspin),code.host 填入 plugin/host.js 的内容,code.client 填入 plugin/client.js 的内容
  2. cordis_run 激活返回的 pluginId / packageId,在审批卡片中点击允许
  3. 侧边栏工作区列表随即切换为带"置顶"菜单的版本

需要停止时使用 cordis_stop;内置浏览器会自动恢复。

Known limitation(已知限制)

sidebar.workspaces.directoryFlow 子插槽由内置条目全局独占声明(声明全局唯一),替换条目无法重新声明,因此侧边栏没有"添加工作区"入口。添加工作区仍可通过会话空态页的工作区选择器(conversation.hero.workspace)完成。

Compatibility(兼容性)

  • 适用于 DeepSeek Harness Web GUI(侧边栏 sidebar.workspaces 区域的 slot 协议)
  • 中英双语界面均支持

License

MIT