@ganglion/weacpx-channel-feishu 0.2.1 → 0.2.2

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/dist/inbound.d.ts CHANGED
@@ -7,6 +7,24 @@ export declare function parseFeishuConversationId(chatKey: string): {
7
7
  chatId: string;
8
8
  threadId?: string;
9
9
  } | null;
10
+ /**
11
+ * Builds the chat-route metadata weacpx records for the current coordinator
12
+ * session. The host requires `chatType` to be `"direct"` or `"group"`, but
13
+ * Feishu reports `chat_type` as `"p2p"` (direct) or `"group"`, so `"p2p"` and
14
+ * any unexpected value normalize to `"direct"`. Without this, interactive
15
+ * Feishu turns recorded a route with no `chatType`, which blocked the in-session
16
+ * scheduled_create/list/cancel tools and group-owner command authorization.
17
+ */
18
+ export declare function buildFeishuRouteMetadata(input: {
19
+ chatType: string | undefined;
20
+ senderOpenId?: string;
21
+ chatId: string;
22
+ }): {
23
+ channel: "feishu";
24
+ chatType: "direct" | "group";
25
+ senderId?: string;
26
+ groupId?: string;
27
+ };
10
28
  export declare function shouldHandleFeishuMessage(input: {
11
29
  event: FeishuMessageEvent;
12
30
  botOpenId?: string;
package/dist/index.js CHANGED
@@ -78312,6 +78312,15 @@ function parseFeishuConversationId(chatKey) {
78312
78312
  }
78313
78313
  return { accountId: parts[1], chatId: parts[2] };
78314
78314
  }
78315
+ function buildFeishuRouteMetadata(input) {
78316
+ const isGroup = input.chatType === "group";
78317
+ return {
78318
+ channel: "feishu",
78319
+ chatType: isGroup ? "group" : "direct",
78320
+ ...input.senderOpenId ? { senderId: input.senderOpenId } : {},
78321
+ ...isGroup ? { groupId: input.chatId } : {}
78322
+ };
78323
+ }
78315
78324
  function shouldHandleFeishuMessage(input) {
78316
78325
  const text = input.parsedText ?? parseFeishuText(input.event.message.content);
78317
78326
  if (input.event.message.message_type !== "text" && !input.allowMediaOnly && text.trim().length === 0) {
@@ -80670,6 +80679,7 @@ class FeishuChannel {
80670
80679
  text: requestText,
80671
80680
  ...media.length > 0 ? { media } : {},
80672
80681
  replyContextToken: messageId,
80682
+ metadata: buildFeishuRouteMetadata({ chatType, senderOpenId: active.senderOpenId, chatId }),
80673
80683
  reply: safeReply,
80674
80684
  ...active.cardController ? {
80675
80685
  onToolEvent: (event) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ganglion/weacpx-channel-feishu",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "description": "Feishu channel plugin for weacpx.",
5
5
  "license": "MIT",
6
6
  "keywords": ["weacpx", "feishu", "channel", "plugin"],