Skip to content

zidane-ui/onboarding/testing/contract

import { … } from 'zidane-ui/onboarding/testing/contract'ui/src/onboarding/testing/contract.ts

Functions#

describeOnboardingHostContractFunction#

Declares the shared OnboardingHost suite for one implementation.

TypeScript
function describeOnboardingHostContract(
  name: string,
  makeHarness: OnboardingHostHarnessFactory,
  capabilities: readonly OnboardingHostCapability[],
): void
Parameters
NameTypeDescription
namestring

The implementation's name, shown in the suite title.

makeHarnessOnboardingHostHarnessFactory

Builds a fresh host over a backend that holds and records what it is given, once per test.

capabilitiesreadonly OnboardingHostCapability[]

The optional members the host offers. Every other optional member must be undefined.

ui/src/onboarding/testing/contract.ts:237

Interfaces#

OnboardingContractModelInterface#

A model the backend serves, as its listing names it.

TypeScript
interface OnboardingContractModel
OnboardingContractModel properties
NameTypeDescription
idstring

Model id.

labelstring

Display name.

reasoningboolean

It takes a reasoning effort.

ui/src/onboarding/testing/contract.ts:68

OnboardingHostContractBackendInterface#

What the backend behind the host holds, and what it records.

TypeScript
interface OnboardingHostContractBackend
OnboardingHostContractBackend properties
NameTypeDescription
connectorsstring[]

The ids of the connectors already installed. A connector added reaches connectorAdded.

extensionsstring[]

The names of the native extensions installed.

failingstring[]

Provider keys whose key, sign-in and test fail.

githubTokenstring | null

The GitHub token the backend already knows.

importPreviewOnboardingImportPreview

What an import from Claude Code brings over.

installProgressstring[]

What an install reports while it runs, one line at a time.

modelsRecord<string, OnboardingContractModel[]>

The models each provider serves, by provider key.

providersOnboardingProvider[]

The providers and their status. Read at each listing; a saved key or a finished sign-in marks one ready.

settingsPartial<Settings>

The stored settings: what the run starts from.

skillListingsReadonly<Record<string, SkillSourceListing>>

The skill sources a browse lists, by what the user typed.

skillsstring[]

The names of the skills installed.

committed(settings: Partial<Settings>) => void

The backend calls this with the settings a finished run writes.

connectorAdded(id: string) => void

The backend calls this when a connector's server is added: its id joins connectors.

extensionInstalled(name: string) => void

The backend calls this when a native extension is installed: its name joins extensions.

imported(selection: OnboardingImportSelection) => void

The backend calls this when an import runs.

keySaved(key: string, value: string | undefined) => void

The backend calls this when a key reaches it: the provider turns ready.

signedIn(key: string) => void

The backend calls this when a browser sign-in of a provider finishes: the provider turns ready.

skillsInstalled(source: string, rels: readonly string[]) => void

The backend calls this when skills of a source are installed: their names join skills.

ui/src/onboarding/testing/contract.ts:78

OnboardingHostHarnessInterface#

A host built over a contract backend, and what its backend can push.

TypeScript
interface OnboardingHostHarness
OnboardingHostHarness properties
NameTypeDescription
hostOnboardingHost

The host under test.

dispose?() => void

Stops sign-ins, listeners and connections after each test.

finishSignIn?(id: string) => void

The browser came back for a sign-in that takes no typed answer. Absent: every sign-in the host offers takes submit.

ui/src/onboarding/testing/contract.ts:118

Types#

OnboardingHostCapabilityType#

An optional OnboardingHost member, by its path.

TypeScript
type OnboardingHostCapability =
  | 'providers.saveKey'
  | 'providers.signIn'
  | 'providers.test'
  | 'providers.models'
  | 'imports'
  | 'connectors'
  | 'connectors.signIn'
  | 'connectors.githubToken'
  | 'skills'
  | 'skills.images'
  | 'extensions'
  | 'themes'
  | 'appIcons'

ui/src/onboarding/testing/contract.ts:36

OnboardingHostHarnessFactoryType#

Builds a fresh host (and its backend) for one test.

TypeScript
type OnboardingHostHarnessFactory = (backend: OnboardingHostContractBackend) => OnboardingHostHarness | Promise<OnboardingHostHarness>

ui/src/onboarding/testing/contract.ts:128