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

@baize-ai/core

v0.3.18

Published

Baize (白泽) — autonomous AI agent infrastructure

Readme

Baize 白泽

Baize(白泽)是一个本地软件研发 Agent 工作台:一个自托管的 AI 智能体,活跃在你的终端、浏览器和消息渠道中。它将 Claude Code 与 Codex 统一在同一套记忆、同一会话与同一个消息网关之下——每一段对话都保持上下文,接入的每个渠道都对话同一个 Agent。

  • 自托管 —— 运行在你自己的机器或你控制的服务器上(支持 Docker)
  • 一个 AI,一个意识 —— Claude Code / Codex 可互换,记忆不丢失
  • 渠道即插即用 —— 飞书、企业微信等,统一连接器框架
  • 浏览器管理 —— 网页控制台安装、配置、监控渠道

快速开始

前置条件: Linux 服务器(或 macOS)、Claude 订阅(或 OpenAI Codex 环境——Codex CLI v0.129.0+,推荐 0.146+)。

curl -fsSL https://raw.githubusercontent.com/baize01-ai/baize-core/main/scripts/install.sh | bash

安装依赖(git、tmux、Node.js、PM2、baize CLI)并运行 baize init 初始化 Agent。

手动安装(Node.js >= 20):

npm install -g @baize-ai/core
baize init

Docker 部署:

# 海外(GitHub Container Registry)
docker run -d --name baize \
  -p 3456:3456 \
  -v baize-data:/home/baize/baize \
  -v claude-config:/home/baize/.claude \
  ghcr.io/baize01-ai/baize-core:latest

# 国内(阿里云 ACR,免镜像加速)
docker run -d --name baize \
  -p 3456:3456 \
  -v baize-data:/home/baize/baize \
  -v claude-config:/home/baize/.claude \
  crpi-8bg62qbrjs3cr3as.cn-hangzhou.personal.cr.aliyuncs.com/baize01/baize-core:latest

镜像由已发布的 @baize-ai/core npm 包构建(构建上下文不含源码)。打开 http://localhost:3456 进入网页控制台(见下文);认证在「模型设置」中配置(Claude API key / setup token / 自定义端点 / Codex / ChatGPT 登录)。Compose 配置、可选认证环境变量与卷说明见 docs/docker.md。

baize init 幂等,支持交互与非交互模式,它会:

  1. 安装缺失工具(tmux、git、PM2、Claude Code 或 Codex)
  2. 配置认证(Claude:浏览器登录 / API key / setup token;Codex:API key 或设备授权)
  3. 创建 ~/baize/(记忆、技能、服务)
  4. 启动后台服务并在 tmux 会话中拉起 Agent

与 Agent 对话:

baize shell        # 交互式 CLI
baize attach       # 附加到 Agent 的 tmux 会话(Ctrl+B d 脱离)
baize add feishu   # 安装消息渠道(npm)

网页控制台

网页控制台(http://localhost:3456,密码在 init 时设置)是 Agent 的运营界面,三个视图:

  • 聊天 —— 浏览器内与 Agent 对话;显示运行时(Claude/Codex)与全局连接摘要。
  • 模型设置 —— 连接状态、连接配置(各运行时的官方登录 / 自定义 API)、模型供应商库(自定义 OpenAI/Anthropic 兼容端点,如 DeepSeek / OpenRouter)。
  • 渠道设置 —— 安装、配置、启停、卸载消息渠道;每个渠道统一卡片(状态徽章 / 版本 / 配置状态 / 操作组)+ schema 驱动的配置表单与平台引导。

所有渠道生命周期统一:安装 → 配置(凭据联网验证)→ 启动 → 运行/停止 → 卸载(卸载保留数据,重装可恢复)。


架构

graph TB
    subgraph Channels["Communication Channels"]
        FS["Feishu (长连接 / Webhook)"]
        WC["WeCom (智能机器人长连接)"]
        WEB["Web Console"]
        MORE["More via npm (baize-channel)"]
    end

    subgraph Baize["Baize — The Life System"]
        C4["C4 Comm Bridge<br/>(unified gateway · SQLite audit)"]
        MEM["Memory<br/>(Inside Out architecture)"]
        SCH["Scheduler<br/>(autonomous task dispatch)"]
        AM["Activity Monitor<br/>(guardian · heartbeat · auto-recovery)"]
        HTTP["HTTP Layer<br/>(Caddy · file sharing · HTTPS)"]
    end

    subgraph Brain["AI Runtime — The Brain"]
        CC["Claude Code / Codex<br/>(in tmux session)"]
    end

    FS & WC & WEB & MORE --> C4
    C4 <--> CC
    MEM <--> CC
    SCH --> CC
    AM --> CC
    HTTP <--> CC

| 组件 | 职责 | 关键技术 | |------|------|----------| | C4 Comm Bridge | 统一消息网关 + 审计 | SQLite、优先级队列 | | Memory | 重启后身份与上下文持久 | Inside Out 分层架构 | | Scheduler | 你离开时的自主任务调度 | Cron、自然语言输入、空闲门控 | | Activity Monitor | 崩溃恢复、心跳、健康检查 | PM2、多层防护 | | HTTP Layer | 网页访问、文件分享、组件路由 | Caddy、自动 HTTPS |


特性

一个 AI,一个意识

所有渠道都经由 C4 桥接——一个会话、一份记忆、一个人格。每条消息持久化到 SQLite 可查询。

上下文有保障

五层 Inside Out 记忆(身份 → 状态 → 引用 → 会话 → 归档)。上下文达到 75% 时,系统在压缩前保存记忆。Agent 永远不会带着失忆醒来。

默认自愈

原生崩溃恢复、心跳存活探针、健康监控、上下文窗口管理与自动升级——内置,无需第三方监控。

一流 AI 运行时

Claude Code 与 Codex 可互换。随时用 baize runtime codex 切换——记忆、技能、渠道全部保留。


渠道

渠道是 npm 连接器组件。官方渠道通过 npm registry 分发(默认 registry.npmjs.org;可配 npmmirror 或私有源——见配置节),一条命令安装,自动出现在网页控制台的渠道目录。

已有渠道:

| 渠道 | 模式 | 说明 | |------|------|------| | 飞书 | WebSocket 长连接(免公网)或 Webhook | 凭据联网验证;群聊/单聊机器人 | | 企业微信 | 智能机器人 WebSocket 长连接(免公网) | 企业机器人凭据,单聊/群聊 |

baize add feishu                    # 默认 npm 源
baize add wecom --registry https://registry.npmmirror.com  # 临时源(本次生效)
baize search                        # 从当前源动态发现渠道目录

渠道目录动态发现:发布带 baize-channel keyword 的渠道包后,无需任何代码改动即出现在目录(CLI baize search 与网页控制台)。自定义/私有渠道可通过 config.json 的 channels 追加。

所有渠道通过 C4 协议连接:一个简单的 HTTP 接口把消息推入统一网关。自定义渠道获得同样的统一会话、审计与记忆。


A2A(Agent-to-Agent 协作)

A2A 让多个 Baize 实例经 HTTPS P2P 直接协作——没有中心消息服务器,消息与任务委托直达对端 Agent,每个实例保持完全独立。

组件:

| 组件 | 职责 | |------|------| | @baize-ai/baize-a2a | npm 渠道包,装在每个启用实例:HTTPS server、注册/心跳客户端、任务 worker、baize a2a CLI | | @baize-ai/baize-admin-workspace | 独立控制面(npm 包 + Docker 镜像 + Ant Design Pro 控制台):准入审批、在线状态、审计、基于 Card 的发现——不进消息路径 |

核心概念:

  • Agent Card 是唯一业务事实源 —— 每个 agent 在 GET /.well-known/baize-agent.json 自报 name / description / skills;admin 不维护业务描述,只管准入、在线、审计与发现。
  • 接收方授权自治 —— 每个 agent 自己决定接受谁的调用(config.json 的 authz:默认 open,或 allowlist)。
  • 基于 Card 的发现 —— 经 admin 目录按 Card 的 name/description/skills 文本匹配,或按 skill id 精确匹配发现 peer。

快速上手:

baize add @baize-ai/baize-a2a              # 安装渠道
baize a2a enable --admin <url> --advertise <https://your-agent.example.com>
# → 自注册 → 管理员审批 → 签发 JWT → 心跳(30s)→ 可发现
baize a2a search <query>                   # 经 admin 目录发现 agent
baize a2a task <peer> <skill> "<instruction>"  # 委托任务(默认同步等待)

CLI(baize a2a):

| 命令 | 用途 | |------|------| | status | 本实例状态:enabled / agent_id / 注册状态 / advertise_url | | enable --admin <url> --advertise <url> | 启用 A2A 并向 admin 注册 | | disable | 关闭(已接受任务继续执行) | | peer list | 本地缓存 peer | | search <query> | 经 admin 目录发现 agent | | card <id> | Agent Card 详情 | | session-summary | 当前可用 peer 摘要 | | send <peer> <text> | 普通消息(不等待回复) | | task <peer> <skill> "<instruction>" | 委托任务;默认同步等待终态(--async 只拿 task_id) | | task status <id> / task cancel <id> | 查询 / 取消委托任务 |

名片编辑与调用授权(网页控制台): A2A 页可编辑本实例 Agent Card——名称、描述,以及从已安装 SKILL.md 列表勾选 Skills(frontmatter 自动提取)。保存后 Card 秒级热更新,admin 探测同步快照;A2A 未启用也可先编辑预填名片。同页配置「调用授权」:默认 open + 黑名单,或 allowlist——被拒调用返回 403 并记审计。

凭证轮换: 每个 agent 持有 admin 签发的独立 JWT(RS256,12h 有效,凭证独立)。agent 在过期前自动刷新;admin 轮换后 agent 60s 内自动重取凭证(吊销检测 + 强制恢复)。轮换只吊销目标 agent 的凭证并以当前 key 重签——全局签名 key 不变,单 agent 轮换不影响其他 agent。


配置

持久化配置在 ~/baize/.baize/config.json:

{
  "npmRegistry": "https://registry.npmmirror.com",
  "npmToken": "private-registry-token",
  "channels": {
    "my-bot": { "title": "内部机器人", "type": "communication", "repo": "acme/my-bot" }
  }
}

需要 token 的私有源通过 BAIZE_NPM_TOKEN(env)或 "npmToken"(config)配置——metadata / search / tarball 请求携带 Authorization: Bearer(不读 .npmrc)。渠道组件的构建、验证与发布规范见 docs/component-publishing.md。

npm 源优先级(从高到低):

--registry <url>            命令级临时源(本次生效,不持久化)
BAIZE_NPM_REGISTRY          进程级(环境变量)
config.json npmRegistry     持久化源(npmmirror / 私有源)
https://registry.npmjs.org  默认(全球统一源)

渠道凭据存放在 ~/baize/.env(FEISHU_APP_ID、FEISHU_APP_SECRET、WECOM_BOT_ID、WECOM_BOT_SECRET)——通过网页控制台配置,保存前会校验。


CLI

baize init                    # 初始化 Baize 环境
baize config get <key>        # 读取配置项
baize config set <key> <val>  # 写入配置项
baize attach                  # 附加到 Agent tmux 会话
baize runtime <name>          # 切换 AI 运行时(claude | codex)
baize runtime status          # 查看当前运行时
baize doctor                  # 诊断并自动修复安装
baize status                  # 查看服务状态
baize logs [service]          # 查看服务日志
baize add <component>         # 安装渠道或能力组件
                              #   --registry <url>  临时 npm 源
                              #   --branch <name>   从 git 分支安装
                              #   --file <tar.gz>   离线交付(校验)
baize upgrade <component>     # 升级组件(官方 npm 渠道走 npm)
baize upgrade --all           # 升级全部组件
baize upgrade --self          # 升级 baize-core 自身
baize list                    # 列出已装组件
baize search [keyword]        # 搜索动态渠道目录
baize uninstall <name>        # 移除组件(--purge 同时删除数据)
baize uninstall --self        # 完全卸载 Baize

Release

npm + Docker 发布的完整操作手册(认证 / 四包发布 / ghcr + 阿里云 ACR 镜像)见 docs/release.md。

License

MIT