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

@bundy-lmw/hive-server

v1.0.9

Published

Hive 多 Agent 协作框架的服务器应用。

Downloads

1,052

Readme

@bundy-lmw/hive-server

Hive 多 Agent 协作框架的服务器应用。

安装

pnpm install
pnpm build

配置

方式一:使用 hive.config.json(推荐)

创建 hive.config.json 文件:

{
  "server": {
    "port": 3000,
    "logLevel": "info"
  },
  "provider": {
    "id": "glm",
    "apiKey": "${GLM_API_KEY}",
    "model": "glm-4-plus"
  },
  "plugins": {
    "@bundy-lmw/hive-plugin-feishu": {
      "apps": [
        {
          "appId": "${FEISHU_APP_ID}",
          "appSecret": "${FEISHU_APP_SECRET}"
        }
      ]
    }
  }
}

环境变量使用 ${VAR_NAME} 语法,会自动从系统环境变量中读取。

使用

CLI 命令

# 查看帮助
hive --help

# 查看版本
hive --version

# 启动交互式聊天
hive chat

# 启动 HTTP/WebSocket 服务器
hive server

# 指定端口启动
hive server --port 8080

HTTP API

服务器启动后,提供以下端点:

| 端点 | 方法 | 描述 | |------|------|------| | /health | GET | 健康检查 | | /api/chat | POST | 发送聊天消息 | | /api/sessions | GET | 获取会话列表 | | /api/sessions/:id | GET | 获取会话详情 | | /webhook/:plugin/:appId | POST | 插件 Webhook |

聊天示例

curl -X POST http://localhost:3000/api/chat \
  -H "Content-Type: application/json" \
  -d '{"message": "你好"}'

WebSocket

连接到 ws://localhost:3000/ws 进行实时通信:

const ws = new WebSocket('ws://localhost:3000/ws')

ws.onopen = () => {
  ws.send(JSON.stringify({ type: 'chat', message: '你好' }))
}

ws.onmessage = (event) => {
  console.log(JSON.parse(event.data))
}

插件系统

Hive 支持通过插件扩展通道能力。

配置插件

hive.config.json 中配置插件:

{
  "plugins": {
    "@bundy-lmw/hive-plugin-feishu": {
      "apps": [
        {
          "appId": "cli_xxxxxx",
          "appSecret": "xxxxxx"
        }
      ]
    }
  }
}

Webhook 配置

对于飞书等需要接收事件的平台,配置 Webhook URL:

https://your-server.com/webhook/feishu/{appId}

开发插件

创建新插件需要实现 IPlugin 接口:

import type { IPlugin, IChannel, PluginContext } from '@bundy-lmw/hive-core'

export class MyPlugin implements IPlugin {
  readonly metadata = {
    id: 'my-plugin',
    name: 'My Plugin',
    version: '1.0.0'
  }

  async initialize(context: PluginContext): Promise<void> {
    // 初始化逻辑
  }

  async activate(): Promise<void> {
    // 激活插件
  }

  async deactivate(): Promise<void> {
    // 停用插件
  }

  getChannels(): IChannel[] {
    // 返回通道列表
    return []
  }
}

架构

┌─────────────────────────────────────────────────────┐
│                    CLI Entry                        │
│                 (src/cli/index.ts)                  │
└───────────────────────┬─────────────────────────────┘
                        │
┌───────────────────────▼─────────────────────────────┐
│                    Bootstrap                        │
│                 (src/bootstrap.ts)                  │
│  ┌─────────┐  ┌────────┐                            │
│  │Agent    │  │Message │                            │
│  │         │  │Bus     │                            │
│  └────┬────┘  └────┬───┘                            │
└───────┼────────────┼────────────────────────────────┘
        │            │
┌───────▼────────────▼─────────────────────────────────┐
│                   Gateways                          │
│  ┌─────────────────────┐  ┌──────────────────────┐  │
│  │HTTP (Hono)          │  │WebSocket             │  │
│  │- /api/chat          │  │- Real-time chat      │  │
│  │- /api/sessions      │  │- Event streaming     │  │
│  └─────────────────────┘  └──────────────────────┘  │
└─────────────────────────────────────────────────────┘

开发

# 监视模式构建
pnpm dev

# 运行测试
pnpm test

# 测试监视模式
pnpm test:watch

GitHub

https://github.com/1695365384/hive

许可证

MIT