mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-25 20:05:46 -06:00
30a241c498
* 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>
30 lines
873 B
TypeScript
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);
|
|
});
|
|
});
|