feat(channels): add Telegram channel integration with ACP bridge

Implements the channels infrastructure for connecting external messaging
platforms to Qwen Code via ACP. Phase 1 supports plain text round-trip:
Telegram user sends message -> AcpBridge -> qwen-code --acp -> response
back to Telegram.

New packages:
- @qwen-code/channel-base: AcpBridge, SessionRouter, SenderGate, ChannelBase
- @qwen-code/channel-telegram: TelegramAdapter using telegraf

CLI: `qwen channel start <name>` reads from settings.json channels config,
spawns ACP agent, connects to Telegram via polling.
This commit is contained in:
tanzhenxin 2026-03-24 04:49:01 +00:00
parent aebe889b31
commit 3eedc43238
18 changed files with 736 additions and 4 deletions

View file

@ -51,6 +51,7 @@ import { getCliVersion } from '../utils/version.js';
import { loadSandboxConfig } from './sandboxConfig.js';
import { appEvents } from '../utils/events.js';
import { mcpCommand } from '../commands/mcp.js';
import { channelCommand } from '../commands/channel.js';
// UUID v4 regex pattern for validation
const SESSION_ID_REGEX =
@ -590,7 +591,9 @@ export async function parseArguments(): Promise<CliArgs> {
// Register Auth subcommands
.command(authCommand)
// Register Hooks subcommands
.command(hooksCommand);
.command(hooksCommand)
// Register Channel subcommands
.command(channelCommand);
yargsInstance
.version(await getCliVersion()) // This will enable the --version flag based on package.json
@ -611,7 +614,8 @@ export async function parseArguments(): Promise<CliArgs> {
result._.length > 0 &&
(result._[0] === 'mcp' ||
result._[0] === 'extensions' ||
result._[0] === 'hooks')
result._[0] === 'hooks' ||
result._[0] === 'channel')
) {
// MCP/Extensions/Hooks commands handle their own execution and process exit
process.exit(0);