Cereal docs
TypeScript SDKTypeScript signatures

AgUiSubscriber

Public TypeScript declaration from @trycereal/sdk/browser.

Import from @trycereal/sdk/browser. Generated from the repository SDK declarations (package version 0.0.0); not from HTTP request schemas.

export declare class AgUiSubscriber {
    constructor(options: {
        readonly tokenSource: () => Promise<StreamToken>;
        readonly onDecide?: (toolCallId: string, approved: boolean) => Promise<void>;
        readonly fetch?: typeof globalThis.fetch;
        readonly signal?: AbortSignal;
        readonly onError?: (error: unknown) => void;
    });
    on(channel: AgUiChannel, handler: (event: AgUiStreamChunk) => void): () => void;
    dispatchDecision(toolCallId: string, approved: boolean): Promise<void>;
    close(): void;
}

See SDK setup, authoring, client behavior, and the API/SDK map for usage. Domain types are described in schema reference.

Related SDK types: StreamToken, AgUiStreamChunk, AgUiChannel.