prime = (generator, primer) => {
  // We capture the first returned promise.
  const first = generator.next(primer);
  /** @type {IteratorResult<TRead, TReturn>=} */
  let result;
  const primed = harden({
    /** @param {TWrite} value */
    async next(value) {
      if (result === undefined) {
        // eslint-disable-next-line @jessie.js/safe-await-separator
        result = await first;
        if (result.done) {
          return result;
        }
      }
      return generator.next(value);
    },
    /** @param {TReturn} value */
    async return(value) {
      if (result === undefined) {
        // eslint-disable-next-line @jessie.js/safe-await-separator
        result = await first;
        if (result.done) {
          return result;
        }
      }
      return generator.return(value);
    },
    /** @param {Error} error */
    async throw(error) {
      if (result === undefined) {
        // eslint-disable-next-line @jessie.js/safe-await-separator
        result = await first;
        if (result.done) {
          throw error;
        }
      }
      return generator.throw(error);
    },
  });
  return primed;
}
@template TRead
@template TWrite
@template TReturn
@param {AsyncGenerator<TRead, TReturn, TWrite>} generator
@param {TWrite} primer