Перейти к основному содержимому
7

dsh-plugin-session-colors

7vw58n3ftvq7cn89v/dsh-plugin-session-colors

Per-session color tags for DeepSeek Harness: hover a sidebar session row to pick one of 12 colors, with a colored bar on tagged rows and host-side persistence.

Установка

dsh plugin --profile web add github:7vw58n3ftvq7cn89v/dsh-plugin-session-colors

README

dsh-plugin-session-colors

English | 中文

给 DeepSeek Harness 的每个会话标上颜色:在侧栏悬停即可选色,被标色的会话一眼可辨。


中文

功能

🎨 侧栏悬停取色

鼠标停在侧栏任意会话行上,行左缘浮出一枚颜色圆点,点开即是取色面板 —— 12 种预设颜色 + 一键清除,选完立即生效。全程无需打开会话。

  • 圆点即为状态:已标色的会话显示实心色点,未标色的显示虚线圆圈
  • 面板自动在屏幕边缘翻转方向,不会溢出视野
  • 160ms 悬停防抖:扫视列表时不会误触,停留即出现

🌈 会话行着色

被标色的会话行左侧显示同色竖条(3px 内嵌条),多会话并行工作时一眼找到目标行。切换会话、刷新页面、重启应用后依然保持。

💾 宿主侧持久化

颜色存在 Harness 宿主的 storages/session-colors.json,浏览器端有 localStorage 镜像:

  • 重启应用、换浏览器都不丢
  • 打开页面即时显示(镜像先渲染,宿主数据随后对齐)
  • 宿主 API 短暂不可达时仍可查看,恢复后自动同步

安装

方式一:插件市场(推荐)

Settings → Plugin Market → 搜索 session-colors → 一键安装 → 刷新页面。

方式二:CLI

dsh plugin --profile web add dsh-plugin-session-colors

方式三:本地 link 开发

把包符号链接到 web profile 的 node_modules,并在 profile 的 package.json 登记 dependencies 与 dsh.profile.bundles。

工作原理

┌─ 浏览器(client half)────────────────┐    ┌─ 宿主(host half)──────────────┐
│ 悬停取色覆盖层(portal,不动 React DOM) │    │ /session-colors HTTP API        │
│ 会话行匹配引擎(标题精确匹配 + 兜底)     │──▶│ PUT / GET / DELETE 颜色映射      │
│ 行着色(inset bar,rAF 节流重绘)        │    │ storages/session-colors.json   │
└───────────────────────────────┘    └─────────(原子写、损坏自愈)────┘
  • 宿主半:一个零依赖的 cordis 插件,向 Harness webserver 注册 /session-colors 路由,把 sessionId → 颜色 映射持久化为 JSON(临时文件 + 原子重命名,损坏的存储文件会在下次写入时自动修复)。
  • 浏览器半:懒 CJS 工厂包(__ModuleLoader__),零运行时依赖。由于官方未提供会话行的插槽,侧栏着色通过「会话标题 ↔ 行标题 span」精确匹配实现(未读噪声安全、同名会话按 DOM 序消费、子串陷阱防护)。匹配失败只影响着色,不影响数据。

HTTP API

方法路径说明
GET/session-colors/api/colors全量颜色映射 { colors: { [sessionId]: "#rrggbb" } }
PUT/session-colors/api/colors/:sessionId设置颜色,body {"color": "#ef4444"};null 清除
DELETE/session-colors/api/colors/:sessionId清除一个会话的颜色

颜色接受 #rgb / #rrggbb 十六进制(统一规范化为小写 6 位);会话 ID 校验后落盘。

兼容性与限制

  • 标准 dsh.bundle 插件包,DeepSeek Harness Web / Desktop 均可使用
  • 侧栏着色基于 DOM 匹配(best-effort):同名会话按列表顺序取色;无标题(空白)会话不着色;Harness 大版本若更改会话行结构,着色可能失效 —— 取色与数据不受影响
  • Node ≥ 22.19 / ≥ 24

开发

node smoke-host.js                    # 宿主半离线冒烟测试(11 项)
node smoke-host-phase2.js <临时目录>    # 存储损坏自愈测试(3 项)
npm i --no-save jsdom                 # 仅 DOM 测试需要
node smoke-client-dom.js              # 浏览器半 jsdom DOM 测试(15 项)

License

MIT


English

Per-session color tags for DeepSeek Harness: hover a sidebar session row to pick a color, and tagged sessions stand out at a glance.

Features

🎨 Hover-to-color in the sidebar

Rest the pointer on any session row in the sidebar and a color dot appears at the row's left edge. Click it for the palette — 12 preset colors plus one-click clear, applied instantly. No need to open the session.

  • The dot reflects state: filled for tagged sessions, dashed outline otherwise
  • The palette flips at screen edges so it never overflows
  • A 160ms hover dwell keeps quick scanning free of pop-ups

🌈 Colored session rows

Tagged rows show a matching 3px bar on their left edge, so the session you want is findable at a glance across parallel work. Colors survive session switches, page reloads, and app restarts.

💾 Host-side persistence

Colors live in the Harness host's storages/session-colors.json with a localStorage mirror in the browser:

  • Survives restarts and browser switches
  • Instant first paint (mirror renders first, then reconciles with the host)
  • Readable even while the host API is briefly unreachable; re-syncs on recovery

Install

Option 1 — plugin market (recommended)

Settings → Plugin Market → search session-colors → install → refresh the page.

Option 2 — CLI

dsh plugin --profile web add dsh-plugin-session-colors

Option 3 — local link (development)

Symlink the package into the web profile's node_modules, then register it in the profile package.json (dependencies + dsh.profile.bundles).

How it works

  • Host half: a zero-dependency cordis plugin that registers a /session-colors route on the Harness webserver and persists the sessionId → color map as JSON (temp file + atomic rename; a corrupted store self-heals on the next write).
  • Client half: a lazy-CJS __ModuleLoader__ bundle with zero runtime dependencies. Harness ships no slot for session rows, so sidebar coloring matches session titles to row title spans exactly (unread-noise safe, DOM-order queue for duplicate titles, substring-trap guarded). A match failure only affects painting — never the data.

HTTP API

MethodPathPurpose
GET/session-colors/api/colorsFull map { colors: { [sessionId]: "#rrggbb" } }
PUT/session-colors/api/colors/:sessionIdSet a color, body {"color": "#ef4444"}; null clears
DELETE/session-colors/api/colors/:sessionIdClear one session's color

Colors accept #rgb / #rrggbb hex (normalized to lowercase 6-digit); session ids are validated before storage.

Compatibility & limitations

  • Ships as a standard dsh.bundle plugin package; works in DeepSeek Harness Web and Desktop
  • Sidebar painting is DOM-matched (best-effort): same-title rows consume colors in list order; blank/untitled sessions are never matched; a future Harness release that changes the row structure may disable painting — picking and data are unaffected
  • Node ≥ 22.19 / ≥ 24

Development

node smoke-host.js                    # host-half offline smoke tests (14 checks)
node smoke-host-phase2.js <temp-dir>  # corrupted-store recovery test
npm i --no-save jsdom                 # only the DOM test needs it
node smoke-client-dom.js              # client-half jsdom tests (15 checks)

License

MIT

Похожие плагины