@fungi.computer/zookeeper

中文文档
0.0.32发布于 2026/11/15MITTypeScriptES Module近 30 天下载 9417

Durable Object store governor: the storage budget and pressure policy behind Shiitake's refusal door

原始使用文档

Zookeeper (@fungi.computer/zookeeper)

Zookeeper keeps a Shiitake host's Durable Object store within its storage budget: a pressure check that refuses new work near the limit, a patrol that finds the largest Sessions, and archiving when compaction drops history. Oyster's Shiitake host uses it. Storage and memory limits belong here, never in Shiitake core.

Install

npm install @fungi.computer/zookeeper

Storage pressure

openStoragePressure({ usedBytes, budgetBytes }) returns the host's StoragePressureCheck for Shiitake's storagePressure option. It reports pressure at 80% of the budget and keeps reporting it until usage falls below 75%, so admission does not flap at the threshold. Shiitake keeps the refusal door and the typed storage_pressure error; Zookeeper owns the numbers.

An invalid budget throws a contract/invalid ShiitakeError when opened. An unreadable measurement throws a store/unavailable ShiitakeError, which refuses the new work.

Zookeeper is Shiitake-only. Pi Durable hosts are out of scope.

openPatrol({ budget, readColdSessions, report }) returns host work for Shiitake's hostWork. Its synchronous pending reads only the platform's size of the store: nextWakeAt is null while the store is under the waterline (half the budget) and a time at least a second ahead (five minutes by default) while it is over. Its run is one bounded pass: when the store is over the waterline it reads one page of Sessions, skips a Session whose bytes are unknown or whose row cannot be read, and hands the host a typed PatrolReport. It evicts nothing.

zookeeperCompaction({ writer }) is the compaction handoff extension over a host-bound ArchiveWriter; the host appends it and zookeeperCompactionGrant to its roster. It archives what leaves the model context (the history and turn-prefix messages, not the summary), returns the writer's receipt as the opaque accepted receipt, and answers discarded_by_policy only when nothing leaves the context. A writer failure is a handoff failure, so compaction stops with the prior context intact; it is never a discard.

版本与发布记录

@fungi.computer/zookeeper 共发布 33 个版本,首次发布于 2026/10/23;过去 12 个月发布了 33 个版本。

版本发布日期距今
0.0.32latest2026/11/15今天
0.0.312026/11/15今天
0.0.302026/11/141 天前
0.0.292026/11/141 天前
0.0.282026/11/141 天前
0.0.272026/11/141 天前

关于 @fungi.computer/zookeeper 的常见问题

@fungi.computer/zookeeper 是什么?

Durable Object store governor: the storage budget and pressure policy behind Shiitake's refusal door

如何安装 @fungi.computer/zookeeper?

在项目目录运行 npm install @fungi.computer/zookeeper,或使用 pnpm add / yarn add / bun add。

@fungi.computer/zookeeper 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@fungi.computer/zookeeper 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@fungi.computer/zookeeper 可以商用吗?

@fungi.computer/zookeeper 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@fungi.computer/zookeeper 的下载量有多少?

根据 npm 官方下载统计,@fungi.computer/zookeeper 在 2026/10/16 – 2026/11/14 这 30 天内被下载 9,417 次,日均约 314 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@fungi.computer/zookeeper 还在维护吗?

最新版本 0.0.32 发布于 2026/11/15(今天);至今共发布 33 个版本,其中过去 12 个月发布了 33 个;首次发布于 2026/10/23。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。