Heartbeat: normalize array replies

This commit is contained in:
Peter Steinberger
2025-12-03 00:40:19 +00:00
parent a7fdc7b992
commit 9da5b9f4bb
4 changed files with 47 additions and 20 deletions

View File

@@ -310,11 +310,23 @@ export async function getReplyFromConfig(
return result;
}
if (reply && reply.mode === "command" && reply.command?.length) {
const isHeartbeat = opts?.isHeartbeat === true;
if (reply && reply.mode === "command") {
const commandArgs =
isHeartbeat && reply.heartbeatCommand?.length
? reply.heartbeatCommand
: reply.command;
if (!commandArgs?.length) {
cleanupTyping();
return undefined;
}
await onReplyStart();
const commandReply = {
...reply,
command: reply.command,
command: commandArgs,
mode: "command" as const,
};
try {

View File

@@ -1,5 +1,6 @@
export type GetReplyOptions = {
onReplyStart?: () => Promise<void> | void;
isHeartbeat?: boolean;
};
export type ReplyPayload = {