Interface DesignerAiContext
- All Superinterfaces:
AiContext
Designer-scoped facade for AI features. Reached through
DesignerContext.getAiContext(),
which returns empty when AI is not enabled in the Designer; once a caller holds one of these,
every accessor is non-empty and ready to use.
UI hosts mount AI through assistant() — a fluent builder whose terminals hand back an
inline AssistSession or a popup-anchored button, each returning empty until isReady(). Hosts that need to wire a session or AssistAction by hand can drop down to
embedFactory(), taking on the readiness gate themselves.
-
Nested Class Summary
Nested classes/interfaces inherited from interface AiContext
AiContext.HarnessBuilder, AiContext.ProvidedModel -
Method Summary
Modifier and TypeMethodDescriptionagents()default EmbeddedAssistantBuilderThe default model for this context, if one is configured.booleanisReady()onReadyChange(Runnable listener) Register a callback fired wheneverisReady()may have changed.tools()Methods inherited from interface AiContext
getModelProviders, newAgenticHarness, newAgenticHarness
-
Method Details
-
getDefaultModel
Optional<AiContext.ProvidedModel> getDefaultModel()The default model for this context, if one is configured. The Designer reads its in-memory catalog, so this never throws.- Specified by:
getDefaultModelin interfaceAiContext- Returns:
- the default model for this context, or empty when none is configured.
-
embedFactory
AssistEmbedFactory embedFactory()- Returns:
- the factory for
AssistSessions — the popup-agnostic chat surface a host mounts inside its own UI. Most hosts reach sessions throughassistant()instead; this remains for hand-wired integrations, which must gate onisReady()themselves.
-
assistant
- Returns:
- a fluent builder for mounting an embedded "Ask AI" assistant against this context — the
preferred entry point over wiring
embedFactory()orAssistActionby hand. SeeEmbeddedAssistantBuilderfor usage.
-
isReady
boolean isReady()- Returns:
- whether the catalog currently has a configured provider and model. When false,
EmbeddedAssistantBuilder's terminals return empty andAssistAction-bound buttons render as disabled.
-
onReadyChange
Register a callback fired wheneverisReady()may have changed. The callback runs on whatever thread the catalog notifies on; UI consumers must marshal to the EDT before touching Swing state.- Returns:
- a runnable that unregisters the listener. Callers tie this to the lifetime of whatever
reacts to readiness (e.g. the hierarchy listener installed by an
AssistAction-bound button).
-
tools
DesignerToolFactory tools()- Returns:
- the factory for Designer-side
ToolBundles — the read-only system-library, user-library, and tag-configuration browsers every assist agent commonly reaches for.
-
agents
PlatformAgentFactory agents()- Returns:
- the factory for baseline
Agents wired to Designer-side state — e.g. the Jython scripting agent. - See Also:
-
promptAssists
PromptAssistFactory promptAssists()- Returns:
- the factory for the reusable
@-reference browsers hosts mount throughEmbeddedAssistantBuilder.promptAssists(PromptAssist...).
-