Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions packages/chat/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@

import type { Root } from "mdast";
import type { CardElement } from "./cards";
import type { SerializedChannel } from "./channel";
import type { ChatElement } from "./jsx-runtime";
import type { Logger, LogLevel } from "./logger";
import type { Message } from "./message";
import type { ModalElement } from "./modals";
import type { SerializedThread } from "./thread";

// =============================================================================
// Re-exports from extracted modules
Expand Down Expand Up @@ -735,6 +737,12 @@ export interface Channel<
* Empty iterable on threadless platforms.
*/
threads(): AsyncIterable<ThreadSummary<TRawMessage>>;

/**
* Serialize the channel to a plain JSON object.
* Use this to pass channel data to external systems like workflow engines.
*/
toJSON(): SerializedChannel;
}

/**
Expand Down Expand Up @@ -940,6 +948,12 @@ export interface Thread<TState = Record<string, unknown>, TRawMessage = unknown>
*/
subscribe(): Promise<void>;

/**
* Serialize the thread to a plain JSON object.
* Use this to pass thread data to external systems like workflow engines.
*/
toJSON(): SerializedThread;

/**
* Unsubscribe from this thread.
*
Expand Down
Loading