GIGHT111/dsh-workspace-inspector

Plugin ⭐ 1 MIT developer-tools

DeepSeek Harness (dsh) Web 右侧面板插件:Token 用量与占比、全部历史消息目录(可折叠/点击跳转)、上下文压力、工作区文件树(点击系统默认打开)。跨平台(macOS / Windows / Linux)。

Install

> dsh plugin --profile web add github:GIGHT111/dsh-workspace-inspector
> dsh --profile web     # restart to activate
> ```
> Requirements: `dsh` installed and `pnpm` on `PATH`. After restarting, the panel opens on the right side; close it with ✕ and reopen it with the **📊 Overview** button in the session header.

## 功能

- **Token 用量(本会话累计)**:输入(未缓存)、缓存读取、输出及**各自占比**(不含缓存写入),总计 = 输入+缓存读取+输出 —— 来自 `tokenUsage` 会话投影。
- **消息目录(全部历史)**:host 重放会话**完整持久化日志**重建目录(客户端事件窗口只有最近约 50 条消息,看不到全部历史)。每条用户消息可折叠展开看该轮回复摘要与工具调用次数;点击条目滚动对话到对应消息行并高亮(若目标消息不在当前已加载窗口,会提示先加载更早历史)。摘要为启发式文本提炼,非 LLM 生成。
- **上下文压力**:下一次请求的预计 token 数、上下文窗口容量与占用百分比 —— 来自 `contextPressure` 投影。
- **工作区文件树**:以当前会话工作区为根,目录懒加载、可展开/折叠,文件显示大小;**点击文件行用系统默认应用打开**(插件自有 host 路由,与官方 openPath 同机制);隐藏文件开关与刷新。
- **关闭/重开**:✕ 一次关闭右侧列(无悬浮模式);会话头部右侧出现「📊 概览」按钮,点击重新打开右侧列,恢复原生拖拽分栏调整大小。

## 架构

双面(dual-face)插件:

| 半面 | 入口 | 职责 |
|---|---|---|
| host | `lib/index.js`(`src/index.ts`) | 注册三个 webserver 精确路由:`GET /__dsh-workspace-inspector/list?path=<abs>` 返回单层目录条目(目录+文件+size+hidden);`GET /__dsh-workspace-inspector/outline?session=<id>` 重放会话日志重建完整消息目录;`GET /__dsh-workspace-inspector/open?path=<abs>` 用系统默认应用打开文件(macOS open / Windows Invoke-Item / Linux xdg-open)。list/open 仅允许 host cwd 或已注册 workspace 根之下的绝对路径(Windows 大小写不敏感);均 `Cache-Control: no-store`。 |
| client | `lib/client.js`(`src/client/index.tsx` + `src/client/matching.ts`) | 认领右侧 `details` 列(single/session,priority -1 遮蔽默认 DetailsPanel),有会话时自动打开右侧列;✕ 一次关闭,会话头部「概览」按钮重新打开。消息目录 key 计算在 `matching.ts`(纯函数,可单测)。 |

client bundle 遵循官方 `__ModuleLoader__.load({ id, factory })` 协议:平台模块(react 等)external,由浏览器模块表应答;其余依赖内联。

## 构建与测试

Add GIGHT111/dsh-workspace-inspector to your DSH config (web profile) to enable.

README

Expand full README Collapse

README is empty.