@assistant-ui/react 0.0.29 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/AssistantRuntime-BM_jVV3g.d.mts +23 -0
- package/dist/AssistantRuntime-CBMSAJqH.d.mts +23 -0
- package/dist/AssistantRuntime-C_BvM7ZT.d.ts +23 -0
- package/dist/AssistantRuntime-DELpXWfG.d.ts +23 -0
- package/dist/ModelConfigTypes-B9UY4zxv.d.mts +55 -0
- package/dist/ModelConfigTypes-B9UY4zxv.d.ts +55 -0
- package/dist/ModelConfigTypes-BF5HxVrH.d.mts +55 -0
- package/dist/ModelConfigTypes-BF5HxVrH.d.ts +55 -0
- package/dist/ModelConfigTypes-Cf3yjaDu.d.mts +55 -0
- package/dist/ModelConfigTypes-Cf3yjaDu.d.ts +55 -0
- package/dist/ModelConfigTypes-CzmXY3sn.d.mts +55 -0
- package/dist/ModelConfigTypes-CzmXY3sn.d.ts +55 -0
- package/dist/Thread-BMASJT4a.d.ts +15 -0
- package/dist/Thread-UEVsUmvl.d.mts +15 -0
- package/dist/chunk-3XZUKECF.mjs +207 -0
- package/dist/chunk-3XZUKECF.mjs.map +1 -0
- package/dist/chunk-4DQ2CIAD.mjs +69 -0
- package/dist/chunk-4DQ2CIAD.mjs.map +1 -0
- package/dist/chunk-5YONSDN4.mjs +200 -0
- package/dist/chunk-5YONSDN4.mjs.map +1 -0
- package/dist/chunk-CY4TTHR7.mjs +76 -0
- package/dist/chunk-CY4TTHR7.mjs.map +1 -0
- package/dist/chunk-DKAWDNW5.mjs +22 -0
- package/dist/chunk-DKAWDNW5.mjs.map +1 -0
- package/dist/chunk-GQKH2ADD.mjs +165 -0
- package/dist/chunk-GQKH2ADD.mjs.map +1 -0
- package/dist/chunk-J5LGTIGS.mjs +10 -0
- package/dist/chunk-J5LGTIGS.mjs.map +1 -0
- package/dist/chunk-NSBOH42A.mjs +200 -0
- package/dist/chunk-NSBOH42A.mjs.map +1 -0
- package/dist/chunk-X4HBDEFP.mjs +30 -0
- package/dist/chunk-X4HBDEFP.mjs.map +1 -0
- package/dist/experimental.d.mts +86 -0
- package/dist/experimental.d.ts +86 -0
- package/dist/experimental.js +123 -0
- package/dist/experimental.js.map +1 -0
- package/dist/experimental.mjs +34 -0
- package/dist/experimental.mjs.map +1 -0
- package/dist/index.d.mts +11 -230
- package/dist/index.d.ts +11 -230
- package/dist/index.js +189 -577
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +140 -757
- package/dist/index.mjs.map +1 -1
- package/dist/internal-dlLjX30u.d.mts +75 -0
- package/dist/internal-dlLjX30u.d.ts +75 -0
- package/dist/internal.d.mts +25 -0
- package/dist/internal.d.ts +25 -0
- package/dist/internal.js +225 -0
- package/dist/internal.js.map +1 -0
- package/dist/internal.mjs +10 -0
- package/dist/internal.mjs.map +1 -0
- package/package.json +23 -3
@@ -0,0 +1,23 @@
|
|
1
|
+
import { c as ThreadMessage, d as AppendMessage, b as ModelConfigProvider } from './ModelConfigTypes-BF5HxVrH.mjs';
|
2
|
+
|
3
|
+
type Unsubscribe = () => void;
|
4
|
+
|
5
|
+
type ThreadState = {
|
6
|
+
messages: readonly ThreadMessage[];
|
7
|
+
isRunning: boolean;
|
8
|
+
getBranches: (messageId: string) => readonly string[];
|
9
|
+
switchToBranch: (branchId: string) => void;
|
10
|
+
append: (message: AppendMessage) => void;
|
11
|
+
startRun: (parentId: string | null) => void;
|
12
|
+
cancelRun: () => void;
|
13
|
+
};
|
14
|
+
|
15
|
+
type ThreadRuntime = Readonly<ThreadState & {
|
16
|
+
subscribe: (callback: () => void) => Unsubscribe;
|
17
|
+
}>;
|
18
|
+
|
19
|
+
type AssistantRuntime = ThreadRuntime & {
|
20
|
+
registerModelConfigProvider: (provider: ModelConfigProvider) => Unsubscribe;
|
21
|
+
};
|
22
|
+
|
23
|
+
export type { AssistantRuntime as A, ThreadRuntime as T, Unsubscribe as U, ThreadState as a };
|
@@ -0,0 +1,23 @@
|
|
1
|
+
import { b as ThreadMessage, d as AppendMessage, h as ModelConfigProvider } from './ModelConfigTypes-B9UY4zxv.mjs';
|
2
|
+
|
3
|
+
type Unsubscribe = () => void;
|
4
|
+
|
5
|
+
type ThreadState = {
|
6
|
+
messages: readonly ThreadMessage[];
|
7
|
+
isRunning: boolean;
|
8
|
+
getBranches: (messageId: string) => readonly string[];
|
9
|
+
switchToBranch: (branchId: string) => void;
|
10
|
+
append: (message: AppendMessage) => void;
|
11
|
+
startRun: (parentId: string | null) => void;
|
12
|
+
cancelRun: () => void;
|
13
|
+
};
|
14
|
+
|
15
|
+
type ThreadRuntime = Readonly<ThreadState & {
|
16
|
+
subscribe: (callback: () => void) => Unsubscribe;
|
17
|
+
}>;
|
18
|
+
|
19
|
+
type AssistantRuntime = ThreadRuntime & {
|
20
|
+
registerModelConfigProvider: (provider: ModelConfigProvider) => Unsubscribe;
|
21
|
+
};
|
22
|
+
|
23
|
+
export type { AssistantRuntime as A, ThreadRuntime as T, Unsubscribe as U, ThreadState as a };
|
@@ -0,0 +1,23 @@
|
|
1
|
+
import { b as ThreadMessage, d as AppendMessage, h as ModelConfigProvider } from './ModelConfigTypes-B9UY4zxv.js';
|
2
|
+
|
3
|
+
type Unsubscribe = () => void;
|
4
|
+
|
5
|
+
type ThreadState = {
|
6
|
+
messages: readonly ThreadMessage[];
|
7
|
+
isRunning: boolean;
|
8
|
+
getBranches: (messageId: string) => readonly string[];
|
9
|
+
switchToBranch: (branchId: string) => void;
|
10
|
+
append: (message: AppendMessage) => void;
|
11
|
+
startRun: (parentId: string | null) => void;
|
12
|
+
cancelRun: () => void;
|
13
|
+
};
|
14
|
+
|
15
|
+
type ThreadRuntime = Readonly<ThreadState & {
|
16
|
+
subscribe: (callback: () => void) => Unsubscribe;
|
17
|
+
}>;
|
18
|
+
|
19
|
+
type AssistantRuntime = ThreadRuntime & {
|
20
|
+
registerModelConfigProvider: (provider: ModelConfigProvider) => Unsubscribe;
|
21
|
+
};
|
22
|
+
|
23
|
+
export type { AssistantRuntime as A, ThreadRuntime as T, Unsubscribe as U, ThreadState as a };
|
@@ -0,0 +1,23 @@
|
|
1
|
+
import { c as ThreadMessage, d as AppendMessage, b as ModelConfigProvider } from './ModelConfigTypes-BF5HxVrH.js';
|
2
|
+
|
3
|
+
type Unsubscribe = () => void;
|
4
|
+
|
5
|
+
type ThreadState = {
|
6
|
+
messages: readonly ThreadMessage[];
|
7
|
+
isRunning: boolean;
|
8
|
+
getBranches: (messageId: string) => readonly string[];
|
9
|
+
switchToBranch: (branchId: string) => void;
|
10
|
+
append: (message: AppendMessage) => void;
|
11
|
+
startRun: (parentId: string | null) => void;
|
12
|
+
cancelRun: () => void;
|
13
|
+
};
|
14
|
+
|
15
|
+
type ThreadRuntime = Readonly<ThreadState & {
|
16
|
+
subscribe: (callback: () => void) => Unsubscribe;
|
17
|
+
}>;
|
18
|
+
|
19
|
+
type AssistantRuntime = ThreadRuntime & {
|
20
|
+
registerModelConfigProvider: (provider: ModelConfigProvider) => Unsubscribe;
|
21
|
+
};
|
22
|
+
|
23
|
+
export type { AssistantRuntime as A, ThreadRuntime as T, Unsubscribe as U, ThreadState as a };
|
@@ -0,0 +1,55 @@
|
|
1
|
+
import { ReactNode } from 'react';
|
2
|
+
import { z } from 'zod';
|
3
|
+
|
4
|
+
type TextContentPart = {
|
5
|
+
type: "text";
|
6
|
+
text: string;
|
7
|
+
};
|
8
|
+
type ImageContentPart = {
|
9
|
+
type: "image";
|
10
|
+
image: string;
|
11
|
+
};
|
12
|
+
type UIContentPart = {
|
13
|
+
type: "ui";
|
14
|
+
display: ReactNode;
|
15
|
+
};
|
16
|
+
type ToolCallContentPart = {
|
17
|
+
type: "tool-call";
|
18
|
+
name: string;
|
19
|
+
args: object;
|
20
|
+
result?: object;
|
21
|
+
};
|
22
|
+
type UserContentPart = TextContentPart | ImageContentPart | UIContentPart;
|
23
|
+
type AssistantContentPart = TextContentPart | UIContentPart | ToolCallContentPart;
|
24
|
+
type AppendContentPart = TextContentPart | ImageContentPart;
|
25
|
+
type BaseMessage = {
|
26
|
+
id: string;
|
27
|
+
createdAt: Date;
|
28
|
+
};
|
29
|
+
type UserMessage = BaseMessage & {
|
30
|
+
role: "user";
|
31
|
+
content: UserContentPart[];
|
32
|
+
};
|
33
|
+
type AssistantMessage = BaseMessage & {
|
34
|
+
role: "assistant";
|
35
|
+
content: AssistantContentPart[];
|
36
|
+
status: "in_progress" | "done" | "error";
|
37
|
+
};
|
38
|
+
type AppendMessage = {
|
39
|
+
parentId: string | null;
|
40
|
+
content: AppendContentPart[];
|
41
|
+
};
|
42
|
+
type ThreadMessage = UserMessage | AssistantMessage;
|
43
|
+
|
44
|
+
type Tool<TArgs> = {
|
45
|
+
description: string;
|
46
|
+
parameters: z.ZodSchema<TArgs>;
|
47
|
+
execute: (args: TArgs) => unknown;
|
48
|
+
};
|
49
|
+
type ModelConfig = {
|
50
|
+
system?: string;
|
51
|
+
tools?: Record<string, Tool<any>>;
|
52
|
+
};
|
53
|
+
type ModelConfigProvider = () => ModelConfig;
|
54
|
+
|
55
|
+
export type { AssistantMessage as A, ImageContentPart as I, ModelConfig as M, TextContentPart as T, UIContentPart as U, ToolCallContentPart as a, ThreadMessage as b, UserMessage as c, AppendMessage as d, AssistantContentPart as e, UserContentPart as f, AppendContentPart as g, ModelConfigProvider as h };
|
@@ -0,0 +1,55 @@
|
|
1
|
+
import { ReactNode } from 'react';
|
2
|
+
import { z } from 'zod';
|
3
|
+
|
4
|
+
type TextContentPart = {
|
5
|
+
type: "text";
|
6
|
+
text: string;
|
7
|
+
};
|
8
|
+
type ImageContentPart = {
|
9
|
+
type: "image";
|
10
|
+
image: string;
|
11
|
+
};
|
12
|
+
type UIContentPart = {
|
13
|
+
type: "ui";
|
14
|
+
display: ReactNode;
|
15
|
+
};
|
16
|
+
type ToolCallContentPart = {
|
17
|
+
type: "tool-call";
|
18
|
+
name: string;
|
19
|
+
args: object;
|
20
|
+
result?: object;
|
21
|
+
};
|
22
|
+
type UserContentPart = TextContentPart | ImageContentPart | UIContentPart;
|
23
|
+
type AssistantContentPart = TextContentPart | UIContentPart | ToolCallContentPart;
|
24
|
+
type AppendContentPart = TextContentPart | ImageContentPart;
|
25
|
+
type BaseMessage = {
|
26
|
+
id: string;
|
27
|
+
createdAt: Date;
|
28
|
+
};
|
29
|
+
type UserMessage = BaseMessage & {
|
30
|
+
role: "user";
|
31
|
+
content: UserContentPart[];
|
32
|
+
};
|
33
|
+
type AssistantMessage = BaseMessage & {
|
34
|
+
role: "assistant";
|
35
|
+
content: AssistantContentPart[];
|
36
|
+
status: "in_progress" | "done" | "error";
|
37
|
+
};
|
38
|
+
type AppendMessage = {
|
39
|
+
parentId: string | null;
|
40
|
+
content: AppendContentPart[];
|
41
|
+
};
|
42
|
+
type ThreadMessage = UserMessage | AssistantMessage;
|
43
|
+
|
44
|
+
type Tool<TArgs> = {
|
45
|
+
description: string;
|
46
|
+
parameters: z.ZodSchema<TArgs>;
|
47
|
+
execute: (args: TArgs) => unknown;
|
48
|
+
};
|
49
|
+
type ModelConfig = {
|
50
|
+
system?: string;
|
51
|
+
tools?: Record<string, Tool<any>>;
|
52
|
+
};
|
53
|
+
type ModelConfigProvider = () => ModelConfig;
|
54
|
+
|
55
|
+
export type { AssistantMessage as A, ImageContentPart as I, ModelConfig as M, TextContentPart as T, UIContentPart as U, ToolCallContentPart as a, ThreadMessage as b, UserMessage as c, AppendMessage as d, AssistantContentPart as e, UserContentPart as f, AppendContentPart as g, ModelConfigProvider as h };
|
@@ -0,0 +1,55 @@
|
|
1
|
+
import { ReactNode } from 'react';
|
2
|
+
import { z } from 'zod';
|
3
|
+
|
4
|
+
type TextContentPart = {
|
5
|
+
type: "text";
|
6
|
+
text: string;
|
7
|
+
};
|
8
|
+
type ImageContentPart = {
|
9
|
+
type: "image";
|
10
|
+
image: string;
|
11
|
+
};
|
12
|
+
type UIContentPart = {
|
13
|
+
type: "ui";
|
14
|
+
display: ReactNode;
|
15
|
+
};
|
16
|
+
type ToolCallContentPart = {
|
17
|
+
type: "tool-call";
|
18
|
+
name: string;
|
19
|
+
args: object;
|
20
|
+
result?: object;
|
21
|
+
};
|
22
|
+
type UserContentPart = TextContentPart | ImageContentPart | UIContentPart;
|
23
|
+
type AssistantContentPart = TextContentPart | UIContentPart | ToolCallContentPart;
|
24
|
+
type AppendContentPart = TextContentPart | ImageContentPart;
|
25
|
+
type BaseMessage = {
|
26
|
+
id: string;
|
27
|
+
createdAt: Date;
|
28
|
+
};
|
29
|
+
type UserMessage = BaseMessage & {
|
30
|
+
role: "user";
|
31
|
+
content: UserContentPart[];
|
32
|
+
};
|
33
|
+
type AssistantMessage = BaseMessage & {
|
34
|
+
role: "assistant";
|
35
|
+
content: AssistantContentPart[];
|
36
|
+
status: "in_progress" | "done" | "error";
|
37
|
+
};
|
38
|
+
type AppendMessage = {
|
39
|
+
parentId: string | null;
|
40
|
+
content: AppendContentPart[];
|
41
|
+
};
|
42
|
+
type ThreadMessage = UserMessage | AssistantMessage;
|
43
|
+
|
44
|
+
type Tool<TArgs> = {
|
45
|
+
description: string;
|
46
|
+
parameters: z.ZodSchema<TArgs>;
|
47
|
+
execute: (args: TArgs) => unknown;
|
48
|
+
};
|
49
|
+
type ModelConfig = {
|
50
|
+
system?: string;
|
51
|
+
tools?: Record<string, Tool<any>>;
|
52
|
+
};
|
53
|
+
type ModelConfigProvider = () => ModelConfig;
|
54
|
+
|
55
|
+
export type { AssistantContentPart as A, ImageContentPart as I, ModelConfig as M, TextContentPart as T, UIContentPart as U, ToolCallContentPart as a, ModelConfigProvider as b, ThreadMessage as c, AppendMessage as d, AssistantMessage as e, UserMessage as f, UserContentPart as g, AppendContentPart as h };
|
@@ -0,0 +1,55 @@
|
|
1
|
+
import { ReactNode } from 'react';
|
2
|
+
import { z } from 'zod';
|
3
|
+
|
4
|
+
type TextContentPart = {
|
5
|
+
type: "text";
|
6
|
+
text: string;
|
7
|
+
};
|
8
|
+
type ImageContentPart = {
|
9
|
+
type: "image";
|
10
|
+
image: string;
|
11
|
+
};
|
12
|
+
type UIContentPart = {
|
13
|
+
type: "ui";
|
14
|
+
display: ReactNode;
|
15
|
+
};
|
16
|
+
type ToolCallContentPart = {
|
17
|
+
type: "tool-call";
|
18
|
+
name: string;
|
19
|
+
args: object;
|
20
|
+
result?: object;
|
21
|
+
};
|
22
|
+
type UserContentPart = TextContentPart | ImageContentPart | UIContentPart;
|
23
|
+
type AssistantContentPart = TextContentPart | UIContentPart | ToolCallContentPart;
|
24
|
+
type AppendContentPart = TextContentPart | ImageContentPart;
|
25
|
+
type BaseMessage = {
|
26
|
+
id: string;
|
27
|
+
createdAt: Date;
|
28
|
+
};
|
29
|
+
type UserMessage = BaseMessage & {
|
30
|
+
role: "user";
|
31
|
+
content: UserContentPart[];
|
32
|
+
};
|
33
|
+
type AssistantMessage = BaseMessage & {
|
34
|
+
role: "assistant";
|
35
|
+
content: AssistantContentPart[];
|
36
|
+
status: "in_progress" | "done" | "error";
|
37
|
+
};
|
38
|
+
type AppendMessage = {
|
39
|
+
parentId: string | null;
|
40
|
+
content: AppendContentPart[];
|
41
|
+
};
|
42
|
+
type ThreadMessage = UserMessage | AssistantMessage;
|
43
|
+
|
44
|
+
type Tool<TArgs> = {
|
45
|
+
description: string;
|
46
|
+
parameters: z.ZodSchema<TArgs>;
|
47
|
+
execute: (args: TArgs) => unknown;
|
48
|
+
};
|
49
|
+
type ModelConfig = {
|
50
|
+
system?: string;
|
51
|
+
tools?: Record<string, Tool<any>>;
|
52
|
+
};
|
53
|
+
type ModelConfigProvider = () => ModelConfig;
|
54
|
+
|
55
|
+
export type { AssistantContentPart as A, ImageContentPart as I, ModelConfig as M, TextContentPart as T, UIContentPart as U, ToolCallContentPart as a, ModelConfigProvider as b, ThreadMessage as c, AppendMessage as d, AssistantMessage as e, UserMessage as f, UserContentPart as g, AppendContentPart as h };
|
@@ -0,0 +1,55 @@
|
|
1
|
+
import { ReactNode } from 'react';
|
2
|
+
import { z } from 'zod';
|
3
|
+
|
4
|
+
type TextContentPart = {
|
5
|
+
type: "text";
|
6
|
+
text: string;
|
7
|
+
};
|
8
|
+
type ImageContentPart = {
|
9
|
+
type: "image";
|
10
|
+
image: string;
|
11
|
+
};
|
12
|
+
type UIContentPart = {
|
13
|
+
type: "ui";
|
14
|
+
display: ReactNode;
|
15
|
+
};
|
16
|
+
type ToolCallContentPart = {
|
17
|
+
type: "tool-call";
|
18
|
+
name: string;
|
19
|
+
args: object;
|
20
|
+
result?: object;
|
21
|
+
};
|
22
|
+
type UserContentPart = TextContentPart | ImageContentPart | UIContentPart;
|
23
|
+
type AssistantContentPart = TextContentPart | UIContentPart | ToolCallContentPart;
|
24
|
+
type AppendContentPart = TextContentPart | ImageContentPart;
|
25
|
+
type BaseMessage = {
|
26
|
+
id: string;
|
27
|
+
createdAt: Date;
|
28
|
+
};
|
29
|
+
type UserMessage = BaseMessage & {
|
30
|
+
role: "user";
|
31
|
+
content: UserContentPart[];
|
32
|
+
};
|
33
|
+
type AssistantMessage = BaseMessage & {
|
34
|
+
role: "assistant";
|
35
|
+
content: AssistantContentPart[];
|
36
|
+
status: "in_progress" | "done" | "error";
|
37
|
+
};
|
38
|
+
type AppendMessage = {
|
39
|
+
parentId: string | null;
|
40
|
+
content: AppendContentPart[];
|
41
|
+
};
|
42
|
+
type ThreadMessage = UserMessage | AssistantMessage;
|
43
|
+
|
44
|
+
type Tool<TArgs> = {
|
45
|
+
description: string;
|
46
|
+
parameters: z.ZodSchema<TArgs>;
|
47
|
+
execute: (args: TArgs) => unknown;
|
48
|
+
};
|
49
|
+
type ModelConfig = {
|
50
|
+
system?: string;
|
51
|
+
tools?: Record<string, Tool<any>>;
|
52
|
+
};
|
53
|
+
type ModelConfigProvider = () => ModelConfig;
|
54
|
+
|
55
|
+
export type { AppendMessage as A, ImageContentPart as I, ModelConfigProvider as M, TextContentPart as T, UIContentPart as U, ToolCallContentPart as a, ThreadMessage as b, ModelConfig as c };
|
@@ -0,0 +1,55 @@
|
|
1
|
+
import { ReactNode } from 'react';
|
2
|
+
import { z } from 'zod';
|
3
|
+
|
4
|
+
type TextContentPart = {
|
5
|
+
type: "text";
|
6
|
+
text: string;
|
7
|
+
};
|
8
|
+
type ImageContentPart = {
|
9
|
+
type: "image";
|
10
|
+
image: string;
|
11
|
+
};
|
12
|
+
type UIContentPart = {
|
13
|
+
type: "ui";
|
14
|
+
display: ReactNode;
|
15
|
+
};
|
16
|
+
type ToolCallContentPart = {
|
17
|
+
type: "tool-call";
|
18
|
+
name: string;
|
19
|
+
args: object;
|
20
|
+
result?: object;
|
21
|
+
};
|
22
|
+
type UserContentPart = TextContentPart | ImageContentPart | UIContentPart;
|
23
|
+
type AssistantContentPart = TextContentPart | UIContentPart | ToolCallContentPart;
|
24
|
+
type AppendContentPart = TextContentPart | ImageContentPart;
|
25
|
+
type BaseMessage = {
|
26
|
+
id: string;
|
27
|
+
createdAt: Date;
|
28
|
+
};
|
29
|
+
type UserMessage = BaseMessage & {
|
30
|
+
role: "user";
|
31
|
+
content: UserContentPart[];
|
32
|
+
};
|
33
|
+
type AssistantMessage = BaseMessage & {
|
34
|
+
role: "assistant";
|
35
|
+
content: AssistantContentPart[];
|
36
|
+
status: "in_progress" | "done" | "error";
|
37
|
+
};
|
38
|
+
type AppendMessage = {
|
39
|
+
parentId: string | null;
|
40
|
+
content: AppendContentPart[];
|
41
|
+
};
|
42
|
+
type ThreadMessage = UserMessage | AssistantMessage;
|
43
|
+
|
44
|
+
type Tool<TArgs> = {
|
45
|
+
description: string;
|
46
|
+
parameters: z.ZodSchema<TArgs>;
|
47
|
+
execute: (args: TArgs) => unknown;
|
48
|
+
};
|
49
|
+
type ModelConfig = {
|
50
|
+
system?: string;
|
51
|
+
tools?: Record<string, Tool<any>>;
|
52
|
+
};
|
53
|
+
type ModelConfigProvider = () => ModelConfig;
|
54
|
+
|
55
|
+
export type { AppendMessage as A, ImageContentPart as I, ModelConfigProvider as M, TextContentPart as T, UIContentPart as U, ToolCallContentPart as a, ThreadMessage as b, ModelConfig as c };
|
@@ -0,0 +1,55 @@
|
|
1
|
+
import { ReactNode } from 'react';
|
2
|
+
import { z } from 'zod';
|
3
|
+
|
4
|
+
type TextContentPart = {
|
5
|
+
type: "text";
|
6
|
+
text: string;
|
7
|
+
};
|
8
|
+
type ImageContentPart = {
|
9
|
+
type: "image";
|
10
|
+
image: string;
|
11
|
+
};
|
12
|
+
type UIContentPart = {
|
13
|
+
type: "ui";
|
14
|
+
display: ReactNode;
|
15
|
+
};
|
16
|
+
type ToolCallContentPart = {
|
17
|
+
type: "tool-call";
|
18
|
+
name: string;
|
19
|
+
args: object;
|
20
|
+
result?: object;
|
21
|
+
};
|
22
|
+
type UserContentPart = TextContentPart | ImageContentPart | UIContentPart;
|
23
|
+
type AssistantContentPart = TextContentPart | UIContentPart | ToolCallContentPart;
|
24
|
+
type AppendContentPart = TextContentPart | ImageContentPart;
|
25
|
+
type BaseMessage = {
|
26
|
+
id: string;
|
27
|
+
createdAt: Date;
|
28
|
+
};
|
29
|
+
type UserMessage = BaseMessage & {
|
30
|
+
role: "user";
|
31
|
+
content: UserContentPart[];
|
32
|
+
};
|
33
|
+
type AssistantMessage = BaseMessage & {
|
34
|
+
role: "assistant";
|
35
|
+
content: AssistantContentPart[];
|
36
|
+
status: "in_progress" | "done" | "error";
|
37
|
+
};
|
38
|
+
type AppendMessage = {
|
39
|
+
parentId: string | null;
|
40
|
+
content: AppendContentPart[];
|
41
|
+
};
|
42
|
+
type ThreadMessage = UserMessage | AssistantMessage;
|
43
|
+
|
44
|
+
type Tool<TArgs> = {
|
45
|
+
description: string;
|
46
|
+
parameters: z.ZodSchema<TArgs>;
|
47
|
+
execute: (args: TArgs) => unknown;
|
48
|
+
};
|
49
|
+
type ModelConfig = {
|
50
|
+
system?: string;
|
51
|
+
tools?: Record<string, Tool<any>>;
|
52
|
+
};
|
53
|
+
type ModelConfigProvider = () => ModelConfig;
|
54
|
+
|
55
|
+
export type { AssistantContentPart as A, ImageContentPart as I, ModelConfigProvider as M, TextContentPart as T, UIContentPart as U, ToolCallContentPart as a, ThreadMessage as b, ModelConfig as c, AppendMessage as d, AssistantMessage as e, UserMessage as f, UserContentPart as g, AppendContentPart as h };
|
@@ -0,0 +1,55 @@
|
|
1
|
+
import { ReactNode } from 'react';
|
2
|
+
import { z } from 'zod';
|
3
|
+
|
4
|
+
type TextContentPart = {
|
5
|
+
type: "text";
|
6
|
+
text: string;
|
7
|
+
};
|
8
|
+
type ImageContentPart = {
|
9
|
+
type: "image";
|
10
|
+
image: string;
|
11
|
+
};
|
12
|
+
type UIContentPart = {
|
13
|
+
type: "ui";
|
14
|
+
display: ReactNode;
|
15
|
+
};
|
16
|
+
type ToolCallContentPart = {
|
17
|
+
type: "tool-call";
|
18
|
+
name: string;
|
19
|
+
args: object;
|
20
|
+
result?: object;
|
21
|
+
};
|
22
|
+
type UserContentPart = TextContentPart | ImageContentPart | UIContentPart;
|
23
|
+
type AssistantContentPart = TextContentPart | UIContentPart | ToolCallContentPart;
|
24
|
+
type AppendContentPart = TextContentPart | ImageContentPart;
|
25
|
+
type BaseMessage = {
|
26
|
+
id: string;
|
27
|
+
createdAt: Date;
|
28
|
+
};
|
29
|
+
type UserMessage = BaseMessage & {
|
30
|
+
role: "user";
|
31
|
+
content: UserContentPart[];
|
32
|
+
};
|
33
|
+
type AssistantMessage = BaseMessage & {
|
34
|
+
role: "assistant";
|
35
|
+
content: AssistantContentPart[];
|
36
|
+
status: "in_progress" | "done" | "error";
|
37
|
+
};
|
38
|
+
type AppendMessage = {
|
39
|
+
parentId: string | null;
|
40
|
+
content: AppendContentPart[];
|
41
|
+
};
|
42
|
+
type ThreadMessage = UserMessage | AssistantMessage;
|
43
|
+
|
44
|
+
type Tool<TArgs> = {
|
45
|
+
description: string;
|
46
|
+
parameters: z.ZodSchema<TArgs>;
|
47
|
+
execute: (args: TArgs) => unknown;
|
48
|
+
};
|
49
|
+
type ModelConfig = {
|
50
|
+
system?: string;
|
51
|
+
tools?: Record<string, Tool<any>>;
|
52
|
+
};
|
53
|
+
type ModelConfigProvider = () => ModelConfig;
|
54
|
+
|
55
|
+
export type { AssistantContentPart as A, ImageContentPart as I, ModelConfigProvider as M, TextContentPart as T, UIContentPart as U, ToolCallContentPart as a, ThreadMessage as b, ModelConfig as c, AppendMessage as d, AssistantMessage as e, UserMessage as f, UserContentPart as g, AppendContentPart as h };
|
@@ -0,0 +1,15 @@
|
|
1
|
+
import { b as ThreadMessage, d as AppendMessage } from './ModelConfigTypes-CzmXY3sn.js';
|
2
|
+
|
3
|
+
type Unsubscribe = () => void;
|
4
|
+
|
5
|
+
type ThreadState = {
|
6
|
+
messages: readonly ThreadMessage[];
|
7
|
+
isRunning: boolean;
|
8
|
+
getBranches: (messageId: string) => readonly string[];
|
9
|
+
switchToBranch: (branchId: string) => void;
|
10
|
+
append: (message: AppendMessage) => void;
|
11
|
+
startRun: (parentId: string | null) => void;
|
12
|
+
cancelRun: () => void;
|
13
|
+
};
|
14
|
+
|
15
|
+
export type { ThreadState as T, Unsubscribe as U };
|
@@ -0,0 +1,15 @@
|
|
1
|
+
import { b as ThreadMessage, d as AppendMessage } from './ModelConfigTypes-CzmXY3sn.mjs';
|
2
|
+
|
3
|
+
type Unsubscribe = () => void;
|
4
|
+
|
5
|
+
type ThreadState = {
|
6
|
+
messages: readonly ThreadMessage[];
|
7
|
+
isRunning: boolean;
|
8
|
+
getBranches: (messageId: string) => readonly string[];
|
9
|
+
switchToBranch: (branchId: string) => void;
|
10
|
+
append: (message: AppendMessage) => void;
|
11
|
+
startRun: (parentId: string | null) => void;
|
12
|
+
cancelRun: () => void;
|
13
|
+
};
|
14
|
+
|
15
|
+
export type { ThreadState as T, Unsubscribe as U };
|