Class SystemLibraryPromptAssist

java.lang.Object
com.inductiveautomation.ignition.designer.ai.embed.LibraryPromptAssist
com.inductiveautomation.ignition.designer.ai.embed.SystemLibraryPromptAssist
All Implemented Interfaces:
PromptAssist

public final class SystemLibraryPromptAssist extends LibraryPromptAssist
LibraryPromptAssist over Ignition's system.* scripting library, letting the user drop a reference to a system function, constant, or whole package into an AI prompt.

The assist browses relative to the system root: the LibraryPromptAssist.label() ("System") stands in for that root, so inserts produce @system:<path> tokens whose path omits the leading system. (e.g. @system:tag.readBlocking). The body's Path: line carries the full callable name (system.tag.readBlocking).

The default hints tree is the Designer's own (CommonContext.getScriptManager()); pass an explicit supplier for another scope. The supplier is consulted on every browse, off the EDT, so a remotely-backed supplier must memoize.

  • Constructor Details

    • SystemLibraryPromptAssist

      public SystemLibraryPromptAssist(DesignerContext context)
      Browses the Designer's own hints tree — the Designer-scope view of system.*.
    • SystemLibraryPromptAssist

      public SystemLibraryPromptAssist(Supplier<PackageTreeNode> treeSupplier)
      Browses the system package of whatever PackageTreeNode the supplier returns. The supplier is consulted on every browse, so the assist tracks the tree as it fills in — pass a scope-specific tree here to surface a scope other than the Designer's.
  • Method Details

    • agentContext

      public Optional<String> agentContext()
      Description copied from interface: PromptAssist
      Self-description appended to the embedded agent's system prompt. The embed concatenates the fragments from every mounted assist into a single addendum so each provider documents its own token shape and reference-body schema in one place, decoupled from any specific agent's translation rules. Fragments are expected to be Markdown; the embed adds a heading for each assist using PromptAssist.label() and joins them with blank lines.

      The embed's framing already tells the model every token is shaped @<id>:<path> and announces this assist's @<id>: prefix in its section heading, so the fragment should not restate the generic shape. It should cover:

      • the grammar of the <path> portion, with a concrete example token;
      • the schema of the <reference token="...">body</reference> body the embed will attach when one of those tokens appears — the line names (Path:, Type:, …) the agent should look for and what they mean;
      • a one-line statement of what the reference represents semantically (so the agent can reason about it without knowing this assist exists).
      Fragments should stay host-language-agnostic — say what the reference is, not how to spell it in a particular tool's syntax. The hosting agent's own system prompt is responsible for translating the body's identifier into whatever expression/script/query syntax it speaks.
      Returns:
      the Markdown fragment, or Optional.empty() when the assist has nothing to contribute (e.g. unit-test stubs).
    • library

      protected ScriptLibrary library()
      Description copied from class: LibraryPromptAssist
      The library this assist browses. Called on every LibraryPromptAssist.options(String) invocation, off the EDT; a ScriptLibrary is a cheap fixed view, so implementations build one against their source's current state per call.
      Specified by:
      library in class LibraryPromptAssist
    • callablePath

      protected String callablePath(String path)
      Description copied from class: LibraryPromptAssist
      Maps a browse path to the fully-qualified name a script invokes the symbol by, carried in the insert body's Path: field. Identity by default; override when the library is browsed relative to an implicit root.
      Overrides:
      callablePath in class LibraryPromptAssist
    • packageDocumentation

      protected @Nullable String packageDocumentation(com.inductiveautomation.ignition.common.script.typing.CompletionDescriptor descriptor)
      Description copied from class: LibraryPromptAssist
      The package's own documentation, carried in a package reference body's Documentation: field. The descriptor's computed description by default; return null to omit the field, as a library whose package descriptors carry synthetic text should.
      Overrides:
      packageDocumentation in class LibraryPromptAssist