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

@elevo-ai/plugin-sdk

v0.5.0

Published

Elevo Plugin SDK - Build plugins for the Elevo platform

Readme

@elevo/plugin-sdk

Elevo Plugin SDK - 用于构建 Elevo 平台插件的开发工具包。

安装

npm install @elevo/plugin-sdk

使用

运行时 SDK

该包的运行时代码只会从 window.ElevoPluginSDK 读取 SDK 实例,主应用负责注入。插件代码通常仅导入类型。

在插件应用中使用

import sdk from '@elevo/plugin-sdk';

// 插件应用组件
export default function MyPluginApp() {
  const handleSendMessage = async () => {
    await sdk.conversation.sendMessage({
      role: 'user',
      content: '执行某个操作',
    });
  };

  const handleListFiles = async () => {
    const files = await sdk.workspace.files.list();
    console.log('Files:', files);
  };

  return (
    <div>
      <h1>我的插件</h1>
      <button onClick={handleSendMessage}>发送消息</button>
      <button onClick={handleListFiles}>列出文件</button>
    </div>
  );
}

类型定义

SDK 导出了完整的 TypeScript 类型定义:

import type {
  PluginConfig,

  // Workspace API
  WorkspaceAPI,
  FilesAPI,
  WorkspaceFile,

  // Conversation API
  ConversationAPI,
  MessageEvent,
  SendMessageInput,

  // 错误类型
  PluginSDKError,
} from '@elevo/plugin-sdk';

API 参考

ElevoPluginSDK

主 SDK 接口,包含以下属性:

| 属性 | 类型 | 描述 | |------|------|------| | workspace | WorkspaceAPI | 工作空间 API | | conversation | ConversationAPI | 对话 API | | config | PluginConfig | 插件配置 |

WorkspaceAPI

工作空间相关操作:

| 属性/方法 | 描述 | |----------|------| | id | 当前工作空间 ID | | files | 文件管理 API |

FilesAPI

文件管理操作:

| 方法 | 描述 | |------|------| | list(dirPath?, pattern?) | 列出目录中的文件 | | read(filePath) | 读取文件内容 | | write(filePath, content) | 写入文件内容 | | delete(filePath) | 删除文件 |

ConversationAPI

对话操作:

| 方法 | 描述 | |------|------| | sendMessage(message) | 发送消息给 Agent | | onMessage(callback) | 订阅对话消息 |

Vite 配置

如果你使用 Vite 构建插件应用,请使用以下配置:

// vite.config.ts
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';

export default defineConfig({
  plugins: [react()],
  build: {
    lib: {
      entry: 'src/App.tsx',
      name: 'MyPluginApp', // 必须与 plugin.json 中的 entry 一致
      fileName: 'app',
      formats: ['umd'],
    },
    rollupOptions: {
      external: ['react', 'react-dom'],
      output: {
        globals: {
          react: 'React',
          'react-dom': 'ReactDOM',
        },
      },
    },
  },
});

许可证

MIT