{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "agent-response",
  "title": "AgentResponse",
  "description": "Ordered renderer for normalized immutable agent response parts or an application-composed response body inside a generic incoming message.",
  "type": "registry:ui",
  "meta": {
    "library": "@ds-mo/ui",
    "distribution": "npm",
    "storybook": "https://zainadeel.github.io/compomo/?path=/story/agent-response",
    "source": "src/wc/components/AgentResponse/AgentResponse.tsx",
    "intentStatus": "complete",
    "intent": {
      "audience": "specialized",
      "status": "experimental",
      "summary": "Ordered renderer for normalized immutable agent response parts or an application-composed response body inside a generic incoming message.",
      "useWhen": [
        "An agent response combines Markdown, user-safe activity, display-only tools, attachments, answered questionnaires, sources, or application-specific content in authored order."
      ],
      "avoidWhen": [
        "The component would be expected to own a model, transport, persistence, title generation, approval policy, or private reasoning."
      ],
      "commonlyComposedWith": [
        "component:ds-message",
        "component:ds-message-actions",
        "component:ds-markdown",
        "component:ds-agent-activity",
        "component:ds-agent-tool-call",
        "component:ds-agent-source-list",
        "component:ds-agent-questionnaire"
      ],
      "patterns": [
        "pattern:agent-chat"
      ],
      "accessibility": [
        "Part or composed-slot order matches authored reading order and remains inside generic message semantics.",
        "Streaming state supplements rather than replaces meaningful textual status.",
        "Forwarded metadata actions retain Message ordering, keyboard reveal, and touch visibility."
      ],
      "states": [
        "The owner replaces immutable part arrays as scripted or live output changes.",
        "Parts mode remains the compatibility default for serializable content; composed mode ignores parts and gives the default slot ownership of the complete ordered response body.",
        "AgentResponse renders directly in Message without borrowing a plain MessageBubble surface.",
        "Markdown parts use the optional safe renderer; the response sets the public prose text measure while code, tables, tools, sources, attachments, and other structured parts retain the full lane.",
        "The application may compose MessageActions for completed-response Copy and controlled feedback while retaining persistent retry or recovery controls in the separate actions slot."
      ],
      "responsiveBehavior": [
        "Direct prose blocks use a readable text measure within the available transcript width, while narrow lanes and structured content retain their available width and local overflow constraints."
      ],
      "references": [
        {
          "label": "Response modes and representative flow",
          "path": "src/wc/components/AgentResponse/AgentResponse.stories.ts"
        },
        {
          "label": "Prose distribution decision",
          "path": "docs/prose-foundation.md"
        }
      ]
    },
    "api": {
      "props": {
        "author": {
          "type": "string",
          "resolvedType": "string",
          "attribute": "author",
          "default": "''",
          "required": false,
          "mutable": false
        },
        "messageId": {
          "type": "string",
          "resolvedType": "string",
          "attribute": "message-id",
          "default": "''",
          "required": false,
          "mutable": false
        },
        "metadataVisibility": {
          "type": "MessageMetadataVisibility",
          "resolvedType": "\"always\" | \"hover\"",
          "attribute": "metadata-visibility",
          "default": "'always'",
          "required": false,
          "mutable": false,
          "description": "Controls whether the complete message metadata footer is persistent or revealed through hover/focus."
        },
        "parts": {
          "type": "AgentResponsePart[]",
          "resolvedType": "AgentResponsePart[]",
          "default": "[]",
          "required": false,
          "mutable": false
        },
        "renderMode": {
          "type": "AgentResponseRenderMode",
          "resolvedType": "\"composed\" | \"parts\"",
          "attribute": "render-mode",
          "default": "'parts'",
          "required": false,
          "mutable": false,
          "description": "Renders serializable ordered parts or lets the default slot own the complete ordered body."
        },
        "showAuthor": {
          "type": "boolean",
          "resolvedType": "boolean",
          "attribute": "show-author",
          "default": "true",
          "required": false,
          "mutable": false
        },
        "streaming": {
          "type": "boolean",
          "resolvedType": "boolean",
          "attribute": "streaming",
          "default": "false",
          "required": false,
          "mutable": false
        },
        "timestamp": {
          "type": "string",
          "resolvedType": "string",
          "attribute": "timestamp",
          "default": "''",
          "required": false,
          "mutable": false
        }
      },
      "events": [],
      "methods": [],
      "slots": []
    },
    "props": {
      "author": {
        "type": "string",
        "resolvedType": "string",
        "attribute": "author",
        "default": "''",
        "required": false,
        "mutable": false
      },
      "messageId": {
        "type": "string",
        "resolvedType": "string",
        "attribute": "message-id",
        "default": "''",
        "required": false,
        "mutable": false
      },
      "metadataVisibility": {
        "type": "MessageMetadataVisibility",
        "resolvedType": "\"always\" | \"hover\"",
        "attribute": "metadata-visibility",
        "default": "'always'",
        "required": false,
        "mutable": false,
        "description": "Controls whether the complete message metadata footer is persistent or revealed through hover/focus."
      },
      "parts": {
        "type": "AgentResponsePart[]",
        "resolvedType": "AgentResponsePart[]",
        "default": "[]",
        "required": false,
        "mutable": false
      },
      "renderMode": {
        "type": "AgentResponseRenderMode",
        "resolvedType": "\"composed\" | \"parts\"",
        "attribute": "render-mode",
        "default": "'parts'",
        "required": false,
        "mutable": false,
        "description": "Renders serializable ordered parts or lets the default slot own the complete ordered body."
      },
      "showAuthor": {
        "type": "boolean",
        "resolvedType": "boolean",
        "attribute": "show-author",
        "default": "true",
        "required": false,
        "mutable": false
      },
      "streaming": {
        "type": "boolean",
        "resolvedType": "boolean",
        "attribute": "streaming",
        "default": "false",
        "required": false,
        "mutable": false
      },
      "timestamp": {
        "type": "string",
        "resolvedType": "string",
        "attribute": "timestamp",
        "default": "''",
        "required": false,
        "mutable": false
      }
    },
    "events": [],
    "methods": [],
    "slots": [],
    "exports": {
      "customElement": "ds-agent-response",
      "react": "DsAgentResponse",
      "vue": "DsAgentResponse",
      "angular": "DsAgentResponse"
    },
    "consumption": {
      "install": "npm install @ds-mo/ui @ds-mo/tokens @ds-mo/icons",
      "cssSetup": "import '@ds-mo/tokens';\nimport '@ds-mo/tokens/reset';\nimport '@ds-mo/tokens/globals';",
      "customElements": {
        "import": "import '@ds-mo/ui/dist/components/ds-agent-response.js';",
        "example": "<ds-agent-response></ds-agent-response>"
      },
      "react": {
        "import": "import { DsAgentResponse } from '@ds-mo/ui/react';",
        "example": "<DsAgentResponse />"
      },
      "vue": {
        "import": "import { DsAgentResponse } from '@ds-mo/ui/vue';",
        "example": "<DsAgentResponse />"
      },
      "angular": {
        "import": "import { DsAgentResponse } from '@ds-mo/ui/angular/ds-agent-response';",
        "example": "<ds-agent-response></ds-agent-response>"
      },
      "complexPropertyNote": "Assign these non-primitive values as JavaScript properties: parts.",
      "peerDependencies": {
        "required": [
          "@ds-mo/tokens ^6.5.0",
          "@ds-mo/icons ^7.0.0"
        ],
        "frameworks": "Custom Elements; React 18/19 wrappers; Vue 3 wrappers; Angular 19-22 standalone adapters."
      }
    }
  },
  "dependencies": [
    "@ds-mo/ui",
    "@ds-mo/tokens"
  ],
  "registryDependencies": [
    "agent-activity",
    "agent-questionnaire",
    "agent-source-list",
    "agent-tool-call",
    "attachment-list",
    "markdown",
    "message"
  ],
  "files": [
    {
      "path": "src/wc/components/AgentResponse/AgentResponse.css",
      "content": ":host {\n  display: block;\n  width: 100%;\n  --ds-prose-text-max-inline-size: var(--dimension-panel-width-lg);\n  -webkit-user-select: none;\n  user-select: none;\n}\n.agent-response {\n  display: grid;\n  gap: var(--dimension-space-150);\n  min-width: 0;\n  width: 100%;\n  -webkit-user-select: none;\n  user-select: none;\n}\n",
      "type": "registry:ui"
    },
    {
      "path": "src/wc/components/AgentResponse/AgentResponse.tsx",
      "content": "import { Component, Prop, h, Host } from '@stencil/core';\nimport type {\n  AgentResponseRenderMode,\n  AgentResponsePart,\n  MessageMetadataVisibility,\n} from '../conversation-types';\n\n@Component({ tag: 'ds-agent-response', styleUrl: 'AgentResponse.css', scoped: true })\nexport class AgentResponse {\n  @Prop() messageId: string = '';\n  @Prop() author: string = '';\n  @Prop() showAuthor: boolean = true;\n  @Prop() timestamp: string = '';\n  @Prop() parts: AgentResponsePart[] = [];\n  /** Renders serializable ordered parts or lets the default slot own the complete ordered body. */\n  @Prop() renderMode: AgentResponseRenderMode = 'parts';\n  @Prop() streaming: boolean = false;\n  /** Controls whether the complete message metadata footer is persistent or revealed through hover/focus. */\n  @Prop() metadataVisibility: MessageMetadataVisibility = 'always';\n\n  private renderPart(part: AgentResponsePart) {\n    switch (part.type) {\n      case 'markdown':\n        return (\n          <ds-markdown\n            key={part.id}\n            content={part.content}\n            streaming={part.state === 'streaming'}\n          />\n        );\n      case 'activity':\n        return <ds-agent-activity key={part.id} items={part.items} />;\n      case 'tool':\n        return (\n          <ds-agent-tool-call\n            key={part.id}\n            name={part.name}\n            label={part.label}\n            state={part.state}\n            input={part.input}\n            output={part.output}\n            error={part.error}\n          />\n        );\n      case 'attachments':\n        return <ds-attachment-list key={part.id} items={part.items} />;\n      case 'sources':\n        return <ds-agent-source-list key={part.id} items={part.items} />;\n      case 'questionnaire':\n        return (\n          <ds-agent-questionnaire\n            key={part.id}\n            requestId={part.requestId}\n            questions={part.questions}\n            answers={part.answers}\n            status=\"answered\"\n          />\n        );\n    }\n  }\n\n  render() {\n    return (\n      <Host>\n        <ds-message\n          messageId={this.messageId}\n          direction=\"incoming\"\n          author={this.author}\n          showAuthor={this.showAuthor}\n          timestamp={this.timestamp}\n          streaming={this.streaming}\n          metadataVisibility={this.metadataVisibility}\n        >\n          <div class=\"agent-response\">\n            {this.renderMode === 'composed' ? (\n              <slot />\n            ) : (\n              this.parts.map(part => this.renderPart(part))\n            )}\n          </div>\n          <slot name=\"footer\" slot=\"footer\" />\n          <slot name=\"metadata-actions\" slot=\"metadata-actions\" />\n          <slot name=\"actions\" slot=\"actions\" />\n        </ds-message>\n      </Host>\n    );\n  }\n}\n",
      "type": "registry:ui"
    }
  ]
}
