{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "console",
  "title": "Console",
  "description": "Workbench for debugging and testing Pipecat agents: connect flow, bot media, conversation and metrics, device and session info, and a live RTVI event stream, with a tabbed mobile layout.",
  "dependencies": [
    "@pipecat-ai/client-js@^1.14.0",
    "@pipecat-ai/client-react@^1.9.0",
    "lucide-react@^1.41.0",
    "react-resizable-panels@^4.12.3"
  ],
  "registryDependencies": [
    "alert",
    "button",
    "card",
    "drawer",
    "input",
    "popover",
    "resizable",
    "select",
    "spinner",
    "tabs",
    "tooltip",
    "@pipecat/audio-visualizer-bar",
    "@pipecat/bot-audio",
    "@pipecat/client-status",
    "@pipecat/connect-button",
    "@pipecat/conversation",
    "@pipecat/dtmf-keypad",
    "@pipecat/metrics",
    "@pipecat/session-info",
    "@pipecat/text-input",
    "@pipecat/use-pipecat-app",
    "@pipecat/use-pipecat-event-stream",
    "@pipecat/use-pipecat-metrics",
    "@pipecat/user-audio-control",
    "@pipecat/user-screen-control",
    "@pipecat/user-video-control"
  ],
  "files": [
    {
      "path": "src/blocks/console/console.tsx",
      "content": "\"use client\";\n\nimport type {\n  APIRequest,\n  Participant,\n  PipecatClient,\n  PipecatClientOptions,\n  TransportConnectionParams,\n  TransportState,\n} from \"@pipecat-ai/client-js\";\nimport { RTVIEvent } from \"@pipecat-ai/client-js\";\nimport {\n  PipecatClientProvider,\n  useConversationContext,\n  useRTVIClientEvent,\n} from \"@pipecat-ai/client-react\";\nimport {\n  BotIcon,\n  ChevronsLeftRightEllipsisIcon,\n  InfoIcon,\n  MessagesSquareIcon,\n  PanelLeftCloseIcon,\n  PanelRightCloseIcon,\n  XIcon,\n} from \"lucide-react\";\nimport * as React from \"react\";\nimport {\n  useDefaultLayout,\n  usePanelRef,\n  type LayoutStorage,\n} from \"react-resizable-panels\";\n\nimport { BotAudioOutput, unlockBotAudio } from \"@/components/pipecat/bot-audio\";\nimport { ConnectButton } from \"@/components/pipecat/connect-button\";\nimport { ConsoleBotAudioPanel } from \"@/components/pipecat/console/bot-audio-panel\";\nimport { ConsoleBotVideoPanel } from \"@/components/pipecat/console/bot-video-panel\";\nimport { SmallWebRTCCodecSetter } from \"@/components/pipecat/console/codec-setter\";\nimport { ConsoleConversationPanel } from \"@/components/pipecat/console/conversation-panel\";\nimport { ConsoleEventsPanel } from \"@/components/pipecat/console/events-panel\";\nimport { ConsoleInfoPanel } from \"@/components/pipecat/console/info-panel\";\nimport { ConsoleKeypadToggle } from \"@/components/pipecat/console/keypad-toggle\";\nimport { PipecatLogo } from \"@/components/pipecat/console/logo\";\nimport { useMinWidth } from \"@/components/pipecat/console/panel\";\nimport type { ConversationProps } from \"@/components/pipecat/conversation\";\nimport type { TextRenderMode } from \"@/components/pipecat/conversation-message\";\nimport type { DTMFKeypadMode } from \"@/components/pipecat/dtmf-keypad\";\nimport {\n  Alert,\n  AlertAction,\n  AlertDescription,\n  AlertTitle,\n} from \"@/components/ui/alert\";\nimport { Button } from \"@/components/ui/button\";\nimport {\n  ResizableHandle,\n  ResizablePanel,\n  ResizablePanelGroup,\n} from \"@/components/ui/resizable\";\nimport { Spinner } from \"@/components/ui/spinner\";\nimport { Tabs, TabsContent, TabsList, TabsTrigger } from \"@/components/ui/tabs\";\nimport {\n  Tooltip,\n  TooltipContent,\n  TooltipProvider,\n  TooltipTrigger,\n} from \"@/components/ui/tooltip\";\nimport {\n  usePipecatApp,\n  type UsePipecatAppReturn,\n} from \"@/hooks/use-pipecat-app\";\nimport { usePipecatEventStream } from \"@/hooks/use-pipecat-event-stream\";\nimport { usePipecatMetricValue } from \"@/hooks/use-pipecat-metrics\";\nimport type {\n  TransportFactory,\n  TransportOptions,\n  TransportType,\n} from \"@/lib/transports\";\nimport { cn } from \"@/lib/utils\";\n\n// Connection-URL helpers: resolve the URL the connect button will hit, for\n// its hover tooltip.\n\nfunction extractUrlFromOptions(options: unknown): string | undefined {\n  if (typeof options !== \"object\" || options === null) return undefined;\n  const record = options as Record<string, unknown>;\n  const requestParams = record.webrtcRequestParams;\n  if (typeof requestParams === \"object\" && requestParams !== null) {\n    const endpoint = (requestParams as Record<string, unknown>).endpoint;\n    if (typeof endpoint === \"string\") return endpoint;\n  }\n  if (typeof record.webrtcUrl === \"string\") return record.webrtcUrl;\n  if (typeof record.connectionUrl === \"string\") return record.connectionUrl;\n  return undefined;\n}\n\nfunction resolveUrl(url: string): string {\n  if (typeof window === \"undefined\") return url;\n  try {\n    return new URL(url, window.location.origin).toString();\n  } catch {\n    return url;\n  }\n}\n\nfunction getConnectionUrl(\n  startBotParams?: APIRequest,\n  connectParams?: unknown,\n  transportOptions?: unknown,\n): string | undefined {\n  const candidate =\n    (typeof startBotParams?.endpoint === \"string\" && startBotParams.endpoint) ||\n    extractUrlFromOptions(connectParams) ||\n    extractUrlFromOptions(transportOptions);\n  return candidate ? resolveUrl(candidate) : undefined;\n}\n\n// The metrics tab and the mobile events tab unmount while inactive. These keep\n// their shared stores collecting, so opening either shows the whole session.\nfunction MetricsCollector() {\n  usePipecatMetricValue(\"ttfb\");\n  return null;\n}\n\nfunction EventStreamCollector() {\n  usePipecatEventStream();\n  return null;\n}\n\n/** Inert storage handed to useDefaultLayout when persistence is off. */\nconst MEMORY_STORAGE: LayoutStorage = {\n  getItem: () => null,\n  setItem: () => {},\n} as LayoutStorage;\n\nexport interface ConsoleProps {\n  // -- Bootstrap (forwarded to usePipecatApp) --------------------------------\n  /** Transport backing the client (default \"smallwebrtc\"). Match it to transportFactory; codec and ICE handling depend on it. */\n  transportType?: TransportType;\n  /** Creates your installed transport. Read once; remount to change. Without it, the loader registered for transportType is used. */\n  transportFactory?: TransportFactory;\n  /** Constructor options for the selected transport. */\n  transportOptions?: TransportOptions;\n  /** Overrides merged into the PipecatClient constructor. */\n  clientOptions?: Partial<PipecatClientOptions>;\n  /** Connection params, or an APIRequest (with endpoint) for start-and-connect. */\n  connectParams?: TransportConnectionParams | APIRequest;\n  /** When set, connecting starts a bot via startBot() first. */\n  startBotParams?: APIRequest;\n  /** Transforms the startBot response before connecting. */\n  startBotResponseTransformer?: (\n    response: TransportConnectionParams,\n  ) => TransportConnectionParams | Promise<TransportConnectionParams>;\n  /** Connect automatically once the client is ready. Default false. */\n  connectOnMount?: boolean;\n  /** Initialize devices as soon as the client exists. Default true. */\n  initDevicesOnMount?: boolean;\n  /** Fired once per created client, before device init or connect. */\n  onClient?: (client: PipecatClient) => void;\n\n  // -- Header ---------------------------------------------------------------\n  /** Header title (default \"Pipecat Console\"); hidden on narrow viewports. */\n  titleText?: string;\n  /** Replaces the Pipecat logo. */\n  logo?: React.ReactNode;\n  /** Hides the logo entirely. Default false. */\n  noLogo?: boolean;\n  /**\n   * Extra header content rendered before the connect button — e.g. your\n   * app's theme toggle. Rendered only when provided.\n   */\n  headerSlot?: React.ReactNode;\n\n  // -- Region toggles (all default false unless noted) -----------------------\n  noUserAudio?: boolean;\n  noUserVideo?: boolean;\n  noScreenControl?: boolean;\n  /** Hides the DTMF keypad button. */\n  noDTMF?: boolean;\n  /** Hides the text input under the transcript. */\n  noTextInput?: boolean;\n  /** Disables bot audio playback entirely (also hides its volume control). */\n  noAudioOutput?: boolean;\n  /** Hides the bot audio pane. */\n  noBotAudio?: boolean;\n  /** Hides the volume control in the bot audio pane header. */\n  noBotAudioControls?: boolean;\n  /** Hides the bot video pane. Default false. */\n  noBotVideo?: boolean;\n  noConversation?: boolean;\n  noMetrics?: boolean;\n  /** Hides the events strip. */\n  noEvents?: boolean;\n  noStatusInfo?: boolean;\n  noSessionInfo?: boolean;\n\n  // -- Behavior --------------------------------------------------------------\n  /** How the DTMF keypad dispatches presses (default \"buffered\"). */\n  keypadMode?: DTMFKeypadMode;\n  /** Seeds the transcript render mode (default \"karaoke\"). */\n  textRenderMode?: TextRenderMode;\n  /** Hides the render-mode select. Default false. */\n  noTextRenderModeSwitch?: boolean;\n  /** Overrides merged onto the Conversation (labels, renderers, …). */\n  conversationProps?: Partial<ConversationProps>;\n  /** Preferred audio codec (smallwebrtc only). */\n  audioCodec?: string;\n  /** Preferred video codec (smallwebrtc only). */\n  videoCodec?: string;\n  /** Start with the info pane collapsed. Default false. */\n  collapseInfoPanel?: boolean;\n  /** Start with the bot media pane collapsed. Default false. */\n  collapseMediaPanel?: boolean;\n  /** Start with the events strip collapsed. Default false. */\n  collapseEventsPanel?: boolean;\n  /**\n   * Persist the resizable layout under this key (localStorage). Off when\n   * unset.\n   */\n  layoutPersistenceKey?: string;\n\n  // -- Callbacks -------------------------------------------------------------\n  /** Fired on every transport state change. */\n  onConnectionStateChange?: (state: TransportState) => void;\n  /** Fired for RTVI server messages. */\n  onServerMessage?: (data: unknown) => void;\n  /** Hands you the transcript's injectMessage function once available. */\n  onInjectMessage?: (\n    inject: ReturnType<typeof useConversationContext>[\"injectMessage\"],\n  ) => void;\n\n  className?: string;\n}\n\n/**\n * Full-page Pipecat debugging console: header with connect flow, resizable\n * bot-media / conversation+metrics / info panes over an events strip, and a\n * single-tree mobile layout using bottom tabs.\n *\n * The console builds its own client via usePipecatApp and renders its own\n * PipecatClientProvider — do not nest it inside another provider. Supply\n * the transport with `transportFactory` or `registerTransport`; load\n * failures surface in the error banner.\n */\nexport function Console(props: ConsoleProps) {\n  const {\n    transportType = \"smallwebrtc\",\n    transportFactory,\n    transportOptions,\n    clientOptions,\n    connectParams,\n    startBotParams,\n    startBotResponseTransformer,\n    connectOnMount = false,\n    initDevicesOnMount = true,\n    onClient,\n    className,\n  } = props;\n\n  const app = usePipecatApp({\n    transportType,\n    transportFactory,\n    transportOptions,\n    clientOptions,\n    connectParams,\n    startBotParams,\n    startBotResponseTransformer,\n    connectOnMount,\n    initDevicesOnMount,\n    onClient,\n  });\n\n  if (!app.client) {\n    return (\n      <div\n        data-slot=\"console\"\n        data-state={app.error ? \"error\" : \"loading\"}\n        className={cn(\n          \"bg-background flex h-full min-h-64 items-center justify-center p-4\",\n          className,\n        )}\n      >\n        {app.error ? (\n          <Alert variant=\"destructive\" className=\"max-w-lg\">\n            <AlertTitle>Failed to start the console</AlertTitle>\n            <AlertDescription>{app.error}</AlertDescription>\n          </Alert>\n        ) : (\n          <Spinner className=\"size-6\" />\n        )}\n      </div>\n    );\n  }\n\n  return (\n    <PipecatClientProvider client={app.client}>\n      <TooltipProvider>\n        <ConsoleShell {...props} app={app} />\n      </TooltipProvider>\n      {!props.noAudioOutput && <BotAudioOutput />}\n      {!props.noMetrics && <MetricsCollector />}\n      {!props.noEvents && <EventStreamCollector />}\n      {transportType === \"smallwebrtc\" && (\n        <SmallWebRTCCodecSetter\n          audioCodec={props.audioCodec}\n          videoCodec={props.videoCodec}\n        />\n      )}\n    </PipecatClientProvider>\n  );\n}\n\nfunction ConsoleShell({\n  app,\n  transportOptions,\n  connectParams,\n  startBotParams,\n  titleText = \"Pipecat Console\",\n  logo,\n  noLogo = false,\n  headerSlot,\n  noUserAudio = false,\n  noUserVideo = false,\n  noScreenControl = false,\n  noDTMF = false,\n  noTextInput = false,\n  noAudioOutput = false,\n  noBotAudio = false,\n  noBotAudioControls = false,\n  noBotVideo = false,\n  noConversation = false,\n  noMetrics = false,\n  noEvents = false,\n  noStatusInfo = false,\n  noSessionInfo = false,\n  keypadMode = \"buffered\",\n  textRenderMode,\n  noTextRenderModeSwitch = false,\n  conversationProps,\n  collapseInfoPanel = false,\n  collapseMediaPanel = false,\n  collapseEventsPanel = false,\n  layoutPersistenceKey,\n  onConnectionStateChange,\n  onServerMessage,\n  onInjectMessage,\n  className,\n}: ConsoleProps & { app: UsePipecatAppReturn }) {\n  // Three resizable columns need about 1024px; narrower screens get tabs.\n  const isDesktop = useMinWidth(1024);\n\n  // -- Session facts collected from RTVI events ------------------------------\n  const [participantId, setParticipantId] = React.useState<string>();\n  const [sessionId, setSessionId] = React.useState<string>();\n\n  useRTVIClientEvent(\n    RTVIEvent.ParticipantConnected,\n    React.useCallback((participant: Participant) => {\n      if (participant.local) setParticipantId(participant.id);\n    }, []),\n  );\n  // Belt and braces for transports that never fire ParticipantConnected.\n  useRTVIClientEvent(\n    RTVIEvent.TrackStarted,\n    React.useCallback((_track: MediaStreamTrack, participant?: Participant) => {\n      if (participant?.local && participant.id) {\n        setParticipantId(participant.id);\n      }\n    }, []),\n  );\n  useRTVIClientEvent(\n    RTVIEvent.BotStarted,\n    React.useCallback((response: unknown) => {\n      const id = (response as { sessionId?: string } | null)?.sessionId;\n      if (typeof id === \"string\") setSessionId(id);\n    }, []),\n  );\n\n  const onServerMessageRef = React.useRef(onServerMessage);\n  onServerMessageRef.current = onServerMessage;\n  useRTVIClientEvent(\n    RTVIEvent.ServerMessage,\n    React.useCallback((data: unknown) => {\n      onServerMessageRef.current?.(data);\n    }, []),\n  );\n\n  const onConnectionStateChangeRef = React.useRef(onConnectionStateChange);\n  onConnectionStateChangeRef.current = onConnectionStateChange;\n  useRTVIClientEvent(\n    RTVIEvent.TransportStateChanged,\n    React.useCallback((state: TransportState) => {\n      onConnectionStateChangeRef.current?.(state);\n    }, []),\n  );\n\n  const { injectMessage } = useConversationContext();\n  const onInjectMessageRef = React.useRef(onInjectMessage);\n  onInjectMessageRef.current = onInjectMessage;\n  React.useEffect(() => {\n    onInjectMessageRef.current?.(injectMessage);\n  }, [injectMessage]);\n\n  // -- Region math -----------------------------------------------------------\n  const noBotArea = noBotAudio && noBotVideo;\n  const noConversationPanel = noConversation && noMetrics;\n  const noDevices = noUserAudio && noUserVideo && noScreenControl;\n  const noInfoPanel = noStatusInfo && noDevices && noSessionInfo;\n\n  // react-resizable-panels v4 reads bare numbers as pixels, so every size\n  // below is a percentage string. Conversation takes whatever the side panes\n  // leave so the horizontal defaults always sum to 100.\n  const mediaDefaultSize = noBotArea ? 0 : collapseMediaPanel ? 8 : 26;\n  const infoDefaultSize = noInfoPanel ? 0 : collapseInfoPanel ? 4 : 27;\n  const conversationDefaultSize = 100 - mediaDefaultSize - infoDefaultSize;\n\n  // -- Resizable layout state ------------------------------------------------\n  const persist = Boolean(layoutPersistenceKey);\n  const storage = persist ? undefined : MEMORY_STORAGE;\n  const verticalLayout = useDefaultLayout({\n    id: `${layoutPersistenceKey ?? \"pipecat-console\"}:v`,\n    storage,\n  });\n  const horizontalLayout = useDefaultLayout({\n    id: `${layoutPersistenceKey ?? \"pipecat-console\"}:h`,\n    storage,\n  });\n\n  const mediaPanelRef = usePanelRef();\n  const infoPanelRef = usePanelRef();\n  const eventsPanelRef = usePanelRef();\n  const [isMediaCollapsed, setIsMediaCollapsed] =\n    React.useState(collapseMediaPanel);\n  const [isInfoCollapsed, setIsInfoCollapsed] =\n    React.useState(collapseInfoPanel);\n  const [isEventsCollapsed, setIsEventsCollapsed] =\n    React.useState(collapseEventsPanel);\n\n  const connectionUrl = getConnectionUrl(\n    startBotParams,\n    connectParams,\n    transportOptions,\n  );\n\n  // -- Shared panel elements (instantiated once per render, one branch) ------\n  const mediaStack = (collapsed: boolean) =>\n    noBotArea ? null : (\n      <div className=\"flex h-full min-h-0 flex-col gap-2\">\n        {!noBotAudio && (\n          <ConsoleBotAudioPanel\n            collapsed={collapsed}\n            noControls={noBotAudioControls || noAudioOutput}\n            className={noBotVideo ? undefined : \"flex-1\"}\n          />\n        )}\n        {!noBotVideo && (\n          <ConsoleBotVideoPanel\n            collapsed={collapsed}\n            className={noBotAudio ? undefined : \"flex-1\"}\n          />\n        )}\n      </div>\n    );\n\n  const conversationPanel = noConversationPanel ? null : (\n    <ConsoleConversationPanel\n      noConversation={noConversation}\n      noMetrics={noMetrics}\n      noTextInput={noTextInput}\n      noTextRenderModeSwitch={noTextRenderModeSwitch}\n      textRenderMode={textRenderMode}\n      conversationProps={conversationProps}\n      className=\"h-full\"\n    />\n  );\n\n  const infoPanel = (collapsed: boolean) =>\n    noInfoPanel ? null : (\n      <ConsoleInfoPanel\n        noStatusInfo={noStatusInfo}\n        noUserAudio={noUserAudio}\n        noUserVideo={noUserVideo}\n        noScreenControl={noScreenControl}\n        noSessionInfo={noSessionInfo}\n        sessionId={sessionId}\n        participantId={participantId}\n        collapsed={collapsed}\n        className=\"h-full\"\n      />\n    );\n\n  const eventsPanel = (collapsed: boolean) =>\n    noEvents ? null : (\n      <ConsoleEventsPanel collapsed={collapsed} className=\"h-full\" />\n    );\n\n  const toggleInfoPanel = () => {\n    const handle = infoPanelRef.current;\n    if (!handle) return;\n    if (handle.isCollapsed()) handle.expand();\n    else handle.collapse();\n  };\n\n  const connectButton = (\n    <ConnectButton\n      size=\"sm\"\n      onConnect={() => {\n        unlockBotAudio();\n        void app.connect();\n      }}\n      onDisconnect={app.disconnect}\n    />\n  );\n\n  return (\n    <div\n      data-slot=\"console\"\n      data-state=\"ready\"\n      className={cn(\n        \"bg-background text-foreground flex h-full min-h-0 flex-col\",\n        className,\n      )}\n    >\n      <header\n        data-slot=\"console-header\"\n        className=\"flex items-center gap-2 border-b px-3 py-2\"\n      >\n        <div className=\"flex shrink-0 items-center\">\n          {noLogo ? (\n            <span className=\"h-6\" />\n          ) : (\n            (logo ?? <PipecatLogo height={20} />)\n          )}\n        </div>\n        <strong className=\"hidden min-w-0 truncate text-sm md:block\">\n          {titleText}\n        </strong>\n        <div className=\"ml-auto flex min-w-0 items-center justify-end gap-1\">\n          {/* Slot content may shrink; the console's own controls never do. */}\n          {headerSlot && (\n            <div className=\"flex min-w-0 items-center gap-1\">{headerSlot}</div>\n          )}\n          {!noDTMF && <ConsoleKeypadToggle mode={keypadMode} />}\n          {!noInfoPanel && (\n            <Button\n              variant=\"ghost\"\n              size=\"icon-sm\"\n              className=\"hidden lg:inline-flex\"\n              aria-label={\n                isInfoCollapsed ? \"Expand info panel\" : \"Collapse info panel\"\n              }\n              onClick={toggleInfoPanel}\n            >\n              {isInfoCollapsed ? (\n                <PanelLeftCloseIcon />\n              ) : (\n                <PanelRightCloseIcon />\n              )}\n            </Button>\n          )}\n          {connectionUrl ? (\n            <Tooltip>\n              <TooltipTrigger render={<span className=\"inline-flex\" />}>\n                {connectButton}\n              </TooltipTrigger>\n              <TooltipContent side=\"bottom\" align=\"end\">\n                {connectionUrl}\n              </TooltipContent>\n            </Tooltip>\n          ) : (\n            connectButton\n          )}\n        </div>\n      </header>\n\n      {app.error && (\n        <Alert\n          variant=\"destructive\"\n          className=\"animate-in fade-in m-2 duration-300\"\n        >\n          <AlertTitle>Session error</AlertTitle>\n          <AlertDescription>{app.error}</AlertDescription>\n          <AlertAction>\n            <Button\n              variant=\"ghost\"\n              size=\"icon-sm\"\n              aria-label=\"Dismiss error\"\n              onClick={app.clearError}\n            >\n              <XIcon />\n            </Button>\n          </AlertAction>\n        </Alert>\n      )}\n\n      <div className=\"min-h-0 flex-1 p-2\">\n        {isDesktop ? (\n          <ResizablePanelGroup\n            orientation=\"vertical\"\n            defaultLayout={verticalLayout.defaultLayout}\n            onLayoutChanged={verticalLayout.onLayoutChanged}\n            className=\"gap-2\"\n          >\n            <ResizablePanel id=\"main\" defaultSize=\"70%\" minSize=\"50%\">\n              <ResizablePanelGroup\n                orientation=\"horizontal\"\n                defaultLayout={horizontalLayout.defaultLayout}\n                onLayoutChanged={horizontalLayout.onLayoutChanged}\n                className=\"gap-2\"\n              >\n                {!noBotArea && (\n                  <ResizablePanel\n                    id=\"media\"\n                    defaultSize={`${mediaDefaultSize}%`}\n                    minSize=\"10%\"\n                    maxSize=\"30%\"\n                    collapsible\n                    collapsedSize=\"8%\"\n                    panelRef={mediaPanelRef}\n                    onResize={() =>\n                      setIsMediaCollapsed(\n                        mediaPanelRef.current?.isCollapsed() ?? false,\n                      )\n                    }\n                  >\n                    {/* p-px keeps each card's ring inside the panel's scroll box, which clips it. */}\n                    <div className=\"h-full p-px\">\n                      {mediaStack(isMediaCollapsed)}\n                    </div>\n                  </ResizablePanel>\n                )}\n                {!noBotArea && (!noConversationPanel || !noInfoPanel) && (\n                  <ResizableHandle withHandle />\n                )}\n                {!noConversationPanel && (\n                  <ResizablePanel\n                    id=\"conversation\"\n                    defaultSize={`${conversationDefaultSize}%`}\n                    minSize=\"30%\"\n                  >\n                    <div className=\"h-full p-px\">{conversationPanel}</div>\n                  </ResizablePanel>\n                )}\n                {!noConversationPanel && !noInfoPanel && (\n                  <ResizableHandle withHandle />\n                )}\n                {!noInfoPanel && (\n                  <ResizablePanel\n                    id=\"info\"\n                    defaultSize={`${infoDefaultSize}%`}\n                    minSize=\"15%\"\n                    collapsible\n                    collapsedSize=\"4%\"\n                    panelRef={infoPanelRef}\n                    onResize={() =>\n                      setIsInfoCollapsed(\n                        infoPanelRef.current?.isCollapsed() ?? false,\n                      )\n                    }\n                  >\n                    <div className=\"h-full p-px\">\n                      {infoPanel(isInfoCollapsed)}\n                    </div>\n                  </ResizablePanel>\n                )}\n              </ResizablePanelGroup>\n            </ResizablePanel>\n            {!noEvents && <ResizableHandle withHandle />}\n            {!noEvents && (\n              <ResizablePanel\n                id=\"events\"\n                defaultSize={collapseEventsPanel ? \"6%\" : \"30%\"}\n                minSize=\"7%\"\n                collapsible\n                collapsedSize=\"6%\"\n                panelRef={eventsPanelRef}\n                onResize={() =>\n                  setIsEventsCollapsed(\n                    eventsPanelRef.current?.isCollapsed() ?? false,\n                  )\n                }\n              >\n                <div className=\"h-full p-px\">\n                  {eventsPanel(isEventsCollapsed)}\n                </div>\n              </ResizablePanel>\n            )}\n          </ResizablePanelGroup>\n        ) : (\n          <Tabs\n            defaultValue={\n              !noConversationPanel\n                ? \"conversation\"\n                : !noBotArea\n                  ? \"bot\"\n                  : !noInfoPanel\n                    ? \"info\"\n                    : \"events\"\n            }\n            className=\"flex h-full min-h-0 flex-col\"\n          >\n            {!noBotArea && (\n              <TabsContent value=\"bot\" className=\"min-h-0 flex-1\">\n                {mediaStack(false)}\n              </TabsContent>\n            )}\n            {!noConversationPanel && (\n              <TabsContent\n                value=\"conversation\"\n                keepMounted\n                className=\"min-h-0 flex-1 data-[hidden]:hidden\"\n              >\n                {conversationPanel}\n              </TabsContent>\n            )}\n            {!noInfoPanel && (\n              <TabsContent value=\"info\" className=\"min-h-0 flex-1\">\n                {infoPanel(false)}\n              </TabsContent>\n            )}\n            {!noEvents && (\n              <TabsContent value=\"events\" className=\"min-h-0 flex-1\">\n                {eventsPanel(false)}\n              </TabsContent>\n            )}\n            <TabsList className=\"mt-2 w-full\">\n              {!noConversationPanel && (\n                <TabsTrigger value=\"conversation\" aria-label=\"Conversation\">\n                  <MessagesSquareIcon />\n                </TabsTrigger>\n              )}\n              {!noBotArea && (\n                <TabsTrigger value=\"bot\" aria-label=\"Bot media\">\n                  <BotIcon />\n                </TabsTrigger>\n              )}\n              {!noInfoPanel && (\n                <TabsTrigger value=\"info\" aria-label=\"Info\">\n                  <InfoIcon />\n                </TabsTrigger>\n              )}\n              {!noEvents && (\n                <TabsTrigger value=\"events\" aria-label=\"Events\">\n                  <ChevronsLeftRightEllipsisIcon />\n                </TabsTrigger>\n              )}\n            </TabsList>\n          </Tabs>\n        )}\n      </div>\n    </div>\n  );\n}\n",
      "type": "registry:block",
      "target": "components/pipecat/console/console.tsx"
    },
    {
      "path": "src/blocks/console/bot-audio-panel.tsx",
      "content": "\"use client\";\n\nimport { usePipecatClientMediaTrack } from \"@pipecat-ai/client-react\";\nimport { MicOffIcon } from \"lucide-react\";\nimport { AudioVisualizerBar } from \"@/components/pipecat/audio-visualizer-bar\";\nimport { BotAudioControl } from \"@/components/pipecat/bot-audio\";\nimport {\n  ConsolePanel,\n  ConsolePanelActions,\n  ConsolePanelContent,\n  ConsolePanelHeader,\n  ConsolePanelTitle,\n} from \"@/components/pipecat/console/panel\";\nimport { cn } from \"@/lib/utils\";\n\nexport interface ConsoleBotAudioPanelProps {\n  /** Compact rendering for a collapsed pane: no header, tighter bars. */\n  collapsed?: boolean;\n  /** Hides the volume control in the header. Default false. */\n  noControls?: boolean;\n  className?: string;\n}\n\n/**\n * Console pane visualizing the bot's audio track, with a volume control in\n * the header. Shows a quiet placeholder until a bot audio track exists.\n * Must be rendered inside a PipecatClientProvider.\n */\nexport function ConsoleBotAudioPanel({\n  collapsed = false,\n  noControls = false,\n  className,\n}: ConsoleBotAudioPanelProps) {\n  const track = usePipecatClientMediaTrack(\"audio\", \"bot\");\n\n  return (\n    <ConsolePanel\n      className={className}\n      data-slot=\"console-bot-audio-panel\"\n      data-state={collapsed ? \"collapsed\" : \"expanded\"}\n    >\n      {!collapsed && (\n        <ConsolePanelHeader>\n          <ConsolePanelTitle>Bot audio</ConsolePanelTitle>\n          {!noControls && (\n            <ConsolePanelActions>\n              <BotAudioControl size=\"icon-sm\" variant=\"ghost\" />\n            </ConsolePanelActions>\n          )}\n        </ConsolePanelHeader>\n      )}\n      <ConsolePanelContent className=\"text-agent-foreground flex items-center justify-center overflow-hidden\">\n        {track ? (\n          <AudioVisualizerBar\n            participantType=\"bot\"\n            barCount={collapsed ? 3 : 8}\n            barWidth={collapsed ? 4 : 8}\n            barGap={collapsed ? 3 : 6}\n            barMaxHeight={collapsed ? 32 : 96}\n            className={cn(\"w-auto\", collapsed && \"opacity-80\")}\n          />\n        ) : (\n          <div className=\"text-muted-foreground flex flex-col items-center gap-1 text-xs\">\n            <MicOffIcon className=\"size-4\" />\n            {!collapsed && <span>No audio</span>}\n          </div>\n        )}\n      </ConsolePanelContent>\n    </ConsolePanel>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/pipecat/console/bot-audio-panel.tsx"
    },
    {
      "path": "src/blocks/console/bot-video-panel.tsx",
      "content": "\"use client\";\n\nimport {\n  PipecatClientVideo,\n  usePipecatClientMediaTrack,\n} from \"@pipecat-ai/client-react\";\nimport { VideoOffIcon } from \"lucide-react\";\nimport {\n  ConsolePanel,\n  ConsolePanelContent,\n  ConsolePanelHeader,\n  ConsolePanelTitle,\n} from \"@/components/pipecat/console/panel\";\n\nexport interface ConsoleBotVideoPanelProps {\n  /** Compact rendering for a collapsed pane: no header. */\n  collapsed?: boolean;\n  className?: string;\n}\n\n/**\n * Console pane rendering the bot's video track, with a quiet placeholder\n * until one exists. Must be rendered inside a PipecatClientProvider.\n */\nexport function ConsoleBotVideoPanel({\n  collapsed = false,\n  className,\n}: ConsoleBotVideoPanelProps) {\n  const track = usePipecatClientMediaTrack(\"video\", \"bot\");\n\n  return (\n    <ConsolePanel\n      className={className}\n      data-slot=\"console-bot-video-panel\"\n      data-state={collapsed ? \"collapsed\" : \"expanded\"}\n    >\n      {!collapsed && (\n        <ConsolePanelHeader>\n          <ConsolePanelTitle>Bot video</ConsolePanelTitle>\n        </ConsolePanelHeader>\n      )}\n      <ConsolePanelContent className=\"flex items-center justify-center overflow-hidden\">\n        {track ? (\n          <PipecatClientVideo\n            participant=\"bot\"\n            fit=\"contain\"\n            className=\"h-full w-full rounded-md\"\n          />\n        ) : (\n          <div className=\"text-muted-foreground flex aspect-video w-full flex-col items-center justify-center gap-1 text-xs\">\n            <VideoOffIcon className=\"size-4\" />\n            {!collapsed && <span>No video</span>}\n          </div>\n        )}\n      </ConsolePanelContent>\n    </ConsolePanel>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/pipecat/console/bot-video-panel.tsx"
    },
    {
      "path": "src/blocks/console/codec-setter.tsx",
      "content": "\"use client\";\n\nimport { usePipecatClient } from \"@pipecat-ai/client-react\";\nimport { useEffect } from \"react\";\n\nexport interface SmallWebRTCCodecSetterProps {\n  /** Preferred audio codec, e.g. \"opus\". Default \"default\" (no override). */\n  audioCodec?: string;\n  /** Preferred video codec, e.g. \"VP8\". Default \"default\" (no override). */\n  videoCodec?: string;\n}\n\n/**\n * Headless helper that applies audio/video codec preferences to a\n * SmallWebRTC transport. Renders nothing; transports without codec setters\n * are left untouched, so it works whether the transport came from a factory\n * or a registered loader. Must be rendered inside a PipecatClientProvider.\n */\nexport function SmallWebRTCCodecSetter({\n  audioCodec = \"default\",\n  videoCodec = \"default\",\n}: SmallWebRTCCodecSetterProps) {\n  const client = usePipecatClient();\n\n  useEffect(() => {\n    // Structural check: the transport package's types can't be named here\n    // (transports are optional installs).\n    const transport = client?.transport as\n      | {\n          setAudioCodec?: (codec: string) => void;\n          setVideoCodec?: (codec: string) => void;\n        }\n      | undefined;\n    if (typeof transport?.setAudioCodec === \"function\") {\n      transport.setAudioCodec(audioCodec);\n    }\n    if (typeof transport?.setVideoCodec === \"function\") {\n      transport.setVideoCodec(videoCodec);\n    }\n  }, [audioCodec, client, videoCodec]);\n\n  return null;\n}\n",
      "type": "registry:component",
      "target": "components/pipecat/console/codec-setter.tsx"
    },
    {
      "path": "src/blocks/console/conversation-panel.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\n\nimport {\n  ConsolePanel,\n  ConsolePanelActions,\n  ConsolePanelContent,\n} from \"@/components/pipecat/console/panel\";\nimport {\n  Conversation,\n  type ConversationProps,\n} from \"@/components/pipecat/conversation\";\nimport type { TextRenderMode } from \"@/components/pipecat/conversation-message\";\nimport { Metrics } from \"@/components/pipecat/metrics/metrics\";\nimport { TextInput } from \"@/components/pipecat/text-input\";\nimport {\n  Select,\n  SelectContent,\n  SelectItem,\n  SelectTrigger,\n  SelectValue,\n} from \"@/components/ui/select\";\nimport { Tabs, TabsContent, TabsList, TabsTrigger } from \"@/components/ui/tabs\";\n\nconst RENDER_MODES: Array<{ value: TextRenderMode; label: string }> = [\n  { value: \"karaoke\", label: \"Karaoke\" },\n  { value: \"captions\", label: \"Captions\" },\n  { value: \"instant\", label: \"Instant\" },\n];\n\nexport interface ConsoleConversationPanelProps {\n  /** Hides the conversation tab. Default false. */\n  noConversation?: boolean;\n  /** Hides the metrics tab. Default false. */\n  noMetrics?: boolean;\n  /** Hides the text input under the transcript. Default false. */\n  noTextInput?: boolean;\n  /** Hides the render-mode select in the header. Default false. */\n  noTextRenderModeSwitch?: boolean;\n  /** Seeds (and can push) the transcript render mode. Default \"karaoke\". */\n  textRenderMode?: TextRenderMode;\n  /** Fired when the user picks a render mode in the header. */\n  onTextRenderModeChange?: (mode: TextRenderMode) => void;\n  /** Overrides merged onto the Conversation (labels, renderers, …). */\n  conversationProps?: Partial<ConversationProps>;\n  className?: string;\n}\n\n/**\n * Console center pane: the live transcript (with text input) and the\n * metrics dashboard as tabs. The conversation tab stays mounted so scroll\n * position survives tab switches; metrics re-reads its shared store. Must\n * be rendered inside a PipecatClientProvider.\n */\nexport function ConsoleConversationPanel({\n  noConversation = false,\n  noMetrics = false,\n  noTextInput = false,\n  noTextRenderModeSwitch = false,\n  textRenderMode,\n  onTextRenderModeChange,\n  conversationProps,\n  className,\n}: ConsoleConversationPanelProps) {\n  // Local selection seeded from the prop; a defined prop change pushes it.\n  const [renderMode, setRenderMode] = React.useState<TextRenderMode>(\n    textRenderMode ?? \"karaoke\",\n  );\n  React.useEffect(() => {\n    if (textRenderMode !== undefined) setRenderMode(textRenderMode);\n  }, [textRenderMode]);\n\n  if (noConversation && noMetrics) return null;\n\n  const handleRenderMode = (mode: TextRenderMode) => {\n    setRenderMode(mode);\n    onTextRenderModeChange?.(mode);\n  };\n\n  return (\n    <Tabs\n      defaultValue={noConversation ? \"metrics\" : \"conversation\"}\n      className={className}\n      data-slot=\"console-conversation-panel\"\n    >\n      <ConsolePanel>\n        <div className=\"flex items-center gap-2 border-b px-(--card-spacing) pb-(--card-spacing)\">\n          <TabsList>\n            {!noConversation && (\n              <TabsTrigger value=\"conversation\">Conversation</TabsTrigger>\n            )}\n            {!noMetrics && <TabsTrigger value=\"metrics\">Metrics</TabsTrigger>}\n          </TabsList>\n          {!noConversation && !noTextRenderModeSwitch && (\n            <ConsolePanelActions className=\"ml-auto\">\n              <Select\n                value={renderMode}\n                onValueChange={(value) =>\n                  handleRenderMode(value as TextRenderMode)\n                }\n              >\n                <SelectTrigger\n                  size=\"sm\"\n                  aria-label=\"Text render mode\"\n                  className=\"h-7 text-xs\"\n                >\n                  <SelectValue />\n                </SelectTrigger>\n                <SelectContent align=\"end\">\n                  {RENDER_MODES.map((mode) => (\n                    <SelectItem key={mode.value} value={mode.value}>\n                      {mode.label}\n                    </SelectItem>\n                  ))}\n                </SelectContent>\n              </Select>\n            </ConsolePanelActions>\n          )}\n        </div>\n        {!noConversation && (\n          <TabsContent\n            value=\"conversation\"\n            keepMounted\n            className=\"flex min-h-0 flex-1 flex-col data-[hidden]:hidden\"\n          >\n            <ConsolePanelContent>\n              <Conversation\n                textRenderMode={renderMode}\n                {...conversationProps}\n              />\n            </ConsolePanelContent>\n            {!noTextInput && (\n              <div className=\"border-t p-(--card-spacing)\">\n                <TextInput />\n              </div>\n            )}\n          </TabsContent>\n        )}\n        {!noMetrics && (\n          <TabsContent value=\"metrics\" className=\"min-h-0 flex-1\">\n            <ConsolePanelContent>\n              <Metrics />\n            </ConsolePanelContent>\n          </TabsContent>\n        )}\n      </ConsolePanel>\n    </Tabs>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/pipecat/console/conversation-panel.tsx"
    },
    {
      "path": "src/blocks/console/events-panel.tsx",
      "content": "\"use client\";\n\nimport { RTVIEvent, type BotOutputData } from \"@pipecat-ai/client-js\";\nimport { PauseIcon, PlayIcon, SearchIcon, Trash2Icon } from \"lucide-react\";\nimport * as React from \"react\";\n\nimport {\n  ConsolePanel,\n  ConsolePanelActions,\n  ConsolePanelContent,\n  ConsolePanelHeader,\n  ConsolePanelTitle,\n} from \"@/components/pipecat/console/panel\";\nimport { Button } from \"@/components/ui/button\";\nimport { Input } from \"@/components/ui/input\";\nimport {\n  usePipecatEventStream,\n  type PipecatEventLog,\n} from \"@/hooks/use-pipecat-event-stream\";\nimport { cn } from \"@/lib/utils\";\n\nconst TIME_FORMAT = new Intl.DateTimeFormat(undefined, {\n  hour12: false,\n  hour: \"2-digit\",\n  minute: \"2-digit\",\n  second: \"2-digit\",\n  fractionalSecondDigits: 3,\n});\n\nfunction summarizeBotOutput(data: Partial<BotOutputData>): string {\n  const spoken =\n    data.will_be_spoken === false\n      ? \"not spoken\"\n      : data.spoken_status !== undefined\n        ? `spoken: ${data.spoken_status}`\n        : data.spoken !== undefined\n          ? `spoken: ${data.spoken}`\n          : null;\n  const details = [\n    data.aggregated_by,\n    data.segment_id !== undefined ? `#${data.segment_id}` : null,\n    spoken,\n  ].filter(Boolean);\n  return `(${details.join(\", \")}): ${data.text ?? \"\"}`;\n}\n\nfunction summarize(event: PipecatEventLog): string {\n  const { data } = event;\n  if (data === undefined) return \"\";\n  if (event.type === RTVIEvent.BotOutput && typeof data === \"object\") {\n    return summarizeBotOutput(data as Partial<BotOutputData>);\n  }\n  try {\n    const json = JSON.stringify(data);\n    return json.length > 120 ? `${json.slice(0, 120)}…` : json;\n  } catch {\n    return String(data);\n  }\n}\n\n/** Chatter covered by botOutput rows and the metrics panel. */\nconst HIDDEN_EVENTS: string[] = [\n  RTVIEvent.Metrics,\n  RTVIEvent.BotTranscript,\n  RTVIEvent.BotLlmStarted,\n  RTVIEvent.BotLlmText,\n  RTVIEvent.BotLlmStopped,\n  RTVIEvent.BotTtsStarted,\n  RTVIEvent.BotTtsText,\n  RTVIEvent.BotTtsStopped,\n];\n\n/**\n * RTVI 2.0.0+ re-sends a segment's botOutput on every spoken progress update\n * (about once per TTS word). Keep one row per spoken status change, so an\n * interrupted segment shows as new/in-progress without a completed row. Keys\n * on segment_id, never text: separate responses can share wording.\n */\nfunction dropRepeatedBotOutput(\n  events: readonly PipecatEventLog[],\n): PipecatEventLog[] {\n  const statuses = new Map<number, string>();\n  return events.filter((event) => {\n    if (event.type !== RTVIEvent.BotOutput) return true;\n    const data = event.data as Partial<BotOutputData> | undefined;\n    if (data?.segment_id === undefined || data.spoken_status === undefined) {\n      return true;\n    }\n    if (statuses.get(data.segment_id) === data.spoken_status) return false;\n    statuses.set(data.segment_id, data.spoken_status);\n    return true;\n  });\n}\n\nfunction EventRow({ event }: { event: PipecatEventLog }) {\n  const [expanded, setExpanded] = React.useState(false);\n  const summary = summarize(event);\n  return (\n    <div data-slot=\"console-event\" className=\"font-mono text-xs\">\n      <button\n        type=\"button\"\n        onClick={() => setExpanded((value) => !value)}\n        className=\"hover:bg-muted/50 grid w-full grid-cols-[min-content_min-content_1fr] items-baseline gap-x-3 rounded-sm px-1 py-0.5 text-left\"\n        aria-expanded={expanded}\n      >\n        <span className=\"text-muted-foreground whitespace-nowrap\">\n          {TIME_FORMAT.format(event.timestamp)}\n        </span>\n        <span className=\"font-semibold whitespace-nowrap\">{event.type}</span>\n        <span className=\"text-muted-foreground truncate\">{summary}</span>\n      </button>\n      {expanded && event.data !== undefined && (\n        <pre className=\"bg-muted/50 my-1 ml-4 overflow-x-auto rounded-sm p-2\">\n          {JSON.stringify(event.data, null, 2)}\n        </pre>\n      )}\n    </div>\n  );\n}\n\nexport interface ConsoleEventsPanelProps {\n  /** Compact rendering for a collapsed pane: header strip only. */\n  collapsed?: boolean;\n  className?: string;\n}\n\n/**\n * Live RTVI event log over the shared use-pipecat-event-stream store:\n * filter-as-you-type, pause/resume, clear, click-to-expand payloads, and\n * scroll pinning that follows the tail until you scroll away. Metrics and bot\n * LLM/TTS events are hidden, and botOutput shows once per spoken status.\n * Capture is shared, so a collapsed panel misses nothing. Must be rendered\n * inside a PipecatClientProvider.\n */\nexport function ConsoleEventsPanel({\n  collapsed = false,\n  className,\n}: ConsoleEventsPanelProps) {\n  const { events, paused, setPaused, clear } = usePipecatEventStream({\n    ignoreEvents: HIDDEN_EVENTS,\n  });\n  const [filter, setFilter] = React.useState(\"\");\n\n  const filtered = React.useMemo(() => {\n    const needle = filter.trim().toLowerCase();\n    const shown = dropRepeatedBotOutput(events);\n    if (!needle) return shown;\n    return shown.filter((event) => event.type.toLowerCase().includes(needle));\n  }, [events, filter]);\n\n  // Scroll pinning: stick to the tail unless the user scrolled away.\n  const scrollRef = React.useRef<HTMLDivElement | null>(null);\n  const pinnedRef = React.useRef(true);\n  const handleScroll = React.useCallback(() => {\n    const el = scrollRef.current;\n    if (!el) return;\n    pinnedRef.current =\n      Math.ceil(el.scrollHeight - el.scrollTop) <=\n      Math.ceil(el.clientHeight) + 4;\n  }, []);\n  React.useEffect(() => {\n    const el = scrollRef.current;\n    if (el && pinnedRef.current) {\n      el.scrollTo({ top: el.scrollHeight, behavior: \"instant\" });\n    }\n  }, [filtered]);\n\n  return (\n    <ConsolePanel\n      className={className}\n      data-slot=\"console-events-panel\"\n      data-state={collapsed ? \"collapsed\" : \"expanded\"}\n    >\n      <ConsolePanelHeader>\n        <ConsolePanelTitle>Events</ConsolePanelTitle>\n        {!collapsed && (\n          <ConsolePanelActions>\n            <div className=\"relative hidden @xs/panel:block\">\n              <SearchIcon className=\"text-muted-foreground pointer-events-none absolute top-1/2 left-2 size-3.5 -translate-y-1/2\" />\n              <Input\n                value={filter}\n                onChange={(event) => setFilter(event.target.value)}\n                placeholder=\"Filter events\"\n                aria-label=\"Filter events\"\n                className=\"h-7 w-40 pl-7 text-xs\"\n              />\n            </div>\n            <Button\n              variant=\"ghost\"\n              size=\"icon-sm\"\n              aria-label={\n                paused ? \"Resume event capture\" : \"Pause event capture\"\n              }\n              aria-pressed={paused}\n              onClick={() => setPaused(!paused)}\n            >\n              {paused ? <PlayIcon /> : <PauseIcon />}\n            </Button>\n            <Button\n              variant=\"ghost\"\n              size=\"icon-sm\"\n              aria-label=\"Clear events\"\n              onClick={clear}\n            >\n              <Trash2Icon />\n            </Button>\n          </ConsolePanelActions>\n        )}\n      </ConsolePanelHeader>\n      {!collapsed && (\n        <ConsolePanelContent\n          ref={scrollRef}\n          onScroll={handleScroll}\n          className={cn(\"flex flex-col gap-0.5\")}\n        >\n          {filtered.length === 0 ? (\n            <div className=\"text-muted-foreground flex h-full min-h-16 items-center justify-center text-xs\">\n              {!filter.trim()\n                ? \"Events appear once a session is live.\"\n                : \"No events match the filter.\"}\n            </div>\n          ) : (\n            filtered.map((event) => <EventRow key={event.id} event={event} />)\n          )}\n        </ConsolePanelContent>\n      )}\n    </ConsolePanel>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/pipecat/console/events-panel.tsx"
    },
    {
      "path": "src/blocks/console/info-panel.tsx",
      "content": "\"use client\";\n\nimport { usePipecatClientCamControl } from \"@pipecat-ai/client-react\";\nimport { ChevronsLeftRightEllipsisIcon, InfoIcon, MicIcon } from \"lucide-react\";\nimport * as React from \"react\";\n\nimport { ClientStatus } from \"@/components/pipecat/client-status\";\nimport {\n  ConsolePanel,\n  ConsolePanelContent,\n  ConsolePanelTitle,\n} from \"@/components/pipecat/console/panel\";\nimport { SessionInfo } from \"@/components/pipecat/session-info\";\nimport { UserAudioControl } from \"@/components/pipecat/user-audio-control\";\nimport { UserScreenControl } from \"@/components/pipecat/user-screen-control\";\nimport { UserVideoControl } from \"@/components/pipecat/user-video-control\";\nimport { Button } from \"@/components/ui/button\";\nimport {\n  Popover,\n  PopoverContent,\n  PopoverTrigger,\n} from \"@/components/ui/popover\";\n\nexport interface ConsoleInfoPanelProps {\n  /** Hides the connection status section. Default false. */\n  noStatusInfo?: boolean;\n  /** Hides the microphone control. Default false. */\n  noUserAudio?: boolean;\n  /** Hides the camera control. Default false. */\n  noUserVideo?: boolean;\n  /** Hides the screen-share control. Default false. */\n  noScreenControl?: boolean;\n  /** Hides the session info section. Default false. */\n  noSessionInfo?: boolean;\n  /** Session id collected by the console shell (BotStarted). */\n  sessionId?: string;\n  /** Local participant id collected by the console shell. */\n  participantId?: string;\n  /** Icon-strip rendering for a collapsed pane; sections open in popovers. */\n  collapsed?: boolean;\n  className?: string;\n}\n\nfunction CollapsedSection({\n  label,\n  icon,\n  children,\n}: {\n  label: string;\n  icon: React.ReactNode;\n  children: React.ReactNode;\n}) {\n  return (\n    <Popover>\n      <PopoverTrigger\n        render={\n          <Button variant=\"ghost\" size=\"icon-sm\" aria-label={label}>\n            {icon}\n          </Button>\n        }\n      />\n      <PopoverContent side=\"left\" align=\"start\" className=\"w-80 max-w-[90vw]\">\n        {children}\n      </PopoverContent>\n    </Popover>\n  );\n}\n\n/**\n * Console info pane: connection status, local device controls, and session\n * details. Renders null when every section is disabled; the collapsed\n * variant is a vertical icon strip whose sections open in popovers. Must be\n * rendered inside a PipecatClientProvider (with a TooltipProvider ancestor\n * for the session copy buttons).\n */\nexport function ConsoleInfoPanel({\n  noStatusInfo = false,\n  noUserAudio = false,\n  noUserVideo = false,\n  noScreenControl = false,\n  noSessionInfo = false,\n  sessionId,\n  participantId,\n  collapsed = false,\n  className,\n}: ConsoleInfoPanelProps) {\n  // Most agents never use the camera, so its preview tile only takes space\n  // once the camera is on.\n  const { isCamEnabled } = usePipecatClientCamControl();\n  const noDevices = noUserAudio && noUserVideo && noScreenControl;\n  if (noStatusInfo && noDevices && noSessionInfo) return null;\n\n  const devices = (\n    <div className=\"flex flex-col gap-2\">\n      {!noUserAudio && <UserAudioControl className=\"w-full\" />}\n      {!noUserVideo && (\n        <UserVideoControl className=\"w-full\" noVideo={!isCamEnabled} />\n      )}\n      {!noScreenControl && <UserScreenControl className=\"w-full\" />}\n    </div>\n  );\n\n  if (collapsed) {\n    return (\n      <div\n        data-slot=\"console-info-panel\"\n        data-state=\"collapsed\"\n        className={className}\n      >\n        <div className=\"flex h-full flex-col items-center gap-1 py-2\">\n          {!noStatusInfo && (\n            <CollapsedSection\n              label=\"Connection status\"\n              icon={<ChevronsLeftRightEllipsisIcon />}\n            >\n              <ClientStatus />\n            </CollapsedSection>\n          )}\n          {!noDevices && (\n            <CollapsedSection label=\"Devices\" icon={<MicIcon />}>\n              {devices}\n            </CollapsedSection>\n          )}\n          {!noSessionInfo && (\n            <CollapsedSection label=\"Session info\" icon={<InfoIcon />}>\n              <SessionInfo\n                sessionId={sessionId}\n                participantId={participantId}\n              />\n            </CollapsedSection>\n          )}\n        </div>\n      </div>\n    );\n  }\n\n  return (\n    <ConsolePanel\n      className={className}\n      data-slot=\"console-info-panel\"\n      data-state=\"expanded\"\n    >\n      <ConsolePanelContent className=\"flex flex-col gap-(--card-spacing)\">\n        {!noStatusInfo && (\n          <section className=\"flex flex-col gap-2\">\n            <ConsolePanelTitle>Status</ConsolePanelTitle>\n            <ClientStatus />\n          </section>\n        )}\n        {!noDevices && (\n          <section className=\"flex flex-col gap-2\">\n            <ConsolePanelTitle>Devices</ConsolePanelTitle>\n            {devices}\n          </section>\n        )}\n        {!noSessionInfo && (\n          <section className=\"flex flex-col gap-2\">\n            <ConsolePanelTitle>Session</ConsolePanelTitle>\n            <SessionInfo sessionId={sessionId} participantId={participantId} />\n          </section>\n        )}\n      </ConsolePanelContent>\n    </ConsolePanel>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/pipecat/console/info-panel.tsx"
    },
    {
      "path": "src/blocks/console/keypad-toggle.tsx",
      "content": "\"use client\";\n\nimport { PhoneIcon } from \"lucide-react\";\nimport * as React from \"react\";\n\nimport { useMinWidth } from \"@/components/pipecat/console/panel\";\nimport {\n  DTMFKeypad,\n  type DTMFKeypadMode,\n} from \"@/components/pipecat/dtmf-keypad\";\nimport { Button } from \"@/components/ui/button\";\nimport {\n  Drawer,\n  DrawerContent,\n  DrawerDescription,\n  DrawerHeader,\n  DrawerTitle,\n  DrawerTrigger,\n} from \"@/components/ui/drawer\";\nimport {\n  Popover,\n  PopoverContent,\n  PopoverTrigger,\n} from \"@/components/ui/popover\";\n\nexport interface ConsoleKeypadToggleProps {\n  /** How the keypad dispatches presses (default \"buffered\"). */\n  mode?: DTMFKeypadMode;\n  /** Overrides merged onto the keypad (wins over defaults). */\n  keypadProps?: Partial<React.ComponentProps<typeof DTMFKeypad>>;\n  className?: string;\n}\n\n/**\n * Header button opening the DTMF keypad — a popover on desktop, a drawer on\n * mobile. One instantiation: the surface switches on the viewport instead\n * of rendering both. Must be rendered inside a PipecatClientProvider.\n */\nexport function ConsoleKeypadToggle({\n  mode = \"buffered\",\n  keypadProps,\n  className,\n}: ConsoleKeypadToggleProps) {\n  const isDesktop = useMinWidth(640);\n\n  const trigger = (\n    <Button\n      variant=\"ghost\"\n      size=\"icon-sm\"\n      aria-label=\"Open keypad\"\n      className={className}\n      data-slot=\"console-keypad-toggle\"\n    >\n      <PhoneIcon />\n    </Button>\n  );\n\n  if (isDesktop) {\n    return (\n      <Popover>\n        <PopoverTrigger render={trigger} />\n        <PopoverContent align=\"end\" side=\"bottom\" className=\"w-auto\">\n          <DTMFKeypad mode={mode} {...keypadProps} />\n        </PopoverContent>\n      </Popover>\n    );\n  }\n\n  return (\n    <Drawer>\n      <DrawerTrigger render={trigger} />\n      <DrawerContent>\n        <DrawerHeader>\n          <DrawerTitle>Keypad</DrawerTitle>\n          <DrawerDescription className=\"sr-only\">\n            Send DTMF tones to the connected bot.\n          </DrawerDescription>\n        </DrawerHeader>\n        <div className=\"mx-auto w-full max-w-xs p-4 pt-0\">\n          <DTMFKeypad mode={mode} {...keypadProps} />\n        </div>\n      </DrawerContent>\n    </Drawer>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/pipecat/console/keypad-toggle.tsx"
    },
    {
      "path": "src/blocks/console/logo.tsx",
      "content": "\"use client\";\n\nconst ASPECT_RATIO = 45 / 26;\n\nexport interface PipecatLogoProps {\n  /** Accessible label for the logo (default \"Pipecat\"). */\n  alt?: string;\n  /** Height in pixels; width derives from the aspect ratio (default 24). */\n  height?: number;\n  className?: string;\n}\n\n/**\n * Inline Pipecat wordmark, drawn in currentColor so it follows the\n * surrounding text color.\n */\nexport function PipecatLogo({\n  alt = \"Pipecat\",\n  height = 24,\n  className,\n}: PipecatLogoProps) {\n  const width = Math.round(height * ASPECT_RATIO);\n  return (\n    <svg\n      data-slot=\"pipecat-logo\"\n      width={width}\n      height={height}\n      viewBox=\"0 0 45 26\"\n      xmlns=\"http://www.w3.org/2000/svg\"\n      className={className}\n      role=\"img\"\n      aria-label={alt}\n    >\n      <path\n        d=\"M6.19825 0.104287C6.83144 -0.13411 7.5461 0.044779 7.99232 0.553371L13.8037 7.17714H31.1545L36.9659 0.553371C37.4121 0.044779 38.1268 -0.13411 38.76 0.104287C39.3932 0.342685 39.8124 0.948477 39.8124 1.62507V16.25H44.9582V19.5H36.5624V5.94116L33.112 9.87383C32.8035 10.2255 32.3584 10.4271 31.8905 10.4271H13.0677C12.5998 10.4271 12.1547 10.2255 11.8462 9.87383L8.39581 5.94116V19.5H0V16.25H5.14582V1.62507C5.14582 0.948477 5.56505 0.342685 6.19825 0.104287Z\"\n        fill=\"currentColor\"\n      />\n      <path d=\"M36.5624 22.75H44.9582V26H36.5624V22.75Z\" fill=\"currentColor\" />\n      <path d=\"M0 22.75H8.39581V26H0V22.75Z\" fill=\"currentColor\" />\n      <path\n        d=\"M17.3333 17.3334C17.3333 18.53 16.3632 19.5 15.1666 19.5C13.97 19.5 13 18.53 13 17.3334C13 16.1367 13.97 15.1667 15.1666 15.1667C16.3632 15.1667 17.3333 16.1367 17.3333 17.3334Z\"\n        fill=\"currentColor\"\n      />\n      <path\n        d=\"M31.9582 17.3334C31.9582 18.53 30.9882 19.5 29.7916 19.5C28.595 19.5 27.6249 18.53 27.6249 17.3334C27.6249 16.1367 28.595 15.1667 29.7916 15.1667C30.9882 15.1667 31.9582 16.1367 31.9582 17.3334Z\"\n        fill=\"currentColor\"\n      />\n    </svg>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/pipecat/console/logo.tsx"
    },
    {
      "path": "src/blocks/console/panel.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\n\nimport {\n  Card,\n  CardAction,\n  CardContent,\n  CardHeader,\n  CardTitle,\n} from \"@/components/ui/card\";\nimport { cn } from \"@/lib/utils\";\n\n/**\n * Console-shared viewport check: true at or above the given width. Single\n * source for the desktop/mobile layout switch so panels are instantiated\n * once, in whichever tree renders.\n */\nexport function useMinWidth(px: number): boolean {\n  const subscribe = React.useCallback(\n    (onChange: () => void) => {\n      const query = window.matchMedia(`(min-width: ${px}px)`);\n      query.addEventListener(\"change\", onChange);\n      return () => query.removeEventListener(\"change\", onChange);\n    },\n    [px],\n  );\n  return React.useSyncExternalStore(\n    subscribe,\n    () => window.matchMedia(`(min-width: ${px}px)`).matches,\n    () => false,\n  );\n}\n\n/**\n * Panel chrome for the console, styled over the stock Card so consumer Card\n * theming (tokens, radius, ring) flows straight through. Density is\n * container-driven: compact padding by default, relaxing at wider panel\n * widths — the same markup serves expanded panes, collapsed strips, and\n * mobile tabs.\n */\nexport function ConsolePanel({\n  className,\n  ...props\n}: React.ComponentProps<typeof Card>) {\n  return (\n    <Card\n      size=\"sm\"\n      className={cn(\n        \"@container/panel h-full min-h-0 gap-(--card-spacing) overflow-hidden\",\n        \"[--card-spacing:--spacing(2)] @xs/panel:[--card-spacing:--spacing(3)] @md/panel:[--card-spacing:--spacing(4)]\",\n        className,\n      )}\n      data-slot=\"console-panel\"\n      {...props}\n    />\n  );\n}\n\nexport function ConsolePanelHeader({\n  className,\n  ...props\n}: React.ComponentProps<typeof CardHeader>) {\n  return (\n    <CardHeader\n      className={cn(\"items-center border-b\", className)}\n      data-slot=\"console-panel-header\"\n      {...props}\n    />\n  );\n}\n\nexport function ConsolePanelTitle({\n  className,\n  ...props\n}: React.ComponentProps<typeof CardTitle>) {\n  return (\n    <CardTitle\n      className={cn(\n        \"text-muted-foreground truncate text-xs font-medium tracking-wide uppercase\",\n        className,\n      )}\n      data-slot=\"console-panel-title\"\n      {...props}\n    />\n  );\n}\n\nexport function ConsolePanelActions({\n  className,\n  ...props\n}: React.ComponentProps<typeof CardAction>) {\n  return (\n    <CardAction\n      className={cn(\"flex items-center gap-1 self-center\", className)}\n      data-slot=\"console-panel-actions\"\n      {...props}\n    />\n  );\n}\n\nexport function ConsolePanelContent({\n  className,\n  ...props\n}: React.ComponentProps<typeof CardContent>) {\n  return (\n    <CardContent\n      className={cn(\"min-h-0 flex-1 overflow-auto\", className)}\n      data-slot=\"console-panel-content\"\n      {...props}\n    />\n  );\n}\n",
      "type": "registry:component",
      "target": "components/pipecat/console/panel.tsx"
    }
  ],
  "docs": "Console builds its own client and PipecatClientProvider; do not nest it in another provider. Pass transportFactory for your installed transport, or registerTransport a loader per type, and render it in a sized container.",
  "categories": [
    "voice",
    "blocks"
  ],
  "type": "registry:block"
}