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

rwx-ai-studio

v1.3.8

Published

@任我行云中台新平台/AI平台

Readme

RwxAIStudio

一个用于嵌入任我行 AI Studio 的 JavaScript 插件,支持在网页中快速集成 AI 工作流和智能体功能。

✨ 特性

  • 🚀 轻量级集成 - 简单几行代码即可嵌入 AI Studio
  • 🎯 多种模式 - 支持智能体(agent)、工作流(workflow)、问题解决(problem)模式
  • 📦 多种引入方式 - 支持 ES6 模块、UMD
  • 🔧 事件驱动 - 完整的事件监听和回调机制
  • 🎨 无侵入式 - 不影响现有页面结构和样式

📦 安装

NPM 安装

npm install rwx-ai-studio

CDN 引用

<!-- UMD 版本 -->
<script src="https://unpkg.com/rwx-ai-studio/dist/index.umd.js"></script>

<!-- 或使用 jsdelivr -->
<script src="https://cdn.jsdelivr.net/npm/rwx-ai-studio/dist/index.umd.js"></script>

🚀 快速开始

ES6 模块方式

import RwxAIStudio from "rwx-ai-studio";

// 创建实例
const studio = new RwxAIStudio();

// 创建 AI Studio
await studio.create({
  token: "your-session-token",
  el: document.getElementById("ai-container"),
});

UMD 方式(浏览器直接引用)

<!DOCTYPE html>
<html>
  <head>
    <script src="https://unpkg.com/rwx-ai-studio/dist/index.umd.js"></script>
  </head>
  <body>
    <div id="ai-container" style="width: 100%; height: 600px;"></div>

    <script>
      const studio = new RwxAIStudio();

      studio.create({
        token: "your-session-token",
        el: document.getElementById("ai-container"),
      });
    </script>
  </body>
</html>

📖 API 文档

构造函数

const studio = new RwxAIStudio();

创建一个新的 RwxAIStudio 实例。

方法

create(options)

创建并挂载 AI Studio 实例。

参数:

  • options (Object) - 配置选项
    • token (string) 必填 - 租户会话令牌
    • el (HTMLElement) 必填 - 挂载的 DOM 容器元素
    • mode (string) - 工作模式,可选值:'agent' | 'workflow' | 'problem',默认 'agent'

返回值: Promise<void>

示例:

const studio = new RwxAIStudio();

try {
  await studio.create({
    token: "your-session-token",
    el: document.getElementById("container"),
    mode: "agent",
  });
  console.log("AI Studio 创建成功");
} catch (error) {
  console.error("创建失败:", error.message);
}

on(event, callback)

监听事件。

参数:

  • event (string) - 事件名称
  • callback (Function) - 事件回调函数

支持的事件:

  • 'load' - Studio 加载完成
  • 'not-login' - 登录过期或无效
  • 'error' - 发生错误
  • 'destroy' - 实例销毁

示例:

studio.on("load", () => {
  console.log("AI Studio 已加载完成");
});

studio.on("error", (error) => {
  console.error("发生错误:", error);
});

off(event, callback)

移除事件监听。

destroy()

销毁 AI Studio 实例,清理资源。

studio.destroy();

💡 使用示例

基础集成

const studio = new RwxAIStudio();

// 监听事件
studio.on("load", () => console.log("加载完成"));
studio.on("not-login", () => {
  studio.destroy()
  // 重新获取token,再创建
  handleCreate()
});
studio.on("error", (err) => console.error("错误:", err));

handleCreate()

// 创建实例
function handleCreate() {
  await studio.create({
    token: "your-token",
    el: document.getElementById("ai-container"),
  });
}

🌐 浏览器支持

  • Chrome >= 60
  • Firefox >= 55
  • Safari >= 12
  • Edge >= 79
  • 支持 IE 9+(已通过 Babel 转译处理兼容性)

技术说明:

  • ES6 私有字段语法已通过 @babel/plugin-transform-private-methods 等插件转译为 ES5 兼容代码
  • 使用 core-js 提供必要的 polyfill 支持
  • 构建配置已优化支持 IE 9+ 环境

📄 许可证

MIT License