formulateInvitation = async (
    hostAgentId,
    hostHandleId,
    guestName,
    deferredTasks,
  ) => {
    const identifiers = await formulaGraphJobs.enqueue(async () => {
      const invitationNumber = await randomHex512();
      const invitationId = formatId({
        number: invitationNumber,
        node: localNodeId,
      });
      await deferredTasks.execute({
        invitationId,
      });
      return { invitationNumber };
    });

    /** @type {InvitationFormula} */
    const formula = {
      type: 'invitation',
      hostAgent: hostAgentId,
      hostHandle: hostHandleId,
      guestName,
    };

    return /** @type {FormulateResult<Invitation>} */ (
      formulate(identifiers.invitationNumber, formula)
    );
  }
@param {string} hostAgentId
@param {string} hostHandleId
@param {string} guestName
@param {DeferredTasks<InvitationDeferredTaskParams>} deferredTasks