Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/Java/Openclaw/extensions/whatsapp/src/   (KI Agentensystem Version 22©)  Datei vom 26.3.2026 mit Größe 1 kB image not shown  

Quelle  heartbeat.ts

  Sprache: JAVA
 

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
C=100 H=100 G=100

¤ Dauer der Verarbeitung: 0.5 Sekunden  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

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.