npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@uix-ai/adapter-vercel

v0.0.2

Published

Adapter to convert Vercel AI SDK messages to UIX Lucid IR format

Downloads

23

Readme

@uix-ai/adapter-vercel

Adapter to convert Vercel AI SDK messages to UIX Lucid IR format. Compatible with Vercel AI SDK 4.x and 6.x.

Install

pnpm add @uix-ai/adapter-vercel

Peer dependencies: react, @uix-ai/core

Quick Start

Using the useVercelChat hook (recommended)

The all-in-one hook manages chat state internally and returns UIX-ready data:

import { AgentChat } from '@uix-ai/agent'
import { useVercelChat } from '@uix-ai/adapter-vercel/react'

function App() {
  const { conversations, status, send, stop } = useVercelChat({ api: '/api/chat' })

  return (
    <AgentChat
      conversations={conversations}
      status={status}
      onSend={send}
      onStop={stop}
    />
  )
}

Using with existing useChat

If you already use useChat from @ai-sdk/react, wrap the messages with useVercelMessages:

import { useChat } from '@ai-sdk/react'
import { useVercelMessages } from '@uix-ai/adapter-vercel/react'

function App() {
  const chat = useChat({ api: '/api/chat' })
  const conversations = useVercelMessages(chat.messages)

  // Use conversations with any UIX component
}

React Hooks

useVercelChat(options?)

Complete bridge that manages chat state and conversion.

Options:

| Option | Type | Default | Description | |--------|------|---------|-------------| | api | string | '/api/chat' | Vercel AI SDK endpoint | | conversionOptions | ConversionOptions | -- | Customize block ID generation, part filtering | | initialMessages | VercelUIMessage[] | [] | Pre-populate the conversation | | onFinish | () => void | -- | Called when response completes | | onError | (error: Error) => void | -- | Called on error |

Returns: { conversations, status, send, stop, isLoading, messages, setMessages }

useVercelMessages(messages, options?)

Low-level hook that reactively converts Vercel messages to LucidConversation[]. Use this when you manage useChat yourself.

const conversations = useVercelMessages(messages)

Manual Conversion API

For non-React usage or server-side conversion:

import { fromVercelMessages, fromVercelMessage, toVercelMessage, toVercelMessages } from '@uix-ai/adapter-vercel'

// Vercel -> UIX
const conversations = fromVercelMessages(vercelMessages)
const single = fromVercelMessage(vercelMessage)

// UIX -> Vercel
const vercelMsg = toVercelMessage(conversation)
const vercelMsgs = toVercelMessages(conversations)

convertPartToBlock(part, options?)

Convert a single Vercel message part to a LucidBlock:

import { convertPartToBlock } from '@uix-ai/adapter-vercel'

const block = convertPartToBlock({ type: 'text', text: 'Hello' })

convertBlockToParts(block)

Convert a LucidBlock back to Vercel message parts:

import { convertBlockToParts } from '@uix-ai/adapter-vercel'

const parts = convertBlockToParts(textBlock)

Conversion Options

const options: ConversionOptions = {
  generateBlockId: () => crypto.randomUUID(),
  includeMetadata: false,
  filterPart: (part) => part.type !== 'step-start',
}

const conversations = fromVercelMessages(messages, options)

Supported Vercel Part Types

| Vercel Part | UIX Block Type | Notes | |-------------|----------------|-------| | text | text | Supports streaming state | | reasoning | thinking | Maps to thinking/reasoning block | | file | file | Preserves MIME type and filename | | source-url | source | URL citation for RAG | | source-document | source | Document citation for RAG | | tool-* / dynamic-tool | tool | Full tool lifecycle mapping | | step-start | (skipped) | Structural marker in SDK 6.x agent loops |

SDK 4.x and 6.x Compatibility

This adapter works with both Vercel AI SDK 4.x and 6.x. Key differences handled automatically:

  • SDK 6.x introduced step-start parts for agent tool loops -- these are skipped as structural markers.
  • SDK 6.x added dynamic-tool type alongside tool-* pattern -- both are supported.
  • Tool state names differ between versions -- all mappings are handled internally.

Links