mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-24 16:32:29 +00:00
Cron: treat shared interactive payloads as deliverable
This commit is contained in:
@@ -1,14 +1,12 @@
|
||||
import { DEFAULT_HEARTBEAT_ACK_MAX_CHARS } from "../../auto-reply/heartbeat.js";
|
||||
import type { ReplyPayload } from "../../auto-reply/types.js";
|
||||
import { truncateUtf16Safe } from "../../utils.js";
|
||||
import { shouldSkipHeartbeatOnlyDelivery } from "../heartbeat-policy.js";
|
||||
|
||||
type DeliveryPayload = {
|
||||
text?: string;
|
||||
mediaUrl?: string;
|
||||
mediaUrls?: string[];
|
||||
channelData?: Record<string, unknown>;
|
||||
isError?: boolean;
|
||||
};
|
||||
type DeliveryPayload = Pick<
|
||||
ReplyPayload,
|
||||
"text" | "mediaUrl" | "mediaUrls" | "interactive" | "channelData" | "isError"
|
||||
>;
|
||||
|
||||
export function pickSummaryFromOutput(text: string | undefined) {
|
||||
const clean = (text ?? "").trim();
|
||||
@@ -65,8 +63,9 @@ export function pickLastDeliverablePayload(payloads: DeliveryPayload[]) {
|
||||
const isDeliverable = (p: DeliveryPayload) => {
|
||||
const text = (p?.text ?? "").trim();
|
||||
const hasMedia = Boolean(p?.mediaUrl) || (p?.mediaUrls?.length ?? 0) > 0;
|
||||
const hasInteractive = (p?.interactive?.blocks?.length ?? 0) > 0;
|
||||
const hasChannelData = Object.keys(p?.channelData ?? {}).length > 0;
|
||||
return text || hasMedia || hasChannelData;
|
||||
return text || hasMedia || hasInteractive || hasChannelData;
|
||||
};
|
||||
for (let i = payloads.length - 1; i >= 0; i--) {
|
||||
if (payloads[i]?.isError) {
|
||||
|
||||
Reference in New Issue
Block a user