@tanstack/ai
Version:
Core TanStack AI library - Open source AI SDK
19 lines (18 loc) • 864 B
TypeScript
import { ChatMiddleware } from './activities/chat/middleware/types.js';
import { StreamChunk } from './types.js';
/**
* Strip only the deprecated nested `error` object from RUN_ERROR events.
* The flat `message`/`code` fields are the spec-compliant form.
*
* All other fields pass through unchanged. @ag-ui/core's BaseEventSchema
* uses `.passthrough()`, so extra fields (model, content, usage,
* finishReason, toolName, stepId, etc.) are allowed and won't break
* spec validation or verifyEvents.
*/
export declare function stripToSpec(chunk: StreamChunk): StreamChunk;
/**
* Middleware that ensures events are AG-UI spec compliant.
* Currently only strips the deprecated nested `error` object from RUN_ERROR.
* All other fields pass through unchanged (passthrough allowed by spec).
*/
export declare function stripToSpecMiddleware(): ChatMiddleware;