{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "subagent",
  "title": "Subagent",
  "description": "A subagent's run: its own steps, a Stop button and its result.",
  "dependencies": [
    "@kind-ui/agent-ui@0.9.0",
    "@ui-sdk/core@0.1.0-beta.17",
    "@ui-sdk/react@0.1.0-beta.17"
  ],
  "registryDependencies": [
    "@kind-ui/agent-ui-setup",
    "@kind-ui/markdown"
  ],
  "files": [
    {
      "path": "packages/agent-ui/src/react/subagent.tsx",
      "content": "\"use client\";\n\nimport { subagentPrimitive } from \"@kind-ui/agent-ui/core\";\nimport { Avatar, AvatarImage } from \"@ui-sdk/react/avatar\";\nimport { createParts } from \"@ui-sdk/react/primitive\";\nimport type { ComponentProps, ReactNode } from \"react\";\nimport { Markdown } from \"./markdown\";\n\nconst parts = createParts(subagentPrimitive, {\n  root: \"div\",\n  trigger: \"button\",\n  avatar: \"span\",\n  icon: \"span\",\n  title: \"span\",\n  meta: \"span\",\n  content: \"div\",\n  children: \"div\",\n  cancel: \"button\",\n  result: \"div\",\n});\n\nexport type SubagentProps = Omit<ComponentProps<typeof parts.Root>, \"children\"> & {\n  /** The subagent's own steps, like a `StepList` of `Tool`s. */\n  children?: ReactNode;\n};\n\n/**\n * A subagent's run: its status, name and avatar, then its own steps, a Stop button while `onCancel` is set, and\n * its `result` once complete. Its `children` are the steps; to arrange the parts yourself, use `SubagentRoot`.\n */\nexport function Subagent({ children, ...props }: SubagentProps) {\n  return (\n    <parts.Root {...props}>\n      {DEFAULT_TRIGGER}\n      <SubagentContent>\n        <SubagentChildren>{children}</SubagentChildren>\n      </SubagentContent>\n      {DEFAULT_END}\n    </parts.Root>\n  );\n}\n\n/** The bare root, for arranging the parts yourself. */\nexport const SubagentRoot = parts.Root;\nexport const SubagentTrigger = parts.Trigger;\nexport const SubagentIcon = parts.Icon;\nexport const SubagentContent = parts.Content;\nexport const SubagentChildren = parts.Children;\n\nexport type SubagentAvatarProps = ComponentProps<typeof parts.Avatar>;\n\n/** A UI SDK Avatar of `avatarSrc`, unless you pass children. Rendered only with an `avatarSrc`. */\nexport function SubagentAvatar({\n  children = ({ src }) => (\n    <Avatar>\n      <AvatarImage src={src} alt=\"\" />\n    </Avatar>\n  ),\n  ...props\n}: SubagentAvatarProps) {\n  return <parts.Avatar {...props}>{children}</parts.Avatar>;\n}\n\nexport type SubagentTitleProps = ComponentProps<typeof parts.Title>;\n\n/** The `label`, else the `agentName`, unless you pass children. */\nexport function SubagentTitle({ children = ({ title }) => title, ...props }: SubagentTitleProps) {\n  return <parts.Title {...props}>{children}</parts.Title>;\n}\n\nexport type SubagentMetaProps = ComponentProps<typeof parts.Meta>;\n\n/** The status in words, like \"Working\" or \"Done in 12 s\", unless you pass children. */\nexport function SubagentMeta({ children = ({ label }) => label, ...props }: SubagentMetaProps) {\n  return <parts.Meta {...props}>{children}</parts.Meta>;\n}\n\nexport type SubagentCancelProps = ComponentProps<typeof parts.Cancel>;\n\n/** Calls `onCancel`. Reads \"Stop\" unless you pass children. Rendered only while the subagent can be stopped. */\nexport function SubagentCancel({ children = DEFAULT_CANCEL, ...props }: SubagentCancelProps) {\n  return <parts.Cancel {...props}>{children}</parts.Cancel>;\n}\n\nexport type SubagentResultProps = ComponentProps<typeof parts.Result>;\n\n/** The `result` as markdown, unless you pass children. Rendered only once the status is `complete`. */\nexport function SubagentResult({\n  children = ({ result }) => (result ? <Markdown source={result} /> : null),\n  ...props\n}: SubagentResultProps) {\n  return <parts.Result {...props}>{children}</parts.Result>;\n}\n\n// Shared, so an update doesn't render the default parts' wrappers again.\nconst DEFAULT_TRIGGER = (\n  <SubagentTrigger>\n    <SubagentIcon />\n    <SubagentAvatar />\n    <SubagentTitle />\n    <SubagentMeta />\n  </SubagentTrigger>\n);\n\nconst DEFAULT_CANCEL = (\n  <>\n    <span data-kind-pending-mark=\"\" data-status-mark=\"\" data-status=\"running\" aria-hidden=\"true\" />\n    Stop\n  </>\n);\n\nconst DEFAULT_END = (\n  <>\n    <SubagentCancel />\n    <SubagentResult />\n  </>\n);\n",
      "type": "registry:ui",
      "target": "@ui/subagent.tsx"
    }
  ],
  "meta": {
    "layer": "react"
  },
  "type": "registry:ui"
}
