# XWUISuperRuntime

The context host every other `XWUISuper*` component reads from. It takes one
`XWUISuperContext` - workspace identity, session identity, a service registry, a
command registry, an event bus, a logger and an `authorize()` function - and
mounts your application beneath it, so a super app and its page factories all
receive the same typed adapters instead of reaching for globals.

It is deliberately thin: it renders a title, an optional service-health strip
and a mount host. The application is whatever `config.mount` builds.

## When to use

- Wrapping an `XWUISuperApp` (or any super hub) so the whole tree shares one
  injected context rather than one ad-hoc adapter per component.
- Any surface where authorization must be answered by the host, not guessed by
  the UI.
- Showing users why a screen is degraded: pass `serviceDescriptors` and the
  health strip reports which backing service is `available`, `degraded`,
  `unavailable` or `unknown`.

If you only need one provider-driven list, the hub components take a `context`
directly and do not need this wrapper. Reach for `XWUISuperRuntime` when more
than one component must agree on the same context.

## Configuration surface

Build the context with `createXWUISuperContext(options)`, whose `options` are
`workspace` (required), `session`, `services` (an id -> implementation record),
`serviceDescriptors` (what the health strip shows), `commands`, `events`,
`logger` and `authorize`.

`config` then accepts:

- `context` - the `XWUISuperContext` handed to the mount callback and to every
  descendant that asks for one.
- `mount(host, context)` - builds the application into the supplied host and
  optionally returns the `XWUIComponent` so the runtime can destroy it with the
  page.
- `autoMount` - mount on connect (default) or defer to an explicit call.
- `showServiceHealth` - show or hide the service strip.
- `title`, `className` - chrome.

`data` carries `services` (the descriptor list rendered by the strip),
`loading` and `error`, the last as an `XWUISuperStructuredError` with `code`,
`message`, `remediation` and `retryable`.

Authorization is fail-closed by design: components call
`context.authorize({ capability })` and a missing authorizer denies. Do not
paper over that with a permissive stub - supply the real decision function, or
leave the capability off the action.

## Runtime context

Inject workspace, session, authorization, service, command, event and logging
adapters once; the child super app and its page factories receive the same
typed context.

```example
file: examples/BasicUsage.ts
html: examples/BasicUsage.html
title: Runtime context
description: One injected context feeding an XWUISuperApp and its page factories.
```

## Workspace OS

Every provider-driven super workspace mounted behind one `XWUISuperApp` shell
and one injected `XWUISuperRuntime` context. The example uses small in-memory
providers; a production host swaps in API, SDK, worker or local-store adapters
without touching the components.

```example
file: examples/WorkspaceOS.ts
html: examples/WorkspaceOS.html
title: Workspace OS
description: All super workspaces behind one shell and one injected runtime context.
```

```api
```
