zidane-ui/ server/ testing
import { … } from 'zidane-ui/server/testing'ui/src/server/testing/index.ts
Functions#
createScriptedProviderFunction#
Creates a deterministic, offline zidane Provider for demos and tests. Each model call asks script what to say and streams the answer in word chunks.
function createScriptedProvider(options?: ScriptedProviderOptions): ProviderParameters
| Name | Type | Default | Description |
|---|---|---|---|
| options? | ScriptedProviderOptions | {} | The |
Returns
ProviderdefaultScriptFunction#
Calls lookup with the prompt, then replies with its result.
function defaultScript(input: ScriptInput): ScriptedTurnParameters
| Name | Type | Description |
|---|---|---|
| input | ScriptInput | The |
Returns
readScriptInputFunction#
The latest prompt and what the run did since, read off the wire messages.
function readScriptInput(messages: readonly SessionMessage[]): ScriptInputParameters
| Name | Type | Description |
|---|---|---|
| messages | readonly SessionMessage[] | The conversation messages sent to the provider. |
Returns
Constants#
demoToolsConstant#
The tool set for demos: just lookupTool, keyed by name.
const demoTools: Record<string, ToolDef>lookupToolConstant#
The lookup tool: answers a topic from a small fixed table (zidane, sse). It touches neither the disk nor the network.
const lookupTool: ToolDefInterfaces#
ScriptedProviderOptionsInterface#
Options for createScriptedProvider.
interface ScriptedProviderOptionsProperties
| Name | Type | Description |
|---|---|---|
| delayMs? | number | Milliseconds between streamed chunks (default 15; 0 streams synchronously). |
| script? | (input: ScriptInput) => ScriptedTurn | Decides what the provider says for each model call. Default: |
| wordsPerChunk? | number | Words per streamed chunk (default 2). |
ScriptedTurnInterface#
What a script answers for one model call: text, optional thinking, and optional tool calls.
interface ScriptedTurnProperties
| Name | Type | Description |
|---|---|---|
| text | string | The reply text, streamed to the client in word chunks. |
| thinking? | string | Reasoning text streamed before the reply. |
| toolCalls? | readonly { id: string; input: Record<string, unknown>; name: string }[] | Tool calls the turn makes. With none, the run ends after this turn. |
ScriptInputInterface#
What a script sees for one model call: the latest prompt and what the run did since.
interface ScriptInputProperties
| Name | Type | Description |
|---|---|---|
| prompt | string | The text of the latest user prompt. |
| step | number | Model calls made since that prompt (0 on the first). |
| toolResults | readonly { callId: string; isError: boolean; output: string }[] | Tool results returned since that prompt, oldest first. |