{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "subagent-vue",
  "title": "Subagent (Vue)",
  "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/vue@0.1.0-beta.17"
  ],
  "registryDependencies": [
    "@kind-ui/agent-ui-setup",
    "@kind-ui/markdown-vue"
  ],
  "files": [
    {
      "path": "packages/agent-ui/src/vue/subagent.ts",
      "content": "import { subagentPrimitive } from \"@kind-ui/agent-ui/core\";\nimport { Avatar, AvatarImage } from \"@ui-sdk/vue/avatar\";\nimport { createParts } from \"@ui-sdk/vue/primitive\";\nimport { type Component, defineComponent, h, type Slot, type VNodeChild } from \"vue\";\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\n// A part whose default slot falls back to `fallback`, as React's default `children` do.\nconst withDefault = <State, Part extends Component = Component>(\n  part: Part,\n  name: string,\n  fallback: (scope: { state: State }) => VNodeChild,\n): Part =>\n  defineComponent({\n    name,\n    inheritAttrs: false,\n    setup(_, { attrs, slots }) {\n      return () => h(part as Component, attrs, { ...slots, default: slots.default ?? (fallback as Slot) });\n    },\n  }) as unknown as Part;\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\n/** A UI SDK Avatar of `avatarSrc`, unless you fill the slot. Rendered only with an `avatarSrc`. */\nexport const SubagentAvatar = withDefault<{ src: string | undefined }>(\n  parts.Avatar,\n  \"SubagentAvatar\",\n  ({ state }) => h(Avatar, null, () => h(AvatarImage, { src: state.src, alt: \"\" })),\n);\n\n/** The `label`, else the `agentName`, unless you fill the slot. */\nexport const SubagentTitle = withDefault<{ title: string }>(\n  parts.Title,\n  \"SubagentTitle\",\n  ({ state }) => state.title,\n);\n\n/** The status in words, like \"Working\" or \"Done in 12 s\", unless you fill the slot. */\nexport const SubagentMeta = withDefault<{ label: string }>(\n  parts.Meta,\n  \"SubagentMeta\",\n  ({ state }) => state.label,\n);\n\n/** Calls `onCancel`. Reads \"Stop\" unless you fill the slot. Rendered only while the subagent can be stopped. */\nexport const SubagentCancel = withDefault(parts.Cancel, \"SubagentCancel\", () => [\n  h(\"span\", {\n    \"data-kind-pending-mark\": \"\",\n    \"data-status-mark\": \"\",\n    \"data-status\": \"running\",\n    \"aria-hidden\": \"true\",\n  }),\n  \"Stop\",\n]);\n\n/** The `result` as markdown, unless you fill the slot. Rendered only once the status is `complete`. */\nexport const SubagentResult = withDefault<{ result: string }>(parts.Result, \"SubagentResult\", ({ state }) =>\n  state.result ? h(Markdown, { source: state.result }) : null,\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 its\n * `result` once complete. Its default slot holds the steps, like a `StepList` of `Tool`s; to arrange the parts\n * yourself, use `SubagentRoot`.\n */\nexport const Subagent = defineComponent({\n  name: \"Subagent\",\n  inheritAttrs: false,\n  setup(_, { attrs, slots }) {\n    return () =>\n      h(parts.Root, attrs, {\n        ...slots,\n        default: () => [\n          h(SubagentTrigger, null, () => [\n            h(SubagentIcon),\n            h(SubagentAvatar),\n            h(SubagentTitle),\n            h(SubagentMeta),\n          ]),\n          h(SubagentContent, null, () => h(SubagentChildren, null, () => slots.default?.())),\n          h(SubagentCancel),\n          h(SubagentResult),\n        ],\n      });\n  },\n});\n",
      "type": "registry:ui",
      "target": "@ui/vue/subagent.ts"
    }
  ],
  "meta": {
    "layer": "vue"
  },
  "type": "registry:ui"
}
