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

@x1a0f3n9/dsh-client-ui-reference

v0.1.7-rc.4

Published

Unified Web @file and @session reference source

Readme


description: "Web @file 与 @session 引用 source:候选项、排序,以及原子行内引用(统一的文件/会话选取)。" kind: "package-reference"

@x1a0f3n9/dsh-client-ui-reference

English | 中文

概述

Web 用户需要从同一个 @ 补全菜单提及文件、文件夹或会话时,可以使用 dsh-client-ui-reference。菜单先列出文件,再列出会话;其中一组无法加载时,另一组仍然可用。选择文件、文件夹或会话会插入带稳定剪贴板形式的原子引用;文件夹行还允许用户在不关闭补全的情况下继续下钻。文件行省略多余的根目录位置,会话行仅在工作区与当前工作区不同时显示该工作区。会话 mention 会在捕获模型上下文前接受校验,而浏览候选项不会影响模型。

目录


使用本包

只要组合挂载了本包且存在宿主 ctx.fileReferences 提供方,该 source 即处于活动状态。输入 @ 后跟一个未加引号的 token,会先看到文件、再看到会话;打开 @"… 则只搜索文件。候选列表是补全菜单,不是搜索结果页:选一次、继续输入即可。

选择后会插入什么

选择文件会关闭补全,并显示为带文件图标与业务色文件名的原子行内引用。目录行携带两个动词:选定 pick(点击行主体或 Enter)把文件夹本身解析为同类原子引用——文件夹图标、带尾斜杠的标签、以规范 @dir/ mention 为序列化形式;钻取动作(Tab 或行尾 chevron)则保持带文件夹图标的可编辑路径纯文本,并让菜单在尾部斜杠处保持活跃,用户可以继续进入下一层。包含空白的路径使用 @"path with spaces",用户显式打开的引号会继续保留。

选择会话会插入一个原子的行内引用,其隐藏 ref 与剪贴板表示均为宿主返回的规范 @[label](dsh-session:…) mention;可见形式为聊天气泡图标加会话标题。发送会经 session.prompt 携带该 mention,session-reference 服务会在 agent/pre-step 校验它并捕获模型上下文。

失败行为

某个候选领域不可用或失败时,该领域不产生任何行,另一领域仍正常列出。会话引用准备失败发生在提示词接受后,并会终止该 agent 轮次。

点击输入框中的文件引用,可在右侧栏预览文件当前的内容。带引号路径中的空格会保留,路径按输入框所属 Session 解析。文件夹和 Session 引用保留原有的编辑行为。


理解实现

该 source 把候选编码保留在注册 effect 内部:/client 导出接口只包含插件主体(apply/inject)。

候选流程

对于未加引号的 token,浏览器会同时启动 fileReferences/list 与 sessionReferenceResolver/candidates Remote 调用,再按文件、当前 Session 的直接 subagent、其他 Session 的确定性顺序排列。各行使用 resolver 的显示标题;subagent 优先使用创建标签,普通 Session 保持投影标题,并渲染在 locale 管理的分组标题下,不显示重复的原始 reference source 标题。会话行用宿主会话列表的 updatedAt 经该列表相同的相对时间分档标注时间,因此同一个会话在两处读到的时长一致;列表中没有的会话回落到候选自带的创建时间。下钻后的查询会发布一条从工作区根目录到当前目录的面包屑;每一节携带的下钻载荷与文件夹行相同,因此「回到某一步」与「进入某一层」是同一个结果。

候选请求要求客户端已持有该会话,并共用一个临时的 referenceCandidates 引用。两个发现调用都等待该会话首次历史打开成功;未持有会话或打开失败时,均不发送 RPC。候选请求的取消信号同时覆盖历史等待和两个调用,查询结束时释放临时引用。

序列化

文件选择把共享 @path 语法所定义的自然文本保留为隐藏的序列化与剪贴板形式。会话选择使用规范的 @[label](dsh-session:…) mention;序列化永远不会根据可见标题重建身份。


进一步探索

以下页面覆盖建议机制、引用 seam 与输入流水线。


模型体验

间接影响模型体验:通过宿主拥有的提供方实现,本包的引用选择把文件指引与会话快照准备委托给它们。

KV Cache 影响

浏览候选项不会影响模型。选择文件或会话只会改变新用户消息的后缀,以及紧随该消息、由宿主准备的会话引用上下文;目标会话更早的历史保持不变。

已知限制与延期工作

这些限制说明引用 source 何时帮不上忙;它们是当前包约束。

  • 候选失败有意保持静默:Remote 发现调用不可用或失败时,该领域不产生候选行。会话引用准备失败发生在提示词接受后,并会终止该 agent 轮次。
  • 浏览器侧不扫描文件:Web 补全需要挂载宿主 ctx.fileReferences 提供方;浏览器无法回退到自身文件系统。
  • 会话搜索仍仅使用元数据:发现流程通过 ctx.sessionReferenceResolver 筛选 session id、cwd 与以日志为依据的最新标题;不搜索消息主体或完整 transcript。

开发备注

无。

运行时不变式: 不发布伴生入口。插件只注册一个 slash source,HMR 测试覆盖释放;它不发出 Cordis 事件,也不持有跨插件可变状态。