@modelzen/feishu-codex-bridge 0.4.0 → 0.4.1
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 +17 -8
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -7502,6 +7502,12 @@ function sanitizeContext(s, maxLen, oneLine2) {
|
|
|
7502
7502
|
out = out.trim();
|
|
7503
7503
|
return out.length > maxLen ? `${out.slice(0, maxLen)}\u2026` : out;
|
|
7504
7504
|
}
|
|
7505
|
+
function prependBlock(block, text) {
|
|
7506
|
+
const base = text.trim();
|
|
7507
|
+
return base ? `${block}
|
|
7508
|
+
|
|
7509
|
+
${base}` : block;
|
|
7510
|
+
}
|
|
7505
7511
|
function weaveQuote(text, quoted) {
|
|
7506
7512
|
if (!quoted) return text;
|
|
7507
7513
|
const who = sanitizeContext(quoted.senderName, 40, true) || "\u67D0\u4EBA";
|
|
@@ -7510,10 +7516,7 @@ function weaveQuote(text, quoted) {
|
|
|
7510
7516
|
const block = `[\u7528\u6237\u5F15\u7528\u4E86\u4E00\u6761\u6D88\u606F\uFF08\u6765\u81EA ${who}\uFF09\uFF1A
|
|
7511
7517
|
${body}
|
|
7512
7518
|
]`;
|
|
7513
|
-
|
|
7514
|
-
return base ? `${block}
|
|
7515
|
-
|
|
7516
|
-
${base}` : block;
|
|
7519
|
+
return prependBlock(block, text);
|
|
7517
7520
|
}
|
|
7518
7521
|
function weaveThreadHistory(text, msgs) {
|
|
7519
7522
|
if (msgs.length === 0) return text;
|
|
@@ -7526,10 +7529,15 @@ function weaveThreadHistory(text, msgs) {
|
|
|
7526
7529
|
const block = `[\u8BDD\u9898\u4E2D\u5728\u6B64\u4E4B\u524D\u5DF2\u6709\u7684\u6D88\u606F\uFF08\u6309\u65F6\u95F4\u5148\u540E\u6392\u5217\uFF0C\u4F9B\u4F60\u7406\u89E3\u4E0A\u4E0B\u6587\uFF09\uFF1A
|
|
7527
7530
|
${lines.join("\n")}
|
|
7528
7531
|
]`;
|
|
7529
|
-
|
|
7530
|
-
|
|
7531
|
-
|
|
7532
|
-
|
|
7532
|
+
return prependBlock(block, text);
|
|
7533
|
+
}
|
|
7534
|
+
var SENDER_NAME_MAX = 40;
|
|
7535
|
+
function weaveSender(text, sender) {
|
|
7536
|
+
const id = (sender.senderId ?? "").trim();
|
|
7537
|
+
if (!id) return text;
|
|
7538
|
+
const who = sanitizeContext(sender.senderName ?? "", SENDER_NAME_MAX, true) || "\u67D0\u7528\u6237";
|
|
7539
|
+
const block = `[\u672C\u6761\u6D88\u606F\u7684\u53D1\u4FE1\u4EBA\uFF1A${who}\uFF08open_id\uFF1A${id}\uFF09]`;
|
|
7540
|
+
return prependBlock(block, text);
|
|
7533
7541
|
}
|
|
7534
7542
|
|
|
7535
7543
|
// src/bot/comments.ts
|
|
@@ -8271,6 +8279,7 @@ function createOrchestrator(channel, cfg, fallbackCwd) {
|
|
|
8271
8279
|
const quoted = await fetchQuotedMessage(channel, msg.replyToMessageId);
|
|
8272
8280
|
body = weaveQuote(body, quoted);
|
|
8273
8281
|
}
|
|
8282
|
+
body = weaveSender(body, msg);
|
|
8274
8283
|
return body;
|
|
8275
8284
|
}
|
|
8276
8285
|
async function handleTurn(msg, text, sessionKey, flat, project, perm) {
|