Hacker News 中文摘要

RSS订阅

克劳德代码:通道 -- Claude Code: Channels

文章摘要

Claude Code文档介绍了如何通过通道(channels)向运行中的会话推送事件,这是其开发者平台的一项功能,属于自动化范畴。文档提供了相关技术参考,帮助开发者实现会话事件推送,属于Claude Code平台构建功能的一部分。

文章总结

通过通道向运行中的会话推送事件 - Claude代码文档

概述

通道(Channels)功能允许用户将消息、警报和Webhook从MCP服务器推送到正在运行的Claude代码会话中。该功能目前处于研究预览阶段,要求Claude代码版本v2.1.80或更高,且需要使用claude.ai账户登录。

主要功能

  1. 双向通信:Claude可以读取事件并通过同一通道回复,如聊天桥接
  2. 实时响应:仅在会话开启时接收事件,如需持续运行需在后台进程或持久终端中运行Claude
  3. 插件支持:通过安装插件配置通道,研究预览版包含Telegram和Discord支持

设置指南

Telegram设置

  1. 通过BotFather创建Telegram机器人并获取token
  2. 安装插件:/plugin install telegram@claude-plugins-official
  3. 配置token:/telegram:configure <token>
  4. 重启Claude代码:claude --channels plugin:telegram@claude-plugins-official
  5. 在Telegram中配对账户并设置访问策略

Discord设置

  1. 在Discord开发者门户创建机器人并获取token
  2. 启用"Message Content Intent"
  3. 邀请机器人到服务器
  4. 安装插件:/plugin install discord@claude-plugins-official
  5. 配置token:/discord:configure <token>
  6. 重启Claude代码:claude --channels plugin:discord@claude-plugins-official
  7. 在Discord中配对账户并设置访问策略

快速入门

使用fakechat演示通道: 1. 安装插件:/plugin install fakechat@claude-plugins-official 2. 重启Claude代码:claude --channels plugin:fakechat@claude-plugins-official 3. 访问http://localhost:8787测试消息推送

安全措施

  1. 发送者白名单:只有已配对的账户可以推送消息
  2. 会话控制:通过--channels参数控制启用的服务器
  3. 企业控制:Team/Enterprise计划可通过管理设置控制通道可用性

企业控制

企业管理员可通过claude.ai管理设置启用通道功能: - Pro/Max计划:默认可用,用户通过--channels选择加入 - Team/Enterprise计划:默认禁用,需管理员显式启用

研究预览说明

当前通道功能处于研究预览阶段: - 仅支持Anthropic维护的插件白名单 - 协议和语法可能根据反馈调整 - 测试自定义通道需使用--dangerously-load-development-channels参数

相关功能

  1. 为无插件的系统构建自定义通道
  2. 使用远程控制从手机驱动本地会话
  3. 设置定时任务按计划轮询而非响应推送事件

(注:本文保留了技术文档的核心内容,删除了重复的导航菜单、页脚信息、图片引用等非主要内容,同时确保技术细节和操作步骤的完整性。)

评论总结

以下是评论内容的总结:

  1. 功能需求与改进建议

    • 用户期待更强大的编辑功能:"But can it edit tabs?" (hmartin)
    • 需要后台运行模式:"Claude Code daemon mode in background when?" (2001zhaozhao)
  2. 产品定位与架构

    • 本地会话模式设计:"Claude is leaning into the idea of a local 'session'" (alexjurkiewicz)
    • CLI作为操作系统:"Basically the Claude CLI is the operating system" (vessenes)
  3. 与OpenClaw的对比

    • 功能追赶:"Claude caught up pretty quickly" (killme2008)
    • 开源生态差距:"OpenClaw's core value is the channel, heartbeat, and the open-source ecosystem" (killme2008)
  4. 集成与触发机制

    • 事件驱动价值:"triggering a claude code based on events" (ewidar)
    • Webhook本质质疑:"so its a webhook" (Invictus0)
  5. 安全与商业化担忧

    • 安全隐患:"remote capabilities are virtually guaranteed to be exploited" (pdp)
    • 商业模式疑问:"how this can be economically viable" (ed_mercer)
  6. 开发者体验

    • 集成痛点解决:"couldn't trigger AI work from the web ui...fixes a huge ux issue" (luckydata)
    • 术语复杂化批评:"way more complicated than it needs to be" (vrosas)
  7. 创新速度评价

    • 积极肯定:"Really surprised for the frequent innovation" (informal007)
    • 持续性怀疑:"doubt a lot of the features will actually be supported" (anthonySs)

关键引用保留: - "Claude was super limiting without...connection to events" (aavci) - "github webhooks triggering code review...nice to see anthropic building this natively" (vicchenai) - "This feels like a response to openclaw" (mmaunder) - "bidirectional communication has been a thing for decades" (vrosas)