UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

3 lines • 1.18 kB
import{l as normalizeOptionalString}from"./string-coerce-CpTFcSwY.mjs";import{n as sha256Hex}from"./node-crypto-DPk8agfR.mjs";import"./string-coerce-runtime-BYDH9Quw.mjs"; //!extensions/device-pair/notify-state.ts const DEVICE_PAIR_NOTIFY_SUBSCRIBER_NAMESPACE=`notify-subscribers`;const DEVICE_PAIR_NOTIFY_SEEN_REQUEST_NAMESPACE=`notify-seen-requests`;const DEVICE_PAIR_NOTIFY_SUBSCRIBER_MAX_ENTRIES=1024;const DEVICE_PAIR_NOTIFY_SEEN_REQUEST_MAX_ENTRIES=4096;const DEVICE_PAIR_NOTIFY_MAX_SEEN_AGE_MS=864e5;function normalizeNotifyThreadKey(e){if(typeof e===`number`&&Number.isFinite(e))return String(Math.trunc(e));if(typeof e!==`string`)return``;const t=normalizeOptionalString(e);if(!t)return``;if(!/^-?\d+$/u.test(t))return t;try{return BigInt(t).toString()}catch{return t}}function notifySubscriberStoreKey(e){return sha256Hex(JSON.stringify([e.to,e.accountId??``,normalizeNotifyThreadKey(e.messageThreadId)]))}export{DEVICE_PAIR_NOTIFY_SUBSCRIBER_NAMESPACE as a,DEVICE_PAIR_NOTIFY_SUBSCRIBER_MAX_ENTRIES as i,DEVICE_PAIR_NOTIFY_SEEN_REQUEST_MAX_ENTRIES as n,notifySubscriberStoreKey as o,DEVICE_PAIR_NOTIFY_SEEN_REQUEST_NAMESPACE as r,DEVICE_PAIR_NOTIFY_MAX_SEEN_AGE_MS as t};