mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-10 17:14:57 +00:00
fix(auto-reply): tighten silent token semantics and prefix streaming
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { describe, it, expect } from "vitest";
|
||||
import { isSilentReplyText } from "./tokens.js";
|
||||
import { isSilentReplyPrefixText, isSilentReplyText } from "./tokens.js";
|
||||
|
||||
describe("isSilentReplyText", () => {
|
||||
it("returns true for exact token", () => {
|
||||
@@ -35,3 +35,24 @@ describe("isSilentReplyText", () => {
|
||||
expect(isSilentReplyText("Checked inbox. HEARTBEAT_OK", "HEARTBEAT_OK")).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe("isSilentReplyPrefixText", () => {
|
||||
it("matches uppercase underscore prefixes", () => {
|
||||
expect(isSilentReplyPrefixText("NO_")).toBe(true);
|
||||
expect(isSilentReplyPrefixText("NO_RE")).toBe(true);
|
||||
expect(isSilentReplyPrefixText("NO_REPLY")).toBe(true);
|
||||
expect(isSilentReplyPrefixText(" HEARTBEAT_", "HEARTBEAT_OK")).toBe(true);
|
||||
});
|
||||
|
||||
it("rejects ambiguous natural-language prefixes", () => {
|
||||
expect(isSilentReplyPrefixText("N")).toBe(false);
|
||||
expect(isSilentReplyPrefixText("No")).toBe(false);
|
||||
expect(isSilentReplyPrefixText("Hello")).toBe(false);
|
||||
});
|
||||
|
||||
it("rejects non-prefixes and mixed characters", () => {
|
||||
expect(isSilentReplyPrefixText("NO_X")).toBe(false);
|
||||
expect(isSilentReplyPrefixText("NO_REPLY more")).toBe(false);
|
||||
expect(isSilentReplyPrefixText("NO-")).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user