{"version":3,"file":"chunk-memory-signal-manager.mjs","names":[],"sources":["../../src/messenger-monitor.ts","../../src/timeouts.ts","../../src/messenger.ts","../../src/signal-methods.ts","../../src/signal-manager/memory-signal-manager.ts"],"sourcesContent":["//\n// Copyright 2024 DXOS.org\n//\n\nimport { trace } from '@dxos/tracing';\n\nexport class MessengerMonitor {\n  public recordMessageAckFailed(): void {\n    trace.metrics.increment('dxos.mesh.signal.messenger.failed-ack', 1);\n  }\n\n  public recordReliableMessage(params: { sendAttempts: number; sent: boolean }): void {\n    trace.metrics.increment('dxos.mesh.signal.messenger.reliable-send', 1, {\n      tags: {\n        success: params.sent,\n        attempts: params.sendAttempts,\n      },\n    });\n  }\n}\n","//\n// Copyright 2023 DXOS.org\n//\n\n/**\n * Timeout for retrying messages.\n */\nexport const MESSAGE_TIMEOUT = 10_000;\n","//\n// Copyright 2022 DXOS.org\n//\n\nimport { TimeoutError, scheduleExponentialBackoffTaskInterval, scheduleTask, scheduleTaskInterval } from '@dxos/async';\nimport { type Any } from '@dxos/codec-protobuf';\nimport { Context } from '@dxos/context';\nimport { invariant } from '@dxos/invariant';\nimport { PublicKey } from '@dxos/keys';\nimport { log } from '@dxos/log';\nimport { TimeoutError as ProtocolTimeoutError } from '@dxos/protocols';\nimport { schema } from '@dxos/protocols/proto';\nimport { type ReliablePayload } from '@dxos/protocols/proto/dxos/mesh/messaging';\nimport { ComplexMap, ComplexSet } from '@dxos/util';\n\nimport { MessengerMonitor } from './messenger-monitor';\nimport { type SignalManager } from './signal-manager';\nimport { type Message, type PeerInfo } from './signal-methods';\nimport { MESSAGE_TIMEOUT } from './timeouts';\n\nexport type OnMessage = (params: Message) => Promise<void>;\n\nexport interface MessengerOptions {\n  signalManager: SignalManager;\n  retryDelay?: number;\n}\n\nconst ReliablePayload = schema.getCodecForType('dxos.mesh.messaging.ReliablePayload');\nconst Acknowledgement = schema.getCodecForType('dxos.mesh.messaging.Acknowledgement');\n\nconst RECEIVED_MESSAGES_GC_INTERVAL = 120_000;\n\n/**\n * Reliable messenger that works trough signal network.\n */\nexport class Messenger {\n  private readonly _monitor = new MessengerMonitor();\n  private readonly _signalManager: SignalManager;\n  // { peerId, payloadType } => listeners set\n  private readonly _listeners = new ComplexMap<{ peerId: string; payloadType: string }, Set<OnMessage>>(\n    ({ peerId, payloadType }) => peerId + payloadType,\n  );\n\n  // peerId => listeners set\n  private readonly _defaultListeners = new Map<string, Set<OnMessage>>();\n\n  private readonly _onAckCallbacks = new ComplexMap<PublicKey, () => void>(PublicKey.hash);\n\n  private readonly _receivedMessages = new ComplexSet<PublicKey>(PublicKey.hash);\n\n  /**\n   * Keys scheduled to be cleared from _receivedMessages on the next iteration.\n   */\n  private readonly _toClear = new ComplexSet<PublicKey>(PublicKey.hash);\n\n  private _ctx!: Context;\n  private _closed = true;\n  private readonly _retryDelay: number;\n\n  constructor({ signalManager, retryDelay = 1000 }: MessengerOptions) {\n    this._signalManager = signalManager;\n    this._retryDelay = retryDelay;\n\n    this.open();\n  }\n\n  open(): void {\n    if (!this._closed) {\n      return;\n    }\n    log('opening messenger');\n    this._ctx = new Context({\n      onError: (err) => log.catch(err),\n    });\n\n    // Clear the map periodically.\n    scheduleTaskInterval(\n      this._ctx,\n      async () => {\n        this._performGc();\n      },\n      RECEIVED_MESSAGES_GC_INTERVAL,\n    );\n\n    this._closed = false;\n    log('opened messenger');\n  }\n\n  async close(): Promise<void> {\n    if (this._closed) {\n      return;\n    }\n    this._closed = true;\n    // Disposing the context tears down every still-active subscription — each `listen` registers its\n    // transport unsubscribe via `onDispose`, and a handle unsubscribed manually has already cleared\n    // its registration. The offline/online cycle keeps the messenger open (only signaling toggles),\n    // so subscriptions are torn down only on a real close.\n    await this._ctx.dispose();\n  }\n\n  async sendMessage(ctx: Context, message: Message): Promise<void> {\n    invariant(!this._closed, 'Closed');\n    const { author, recipient, payload } = message;\n    // Messenger provides reliable point-to-point delivery; broadcasts are not routed here.\n    invariant(recipient, 'Recipient is required');\n    const messageContext = this._ctx.derive();\n\n    const reliablePayload: ReliablePayload = {\n      messageId: PublicKey.random(),\n      payload,\n    };\n    invariant(!this._onAckCallbacks.has(reliablePayload.messageId!));\n    log('send message', { messageId: reliablePayload.messageId, author, recipient });\n\n    let messageReceived: () => void;\n    let timeoutHit: (err: Error) => void;\n    let sendAttempts = 0;\n\n    const promise = new Promise<void>((resolve, reject) => {\n      messageReceived = resolve;\n      timeoutHit = reject;\n    });\n\n    // Setting retry interval if signal was not acknowledged.\n    scheduleExponentialBackoffTaskInterval(\n      messageContext,\n      async () => {\n        log('retrying message', { messageId: reliablePayload.messageId });\n        sendAttempts++;\n        await this._encodeAndSend(ctx, { author, recipient, reliablePayload }).catch((err) =>\n          log('failed to send message', { err }),\n        );\n      },\n      this._retryDelay,\n    );\n\n    scheduleTask(\n      messageContext,\n      () => {\n        log('message not delivered', { messageId: reliablePayload.messageId });\n        this._onAckCallbacks.delete(reliablePayload.messageId!);\n        timeoutHit(\n          new ProtocolTimeoutError({\n            message: 'signaling message not delivered',\n            cause: new TimeoutError(MESSAGE_TIMEOUT, 'Message not delivered'),\n          }),\n        );\n        void messageContext.dispose();\n        this._monitor.recordReliableMessage({ sendAttempts, sent: false });\n      },\n      MESSAGE_TIMEOUT,\n    );\n\n    this._onAckCallbacks.set(reliablePayload.messageId, () => {\n      messageReceived();\n      this._onAckCallbacks.delete(reliablePayload.messageId!);\n      void messageContext.dispose();\n      this._monitor.recordReliableMessage({ sendAttempts, sent: true });\n    });\n\n    await this._encodeAndSend(ctx, { author, recipient, reliablePayload });\n    return promise;\n  }\n\n  /**\n   * Subscribes onMessage function to messages that contains payload with payloadType.\n   * @param payloadType if not specified, onMessage will be subscribed to all types of messages.\n   */\n  async listen({\n    peer,\n    payloadType,\n    onMessage,\n  }: {\n    peer: PeerInfo;\n    payloadType?: string;\n    onMessage: OnMessage;\n  }): Promise<ListeningHandle> {\n    invariant(!this._closed, 'Closed');\n    invariant(peer.peerKey, 'Peer key is required');\n    const peerKey = peer.peerKey;\n\n    // Multiplexing is owned by the signal manager. The messenger keeps only reliable delivery\n    // (ACK/dedup) and payloadType routing, and passes the transport unsubscribe back through the\n    // handle. The unsubscribe is also registered on the messenger context so `close` tears every\n    // subscription down; a handle unsubscribed manually clears that registration first.\n    const unsubscribe = await this._signalManager.subscribeMessages({\n      peer,\n      onMessage: (message) => {\n        // Subscriptions can outlive a close (they are torn down on dispose, and survive offline/online\n        // cycles), so ignore late deliveries and never let a handler rejection escape as unhandled.\n        if (this._closed) {\n          return;\n        }\n        log('received message', { from: message.author });\n        void this._handleMessage(message).catch((err) => log.catch(err));\n      },\n    });\n    const clearDispose = this._ctx.onDispose(unsubscribe);\n\n    let listeners: Set<OnMessage> | undefined;\n    if (!payloadType) {\n      listeners = this._defaultListeners.get(peerKey);\n      if (!listeners) {\n        listeners = new Set();\n        this._defaultListeners.set(peerKey, listeners);\n      }\n    } else {\n      listeners = this._listeners.get({ peerId: peerKey, payloadType });\n      if (!listeners) {\n        listeners = new Set();\n        this._listeners.set({ peerId: peerKey, payloadType }, listeners);\n      }\n    }\n\n    listeners.add(onMessage);\n\n    return {\n      unsubscribe: async () => {\n        clearDispose();\n        listeners!.delete(onMessage);\n        await unsubscribe();\n      },\n    };\n  }\n\n  private async _encodeAndSend(\n    ctx: Context,\n    {\n      author,\n      recipient,\n      reliablePayload,\n    }: {\n      author: PeerInfo;\n      recipient: PeerInfo;\n      reliablePayload: ReliablePayload;\n    },\n  ): Promise<void> {\n    await this._signalManager.sendMessage(ctx, {\n      author,\n      recipient,\n      payload: {\n        type_url: 'dxos.mesh.messaging.ReliablePayload',\n        value: ReliablePayload.encode(reliablePayload, { preserveAny: true }),\n      },\n    });\n  }\n\n  private async _handleMessage(message: Message): Promise<void> {\n    switch (message.payload.type_url) {\n      case 'dxos.mesh.messaging.ReliablePayload': {\n        await this._handleReliablePayload(message);\n        break;\n      }\n      case 'dxos.mesh.messaging.Acknowledgement': {\n        await this._handleAcknowledgement({ payload: message.payload });\n        break;\n      }\n    }\n  }\n\n  private async _handleReliablePayload(message: Message): Promise<void> {\n    const { author, recipient, payload } = message;\n    invariant(payload.type_url === 'dxos.mesh.messaging.ReliablePayload');\n    invariant(recipient, 'Recipient is required');\n    const reliablePayload: ReliablePayload = ReliablePayload.decode(payload.value, { preserveAny: true });\n\n    log('handling message', { messageId: reliablePayload.messageId });\n\n    try {\n      await this._sendAcknowledgement(this._ctx, {\n        author,\n        recipient,\n        messageId: reliablePayload.messageId,\n      });\n    } catch (err) {\n      this._monitor.recordMessageAckFailed();\n      throw err;\n    }\n\n    // Ignore message if it was already received, i.e. from multiple signal servers.\n    if (this._receivedMessages.has(reliablePayload.messageId!)) {\n      return;\n    }\n\n    this._receivedMessages.add(reliablePayload.messageId!);\n\n    await this._callListeners({\n      author,\n      recipient,\n      payload: reliablePayload.payload,\n    });\n  }\n\n  private async _handleAcknowledgement({ payload }: { payload: Any }): Promise<void> {\n    invariant(payload.type_url === 'dxos.mesh.messaging.Acknowledgement');\n    this._onAckCallbacks.get(Acknowledgement.decode(payload.value).messageId)?.();\n  }\n\n  private async _sendAcknowledgement(\n    ctx: Context,\n    {\n      author,\n      recipient,\n      messageId,\n    }: {\n      author: PeerInfo;\n      recipient: PeerInfo;\n      messageId: PublicKey;\n    },\n  ): Promise<void> {\n    log('sending ACK', { messageId, from: recipient, to: author });\n\n    await this._signalManager.sendMessage(ctx, {\n      author: recipient,\n      recipient: author,\n      payload: {\n        type_url: 'dxos.mesh.messaging.Acknowledgement',\n        value: Acknowledgement.encode({ messageId }),\n      },\n    });\n  }\n\n  private async _callListeners(message: Message): Promise<void> {\n    const { recipient } = message;\n    invariant(recipient?.peerKey, 'Peer key is required');\n    const peerKey = recipient.peerKey;\n    {\n      const defaultListenerMap = this._defaultListeners.get(peerKey);\n      if (defaultListenerMap) {\n        for (const listener of defaultListenerMap) {\n          await listener(message);\n        }\n      }\n    }\n\n    {\n      const listenerMap = this._listeners.get({\n        peerId: peerKey,\n        payloadType: message.payload.type_url,\n      });\n      if (listenerMap) {\n        for (const listener of listenerMap) {\n          await listener(message);\n        }\n      }\n    }\n  }\n\n  private _performGc(): void {\n    const start = performance.now();\n\n    for (const key of this._toClear.keys()) {\n      this._receivedMessages.delete(key);\n    }\n    this._toClear.clear();\n    for (const key of this._receivedMessages.keys()) {\n      this._toClear.add(key);\n    }\n\n    const elapsed = performance.now() - start;\n    if (elapsed > 100) {\n      log.warn('GC took too long', { elapsed });\n    }\n  }\n}\n\nexport interface ListeningHandle {\n  unsubscribe: () => Promise<void>;\n}\n","//\n// Copyright 2022 DXOS.org\n//\n\nimport { type Event } from '@dxos/async';\nimport { type Context } from '@dxos/context';\nimport { type Peer, type SwarmResponse } from '@dxos/protocols/proto/dxos/edge/messenger';\nimport {\n  type JoinRequest,\n  type LeaveRequest,\n  type Message,\n  type QueryRequest,\n  type SwarmEvent,\n} from '@dxos/protocols/proto/dxos/edge/signal';\nimport { type SignalState } from '@dxos/protocols/proto/dxos/mesh/signal';\n\nexport type { Message, SwarmEvent };\nexport type PeerInfo = Peer;\nexport const PeerInfoHash = ({ peerKey }: PeerInfo) => peerKey;\n\nexport type SignalStatus = {\n  host: string;\n  state: SignalState;\n  error?: string;\n  reconnectIn: number;\n  connectionStarted: Date;\n  lastStateChange: Date;\n};\n\n/**\n * Parameters for {@link SignalMethods.subscribeMessages}.\n */\nexport type SubscribeMessagesParams = {\n  /**\n   * The subscribing peer. Point-to-point messages addressed to this `peerKey` are delivered.\n   */\n  peer: PeerInfo;\n\n  /**\n   * OR-subscription tags (DX-1125). When provided, swarm broadcasts whose tags intersect this set are\n   * also delivered. Only meaningful for edge signaling; other transports ignore them.\n   */\n  tags?: string[];\n\n  /**\n   * Invoked for every message delivered to this subscription (point-to-point or matching broadcast).\n   */\n  onMessage: (message: Message) => void;\n};\n\n/**\n * Tears down a subscription created by {@link SignalMethods.subscribeMessages} and releases its\n * transport resources (edge tag registration / receive stream). The subscriber owns this lifecycle.\n */\nexport type UnsubscribeCallback = () => Promise<void>;\n\n/**\n * Message routing interface.\n */\nexport interface SignalMethods {\n  /**\n   * Emits when other peers join or leave the swarm.\n   * @deprecated\n   * TODO(mykola): Use swarmState in network-manager instead.\n   */\n  swarmEvent: Event<SwarmEvent>;\n\n  /**\n   * Emits when the swarm state changes.\n   */\n  swarmState?: Event<SwarmResponse>;\n\n  /**\n   * Join topic on signal network, to be discoverable by other peers.\n   */\n  join: (ctx: Context, params: JoinRequest) => Promise<void>;\n\n  /**\n   * Leave topic on signal network, to stop being discoverable by other peers.\n   */\n  leave: (ctx: Context, params: LeaveRequest) => Promise<void>;\n\n  /**\n   * Query peers in the swarm without joining it.\n   */\n  query: (ctx: Context, params: QueryRequest) => Promise<SwarmResponse>;\n\n  /**\n   * Send a message. Point-to-point when `recipient` is set; a swarm broadcast (DX-1125) when `tags`\n   * are set — fanned out to every peer whose tag subscription intersects, with the target swarm taken\n   * from `author.swarmKey`. Exactly one of `recipient` / `tags` must be present. Broadcasts are only\n   * supported by edge signaling.\n   */\n  sendMessage: (ctx: Context, message: Message) => Promise<void>;\n\n  /**\n   * Start receiving messages for `peer`: its point-to-point messages, plus — when `tags` are provided\n   * (DX-1125) — swarm broadcasts whose tags intersect. Matching messages are routed to\n   * `params.onMessage`; routing and the transport stream are owned here. Returns a callback that tears\n   * the subscription down; the subscriber owns that lifecycle.\n   */\n  subscribeMessages: (params: SubscribeMessagesParams) => Promise<UnsubscribeCallback>;\n}\n","//\n// Copyright 2020 DXOS.org\n//\n\nimport { Event, Trigger } from '@dxos/async';\nimport { type Any } from '@dxos/codec-protobuf';\nimport { Context } from '@dxos/context';\nimport { invariant } from '@dxos/invariant';\nimport { PublicKey } from '@dxos/keys';\nimport { log } from '@dxos/log';\nimport { schema } from '@dxos/protocols/proto';\nimport { type SwarmResponse } from '@dxos/protocols/proto/dxos/edge/messenger';\nimport { type QueryRequest } from '@dxos/protocols/proto/dxos/edge/signal';\nimport { ComplexMap, ComplexSet } from '@dxos/util';\n\nimport {\n  type Message,\n  type PeerInfo,\n  PeerInfoHash,\n  type SignalStatus,\n  type SubscribeMessagesParams,\n  type SwarmEvent,\n  type UnsubscribeCallback,\n} from '../signal-methods';\nimport { type SignalManager } from './signal-manager';\n\n/**\n * A single message subscription registered on a {@link MemorySignalManager} (DX-1125). Point-to-point\n * delivery matches `peerKey`; broadcast delivery matches any intersection with `tags`.\n */\ntype MessageSubscription = {\n  peerKey: string;\n  tags: Set<string>;\n  onMessage: (message: Message) => void;\n};\n\n/**\n * Common signaling context that connects multiple MemorySignalManager instances.\n */\nexport class MemorySignalManagerContext {\n  // Swarm messages.\n  readonly swarmEvent = new Event<SwarmEvent>();\n\n  // Mapping from topic to set of peers.\n  readonly swarms = new ComplexMap<PublicKey, ComplexSet<PeerInfo>>(PublicKey.hash);\n\n  // Map of connections for each peer for signaling.\n  readonly connections = new ComplexMap<PeerInfo, MemorySignalManager>(PeerInfoHash);\n}\n\n/**\n * In memory signal manager for testing.\n */\nexport class MemorySignalManager implements SignalManager {\n  readonly statusChanged = new Event<SignalStatus[]>();\n  readonly swarmEvent = new Event<SwarmEvent>();\n\n  /**\n   * Active message subscriptions on this manager. Routing is encapsulated here (DX-1125): a delivered\n   * message is dispatched to every subscription it matches.\n   */\n  private readonly _subscriptions = new Set<MessageSubscription>();\n\n  /**  Will be used to emit SwarmEvents on .open() and .close() */\n  private _joinedSwarms = new ComplexSet<{ topic: PublicKey; peer: PeerInfo }>(\n    ({ topic, peer }) => topic.toHex() + peer.peerKey,\n  );\n\n  private _ctx!: Context;\n\n  // TODO(dmaretskyi): Replace with callback.\n  private readonly _freezeTrigger = new Trigger().wake();\n\n  constructor(private readonly _context: MemorySignalManagerContext) {\n    this._ctx = new Context();\n\n    this._ctx.onDispose(this._context.swarmEvent.on((data) => this.swarmEvent.emit(data)));\n  }\n\n  async open(): Promise<void> {\n    if (!this._ctx.disposed) {\n      return;\n    }\n    this._ctx = new Context();\n    this._ctx.onDispose(this._context.swarmEvent.on((data) => this.swarmEvent.emit(data)));\n\n    await Promise.all([...this._joinedSwarms.values()].map((value) => this.join(this._ctx, value)));\n  }\n\n  async close(): Promise<void> {\n    if (this._ctx.disposed) {\n      return;\n    }\n    // save copy of joined swarms.\n    const joinedSwarmsCopy = new ComplexSet<{ topic: PublicKey; peer: PeerInfo }>(\n      ({ topic, peer }) => topic.toHex() + peer.peerKey,\n      [...this._joinedSwarms.values()],\n    );\n\n    await Promise.all([...this._joinedSwarms.values()].map((value) => this.leave(this._ctx, value)));\n\n    // assign joined swarms back because .leave() deletes it.\n    this._joinedSwarms = joinedSwarmsCopy;\n\n    await this._ctx.dispose();\n  }\n\n  getStatus(): SignalStatus[] {\n    return [];\n  }\n\n  async join(_ctx: Context, { topic, peer }: { topic: PublicKey; peer: PeerInfo }): Promise<void> {\n    invariant(!this._ctx.disposed, 'Closed');\n\n    this._joinedSwarms.add({ topic, peer });\n\n    if (!this._context.swarms.has(topic)) {\n      this._context.swarms.set(topic, new ComplexSet(PeerInfoHash));\n    }\n\n    this._context.swarms.get(topic)!.add(peer);\n    this._context.swarmEvent.emit({\n      topic,\n      peerAvailable: {\n        peer,\n        since: new Date(),\n      },\n    });\n\n    // Emitting swarm events for each peer.\n    for (const [topic, peers] of this._context.swarms) {\n      Array.from(peers).forEach((peer) => {\n        this.swarmEvent.emit({\n          topic,\n          peerAvailable: {\n            peer,\n            since: new Date(),\n          },\n        });\n      });\n    }\n  }\n\n  async leave(_ctx: Context, { topic, peer }: { topic: PublicKey; peer: PeerInfo }): Promise<void> {\n    invariant(!this._ctx.disposed, 'Closed');\n\n    this._joinedSwarms.delete({ topic, peer });\n\n    if (!this._context.swarms.has(topic)) {\n      this._context.swarms.set(topic, new ComplexSet(PeerInfoHash));\n    }\n\n    this._context.swarms.get(topic)!.delete(peer);\n\n    const swarmEvent: SwarmEvent = {\n      topic,\n      peerLeft: {\n        peer,\n      },\n    };\n\n    this._context.swarmEvent.emit(swarmEvent);\n  }\n\n  async query(_ctx: Context, request: QueryRequest): Promise<SwarmResponse> {\n    throw new Error('Not implemented');\n  }\n\n  async sendMessage(_ctx: Context, message: Message): Promise<void> {\n    invariant(!this._ctx.disposed, 'Closed');\n    const { author, recipient, tags, payload } = message;\n    // Exactly one of point-to-point (`recipient`) or broadcast (`tags`) delivery (DX-1125).\n    invariant((recipient == null) !== !tags?.length, 'Exactly one of `recipient` or `tags` must be set');\n\n    await this._freezeTrigger.wait();\n\n    if (recipient != null) {\n      log('send message', { author, recipient, ...dec(payload) });\n      const remote = this._context.connections.get(recipient);\n      if (!remote) {\n        log.warn('recipient is not subscribed for messages', { author, recipient });\n        return;\n      }\n      remote._deliver(message);\n    } else {\n      // Broadcast: fan out to every subscriber in the shared context whose tags intersect.\n      log('broadcast message', { author, tags, ...dec(payload) });\n      for (const manager of new Set(this._context.connections.values())) {\n        manager._deliver(message);\n      }\n    }\n  }\n\n  async subscribeMessages({ peer, tags = [], onMessage }: SubscribeMessagesParams): Promise<UnsubscribeCallback> {\n    invariant(!this._ctx.disposed, 'Closed');\n    log('subscribing', { peer, tags });\n    const subscription: MessageSubscription = { peerKey: peer.peerKey, tags: new Set(tags), onMessage };\n    this._subscriptions.add(subscription);\n    this._context.connections.set(peer, this);\n\n    return async () => {\n      log('unsubscribing', { peer, tags });\n      this._subscriptions.delete(subscription);\n      // Drop the shared-context connection entry only once no subscription for this peer remains.\n      if (![...this._subscriptions].some((sub) => sub.peerKey === peer.peerKey)) {\n        this._context.connections.delete(peer);\n      }\n    };\n  }\n\n  freeze(): void {\n    this._freezeTrigger.reset();\n  }\n\n  unfreeze(): void {\n    this._freezeTrigger.wake();\n  }\n\n  /**\n   * Route a delivered message to this manager's matching subscriptions once it is unfrozen and open.\n   */\n  private _deliver(message: Message): void {\n    if (this._ctx.disposed) {\n      log.warn('recipient is disposed', { message });\n      return;\n    }\n\n    this._freezeTrigger\n      .wait()\n      .then(() => {\n        if (this._ctx.disposed) {\n          log.warn('recipient is disposed', { message });\n          return;\n        }\n\n        log('receive message', { author: message.author, recipient: message.recipient, ...dec(message.payload) });\n        for (const subscription of this._subscriptions) {\n          if (message.recipient != null) {\n            if (subscription.peerKey === message.recipient.peerKey) {\n              subscription.onMessage(message);\n            }\n          } else if (message.tags?.some((tag) => subscription.tags.has(tag))) {\n            subscription.onMessage(message);\n          }\n        }\n      })\n      .catch((err) => {\n        log.error('error while waiting for freeze', { err });\n      });\n  }\n}\nconst dec = (payload: Any) => {\n  if (!payload.type_url.endsWith('ReliablePayload')) {\n    return {};\n  }\n\n  const relPayload = schema.getCodecForType('dxos.mesh.messaging.ReliablePayload').decode(payload.value);\n\n  if (typeof relPayload?.payload?.data === 'object') {\n    return { payload: Object.keys(relPayload?.payload?.data)[0], sessionId: relPayload?.payload?.sessionId };\n  }\n\n  return {};\n};\n"],"mappings":";;;;;;;;;;AAMA,IAAa,mBAAb,MAA8B;CAC5B,yBAAsC;EACpC,MAAM,QAAQ,UAAU,yCAAyC,CAAC;CACpE;CAEA,sBAA6B,QAAuD;EAClF,MAAM,QAAQ,UAAU,4CAA4C,GAAG,EACrE,MAAM;GACJ,SAAS,OAAO;GAChB,UAAU,OAAO;EACnB,EACF,CAAC;CACH;AACF;;;;;;ACZA,IAAa,kBAAkB;;;;ACoB/B,IAAM,kBAAkB,OAAO,gBAAgB,qCAAqC;AACpF,IAAM,kBAAkB,OAAO,gBAAgB,qCAAqC;AAEpF,IAAM,gCAAgC;;;;AAKtC,IAAa,YAAb,MAAuB;CACrB,WAA4B,IAAI,iBAAiB;CACjD;CAEA,aAA8B,IAAI,YAC/B,EAAE,QAAQ,kBAAkB,SAAS,WACxC;CAGA,oCAAqC,IAAI,IAA4B;CAErE,kBAAmC,IAAI,WAAkC,UAAU,IAAI;CAEvF,oBAAqC,IAAI,WAAsB,UAAU,IAAI;;;;CAK7E,WAA4B,IAAI,WAAsB,UAAU,IAAI;CAEpE;CACA,UAAkB;CAClB;CAEA,YAAY,EAAE,eAAe,aAAa,OAA0B;EAClE,KAAK,iBAAiB;EACtB,KAAK,cAAc;EAEnB,KAAK,KAA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