{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "subagent-solid",
  "title": "Subagent (Solid)",
  "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/solid@0.1.0-beta.17"
  ],
  "registryDependencies": [
    "@kind-ui/agent-ui-setup",
    "@kind-ui/markdown-solid"
  ],
  "files": [
    {
      "path": "packages/agent-ui/src/solid/subagent.tsx",
      "content": "import { subagentPrimitive } from \"@kind-ui/agent-ui/core\";\nimport type { ComponentProps, JSX } from \"@solidjs/web\";\nimport { Avatar, AvatarImage } from \"@ui-sdk/solid/avatar\";\nimport { createParts } from \"@ui-sdk/solid/primitive\";\nimport { omit, Show } from \"solid-js\";\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?: JSX.Element;\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(props: SubagentProps) {\n  return (\n    <parts.Root {...omit(props, \"children\")}>\n      <SubagentTrigger>\n        <SubagentIcon />\n        <SubagentAvatar />\n        <SubagentTitle />\n        <SubagentMeta />\n      </SubagentTrigger>\n      <SubagentContent>\n        <SubagentChildren>{props.children}</SubagentChildren>\n      </SubagentContent>\n      <SubagentCancel />\n      <SubagentResult />\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(props: SubagentAvatarProps) {\n  return (\n    <parts.Avatar {...omit(props, \"children\")}>\n      {props.children ??\n        ((state: { src: string | undefined }) => (\n          <Avatar>\n            <AvatarImage src={state.src} alt=\"\" />\n          </Avatar>\n        ))}\n    </parts.Avatar>\n  );\n}\n\nexport type SubagentTitleProps = ComponentProps<typeof parts.Title>;\n\n/** The `label`, else the `agentName`, unless you pass children. */\nexport function SubagentTitle(props: SubagentTitleProps) {\n  return (\n    <parts.Title {...omit(props, \"children\")}>\n      {props.children ?? ((state: { title: string }) => state.title)}\n    </parts.Title>\n  );\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(props: SubagentMetaProps) {\n  return (\n    <parts.Meta {...omit(props, \"children\")}>\n      {props.children ?? ((state: { label: string }) => state.label)}\n    </parts.Meta>\n  );\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(props: SubagentCancelProps) {\n  return (\n    <parts.Cancel {...omit(props, \"children\")}>\n      {props.children ?? (\n        <>\n          <span data-kind-pending-mark=\"\" data-status-mark=\"\" data-status=\"running\" aria-hidden=\"true\" />\n          Stop\n        </>\n      )}\n    </parts.Cancel>\n  );\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(props: SubagentResultProps) {\n  return (\n    <parts.Result {...omit(props, \"children\")}>\n      {props.children ??\n        ((state: { result: string | undefined }) => (\n          <Show when={state.result}>{(result) => <Markdown source={result()} />}</Show>\n        ))}\n    </parts.Result>\n  );\n}\n",
      "type": "registry:ui",
      "target": "@ui/solid/subagent.tsx"
    }
  ],
  "meta": {
    "layer": "solid"
  },
  "type": "registry:ui"
}
