openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
27 lines (26 loc) • 1.43 kB
JavaScript
import { a as isSilentReplyPayloadText } from "./tokens-Ljy0DfNV.mjs";
import { u as stripHeartbeatToken } from "./heartbeat-nZ1C5oCa.mjs";
import { t as stripInternalMetadataForDisplay } from "./display-text-sanitize-BuJdluwh.mjs";
import { c as trimTextPreservingCode } from "./text-projection-DmHct7rN.mjs";
import { t as stripMixedSilentReplyTokens } from "./mixed-silent-reply-tokens-CMO7m8hX.mjs";
//#region src/auto-reply/reply/pending-final-delivery-state.ts
const PENDING_FINAL_DELIVERY_CLEAR_PATCH = { pendingFinalDelivery: void 0 };
function classifyHeartbeatPendingFinalDelivery(text, ackMaxChars) {
const stripped = stripHeartbeatToken(text, {
mode: "heartbeat",
maxAckChars: ackMaxChars
});
return {
shouldClear: stripped.shouldSkip,
replayText: stripped.didStrip && stripped.text ? stripped.text : text
};
}
/** Sanitizes pending final delivery text before channel-visible output. */
function sanitizePendingFinalDeliveryText(text) {
let stripped = trimTextPreservingCode(stripInternalMetadataForDisplay(text));
if (isSilentReplyPayloadText(stripped, "NO_REPLY")) return "";
stripped = stripMixedSilentReplyTokens(stripped) ?? stripped;
return !stripped.trim() || isSilentReplyPayloadText(stripped, "NO_REPLY") ? "" : trimTextPreservingCode(stripped);
}
//#endregion
export { classifyHeartbeatPendingFinalDelivery as n, sanitizePendingFinalDeliveryText as r, PENDING_FINAL_DELIVERY_CLEAR_PATCH as t };