Skip to content

Web component API

The widget is one custom element, <diosc-chat>. The embed loader mounts it for you; in a framework app you render it yourself. Configuration beyond the attributes below is set with diosc('config', …).

AttributeDescription
api-keyYour embed key.
backend-urlThe DioscHub backend URL.
assistant-idThe assistant to load. Resolved from the embed key when omitted.
bind-endpointThe host’s BYOA bind endpoint. The kit POSTs here when it needs to bind identity.
modefab (default) for the floating launcher, or embed for an inline, container-anchored panel.
positionbottom-right (default) or bottom-left. Ignored in embed mode.
embed-min-width-pxMinimum container width (default 320) below which the embed frame shows a too-narrow placeholder. Ignored in fab mode.
<diosc-chat api-key="YOUR_EMBED_KEY" backend-url="https://your-hub.example.com"></diosc-chat>

When you embed via the loader script, you don’t set these by hand. The loader resolves them from your embed key and mounts the element for you.

Most of these can also be set with diosc('config', …). Set bind-endpoint as an attribute rather than through config: an attribute lands before auto-connect dispatches the bind, so it avoids a config/connect race.

mode="embed" requires the embeddedPanelMode capability (Enterprise tier). Without it the element renders nothing.

Subscribe with diosc('on', event, handler), or to all events with diosc('onAny', handler).

EventFires whenPayload
authenticatedThe connection is authenticated.
disconnectedThe connection drops.
reconnectedThe connection is re-established.
rate_limitedA request is rate-limited.
auth:refreshedThe session credential is refreshed.
auth:failedAuthentication fails.
auth:requiredThe server asks the kit to (re)bind identity via the host bind endpoint.{ reason: 'initial' | 'host_invalidate' | 'expired' | 'mcp_auth_fail' }
bind:readyA host bind landed. Carries the bound identity (or null for anonymous), role feature flags, and the REST token.{ identity, features, suggestions?, restToken, restTokenExpiresAt }
features:updateThe bound role’s feature flags change while connected (e.g. an admin edits the role).{ features, suggestions? }
rest_token:rotateThe server pushes a fresh REST token before the current one expires.{ restToken, restTokenExpiresAt }
EventFires when
session:startedA new session begins.
session:joinedThe client joins a session.
session:loadedA session is loaded.
session:restored / session:restore_failedA prior session is (or isn’t) restored.
session:invalidA restore is rejected because the session isn’t owned by the bound identity — the kit drops the persisted token and starts fresh. Payload: { code, message }.
session:listThe session list arrives.
session:renamed / session:pinnedA session is renamed or (un)pinned.
session:path_changedThe session’s page context changes.
session:state_changedSession state changes.
session:user_changedThe session’s user identity changes.
session:upgradedAn anonymous session is promoted in place to an authenticated one (the visitor signed in).
session:errorA session-level error occurs.
EventFires when
stream:startThe assistant begins responding.
stream:chunkA chunk of the response arrives.
stream:endThe response completes.
EventFires when
tool:started / tool:completed / tool:failedA tool call starts, completes, or fails.
approval:requestA gated tool call is awaiting approval.
EventFires when
content_blockedA response is blocked by content rules.
files:updatedThe session’s files change.
EventFires whenPayload
quota:statusThe message quota state updates.{ used, limit, windowExpiresAt, percentUsed, blocked, warning }
quota:exceededA request is refused because the quota is spent.{ used, limit, windowExpiresAt, percentUsed, blocked, warning }
context:statusThe model’s context-window fill updates.{ used, limit, percentUsed, warning, critical, modelId }

These events drive client-side tools — the kit runs the request against the host page and returns the result.

EventFires whenPayload
browser:read_pageThe assistant requests the current page.
browser:navigateThe assistant requests a navigation.{ params: { path } }
browser:browser_intentThe assistant calls a host-declared browser adapter intent.{ intentName, args? }