Skip to content

zidane-ui/chat/testing

import { … } from 'zidane-ui/chat/testing'ui/src/chat/testing/index.ts

Functions#

createFixtureComposerChromeFunction#

Creates the fixture's chrome members.

TypeScript
function createFixtureComposerChrome(
  options?: FixtureComposerChromeOptions,
): FixtureComposerChrome
Parameters
NameTypeDefaultDescription
options?FixtureComposerChromeOptions{}

What they hold. Leave a list out for the demo one.

ui/src/chat/testing/fixture-composer-chrome.ts:109

createFixtureComposerHostFunction#

Creates a FixtureComposerHost.

TypeScript
function createFixtureComposerHost(
  options?: FixtureComposerHostOptions,
): FixtureComposerHost
Parameters
NameTypeDefaultDescription
options?FixtureComposerHostOptions{}

What it holds. Leave a list out for the demo one.

ui/src/chat/testing/fixture-composer-host.ts:79

createFixtureHostFunction#

Creates a complete ChatHost over static data, held in memory. The kit's demos, docs, and tests run on it.

TypeScript
function createFixtureHost(fixture: ChatFixture, options?: FixtureHostOptions): ChatHost
Parameters
NameTypeDefaultDescription
fixtureChatFixture

The sessions, transcripts, models, and interactions to serve.

options?FixtureHostOptions{}

Whether the host is editable, how it replies to prompts, and the streaming pace.

ui/src/chat/headless/fixture-host.ts:67

createFixtureSidebarHostFunction#

Creates a SidebarHost held in memory.

TypeScript
function createFixtureSidebarHost(
  options?: FixtureSidebarHostOptions,
): FixtureSidebarHost
Parameters
NameTypeDefaultDescription
options?FixtureSidebarHostOptions{}

The environments, and which members to offer.

ui/src/chat/testing/fixture-sidebar-host.ts:55

Constants#

DEMO_AGENT_PROFILESConstant#

Demo agent profiles.

TypeScript
const DEMO_AGENT_PROFILES: readonly ComposerAgentProfile[]

ui/src/chat/testing/fixture-composer-chrome.ts:95

DEMO_COMPOSER_COMMANDSConstant#

Demo commands for the / popover.

TypeScript
const DEMO_COMPOSER_COMMANDS: readonly CommandSummary[]

ui/src/chat/testing/fixture-composer-host.ts:69

DEMO_COMPOSER_FILESConstant#

Demo files for the @ popover.

TypeScript
const DEMO_COMPOSER_FILES: readonly FileEntry[]

ui/src/chat/testing/fixture-composer-host.ts:62

DEMO_COMPOSER_MODELSConstant#

Demo chat models for the pickers.

TypeScript
const DEMO_COMPOSER_MODELS: readonly ComposerModelEntry[]

ui/src/chat/testing/fixture-composer-chrome.ts:66

DEMO_TRANSCRIPTConstant#

The showcase session: rate limiting a chat endpoint, then documenting and committing it. Used by the product displays; none of it is real.

TypeScript
const DEMO_TRANSCRIPT: ChatEvent[]

ui/src/chat/headless/fixtures/demo-transcript.ts:82

DEMO_TRANSCRIPT_ALL_KINDSConstant#

A synthetic two-exchange session that covers every transcript row kind. Used by the kit's tests and the gallery; none of it is real.

TypeScript
const DEMO_TRANSCRIPT_ALL_KINDS: ChatEvent[]

ui/src/chat/headless/fixtures/demo-transcript-all-kinds.ts:44

Interfaces#

ChatFixtureInterface#

Static data a createFixtureHost serves: sessions, their transcripts, models, and pending interactions.

TypeScript
interface ChatFixture
ChatFixture properties
NameTypeDescription
extras?ChatTranscriptFixture

The transcript extras (references, chips, card facts, badge actions, a shared search). Each part left out leaves its member out.

interactions?Record<string, InteractionRequest[]>

Requests already waiting, per session id.

models?ChatModelProvider[]

Providers and models for the model picker. Default: none.

sessionsChatSession[]

The sessions the list starts with.

transcripts?Record<string, ChatEvent[]>

Events per session id.

ui/src/chat/headless/fixture-host.ts:25

ChatTranscriptFixtureInterface#

Static data for the transcript extras.

TypeScript
interface ChatTranscriptFixture
ChatTranscriptFixture properties
NameTypeDescription
badges?{ effects: Readonly<Record<string, BadgeActionEffect>>; items: Readonly<Record<string, readonly BadgeMenuItem[]>> }

Badge items per folder, and the effect each item id answers.

blockRuns?{ exitCode: number; output: string }

Run here: what every block writes, and its exit code. Saved runs live in memory.

commands?Readonly<Record<string, readonly ChatCommandFacts[]>>

Commands per folder.

commits?Readonly<Record<string, ChatCommit>>

Commits by full sha.

contexts?Readonly<Record<string, ChatContextFacts>>

Context gauges by session id.

paths?Readonly<Record<string, Readonly<Record<string, ChatResolvedPath>>>>

What each text names, per folder (a text missing here names nothing).

references?{ providers: Readonly<Record<string, readonly ReferenceProviderWire[]>>; views: Readonly<Record<string, ExtensionReferenceView>> }

Reference providers per folder, and the views of their keys by providerId:key.

searchSync?boolean

Share the transcript search between the windows of this page (one host per window).

sessions?readonly ChatSessionFacts[]

The sessions #chat cards read.

siteIcons?Readonly<Record<string, string>>

Site icons (data URLs) by origin.

skills?Readonly<Record<string, readonly ChatSkillFacts[]>>

Skills per folder.

ui/src/chat/headless/fixture-transcript.ts:31

FixtureComposerChromeInterface#

The chrome members, with the controls a demo or a test plays.

TypeScript
interface FixtureComposerChrome extends Required<Pick<ComposerHost, 'controls' | 'models' | 'agents' | 'prefs' | 'pickerPrefs' | 'context' | 'runs'>>
FixtureComposerChrome properties
NameTypeDescription
agentsfrom RequiredComposerAgents

The agent profiles the agent picker offers.

contextfrom RequiredComposerContext

A session's context gauge, its breakdown and its settled cost.

controlsfrom RequiredComposerControls

The pickers' writes on a session (model, effort, options, agent) and their cache estimates.

modelsfrom RequiredComposerModels

The model catalogs the pickers list.

pickerPrefsfrom RequiredModelPickerPrefsStore

The model picker's per-device preferences. Absent: an in-memory store for the page's life.

prefsfrom RequiredComposerPrefs

Where picks are remembered across apps (effort and options per model, the next chat's model).

runsfrom RequiredComposerRuns

The current run's counters per session (the run chip, the cost pill).

runSignal(signal: RunMeterSignal) => void

The backend streams a run signal (run:start, stream:progress, turn:end, run:end).

ui/src/chat/testing/fixture-composer-chrome.ts:58

FixtureComposerChromeOptionsInterface#

What the fixture's chrome holds.

TypeScript
interface FixtureComposerChromeOptions
FixtureComposerChromeOptions properties
NameTypeDescription
agents?readonly ComposerAgentProfile[]

The agent profiles. Default: DEMO_AGENT_PROFILES.

cacheImpact?CacheImpact | null

What any switch costs the cache (null: unknown).

context?Record<string, { breakdown?: ContextBreakdown; cost?: ComposerCostStatus; status?: ComposerContextStatus }>

Each session's meters.

imageModels?readonly ImageModelRow[]

The image models.

models?readonly ComposerModelEntry[]

The chat models. Default: DEMO_COMPOSER_MODELS.

prefs?ComposerPrefsState

The remembered picks.

runProgress?Record<string, ComposerRunProgress>

Each session's run in progress.

sessions?Record<string, FixtureComposerSession>

Each session's picks (the controls write here).

ui/src/chat/testing/fixture-composer-chrome.ts:35

FixtureComposerHostInterface#

The fixture host, with the controls a demo or a test plays.

TypeScript
interface FixtureComposerHost extends Omit<ComposerHost, keyof FixtureComposerChrome>, FixtureComposerChrome
FixtureComposerHost properties
NameTypeDescription
agentsfrom FixtureComposerChromeComposerAgents

The agent profiles the agent picker offers.

autocomplete?from OmitComposerAutocomplete

Inline ghost text.

completions?from OmitComposerCompletions

The completion catalogs.

contextfrom FixtureComposerChromeComposerContext

A session's context gauge, its breakdown and its settled cost.

controlsfrom FixtureComposerChromeComposerControls

The pickers' writes on a session (model, effort, options, agent) and their cache estimates.

drafts?from OmitComposerDrafts

The shared per-session draft.

folders?from OmitComposerFolders

The folder a new session opens in, remembered. Absent: a new session starts without one.

modelsfrom FixtureComposerChromeComposerModels

The model catalogs the pickers list.

pickerPrefsfrom FixtureComposerChromeModelPickerPrefsStore

The model picker's per-device preferences. Absent: an in-memory store for the page's life.

prefsfrom FixtureComposerChromeComposerPrefs

Where picks are remembered across apps (effort and options per model, the next chat's model).

runsfrom FixtureComposerChromeComposerRuns

The current run's counters per session (the run chip, the cost pill).

suggestions?from OmitComposerSuggestions

Next-prompt suggestions.

announceDraft(sessionId: string, text: string, shell?: boolean) => void

Another window changed a session's draft.

announceDraftAttachments(sessionId: string, attachments: PromptAttachment[]) => void

Another window changed a session's staged files.

announceGhost(ghost: ComposerSharedGhost) => void

Another window resolved a ghost text.

runSignalfrom FixtureComposerChrome(signal: RunMeterSignal) => void

The backend streams a run signal (run:start, stream:progress, turn:end, run:end).

startRun(sessionId: string) => void

A run started: the session's suggestion goes stale.

suggest(suggestion: ComposerPromptSuggestion) => void

A run ended with a next-prompt suggestion.

ui/src/chat/testing/fixture-composer-host.ts:48

FixtureComposerHostOptionsInterface#

What createFixtureComposerHost holds.

TypeScript
interface FixtureComposerHostOptions extends FixtureComposerChromeOptions
FixtureComposerHostOptions properties
NameTypeDescription
agents?from FixtureComposerChromeOptionsreadonly ComposerAgentProfile[]

The agent profiles. Default: DEMO_AGENT_PROFILES.

cacheImpact?from FixtureComposerChromeOptionsCacheImpact | null

What any switch costs the cache (null: unknown).

chats?readonly ChatReferenceEntry[]

The sessions # can reference.

commandArgs?Record<string, readonly CommandArgSuggestionSummary[]>

The argument suggestions per command name.

commands?readonly CommandSummary[]

The / commands.

context?from FixtureComposerChromeOptionsRecord<string, { breakdown?: ContextBreakdown; cost?: ComposerCostStatus; status?: ComposerContextStatus }>

Each session's meters.

drafts?Record<string, SharedDraft>

The shared drafts per session.

files?Record<string, readonly FileEntry[]>

The files under each root.

ghosts?Record<string, readonly string[]>

Ghost text completions per draft text.

imageModels?from FixtureComposerChromeOptionsreadonly ImageModelRow[]

The image models.

models?from FixtureComposerChromeOptionsreadonly ComposerModelEntry[]

The chat models. Default: DEMO_COMPOSER_MODELS.

prefs?from FixtureComposerChromeOptionsComposerPrefsState

The remembered picks.

runProgress?from FixtureComposerChromeOptionsRecord<string, ComposerRunProgress>

Each session's run in progress.

sessions?from FixtureComposerChromeOptionsRecord<string, FixtureComposerSession>

Each session's picks (the controls write here).

skills?readonly SkillConfig[]

The enabled skills.

ui/src/chat/testing/fixture-composer-host.ts:30

FixtureComposerSessionInterface#

A session's picks as the fixture holds them.

TypeScript
interface FixtureComposerSession
FixtureComposerSession properties
NameTypeDescription
agent?string

The agent profile.

effort?string

The reasoning effort.

model?ModelPickRef[]

The model chain, primary first.

options?Record<string, boolean>

The enabled options.

ui/src/chat/testing/fixture-composer-chrome.ts:23

FixtureHostOptionsInterface#

Options for createFixtureHost.

TypeScript
interface FixtureHostOptions
FixtureHostOptions properties
NameTypeDescription
editable?boolean

Allow create / rename / archive / favorite / delete (default true).

reply?(prompt: string, sessionId: string) => FixtureStep[]

What the "agent" answers to a sent prompt; streamed in. None: send, interrupt, steer and followUp are absent.

tickMs?number

Milliseconds between streamed chunks (default 24).

ui/src/chat/headless/fixture-host.ts:50

FixtureInteractionStepInterface#

A scripted pause: the run waits on interaction, then streams then(answer) (null: dismissed).

TypeScript
interface FixtureInteractionStep
FixtureInteractionStep properties
NameTypeDescription
interactionInteractionRequest

The question, plan, or approval the run raises.

then?(response: InteractionResponse | null) => ChatEvent[]

Builds the events to stream after the user answers. Receives the response, or null when the request was dismissed.

ui/src/chat/headless/fixture-host.ts:39

FixtureSidebarCallsInterface#

What the fixture recorded.

TypeScript
interface FixtureSidebarCalls
FixtureSidebarCalls properties
NameTypeDescription
hostSettingsstring[]

Every host whose settings were opened, in order.

ran{ actionId: string; sessionId: string }[]

Every environment command run, in order.

retriedstring[]

Every environment retried, in order.

revealedstring[]

Every folder revealed, in order.

windows{ mode: SessionWindowMode; sessionId: string }[]

Every window opened, in order.

ui/src/chat/testing/fixture-sidebar-host.ts:31

FixtureSidebarEnvironmentInterface#

One session's environment, as the fixture holds it.

TypeScript
interface FixtureSidebarEnvironment
FixtureSidebarEnvironment properties
NameTypeDescription
actionsreadonly EnvironmentActionSummary[]

The commands it offers.

results?Readonly<Record<string, EnvironmentActionResult>>

What running each one answers (by action id). An action without one answers its label.

ui/src/chat/testing/fixture-sidebar-host.ts:11

FixtureSidebarHostInterface#

The SidebarHost createFixtureSidebarHost returns, with what it recorded.

TypeScript
interface FixtureSidebarHost extends SidebarHost
FixtureSidebarHost properties
NameTypeDescription
badges?from SidebarHostSessionBadgesSource

The rows' badges and when they change, for createSessionBadges. Absent: the app reads them its own way, or rows show none.

callsFixtureSidebarCalls

What the host was asked to do.

environment?from SidebarHostSidebarEnvironmentHost

A session's environment commands. Absent: no retry, no environment commands.

openHostSettings?from SidebarHost(hostId: string) => Promise<void>

Opens a saved host's page in the app's settings. Absent: a server folder's host badge is not a button.

openWindow?from SidebarHost(sessionId: string, mode: SessionWindowMode) => Promise<void>

Opens a session in a window of its own. Absent: no window rows.

revealPath?from SidebarHost(path: string) => Promise<void>

Shows a folder of this machine in the file manager. Absent: no "Open in Finder".

ui/src/chat/testing/fixture-sidebar-host.ts:45

FixtureSidebarHostOptionsInterface#

What createFixtureSidebarHost holds.

TypeScript
interface FixtureSidebarHostOptions
FixtureSidebarHostOptions properties
NameTypeDescription
environments?Readonly<Record<string, FixtureSidebarEnvironment>>

Each session's environment commands. Default: none, and no environment member.

hostSettings?boolean

Offer openHostSettings. Default: true.

reveal?boolean

Offer revealPath. Default: true.

windows?boolean

Offer openWindow. Default: true.

ui/src/chat/testing/fixture-sidebar-host.ts:19

Types#

FixtureStepType#

One step of a scripted reply: a transcript event to stream, or a FixtureInteractionStep that pauses the run.

TypeScript
type FixtureStep = ChatEvent | FixtureInteractionStep

ui/src/chat/headless/fixture-host.ts:47