# @copilotkit/channels 中文文档

规范地址：https://npmcn.com/package/%40copilotkit/channels/

版本：0\.12\.0
npm 元数据更新时间：2026-10-28T13:49:51.928Z
中文译文更新时间：2026-11-10T18:34:06.864Z
软件包许可：MIT

本文由上游 README 翻译，可能存在偏差，请结合原文核对 API、命令与配置。版权与许可归原作者所有。

原始 npm 页面：https://www.npmjs.com/package/%40copilotkit/channels
原文对照：https://npmcn.com/package/%40copilotkit/channels/?lang=original
项目主页：https://github.com/CopilotKit/CopilotKit
源码仓库：https://github.com/CopilotKit/CopilotKit

## 关键信息（来自 npm 元数据）

- 包体积（解压后）：13.7 kB，45 个文件
- 模块格式：ES Module
- TypeScript 类型：包内自带
- 运行依赖：6 个
- peer 依赖：react \>=18，express ^4\.18\.0 \|\| ^5\.0\.0，takumi-js ^2\.7\.3，@microsoft/agents-hosting ^1\.5\.3，@microsoft/agents-activity ^1\.5\.3
- 首次发布：2026-07-08T19:57:08.811Z
- 最新版本发布：2026-10-28T13:49:51.487Z
- 近 30 天下载量：48262（2026-10-11 至 2026-11-09，npm 官方下载统计）
- 已发布版本数：43（近 12 个月 43 个）

## 中文简介

包括电池的副驾驶Kit 带有核心引擎JSX UI的Channels软件包,以及每一个被支持的平台适配器.

## 安装

```sh
npm install @copilotkit/channels
```

也可以使用：`pnpm add @copilotkit/channels`、`yarn add @copilotkit/channels`、`bun add @copilotkit/channels`

## README

# @ copilotkit/ 频道

`@copilotkit/channels` 是包含电池的 CopilotKit Channels 软件包。 一个安装 提供引擎,JSX词汇,UI原始,测试API,以及每个被支持的适配器.

**频道通过频道跑道运行.** 副驾驶Kit情报部门提供 管理下跑者,可在自由计划中使用: `CopilotRuntime` 开始和拥有 每个频道的生命周期,一旦配置智能。 你也可以建造和 在SDK原始版下层操作自己的频道跑取器,没有 情报依赖——一个支持路径,你的团队拥有状态, 持久性、货币性、锁定性、再试和种族条件处理.

## 安装

```sh
pnpm add @copilotkit/channels
```

配置 TypeScript 用于频道 JSX 运行时间 :

```json
{
  "compilerOptions": {
    "jsx": "react-jsx",
    "jsxImportSource": "@copilotkit/channels"
  }
}
```

```tsx
import { createChannel, Message, Section } from "@copilotkit/channels";
import { slack } from "@copilotkit/channels/slack";
import { CopilotRuntime, CopilotKitIntelligence } from "@copilotkit/runtime/v2";
import { createCopilotNodeListener } from "@copilotkit/runtime/v2/node";

const channel = createChannel({
  name: "support-bot", // project-unique Intelligence Channel name
  identifyUser: "platform",
  adapters: [
    slack({
      botToken: process.env.SLACK_BOT_TOKEN!,
      appToken: process.env.SLACK_APP_TOKEN!,
    }),
  ],
});

channel.onMessage(({ thread, message }) =>
  thread.post(
    <Message>
      <Section>Echo: {message.text}</Section>
    </Message>,
  ),
);

// The runtime owns the Channel's lifecycle — there is no `channel.start()`.
const runtime = new CopilotRuntime({
  intelligence: new CopilotKitIntelligence({
    // apiUrl and wsUrl default to cloud-hosted CopilotKit Intelligence — override
    // both together only for a self-hosted deployment.
    apiKey: process.env.CPK_INTELLIGENCE_API_KEY!, // free tier available
  }),
  channels: [channel],
});

// Creating the listener starts the Channel's connection.
const listener = createCopilotNodeListener({ runtime });
// Optional: await that activation so a broken config fails startup loudly.
await listener.channels.ready(); // listener.channels.stop() tears it down
```

## 适应器切入点

-   `@copilotkit/channels/slack` (单位:千美元) `/slack/codec` 财务报告和审定财务报表 `/slack/render`(中文(简体) )
-   `@copilotkit/channels/teams` (单位:千美元) `/teams/render`(中文(简体) )
-   `@copilotkit/channels/discord`
-   `@copilotkit/channels/whatsapp`

一个软件包版本给你一个测试过的核心引擎快照 JSX/UI词汇, 测试辅助器,以及上面列出的所有适配器.

`@copilotkit/channels/teams` 需要微软365代理SDK,这是一个 **可选同伴依赖** 而不为您安装

```sh
pnpm add @microsoft/agents-hosting @microsoft/agents-activity
```

只有自办的团队适配器需要它. `@copilotkit/channels/teams/render` 没有,这就是为什么SDK 远离从未运行过团队的安装 内入. `express` 也是可选的对等器, 懒散地装入, 只需要由 内置 `createTeamsServer` 听着.

对于适配器作者或选择性依赖性图表,安装 `@copilotkit/channels-core` 加您需要的直接适配软件包,例如:

```sh
pnpm add @copilotkit/channels-core @copilotkit/channels-slack
```

## 常见问题

### @copilotkit/channels 是什么？

包括电池的副驾驶Kit 带有核心引擎JSX UI的Channels软件包,以及每一个被支持的平台适配器\.

### 如何安装 @copilotkit/channels？

在项目目录运行 npm install @copilotkit/channels，或使用 pnpm add / yarn add / bun add。

### @copilotkit/channels 支持 TypeScript 吗？

支持。包内自带 TypeScript 类型声明（package\.json 声明了 types 入口），安装后即可获得类型提示，无需再安装 @types 包。

### @copilotkit/channels 支持 ESM 还是 CommonJS？

以 ES Module 形式发布，推荐使用 import 引入。在 CommonJS 项目中，Node\.js 20\.19\+ / 22\.12\+ 可以直接 require\(\) 不含顶层 await 的 ES Module，更早的版本需要改用动态 import\(\)。

### @copilotkit/channels 可以商用吗？

@copilotkit/channels 使用 MIT 许可。宽松许可：允许商业使用、修改和再分发，通常只需在分发时保留原版权与许可声明。以上为概括，不构成法律意见，请以许可原文为准。

### @copilotkit/channels 的下载量有多少？

根据 npm 官方下载统计，@copilotkit/channels 在 2026/10/11 – 2026/11/09 这 30 天内被下载 48,262 次，日均约 1,609 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入，适合横向比较热度，不能直接等同于使用人数。

### @copilotkit/channels 还在维护吗？

最新版本 0\.12\.0 发布于 2026/10/28（13 天前）；至今共发布 43 个版本，其中过去 12 个月发布了 43 个；首次发布于 2026/07/09。发布频率只是参考信号：功能稳定的工具可能很少需要更新，建议结合源码仓库的 issue 和提交记录判断。

