mirror of
https://github.com/openclaw/openclaw.git
synced 2026-07-10 08:09:06 +00:00
* fix(irc): sanitize internal tool-trace lines from outbound text * fix(irc): sanitize internal tool-trace lines from outbound text --------- Co-authored-by: Vincent Koc <vincentkoc@ieee.org>
36 lines
1.2 KiB
TypeScript
36 lines
1.2 KiB
TypeScript
// Irc tests cover channel plugin behavior.
|
||
import { afterEach, describe, expect, it } from "vitest";
|
||
import { ircOutboundBaseAdapter } from "./outbound-base.js";
|
||
import { clearIrcRuntime } from "./runtime.js";
|
||
|
||
describe("irc outbound chunking", () => {
|
||
afterEach(() => {
|
||
clearIrcRuntime();
|
||
});
|
||
|
||
it("chunks outbound text without requiring IRC runtime initialization", () => {
|
||
expect(ircOutboundBaseAdapter.chunker("alpha beta", 5)).toEqual(["alpha", "beta"]);
|
||
expect(ircOutboundBaseAdapter.deliveryMode).toBe("direct");
|
||
expect(ircOutboundBaseAdapter.chunkerMode).toBe("markdown");
|
||
expect(ircOutboundBaseAdapter.textChunkLimit).toBe(350);
|
||
});
|
||
});
|
||
|
||
describe("irc outbound sanitizeText", () => {
|
||
afterEach(() => {
|
||
clearIrcRuntime();
|
||
});
|
||
|
||
it("strips internal tool-trace banners before outbound delivery", () => {
|
||
const text = "Done.\n⚠️ 🛠️ `search repos (agent)` failed";
|
||
|
||
expect(ircOutboundBaseAdapter.sanitizeText({ text })).toBe("Done.");
|
||
});
|
||
|
||
it("preserves ordinary assistant prose while sanitizing", () => {
|
||
const text = "The pipeline has 3 open deals.";
|
||
|
||
expect(ircOutboundBaseAdapter.sanitizeText({ text })).toBe(text);
|
||
});
|
||
});
|