npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

dsh-archived-conversations

v0.3.2

Published

Show archived conversations in the DSH Web settings page with read-only message previews.

Readme

dsh-archived-conversations

在 DSH Web 设置页显示已归档对话列表,点击条目可只读预览最近的用户/助手消息。独立插件,通过 dsh plugin 安装进 web profile。

为什么是"只读预览"

DSH 产品有意禁止打开归档会话:客户端 workspaces 服务有一条强制规则——归档会话一旦成为当前会话就被立即清除回"新对话"状态("隐藏的行不能保持打开"),且当前 Host 端没有取消归档(unarchive)API。因此本插件不尝试打开或恢复归档会话,而是提供安全的只读预览:

  • 入口在设置面板(settings.section,id archived-conversations,导航项"已归档对话");
  • 页面顶部固定一行能力提示:当前不支持取消归档(原因见下),避免用户在不知情的情况归档后无法取回;
  • 页面列出所有已归档对话(标题 + 相对时间 + 数量徽标);
  • 点击某条 → Host 读取该会话日志,提取最近 6 条用户/助手文本消息(每条截断 400 字符)返回展示;
  • 完全不切换当前会话、不修改任何状态、不暴露完整日志。

为什么现在不能"移出归档"

DSH 目前没有取消归档 API:workspace-controller 只暴露 @Remote('archiveSession'),全仓无 unarchiveSession / removeArchivedSession。且插件侧无法自行实现——WorkspaceRegistry.setState 与 enqueueOperation 都是 private,registry 的公开写入口只有 archiveSession,没有可安全移除元素的公开方法。绕过私有方法直接写权威 domain state 会与 registry 的写队列和 pendingMutation 恢复逻辑并发竞争,等于让插件成为状态的第二个 owner,因此本插件不做这件事。

好消息是 harness 侧留了门:workspaceDomainSpec 的注释明确写着 "an archived session keeps its sessionIds slot (unarchiving must restore the position)",所以一旦上游补上 unarchiveSession,恢复后位置可以还原。参见 issue #2。

工作方式

  • Host 半部(src/index.ts):注册 webServer 精确路由 GET /__archived-conversations/preview?sessionId=<id>,通过 sessionQuery.readSession(live-preferred,冷会话走持久化)读取日志,只提取 user/message(真实用户来源)与 assistant/message 的纯文本块,限量返回 JSON。
  • Client 半部(src/client/index.js):window.__ModuleLoader__.load 静态 bundle,require('react'),注册 settings.section 条目,用 fetch 调 Host 预览路由;列表数据来自槽位标准 props(useSessions/useWorkspaces)。

安全设计

本插件的预览路由在发布前经过独立安全审核,并做了如下加固:

  • IDOR 防护:预览路由只在 sessionId 属于 registry 归档集合(workspaceRegistry.archivedSessionIds)时才响应,活动会话、子代理会话一律不可读(404);
  • 会话 id 校验:sessionId 必须是 DSH 会话 id 形态(session- 前缀 + UUID/计数器),否则拒绝;
  • 最小数据:只返回最近 6 条、每条 ≤400 字符的纯文本消息;不返回推理内容、工具调用、文件内容或完整日志;
  • XSS 安全:消息文本在浏览器端以 React 文本节点渲染(自动转义,无 innerHTML/dangerouslySetInnerHTML);
  • 固定错误文案:错误响应使用固定文本,不泄露内部错误细节、堆栈或路径;
  • 响应头:Cache-Control: no-store + X-Content-Type-Options: nosniff;
  • 请求来源:只接受 loopback socket、loopback Host,并拒绝跨站 Fetch Metadata、跨源 Origin/Referer;
  • 不携带凭据:插件不读取、不发送任何文件、凭据或系统信息;路由只读、同源。

说明:路由本身是 DSH 静态插件与 Host 通信的标准模式(webServer.register + fetch,与 dsh-mermaid 等社区插件一致)。预览路由即使 webServer 绑定 0.0.0.0 也只服务 loopback 请求;这不是认证层。

安装

从 GitHub 仓库安装(构建在 prepare 脚本里自动执行):

dsh plugin --profile web add github:AKS1st/dsh-archived-conversations
dsh web   # 重启 web 服务使 profile 生效

若 pnpm 提示 git 依赖需要执行构建脚本(ERR_PNPM_GIT_DEP_PREPARE_NOT_ALLOWED), 按提示把包加入 profile 的 pnpm-workspace.yaml 的 allowBuilds 后重试即可。

本地开发(先构建再安装):

npm install
npm run build
dsh plugin --profile web add .
dsh web

卸载:

dsh plugin --profile web remove archived-conversations

许可

MIT