//#region src/stream/message-metadata-tracker.d.ts
/**
 * Optimistic lifecycle status for a message that originated from a
 * local {@link StreamController.submit} before the server echoed it.
 *
 *   - `"pending"` — applied optimistically; the run is in flight and
 *     the server has not yet echoed this id in a `values` snapshot.
 *   - `"sent"`    — the server echoed the id (run progressed); the
 *     message is now server-authoritative.
 *   - `"failed"`  — the run failed before the id was echoed. The
 *     message is kept (so UIs can show it with a retry affordance) but
 *     is dropped on the next {@link StreamController.hydrate} because
 *     it was never persisted server-side.
 *
 * Server-originated messages (history, streamed assistant turns) never
 * carry a status — `undefined` means "not optimistic".
 */
type OptimisticStatus = "pending" | "sent" | "failed";
/**
 * Metadata tracked per message id. Surfaced to applications via
 * `useMessageMetadata(stream, messageId)`.
 */
interface MessageMetadata {
  /**
   * Checkpoint id the message's *parent* was at when this message was
   * observed. Drives fork / edit flows
   * (`submit(input, { forkFrom: checkpointId })`).
   *
   * `undefined` when the message was observed without a paired
   * checkpoint envelope (e.g. before checkpoints rolled out, or when
   * the caller stripped them upstream).
   */
  readonly parentCheckpointId: string | undefined;
  /**
   * Optimistic lifecycle status, present only for messages applied
   * locally by an optimistic `submit()`. `undefined` for ordinary
   * server-originated messages. See {@link OptimisticStatus}.
   */
  readonly optimisticStatus?: OptimisticStatus;
}
/**
 * Read-only map exposed via {@link MessageMetadataTracker.store}.
 */
type MessageMetadataMap = ReadonlyMap<string, MessageMetadata>;
//#endregion
export { MessageMetadata, MessageMetadataMap };
//# sourceMappingURL=message-metadata-tracker.d.ts.map