---
id: assistant/assistant-surface
title: Assistant surface and settings
summary: Configure an assistant runtime for one application surface and expose its chat and settings elements through ordinary pages and placements.
keywords: ai, assistant, chat, config, environment, page, placement, settings, surface
requires: @jskit-ai/assistant-runtime, @jskit-ai/shell-web, @jskit-ai/connectors-catalog, @jskit-ai/connectors-core
---

# Assistant surface and settings

## Use when

Use this pattern when an application should expose JSKIT's assistant runtime on
an enabled surface and provide a settings page for that assistant.

## Do not use when

Do not use this pattern for an application that only needs a single
server-to-model call, or when the product has no conversational surface. Do not
copy the assistant runtime's repositories or transport into application code.

## Product decisions

Choose the runtime surface, settings surface, global or workspace configuration
scope, page routes, placement roles, AI provider, model policy, and whether the
assistant begins disabled until credentials are supplied. Never put an API key
in source or a questionnaire transcript.

## Invariants

- Both configured surfaces exist and are enabled.
- Workspace configuration is used only when both surfaces require a workspace.
- Each runtime surface appears once in `assistantSurfaces` and
  `assistantServer`.
- The server config selects an AI integration ID, never a credential value.
- The application publishes an authorized `integrations.ai` resolver capability.
- Changing the assistant's instructions needs `workspace.settings.update` on a
  workspace settings surface, the console owner on a console-owner surface and
  `assistant.settings.update` on any other, unless
  `assistantServer.<surface>.settingsUpdatePermission` names the permission the
  application's administrators hold. Reading them needs only a signed-in user.
- Runtime and settings pages use the public assistant elements.
- Environment values are supplied through the application's normal secret
  environment boundary.
- No generator markers, setup receipts, or overwrite state remain.

## Framework APIs

Use `AssistantSurfaceClientElement` and `AssistantSettingsClientElement` from
`@jskit-ai/assistant-runtime/client`. Install the runtime package through the
normal package-capability path. Install `@jskit-ai/resource-runtime` and
register `AssistantStoreFeature` from `@jskit-ai/assistant-runtime/server` in
the ordinary server feature list; it owns the assistant's tables and provides the
repositories the database-backed surface uses. Configure `assistantSurfaces` in
public config and `assistantServer` in server config.

## Example files

`example/` contains concrete public/server config, assistant and settings pages,
semantic placements, an AI integration and its server resolver for an `admin` surface.
Install `@jskit-ai/connectors-catalog` and `@jskit-ai/connectors-core` and register
`ApplicationAiFeature` in the ordinary server feature list. Set its application ID
and AI-use policy. The example selects Z.AI's GLM-4.7-Flash with a regular Z.AI key
in `APP_AI_API_KEY`; choose the application's own provider, model and key.
Provider availability is independent of configuration. Adapt the complete files to the
application's existing config and placement registries.

## Variation points

Change surface ids, settings location, config scope, AI integration IDs, routes,
labels, icons, and placement targets. A workspace-scoped application must retain
the current workspace in both routes and assistant requests through the runtime's
public workspace support.

## Verification

- load both pages through their normal navigation
- verify the configured surface and settings target agree
- verify missing credentials disable assistant calls without exposing secrets
- exercise one successful and one provider-error conversation
- verify global or cross-workspace isolation, whichever applies
- run migrations, server/client tests, and focused browser coverage

## Avoid

- API keys or provider secrets in source
- a second model client beside the assistant runtime
- implicit surface selection
- workspace scope on a non-workspace surface
- copied runtime repositories, actions, or routes
- generator commands, question metadata, receipts, or provenance

## Presentation and view lifetime

The surface uses the same `AssistantConversationElement` as applications with
their own runtime. Use `layout="compact"` for a bounded drawer and the
`assistantLabel`, `welcomeMessage`, `placeholder`, and `showToolActivity` props
for presentation. Conversations remains available at all widths. Keep settings
on the configured settings route. Use the `composer-tools` slot for extra
application controls and `focus()` when opening a pane; do not target internal
DOM classes.

The runtime owns one draft and maps its stream statuses to the shared contract.
Typing remains possible during a response; Send waits. Unmounting or switching
workspace/surface aborts the local response and discards that view's state.
Reopening restores saved history, not a live stream. Stop cannot guarantee that
a server-side tool already running has stopped. Custom editor conversations
should use their own adapter and keep their existing operation/storage owner.

## Shared optional controls

The shared status row shows “Assistant is working…” before output and answers
stream as they arrive. Pass safe `connections: [{ id, label }]` with
`v-model:integration-id` to offer the shared model chooser; list every selectable
ID in server `aiIntegrationIds`. Use `configuration-mode="hidden"` for a supplied
fixed connection or `readonly` to show its fixed choice.

The optional `suggestions`, `attachments`, `goal` and `activity` props use the
embeddable conversation contract. Goals are disabled unless a real backend
scheduler is supplied. Suggestions use their own generator and agent policy.
File bytes and upload authorization belong to the app's `assistant.attachments`
resolver and upload routes. See the Assistant and Embeddable assistant
conversations guides for exact callback shapes.
