import { resolveWhatsAppAccount } from "./accounts.js"; import { readWebAuthExistsForDecision, WHATSAPP_AUTH_UNSTABLE_CODE } from "./auth-store.js"; import type { OpenClawConfig } from "./runtime-api.js"; import { loadWhatsAppChannelRuntime } from "./shared.js";
export async function checkWhatsAppHeartbeatReady(params: {
cfg: OpenClawConfig;
accountId?: string;
deps?: {
readWebAuthExistsForDecision?: typeof readWebAuthExistsForDecision;
hasActiveWebListener?: (accountId?: string) => boolean;
};
}) { if (params.cfg.web?.enabled === false) { return { ok: false as const, reason: "whatsapp-disabled" as const };
} const account = resolveWhatsAppAccount({ cfg: params.cfg, accountId: params.accountId }); const authState = await (
params.deps?.readWebAuthExistsForDecision ?? readWebAuthExistsForDecision
)(account.authDir); if (authState.outcome === "unstable") { return { ok: false as const, reason: WHATSAPP_AUTH_UNSTABLE_CODE };
} if (!authState.exists) { return { ok: false as const, reason: "whatsapp-not-linked" as const };
} const listenerActive = params.deps?.hasActiveWebListener
? params.deps.hasActiveWebListener(account.accountId)
: Boolean((await loadWhatsAppChannelRuntime()).getActiveWebListener(account.accountId)); if (!listenerActive) { return { ok: false as const, reason: "whatsapp-not-running" as const };
} return { ok: true as const, reason: "ok" as const };
}
Messung V0.5 in Prozent
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.14Bemerkung:
(vorverarbeitet am 2026-06-07)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.