aai-lark-bridge 0.2.48 → 0.2.49

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/cli.js CHANGED
@@ -4,7 +4,7 @@ import { Command } from "commander";
4
4
  // package.json
5
5
  var package_default = {
6
6
  name: "aai-lark-bridge",
7
- version: "0.2.48",
7
+ version: "0.2.49",
8
8
  description: "Lark AI Native Bridge - Lark\u57FA\u7840\u8BBE\u65BD\u5C42\u548CCLI\u96C6\u6210",
9
9
  type: "module",
10
10
  main: "./dist/index.js",
@@ -15401,39 +15401,6 @@ async function removeReaction(channel, messageId, reactionId) {
15401
15401
  var POSITIVE_EMOJIS = /* @__PURE__ */ new Set(["OK", "THUMBSUP", "DONE", "JIAYI", "LGTM"]);
15402
15402
  var CONFIRM_WINDOW_MS = 45 * 6e4;
15403
15403
  var SCOPE_MAX = 500;
15404
- function extractText(content) {
15405
- if (!content) return "";
15406
- let tree;
15407
- try {
15408
- tree = JSON.parse(content);
15409
- } catch {
15410
- return content;
15411
- }
15412
- if (tree && typeof tree === "object" && tree.schema === "2.0") {
15413
- const elements = tree.body?.elements;
15414
- const parts = [];
15415
- if (Array.isArray(elements)) {
15416
- for (const el of elements) {
15417
- const e = el;
15418
- if (e?.tag === "markdown" && typeof e.content === "string" && e.text_size !== "notation") parts.push(e.content);
15419
- }
15420
- }
15421
- return parts.join("\n");
15422
- }
15423
- const out = [];
15424
- const walk = (v, key) => {
15425
- if (typeof v === "string") {
15426
- if (key === "text" || key === "content" || key === "title") out.push(v);
15427
- } else if (Array.isArray(v)) v.forEach((x) => walk(x, key));
15428
- else if (v && typeof v === "object") for (const [k, x] of Object.entries(v)) walk(x, k);
15429
- };
15430
- walk(tree);
15431
- return out.join("\n");
15432
- }
15433
- function isConfirmQuestion(text) {
15434
- const tail = text.trim().split(/[。!!\n]/).map((s) => s.trim()).filter(Boolean).pop() ?? "";
15435
- return /[??]$/.test(tail) && /吗|是否|要不要|可不可以|对不对|行不行|可以不/.test(tail);
15436
- }
15437
15404
  var ReactionConfirmer = class {
15438
15405
  constructor(now = Date.now) {
15439
15406
  this.now = now;
@@ -15478,7 +15445,6 @@ var ReactionConfirmer = class {
15478
15445
  if (this.latestByScope.get(handled.scope) !== parentId) return reject4("not-latest");
15479
15446
  if (handled.msg.chatId !== bot.chat_id) return reject4("chat-mismatch");
15480
15447
  if (evt.operator.openId !== handled.msg.senderId) return reject4("not-asker");
15481
- if (!isConfirmQuestion(extractText(bot.body?.content))) return reject4("not-a-question");
15482
15448
  const t = this.now();
15483
15449
  if (t - handled.msg.createTime > CONFIRM_WINDOW_MS) return reject4("expired");
15484
15450
  this.used.add(evt.messageId);