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

@zhushanwen/zcode-session-source

v0.2.3

Published

Read-only zcode session database source: bun/node dual sqlite driver with a four-level CANTOPEN recovery ladder, transcript row queries, and schema version gate

Readme

@zhushanwen/zcode-session-source

zcode subagent 会话库(SQLite)的唯一只读读取基座。三个消费面:session-reader 扩展 (bun 宿主)、runtime 会话导入薄包装(node 侧)、未来新增的 coding-agent source。

内容

  • sqlite-driver(D3 双驱动):运行时探测 bun/node,动态 import 经变量间接 (esbuild 规约防护);适配层只暴露 open / prepare / all / get / close 公共子集。
  • 四级恢复阶梯(设计 §3.5 单一规格,全网唯一):
    • L1 直开(readonly,-wal 在场正常工作)
    • L2 immutable 逃逸(常态恢复,零拷贝;仅当开库前确认 -wal 不存在——有内容 -wal 下 immutable 静默丢行,必须门控。darwin bun 常态;linux bun 的 file: URI 开库不可用,直开失败直接落 L3——bun 平台分叉矩阵登记在 src/__tests__/platform-matrix.ts)
    • L3 小库快照兜底(db 拷 mkdtemp 固定前缀 taiji-zcode-snap- + 自建 0 字节 -wal → 开库后验证 sqlite_master 表集合含 session/message/part;规模门 256MB 拒拷;读后 finally 清理。$TMPDIR 治理面:快照属「读快照」非对话数据 存放——源库只读零触碰、副本即弃,taiji 侧登记为 data-source-registry §4 ⑰ 〔ADR-0063 I2 的登记例外〕,详见 recovery.ts 头注)
    • L4 错误面(SqliteUnreadableError,attempted 记录已尝试级别,供上层映射 消费侧错误码——本包不私建错误码词表)
    • 拷贝集唯一定义:db only + 自建 0 字节 -wal;-wal/-shm 在场绝不自动拷贝 (防静默回滚),-shm 永不进拷贝集。
  • sqlite-access:行集查询(getSessionTranscript:session → message → part 三级表,联合序)、schema 版本已知集闸门(KNOWN_ZCODE_SCHEMA_VERSIONS)、 库路径投影与白名单集合(路径段常量同源 @zhushanwen/subagent-engine-sdk, dataDir 由调用方传入,本包不做宿主路径推导)。

测试(D3 源级双跑)

pnpm vitest run        # node 趟(node:sqlite 驱动路径)
bunx vitest run        # bun 趟(bun:sqlite 驱动路径,挂 pre-commit/CI)

同一断言集双趟执行,分别覆盖两条驱动路径;fixture 建库同样经变量间接取当前 运行时的可写连接(bun 下 node:sqlite 不可用)。测试只写删 os.tmpdir() 下 自建自删目录,不触真实数据目录。