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

@lark-apaas/aily-web-sdk

v0.0.12

Published

Aily Web SDK - iframe-based chat panel integration

Readme

Aily-Web-SDK

Aily Web SDK 是飞书 Aily 团队推出的轻量级 SDK,帮助你快速接入 Aily AI 能力。

特点

  • 轻量级: 接入成本低,无 CDN 资源加载
  • 高隔离性: 独立运行环境
  • 简单易用: 简洁的 API 设计

安装

npm install @lark-apaas/aily-web-sdk

使用

@lark-apaas/aily-web-sdk 当前提供两个初始化 API,分别面向不同的 Aily Chat 场景:

  • initAilyChat:用于初始化 Aily 工作流应用 Chat 面板,适合接入已有工作流应用的对话能力。
  • initAgentChat:用于初始化 Aily 自定义智能体 Chat 面板,适合接入自定义智能体会话能力。
import { initAilyChat } from '@lark-apaas/aily-web-sdk'

const container = document.querySelector('.container');
const chatPanel = await initAilyChat(container, {
  appKey: 'your-app-key',
  common: {},
  events: {
    onReady: () => console.log('ready'),
    onError: (error) => console.error(error)
  }
});
import { initAgentChat } from '@lark-apaas/aily-web-sdk'

const container = document.querySelector('.container');

const sdk = await initAgentChat(container, {
  channelToken: 'wsk_xxx',
});
import { initAgentChat } from '@lark-apaas/aily-web-sdk'

const container = document.querySelector('.container');

const sdk = await initAgentChat(container, {
  channelToken: 'wsk_xxx',
  customParams: {
    employee_id: {
      value: '12345',
      desc: '员工工号,可作为查询型技能的 user_id 入参'
    }
  }
});
import { initAgentChat } from '@lark-apaas/aily-web-sdk'

const container = document.querySelector('.container');

const sdk = await initAgentChat(container, {
  channelToken: 'wsk_xxx',
  customParamsToken: 'jwt-token'
});

API

initAilyChat(root, config)

初始化 Aily 工作流应用 Chat 面板。

适用场景:

  • 宿主页面需要接入 Aily 工作流应用的 Chat 能力
  • 需要使用 ChatPanel 提供的消息发送、清空、更新配置等控制方法

参数:

  • root (HTMLElement) - 挂载容器元素
  • config (WebSDKConfig) - 配置项
    • appKey (string) - 应用 Key
    • uuid (string, 可选) - 用户标识
    • device ('pc' | 'mobile', 可选) - 设备类型
    • common (WebSDKCommonConfig) - 通用配置
      • baseURL (string) - Aily 服务地址
      • headers (Record<string, string>, 可选) - 自定义请求头
    • events (WebSDKEvents, 可选) - 事件回调
      • onReady - 面板就绪回调
      • onError - 错误回调
      • onMessage - 消息回调

返回: Promise<ChatPanel>

initAgentChat(root, config)

初始化 Aily 自定义智能体 Chat 面板。

适用场景:

  • 宿主页面需要接入 Aily 自定义智能体的 Chat 能力
  • 只需要完成智能体 Chat 面板的初始化与销毁管理

参数:

  • root (HTMLElement) - 挂载容器元素
  • config (AgentSDKInitConfig) - 配置项
    • channelToken (string) - agent 渠道 token
    • customParams (CustomParams, 可选) - 宿主初始化时注入的上下文;如有需要,也可在 JWT 模式下一并传入
    • customParamsToken (string, 可选) - 宿主初始化时注入的 JWT 验签 token,JWT 模式下可单独传入

明文模式下可传 customParams;JWT 模式下传 customParamsToken 即可,如有需要也可同时传入 customParams

customParams / customParamsToken 属于可选增强能力。

如果 customParamsToken 为空,或当前接入环境暂不支持该能力,custom context 将不会生效,但基础初始化流程仍会继续。

返回: Promise<AgentSDKInstance>

ChatPanel

| 方法 | 说明 | | --- | --- | | sendMessage(data) | 发送消息 | | clear() | 清空聊天记录 | | cancelMessage(messageItem) | 取消消息 | | clearAndStop() | 清空消息并停止当前响应 | | updateWelcomeMessage() | 刷新欢迎消息 | | updateConfig(config) | 更新面板配置 | | destroy() | 销毁实例 |

AgentSDKInstance

| 方法 | 说明 | | --- | --- | | destroy() | 销毁 agent 实例 |

License

MIT