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

@lexjade-ai/dsh-api-session-controller

v0.1.2-alpha.1

Published

Session Remote commands, cold reads, and live control transport

Downloads

28

Readme


description: "Host 与 Client 会话控制:创建、恢复、提示、跟随历史并投影实时会话状态。" kind: "package-reference"

Session Controller

English | 中文

概述

@lexjade-ai/dsh-api-session-controller 拥有 Host 的 ctx.sessionController 服务,以及生成的 Client sessionskillsfileReferences Remote namespace。它提供 Session 生命周期与历史、Host generation 模型目录、工作区路径打开、用户可调用 skill 发现,以及面向 Agent 的文件引用 adapter。当 Client 需要按 Session 寻址的操作时,请通过 API Gateway 使用它。

目录


使用本包

历史页与 follow opening snapshot 携带带判别字段的 SessionHistoryRecord。两个分支都使用 { type, event }type: 'event' 携带一个原始 SessionWireEventtype: 'chunks' 则携带一个由连续且属于同一 block 的 assistant/chunk delta 组成的无损 ChunkRowEvent。两种内部值都公开 typeseqtimedata,因此 Client 无需逐 record 转换,就能把每条已接受 record 保留为一个 SessionEventLikeEntry。packed event 的 seqtime 表示首成员,data 保留 fragment 与 timestamp-gap 数组。实时 follow frame 继续携带单个 event record。工具参数、结果内容、失败信息和 tool/result.data.meta 原样通过;controller 不解析 Tool definition、不运行 presenter,也不附加 UI 数据。

每个 endpoint 都声明自己的激活策略。列表、搜索、附件、历史页、日志跟随、skill 发现和工作区路径打开可以在不激活 Agent 的情况下检查 persistence;canOpenWorkspacePath() 无需指定 Session 即可报告原生打开能力。queue 变更与取消要求 live 状态;模型、重命名、prompt 和文件引用操作可以解析或恢复普通 Session。只有 create 与 fork 会直接创建新 Agent。skill 目录则优先使用已有 live Agent,否则使用所记录 preset 的常驻 scope,因此列表查询绝不会启动 Agent。

Client adapter 提供 SessionEventStream,即绑定到一个普通 Session 或 direct subagent address 的 Gateway RemoteJournalStream。它在读取首个 page 前打开 follow,只发布连续的 replaceprependappend 变更,并通过 tail page 修复重连或 seq 缺口。普通 record 覆盖 [event.seq, event.seq],packed row 覆盖 [event.seq, event.seq + memberCount - 1]。业务、persistence 或无法恢复的连续性错误会终止 stream,只有物理载体断开才触发自动恢复。SessionControlStream 是 Gateway RemoteSnapshotStream;每代都以完整的进程本地 baseline 开始,因此重连会替换 queue、jobs 和 projection 状态,而不会把瞬态值当作 durable event。

Session 对象还承载本地提交回显:session.beginSubmission 在调用方序列化与 prompt 之前,同步把一条回显写入 SessionSnapshot.pendingSubmissions,会话 UI 因此能在点击提交的当帧显示消息。prompt 的 requestId 就是关联标识,Host 本就把它回显为 durable user source 的 rpcId,queue occurrence 也把它投影为 SessionQueuedItem.rpcId。回显在观察到其 durable event 或 queue occurrence 后延迟一个动画帧退休(该延迟保证 transcript 节点可渲染之前回显仍在),带标识的 prompt 失败或被放弃时立即退休,销毁时按 failed 退休;每次退休恰好触发一次注册的 onRetire 回调。回显只存在于 Client 内存,刷新与重连只从 durable event 重建会话。


配置

| 字段 | 默认值 | 含义 | |---|---:|---| | coldBlankProbeMaxBytes | 1,024 | 可进行空白状态验证的冷 Session 工件最大物理大小;0 禁用探测 | | nativeOpen | 平台探测 | 是否能把 Session 工作区路径交给原生桌面打开器 |

生成的配置目录是所有受支持字段及其 JSDoc 的完整来源。


模型体验

无,因为被调用的 Agent 命令拥有任何模型可见效果。

KV Cache 影响

无直接影响;模型请求仍由 Agent 和 LLM 包拥有。

已知限制与延期工作

  • Control baseline 表示进程本地状态,因此 Host 重启后无法重建 jobs。
  • follow 恢复失败会对调用方可见,而不会无限重试。
  • 文件引用补全使用共享 Agent lookup,因此可能恢复冷 Session;skills/list 目录是不激活 Agent 的 skill 元数据读取路径。

开发备注

无。