AIUIComponentContext

class AIUIComponentContext(val messageId: String, val isStreaming: Boolean, val host: AIUIHost, uriHandler: UriHandler, emit: (event: String, label: String, payload: Map<String, Any?>) -> Unit)

What a component gets besides its arguments: which reply it is in, and how it tells the agent what the person did.

Parameters

messageId

The reply the component is in.

isStreaming

Whether the agent is still writing the reply's UI, so the arguments may still change.

host

The conversation's host, for running the app's tools and keeping state.

uriHandler

Opens the links openUrl lets through, such as the composition's LocalUriHandler.

emit

Sends an event to the agent the way the renderer's format does.

Constructors

Link copied to clipboard
constructor(messageId: String, isStreaming: Boolean, host: AIUIHost, uriHandler: UriHandler, emit: (event: String, label: String, payload: Map<String, Any?>) -> Unit)

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard
fun emit(event: String, label: String, payload: Map<String, Any?> = emptyMap())

Tells the agent about one of the component's events, as the person's next message.

Link copied to clipboard

Opens a link, when the host lets links of its kind open (see AIUIHost.canOpen).