Package com.inductiveautomation.perspective.designer.ai


@NullMarked 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:

  1. callerContextFor with a PerspectiveScriptSurface constant, for custom methods and extension functions.
  2. messageHandlerCallerContext, propertyChangeCallerContext, or componentCallerContext, 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.