@promptbook/remote-client
Version:
Promptbook: Create persistent AI agents that turn your company's scattered knowledge into action
62 lines (61 loc) • 2.06 kB
TypeScript
/**
* Options that customize how streaming message content is sanitized.
*/
type SanitizeStreamingMessageContentOptions = {
/**
* Whether the chat message has finished streaming.
*/
isComplete?: boolean;
};
/**
* Type describing fence delimiter.
*/
type FenceDelimiter = '```' | '~~~';
/**
* Type describing code fence streaming boundary.
*/
type CodeFenceStreamingBoundary = {
readonly kind: 'codeFence';
readonly index: number;
readonly delimiter: FenceDelimiter;
};
/**
* Type describing math streaming boundary.
*/
type MathStreamingBoundary = {
readonly kind: 'math';
readonly index: number;
};
/**
* Type describing image prompt streaming boundary.
*/
type ImagePromptStreamingBoundary = {
readonly kind: 'imagePrompt';
readonly index: number;
};
/**
* Metadata describing the most-recently introduced rich feature that is still streaming.
*
* @private internal helper of <ChatMessageItem/>
*/
export type StreamingFeatureBoundary = CodeFenceStreamingBoundary | MathStreamingBoundary | ImagePromptStreamingBoundary;
/**
* Examines the latest streaming feature boundary so rich placeholders can be rendered while content is still being produced.
*
* @param content - Message text that may still be streaming.
* @returns Metadata describing the richest streaming feature or `null` when nothing is being hidden.
*
* @private internal helper of <ChatMessageItem/>
*/
export declare function getLatestStreamingFeatureBoundary(content: string): StreamingFeatureBoundary | null;
/**
* Trims trailing rich-feature markup from streaming messages so users do not see the raw source while the feature loads.
*
* @param content - Full markdown text produced by the assistant.
* @param options - Sanitization options (streaming state).
* @returns Text that is safe to render during streaming.
*
* @private internal helper of <ChatMessageItem/>
*/
export declare function sanitizeStreamingMessageContent(content: string, options?: SanitizeStreamingMessageContentOptions): string;
export {};