通道
Bub 使用 channel 适配器在不同 I/O 端点上运行同一套 pipeline。Hook 不感知当前处于哪个 channel。
内置 Channel
Section titled “内置 Channel”本地交互模式:
uv run bub chat
Channel 监听模式(默认启用所有非 cli channel):
uv run bub gateway
仅启用 Telegram:
uv run bub gateway --enable-channel telegram
Session 语义
Section titled “Session 语义”run命令的默认 session id:<channel>:<chat_id>- Telegram channel 的 session id:
telegram:<chat_id> chat命令的默认 session id:cli_session(可通过--session-id覆盖)chat命令的默认 chat id:local
出站传递接口
Section titled “出站传递接口”Channel 适配器可以通过两种形式接收出站数据:
send(message):最终渲染的出站消息on_event(event, message):模型仍在生成输出时发出的流式事件
使用 on_event 实现增量 UX,如实时文本更新、输入指示器、进度条或块级日志。使用 send 传递最终的持久化出站载荷。
on_event 是可选的。不需要流式行为的 channel 可以忽略它,仅实现 send。
Debounce 行为
Section titled “Debounce 行为”cli不做 debounce;每次输入立即处理。- 其他 channel 可以按 session 对入站消息进行 debounce 和批处理。
- 逗号命令(
,前缀)始终绕过 debounce,立即执行。
关于 Discord
Section titled “关于 Discord”Bub 核心目前不包含内置的 Discord 适配器。
如需 Discord 支持,请通过 provide_channels 在外部插件中实现。