{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "chat-model",
  "type": "registry:lib",
  "title": "Conversation data",
  "description": "Provider-independent typed messages, parts, files and responses.",
  "dependencies": [],
  "registryDependencies": [],
  "files": [
    {
      "path": "src/components/ui/chat-model.ts",
      "type": "registry:component",
      "target": "@ui/chat-model.ts",
      "content": "/**\n * Provider-independent data contracts for conversational UI.\n *\n * This file is intentionally pure TypeScript. It has no React, SDK, runtime,\n * transport, or network dependency so callers can use the contracts in\n * server-side data preparation and optional adapters.\n */\n\nexport type ChatActor = \"user\" | \"assistant\" | \"system\";\n\nexport interface ChatAuthor {\n  id?: string;\n  name?: string;\n  avatarUrl?: string;\n  kind?: \"human\" | \"agent\";\n  provider?: { id?: string; name?: string; iconUrl?: string };\n}\n\nexport interface ChatDeliveryReceipt {\n  readonly id: string;\n  readonly name: string;\n  readonly avatarUrl?: string;\n  readonly initials?: string;\n  readonly sentAt?: Date | string;\n  readonly deliveredAt?: Date | string;\n  readonly readAt?: Date | string;\n}\n\nexport interface ChatDelivery {\n  readonly status: \"delivered\" | \"read\";\n  readonly recipients: readonly ChatDeliveryReceipt[];\n}\n\nexport type MessageStatus = \"queued\" | \"streaming\" | \"complete\" | \"stopped\" | \"error\";\n\nexport interface AttachmentFile {\n  id: string;\n  name: string;\n  mediaType?: string;\n  size?: number;\n  url?: string;\n  status?: \"ready\" | \"uploading\" | \"error\" | \"cancelled\";\n  progress?: number;\n  error?: string;\n}\n\nexport interface ComposerSubmission {\n  text: string;\n  attachments: readonly AttachmentFile[];\n}\n\nexport type ActivityState = \"pending\" | \"active\" | \"complete\" | \"error\" | \"cancelled\";\n\nexport interface ActivityEvent {\n  id: string;\n  kind: string;\n  state: ActivityState;\n  label: string;\n  /** Adverbial detail beside the title: a count, duration, result, impact, outcome or progress. */\n  meta?: string;\n  description?: string;\n  /** Ordered child operations; runtime data stays independent of React glyphs. */\n  children?: readonly ActivityEvent[];\n  progress?: {\n    value?: number;\n    max?: number;\n  };\n}\n\nexport interface SourceRecord {\n  id: string;\n  type: \"url\" | \"document\";\n  title: string;\n  url?: string;\n  domain?: string;\n  snippet?: string;\n  author?: string;\n  publishedAt?: string;\n  /** Optional caller supplied connector metadata. No provider SDK is implied. */\n  connectorName?: string;\n  connectorType?: string;\n  mediaType?: string;\n  size?: number;\n  document?: {\n    name: string;\n    page?: number;\n    location?: string;\n  };\n}\n\nexport interface QuestionOption {\n  value: string;\n  label: string;\n  description?: string;\n  disabled?: boolean;\n}\n\n/** A typed answer that is not one of the declared option values. */\nexport interface QuestionCustomAnswer {\n  type: \"custom\";\n  /** Stable identity for this question's custom row. The text may change. */\n  id: string;\n  value: string;\n}\n\nexport type QuestionnaireCustomAnswer = QuestionCustomAnswer;\nexport type QuestionnaireAnswer = string | QuestionCustomAnswer;\n\nexport interface QuestionCustomDefinition {\n  placeholder?: string;\n  maxLength?: number;\n}\n\nexport type QuestionDefinition = {\n  id: string;\n  title: string;\n  description?: string;\n  required?: boolean;\n  kind: \"single\" | \"multiple\" | \"text\";\n  options?: readonly QuestionOption[];\n  placeholder?: string;\n  maxLength?: number;\n  minSelections?: number;\n  maxSelections?: number;\n  /** Adds an editable final row to a single- or multiple-choice question. */\n  custom?: boolean | QuestionCustomDefinition;\n};\n\nexport type QuestionnaireAnswers = Readonly<Record<string, QuestionnaireAnswer | readonly QuestionnaireAnswer[]>>;\n\nexport interface QuestionnaireResponse {\n  answers: QuestionnaireAnswers;\n  skipped: readonly string[];\n}\n\nexport interface InputRequestPart {\n  type: \"input-request\";\n  id: string;\n  revision: number;\n  kind: \"clarification\";\n  state: \"pending\" | \"submitting\" | \"resolved\" | \"cancelled\" | \"expired\";\n  title?: string;\n  description?: string;\n  questions: readonly QuestionDefinition[];\n  response?: QuestionnaireResponse;\n  error?: string;\n}\n\nexport interface ToolPart {\n  type: \"tool\";\n  id: string;\n  name: string;\n  state:\n    | \"input-streaming\"\n    | \"input-ready\"\n    | \"approval-required\"\n    | \"approval-resolved\"\n    | \"running\"\n    | \"output-ready\"\n    | \"error\"\n    | \"cancelled\";\n  /** Approval decision metadata, separate from the tool execution lifecycle. */\n  approval?: {\n    id: string;\n    state: \"pending\" | \"approved\" | \"denied\";\n    reason?: string;\n    automatic?: boolean;\n  };\n  input?: unknown;\n  output?: unknown;\n  error?: string;\n}\n\nexport type ChatPart =\n  | { type: \"text\"; id?: string; text: string; state?: \"streaming\" | \"complete\" }\n  | ({ type: \"file\" } & AttachmentFile)\n  | { type: \"source\"; id: string; source: SourceRecord }\n  | { type: \"citation-anchor\"; id?: string; sourceIds: readonly string[]; label?: string }\n  | ToolPart\n  | {\n      type: \"reasoning-summary\";\n      id?: string;\n      text: string;\n      source: \"provider-summary\" | \"application-summary\";\n    }\n  | { type: \"activity\"; id: string; event: ActivityEvent }\n  | InputRequestPart\n  | { type: \"data\"; id?: string; name: string; data: unknown }\n  | { type: \"error\"; id?: string; message: string }\n  | { type: \"unknown\"; id?: string; originalType: string; value?: unknown };\n\nexport interface ChatMessage {\n  id: string;\n  actor: ChatActor;\n  createdAt?: Date | string;\n  author?: ChatAuthor;\n  delivery?: ChatDelivery;\n  parts: readonly ChatPart[];\n  status?: MessageStatus;\n  metadata?: Readonly<Record<string, unknown>>;\n}\n\nexport interface InputRequestController {\n  respond(requestId: string, revision: number, response: QuestionnaireResponse): Promise<void>;\n  cancel?(requestId: string): Promise<void>;\n  getCurrent?(requestId: string): InputRequestPart | undefined;\n}\n\nexport interface ChatController {\n  status: \"ready\" | \"submitting\" | \"streaming\" | \"error\";\n  error?: Error;\n  send(input: ComposerSubmission): void | Promise<void>;\n  stop?(): void | Promise<void>;\n  retry?(messageId?: string): void | Promise<void>;\n  editAndResubmit?(input: { messageId: string; text: string }): void | Promise<void>;\n  respondToToolApproval?(input: ChatToolApprovalResponse): void | Promise<void>;\n}\n\nexport interface ChatToolApprovalResponse {\n  messageId: string;\n  toolCallId: string;\n  approvalId: string;\n  approved: boolean;\n}\n"
    }
  ]
}
