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

@morlay/session-branch

v0.0.2

Published

Provider abstraction + high-level service for rewind / retry / fork over DeepSeek Harness event-sourced sessions.

Readme

@morlay/session-branch

分支式会话编辑的契约层:定义数据层分支原语 SessionBranchProvider (rewind / forkFrom / readBranchPrefix)、高层服务 SessionBranchctx.sessionBranch)与共享的版本树投影 buildTimeline

与上游 SessionPersistence 的关系

| 面 | 上游 PersistenceBackend | 本包 SessionBranchProvider | | ------ | --------------------------------------------- | ------------------------------------------------------ | | 覆盖 | 持久读写 + 崩溃修复(append-only) | 显式回退 + 闭合边界派生(分支面) | | 原语 | loadStored / appendBatch / commitRepair | readBranchPrefix / forkFrom / rewind | | 实现方 | JSONL / RDB 等 | RDB 等(@morlay/session-rdb 同时实现两者,形成闭环) |

Provider 抽象

interface SessionBranchProvider {
  readBranchPrefix(id, atSeq?, mode?, signal?): Promise<BranchBoundary>;
  forkFrom(sourceId, options?, signal?): Promise<SessionId>;
  rewind(id, toBoundary, signal?): Promise<SessionPersistenceSnapshot>;
}
  • readBranchPrefix:定位 atSeq 锚定的闭合 turn/end 边界并返回前缀; mode: "after"(包含目标轮,fork 语义)/ "before"(排除目标轮,编辑 / 重掷 / 重试语义)。
  • forkFrom:纯 append——新会话(parentSession / seedLength),seed = 边界前缀 + seedSuffix,不触碰源会话。
  • rewind:唯一改写事件 log 的操作,事务整体提交或回滚;支持 live 会话(内存 log 截断 + 派生缓存复位 + coordinator cursor 同步,见 @morlay/session-rdbSessionBranchRdbProvider)。
  • syncLiveCursor(sessionId):编排层把 ignorable 版本效果 push 进 live log 后(不发布、不进 write-behind 缓冲),用其对齐 coordinator cursor,避免 后续 append 的 seq 校验错位(默认空实现,rdb 覆写)。

版本树

buildTimeline(snapshots, readOwnEvents, sessionId) 从会话快照(header lineage)+ 每会话自有后缀(seq >= seedLengthsession-branch/version 事件)投影完整版本树。

版本效果事件携带 ignorable: true(对核心可跳过、不进 canonical log), live 会话从内存 log 读到效果,cold 会话 timeline 只有 lineage 骨架。