@xyo-network/event-kit-example

中文文档
2.3.4发布于 2026/11/03LGPL-3.0-onlyTypeScriptES Module

Design-partner style checkpointing reducer example for Event Kit

原始使用文档

@xyo-network/event-kit-example

Public npm package (publishConfig.access: public) — design-partner reference for the White Paper split:

RoleOwner
Generic wake daemonEvent Kit publisher + admission gate
Application reducerYou — checkpoint ranges from admitted wakes

Replaces

Typical bespoke “HMAC webhook URL that runs my indexer”:

  • open or semi-secret HTTP that executes heavy work inline
  • hand-rolled shared secrets without on-chain enable/disable
  • no idempotent wakeId / grant freshness story

This example rehearses admit-and-enqueue → checkpointing reducer instead. Its specs now drive the real D-002 path end to end: a real XYO account mints the wallet JWT, the gate runs verifyWakeRequest + admitAndEnqueue, and the failure matrix covers a malformed token, a Payload the token does not commit to, a wrong audience, an out-of-scope queue, a revoked grant, concurrent replay, idempotent retry, and checkpoint-save failure.

Chain state, the queue, and the inbox remain in-memory, so this is rehearsal evidence. It does not close the design-partner gate, which needs a partner to delete equivalent bespoke webhook auth or a signed deferral.

API

  • createCheckpointingRangeReducer — applies fromPosition/toPosition and persists lastProcessedPosition plus scoped wake/hash records
  • createMemoryReducerCheckpointStore — in-memory checkpoint for tests/demos

Use a separate checkpoint store for each source and logical consumer. Admission pins source identity and the accepted subscription before the reducer sees a wake. Stores must provide runExclusive for all reducers sharing that checkpoint. The memory implementation supplies this serialization; a persistent implementation must coordinate its actual owners. ID-only checkpoints fail visibly and require explicit evidence-backed migration. Serialization reduces parallelism for one checkpoint. applyRange still needs repeat-safe external effects because a process may die after those effects and before checkpoint save.

See specs for the happy path and the injected failure cases. Body tampering is detected by recomputing the XYO Payload hash and comparing it with the wallet-signed JWT eventHash; there is no separate event signature.

版本与发布记录

@xyo-network/event-kit-example 共发布 22 个版本,首次发布于 2026/08/21;过去 12 个月发布了 22 个版本。

版本发布日期距今
2.3.4latest2026/11/03今天
2.3.32026/11/03今天
2.3.22026/10/313 天前
2.3.12026/10/303 天前
2.3.02026/10/295 天前
2.2.32026/10/286 天前

关于 @xyo-network/event-kit-example 的常见问题

@xyo-network/event-kit-example 是什么?

Event Kit的设计伙伴风格的检查点减速器示例

如何安装 @xyo-network/event-kit-example?

在项目目录运行 npm install @xyo-network/event-kit-example,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:ajv(^8.20)、zod(^4.6)、@ariestools/sdk(^9.0)、@xyo-network/sdk(^8.1)、@ariestools/actor(^2.0)、@opentelemetry/api(^1.10)、@xyo-network/sdk-protocol(^8.0)、@xyo-network/xl1-protocol(^5.8)、@xyo-network/xl1-statement-graph-sdk(^0.7)、@xyo-network/xl1-statement-graph-engine(^0.7)、@xyo-network/xl1-statement-graph-schemas(^0.7)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@xyo-network/event-kit-example 支持 TypeScript 吗?

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

@xyo-network/event-kit-example 支持 ESM 还是 CommonJS?

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

@xyo-network/event-kit-example 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=26。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@xyo-network/event-kit-example 可以商用吗?

@xyo-network/event-kit-example 使用 LGPL-3.0-only 许可。弱 Copyleft:作为库被调用时通常不要求开源你自己的代码,但修改库本身需以 LGPL 开源;前端打包合并后的适用边界存在不同理解。以上为概括,不构成法律意见,请以许可原文为准。

@xyo-network/event-kit-example 还在维护吗?

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