feat(feishu): add configurable group response mode

This commit is contained in:
xmanrui 2026-08-22 01:26:29 +08:00
parent 1a86fa5013
commit 9950261a49
19 changed files with 615 additions and 150 deletions

View file

@ -2,6 +2,7 @@ import { randomUUID } from 'node:crypto';
import { FeishuHarnessBridge } from './bridge.mjs';
import { cardActionProbeCard } from './feishu-cards.mjs';
import { VerifiedFeishuChannel } from './feishu-channel.mjs';
import { normalizeFeishuGroupResponseMode } from './group-response-mode.mjs';
import {
connectionTestTargetUnavailable,
sendRememberedConnectionTest,
@ -87,6 +88,8 @@ export class FeishuRuntime {
#appId;
#appSecret;
#domain;
#botOpenId;
#groupResponseMode;
#ownerOpenIds;
#harness;
#state;
@ -109,6 +112,8 @@ export class FeishuRuntime {
appId,
appSecret,
domain = 'feishu',
botOpenId,
groupResponseMode,
ownerOpenId,
ownerOpenIds,
harness,
@ -138,6 +143,8 @@ export class FeishuRuntime {
this.#appId = appId;
this.#appSecret = appSecret;
this.#domain = domain;
this.#botOpenId = nonEmptyString(botOpenId);
this.#groupResponseMode = normalizeFeishuGroupResponseMode(groupResponseMode);
this.#ownerOpenIds = normalizedOwners;
this.#harness = harness;
this.#state = state;
@ -153,6 +160,11 @@ export class FeishuRuntime {
return structuredClone(this.#status);
}
setGroupResponseMode(value) {
this.#groupResponseMode = normalizeFeishuGroupResponseMode(value);
this.#bridge?.setGroupResponseMode(this.#groupResponseMode);
}
async start() {
if (this.#wsClient && this.#status.ready) return this.status;
if (this.#starting) return this.#starting;
@ -202,6 +214,8 @@ export class FeishuRuntime {
allowedSenderOpenIds: new Set(this.#ownerOpenIds),
botId: this.#botId,
appId: this.#appId,
botOpenId: this.#botOpenId,
groupResponseMode: this.#groupResponseMode,
repair: this.#repair,
repairOwnerOpenIds: new Set(this.#ownerOpenIds.filter((value) => value !== '*')),
replyTimeoutMs: this.#replyTimeoutMs,