lang_core library
The low-level OpenUI Lang API with @openuidev/lang-core's names: lexer, parser, serializer, evaluator,
store and query manager.
Classes
- ActionPlan
- An evaluated action: the steps a click runs, in order.
- ActionStep
-
A step of a plan;
jsFieldsare lang-core's step object. - ArrNode
- AssignNode
- Ast
-
The OpenUI Lang 1.0 syntax tree, mirroring lang-core's
ASTNode. - BinOpNode
- BoolNode
- CompiledSchema
- The library schema compiled for parsing: component params by name, and the call registry (built-ins plus library functions and actions).
- CompNode
-
A call: a component, a built-in or library
@function, an action step,Action([...]),QueryorMutation. - CustomStep
-
A library action call such as
@CopyToClipboard(text). Only an evaluated call creates one, so data cannot pose as a custom action. - ElementNode
- A component instance after materialization or evaluation.
- EvaluationContext
- What evaluation reads from: state, statement refs, library calls.
- IndexNode
- MemberNode
- MutationNode
-
lang-core
MutationNode: a Mutation statement and the tool it runs. - MutationStatementInfo
- NullNode
- NumNode
- ObjNode
- OpenUrlStep
- ParseMeta
- Parser
-
lang-core
Parser: parses whole programs against one library schema. - ParseResult
- PlaceholderNode
- A placeholder for a reference that did not resolve (yet).
- PromptEntry
- One line of the prompt: a component, function or action signature.
- PromptGroup
- PromptSpec
-
Everything lang-core's
generatePromptreads. - PromptTool
-
A tool the program may call from
Query/Mutation, as the prompt shows it. - QueryManager
-
lang-core
createQueryManager: fetches Query tools, caches by tool + args + state deps, serves defaults until data arrives, and runs Mutations on demand. - QueryNode
- A Query statement evaluated against the current state.
- QuerySnapshot
-
lang-core
QuerySnapshot: every statement's data plus loading, refetching and error lists. - QueryStatementInfo
- RawStatement
- ReactiveAssign
-
A two-way binding: writing
$valueruns expr and stores the result in target. Bound inputs receive this instead of the state's value. - RefNode
-
A reference to another statement, or an
@Eachloop variable. - ResetStep
- RunStep
- RuntimeFunction
-
A library
@functionas the runtime calls it. - RuntimeRefNode
- SetStep
-
StateField<
T> -
lang-core
StateField: a form field's value and setter, bound to a$variableor held by the form. - StateRefNode
- Store
-
lang-core
createStore:$variablesand form fields. Keys still at their declared default are pristine and follow new defaults while the program streams; a key the user changed keeps its value. - StreamParser
- lang-core's streaming parser: caches completed statements and re-parses only the pending tail on each update.
- StrNode
- TernaryNode
- ToAssistantStep
- Token
- UnaryOpNode
- ValidationError
- ValueNode
-
A runtime value spliced into an
@Eachtemplate that has no literal form (a component, an action, a binding); it evaluates to itself.
Enums
Constants
-
actionSteps
→ const Map<
String, String> -
lang-core
ACTION_STEPS: each built-in step's runtime step type.
Functions
-
astFromJson(
Map< Object?, Object?> json) → Ast - The node of lang-core's JSON form (Ast.jsFields as JSON).
-
autoClose(
String input) → ({String text, bool wasIncomplete}) -
lang-core
autoClose: closes unclosed strings and brackets of a partial program so it parses. -
buildSignature(
String componentName, Map< String, Schema> props) → String -
lang-core
buildSignature: a component's prompt signature, such asCard(title: string, subtitle?: string). -
createParser(
JsonSchema schema, {String? rootName}) → Parser -
lang-core
createParser; passlibrary.toJsonSchema(). -
createQueryManager(
ToolProvider? toolProvider) → QueryManager -
lang-core
createQueryManager. -
createStreamingParser(
JsonSchema schema, {String? rootName}) → StreamParser -
lang-core
createStreamingParser; passlibrary.toJsonSchema(). -
enrichErrors(
List< ValidationError> validationErrors, Map<String, Object?> schema, List<String> componentNames) → List<OpenUiError> -
lang-core
enrichErrors: parser validation errors as OpenUiErrors with fix hints. -
evaluate(
Ast node, EvaluationContext ctx, [IsReactiveProp? reactive]) → Object? -
lang-core
evaluate.reactiveis lang-core's schema context: present when evaluating props for rendering. -
evaluateElementProps(
ElementNode el, EvaluationContext ctx, IsReactiveProp reactive, List< OpenUiError> errors) → ElementNode -
lang-core
evaluateElementProps: evaluates each prop, reporting a failure toerrorsinstead of throwing. -
evaluateRoot(
ParseResult result, EvaluationContext ctx, IsReactiveProp reactive, List< OpenUiError> errors) → ElementNode? -
lang-core
evaluateRoot: the root element, or the component a runtime entry picks; null if none. -
generatePrompt(
PromptSpec spec) → String -
lang-core
generatePrompt. -
generateSystemPrompt(
OpenUiLibrary library, [PromptOptions options = const PromptOptions()]) → String -
lang-core
generateSystemPromptfor a library: OpenUiLibrary.systemPrompt. For OpenUI Cloud's config block usecloudSystemPrompt. -
isAstJson(
Object? value) → bool -
lang-core
isASTNodefor a JSON value: a map with a knownk. -
isElementNodeJson(
Object? value) → bool -
lang-core
isElementNodefor a JSON value. -
jsonToOpenUI(
Object json, OpenUiLibrary library, {Map< String, Object?> ? stateDeclarations}) → String -
lang-core
jsonToOpenUI: an element tree back to program text thatmergeStatementsaccepts.jsonis an ElementNode (a parse result's root) or its JSON form (ElementNode.toJson). -
mergeStatements(
String existing, String patch, [String rootId = 'root']) → String -
lang-core
mergeStatements: patch statements replace existing ones by name,name = nulldeletes one, and statements no longer reachable fromrootIdare dropped ($stateis always kept). -
parse(
String input, CompiledSchema schema, [String? rootName]) → ParseResult -
lang-core
parse: one complete (or partial) program against a compiled schema (CompiledSchema.fromJsonSchema(library.toJsonSchema())). -
parseExpression(
List< Token> tokens) → Ast -
lang-core
parseExpression: a Pratt parser over one statement's tokens. -
resolveStateField<
T> (String name, Object? bindingValue, Store? store, EvaluationContext? context, Object? fieldGetter(String fieldName), void fieldSetter(String fieldName, Object? value)) → StateField< T> -
lang-core
resolveStateField: a$binding(ReactiveAssign) reads and writes the store, running its expression with$value; any other field readsfieldGetter(falling back tobindingValue) and writesfieldSetter. -
split(
List< Token> tokens) → List<RawStatement> -
lang-core
split: one statement peridentifier = expressionline, with newlines inside brackets and before a ternary's?/:ignored. -
stripReactiveAssign(
Object? value, EvaluationContext ctx) → Object? -
lang-core
stripReactiveAssign: a binding read as its current state value. -
tokenize(
String src) → List< Token> -
lang-core
tokenize. -
walkAst(
Ast node, void visit(Ast node)) → void
Typedefs
- IsReactiveProp = bool Function(String component, String prop)
-
Whether a component's prop is a
$binding(two-way) prop. -
JsonSchema
= Map<
String, Object?> -
MutationResult
= Map<
String, Object?> -
lang-core
MutationResult:{status: "idle" | "loading" | "success" | "error", data?, error?}. -
ToolCaller
= Future<
Object?> Function(String name, Map<String, Object?> args) -
Calls a tool by name: what
QueryandMutationrun. - ToolProvider = ToolCaller
-
lang-core
ToolProvider: what a QueryManager calls tools with.