Record Class EmbedHost

java.lang.Object
java.lang.Record
com.inductiveautomation.ignition.designer.ai.embed.EmbedHost
Record Components:
composer - turns each user submission plus host state into the message body sent to the agent.
rendererFactory - builds the per-session ReplyRenderer; receives a runnable the renderer fires after a successful host write-back so mounters (e.g. the popup-anchored trigger) can react.

public record EmbedHost(PromptComposer composer, ReplyRendererFactory rendererFactory) extends Record
Host-side strategies an embedded AI assistant uses to talk to its surrounding UI: how to turn each user submission into a message body and how to render replies into the suggestion card. Pass an EmbedHost to EmbeddedAssistantBuilder.host(EmbedHost) to wire up a session. Non-text hosts compose one via builder() (or the assistant builder's host(Consumer) overload) with their own composer/renderer; text-editor hosts can build a standard one via forTextEditor(TextlikeComponent) or forTextEditorWithInsert(TextlikeComponent).
  • Constructor Details

  • Method Details

    • builder

      public static EmbedHostBuilder builder()
      Returns:
      a fluent builder for a host with a custom composer and renderer. Prefer forTextEditor(TextlikeComponent) / forTextEditorWithInsert(TextlikeComponent) for plain text editors.
    • forTextEditor

      public static EmbedHost forTextEditor(TextlikeComponent component)
      Builds a replace-only host for a text-editor component. The composer wraps the editor's snapshot in <editor>/<selection> blocks; the reply renderer's Replace button overwrites the host buffer via TextlikeComponent.setText(String). Suited to small editors (single-statement expressions, short bindings) where the buffer is the unit of work.
      Parameters:
      component - the editor wrapper. Must expose a non-null TextlikeComponent.getEditorState(); verified eagerly so wrappers like TextLikeComboBox fail at hook-up rather than at the first user submit.
      Throws:
      IllegalArgumentException - if component doesn't expose an editor state snapshot.
    • forTextEditorWithInsert

      public static EmbedHost forTextEditorWithInsert(TextlikeComponent component)
      Variant of forTextEditor(TextlikeComponent) that adds a secondary Insert button to the suggestion card. The button writes back through TextlikeComponent.insert(String), dropping the suggested code at the host's caret (replacing any active selection). Suited to multi-line script editors where users routinely splice suggestions into existing code rather than wholesale-replacing the buffer.
      Parameters:
      component - the editor wrapper. Same shape requirement as forTextEditor(TextlikeComponent).
      Throws:
      IllegalArgumentException - if component doesn't expose an editor state snapshot.
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • composer

      public PromptComposer composer()
      Returns the value of the composer record component.
      Returns:
      the value of the composer record component
    • rendererFactory

      public ReplyRendererFactory rendererFactory()
      Returns the value of the rendererFactory record component.
      Returns:
      the value of the rendererFactory record component