> For AI agents: the complete documentation index is available at /next/zh/llms.txt, the full documentation bundle is available at /next/zh/llms-full.txt.

# Interface: OpenUiRendererRuntimeProps

用于渲染原始 OpenUI 响应文本的 props，包含解析、运行时状态、action 和 query 执行。

## Properties

### initialQueryResults?

> `optional` **initialQueryResults?**: `Readonly`\<`Record`\<`string`, `unknown`>>

预取的 Query 结果，以 Query 赋值名称（statement ID）为键。结果会同步渲染，之后由可选的 toolProvider 重新校验。

***

### initialState?

> `optional` **initialState?**: `Record`\<`string`, `unknown`>

初始的持久化状态。以 $ 开头的键会用于初始化响应式绑定。

***

### isStreaming?

> `optional` **isStreaming?**: `boolean`

模型是否正在生成。部分输出会逐步渲染，Query 执行、mutation 注册和内置交互会等待。
只有成功完成后才设为 false，即使 response 文本未变也要更新。
失败或取消时清空 response，避免把未完成文本标记为完成。

#### Default Value

```ts
false
```

***

### library

> **library**: [`Library`](/next/zh/api/genui/openui/core/type-aliases/Library.md)

由 createOpenUiLibrary() 创建的组件库。

***

### onAction?

> `optional` **onAction?**: (`event`: [`ActionEvent`](/next/zh/api/genui/openui/core/interfaces/ActionEvent.md)) => `void`

组件触发宿主 action 时的回调。

#### Parameters

| Parameter | Type                                                                      |
| --------- | ------------------------------------------------------------------------- |
| `event`   | [`ActionEvent`](/next/zh/api/genui/openui/core/interfaces/ActionEvent.md) |

#### Returns

`void`

***

### onError?

> `optional` **onError?**: (`errors`: [`OpenUIError`](/next/zh/api/genui/openui/core/interfaces/OpenUIError.md)\[]) => `void`

结构化的解析器/运行时/query 错误，用于纠错循环。

#### Parameters

| Parameter | Type                                                                         |
| --------- | ---------------------------------------------------------------------------- |
| `errors`  | [`OpenUIError`](/next/zh/api/genui/openui/core/interfaces/OpenUIError.md)\[] |

#### Returns

`void`

***

### onParseResult?

> `optional` **onParseResult?**: (`result`: [`ParseResult`](/next/zh/api/genui/openui/core/interfaces/ParseResult.md) | `null`) => `void`

原始解析结果每次变化时调用。

#### Parameters

| Parameter | Type                                                                                |
| --------- | ----------------------------------------------------------------------------------- |
| `result`  | [`ParseResult`](/next/zh/api/genui/openui/core/interfaces/ParseResult.md) \| `null` |

#### Returns

`void`

***

### onStateUpdate?

> `optional` **onStateUpdate?**: (`state`: `Record`\<`string`, `unknown`>) => `void`

$variables 或表单状态每次变化时调用。

#### Parameters

| Parameter | Type                           |
| --------- | ------------------------------ |
| `state`   | `Record`\<`string`, `unknown`> |

#### Returns

`void`

***

### queryLoader?

> `optional` **queryLoader?**: `ReactNode`

Query() 调用进行中时显示的自定义加载节点。

***

### response

> **response**: `string` | `null`

累计的完整 OpenUI Lang 文本，或用 null 清空渲染输出。
传入前先追加模型 delta；renderer 的增量 parser 会缓存已完成的语句。替换文本会重置解析。
清空文本不会重置表单状态；新会话需使用新的 key。

#### Example

```tsx
<OpenUiRenderer response={accumulatedText} isStreaming={isGenerating} library={library} />
```

***

### toolProvider?

> `optional` **toolProvider?**: [`ToolProviderInput`](/next/zh/api/genui/openui/core/type-aliases/ToolProviderInput.md)

用于 Query()/Mutation() 的工具提供者：函数映射或 MCP 客户端。
