Packages
@toon-ui/core
The protocol foundation of ToonUI: language, validation, prompts, and interaction conversion.
@toon-ui/core is the package that defines the contract.
Use it when you need the server-side language layer, not rendering.
Why use @toon-ui/core?
Because every ToonUI integration starts with the same requirement:
the model needs a clear, teachable language for describing UI.
@toon-ui/core gives you that language and the APIs around it.
What it owns
- official catalog
- parsing
- validation
- prompt generation
- reply and submit event creation
- message conversion back into your app or model loop
Most common usage
import { createToonProtocol } from '@toon-ui/core';
const toon = createToonProtocol();
const system = [
toon.prompt,
'Available tools:',
'- searchProducts(query)',
].join('\n\n');Here, toon.prompt is the canonical ToonUI contract.
Your app-specific instructions still belong AFTER it.
What createToonProtocol() gives you
const toon = createToonProtocol();
toon.catalog.components.form.syntax;
toon.events.reply('Open details');
toon.events.submit('create_product', { name: 'Coca-Cola' });
toon.messages.toContent(payload);
toon.messages.toModelMessage(payload);
toon.messages.toUIMessage(payload);Mental model
Think about @toon-ui/core as three things:
catalog= what the language supportsevents= how user intent becomes structured payloadsmessages= how that intent goes back into your app loop
What it does NOT do
@toon-ui/core does NOT render React.
If you need rendering, pair it with:
@toon-ui/toon-uifor the fastest path@toon-ui/reactfor explicit adapter ownership
Best fit
Use @toon-ui/core when you are building:
- server prompts
- model contracts
- validation pipelines
- tooling around the ToonUI language