@toon-ui/core
v2.0.1
Published
Core parser, AST, validation, and protocol utilities for ToonUI.
Maintainers
Readme
@toon-ui/core
@toon-ui/core is the protocol foundation of ToonUI.
Use it when you need the server model, the central catalog, parsing, validation, or event/message conversion.
Quick path
- Create a protocol with
createToonProtocol(). - Feed
toon.promptinto your system prompt. - Use
toon.catalog,toon.events, andtoon.messagesas the public API.
Install
Use only the protocol package when you do not need React rendering:
pnpm add @toon-ui/coreMain exports
createToonProtocol()createToonCatalog()TOON_CATALOGparseToonUI()validateToonUI()extractToonBlocks()toToonEventContent()
Recommended server usage
import { createToonProtocol } from '@toon-ui/core';
const toon = createToonProtocol();
const system = [toon.prompt, 'Available tools:', '- searchProducts(query)'].join('
');Public API shape
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);Why this shape exists
The old flat helpers were technically functional but conceptually noisy.
The new model is explicit:
catalog= language definitionevents= user intent objectsmessages= reinjection into chat state
Boundary
@toon-ui/core does NOT render React.
If you need rendering:
@toon-ui/reactfor explicit adapters@toon-ui/toon-uifor the simplest client path
