write(role, content) {
    if (this.messages.length >= MAX_MESSAGES || this.tokenCount >= MAX_TOKENS) {
      this.messages.shift();
    }
    this.messages.push(new Message({ role, content: addMark(content) }));
    return this;
  }
@param {string} role
@param {string} content