| .. | ||
| icon.lua | ||
| plugin.lua | ||
| README.md | ||
Assistant Plugin Reference
This folder keeps the Lua manifest (plugin.lua) that defines a custom assistant. Treat it as the single source of truth for how AI Studio renders your assistant UI and builds the submitted prompt.
Structure
ASSISTANTis the root table. It must containTitle,Description,SystemPrompt,SubmitText,AllowProfiles, and the nestedUIdefinition.UI.Typeis always"FORM"andUI.Childrenis a list of component tables.- Each component table declares
Type, an optionalChildrenarray, and aPropstable that feeds the component’s parameters.
Supported types (matching the Blazor UI components):
TEXT_AREA: any user input field withName,Label,UserPrompt,PrefillText,IsSingleLine,ReadOnly.DROPDOWN: selects between variants;Propsmust includeName,Label,Default,Items, and optionallyValueTypeplusUserPrompt.SWITCH: boolean option; requiresName,Label,Value,LabelOn,LabelOff, and may includeUserPrompt.PROVIDER_SELECTION/PROFILE_SELECTION: hooks into the shared provider/profile selectors.WEB_CONTENT_READER: rendersReadWebContent; includeName,UserPrompt,Preselect,PreselectContentCleanerAgent.FILE_CONTENT_READER: rendersReadFileContent; includeName,UserPrompt.HEADING,TEXT,LIST: descriptive helpers.
Prompt Assembly
Each component exposes a UserPrompt string. When the assistant runs, AssistantDynamic iterates over RootComponent.Children and, for each component that has a prompt, emits:
context:
<UserPrompt>
---
user prompt:
<value extracted from the component>
For switches the “value” is the boolean true/false; for readers it is the fetched/selected content. Always provide a meaningful UserPrompt so the final concatenated prompt remains coherent from the LLM’s perspective.
Tips
- Give every component a unique
Name— it’s used to track state. - Keep in mind that components and their properties are case-sensitive (e.g. if you write
["Type"] = "heading"instead of["Type"] = "HEADING"the component will not be registered). Always copy-paste the component from theplugin.luamanifest to avoid this. - When you expect default content (e.g., a textarea with instructions), keep
UserPromptbut also setPrefillTextso the user starts with a hint. - If you need extra explanatory text (before or after the interactive controls), use
TEXTorHEADINGcomponents. - Keep
Preselect/PreselectContentCleanerAgentflags inWEB_CONTENT_READERto simplify the initial UI for the user.
The sample plugin.lua in this directory is the live reference. Adjust it, reload the assistant plugin via the desktop app, and verify that the prompt log contains the blocked context/user prompt pairs that you expect.