Skip to content

The Open Standard for Generative UI

Make an initial attempt at generating API reference within docs

Rabi Shanker Guhae3ad978b7003
diff --git a/docs/docs/reference/js/react-core/functions/ChatProvider.md b/docs/docs/reference/js/react-core/functions/ChatProvider.md
index ef507db9d..45aa24a21 100644
--- a/docs/docs/reference/js/react-core/functions/ChatProvider.md
+++ b/docs/docs/reference/js/react-core/functions/ChatProvider.md
@@ -1,17 +1,60 @@
-# Function: ChatProvider()
-
-> **ChatProvider**(`__namedParameters`): `Element`
+```ts
+function ChatProvider(props: PropsWithChildren<ChatManager>): ReactNode | Promise<ReactNode>
+```
## Parameters
-### \_\_namedParameters
+<table>
+<thead>
+<tr>
+<th>Parameter</th>
+<th>Type</th>
+<th>Description</th>
+</tr>
+</thead>
+<tbody>
+<tr>
+<td>
+
+`props`
+
+</td>
+<td>
+
+`PropsWithChildren`\<[`ChatManager`](../type-aliases/ChatManager.md)\>
+
+</td>
+<td>
+
+The component props
-`PropsWithChildren`\<`ChatManager`\>
+</td>
+</tr>
+</tbody>
+</table>
## Returns
-`Element`
+`ReactNode` \| `Promise`\<`ReactNode`\>
+
+A ChatContext.Provider wrapping the children components
+
+## Remarks
+
+ChatProvider is a React component that provides chat management context to its children.
+It serves as the top-level provider for thread and thread list management functionality.
+
+## Example
+
+```tsx
+<ChatProvider
+ threadManager={myThreadManager}
+ threadListManager={myThreadListManager}
+>
+ <App />
+</ChatProvider>
+```
## Defined in
-[ChatProvider.tsx:7](https://github.com/thesysdev/crayonai/blob/17896918821373fefeeea6d878227773c31bc548/frontend-sdk/packages/react-core/src/ChatProvider.tsx#L7)
+[packages/react-core/src/ChatProvider.tsx:31](https://github.com/thesysdev/crayonai/blob/6eac6f4f2cad380ceb23505021a977f1a24045b3/frontend-sdk/packages/react-core/src/ChatProvider.tsx#L31)
diff --git a/docs/docs/reference/js/react-core/functions/useThreadActions.md b/docs/docs/reference/js/react-core/functions/useThreadActions.md
index c0a4378cc..e46acf57c 100644
--- a/docs/docs/reference/js/react-core/functions/useThreadActions.md
+++ b/docs/docs/reference/js/react-core/functions/useThreadActions.md
@@ -1,11 +1,15 @@
-# Function: useThreadActions()
-
-> **useThreadActions**(): `ThreadActions`
+```ts
+function useThreadActions(): ThreadActions
+```
## Returns
-`ThreadActions`
+[`ThreadActions`](../type-aliases/ThreadActions.md)
+
+## Remarks
+
+useThreadActions
## Defined in
-[hooks/useThreadActions.ts:5](https://github.com/thesysdev/crayonai/blob/17896918821373fefeeea6d878227773c31bc548/frontend-sdk/packages/react-core/src/hooks/useThreadActions.ts#L5)
+[packages/react-core/src/hooks/useThreadActions.ts:11](https://github.com/thesysdev/crayonai/blob/6eac6f4f2cad380ceb23505021a977f1a24045b3/frontend-sdk/packages/react-core/src/hooks/useThreadActions.ts#L11)
diff --git a/docs/docs/reference/js/react-core/functions/useThreadListActions.md b/docs/docs/reference/js/react-core/functions/useThreadListActions.md
index ecdc7b3da..ccfcb9a14 100644
--- a/docs/docs/reference/js/react-core/functions/useThreadListActions.md
+++ b/docs/docs/reference/js/react-core/functions/useThreadListActions.md
@@ -1,11 +1,15 @@
-# Function: useThreadListActions()
-
-> **useThreadListActions**(): `ThreadListActions`
+```ts
+function useThreadListActions(): ThreadListActions
+```
## Returns
-`ThreadListActions`
+[`ThreadListActions`](../type-aliases/ThreadListActions.md)
+
+## Remarks
+
+useThreadListActions
## Defined in
-[hooks/useThreadListActions.ts:5](https://github.com/thesysdev/crayonai/blob/17896918821373fefeeea6d878227773c31bc548/frontend-sdk/packages/react-core/src/hooks/useThreadListActions.ts#L5)
+[packages/react-core/src/hooks/useThreadListActions.ts:11](https://github.com/thesysdev/crayonai/blob/6eac6f4f2cad380ceb23505021a977f1a24045b3/frontend-sdk/packages/react-core/src/hooks/useThreadListActions.ts#L11)
diff --git a/docs/docs/reference/js/react-core/functions/useThreadListState.md b/docs/docs/reference/js/react-core/functions/useThreadListState.md
index e8dd2cad3..33fe538ea 100644
--- a/docs/docs/reference/js/react-core/functions/useThreadListState.md
+++ b/docs/docs/reference/js/react-core/functions/useThreadListState.md
@@ -1,11 +1,15 @@
-# Function: useThreadListState()
-
-> **useThreadListState**(): `ThreadListState`
+```ts
+function useThreadListState(): ThreadListState
+```
## Returns
-`ThreadListState`
+[`ThreadListState`](../type-aliases/ThreadListState.md)
+
+## Remarks
+
+useThreadListState
## Defined in
-[hooks/useThreadListState.ts:5](https://github.com/thesysdev/crayonai/blob/17896918821373fefeeea6d878227773c31bc548/frontend-sdk/packages/react-core/src/hooks/useThreadListState.ts#L5)
+[packages/react-core/src/hooks/useThreadListState.ts:11](https://github.com/thesysdev/crayonai/blob/6eac6f4f2cad380ceb23505021a977f1a24045b3/frontend-sdk/packages/react-core/src/hooks/useThreadListState.ts#L11)
diff --git a/docs/docs/reference/js/react-core/functions/useThreadState.md b/docs/docs/reference/js/react-core/functions/useThreadState.md
index b516ff1fc..a0358e754 100644
--- a/docs/docs/reference/js/react-core/functions/useThreadState.md
+++ b/docs/docs/reference/js/react-core/functions/useThreadState.md
@@ -1,11 +1,15 @@
-# Function: useThreadState()
-
-> **useThreadState**(): `ThreadState`
+```ts
+function useThreadState(): ThreadState
+```
## Returns
-`ThreadState`
+[`ThreadState`](../type-aliases/ThreadState.md)
+
+## Remarks
+
+useThreadState
## Defined in
-[hooks/useThreadState.ts:5](https://github.com/thesysdev/crayonai/blob/17896918821373fefeeea6d878227773c31bc548/frontend-sdk/packages/react-core/src/hooks/useThreadState.ts#L5)
+[packages/react-core/src/hooks/useThreadState.ts:11](https://github.com/thesysdev/crayonai/blob/6eac6f4f2cad380ceb23505021a977f1a24045b3/frontend-sdk/packages/react-core/src/hooks/useThreadState.ts#L11)
diff --git a/docs/docs/reference/js/react-core/index.md b/docs/docs/reference/js/react-core/index.md
index 10bb3a114..90eeb5c39 100644
--- a/docs/docs/reference/js/react-core/index.md
+++ b/docs/docs/reference/js/react-core/index.md
@@ -1,9 +1,24 @@
-# @clay/react-core
-
-## Functions
+## Components
- [ChatProvider](functions/ChatProvider.md)
+
+## Hooks
+
- [useThreadActions](functions/useThreadActions.md)
- [useThreadListActions](functions/useThreadListActions.md)
- [useThreadListState](functions/useThreadListState.md)
- [useThreadState](functions/useThreadState.md)
+
+## Other
+
+- [ChatManager](type-aliases/ChatManager.md)
+- [CreateMessage](type-aliases/CreateMessage.md)
+- [Message](type-aliases/Message.md)
+- [MessageConverter](type-aliases/MessageConverter.md)
+- [Thread](type-aliases/Thread.md)
+- [ThreadActions](type-aliases/ThreadActions.md)
+- [ThreadListActions](type-aliases/ThreadListActions.md)
+- [ThreadListManager](type-aliases/ThreadListManager.md)
+- [ThreadListState](type-aliases/ThreadListState.md)
+- [ThreadManager](type-aliases/ThreadManager.md)
+- [ThreadState](type-aliases/ThreadState.md)
diff --git a/docs/docs/reference/js/react-core/type-aliases/ChatManager.md b/docs/docs/reference/js/react-core/type-aliases/ChatManager.md
new file mode 100644
index 000000000..a87e382e1
--- /dev/null
+++ b/docs/docs/reference/js/react-core/type-aliases/ChatManager.md
@@ -0,0 +1,60 @@
+```ts
+type ChatManager = {
+ threadListManager: ThreadListManager;
+ threadManager: ThreadManager;
+};
+```
+
+Main chat manager combining thread and thread list management
+
+## Type declaration
+
+<table>
+<thead>
+<tr>
+<th>Name</th>
+<th>Type</th>
+<th>Defined in</th>
+</tr>
+</thead>
+<tbody>
+<tr>
+<td>
+
+`threadListManager`
+
+</td>
+<td>
+
+[`ThreadListManager`](ThreadListManager.md)
+
+</td>
+<td>
+
+[packages/react-core/src/types.ts:93](https://github.com/thesysdev/crayonai/blob/6eac6f4f2cad380ceb23505021a977f1a24045b3/frontend-sdk/packages/react-core/src/types.ts#L93)
+
+</td>
+</tr>
+<tr>
+<td>
+
+`threadManager`
+
+</td>
+<td>
+
+[`ThreadManager`](ThreadManager.md)
+
+</td>
+<td>
+
+[packages/react-core/src/types.ts:94](https://github.com/thesysdev/crayonai/blob/6eac6f4f2cad380ceb23505021a977f1a24045b3/frontend-sdk/packages/react-core/src/types.ts#L94)
+
+</td>
+</tr>
+</tbody>
+</table>
+
+## Defined in
+
+[packages/react-core/src/types.ts:92](https://github.com/thesysdev/crayonai/blob/6eac6f4f2cad380ceb23505021a977f1a24045b3/frontend-sdk/packages/react-core/src/types.ts#L92)
diff --git a/docs/docs/reference/js/react-core/type-aliases/CreateMessage.md b/docs/docs/reference/js/react-core/type-aliases/CreateMessage.md
new file mode 100644
index 000000000..1320a184e
--- /dev/null
+++ b/docs/docs/reference/js/react-core/type-aliases/CreateMessage.md
@@ -0,0 +1,42 @@
+```ts
+type CreateMessage = Omit<Message, "id"> & {
+ id: Message["id"];
+};
+```
+
+Represents a message being created, with an optional ID
+
+## Type declaration
+
+<table>
+<thead>
+<tr>
+<th>Name</th>
+<th>Type</th>
+<th>Defined in</th>
+</tr>
+</thead>
+<tbody>
+<tr>
+<td>
+
+`id`?
+
+</td>
+<td>
+
+[`Message`](Message.md)\[`"id"`\]
+
+</td>
+<td>
+
+[packages/react-core/src/types.ts:11](https://github.com/thesysdev/crayonai/blob/6eac6f4f2cad380ceb23505021a977f1a24045b3/frontend-sdk/packages/react-core/src/types.ts#L11)
+
+</td>
+</tr>
+</tbody>
+</table>
+
+## Defined in
+
+[packages/react-core/src/types.ts:10](https://github.com/thesysdev/crayonai/blob/6eac6f4f2cad380ceb23505021a977f1a24045b3/frontend-sdk/packages/react-core/src/types.ts#L10)
diff --git a/docs/docs/reference/js/react-core/type-aliases/Message.md b/docs/docs/reference/js/react-core/type-aliases/Message.md
new file mode 100644
index 000000000..b26fc6794
--- /dev/null
+++ b/docs/docs/reference/js/react-core/type-aliases/Message.md
@@ -0,0 +1,9 @@
+```ts
+type Message = VercelMessage;
+```
+
+Represents a chat message, extending Vercel's Message type
+
+## Defined in
+
+[packages/react-core/src/types.ts:4](https://github.com/thesysdev/crayonai/blob/6eac6f4f2cad380ceb23505021a977f1a24045b3/frontend-sdk/packages/react-core/src/types.ts#L4)
diff --git a/docs/docs/reference/js/react-core/type-aliases/MessageConverter.md b/docs/docs/reference/js/react-core/type-aliases/MessageConverter.md
new file mode 100644
index 000000000..e811e0795
--- /dev/null
+++ b/docs/docs/reference/js/react-core/type-aliases/MessageConverter.md
@@ -0,0 +1,69 @@
+```ts
+type MessageConverter<T> = (message: T) => Message;
+```
+
+Function type for converting between message types
+
+## Type Parameters
+
+<table>
+<thead>
+<tr>
+<th>Type Parameter</th>
+<th>Default type</th>
+<th>Description</th>
+</tr>
+</thead>
+<tbody>
+<tr>
+<td>
+
+`T`
+
+</td>
+<td>
+
+[`Message`](Message.md)
+
+</td>
+<td>
+
+The source message type
+
+</td>
+</tr>
+</tbody>
+</table>
+
+## Parameters
+
+<table>
+<thead>
+<tr>
+<th>Parameter</th>
+<th>Type</th>
+</tr>
+</thead>
+<tbody>
+<tr>
+<td>
+
+`message`
+
+</td>
+<td>
+
+`T`
+
+</td>
+</tr>
+</tbody>
+</table>
+
+## Returns
+
+[`Message`](Message.md)
+
+## Defined in
+
+[packages/react-core/src/types.ts:18](https://github.com/thesysdev/crayonai/blob/6eac6f4f2cad380ceb23505021a977f1a24045b3/frontend-sdk/packages/react-core/src/types.ts#L18)
diff --git a/docs/docs/reference/js/react-core/type-aliases/Thread.md b/docs/docs/reference/js/react-core/type-aliases/Thread.md
new file mode 100644
index 000000000..42789c891
--- /dev/null
+++ b/docs/docs/reference/js/react-core/type-aliases/Thread.md
@@ -0,0 +1,117 @@
+```ts
+type Thread = {
+ createdAt: Date;
+ isRunning: boolean;
+ threadId: string;
+ title: string;
+};
+```
+
+Represents a chat thread
+
+## Type declaration
+
+<table>
+<thead>
+<tr>
+<th>Name</th>
+<th>Type</th>
+<th>Description</th>
+<th>Defined in</th>
+</tr>
+</thead>
+<tbody>
+<tr>
+<td>
+
+`createdAt`
+
+</td>
+<td>
+
+`Date`
+
+</td>
+<td>
+
+Creation timestamp
+
+</td>
+<td>
+
+[packages/react-core/src/types.ts:29](https://github.com/thesysdev/crayonai/blob/6eac6f4f2cad380ceb23505021a977f1a24045b3/frontend-sdk/packages/react-core/src/types.ts#L29)
+
+</td>
+</tr>
+<tr>
+<td>
+
+`isRunning`
+
+</td>
+<td>
+
+`boolean`
+
+</td>
+<td>
+
+Indicates if the thread is currently processing
+
+</td>
+<td>
+
+[packages/react-core/src/types.ts:31](https://github.com/thesysdev/crayonai/blob/6eac6f4f2cad380ceb23505021a977f1a24045b3/frontend-sdk/packages/react-core/src/types.ts#L31)
+
+</td>
+</tr>
+<tr>
+<td>
+
+`threadId`
+
+</td>
+<td>
+
+`string`
+
+</td>
+<td>
+
+Unique identifier for the thread
+
+</td>
+<td>
+
+[packages/react-core/src/types.ts:25](https://github.com/thesysdev/crayonai/blob/6eac6f4f2cad380ceb23505021a977f1a24045b3/frontend-sdk/packages/react-core/src/types.ts#L25)
+
+</td>
+</tr>
+<tr>
+<td>
+
+`title`
+
+</td>
+<td>
+
+`string`
+
+</td>
+<td>
+
+Title of the thread
+
+</td>
+<td>
+
+[packages/react-core/src/types.ts:27](https://github.com/thesysdev/crayonai/blob/6eac6f4f2cad380ceb23505021a977f1a24045b3/frontend-sdk/packages/react-core/src/types.ts#L27)
+
+</td>
+</tr>
+</tbody>
+</table>
+
+## Defined in
+
+[packages/react-core/src/types.ts:23](https://github.com/thesysdev/crayonai/blob/6eac6f4f2cad380ceb23505021a977f1a24045b3/frontend-sdk/packages/react-core/src/types.ts#L23)
diff --git a/docs/docs/reference/js/react-core/type-aliases/ThreadActions.md b/docs/docs/reference/js/react-core/type-aliases/ThreadActions.md
new file mode 100644
index 000000000..dc8d262e2
--- /dev/null
+++ b/docs/docs/reference/js/react-core/type-aliases/ThreadActions.md
@@ -0,0 +1,151 @@
+```ts
+type ThreadActions<T> = {
+ convertMessage: T extends Message ? MessageConverter<T> | undefined : MessageConverter<T>;
+ onAddToolResult: (props: {
+ result: any;
+ toolCallId: string;
+ }) => Promise<void> | void;
+ onCancel: () => void;
+ onNew: (message: CreateMessage) => void;
+ onReload: (messageId: string) => undefined;
+};
+```
+
+Actions available for managing a thread
+
+## Type Parameters
+
+<table>
+<thead>
+<tr>
+<th>Type Parameter</th>
+<th>Default type</th>
+<th>Description</th>
+</tr>
+</thead>
+<tbody>
+<tr>
+<td>
+
+`T`
+
+</td>
+<td>
+
+[`Message`](Message.md)
+
+</td>
+<td>
+
+The message type used in the thread
+
+</td>
+</tr>
+</tbody>
+</table>
+
+## Type declaration
+
+<table>
+<thead>
+<tr>
+<th>Name</th>
+<th>Type</th>
+<th>Defined in</th>
+</tr>
+</thead>
+<tbody>
+<tr>
+<td>
+
+`convertMessage`
+
+</td>
+<td>
+
+`T` *extends* [`Message`](Message.md) ? [`MessageConverter`](MessageConverter.md)\<`T`\> \| `undefined` : [`MessageConverter`](MessageConverter.md)\<`T`\>
+
+</td>
+<td>
+
+[packages/react-core/src/types.ts:45](https://github.com/thesysdev/crayonai/blob/6eac6f4f2cad380ceb23505021a977f1a24045b3/frontend-sdk/packages/react-core/src/types.ts#L45)
+
+</td>
+</tr>
+<tr>
+<td>
+
+`onAddToolResult`?
+
+</td>
+<td>
+
+(`props`: \{
+ `result`: `any`;
+ `toolCallId`: `string`;
+ \}) => `Promise`\<`void`\> \| `void`
+
+</td>
+<td>
+
+[packages/react-core/src/types.ts:42](https://github.com/thesysdev/crayonai/blob/6eac6f4f2cad380ceb23505021a977f1a24045b3/frontend-sdk/packages/react-core/src/types.ts#L42)
+
+</td>
+</tr>
+<tr>
+<td>
+
+`onCancel`?
+
+</td>
+<td>
+
+() => `void`
+
+</td>
+<td>
+
+[packages/react-core/src/types.ts:41](https://github.com/thesysdev/crayonai/blob/6eac6f4f2cad380ceb23505021a977f1a24045b3/frontend-sdk/packages/react-core/src/types.ts#L41)
+
+</td>
+</tr>
+<tr>
+<td>
+
+`onNew`
+
+</td>
+<td>
+
+(`message`: [`CreateMessage`](CreateMessage.md)) => `void`
+
+</td>
+<td>
+
+[packages/react-core/src/types.ts:39](https://github.com/thesysdev/crayonai/blob/6eac6f4f2cad380ceb23505021a977f1a24045b3/frontend-sdk/packages/react-core/src/types.ts#L39)
+
+</td>
+</tr>
+<tr>
+<td>
+
+`onReload`?
+
+</td>
+<td>
+
+(`messageId`: `string`) => `undefined`
+
+</td>
+<td>
+
+[packages/react-core/src/types.ts:40](https://github.com/thesysdev/crayonai/blob/6eac6f4f2cad380ceb23505021a977f1a24045b3/frontend-sdk/packages/react-core/src/types.ts#L40)
+
+</td>
+</tr>
+</tbody>
+</table>
+
+## Defined in
+
+[packages/react-core/src/types.ts:38](https://github.com/thesysdev/crayonai/blob/6eac6f4f2cad380ceb23505021a977f1a24045b3/frontend-sdk/packages/react-core/src/types.ts#L38)
diff --git a/docs/docs/reference/js/react-core/type-aliases/ThreadListActions.md b/docs/docs/reference/js/react-core/type-aliases/ThreadListActions.md
new file mode 100644
index 000000000..2a311c4e7
--- /dev/null
+++ b/docs/docs/reference/js/react-core/type-aliases/ThreadListActions.md
@@ -0,0 +1,96 @@
+```ts
+type ThreadListActions = {
+ deleteThread: (threadId: string) => void;
+ load: () => void;
+ switchToNew: () => void;
+ updateThread: (thread: Thread) => void;
+};
+```
+
+Actions available for managing the thread list
+
+## Type declaration
+
+<table>
+<thead>
+<tr>
+<th>Name</th>
+<th>Type</th>
+<th>Defined in</th>
+</tr>
+</thead>
+<tbody>
+<tr>
+<td>
+
+`deleteThread`
+
+</td>
+<td>
+
+(`threadId`: `string`) => `void`
+
+</td>
+<td>
+
+[packages/react-core/src/types.ts:81](https://github.com/thesysdev/crayonai/blob/6eac6f4f2cad380ceb23505021a977f1a24045b3/frontend-sdk/packages/react-core/src/types.ts#L81)
+
+</td>
+</tr>
+<tr>
+<td>
+
+`load`
+
+</td>
+<td>
+
+() => `void`
+
+</td>
+<td>
+
+[packages/react-core/src/types.ts:78](https://github.com/thesysdev/crayonai/blob/6eac6f4f2cad380ceb23505021a977f1a24045b3/frontend-sdk/packages/react-core/src/types.ts#L78)
+
+</td>
+</tr>
+<tr>
+<td>
+
+`switchToNew`
+
+</td>
+<td>
+
+() => `void`
+
+</td>
+<td>
+
+[packages/react-core/src/types.ts:79](https://github.com/thesysdev/crayonai/blob/6eac6f4f2cad380ceb23505021a977f1a24045b3/frontend-sdk/packages/react-core/src/types.ts#L79)
+
+</td>
+</tr>
+<tr>
+<td>
+
+`updateThread`
+
+</td>
+<td>
+
+(`thread`: [`Thread`](Thread.md)) => `void`
+
+</td>
+<td>
+
+[packages/react-core/src/types.ts:80](https://github.com/thesysdev/crayonai/blob/6eac6f4f2cad380ceb23505021a977f1a24045b3/frontend-sdk/packages/react-core/src/types.ts#L80)
+
+</td>
+</tr>
+</tbody>
+</table>
+
+## Defined in
+
+[packages/react-core/src/types.ts:77](https://github.com/thesysdev/crayonai/blob/6eac6f4f2cad380ceb23505021a977f1a24045b3/frontend-sdk/packages/react-core/src/types.ts#L77)
diff --git a/docs/docs/reference/js/react-core/type-aliases/ThreadListManager.md b/docs/docs/reference/js/react-core/type-aliases/ThreadListManager.md
new file mode 100644
index 000000000..0e1744255
--- /dev/null
+++ b/docs/docs/reference/js/react-core/type-aliases/ThreadListManager.md
@@ -0,0 +1,9 @@
+```ts
+type ThreadListManager = ThreadListState & ThreadListActions;
+```
+
+Combines thread list state and actions
+
+## Defined in
+
+[packages/react-core/src/types.ts:87](https://github.com/thesysdev/crayonai/blob/6eac6f4f2cad380ceb23505021a977f1a24045b3/frontend-sdk/packages/react-core/src/types.ts#L87)
diff --git a/docs/docs/reference/js/react-core/type-aliases/ThreadListState.md b/docs/docs/reference/js/react-core/type-aliases/ThreadListState.md
new file mode 100644
index 000000000..6cae81d8b
--- /dev/null
+++ b/docs/docs/reference/js/react-core/type-aliases/ThreadListState.md
@@ -0,0 +1,78 @@
+```ts
+type ThreadListState = {
+ error: Error | null | undefined;
+ isLoading: boolean;
+ threads: Thread[];
+};
+```
+
+Represents the state of the thread list
+
+## Type declaration
+
+<table>
+<thead>
+<tr>
+<th>Name</th>
+<th>Type</th>
+<th>Defined in</th>
+</tr>
+</thead>
+<tbody>
+<tr>
+<td>
+
+`error`
+
+</td>
+<td>
+
+`Error` \| `null` \| `undefined`
+
+</td>
+<td>
+
+[packages/react-core/src/types.ts:71](https://github.com/thesysdev/crayonai/blob/6eac6f4f2cad380ceb23505021a977f1a24045b3/frontend-sdk/packages/react-core/src/types.ts#L71)
+
+</td>
+</tr>
+<tr>
+<td>
+
+`isLoading`
+
+</td>
+<td>
+
+`boolean`
+
+</td>
+<td>
+
+[packages/react-core/src/types.ts:70](https://github.com/thesysdev/crayonai/blob/6eac6f4f2cad380ceb23505021a977f1a24045b3/frontend-sdk/packages/react-core/src/types.ts#L70)
+
+</td>
+</tr>
+<tr>
+<td>
+
+`threads`
+
+</td>
+<td>
+
+[`Thread`](Thread.md)[]
+
+</td>
+<td>
+
+[packages/react-core/src/types.ts:69](https://github.com/thesysdev/crayonai/blob/6eac6f4f2cad380ceb23505021a977f1a24045b3/frontend-sdk/packages/react-core/src/types.ts#L69)
+
+</td>
+</tr>
+</tbody>
+</table>
+
+## Defined in
+
+[packages/react-core/src/types.ts:68](https://github.com/thesysdev/crayonai/blob/6eac6f4f2cad380ceb23505021a977f1a24045b3/frontend-sdk/packages/react-core/src/types.ts#L68)
diff --git a/docs/docs/reference/js/react-core/type-aliases/ThreadManager.md b/docs/docs/reference/js/react-core/type-aliases/ThreadManager.md
new file mode 100644
index 000000000..231782fcd
--- /dev/null
+++ b/docs/docs/reference/js/react-core/type-aliases/ThreadManager.md
@@ -0,0 +1,40 @@
+```ts
+type ThreadManager<T> = ThreadState<T> & ThreadActions<T>;
+```
+
+Combines thread state and actions
+
+## Type Parameters
+
+<table>
+<thead>
+<tr>
+<th>Type Parameter</th>
+<th>Default type</th>
+<th>Description</th>
+</tr>
+</thead>
+<tbody>
+<tr>
+<td>
+
+`T`
+
+</td>
+<td>
+
+[`Message`](Message.md)
+
+</td>
+<td>
+
+The message type used in the thread
+
+</td>
+</tr>
+</tbody>
+</table>
+
+## Defined in
+
+[packages/react-core/src/types.ts:63](https://github.com/thesysdev/crayonai/blob/6eac6f4f2cad380ceb23505021a977f1a24045b3/frontend-sdk/packages/react-core/src/types.ts#L63)
diff --git a/docs/docs/reference/js/react-core/type-aliases/ThreadState.md b/docs/docs/reference/js/react-core/type-aliases/ThreadState.md
new file mode 100644
index 000000000..83479b20c
--- /dev/null
+++ b/docs/docs/reference/js/react-core/type-aliases/ThreadState.md
@@ -0,0 +1,127 @@
+```ts
+type ThreadState<T> = {
+ error: Error | null | undefined;
+ isDisabled: boolean;
+ isRunning: boolean;
+ messages: T[];
+};
+```
+
+Represents the state of a thread
+
+## Type Parameters
+
+<table>
+<thead>
+<tr>
+<th>Type Parameter</th>
+<th>Default type</th>
+<th>Description</th>
+</tr>
+</thead>
+<tbody>
+<tr>
+<td>
+
+`T`
+
+</td>
+<td>
+
+[`Message`](Message.md)
+
+</td>
+<td>
+
+The message type used in the thread
+
+</td>
+</tr>
+</tbody>
+</table>
+
+## Type declaration
+
+<table>
+<thead>
+<tr>
+<th>Name</th>
+<th>Type</th>
+<th>Defined in</th>
+</tr>
+</thead>
+<tbody>
+<tr>
+<td>
+
+`error`
+
+</td>
+<td>
+
+`Error` \| `null` \| `undefined`
+
+</td>
+<td>
+
+[packages/react-core/src/types.ts:56](https://github.com/thesysdev/crayonai/blob/6eac6f4f2cad380ceb23505021a977f1a24045b3/frontend-sdk/packages/react-core/src/types.ts#L56)
+
+</td>
+</tr>
+<tr>
+<td>
+
+`isDisabled`?
+
+</td>
+<td>
+
+`boolean`
+
+</td>
+<td>
+
+[packages/react-core/src/types.ts:53](https://github.com/thesysdev/crayonai/blob/6eac6f4f2cad380ceb23505021a977f1a24045b3/frontend-sdk/packages/react-core/src/types.ts#L53)
+
+</td>
+</tr>
+<tr>
+<td>
+
+`isRunning`?
+
+</td>
+<td>
+
+`boolean`
+
+</td>
+<td>
+
+[packages/react-core/src/types.ts:54](https://github.com/thesysdev/crayonai/blob/6eac6f4f2cad380ceb23505021a977f1a24045b3/frontend-sdk/packages/react-core/src/types.ts#L54)
+
+</td>
+</tr>
+<tr>
+<td>
+
+`messages`
+
+</td>
+<td>
+
+`T`[]
+
+</td>
+<td>
+
+[packages/react-core/src/types.ts:55](https://github.com/thesysdev/crayonai/blob/6eac6f4f2cad380ceb23505021a977f1a24045b3/frontend-sdk/packages/react-core/src/types.ts#L55)
+
+</td>
+</tr>
+</tbody>
+</table>
+
+## Defined in
+
+[packages/react-core/src/types.ts:52](https://github.com/thesysdev/crayonai/blob/6eac6f4f2cad380ceb23505021a977f1a24045b3/frontend-sdk/packages/react-core/src/types.ts#L52)
diff --git a/docs/docs/reference/js/react-ui/index.md b/docs/docs/reference/js/react-ui/index.md
index 96b02c090..8b1378917 100644
--- a/docs/docs/reference/js/react-ui/index.md
+++ b/docs/docs/reference/js/react-ui/index.md
@@ -1 +1 @@
-# @clay/react-ui
+
diff --git a/docs/docusaurus.config.ts b/docs/docusaurus.config.ts
index e7c091662..f48b6f310 100644
--- a/docs/docusaurus.config.ts
+++ b/docs/docusaurus.config.ts
@@ -4,6 +4,27 @@ import type * as Preset from "@docusaurus/preset-classic";
// This runs in Node.js - Don't use client-side code here (browser APIs, JSX...)
+const typeDocConfig = {
+ sidebar: {
+ autoConfiguration: false,
+ },
+
+ parametersFormat: "htmlTable",
+ interfacePropertiesFormat: "htmlTable",
+ classPropertiesFormat: "htmlTable",
+ propertyMembersFormat: "htmlTable",
+ typeDeclarationFormat: "htmlTable",
+ typeDeclarationVisibility: "compact",
+ useCodeBlocks: true,
+ hidePageHeader: true,
+ hidePageTitle: true,
+ expandObjects: true,
+ expandParameters: true,
+
+ // typedoc options
+ plugin: ["typedoc-plugin-markdown"],
+};
+
const config: Config = {
title: "CrayonAI",
tagline: "Generative UI SDK",
@@ -142,11 +163,10 @@ const config: Config = {
entryPoints: ["../frontend-sdk/packages/react-core/src/index.ts"],
tsconfig: "../frontend-sdk/tsconfig.json",
out: "./docs/reference/js/react-core",
- sidebar: {
- autoConfiguration: false,
- },
+ ...typeDocConfig,
},
],
+
[
"docusaurus-plugin-typedoc",
{
@@ -154,9 +174,7 @@ const config: Config = {
entryPoints: ["../frontend-sdk/packages/react-ui/src/index.ts"],
tsconfig: "../frontend-sdk/tsconfig.json",
out: "./docs/reference/js/react-ui",
- sidebar: {
- autoConfiguration: false,
- },
+ ...typeDocConfig,
},
],
],
diff --git a/docs/package.json b/docs/package.json
index 76d359dbe..8cc08ea1e 100644
--- a/docs/package.json
+++ b/docs/package.json
@@ -27,7 +27,10 @@
"@docusaurus/module-type-aliases": "3.6.3",
"@docusaurus/tsconfig": "3.6.3",
"@docusaurus/types": "3.6.3",
+ "@microsoft/api-extractor": "^7.48.1",
+ "docusaurus-plugin-react-docgen-typescript": "^1.2.1",
"docusaurus-plugin-typedoc": "^1.1.1",
+ "react-docgen-typescript": "^2.2.2",
"typedoc": "^0.27.5",
"typedoc-plugin-markdown": "^4.3.3",
"typescript": "~5.6.2"
diff --git a/docs/pnpm-lock.yaml b/docs/pnpm-lock.yaml
index e0146adf3..b46627ee8 100644
--- a/docs/pnpm-lock.yaml
+++ b/docs/pnpm-lock.yaml
@@ -39,9 +39,18 @@ importers:
'@docusaurus/types':
specifier: 3.6.3
+ '@microsoft/api-extractor':
+ specifier: ^7.48.1
+ version: 7.48.1(@types/[email protected])
+ docusaurus-plugin-react-docgen-typescript:
+ specifier: ^1.2.1
docusaurus-plugin-typedoc:
specifier: ^1.1.1
+ react-docgen-typescript:
+ specifier: ^2.2.2
+ version: 2.2.2([email protected])
typedoc:
specifier: ^0.27.5
version: 0.27.5([email protected])
@@ -1186,6 +1195,10 @@ packages:
resolution: {integrity: sha512-foQZKJig7Ob0BMAYBfcJk8d77QtOe7Wo4ox7ff1lQYoNNAb6jwcY1ncdoy2e9wQZzvNy7ODZCYJkK8kzmcAnAg==}
+ '@isaacs/[email protected]':
+ resolution: {integrity: sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==}
+ engines: {node: '>=12'}
+
resolution: {integrity: sha512-mo5j5X+jIZmJQveBKeS/clAueipV7KgiX1vMgCxam1RNYiqE1w62n0/tJJnHtjW8ZHcQco5gY85jA3mi0L+nSA==}
engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
@@ -1227,6 +1240,19 @@ packages:
'@types/react': '>=16'
react: '>=16'
+ '@microsoft/[email protected]':
+ resolution: {integrity: sha512-CTS2PlASJHxVY8hqHORVb1HdECWOEMcMnM6/kDkPr0RZapAFSIHhg9D4jxuE8g+OWYHtPc10LCpmde5pylTRlA==}
+
+ '@microsoft/[email protected]':
+ resolution: {integrity: sha512-HN9Osa1WxqLM66RaqB5nPAadx+nTIQmY/XtkFdaJvusjG8Tus++QqZtD7KPZDSkhEMGHsYeSyeU8qUzCDUXPjg==}
+ hasBin: true
+
+ '@microsoft/[email protected]':
+ resolution: {integrity: sha512-UtjIFe0C6oYgTnad4q1QP4qXwLhe6tIpNTRStJ2RZEPIkqQPREAwE5spzVxsdn9UaEMUqhh0AqSx3X4nWAKXWw==}
+
+ '@microsoft/[email protected]':
+ resolution: {integrity: sha512-4aErSrCR/On/e5G2hDP0wjooqDdauzEbIq8hIkIe5pXV0rtWJZvdCEKL0ykZxex+IxIwBp0eGeV48hQN07dXtw==}
+
'@nodelib/[email protected]':
resolution: {integrity: sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==}
engines: {node: '>= 8'}
@@ -1239,6 +1265,10 @@ packages:
resolution: {integrity: sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==}
engines: {node: '>= 8'}
+ '@pkgjs/[email protected]':
+ resolution: {integrity: sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==}
+ engines: {node: '>=14'}
+
resolution: {integrity: sha512-htyl8TWnKL7K/ESFa1oW2UB5lVDxuF5DpM7tBi6Hu2LNL3mWkIzNLG6N4zoCUP1lCKNxWy/3iu8mS8MvToGd6w==}
engines: {node: '>=12.22.0'}
@@ -1254,6 +1284,28 @@ packages:
resolution: {integrity: sha512-8LduaNlMZGwdZ6qWrKlfa+2M4gahzFkprZiAt2TF8uS0qQgBizKXpXURqvTJ4WtmupWxaLqjRb2UCTe72mu+Aw==}
+ '@rushstack/[email protected]':
+ resolution: {integrity: sha512-BSb/KcyBHmUQwINrgtzo6jiH0HlGFmrUy33vO6unmceuVKTEyL2q+P0fQq2oB5hvXVWOEUhxB2QvlkZluvUEmg==}
+ peerDependencies:
+ '@types/node': '*'
+ peerDependenciesMeta:
+ '@types/node':
+ optional: true
+
+ '@rushstack/[email protected]':
+ resolution: {integrity: sha512-olzSSjYrvCNxUFZowevC3uz8gvKr3WTpHQ7BkpjtRpA3wK+T0ybep/SRUMfr195gBzJm5gaXw0ZMgjIyHqJUow==}
+
+ '@rushstack/[email protected]':
+ resolution: {integrity: sha512-NxACqERW0PHq8Rpq1V6v5iTHEwkRGxenjEW+VWqRYQ8T9puUzgmGHmEZUaUEDHAe9Qyvp0/Ew04sAiQw9XjhJg==}
+ peerDependencies:
+ '@types/node': '*'
+ peerDependenciesMeta:
+ '@types/node':
+ optional: true
+
+ '@rushstack/[email protected]':
+ resolution: {integrity: sha512-JJ7XZX5K3ThBBva38aomgsPv1L7FV6XmSOcR6HtM7HDFZJkepqT65imw26h9ggGqMjsY0R9jcl30tzKcVj9aOQ==}
+
'@shikijs/[email protected]':
resolution: {integrity: sha512-Do2ry6flp2HWdvpj2XOwwa0ljZBRy15HKZITzPcNIBOGSeprnA8gOooA/bLsSPuy8aJBa+Q/r34dMmC3KNL/zw==}
@@ -1375,6 +1427,9 @@ packages:
resolution: {integrity: sha512-veQTnWP+1D/xbxVrPC3zHnCZRjSrKfhbMUlEA43iMZLu7EsnTtkJklIuwrCPbOi8YkvDQAiW05VQQFvvz9oieQ==}
+ '@types/[email protected]':
+ resolution: {integrity: sha512-ebDJ9b0e702Yr7pWgB0jzm+CX4Srzz8RcXtLJDJB+BSccqMa36uyH/zUsSYao5+BD1ytv3k3rPYCq4mAE1hsXA==}
+
resolution: {integrity: sha512-fB3Zu92ucau0iQ0JMCFQE7b/dv8Ot07NI3KaZIkIUNXq82k4eBAqUaneXfleGY9JWskeS9y+u0nXMyspcuQrCg==}
@@ -1602,6 +1657,14 @@ packages:
resolution: {integrity: sha512-4I7Td01quW/RpocfNayFdFVk1qSuoh0E7JrbRJ16nH01HhKFQ88INq9Sd+nd72zqRySlr9BmDA8xlEJ6vJMrYA==}
engines: {node: '>=8'}
+ resolution: {integrity: sha512-mv00Te6nmYbRp5DCwclxtt7yV/joXJPGS7nM+97GdxvuttCOfgI3K4U25zboyeX0O+myI8ERluxQe5wljMmVIw==}
+ peerDependencies:
+ ajv: ^8.5.0
+ peerDependenciesMeta:
+ ajv:
+ optional: true
+
resolution: {integrity: sha512-Wx0Kx52hxE7C18hkMEggYlEifqWZtYaRgouJor+WMdPnQyEK13vgEWyVNup7SoeeoLMsr4kf5h6dOW11I15MUA==}
peerDependencies:
@@ -1610,6 +1673,14 @@ packages:
ajv:
optional: true
+ resolution: {integrity: sha512-8iUql50EUR+uUcdRQ3HDqa6EVyo3docL8g5WJ3FNcWmu62IbkGUue/pEyLBW8VGKKucTPgqeks4fIU1DA4yowQ==}
+ peerDependencies:
+ ajv: ^8.0.0
+ peerDependenciesMeta:
+ ajv:
+ optional: true
+
resolution: {integrity: sha512-5p6WTN0DdTGVQk6VjcEju19IgaHudalcfabD7yhDGeA6bcQnmL+CpveLJq/3hvfwd1aof6L386Ougkx6RfyMIQ==}
peerDependencies:
@@ -1623,6 +1694,12 @@ packages:
resolution: {integrity: sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==}
+ resolution: {integrity: sha512-sRu1kpcO9yLtYxBKvqfTeh9KzZEwO3STyX1HT+4CaDzC6HpTGYhIhPIzj9XuKU7KYDwnaeh5hcOwjy1QuJzBPA==}
+
+ resolution: {integrity: sha512-PRA911Blj99jR5RMeTunVbNXMF6Lp4vZXnk5GQjcnUWUTsrXtekg/pnmFFI2u/I36Y/2bITGS30GZCXei6uNkA==}
+
resolution: {integrity: sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g==}
@@ -2250,6 +2327,12 @@ packages:
resolution: {integrity: sha512-l4gcSouhcgIKRvyy99RNVOgxXiicE+2jZoNmaNmZ6JXiGajBOJAesk1OBlJuM5k2c+eudGdLxDqXuPCKIj6kpw==}
engines: {node: '>=6'}
+ resolution: {integrity: sha512-ijpi8RkWNsHylXkcNY4KiJzzi3gcxWzDaUHPGAWSr8yJvBYV+W6mLwNiKuEcsjLNT7zbH6SszqGMT9MWaKX8zA==}
+ peerDependencies:
+ react: '>=16.8.0'
+ react-docgen-typescript: ^2.0.0
+
resolution: {integrity: sha512-jaSHPA2iQVE60Mugr/pbHzIWVR/7tp77A+e9+oYvZylupdNCwZ/5BadqcqZHdLQCsUZSvu4SlE3ob/ynN6aUAw==}
peerDependencies:
@@ -2547,6 +2630,10 @@ packages:
debug:
optional: true
+ resolution: {integrity: sha512-Ld2g8rrAyMYFXBhEqMz8ZAHBi4J4uS1i/CxGMDnjyFWddMXLVcDp051DZfu+t7+ab7Wv6SMqpWmyFIj5UbfFvg==}
+ engines: {node: '>=14'}
+
resolution: {integrity: sha512-SbH/l9ikmMWycd5puHJKTkZJKddF4iRLyW3DeZ08HTI7NGyLS38MXd/KGgeWumQO7YNQbW2u/NtPT2YowbPaGQ==}
engines: {node: '>=10', yarn: '>=1.0.0'}
@@ -2584,6 +2671,10 @@ packages:
resolution: {integrity: sha512-PmDi3uwK5nFuXh7XDTlVnS17xJS7vW36is2+w3xcv8SVxiB4NyATf4ctkVY5bkSjX0Y4nbvZCq1/EjtEyr9ktw==}
engines: {node: '>=14.14'}
+ resolution: {integrity: sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw==}
+ engines: {node: '>=6 <7 || >=8'}
+
resolution: {integrity: sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ==}
engines: {node: '>=10'}
@@ -2631,6 +2722,10 @@ packages:
resolution: {integrity: sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw==}
+ resolution: {integrity: sha512-7Bv8RF0k6xjo7d4A/PxYLbUCfb6c+Vpd2/mB2yRDlew7Jb5hEXiCD9ibfO7wpk8i4sevK6DFny9h7EYbM3/sHg==}
+ hasBin: true
+
resolution: {integrity: sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==}
deprecated: Glob versions prior to v9 are no longer supported
@@ -3023,6 +3118,9 @@ packages:
resolution: {integrity: sha512-WhB9zCku7EGTj/HQQRz5aUQEUeoQZH2bWcltRErOpymJ4boYE6wL9Tbr23krRPSZ+C5zqNSrSw+Cc7sZZ4b7vg==}
engines: {node: '>=0.10.0'}
+ resolution: {integrity: sha512-OGlZQpz2yfahA/Rd1Y8Cd9SIEsqvXkLVoSw/cgwhnhFMDbsQFeZYoJJ7bIZBS9BcamUW96asq/npPWugM+RQBw==}
+
resolution: {integrity: sha512-z6EbKajIpqGKU56y5KBUgy1dt1ihhQJgWzUlZHArA/+X2ad7Cb5iF+AK1EWVL/Bo7Rz9uurpqw6SiBCefUbCGA==}
engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
@@ -3039,6 +3137,9 @@ packages:
resolution: {integrity: sha512-/imKNG4EbWNrVjoNC/1H5/9GFy+tqjGBHCaSsN+P2RnPqjsLmv6UD3Ej+Kj8nBWaRAwyk7kK5ZUc+OEatnTR3A==}
hasBin: true
+ resolution: {integrity: sha512-8wb9Yw966OSxApiCt0K3yNJL8pnNeIv+OEq2YMidz4FKP6nonSRoOXc80iXY4JaN2FC11B9qsNmDsm+ZOfMROA==}
+
resolution: {integrity: sha512-otDA4ldcIx+ZXsKHWmp0YizCweVRZG96J10b0FevjfuncLO1oX59THoAmHkNubYJ+9gWsYsp5k8v4ib6oDv1fA==}
@@ -3080,6 +3181,9 @@ packages:
engines: {node: '>=6'}
hasBin: true
+ resolution: {integrity: sha512-m6F1R3z8jjlf2imQHS2Qez5sjKWQzbuuhuJ/FKYFRZvPE3PuHcSMVZzfsLhGVOkfd20obL5SWEBew5ShlquNxg==}
+
resolution: {integrity: sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==}
@@ -3165,9 +3269,16 @@ packages:
resolution: {integrity: sha512-ozCC6gdQ+glXOQsveKD0YsDy8DSQFjDTz4zyzEHNV5+JP5D62LmfDZ6o1cycFx9ouG940M5dE8C8CTewdj2YWQ==}
engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0}
+ resolution: {integrity: sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==}
+
resolution: {integrity: sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==}
+ resolution: {integrity: sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==}
+ engines: {node: '>=10'}
+
resolution: {integrity: sha512-zTU3DaZaF3Rt9rhN3uBMGQD3dD2/vFQqnvZCDv4dl5iOzq2IZQqTxu90r4E5J+nP70J3ilqVCrbho2eWaeW8Ow==}
@@ -3447,6 +3558,9 @@ packages:
resolution: {integrity: sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==}
+ resolution: {integrity: sha512-6FsRAQsxQ61mw+qP1ZzbL9Bc78x2p5OqNgNpnoAFLTrX8n5Kxph0CsnhmKKNXTWjXqU5L0pGPR7hYk+XWZr60Q==}
+
resolution: {integrity: sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==}
@@ -3457,6 +3571,10 @@ packages:
resolution: {integrity: sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==}
+ resolution: {integrity: sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw==}
+ engines: {node: '>=16 || 14 >=14.17'}
+
resolution: {integrity: sha512-eu38+hdgojoyq63s+yTpN4XMBdt5l8HhMhc4VKLO9KM5caLIBvUm4thi7fFaxyTmCKeNnXZ5pAlBwCUnhA09uw==}
engines: {node: '>=10'}
@@ -3611,6 +3729,9 @@ packages:
resolution: {integrity: sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==}
engines: {node: '>=6'}
+ resolution: {integrity: sha512-UEZIS3/by4OC8vL3P2dTXRETpebLI2NiI5vIrjaD/5UtrkFX/tNbwjTSRAGC/+7CAo2pIcBaRgWmcBBHcsaCIw==}
+
resolution: {integrity: sha512-cbH9IAIJHNj9uXi196JVsRlt7cHKak6u/e6AkL/bkRelZ7rlL3X1YKxsZwa36xipOEKAsdtmaG6aAJoM1fx2zA==}
engines: {node: '>=14.16'}
@@ -3671,6 +3792,10 @@ packages:
resolution: {integrity: sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==}
+ resolution: {integrity: sha512-Xa4Nw17FS9ApQFJ9umLiJS4orGjm7ZzwUrwamcGQuHSzDyth9boKDaycYdDcZDuqYATXw4HFXgaqWTctW/v1HA==}
+ engines: {node: '>=16 || 14 >=14.18'}
+
resolution: {integrity: sha512-RA1GjUVMnvYFxuqovrEqZoxxW5NUZqbwKtYz/Tt7nXerk0LbLblQmrsgdeOxV5SFHf0UDggjS/bSeOZwt1pmEQ==}
@@ -4181,6 +4306,11 @@ packages:
typescript:
optional: true
+ resolution: {integrity: sha512-tvg2ZtOpOi6QDwsb3GZhOjDkkX0h8Z2gipvTg6OVMUyoYoURhEiRNePT8NZItTVCDh39JJHnLdfCOkzoLbFnTg==}
+ peerDependencies:
+ typescript: '>= 4.3.x'
+
resolution: {integrity: sha512-5m4nQKp+rZRb09LNH59GM4BxTh9251/ylbKIbpe7TpGxfJ+9kv6BLkLBXIjjspbgbnIBNqlI23tRnTWT0snUIw==}
peerDependencies:
@@ -4449,6 +4579,11 @@ packages:
resolution: {integrity: sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==}
hasBin: true
+ resolution: {integrity: sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==}
+ engines: {node: '>=10'}
+ hasBin: true
+
resolution: {integrity: sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A==}
engines: {node: '>=10'}
@@ -4525,6 +4660,10 @@ packages:
resolution: {integrity: sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==}
+ resolution: {integrity: sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==}
+ engines: {node: '>=14'}
+
resolution: {integrity: sha512-94Bdh3cC2PKrbgSOUqTiGPWVZeSiXfKOVZNJniWoqrWrRkB1CJzBU3NEbiTsPcYy1lDsANA/THzS+9WBiy5nfQ==}
engines: {node: '>= 10'}
@@ -4602,6 +4741,10 @@ packages:
resolution: {integrity: sha512-Bc3YwwCB+OzldMxOXJIIvC6cPRWr/LxOp48CdQTOkPyk/t4JWWJbrilwBd7RJzKV8QW7tJkcgAmeuLLJugl5/w==}
+ resolution: {integrity: sha512-aqD2Q0144Z+/RqG52NeHEkZauTAUWJO8c6yTftGJKO3Tja5tUgIfmIl6kExvhtxSDP7fXB6DvzkfMpCd/F3G+Q==}
+ engines: {node: '>=0.6.19'}
+
resolution: {integrity: sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==}
engines: {node: '>=8'}
@@ -4773,6 +4916,11 @@ packages:
peerDependencies:
typescript: 5.0.x || 5.1.x || 5.2.x || 5.3.x || 5.4.x || 5.5.x || 5.6.x || 5.7.x
+ resolution: {integrity: sha512-+2/g0Fds1ERlP6JsakQQDXjZdZMM+rqpamFZJEKh4kwTIn3iDkgKtby0CeNd5ATNZ4Ry1ax15TMx0W2V+miizQ==}
+ engines: {node: '>=14.17'}
+ hasBin: true
+
resolution: {integrity: sha512-hjcS1mhfuyi4WW8IWtjP7brDrG2cuDZukyrYrSauoXGNgx0S7zceP07adYkJycEr56BOUTNPzbInooiN3fn1qw==}
engines: {node: '>=14.17'}
@@ -4829,6 +4977,10 @@ packages:
resolution: {integrity: sha512-MR04uvD+07cwl/yhVuVWAtw+3GOR/knlL55Nd/wAdblk27GCVt3lqpTivy/tkJcZoNPzTwS1Y+KMojlLDhoTzg==}
+ resolution: {integrity: sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==}
+ engines: {node: '>= 4.0.0'}
+
resolution: {integrity: sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==}
engines: {node: '>= 10.0.0'}
@@ -5029,6 +5181,9 @@ packages:
resolution: {integrity: sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==}
+ resolution: {integrity: sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==}
+
resolution: {integrity: sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg==}
engines: {node: '>= 6'}
@@ -7008,6 +7163,15 @@ snapshots:
dependencies:
'@hapi/hoek': 9.3.0
+ '@isaacs/[email protected]':
+ dependencies:
+ string-width: 5.1.2
+ string-width-cjs: [email protected]
+ strip-ansi: 7.1.0
+ strip-ansi-cjs: [email protected]
+ wrap-ansi: 8.1.0
+ wrap-ansi-cjs: [email protected]
+
dependencies:
'@sinclair/typebox': 0.27.8
@@ -7081,6 +7245,41 @@ snapshots:
'@types/react': 19.0.2
react: 18.3.1
+ '@microsoft/[email protected](@types/[email protected])':
+ dependencies:
+ '@microsoft/tsdoc': 0.15.1
+ '@microsoft/tsdoc-config': 0.17.1
+ '@rushstack/node-core-library': 5.10.1(@types/[email protected])
+ transitivePeerDependencies:
+ - '@types/node'
+
+ '@microsoft/[email protected](@types/[email protected])':
+ dependencies:
+ '@microsoft/api-extractor-model': 7.30.1(@types/[email protected])
+ '@microsoft/tsdoc': 0.15.1
+ '@microsoft/tsdoc-config': 0.17.1
+ '@rushstack/node-core-library': 5.10.1(@types/[email protected])
+ '@rushstack/rig-package': 0.5.3
+ '@rushstack/terminal': 0.14.4(@types/[email protected])
+ '@rushstack/ts-command-line': 4.23.2(@types/[email protected])
+ lodash: 4.17.21
+ minimatch: 3.0.8
+ resolve: 1.22.10
+ semver: 7.5.4
+ source-map: 0.6.1
+ typescript: 5.4.2
+ transitivePeerDependencies:
+ - '@types/node'
+
+ '@microsoft/[email protected]':
+ dependencies:
+ '@microsoft/tsdoc': 0.15.1
+ ajv: 8.12.0
+ jju: 1.4.0
+ resolve: 1.22.10
+
+ '@microsoft/[email protected]': {}
+
'@nodelib/[email protected]':
dependencies:
'@nodelib/fs.stat': 2.0.5
@@ -7093,6 +7292,9 @@ snapshots:
'@nodelib/fs.scandir': 2.1.5
fastq: 1.18.0
+ '@pkgjs/[email protected]':
+ optional: true
+
'@pnpm/[email protected]': {}
@@ -7107,6 +7309,40 @@ snapshots:
'@polka/[email protected]': {}
+ '@rushstack/[email protected](@types/[email protected])':
+ dependencies:
+ ajv: 8.13.0
+ ajv-draft-04: 1.0.0([email protected])
+ ajv-formats: 3.0.1([email protected])
+ fs-extra: 7.0.1
+ import-lazy: 4.0.0
+ jju: 1.4.0
+ resolve: 1.22.10
+ semver: 7.5.4
+ optionalDependencies:
+ '@types/node': 22.10.2
+
+ '@rushstack/[email protected]':
+ dependencies:
+ resolve: 1.22.10
+ strip-json-comments: 3.1.1
+
+ '@rushstack/[email protected](@types/[email protected])':
+ dependencies:
+ '@rushstack/node-core-library': 5.10.1(@types/[email protected])
+ supports-color: 8.1.1
+ optionalDependencies:
+ '@types/node': 22.10.2
+
+ '@rushstack/[email protected](@types/[email protected])':
+ dependencies:
+ '@rushstack/terminal': 0.14.4(@types/[email protected])
+ '@types/argparse': 1.0.38
+ argparse: 1.0.10
+ string-argv: 0.3.2
+ transitivePeerDependencies:
+ - '@types/node'
+
'@shikijs/[email protected]':
dependencies:
'@shikijs/types': 1.24.4
@@ -7242,6 +7478,8 @@ snapshots:
dependencies:
'@types/estree': 1.0.6
+ '@types/[email protected]': {}
+
dependencies:
'@types/connect': 3.4.38
@@ -7523,10 +7761,18 @@ snapshots:
clean-stack: 2.2.0
indent-string: 4.0.0
+ optionalDependencies:
+ ajv: 8.13.0
+
optionalDependencies:
ajv: 8.17.1
+ optionalDependencies:
+ ajv: 8.13.0
+
dependencies:
ajv: 6.12.6
@@ -7543,6 +7789,20 @@ snapshots:
json-schema-traverse: 0.4.1
uri-js: 4.4.1
+ dependencies:
+ fast-deep-equal: 3.1.3
+ json-schema-traverse: 1.0.0
+ require-from-string: 2.0.2
+ uri-js: 4.4.1
+
+ dependencies:
+ fast-deep-equal: 3.1.3
+ json-schema-traverse: 1.0.0
+ require-from-string: 2.0.2
+ uri-js: 4.4.1
+
dependencies:
fast-deep-equal: 3.1.3
@@ -8235,6 +8495,12 @@ snapshots:
dependencies:
'@leichtgewicht/ip-codec': 2.0.5
+ dependencies:
+ glob: 10.4.5
+ react: 18.3.1
+ react-docgen-typescript: 2.2.2([email protected])
+
dependencies:
typedoc-plugin-markdown: 4.3.3([email protected]([email protected]))
@@ -8565,6 +8831,11 @@ snapshots:
+ dependencies:
+ cross-spawn: 7.0.6
+ signal-exit: 4.1.0
+
dependencies:
'@babel/code-frame': 7.26.2
@@ -8599,6 +8870,12 @@ snapshots:
jsonfile: 6.1.0
universalify: 2.0.1
+ dependencies:
+ graceful-fs: 4.2.11
+ jsonfile: 4.0.0
+ universalify: 0.1.2
+
dependencies:
at-least-node: 1.0.0
@@ -8646,6 +8923,15 @@ snapshots:
+ dependencies:
+ foreground-child: 3.3.0
+ jackspeak: 3.4.3
+ minimatch: 9.0.5
+ minipass: 7.1.2
+ package-json-from-dist: 1.0.1
+ path-scurry: 1.11.1
+
dependencies:
fs.realpath: 1.0.0
@@ -9091,6 +9377,12 @@ snapshots:
+ dependencies:
+ '@isaacs/cliui': 8.0.2
+ optionalDependencies:
+ '@pkgjs/parseargs': 0.11.0
+
dependencies:
'@jest/types': 29.6.3
@@ -9115,6 +9407,8 @@ snapshots:
+
dependencies:
'@hapi/hoek': 9.3.0
@@ -9148,6 +9442,10 @@ snapshots:
+ optionalDependencies:
+ graceful-fs: 4.2.11
+
dependencies:
universalify: 2.0.1
@@ -9224,10 +9522,16 @@ snapshots:
+
dependencies:
yallist: 3.1.1
+ dependencies:
+ yallist: 4.0.0
+
@@ -9788,6 +10092,10 @@ snapshots:
+ dependencies:
+ brace-expansion: 1.1.11
+
dependencies:
brace-expansion: 1.1.11
@@ -9798,6 +10106,8 @@ snapshots:
+
@@ -9931,6 +10241,8 @@ snapshots:
+
dependencies:
got: 12.6.1
@@ -9996,6 +10308,11 @@ snapshots:
+ dependencies:
+ lru-cache: 10.4.3
+ minipass: 7.1.2
+
@@ -10564,6 +10881,10 @@ snapshots:
- supports-color
- vue-template-compiler
+ dependencies:
+ typescript: 5.6.3
+
dependencies:
loose-envify: 1.4.0
@@ -10919,6 +11240,10 @@ snapshots:
+ dependencies:
+ lru-cache: 6.0.0
+
@@ -11037,6 +11362,8 @@ snapshots:
+
dependencies:
'@polka/url': 1.0.0-next.28
@@ -11117,6 +11444,8 @@ snapshots:
+
dependencies:
emoji-regex: 8.0.0
@@ -11270,6 +11599,8 @@ snapshots:
typescript: 5.6.3
yaml: 2.6.1
+
@@ -11330,6 +11661,8 @@ snapshots:
unist-util-is: 6.0.0
unist-util-visit-parents: 6.0.1
+
@@ -11588,6 +11921,8 @@ snapshots:
+
diff --git a/frontend-sdk/packages/react-core/src/ChatProvider.tsx b/frontend-sdk/packages/react-core/src/ChatProvider.tsx
index b62e84dc9..9058fd49e 100644
--- a/frontend-sdk/packages/react-core/src/ChatProvider.tsx
+++ b/frontend-sdk/packages/react-core/src/ChatProvider.tsx
@@ -3,26 +3,46 @@ import { ChatContext } from "./internal/ChatContext";
import { ChatManager } from "./types";
import { useThreadListManagerStore } from "./internal/useThreadListManagerStore";
import { useThreadManagerStore } from "./internal/useThreadManagerStore";
+import { FC } from "react";
-export const ChatProvider = ({
+/**
+ * @category Components
+ *
+ * @remarks
+ * ChatProvider is a React component that provides chat management context to its children.
+ * It serves as the top-level provider for thread and thread list management functionality.
+ *
+ * @example
+ * ```tsx
+ * <ChatProvider
+ * threadManager={myThreadManager}
+ * threadListManager={myThreadListManager}
+ * >
+ * <App />
+ * </ChatProvider>
+ * ```
+ *
+ * @param props - The component props
+ * @param props.threadManager - The thread manager instance for handling individual chat threads
+ * @param props.threadListManager - The thread list manager instance for handling multiple chat threads
+ * @param props.children - The child components that will have access to the chat context
+ * @returns A ChatContext.Provider wrapping the children components
+ */
+export const ChatProvider: FC<React.PropsWithChildren<ChatManager>> = ({
threadManager: inputThreadManager,
threadListManager: inputThreadListManager,
children,
}: React.PropsWithChildren<ChatManager>) => {
const threadManagerStore = useThreadManagerStore(inputThreadManager);
- const threadListManagerStore = useThreadListManagerStore(
- inputThreadListManager
- );
+ const threadListManagerStore = useThreadListManagerStore(inputThreadListManager);
const ctxValue = useMemo(
() => ({
threadListManager: threadListManagerStore,
threadManager: threadManagerStore,
}),
- [threadListManagerStore, threadManagerStore]
+ [threadListManagerStore, threadManagerStore],
);
- return (
- <ChatContext.Provider value={ctxValue}>{children}</ChatContext.Provider>
- );
+ return <ChatContext.Provider value={ctxValue}>{children}</ChatContext.Provider>;
};
diff --git a/frontend-sdk/packages/react-core/src/hooks/useThreadActions.ts b/frontend-sdk/packages/react-core/src/hooks/useThreadActions.ts
index 7173b086f..9b8ae129f 100644
--- a/frontend-sdk/packages/react-core/src/hooks/useThreadActions.ts
+++ b/frontend-sdk/packages/react-core/src/hooks/useThreadActions.ts
@@ -2,6 +2,12 @@ import { useStore } from "zustand";
import { useChatContext } from "../internal/ChatContext";
import { ThreadActions } from "../types";
+/**
+ * @category Hooks
+ *
+ * @remarks
+ * useThreadActions
+ */
export const useThreadActions = (): ThreadActions => {
const { threadManager } = useChatContext();
diff --git a/frontend-sdk/packages/react-core/src/hooks/useThreadListActions.ts b/frontend-sdk/packages/react-core/src/hooks/useThreadListActions.ts
index e56a4caa5..63256275e 100644
--- a/frontend-sdk/packages/react-core/src/hooks/useThreadListActions.ts
+++ b/frontend-sdk/packages/react-core/src/hooks/useThreadListActions.ts
@@ -2,6 +2,12 @@ import { useStore } from "zustand";
import { useChatContext } from "../internal/ChatContext";
import { ThreadListActions } from "../types";
+/**
+ * @category Hooks
+ *
+ * @remarks
+ * useThreadListActions
+ */
export const useThreadListActions = (): ThreadListActions => {
const { threadListManager } = useChatContext();
return {
diff --git a/frontend-sdk/packages/react-core/src/hooks/useThreadListState.ts b/frontend-sdk/packages/react-core/src/hooks/useThreadListState.ts
index 464ba3c6a..5ad9d7389 100644
--- a/frontend-sdk/packages/react-core/src/hooks/useThreadListState.ts
+++ b/frontend-sdk/packages/react-core/src/hooks/useThreadListState.ts
@@ -2,6 +2,12 @@ import { useStore } from "zustand";
import { useChatContext } from "../internal/ChatContext";
import { ThreadListState } from "../types";
+/**
+ * @category Hooks
+ *
+ * @remarks
+ * useThreadListState
+ */
export const useThreadListState = (): ThreadListState => {
const { threadListManager } = useChatContext();
return {
diff --git a/frontend-sdk/packages/react-core/src/hooks/useThreadState.ts b/frontend-sdk/packages/react-core/src/hooks/useThreadState.ts
index a32fae974..46e025fc2 100644
--- a/frontend-sdk/packages/react-core/src/hooks/useThreadState.ts
+++ b/frontend-sdk/packages/react-core/src/hooks/useThreadState.ts
@@ -2,6 +2,12 @@ import { useStore } from "zustand";
import { useChatContext } from "../internal/ChatContext";
import { ThreadState } from "../types";
+/**
+ * @category Hooks
+ *
+ * @remarks
+ * useThreadState
+ */
export const useThreadState = (): ThreadState => {
const { threadManager } = useChatContext();
diff --git a/frontend-sdk/packages/react-core/src/index.ts b/frontend-sdk/packages/react-core/src/index.ts
index 8f82c8699..df1487ba2 100644
--- a/frontend-sdk/packages/react-core/src/index.ts
+++ b/frontend-sdk/packages/react-core/src/index.ts
@@ -4,3 +4,4 @@ export { useThreadActions } from "./hooks/useThreadActions";
export { useThreadListActions } from "./hooks/useThreadListActions";
export { useThreadListState } from "./hooks/useThreadListState";
export { useThreadState } from "./hooks/useThreadState";
+export * from "./types";
diff --git a/frontend-sdk/packages/react-core/src/types.ts b/frontend-sdk/packages/react-core/src/types.ts
index e58559942..c57af481e 100644
--- a/frontend-sdk/packages/react-core/src/types.ts
+++ b/frontend-sdk/packages/react-core/src/types.ts
@@ -1,34 +1,54 @@
import { Message as VercelMessage } from "ai";
+/** Represents a chat message, extending Vercel's Message type */
export type Message = VercelMessage;
+/**
+ * Represents a message being created, with an optional ID
+ * @extends Omit<Message, "id">
+ */
export type CreateMessage = Omit<Message, "id"> & {
id?: Message["id"];
};
+/**
+ * Function type for converting between message types
+ * @template T - The source message type
+ */
export type MessageConverter<T = Message> = (message: T) => Message;
+/**
+ * Represents a chat thread
+ */
export type Thread = {
+ /** Unique identifier for the thread */
threadId: string;
+ /** Title of the thread */
title: string;
+ /** Creation timestamp */
createdAt: Date;
+ /** Indicates if the thread is currently processing */
isRunning: boolean;
};
+/**
+ * Actions available for managing a thread
+ * @template T - The message type used in the thread
+ */
export type ThreadActions<T = Message> = {
- // add new message
onNew: (message: CreateMessage) => void;
- // reload current chat message
onReload?: (messageId: string) => undefined;
- // stop current processing
onCancel?: () => void;
onAddToolResult?:
| ((props: { toolCallId: string; result: any }) => Promise<void> | void)
| undefined;
- // convert message to message renderes message type
convertMessage: T extends Message ? MessageConverter<T> | undefined : MessageConverter<T>;
};
+/**
+ * Represents the state of a thread
+ * @template T - The message type used in the thread
+ */
export type ThreadState<T = Message> = {
isDisabled?: boolean | undefined;
isRunning?: boolean | undefined;
@@ -36,25 +56,39 @@ export type ThreadState<T = Message> = {
error: Error | null | undefined;
};
+/**
+ * Combines thread state and actions
+ * @template T - The message type used in the thread
+ */
export type ThreadManager<T = Message> = ThreadState<T> & ThreadActions<T>;
+/**
+ * Represents the state of the thread list
+ */
export type ThreadListState = {
threads: Thread[];
isLoading: boolean;
error: Error | null | undefined;
};
+/**
+ * Actions available for managing the thread list
+ */
export type ThreadListActions = {
- // trigger load thread
load: () => void;
- // switch to new thread
switchToNew: () => void;
updateThread: (thread: Thread) => void;
deleteThread: (threadId: string) => void;
};
+/**
+ * Combines thread list state and actions
+ */
export type ThreadListManager = ThreadListState & ThreadListActions;
+/**
+ * Main chat manager combining thread and thread list management
+ */
export type ChatManager = {
threadListManager: ThreadListManager;
threadManager: ThreadManager;