Skip to content

Commit cdf0ee3

Browse files
committed
fix(line): strip internal tool-trace banners from outbound text
1 parent c8d95da commit cdf0ee3

2 files changed

Lines changed: 21 additions & 0 deletions

File tree

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// LINE outbound must strip assistant internal tool-trace scaffolding, matching
2+
// the sibling channel fixes tracked under #90684 (Slack / Signal / Matrix /
3+
// Feishu / Mattermost / Telegram / Google Chat / QQBot / IRC / SMS).
4+
import { describe, expect, it } from "vitest";
5+
import { linePlugin } from "./channel.js";
6+
7+
describe("line outbound sanitizeText", () => {
8+
it("strips internal tool-trace banners before outbound delivery", () => {
9+
const text = "Done.\n⚠️ 🛠️ `search repos (agent)` failed";
10+
11+
expect(linePlugin.outbound?.sanitizeText?.({ text, payload: { text } })).toBe("Done.");
12+
});
13+
14+
it("preserves ordinary assistant prose while sanitizing", () => {
15+
const text = "The pipeline has 3 open deals.";
16+
17+
expect(linePlugin.outbound?.sanitizeText?.({ text, payload: { text } })).toBe(text);
18+
});
19+
});

extensions/line/src/outbound.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import {
1010
} from "openclaw/plugin-sdk/channel-send-result";
1111
import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
1212
import { resolveOutboundMediaUrls } from "openclaw/plugin-sdk/reply-payload";
13+
import { sanitizeAssistantVisibleText } from "openclaw/plugin-sdk/text-chunking";
1314
import { truncateUtf16Safe } from "openclaw/plugin-sdk/text-utility-runtime";
1415
import type { ChannelPlugin, ResolvedLineAccount } from "./channel-api.js";
1516
import { resolveLineOutboundMedia, type LineOutboundMediaResolved } from "./outbound-media.js";
@@ -82,6 +83,7 @@ export const lineOutboundAdapter: NonNullable<ChannelPlugin<ResolvedLineAccount>
8283
deliveryMode: "direct",
8384
chunker: (text, limit) => getLineRuntime().channel.text.chunkMarkdownText(text, limit),
8485
textChunkLimit: 5000,
86+
sanitizeText: ({ text }) => sanitizeAssistantVisibleText(text),
8587
sendPayload: async ({ to, payload, accountId, cfg, onDeliveryResult }) => {
8688
const runtime = getLineRuntime();
8789
const outboundRuntime = await loadLineOutboundRuntime();

0 commit comments

Comments
 (0)