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

claweye-plugin

v1.1.0

Published

ClawEye Monitor Plugin for OpenClaw - Collects agent metrics via Hooks and provides Gateway API for ClawEye Dashboard

Downloads

86

Readme

ClawEye Plugin for OpenClaw

ClawEye Monitor Plugin - 为 OpenClaw 提供实时监控数据收集和 Gateway API


🎯 功能概述

ClawEye Plugin 是一个 OpenClaw 插件,用于:

  1. 收集 Agent 运行数据 - 通过 Hook 实时收集会话、Token、工具调用等数据
  2. 提供 Gateway API - 让 ClawEye Dashboard 通过 API 获取监控数据
  3. 解耦部署 - ClawEye Dashboard 可以部署在任何位置,只需 HTTP 访问 OpenClaw Gateway

📦 安装

从 npm 安装

openclaw plugins install claweye-plugin

⚙️ 配置

在 OpenClaw 配置文件中添加:

plugins:
  claweye-plugin:
    maxMemorySessions: 1000  # 内存最大会话数
    logLevel: info           # debug | info | warn | error

🔌 Hook 事件

插件监听以下 Hook 事件收集数据:

| Hook | 说明 | 收集数据 | |------|------|----------| | session_start | 会话开始 | sessionId, agentId, channelId | | session_end | 会话结束 | durationMs, messageCount, reason | | llm_input | LLM 输入 | provider, model, prompt length | | llm_output | LLM 输出 | Token 使用量(input/output/cache) | | before_tool_call | 工具调用开始 | toolName, params | | after_tool_call | 工具调用结束 | result, error, durationMs | | subagent_spawned | 子 Agent 启动 | agentId, childSessionKey | | subagent_ended | 子 Agent 结束 | outcome, error | | gateway_start | Gateway 启动 | 初始化 |


📡 Gateway API

ClawEye Dashboard 通过 Gateway API 获取数据:

1. 获取会话列表

claweye.sessions?status=running&limit=50

响应:

{
  "success": true,
  "data": {
    "sessions": [...],
    "total": 100,
    "active": 5
  },
  "timestamp": 1710000000000
}

2. 获取会话详情

claweye.session_detail?sessionId=xxx

响应:

{
  "success": true,
  "data": {
    "session": {...},
    "llmCalls": [...],
    "toolCalls": [...],
    "subagentEvents": [...]
  },
  "timestamp": 1710000000000
}

3. 获取统计数据

claweye.stats

响应:

{
  "success": true,
  "data": {
    "totalSessions": 100,
    "activeSessions": 5,
    "totalTokens": { "input": 50000, "output": 10000 },
    "modelUsage": { "anthropic/claude-3": 50 },
    "toolUsage": { "bash": 30 }
  },
  "timestamp": 1710000000000
}

4. 健康检查

claweye.health

🏗️ 架构

┌─────────────────┐      Gateway API      ┌───────────────────┐
│  ClawEye        │ ←──────────────────→ │ ClawEye Plugin    │
│  Dashboard      │                       │ (OpenClaw 内)     │
│  (任意位置)      │                       │                   │
└─────────────────┘                       │  ┌──────────────┐ │
                                          │  │ Hook 收集    │ │
                                          │  │ 内存存储     │ │
                                          │  │ Gateway API  │ │
                                          │  └──────────────┘ │
                                          └─────────┬─────────┘
                                                    │ Hooks
                                                    ▼
                                          ┌───────────────────┐
                                          │    OpenClaw       │
                                          │  Agent Runtime    │
                                          └───────────────────┘

💾 存储说明

  • 内存存储 - 数据存储在内存中,重启后数据丢失
  • 适合场景 - 开发测试、实时监控、短期数据分析
  • 最大会话数 - 默认 1000,可配置

📁 项目结构

claweye-plugin/
├── src/
│   ├── plugin-entry.ts       # 插件入口
│   ├── hooks/
│   │   ├── index.ts          # Hook 汇总
│   │   ├── session.ts        # 会话 Hook
│   │   ├── llm.ts            # LLM Hook
│   │   ├── tool.ts           # 工具 Hook
│   │   ├── subagent.ts       # 子 Agent Hook
│   │   └── gateway.ts        # Gateway Hook
│   ├── api/
│   │   ├── handlers.ts       # API 处理器
│   │   └── routes.ts         # API 路由
│   ├── storage/
│   │   ├── index.ts          # 存储入口
│   │   └── memory.ts         # 内存存储
│   └── types/
│       └── index.ts          # 类型定义
├── package.json
├── tsconfig.json
├── openclaw.plugin.json
└── README.md

🚀 开发

npm install
npm run build
npm run dev

📄 License

Apache 2.0