<char-agent>
<char-agent> custom element.
Creates an iframe pointing to the SaaS app’s /embed/ entrypoint and relays
auth, styles, dark mode, display mode, and MCP messages via postMessage.
Uses a unified char-context message with diffing (only changed fields
are sent) instead of separate messages per concern.
Registration and import
Auth and connection helpers
Attributes
Properties
Methods
setAuth(options: ConnectOptions | null): void
Convenience method for declarative wrappers.
Applies auth when provided, otherwise clears auth.
Parameters:
options(ConnectOptions | null): Auth payload to connect, ornullto disconnect.
void
connect(options: ConnectOptions): void
Connect to the Char agent with authentication.
The token is stored as a JavaScript property (not as a DOM attribute),
preventing exposure to DOM inspection and session replay tools.
Parameters:
options(ConnectOptions): Authentication payload.
void
disconnect(): void
Disconnect from the Char agent.
Clears pending auth state and posts a disconnect message to the iframe.
Returns: void
setHostContext(hostContext: CharHostContext): void
Update the host context sent to the iframe.
Only changed fields are transmitted (diffing pattern).
Parameters:
hostContext(CharHostContext): Partial host context patch to merge and emit.
void

