UI Registry (Assistant.js)
UI Registry (Assistant.js)
UI Registry (Assistant.js)
The registry object from ./Assistant.js provides methods for creating interactive tools and dynamic instructions that the AI assistant can use to interact with your HTML interface in User Interface assets.
Use registry.addTool() to create tools that the AI assistant can invoke to interact with your UI:
Each tool requires the following configuration:
type: "object" with properties to define parameter structurerequired array for mandatory parameters"string", "number", "boolean", "array", "object"enum arrays for restricted value setsIn addition to tools, the registry supports adding dynamically updatable instructions to the model context using addInstruction. Use this to stream concise, structured state into the assistant’s system prompt.
"updateField", "submitForm", "toggleVisibility")Tools should return objects that indicate success or failure:
{ success: true, result: data } or { success: true, data: formData }{ success: false, error: "Error message" }When creating form-based interfaces:
id attributes for form elements