@gistui/core
v0.2.1
Published
GistUI Lang: streaming parser, materializer, validator and prompt generator. Zero dependencies.
Maintainers
Readme
The GistUI Lang engine: an incremental streaming parser, a patch-based materializer, validation with deterministic repair, a canonical printer, edit-mode merge and a system-prompt generator. It has zero dependencies and works in any JS runtime.
npm install @gistui/coreimport { createStream, defineLibrary, generatePrompt } from "@gistui/core";
const lib = defineLibrary({ components: [/* ComponentSpec… */] });
const system = generatePrompt(lib).text;
const stream = createStream(lib);
stream.store.subscribe("root", () => render(stream.store.get("root")));
for await (const chunk of llmResponse) {
stream.push(chunk); // string or UTF-8 bytes
stream.flush(); // call once per frame; commits patches and notifies subscribers
}
stream.end(); // auto-closes, drops unresolved refs, reports errors
console.log(stream.errors());parse(source, lib): one-shot parse. Returns{root, store, errors, valid: {strict, lenient}}.validate(source, lib): validity, errors and the reachable component count.autofix(text, lib): repairs a program with mistakes, in code (no model call): unknown props and extra arguments removed, invalid values corrected, missing required props filled, misspelled components renamed, dangling references dropped, unused statements placed. Every change is listed.toEditSource/merge: the canonical printout for edit turns, and the merge of an edit into a program.generatePrompt(lib, {mode, tools, examples, groups, progressive}): a byte-stable system prompt.
The language is specified in spec/gistui-lang.md in the GistUI repository, with a conformance suite
in spec/conformance/.
bun test # unit, property, conformance and performance tests
bun run bench # parser benchmarks → bench/results/parser.jsonAll packages
GistUI is one project in several packages, released together under one version.
| Package | What it is |
|---|---|
| @gistui/react | React renderer and default components |
| @gistui/vue | Vue 3.5+ and Nuxt |
| @gistui/svelte | Svelte 5 and SvelteKit |
| @gistui/solid | Solid and SolidStart |
| @gistui/vanilla | Vanilla JavaScript renderer, no framework |
| @gistui/catalog | Component schemas, the system prompt and the agent skill |
| @gistui/styles | One stylesheet for every framework |
| @gistui/server | Stream reading, validation and repair on the server |
| @gistui/chat | Headless chat store, model adapters, React chat layouts |
| @gistui/core | The language: streaming parser, validator, autofix, prompt generator |
| @gistui/headless | Shared internals: engine, themes, forms |
| @gistui/widgets | Shared internals: charts, Markdown |
