@copilotkit/channels

中文文档
0.12.0发布于 2026/10/28MITTypeScriptES Module构建来源已验证近 30 天下载 4.8万

Batteries-included CopilotKit Channels package with the core engine, JSX UI, and every supported platform adapter.

原始使用文档

@copilotkit/channels

@copilotkit/channels is the batteries-included CopilotKit Channels package. One install provides the engine, JSX vocabulary, UI primitives, testing API, and every supported adapter.

Channels run through a channel runner. CopilotKit Intelligence provides the managed runner, available on a free plan: the CopilotRuntime starts and owns each Channel's lifecycle once Intelligence is configured. You can also build and operate your own channel runner on the lower-level SDK primitives, with no Intelligence dependency — a supported path where your team owns state, persistence, concurrency, locking, retries, and race-condition handling.

Install

pnpm add @copilotkit/channels

Configure TypeScript to use the Channels JSX runtime:

{
  "compilerOptions": {
    "jsx": "react-jsx",
    "jsxImportSource": "@copilotkit/channels"
  }
}
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

Adapter entry points

  • @copilotkit/channels/slack (plus /slack/codec and /slack/render)
  • @copilotkit/channels/teams (plus /teams/render)
  • @copilotkit/channels/discord
  • @copilotkit/channels/whatsapp

One package version gives you a tested snapshot of the core engine, JSX/UI vocabulary, testing helpers, and every adapter listed above.

@copilotkit/channels/teams needs the Microsoft 365 Agents SDK, which is an optional peer dependency and is not installed for you:

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

Only the self-hosted Teams adapter needs it. @copilotkit/channels/teams/render does not, which is why the SDK stays out of installs that never run a Teams ingress. express is an optional peer as well, loaded lazily and needed only by the built-in createTeamsServer listener.

For adapter authoring or a selective dependency graph, install @copilotkit/channels-core plus the direct adapter package you need, for example:

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

版本与发布记录

@copilotkit/channels 共发布 43 个版本,首次发布于 2026/07/09;过去 12 个月发布了 43 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
0.12.0latest2026/10/2813 天前
0.11.12026/10/1625 天前
0.11.02026/09/231 个月前
0.10.02026/09/151 个月前
0.9.22026/09/032 个月前
0.9.02026/08/152 个月前

其他发布通道:canary → 0.7.3-canary.1785878925。

关于 @copilotkit/channels 的常见问题

@copilotkit/channels 是什么?

Batteries-included CopilotKit Channels package with the core engine, JSX UI, and every supported platform adapter.

如何安装 @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 和提交记录判断。