Repository navigation
Releases
ingenui@0.0.3
Patch Changes
- d929217: Actions can now report what the user entered. When an action is called with a form's submit event (its fields, via
FormData, including the submitter), a click on a named<button>(itsname/value), or a plain data object, the values appear asActionEvent.dataand the canonical message lists them ("… was fired by the user with these values:" followed by JSON-quoted- name: "value"lines). The submission's navigation is prevented.resolveGenUiAction(schema, name, data?)normalizes the client's values the same way on the server (newnormalizeActionData;extractActionDatais exported too). The prompt tells the model that some components report values, as their descriptions say; it never suggests raw HTML forms. Supply form and control components and describe their semantics. - 991be64:
formatGenUiPromptnow tells the model that a fired action reports only its name, so every distinct choice needs its own action (e.g.actions.addToCartBlueMug/actions.addToCartRedMuginstead ofactions.addToCarton every item). - fd8d80a: The prompt contract no longer contradicts ingenui's message format.
formatPromptContracttakes a newstandaloneoption (defaulttrue, unchanged output: the JSX is the model's whole output, with no prose or code fences around it). Withstandalone: falsethe contract only constrains what goes inside a UI block ("Inside a UI block, write only JSX — no nested code fences, no imports, no statements.").formatGenUiPromptnow uses that embedded form: its "UI contract" section used to say "Output raw JSX only — no prose, no markdown code fences", against the Markdown +ui+jsxfence format it describes just above. - Updated dependencies [fd8d80a]
- @ingenui/incremental-jsx-parser@0.0.3
@ingenui/incremental-jsx-parser@0.0.3
Patch Changes
- fd8d80a: The prompt contract no longer contradicts ingenui's message format.
formatPromptContracttakes a newstandaloneoption (defaulttrue, unchanged output: the JSX is the model's whole output, with no prose or code fences around it). Withstandalone: falsethe contract only constrains what goes inside a UI block ("Inside a UI block, write only JSX — no nested code fences, no imports, no statements.").formatGenUiPromptnow uses that embedded form: its "UI contract" section used to say "Output raw JSX only — no prose, no markdown code fences", against the Markdown +ui+jsxfence format it describes just above.
ingenui@0.0.2
Patch Changes
-
ebfc21a: Add
useIsElementComplete(): a hook for catalog components that returnsfalsewhile the component's element is still open on the stream andtrueonce it is settled (closing tag arrived, self-closing, or auto-closed). Each resolved component element is now wrapped in a context provider, so the flag flips without remounting. Exported from@ingenui/incremental-jsx-parserand/react, and re-exported fromingenui/react. -
7ea2f79: Internal refactoring: the parser's AST primitives and error events move into dependency-free modules (no more import cycles), and duplicated logic (component resolution, fence parsing,
actionsvariable wiring) is shared.IncrementalJsxParserOptionsfields now also accept an explicitundefined, andGenUiMessageextendsIncrementalJsxParser. WithdynamicActions: falseand an emptyactionsmap, theactionsvariable is no longer defined (matching the prompt). -
b71bd59:
pipeGenUican stop a streamed message on a parse issue and recover, transport-agnostically.pipe.stop()(also passed toonIssueas its second argument) cancels the source and ends the stream normally instead of with an error. The newcontinuationoption continues a stopped message in the same stream: it closes an open fence, then pipes the source the callback returns into the same validation state, so block indices and issues stay aligned with the client.donenow resolves with a result object (status,text,issues,issueReport,cleanOffset/cleanText,stops) instead of the issues array. NewformatContinuationMessagebuilds the Messages API "continue from where you left off" request, and the validator gainsgetCleanOffset()/getFenceClose(). -
e871136: Separate pure logic from side effects. Breaking (
/core):createParsernow takes the schema checks as onechecks: SchemaChecksoption (build it with the newcreateSchemaChecks(schema)) instead of the flatisKnownComponent/isKnownVariable/isAllowedElement/checkPropcallbacks, andTreeBuilderOptionsis no longer exported. The AST node types are nowreadonly, matching the frozen nodes the parser has always handed out. Parse errors are still reported synchronously by thewrite()that completes them, now once the chunk is fully parsed.validateOpeningTagandvalidateVariableare exported as the pure functions behind the schema errors. Streaming is faster with small chunks (the live snapshot copies less), and a streamed ingenui message renders with fewer, larger UI-block updates. -
a60f3da: ingenui now covers the server as well as the client:
ingenui/schema:defineGenUiSchemadeclares the parse-affecting options (elements, component prop catalogs with descriptions, variable types, actions,dynamicActions,mismatchedTag) as plain data, shared by the server and the client.bindGenUi(schema, bindings)(iningenui) binds components, variable values and action handlers to a schema. The bindings are type-checked against the schema (InferSchemaType/InferComponentProps) and checked at runtime.ingenui/server(React-free):pipeGenUivalidates a model's stream while passing it through to the client, reporting the client's parse-time issues as soon as they are streamed. It also exportscreateGenUiValidator/validateGenUiMessage,resolveGenUiAction(for building the next request on the server from an action name),formatGenUiPrompt, andformatIssueReport.formatGenUiPromptaccepts a schema and includes component and action descriptions. Actions may be declared as{ description }.
Parser: component specs accept a
description(listed byformatPromptContract). The prompt contract now lists declared variables first, and a prop rejected by an empty prop catalog now reads "<Tag>takes no props". -
d6c196e: Render unterminated inline Markdown optimistically while streaming: at the stream frontier,
**bold,*em, and`codeshow as formatted text instead of raw markers, link destinations are hidden until complete, and trailing markers that could still become syntax are withheld. Emphasis now follows CommonMark flanking rules (** not bold **stays literal). CustomrenderMarkdownfunctions receive a{ streaming }context, and the exportedrenderMarkdownaccepts{ streaming: true }. -
9c4002d: New
wrapUiBlockoption forcreateGenUiMessage: wraps eachui+jsxblock's rendering with the app's own markup. It receives the block'sblockIndex,state("streaming"/"closed"/"unterminated"), itsjsx-error/render-errorissuesso far, whether itcrashed, andchildren(the default rendering, still inside the built-in error boundary), so an app can grey out, collapse, or label a broken block (e.g. above the corrected block after a stop and continuation), or show a fallback for a crashed one. It is called again only when the block's tree or status changes.A render crash is now final: the block's error boundary no longer retries as more of the stream arrives (props are final when an element appears; only children grow, and components can check
useIsElementComplete()).UiBlockErrorBoundarydrops itsresetKeyprop.renderUiErroris deprecated in favour ofwrapUiBlock(crashed ? fallback : children). -
Updated dependencies [ebfc21a]
-
Updated dependencies [7ea2f79]
-
Updated dependencies [ff93a7e]
-
Updated dependencies [e871136]
-
Updated dependencies [a60f3da]
- @ingenui/incremental-jsx-parser@0.0.2
@ingenui/incremental-jsx-parser@0.0.2
Patch Changes
-
ebfc21a: Add
useIsElementComplete(): a hook for catalog components that returnsfalsewhile the component's element is still open on the stream andtrueonce it is settled (closing tag arrived, self-closing, or auto-closed). Each resolved component element is now wrapped in a context provider, so the flag flips without remounting. Exported from@ingenui/incremental-jsx-parserand/react, and re-exported fromingenui/react. -
7ea2f79: Internal refactoring: the parser's AST primitives and error events move into dependency-free modules (no more import cycles), and duplicated logic (component resolution, fence parsing,
actionsvariable wiring) is shared.IncrementalJsxParserOptionsfields now also accept an explicitundefined, andGenUiMessageextendsIncrementalJsxParser. WithdynamicActions: falseand an emptyactionsmap, theactionsvariable is no longer defined (matching the prompt). -
ff93a7e: The prompt contract (
formatPromptContract, and soformatGenUiPrompt) no longer claims text is "rendered literally". It now says text follows JSX rules — HTML entities are decoded and line breaks/indentation collapse to single spaces — still recommends writing characters directly, and lists</{alongside{"<"}for a literal<or{. -
e871136: Separate pure logic from side effects. Breaking (
/core):createParsernow takes the schema checks as onechecks: SchemaChecksoption (build it with the newcreateSchemaChecks(schema)) instead of the flatisKnownComponent/isKnownVariable/isAllowedElement/checkPropcallbacks, andTreeBuilderOptionsis no longer exported. The AST node types are nowreadonly, matching the frozen nodes the parser has always handed out. Parse errors are still reported synchronously by thewrite()that completes them, now once the chunk is fully parsed.validateOpeningTagandvalidateVariableare exported as the pure functions behind the schema errors. Streaming is faster with small chunks (the live snapshot copies less), and a streamed ingenui message renders with fewer, larger UI-block updates. -
a60f3da: ingenui now covers the server as well as the client:
ingenui/schema:defineGenUiSchemadeclares the parse-affecting options (elements, component prop catalogs with descriptions, variable types, actions,dynamicActions,mismatchedTag) as plain data, shared by the server and the client.bindGenUi(schema, bindings)(iningenui) binds components, variable values and action handlers to a schema. The bindings are type-checked against the schema (InferSchemaType/InferComponentProps) and checked at runtime.ingenui/server(React-free):pipeGenUivalidates a model's stream while passing it through to the client, reporting the client's parse-time issues as soon as they are streamed. It also exportscreateGenUiValidator/validateGenUiMessage,resolveGenUiAction(for building the next request on the server from an action name),formatGenUiPrompt, andformatIssueReport.formatGenUiPromptaccepts a schema and includes component and action descriptions. Actions may be declared as{ description }.
Parser: component specs accept a
description(listed byformatPromptContract). The prompt contract now lists declared variables first, and a prop rejected by an empty prop catalog now reads "<Tag>takes no props".