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

@beeftv/plugin-sdk

v0.1.0

Published

BeefTV 插件开发 SDK:提供插件清单、宿主接口、界面挂点、宿主事件与助手扩展工具的类型定义与辅助函数。

Readme

@beeftv/plugin-sdk

BeefTV 插件开发 SDK,提供:

  • package.json 里 beeftv 一段的类型(PluginManifest)
  • 浏览器端 activate(host) 的宿主接口类型(BeefTVPluginHost)
  • 全部界面扩展位(BeefTVSlotMap)与宿主事件(BeefTVEventMap)
  • 用 JS 写生成服务时的 submit / query 类型(defineProvider、ProviderModule)
  • 助手端 pi 扩展工具定义辅助函数(definePiExtension、PiExtensionAPI)

清单

插件 ID、版本、说明和作者直接取 package.json 的 name、version、description、author,beeftv 里只写 BeefTV 自己的东西:

{
  "name": "beeftv-plugin-sticky-note",
  "version": "0.1.0",
  "description": "在画布上放一张便签",
  "keywords": ["beeftv-plugin"],
  "beeftv": {
    "name": "画布便签",
    "client": "./client/index.js",
    "contributes": {
      "canvasNodes": [
        { "id": "sticky-note", "label": "画布便签", "defaultTitle": "便签", "renderer": "client", "defaultSize": { "width": 240, "height": 180 } }
      ]
    }
  }
}

写了别的键(比如 beeftv.id、顶层 canvasNodes、节点的 type)时,BeefTV 不会安装,并逐项说明该怎么改。

怎么用

BeefTV 直接加载插件里的 JS 文件,不经过打包,所以文件里不能 import "@beeftv/plugin-sdk"。把仓库内的 packages/plugin-sdk 装成开发依赖(例如 npm i -D <BeefTV仓库路径>/packages/plugin-sdk),用 JSDoc 拿到编辑器提示;用 TypeScript 或打包工具的插件也可以直接用 definePlugin、defineProvider,打包后发布。

界面插件

/** @param {import("@beeftv/plugin-sdk").BeefTVPluginHost} host */
export function activate(host) {
  host.contribute("app.command", {
    id: "hello-beeftv",
    label: "向 BeefTV 问好",
    onSelect: () => host.ui.notify("你好,BeefTV!", "success"),
  });
}

用 JS 写生成服务

在清单里登记 "providers": [{ "id": "my-service", "label": "我的服务", "capabilities": ["image"], "scopes": ["user.custom-channel"], "module": "./provider.js" }](只支持图片、视频、音频),然后在 provider.js 里:

/** @type {import("@beeftv/plugin-sdk").ProviderModule["submit"]} */
export async function submit(request, ctx) {
  const response = await fetch(`${ctx.config.baseUrl}/tasks`, {
    method: "POST",
    headers: { Authorization: `Bearer ${ctx.config.apiKey}` },
    body: JSON.stringify({ prompt: request.prompt }),
    signal: ctx.signal,
  });
  if (!response.ok) return { status: "failed", message: `服务商返回 HTTP ${response.status}` };
  return { taskId: (await response.json()).id, status: "pending" };
}

/** @type {import("@beeftv/plugin-sdk").ProviderModule["query"]} */
export async function query(taskId, request, ctx) {
  const task = await (await fetch(`${ctx.config.baseUrl}/tasks/${taskId}`, { signal: ctx.signal })).json();
  if (task.state === "done") return { taskId, status: "succeeded", result: { images: [{ url: task.imageUrl }] } };
  return { taskId, status: "processing" };
}

还可以导出 models(ctx),返回 [{ id, displayName, capability }]。装好插件后,这个服务会出现在「模型服务 → 选择服务商」里,用户填好地址后点「读取模型」,BeefTV 就调用它列出模型;不写的话,用户要手动填模型 ID。

这个文件跑在 BeefTV 后端旁边的 Node 进程里。BeefTV 负责记任务、重启后继续查询、把结果下载进工作区;插件只管跟服务商说话。