import type { OutboundAttachment } from '../../channels/types.js';

/**
 * Collects outbound attachments during a tool execution cycle.
 * Tools can push attachments here, and they'll be included in the reply.
 */
export class OutboundAttachmentCollector {
  private _attachments: OutboundAttachment[] = [];

  /** Queue an attachment for inclusion in the next outbound message. */
  push(attachment: OutboundAttachment): void {
    this._attachments.push(attachment);
  }

  /** Remove and return all queued attachments. */
  drain(): OutboundAttachment[] {
    const result = [...this._attachments];
    this._attachments = [];
    return result;
  }

  /** Number of queued attachments. */
  get count(): number {
    return this._attachments.length;
  }
}
