@@ -25,17 +25,16 @@ import {
2525resolveReconnectPolicy,
2626} from "../web/reconnect.js";
2727import { createDefaultDeps, logWebSelfId } from "./deps.js";
28-import { spawnRelayTmux } from "./relay_tmux.js";
29283029export function buildProgram() {
3130const program = new Command();
3231const PROGRAM_VERSION = VERSION;
3332const TAGLINE =
34-"Send, receive, and auto-reply on WhatsApp—Baileys (web) only.";
33+"Send, receive, and auto-reply on WhatsApp (web) and Telegram (bot).";
35343635program
3736.name("clawdis")
38-.description("WhatsApp relay CLI (WhatsApp Web session only)")
37+.description("Messaging relay CLI for WhatsApp Web and Telegram Bot API")
3938.version(PROGRAM_VERSION);
40394140const formatIntroLine = (version: string, rich = true) => {
@@ -91,7 +90,11 @@ export function buildProgram() {
9190],
9291[
9392'clawdis agent --to +15555550123 --message "Run summary" --deliver',
94-"Talk directly to the agent using the same session handling; optionally send the reply.",
93+"Talk directly to the agent using the same session handling; optionally send the WhatsApp reply.",
94+],
95+[
96+'clawdis send --provider telegram --to @mychat --message "Hi"',
97+"Send via your Telegram bot.",
9598],
9699] as const;
97100@@ -176,7 +179,7 @@ Examples:
176179program
177180.command("agent")
178181.description(
179-"Talk directly to the configured agent (no WhatsApp send, reuses sessions)",
182+"Talk directly to the configured agent (no chat send; optional WhatsApp delivery)",
180183)
181184.requiredOption("-m, --message <text>", "Message body for the agent")
182185.option(
@@ -312,7 +315,7 @@ Examples:
312315313316program
314317.command("heartbeat")
315-.description("Trigger a heartbeat or manual send once (web only, no tmux)")
318+.description("Trigger a heartbeat or manual send once (web provider only)")
316319.option("--to <number>", "Override target E.164; defaults to allowFrom[0]")
317320.option(
318321"--session-id <id>",
@@ -396,7 +399,7 @@ Examples:
396399397400program
398401.command("relay")
399-.description("Auto-reply to inbound messages (web only)")
402+.description("Auto-reply to inbound WhatsApp messages (web provider)")
400403.option(
401404"--web-heartbeat <seconds>",
402405"Heartbeat interval for web relay health logs (seconds)",
@@ -528,9 +531,7 @@ Examples:
528531529532program
530533.command("relay:heartbeat")
531-.description(
532-"Run relay with an immediate heartbeat (no tmux); requires web provider",
533-)
534+.description("Run relay with an immediate heartbeat; requires web provider")
534535.option("--verbose", "Verbose logging", false)
535536.action(async (opts) => {
536537setVerbose(Boolean(opts.verbose));
@@ -737,88 +738,6 @@ Shows token usage per session when the agent reports it; set inbound.reply.agent
737738);
738739});
739740740-program
741-.command("relay:tmux")
742-.description(
743-"Run relay --verbose inside tmux (session clawdis-relay), restarting if already running, then attach",
744-)
745-.action(async () => {
746-try {
747-const shouldAttach = Boolean(process.stdout.isTTY);
748-const session = await spawnRelayTmux(
749-"pnpm clawdis relay --verbose",
750-shouldAttach,
751-);
752-defaultRuntime.log(
753-info(
754-shouldAttach
755- ? `tmux session started and attached: ${session} (pane running "pnpm clawdis relay --verbose")`
756- : `tmux session started: ${session} (pane running "pnpm clawdis relay --verbose"); attach manually with "tmux attach -t ${session}"`,
757-),
758-);
759-} catch (err) {
760-defaultRuntime.error(
761-danger(`Failed to start relay tmux session: ${String(err)}`),
762-);
763-defaultRuntime.exit(1);
764-}
765-});
766-767-program
768-.command("relay:tmux:attach")
769-.description(
770-"Attach to the existing clawdis-relay tmux session (no restart)",
771-)
772-.action(async () => {
773-try {
774-if (!process.stdout.isTTY) {
775-defaultRuntime.error(
776-danger(
777-"Cannot attach: stdout is not a TTY. Run this in a terminal or use 'tmux attach -t clawdis-relay' manually.",
778-),
779-);
780-defaultRuntime.exit(1);
781-return;
782-}
783-await spawnRelayTmux("pnpm clawdis relay --verbose", true, false);
784-defaultRuntime.log(info("Attached to clawdis-relay session."));
785-} catch (err) {
786-defaultRuntime.error(
787-danger(`Failed to attach to clawdis-relay: ${String(err)}`),
788-);
789-defaultRuntime.exit(1);
790-}
791-});
792-793-program
794-.command("relay:heartbeat:tmux")
795-.description(
796-"Run relay --verbose with an immediate heartbeat inside tmux (session clawdis-relay), then attach",
797-)
798-.action(async () => {
799-try {
800-const shouldAttach = Boolean(process.stdout.isTTY);
801-const session = await spawnRelayTmux(
802-"pnpm clawdis relay --verbose --heartbeat-now",
803-shouldAttach,
804-);
805-defaultRuntime.log(
806-info(
807-shouldAttach
808- ? `tmux session started and attached: ${session} (pane running "pnpm clawdis relay --verbose --heartbeat-now")`
809- : `tmux session started: ${session} (pane running "pnpm clawdis relay --verbose --heartbeat-now"); attach manually with "tmux attach -t ${session}"`,
810-),
811-);
812-} catch (err) {
813-defaultRuntime.error(
814-danger(
815-`Failed to start relay tmux session with heartbeat: ${String(err)}`,
816-),
817-);
818-defaultRuntime.exit(1);
819-}
820-});
821-822741program
823742.command("webchat")
824743.description("Start or query the loopback-only web chat server")