Class EventScriptPromptComposer

java.lang.Object
com.inductiveautomation.ignition.designer.scripteditor.workspace.ai.EventScriptPromptComposer
All Implemented Interfaces:
PromptComposer

public final class EventScriptPromptComposer extends Object implements PromptComposer
Contributes the event-script tab's live state as the leading blocks of each assistant message:
<enabled>true</enabled>
<triggerConfig>
{ "thread": "shared", ... }
</triggerConfig>
<editor>
(the extension function body)
</editor>
<selection>highlighted substring</selection>

The framework appends the canonical references block and the user's prompt after these blocks.

A tab that pins its checkbox omits <enabled>, and one with no trigger omits <triggerConfig>. EventScriptReplyRenderer.payloadInstructions(EventScriptTabState) names whichever blocks a tab carries off the same state this composer reads, so a block and its description move together.

The state is snapshotted on every compose(String, List): the popup is non-modal, so the panel may have changed since the last submit.

  • Constructor Details

    • EventScriptPromptComposer

      public EventScriptPromptComposer(Supplier<EventScriptTabState> snapshot)
      Parameters:
      snapshot - returns the tab's live state on each compose(String, List) call. Must snapshot inside the supplier: retries replay it and need fresh state.
  • Method Details

    • compose

      public CompletableFuture<String> compose(String userPrompt, List<ContextReference> references)
      Description copied from interface: PromptComposer
      Builds the host-context blocks for one user submission. The framework appends the canonical references block and the user's prompt after whatever this returns.
      Specified by:
      compose in interface PromptComposer
      Parameters:
      userPrompt - the text the user typed into the prompt box, including any inline reference tokens (e.g. @tag:[default]Tank/Level) that match entries in references. Provided so composers can adapt their context to the request; implementations must not append it to their output — the framework places it.
      references - references the user inserted via the autocomplete popup, each with its body already resolved. Empty when the user inserted no references — or when no PromptAssists were supplied to the session. Provided so composers can load extra context keyed off a reference (e.g. OPC grounding); implementations must not render the references themselves — the framework emits the canonical block.
      Returns:
      a future completing with the host-context blocks, or the empty string when the host has nothing to contribute. Sync composers return CompletableFuture.completedFuture(Object); composers that defer slow reads return a future they complete on a worker thread.