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

@arkclaw/arkclaw-plugin

v0.2.5

Published

ArkClaw plugin

Downloads

118

Readme

ArkClaw Plugin

面向 OpenClaw 网关的 ArkClaw 扩展:在不修改 OpenClaw 核心的前提下,提供 Web 聊天历史分页能力与可选的消息重写。

功能特性

1. 错误文案重写(Hooks)

对已配置的错误文案进行统一重写(见下方 messageRewrite 配置)。

2. 历史会话索引(Session Key Index)

当会话被 /new/reset 重置时,自动将旧 sessionId 写入持久化索引文件(.arkclaw-session-key-index.json),使后续 chat.history.paged 能够发现并合并所有同一 sessionKey 的历史 transcript。

3. Web 聊天网关方法

| 方法 | 说明 | | -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- | | chat.history.paged | 按 sessionKey 合并 store 内同一逻辑会话的多个 sessionId(含已 reset 的历史 ID)、当前与归档(.reset.* / .deleted.*)transcript,全局排序后基于 __openclaw.seq 游标分页返回。 |

chat.history.paged 请求参数(摘要)

| 字段 | 类型 | 说明 | | ------------ | -------- | ----------------------------------------------- | | sessionKey | string | 必填。 | | limit | number | 可选,默认 100,硬上限 1000。 | | before | number | 可选。若传入,只返回 seq < before 的较旧消息(上一页);不传则返回最新一页。 |

响应中包含 messageshasMoreoldestSeqnewestSeq,以及合并来源 sessionIdsMerged(若适用)。

性能说明(chat.history.paged

当前实现会读入并解析相关 transcript 的全部 JSONL,合并排序后再截取一页。会话极长时 CPU、内存与延迟会上升。若成为瓶颈,需要在宿主侧引入按文件尾/索引增量等策略;详见源码 src/history/register.ts 顶部注释。

4. 依赖关系

  • peeropenclaw >=2026.3.2(版本见 package.jsonpeerDependencies)。

源码结构

src/
  config.ts                    # 插件配置类型
  hooks.ts                     # 错误文案重写 hooks
  history/
    index.ts                   # barrel 导出
    register.ts                # registerWebchatHistory(hook + gateway method 注册)
    session-key-index.ts       # sessionKey → 历史 sessionId 持久化索引
    transcript.ts              # JSONL transcript 读取与路径发现
    sanitize.ts                # 消息清洗、信封剥离、截断、大小控制
    paginate.ts                # 跨文件排序与游标分页
  messaging/
    language.ts                # 语言检测
    rewrite.ts                 # 错误文案重写逻辑
  types/
    pi-coding-agent.d.ts       # 可选 peer 类型声明

安装

openclaw plugins install @arkclaw/arkclaw-plugin

配置

在 OpenClaw 配置文件 openclaw.json 中启用插件,例如:

{
  "plugins": {
    "entries": {
      "arkclaw-plugin": {
        "enabled": true,
        "config": {
          "messageRewrite": {
            "errorMessage": true
          }
        }
      }
    }
  }
}

配置字段

| 字段 | 类型 | 是否必填 | 说明 | | ----------------------------- | --------- | ---- | ---------------------- | | messageRewrite | object | 否 | 消息重写配置。 | | messageRewrite.errorMessage | boolean | 否 | 是否开启错误文案重写。默认 false。 |

(Web 网关方法无需额外 JSON 配置,安装并启用插件后即注册。)

客户端集成参考

仓库内 claw-client 示例:发送链路直接使用 OpenClaw 原生 chat.send;若检测到插件已安装,则历史列表优先调用 chat.history.paged 并通过 before 游标上拉加载;若未安装插件,则自动回退到原生 chat.history

许可

Apache-2.0