For AI agents: the complete documentation index is available at /zh/llms.txt, the full documentation bundle is available at /zh/llms-full.txt, and this page is available as Markdown at /zh/api/genui/a2ui/interfaces/MessageStore.md.
Lynx
  • 简体中文
  • genui / a2ui / MessageStore

    MessageStore

    A pure append-only buffer of raw protocol messages produced by the developer's IO module. The store knows nothing about the v0.9 protocol — it does not parse, process, or interpret messages. It only:

    1. Stores them in arrival order.
    2. Notifies subscribers when new ones land.
    3. Hands the current snapshot back via getSnapshot() (referentially stable between mutations — required by useSyncExternalStore).

    Protocol-aware processing — surfaces, signals, resources, action dispatch — is the responsibility of <A2UI> (the renderer component). Developers who don't want to learn the protocol should use <A2UI>; developers who do can run their own MessageProcessor against the snapshot directly.

    属性

    getSnapshot()

    readonly getSnapshot: () => readonly any[];

    useSyncExternalStore getSnapshot contract — stable between pushes.

    返回

    readonly any[]

    定义于

    @lynx-js/genui/a2ui/src/store/MessageStore.ts:26


    subscribe()

    readonly subscribe: (cb: () => void) => () => void;

    useSyncExternalStore subscribe contract.

    参数

    范围类型
    cb() => void

    返回

    Function

    返回

    void

    定义于

    @lynx-js/genui/a2ui/src/store/MessageStore.ts:24

    方法

    clear()

    clear(): void

    Reset the buffer. Notifies subscribers.

    返回

    void

    定义于

    @lynx-js/genui/a2ui/src/store/MessageStore.ts:35


    push()

    push(message: any): void

    Append one or more raw messages to the buffer. Notifies subscribers once per call (batches a single array argument into a single notify).

    参数

    范围类型
    messageany

    返回

    void

    定义于

    @lynx-js/genui/a2ui/src/store/MessageStore.ts:31

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