@0xmaxma/claude-gateway 1.8.13 → 1.8.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1388,6 +1388,7 @@ sees a message. If those aren't met the bot looks online but stays silent.
1388
1388
  | **WhatsApp (Baileys)** | DM | number is linked (QR/pairing-code device link) | `dmPolicy` + `pairing` → `dmAllowlist` (per account) | — |
1389
1389
  | | Group | number is linked and is a member of the group | `groupPolicy` + `groupAllowlist` (per account) | `requireMention` false, or @mentioned |
1390
1390
  | **WhatsApp (Cloud API)** | DM | webhook delivered (valid `X-Hub-Signature-256`) | `dmPolicy` + `pairing` → `dmAllowlist` | — (DM-only, no group concept) |
1391
+ | **WeChat** | DM | iLink long-poll (`getupdates`) delivers a new message | `dmPolicy` + `pairing` → `dmAllowlist` | — (DM-only, no group concept) |
1391
1392
 
1392
1393
  **Telegram limits**
1393
1394
  - Exactly one process may poll a bot token — a second poller causes `409 Conflict`.
@@ -1415,6 +1416,13 @@ sees a message. If those aren't met the bot looks online but stays silent.
1415
1416
  - **Cloud API's 24-hour customer-service window**: free-form text replies only work within 24h of the user's last inbound message; outside that window only a pre-approved message template can reach them, and template sending is off by default (`templatesEnabled: false`) since it's the one send that can reach a user outside that window.
1416
1417
  - Inbound media cap is **20 MB** on both modes (same `MediaStore` cap LINE's file uploads use).
1417
1418
 
1419
+ **WeChat limits**
1420
+ - Single personal account per agent, linked via **QR code only** (no pairing-code option, no multi-account support in v1) through Tencent's own iLink Bot API bridge (`wechat` config block) — Tencent's self-serve product, not a third-party bridge.
1421
+ - **DM-only** — no `groupPolicy`/`groupAllowlist`/`requireMention` fields exist because the iLink bridge cannot reliably deliver WeChat group events.
1422
+ - Inbound delivery is **long-polling** (`getupdates`, 35s timeout), not a webhook — there is no `/webhooks/wechat/...` route.
1423
+ - Outbound text is capped at **4000 characters** per message (iLink's documented limit); longer replies are auto-chunked on line boundaries with a short delay between chunks.
1424
+ - The whole channel can be disabled without a redeploy via `WECHAT_CHANNEL_DISABLED=true` (opt-out, enabled by default) — see [WeChat Channel API](API.md#wechat-channel-api).
1425
+
1418
1426
  ---
1419
1427
 
1420
1428
  ## Telegram Groups
@@ -2,6 +2,7 @@ import { EventEmitter } from 'events';
2
2
  import { AgentConfig, CustomConnectorEntry, GatewayConfig, Logger, ModelConfig, ApiAttachment, ImageParams, VideoParams } from '../types';
3
3
  import { SessionProcess } from '../session/process';
4
4
  import { type WhatsAppStatus } from '../whatsapp/manager';
5
+ import { type WeChatStatus } from '../wechat/manager';
5
6
  import { type SkillRegistry } from '../skills';
6
7
  import { type ApiStreamCallbacks, type TurnSink } from './turn-stream';
7
8
  import { type CliChannel } from '../cli-viewer/pairing-store';
@@ -55,6 +56,7 @@ export declare class AgentRunner extends EventEmitter {
55
56
  private readonly whatsappAccounts;
56
57
  private whatsappConfigSnapshot;
57
58
  private readonly whatsappAccountForChat;
59
+ private wechat;
58
60
  private readonly sessionStore;
59
61
  private readonly idleTimeoutMs;
60
62
  private readonly maxConcurrent;
@@ -545,6 +547,21 @@ export declare class AgentRunner extends EventEmitter {
545
547
  asDocument?: boolean;
546
548
  ackMessageId?: string;
547
549
  }): Promise<void>;
550
+ /** Lazily construct this agent's WeChatManager — safe to call repeatedly. */
551
+ private ensureWeChatManager;
552
+ getWeChatStatus(): WeChatStatus;
553
+ startWeChatLinking(): Promise<void>;
554
+ unlinkWeChat(): Promise<void>;
555
+ sendWeChatMessage(toId: string, text: string): Promise<void>;
556
+ /**
557
+ * Gate + forward one inbound WeChat message. Mirrors the LINE webhook
558
+ * router's own gate-then-forward-to-/channel shape exactly (see
559
+ * src/api/line-webhook-router.ts's `recordDeniedSender` call and its
560
+ * "forward to the agent's existing /channel intake" comment) — WeChat has
561
+ * no webhook of its own, so this is the equivalent point for a message
562
+ * arriving off WeChatManager's long-poll loop instead of an Express route.
563
+ */
564
+ private handleWeChatInboundMessage;
548
565
  startSlackOutbound(): void;
549
566
  stopSlackO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O,EAAE,MAAM,EACf,UAAU,EAAE,MAAM,GAAG,SAAS,EAC9B,SAAS,EAAE,kBAAkB,EAC7B,IAAI,EAAE;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,GAC9C,OAAO,CAAC,MAAM,IAAI,CAAC;IA2JtB,OAAO,CAAC,iBAAiB;IA2CzB;;;OAGG;IACH,eAAe,IAAI,MAAM;IAIzB;;;;;;OAMG;IACH,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;CAoBnC"}
@@ -54,6 +54,10 @@ const slack_client_1 = require("../api/slack-client");
54
54
  const whatsapp_cloud_client_1 = require("../api/whatsapp-cloud-client");
55
55
  const manager_1 = require("../whatsapp/manager");
56
56
  const whatsapp_accounts_1 = require("../config/whatsapp-accounts");
57
+ const manager_2 = require("../wechat/manager");
58
+ const ilink_client_1 = require("../wechat/ilink-client");
59
+ const wechat_access_1 = require("../api/wechat-access");
60
+ const pending_senders_1 = require("../api/pending-senders");
57
61
  const markdown_1 = require("../telegram/markdown");
58
62
  const skills_1 = require("../skills");
59
63
  const builtin_commands_1 = require("./builtin-commands");
@@ -71,6 +75,7 @@ const screen_1 = require("../shell/screen");
71
75
  const db_1 = require("../history/db");
72
76
  const media_store_1 = require("../history/media-store");
73
77
  const cleanup_1 = require("../history/cleanup");
78
+ const types_1 = require("../history/types");
74
79
  const knowledge_1 = require("./knowledge");
75
80
  const resolve_1 = require("../connectors/resolve");
76
81
  const DEFAULT_IDLE_TIMEOUT_MINUTES = 30;
@@ -271,6 +276,12 @@ class AgentRunner extends events_1.EventEmitter {
271
276
  // that omits account_id) answer on the SAME number the user wrote to
272
277
  // instead of guessing 'default' and replying from the wrong line.
273
278
  this.whatsappAccountForChat = new Map();
279
+ // WeChat: unlike every credential-input channel above, constructed
280
+ // unconditionally (there's no config field to gate on — the link flow is
281
+ // QR device-pairing, not a typed-in token, same reasoning WhatsApp/Baileys
282
+ // uses). Does nothing until startWeChatLinking() is called or a
283
+ // previously-linked session is resumed at start().
284
+ this.wechat = null;
274
285
  this.idleCleanerTimer = null;
275
286
  // Tracks session IDs with an in-flight API request (prevents concurrent turns)
276
287
  this.pendingApiSessions = new Set();
@@ -467,18 +478,13 @@ class AgentRunner extends events_1.EventEmitter {
467
478
  const meta = params.meta ?? {};
468
479
  const chatId = meta['chat_id'] ?? '';
469
480
  const content = params.content ?? '';
470
- // Set channel early so all handlers (including session commands) have it
471
- const channelSource = (meta['source'] === 'discord'
472
- ? 'discord'
473
- : meta['source'] === 'line'
474
- ? 'line'
475
- : meta['source'] === 'slack'
476
- ? 'slack'
477
- : meta['source'] === 'whatsapp'
478
- ? 'whatsapp'
479
- : meta['source'] === 'whatsapp_cloud'
480
- ? 'whatsapp_cloud'
481
- : 'telegram');
481
+ // Set channel early so all handlers (including session commands) have it.
482
+ // Derived from the canonical CHAT_CHANNELS list (see history/types.ts's
483
+ // doc comment) — a hand-copied ternary here is exactly what silently
484
+ // turned every WeChat (and, historically, Slack) message into
485
+ // 'telegram' before, since a new channel added elsewhere is easy to
486
+ // forget adding to a chain of `=== 'x' ? 'x' : ...` checks.
487
+ const channelSource = ((0, types_1.isChatChannel)(meta['source']) ? meta['source'] : 'telegram');
482
488
  this.channelSourceMap.set(chatId, channelSource);
483
489
  // Slack: remember the current message's thread context so the
484
490
  // auto-forward fallback (writeAutoForward) can stay in-thread. A
@@ -1074,7 +1080,21 @@ class AgentRunner extends events_1.EventEmitter {
1074
1080
  for (const entry of entries) {
1075
1081
  const meta = entry.meta ?? {};
1076
1082
  const content = entry.content ?? '';
1077
- const userContent = content || (meta['attachment_file_id'] || meta['image_path'] ? '(photo)' : meta['document_path'] ? '(document)' : meta['sticker_path'] ? '(sticker)' : '');
1083
+ // `image_path` is used for ANY attachment, not just photos (see
1084
+ // handleWeChatInboundMessage's doc comment) — a non-image
1085
+ // extension (e.g. WeChat's PDF/file support) must not show as
1086
+ // "(photo)" in the transcript.
1087
+ const isImagePath = /\.(jpe?g|png|gif|webp|heic|bmp)$/i.test(meta['image_path'] ?? '');
1088
+ const attachmentPlaceholder = meta['attachment_file_id']
1089
+ ? '(photo)'
1090
+ : meta['image_path']
1091
+ ? (isImagePath ? '(photo)' : '(file)')
1092
+ : meta['document_path']
1093
+ ? '(document)'
1094
+ : meta['sticker_path']
1095
+ ? '(sticker)'
1096
+ : '';
1097
+ const userContent = content || attachmentPlaceholder;
1078
1098
  const userTs = Date.now();
1079
1099
  await this.sessionStore.appendTelegramMessage(this.agentConfig.id, chatId, sessionId, {
1080
1100
  role: 'user',
@@ -1717,6 +1737,9 @@ class AgentRunner extends events_1.EventEmitter {
1717
1737
  let lastAssistantTextThisTurn = '';
1718
1738
  let typingDoneTimer = null;
1719
1739
  const TYPING_DONE_DELAY_MS = 3000;
1740
+ // Same hand-copied-ternary gap CHAT_CHANNELS' doc comment warns about —
1741
+ // 'wechat' was missing here too (confirmed live 2026-09-11), so this
1742
+ // turn-completion tracking never recognized a wechat_reply tool call.
1720
1743
  const replyToolName = source === 'discord'
1721
1744
  ? 'mcp__gateway__discord_reply'
1722
1745
  : source === 'line'
@@ -1727,7 +1750,9 @@ class AgentRunner extends events_1.EventEmitter {
1727
1750
  ? 'mcp__gateway__whatsapp_reply'
1728
1751
  : source === 'whatsapp_cloud'
1729
1752
  ? 'mcp__gateway__whatsapp_cloud_reply'
1730
- : 'mcp__gateway__telegram_reply';
1753
+ : source === 'wechat'
1754
+ ? 'mcp__gateway__wechat_reply'
1755
+ : 'mcp__gateway__telegram_reply';
1731
1756
  proc.on('output', (line) => {
1732
1757
  try {
1733
1758
  const obj = JSON.parse(line);
@@ -2935,6 +2960,21 @@ class AgentRunner extends events_1.EventEmitter {
2935
2960
  }
2936
2961
  return;
2937
2962
  }
2963
+ // WeChat has no .forward consumer either — same gap that used to silently
2964
+ // drop every command reply / no-tool-call fallback for Slack (confirmed
2965
+ // live 2026-09-11: the agent's plain-text reply showed up in the web
2966
+ // session view but never reached the user's phone, because it landed in
2967
+ // a chatId.forward file nothing reads for this channel). Deliver via the
2968
+ // manager directly, mirroring Slack's branch above.
2969
+ if (this.channelFor(chatId) === 'wechat') {
2970
+ void this.wechat?.sendMessage(chatId, text).catch((err) => {
2971
+ this.logger.warn('WeChat auto-forward failed', {
2972
+ chatId,
2973
+ error: err instanceof Error ? err.message : String(err),
2974
+ });
2975
+ });
2976
+ return;
2977
+ }
2938
2978
  const typingDir = this.getTypingDir(chatId);
2939
2979
  const forwardPath = path.join(typingDir, `${chatId}.forward`);
2940
2980
  try {
@@ -3043,6 +3083,8 @@ class AgentRunner extends events_1.EventEmitter {
3043
3083
  // no-ops here and stays 'unlinked' until the user starts a QR/pairing
3044
3084
  // flow via the API.
3045
3085
  this.syncWhatsAppAccounts();
3086
+ this.ensureWeChatManager();
3087
+ await this.wechat?.resumeIfLinked();
3046
3088
  this.startIdleCleaner();
3047
3089
  this._startCleanupScheduler();
3048
3090
  this.logger.info('AgentRunner started', { agentId: this.agentConfig.id });
@@ -3104,6 +3146,10 @@ class AgentRunner extends events_1.EventEmitter {
3104
3146
  // (access-control fields) into every already-running manager, and
3105
3147
  // add/remove managers only if the set of configured accounts changed.
3106
3148
  this.syncWhatsAppAccounts();
3149
+ // WeChat has no credential to react to (QR-linked, not config-driven) —
3150
+ // just hand the manager the fresh config so its access-control reads
3151
+ // (dmPolicy/dmAllowlist/pairing) see the latest values.
3152
+ this.wechat?.updateAgentConfig(newConfig);
3107
3153
  }
3108
3154
  /**
3109
3155
  * Reconcile `this.whatsappAccounts` with `agentConfig.whatsapp.accounts`.
@@ -3220,6 +3266,133 @@ class AgentRunner extends events_1.EventEmitter {
3220
3266
  opts) {
3221
3267
  await this.whatsAppManagerFor(jid, accountId).sendMessage(jid, text, imagePath, opts);
3222
3268
  }
3269
+ /** Lazily construct this agent's WeChatManager — safe to call repeatedly. */
3270
+ ensureWeChatManager() {
3271
+ if (!this.wechat) {
3272
+ // WECHAT_ILINK_FAKE is local-testing-only (see ilink-client.ts's
3273
+ // createFakeILinkClient doc comment) — never set in a real deployment.
3274
+ // The real client needs no account/credential of its own (confirmed
3275
+ // against Tencent's own protocol doc — see ilink-client.ts's module
3276
+ // comment), this flag exists purely to skip a real QR scan while
3277
+ // iterating on the UI.
3278
+ const client = (0, ilink_client_1.isWeChatILinkFakeEnabled)()
3279
+ ? (0, ilink_client_1.createFakeILinkClient)()
3280
+ : (0, ilink_client_1.createILinkClient)(process.env.ILINK_BASE_URL ?? '', this.agentConfig.wechat?.botAgent);
3281
+ this.wechat = new manager_2.WeChatManager(this.agentConfig, this.gatewayConfig.gateway.logDir, client, (update) => this.handleWeChatInboundMessage(update));
3282
+ }
3283
+ return this.wechat;
3284
+ }
3285
+ getWeChatStatus() {
3286
+ return this.ensureWeChatManager().getStatus();
3287
+ }
3288
+ async startWeChatLinking() {
3289
+ await this.ensureWeChatManager().startLinking();
3290
+ }
3291
+ async unlinkWeChat() {
3292
+ await this.ensureWeChatManager().unlink();
3293
+ }
3294
+ async sendWeChatMessage(toId, text) {
3295
+ await this.ensureWeChatManager().sendMessage(toId, text);
3296
+ }
3297
+ /**
3298
+ * Gate + forward one inbound WeChat message. Mirrors the LINE webhook
3299
+ * router's own gate-then-forward-to-/channel shape exactly (see
3300
+ * src/api/line-webhook-router.ts's `recordDeniedSender` call and its
3301
+ * "forward to the agent's existing /channel intake" comment) — WeChat has
3302
+ * no webhook of its own, so this is the equivalent point for a message
3303
+ * arriving off WeChatManager's long-poll loop instead of an Express route.
3304
+ */
3305
+ handleWeChatInboundMessage(update) {
3306
+ const cfg = this.agentConfig.wechat;
3307
+ const allowed = (0, wechat_access_1.isWeChatConversationAllowed)(cfg, { fromId: update.fromId });
3308
+ if (!allowed) {
3309
+ const pairingOn = cfg?.pairing !== false; // absent ⇒ on, mirrors line.pairing/slack.pairing
3310
+ const existing = (0, pending_senders_1.getPendingSender)('wechat', this.agentConfig.id, update.fromId);
3311
+ const code = pairingOn ? (existing?.code ?? (0, pending_senders_1.generatePairingCode)()) : undefined;
3312
+ const isNew = (0, pending_senders_1.recordDeniedSender)('wechat', this.agentConfig.id, update.fromId, update.displayName, Date.now(), code);
3313
+ if (isNew && pairingOn && code) {
3314
+ this.wechat
3315
+ ?.sendMessage(update.fromId, `This account isn't approved to message this agent yet. Give the admin this code: ${code}`)
3316
+ .catch((err) => this.logger.warn('WeChat pairing-code reply failed', { error: err.message }));
3317
+ }
3318
+ return;
3319
+ }
3320
+ // Self-heal a stale pending-knock record for a sender who's now allowed.
3321
+ // Approving a sender already clears their pending entry (router.ts's
3322
+ // wechat_dm_allowlist PATCH handler), but confirmed live 2026-09-11: a
3323
+ // sender can still show as both allowed AND pending in the UI, most
3324
+ // likely a race between that approval and a message processed in the
3325
+ // same window. Clearing it here too means any such staleness can't
3326
+ // outlive this sender's very next allowed message.
3327
+ (0, pending_senders_1.clearPendingSender)('wechat', this.agentConfig.id, update.fromId);
3328
+ const meta = {
3329
+ source: 'wechat',
3330
+ chat_id: update.fromId,
3331
+ user_id: update.fromId,
3332
+ user: update.displayName || update.fromId,
3333
+ message_id: update.id,
3334
+ ts: new Date(update.timestamp ?? Date.now()).toISOString(),
3335
+ };
3336
+ void (async () => {
3337
+ // Stage an inbound image or file to a temp path the same way LINE's
3338
+ // webhook router does (src/api/line-webhook-router.ts's
3339
+ // downloadLineImage/drainToFile pattern) — AgentRunner.injectTurn
3340
+ // already knows how to take meta.image_path from here (the field name
3341
+ // is historical; the mechanism itself is content-agnostic — it just
3342
+ // copies whatever's at that path into MediaStore), rewrite the path
3343
+ // for the agent's sandbox, and clean up the ephemeral original. No
3344
+ // format sniffing for images: always staged as .jpg, matching
3345
+ // Hermes-agent's own assumption for this same protocol. Files keep
3346
+ // their real name/extension (sniffing isn't needed — it's given).
3347
+ // update.id (Tencent's message_id) arrives as a JSON number at runtime
3348
+ // despite ILinkUpdate declaring it a string (confirmed live
3349
+ // 2026-09-11: `.replace is not a function` on a real image message) —
3350
+ // String() it before sanitizing.
3351
+ const safeId = String(update.id).replace(/[^a-zA-Z0-9_-]/g, '_');
3352
+ if (update.image) {
3353
+ try {
3354
+ const bytes = await (0, ilink_client_1.downloadWeixinImage)(update.image, { maxBytes: media_store_1.MediaStore.maxUploadBytes });
3355
+ const tempPath = path.join(os.tmpdir(), `wechat-img-${safeId}-${Date.now()}.jpg`);
3356
+ await fsPromises.writeFile(tempPath, bytes);
3357
+ meta.image_path = tempPath;
3358
+ meta.media_ephemeral = '1';
3359
+ }
3360
+ catch (err) {
3361
+ this.logger.warn('WeChat image download failed, forwarding text only', {
3362
+ error: err.message,
3363
+ });
3364
+ }
3365
+ }
3366
+ else if (update.file) {
3367
+ try {
3368
+ const bytes = await (0, ilink_client_1.downloadWeixinImage)(update.file, { maxBytes: media_store_1.MediaStore.maxUploadBytes });
3369
+ // Preserve the sender's real filename/extension (unlike images,
3370
+ // which are always staged as .jpg) — the agent's Read tool needs a
3371
+ // correct extension to make sense of a PDF/docx/etc.
3372
+ const safeName = update.file.fileName.replace(/[^a-zA-Z0-9_.-]/g, '_') || 'file';
3373
+ const tempPath = path.join(os.tmpdir(), `wechat-file-${safeId}-${Date.now()}-${safeName}`);
3374
+ await fsPromises.writeFile(tempPath, bytes);
3375
+ meta.image_path = tempPath;
3376
+ meta.media_ephemeral = '1';
3377
+ }
3378
+ catch (err) {
3379
+ this.logger.warn('WeChat file download failed, forwarding text only', {
3380
+ error: err.message,
3381
+ });
3382
+ }
3383
+ }
3384
+ try {
3385
+ await fetch(`http://127.0.0.1:${this.callbackPort}/channel`, {
3386
+ method: 'POST',
3387
+ headers: { 'Content-Type': 'application/json' },
3388
+ body: JSON.stringify({ content: update.text ?? '', meta }),
3389
+ });
3390
+ }
3391
+ catch (err) {
3392
+ this.logger.error('WeChat: failed to forward to callback', { error: err.message });
3393
+ }
3394
+ })();
3395
+ }
3223
3396
  startSlackOutbound() {
3224
3397
  if (!this.agentConfig.slack?.botToken || !this.agentConfig.slack?.signingSecret)
3225
3398
  return;