Package com.inductiveautomation.perspective.designer.ai
Package provides AI feature for Perspective's component script editors, namely:
- Component custom methods
- Message handlers
- Extension functions
- Property change scripts
- Script surfaces other modules contribute to the component Scripts editor through
ScriptCategoryProvider, such as the AI Chat's Agent Tools
PerspectiveScriptAssistMounter.attach(ExtensionFunctionPanel, PerspectiveScriptGrounding, Supplier) mounts
the "Ask AI" button on an editor's toolbar. It can be used to locate all surfaces this feature
is installed on.
PerspectiveScriptGrounding decides what the
agent knows — framing, read tools, @-reference sources.
PerspectiveScriptGrounding.TargetSnapshot
is taken when the editor window opens and records the type of the first component the window
writes to, plus how many components it writes to. For a window opened on Button1, it holds
ia.input.button and 1. The type is left unknown when the Designer selection isn't that
component.
PerspectiveScriptCallerContext holds the
specific text for the various script editors that's used in framing. It is retrieved through
PerspectiveScriptGrounding:
callerContextForwith aPerspectiveScriptSurfaceconstant, for custom methods and extension functions.messageHandlerCallerContext,propertyChangeCallerContext, orcomponentCallerContext, for surfaces that need live form state or that another module defines.
PerspectiveScriptPromptComposer re-reads the
framing and the locked def signature on every Send and puts them at the start of the message,
so the agent sees the editor as it is now, not as it was when the popup opened.
-
ClassDescriptionRead-only tools that expose context about the view, selection, and component graph in the Perspective designer to an LLM for agentic code completion.Attaches a shared "Ask AI" toolbar button to a Perspective component script surface — one of the
PerspectiveScriptSurfaceeditors, or another module's script surface bound to a Perspective component.Produces the AI grounding for one Perspective script-editing surface: the framing string that describes where the body lives, the read tools the agent can call for anything the framing does not carry, and the@-reference sources the prompt offers.What an editor window was opened on, captured once when the window is built — not when an editor panel inside it is built, since those are created lazily, after the selection may already have moved.A Perspective scripting surface whose Jython body an AI assist can be mounted on, and the key its framing is looked up by throughPerspectiveScriptGrounding.callerContextFor(PerspectiveScriptSurface)or, for the surfaces whose framing reads live form state, that surface's own variant.