
Security News
The Hidden Blast Radius of the Axios Compromise
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.
@rodgerai/embed
Advanced tools
Embeddable chat widget for Rodger.ai agents. Drop a fully functional AI chat interface into any website with just a few lines of code.
npm install @rodger/embed
# or
pnpm add @rodger/embed
# or
yarn add @rodger/embed
import { RodgerEmbed } from '@rodger/embed';
function App() {
return (
<div>
{/* Your app content */}
<RodgerEmbed
endpoint="/api/chat"
sessionId="user-123"
/>
</div>
);
}
import { RodgerEmbed } from '@rodger/embed';
function App() {
return (
<RodgerEmbed
endpoint="/api/chat"
position="bottom-right"
theme={{
primaryColor: '#6366f1',
fontFamily: 'Inter, sans-serif',
borderRadius: '12px',
width: '450px',
height: '650px',
}}
welcomeMessage={
<div>
<h3>Welcome to Support Chat!</h3>
<p>How can we help you today?</p>
</div>
}
/>
);
}
import { RodgerEmbed } from '@rodger/embed';
function WeatherWidget({ data }) {
return (
<div className="rounded-lg border p-4">
<h4>{data.location}</h4>
<p className="text-2xl">{data.temperature}°</p>
<p>{data.conditions}</p>
</div>
);
}
function App() {
return (
<RodgerEmbed
endpoint="/api/chat"
widgets={{
weather: WeatherWidget,
}}
/>
);
}
import { EmbedProvider, EmbedTrigger, EmbedDialog, useEmbed } from '@rodger/embed';
function CustomTrigger() {
const { toggle, state } = useEmbed();
return (
<button onClick={toggle} className="my-custom-button">
Chat with us {state.unreadCount > 0 && `(${state.unreadCount})`}
</button>
);
}
function App() {
return (
<EmbedProvider
config={{
endpoint: '/api/chat',
position: 'bottom-right',
}}
>
<div>
{/* Your app content */}
<CustomTrigger />
<EmbedDialog />
</div>
</EmbedProvider>
);
}
| Property | Type | Default | Description |
|---|---|---|---|
endpoint | string | required | API endpoint for chat (e.g., /api/chat) |
sessionId | string | auto-generated | Session ID for this user. Auto-generated as session-{timestamp} if not provided |
position | 'bottom-right' | 'bottom-left' | 'top-right' | 'top-left' | 'bottom-right' | Position of the widget on the screen |
theme | EmbedTheme | - | Theme configuration for customizing appearance |
widgets | Record<string, ComponentType> | - | Custom widgets for rendering tool results |
welcomeMessage | ReactNode | - | Welcome message shown when thread is empty |
trigger | TriggerConfig | - | Trigger button customization |
defaultOpen | boolean | false | Whether the chat dialog is open by default |
notifications | boolean | true | Enable unread message count badge on trigger button |
zIndex | number | 50 | Z-index for widget positioning |
| Property | Type | Default | Description |
|---|---|---|---|
primaryColor | string | - | Primary brand color (hex, rgb, or CSS color) |
fontFamily | string | - | Font family for the chat interface |
borderRadius | string | - | Border radius for the chat dialog |
width | string | '400px' | Width of chat dialog |
height | string | '600px' | Height of chat dialog |
cssVariables | Record<string, string> | - | Custom CSS variables for advanced theming |
| Property | Type | Default | Description |
|---|---|---|---|
icon | ReactNode | <MessageCircle /> | Custom icon for the trigger button |
label | string | 'Open chat' | Aria label for accessibility |
className | string | - | Additional CSS classes for the trigger button |
useEmbed()Access the embed context to control the widget programmatically.
const { config, state, open, close, toggle, incrementUnread, resetUnread } = useEmbed();
Returns:
config: Current embed configurationstate: Current embed state (isOpen, unreadCount, sessionId)open(): Open the chat dialogclose(): Close the chat dialogtoggle(): Toggle the chat dialogincrementUnread(): Increment unread countresetUnread(): Reset unread count to 0<RodgerEmbed
endpoint="/api/support"
position="bottom-right"
theme={{
primaryColor: '#10b981',
width: '420px',
}}
welcomeMessage={
<div>
<h3>Need help?</h3>
<p>Ask us about products, orders, or shipping!</p>
</div>
}
widgets={{
product: ProductCard,
order: OrderStatus,
}}
/>
<RodgerEmbed
endpoint="/api/assistant"
sessionId={userId}
position="bottom-left"
theme={{
primaryColor: '#3b82f6',
height: '700px',
}}
trigger={{
label: 'Ask AI Assistant',
}}
defaultOpen={false}
/>
<RodgerEmbed
endpoint="/api/docs-chat"
position="top-right"
theme={{
width: '500px',
height: '80vh',
}}
welcomeMessage="Search our docs or ask a question"
widgets={{
docLink: DocLinkCard,
codeSnippet: CodeSnippet,
}}
/>
The embed widget requires a chat API endpoint that follows the Vercel AI SDK streaming protocol. Here's an example Next.js API route:
// app/api/chat/route.ts
import { createAgent } from '@rodger/core';
import { streamText } from 'ai';
const agent = createAgent({
name: 'support-agent',
llm: { provider: 'openai', model: 'gpt-4o' },
systemPrompt: 'You are a helpful customer support agent.',
});
export async function POST(req: Request) {
const { messages, sessionId } = await req.json();
const stream = await streamText({
model: agent.llm,
messages,
// Add your tools here
});
return stream.toDataStreamResponse();
}
// History endpoint (optional but recommended)
export async function POST(req: Request) {
const { sessionId } = await req.json();
// Load message history from your database
const messages = await loadMessageHistory(sessionId);
return Response.json({ messages });
}
The widget automatically manages sessions:
sessionId is provided, it uses that IDsession-{timestamp})The widget attempts to load message history from {endpoint}/history on mount. Implement this endpoint to restore previous conversations:
// app/api/chat/history/route.ts
export async function POST(req: Request) {
const { sessionId } = await req.json();
// Load from your database
const messages = await db.messages.findMany({
where: { sessionId },
orderBy: { createdAt: 'asc' }
});
return Response.json({ messages });
}
If you're currently using the standalone Thread component from @rodger/ui, migrating to the embed widget is straightforward:
import { Thread, RodgerProvider, useRodgerChat } from '@rodger/ui';
function ChatPage() {
const { runtime } = useRodgerChat({
endpoint: '/api/chat',
sessionId: 'session-123',
});
return (
<RodgerProvider runtime={runtime}>
<div className="h-screen">
<Thread widgets={myWidgets} />
</div>
</RodgerProvider>
);
}
import { RodgerEmbed } from '@rodger/embed';
function App() {
return (
<div>
{/* Your app content */}
<RodgerEmbed
endpoint="/api/chat"
sessionId="session-123"
widgets={myWidgets}
/>
</div>
);
}
The embed widget handles all the setup (RodgerProvider, useRodgerChat, positioning) automatically.
Full TypeScript support with exported types:
import type { EmbedConfig, EmbedTheme, EmbedState } from '@rodger/embed';
const config: EmbedConfig = {
endpoint: '/api/chat',
position: 'bottom-right',
theme: {
primaryColor: '#3b82f6',
width: '450px',
},
};
# Install dependencies
pnpm install
# Build the package
pnpm build
# Development mode with watch
pnpm dev
# Type check
pnpm type-check
endpoint prop points to a valid API routetheme.cssVariables for advanced custom stylingMIT
FAQs
Embeddable chat widget for Rodger.ai agents
We found that @rodgerai/embed demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.

Research
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.

Research
Malicious versions of the Telnyx Python SDK on PyPI delivered credential-stealing malware via a multi-stage supply chain attack.