Files
openclaw/extensions/line/src/outbound-tool-trace-sanitize.test.ts
pick-cat 30a241c498 fix(line): strip internal tool-trace banners from outbound text (#101708)
* fix(line): strip internal tool-trace banners from outbound text

* fix(line): sanitize inbound assistant replies

* chore: retrigger PR CI

---------

Co-authored-by: Pick-cat <266665499+Pick-cat@users.noreply.github.com>
Co-authored-by: Peter Steinberger <steipete@gmail.com>
2026-07-14 15:38:19 -07:00

30 lines
873 B
TypeScript

import { describe, expect, it } from "vitest";
import { lineOutboundAdapter } from "./outbound.js";
describe("line outbound sanitizeText", () => {
const sanitize = (text: string) =>
lineOutboundAdapter.sanitizeText?.({ text, payload: { text } });
it("strips internal tool traces before standard outbound delivery", () => {
const text = [
"Done.",
'<tool_call>{"name":"read","arguments":{"path":"secret"}}</tool_call>',
"⚠️ 🛠️ `search repos (agent)` failed",
].join("\n");
expect(sanitize(text)).toBe("Done.");
});
it("preserves literal tool-trace examples in fenced code", () => {
const text = [
"Example:",
"```text",
"⚠️ 🛠️ `search repos (agent)` failed",
'<tool_call>{"name":"read"}</tool_call>',
"```",
].join("\n");
expect(sanitize(text)).toBe(text);
});
});