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, and this page is available as Markdown at /next/zh/api/genui/a2ui/classes/MessageProcessor.md.
Lynx
  • 简体中文
  • 类: MessageProcessor

    有状态的 A2UI 协议处理器,将原始 v0.9 消息转换为可渲染的 surface、resource、数据模型 signal 以及用户操作事件。

    构造函数

    构造函数

    new MessageProcessor(): MessageProcessor

    返回

    MessageProcessor

    属性

    surfaces

    surfaces: Map<string, Surface>

    方法

    clearSurfaces()

    clearSurfaces(): void

    返回

    void


    dispatch()

    dispatch(message: Record<string, unknown>): Promise<unknown>

    参数

    参数类型
    messageRecord<string, unknown>

    返回

    Promise<unknown>


    getOrCreateSurface()

    getOrCreateSurface(surfaceId: string): Surface

    参数

    参数类型
    surfaceIdstring

    返回

    Surface


    getSurfaces()

    getSurfaces(): ReadonlyMap<string, Surface>

    返回

    ReadonlyMap<string, Surface>


    onEvent()

    onEvent(callback: (event: A2UIEvent) => void): () => void

    参数

    参数类型
    callback(event: A2UIEvent) => void

    返回

    () => void


    onUpdate()

    onUpdate(callback: (data: Record<string, unknown>) => void): () => void

    参数

    参数类型
    callback(data: Record<string, unknown>) => void

    返回

    () => void


    processMessages()

    processMessages(messages: ServerToClientMessage[]): void

    参数

    参数类型
    messagesServerToClientMessage[]

    返回

    void


    resolvePath()

    resolvePath(path: string, dataContextPath?: string): string

    结合当前数据上下文解析 JSON Pointer。

    • 绝对路径(以 '/' 开头)原样返回。
    • 相对路径基于传入的 dataContextPath 解析。

    参数

    参数类型
    pathstring
    dataContextPath?string

    返回

    string

    除非另有说明,本项目采用知识共享署名 4.0 国际许可协议进行许可,代码示例采用 Apache License 2.0 许可协议进行许可。