fix: preserve visible Discord labeled replies

This commit is contained in:
Peter Steinberger
2026-05-04 23:08:31 +01:00
parent 31edc4ee1a
commit 343f859b90
2 changed files with 26 additions and 1 deletions

View File

@@ -249,6 +249,31 @@ describe("deliverDiscordReply", () => {
);
});
it("does not strip ordinary visible labeled lines", async () => {
const text = [
"Command: restart the gateway",
"Search: check recent Discord logs",
"Open: the channel status page",
"Find: the failing account",
].join("\n");
await deliverDiscordReply({
replies: [{ text }],
target: "channel:101",
token: "token",
accountId: "default",
runtime,
cfg,
textLimit: 2000,
});
expect(deliverOutboundPayloadsMock).toHaveBeenCalledWith(
expect.objectContaining({
payloads: [{ text }],
}),
);
});
it("passes resolved Discord formatting options as explicit delivery options", async () => {
const baseCfg = {
channels: {

View File

@@ -3,7 +3,7 @@ import { resolveSendableOutboundReplyParts } from "openclaw/plugin-sdk/reply-pay
import { sanitizeAssistantVisibleText } from "openclaw/plugin-sdk/text-runtime";
const DISCORD_INTERNAL_TRACE_LINE_RE =
/^(?:>\s*)?(?:(?:📊|🛠️|📖|📝|🔍|🔎|⚙️)\s*)?(?:Session Status|Exec|Read|Edit|Write|Patch|Search|Open|Click|Find|Screenshot|Update Plan|Tool Call|Tool Result|Function Call|Shell|Command)\s*:/i;
/^(?:>\s*)?(?:📊|🛠️|📖|📝|🔍|🔎|⚙️)\s*(?:Session Status|Exec|Read|Edit|Write|Patch|Search|Open|Click|Find|Screenshot|Update Plan|Tool Call|Tool Result|Function Call|Shell|Command)\s*:/i;
const DISCORD_INTERNAL_CHANNEL_LINE_RE =
/^(?:>\s*)?(?:analysis|commentary|tool[-_ ]?call|tool[-_ ]?result|function[-_ ]?call|thinking|reasoning)\s*[:=]/i;