Fix empty result JSON dump and missing heartbeat prefix
Bug fixes: - Empty result field handling: Changed truthy check to explicit type check (`typeof parsed?.text === "string"`) in command-reply.ts. Previously, Claude CLI returning `result: ""` would cause raw JSON to be sent to WhatsApp. - Response prefix on heartbeat: Apply `responsePrefix` to heartbeat alert messages in runReplyHeartbeat, matching behavior of regular message handler.
This commit is contained in:
@@ -230,7 +230,7 @@ export async function runCommandReply(
|
||||
`Claude JSON raw: ${JSON.stringify(parsed.parsed, null, 2)}`,
|
||||
);
|
||||
}
|
||||
if (parsed?.text) {
|
||||
if (typeof parsed?.text === "string") {
|
||||
logVerbose(
|
||||
`Claude JSON parsed -> ${parsed.text.slice(0, 120)}${parsed.text.length > 120 ? "…" : ""}`,
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user