Interface AssistEmbedFactory


public interface AssistEmbedFactory
Builds AssistSessions for a host. Reachable through DesignerAiContext.embedFactory(); the factory is popup-agnostic — the component can be anchored in a popup or mounted inline in any surface. Callers declare which shape they want at creation time so the panel can configure its ui and dismissal affordances up front.

Most hosts never call this directly: DesignerAiContext.assistant() wraps it (and the readiness gate) in a fluent builder. It stays public for hosts that wire a session or an AssistAction by hand — those callers own gating on DesignerAiContext.isReady().

  • Method Details

    • create

      Optional<AssistSession> create(Agent.AgentFactory agentFactory, EmbedHost host, List<PromptAssist> promptAssists, EmbedShape shape)
      Resolve the currently configured provider and model from the catalog and build a session that dispatches against them. Returns empty when the catalog has no configured provider or model — callers can subscribe to DesignerAiContext.onReadyChange(Runnable) to know when readiness flips, or simply read DesignerAiContext.isReady() before calling.
      Parameters:
      agentFactory - builds the Agent that powers each model turn.
      host - the host-side strategies the session uses to talk to the surrounding UI.
      promptAssists - assists that drive the in-prompt autocomplete popup. Pass an empty list to disable the popup entirely — but every production caller bundles at least one, so disabling is reserved for unit tests that don't exercise the assist surface.
      shape - declares how the session will be presented; the panel uses it to decide ui and dismissal affordances. See EmbedShape for the available shapes.
      Returns:
      a fresh session, or empty when no provider/model is configured.