@assistant-ui/react 0.10.29 → 0.10.30
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/api/AttachmentRuntime.d.ts +1 -1
- package/dist/api/AttachmentRuntime.d.ts.map +1 -1
- package/dist/api/AttachmentRuntime.js.map +1 -1
- package/dist/api/ComposerRuntime.d.ts +3 -10
- package/dist/api/ComposerRuntime.d.ts.map +1 -1
- package/dist/api/ComposerRuntime.js.map +1 -1
- package/dist/api/MessagePartRuntime.d.ts +1 -1
- package/dist/api/MessagePartRuntime.d.ts.map +1 -1
- package/dist/api/MessagePartRuntime.js.map +1 -1
- package/dist/api/MessageRuntime.d.ts +10 -4
- package/dist/api/MessageRuntime.d.ts.map +1 -1
- package/dist/api/MessageRuntime.js.map +1 -1
- package/dist/api/RuntimeBindings.d.ts +38 -0
- package/dist/api/RuntimeBindings.d.ts.map +1 -0
- package/dist/api/RuntimeBindings.js +1 -0
- package/dist/api/RuntimeBindings.js.map +1 -0
- package/dist/api/ThreadListItemRuntime.d.ts +2 -12
- package/dist/api/ThreadListItemRuntime.d.ts.map +1 -1
- package/dist/api/ThreadListItemRuntime.js.map +1 -1
- package/dist/api/ThreadRuntime.d.ts +1 -1
- package/dist/api/ThreadRuntime.d.ts.map +1 -1
- package/dist/api/ThreadRuntime.js.map +1 -1
- package/dist/context/react/AttachmentContext.d.ts +48 -48
- package/dist/runtimes/core/ThreadListRuntimeCore.d.ts +2 -1
- package/dist/runtimes/core/ThreadListRuntimeCore.d.ts.map +1 -1
- package/dist/runtimes/external-store/ExternalStoreRuntimeCore.d.ts +1 -1
- package/dist/runtimes/external-store/ExternalStoreRuntimeCore.d.ts.map +1 -1
- package/dist/runtimes/external-store/ExternalStoreRuntimeCore.js +1 -1
- package/dist/runtimes/external-store/ExternalStoreRuntimeCore.js.map +1 -1
- package/dist/types/AssistantTypes.d.ts +4 -50
- package/dist/types/AssistantTypes.d.ts.map +1 -1
- package/dist/types/AttachmentTypes.d.ts +1 -1
- package/dist/types/AttachmentTypes.d.ts.map +1 -1
- package/dist/types/MessagePartTypes.d.ts +49 -0
- package/dist/types/MessagePartTypes.d.ts.map +1 -0
- package/dist/types/MessagePartTypes.js +1 -0
- package/dist/types/MessagePartTypes.js.map +1 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/api/AttachmentRuntime.ts +1 -1
- package/src/api/ComposerRuntime.ts +12 -16
- package/src/api/MessagePartRuntime.ts +1 -1
- package/src/api/MessageRuntime.ts +2 -5
- package/src/api/RuntimeBindings.ts +70 -0
- package/src/api/ThreadListItemRuntime.ts +5 -14
- package/src/api/ThreadRuntime.ts +1 -1
- package/src/runtimes/core/ThreadListRuntimeCore.tsx +2 -1
- package/src/runtimes/external-store/ExternalStoreRuntimeCore.tsx +1 -1
- package/src/types/AssistantTypes.ts +27 -70
- package/src/types/AttachmentTypes.ts +1 -1
- package/src/types/MessagePartTypes.ts +69 -0
- package/src/types/index.ts +3 -0
package/package.json
CHANGED
@@ -28,7 +28,7 @@
|
|
28
28
|
"conversational-ui",
|
29
29
|
"conversational-ai"
|
30
30
|
],
|
31
|
-
"version": "0.10.
|
31
|
+
"version": "0.10.30",
|
32
32
|
"license": "MIT",
|
33
33
|
"type": "module",
|
34
34
|
"exports": {
|
@@ -57,7 +57,7 @@
|
|
57
57
|
"@radix-ui/react-use-callback-ref": "^1.1.1",
|
58
58
|
"@radix-ui/react-use-escape-keydown": "^1.1.1",
|
59
59
|
"@standard-schema/spec": "^1.0.0",
|
60
|
-
"assistant-stream": "^0.2.
|
60
|
+
"assistant-stream": "^0.2.21",
|
61
61
|
"json-schema": "^0.4.0",
|
62
62
|
"nanoid": "5.1.5",
|
63
63
|
"react-textarea-autosize": "^8.5.9",
|
@@ -5,7 +5,7 @@ import {
|
|
5
5
|
ThreadComposerRuntimeCore,
|
6
6
|
} from "../runtimes/core/ComposerRuntimeCore";
|
7
7
|
import { Unsubscribe } from "../types";
|
8
|
-
|
8
|
+
|
9
9
|
import { LazyMemoizeSubject } from "./subscribable/LazyMemoizeSubject";
|
10
10
|
import {
|
11
11
|
AttachmentRuntime,
|
@@ -18,21 +18,17 @@ import { SKIP_UPDATE } from "./subscribable/SKIP_UPDATE";
|
|
18
18
|
import { ComposerRuntimePath } from "./RuntimePathTypes";
|
19
19
|
import { MessageRole, RunConfig } from "../types/AssistantTypes";
|
20
20
|
import { EventSubscriptionSubject } from "./subscribable/EventSubscriptionSubject";
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
export type
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
export type ComposerRuntimeCoreBinding = SubscribableWithState<
|
33
|
-
ComposerRuntimeCore | undefined,
|
34
|
-
ComposerRuntimePath
|
35
|
-
>;
|
21
|
+
import type {
|
22
|
+
ThreadComposerRuntimeCoreBinding,
|
23
|
+
EditComposerRuntimeCoreBinding,
|
24
|
+
ComposerRuntimeCoreBinding,
|
25
|
+
} from "./RuntimeBindings";
|
26
|
+
|
27
|
+
export type {
|
28
|
+
ThreadComposerRuntimeCoreBinding,
|
29
|
+
EditComposerRuntimeCoreBinding,
|
30
|
+
ComposerRuntimeCoreBinding,
|
31
|
+
};
|
36
32
|
|
37
33
|
type BaseComposerState = {
|
38
34
|
readonly canCancel: boolean;
|
@@ -5,7 +5,7 @@ import {
|
|
5
5
|
ToolCallMessagePartStatus,
|
6
6
|
} from "../types/AssistantTypes";
|
7
7
|
import { ThreadRuntimeCoreBinding } from "./ThreadRuntime";
|
8
|
-
import { MessageStateBinding } from "./
|
8
|
+
import type { MessageStateBinding } from "./RuntimeBindings";
|
9
9
|
import { SubscribableWithState } from "./subscribable/Subscribable";
|
10
10
|
import { Unsubscribe } from "../types";
|
11
11
|
import { MessagePartRuntimePath } from "./RuntimePathTypes";
|
@@ -34,7 +34,7 @@ import { ThreadRuntimeCoreBinding } from "./ThreadRuntime";
|
|
34
34
|
import { NestedSubscriptionSubject } from "./subscribable/NestedSubscriptionSubject";
|
35
35
|
import { SKIP_UPDATE } from "./subscribable/SKIP_UPDATE";
|
36
36
|
import { ShallowMemoizeSubject } from "./subscribable/ShallowMemoizeSubject";
|
37
|
-
import {
|
37
|
+
import type { MessageStateBinding } from "./RuntimeBindings";
|
38
38
|
|
39
39
|
const COMPLETE_STATUS: MessagePartStatus = Object.freeze({
|
40
40
|
type: "complete",
|
@@ -92,10 +92,7 @@ export type MessageState = ThreadMessage & {
|
|
92
92
|
readonly submittedFeedback: SubmittedFeedback | undefined;
|
93
93
|
};
|
94
94
|
|
95
|
-
export type MessageStateBinding
|
96
|
-
MessageState,
|
97
|
-
MessageRuntimePath
|
98
|
-
>;
|
95
|
+
export type { MessageStateBinding } from "./RuntimeBindings";
|
99
96
|
|
100
97
|
type ReloadConfig = {
|
101
98
|
runConfig?: RunConfig;
|
@@ -0,0 +1,70 @@
|
|
1
|
+
import type {
|
2
|
+
ComposerRuntimeCore,
|
3
|
+
ThreadComposerRuntimeCore,
|
4
|
+
} from "../runtimes/core/ComposerRuntimeCore";
|
5
|
+
import type { ThreadRuntimeCore } from "../runtimes/core/ThreadRuntimeCore";
|
6
|
+
import type { ThreadListRuntimeCore } from "../runtimes/core/ThreadListRuntimeCore";
|
7
|
+
import type { SubscribableWithState } from "./subscribable/Subscribable";
|
8
|
+
import type { ThreadMessage } from "../types";
|
9
|
+
import type {
|
10
|
+
SpeechState,
|
11
|
+
SubmittedFeedback,
|
12
|
+
} from "../runtimes/core/ThreadRuntimeCore";
|
13
|
+
import type {
|
14
|
+
ComposerRuntimePath,
|
15
|
+
ThreadRuntimePath,
|
16
|
+
ThreadListItemRuntimePath,
|
17
|
+
MessageRuntimePath,
|
18
|
+
} from "./RuntimePathTypes";
|
19
|
+
|
20
|
+
export type ComposerRuntimeCoreBinding = SubscribableWithState<
|
21
|
+
ComposerRuntimeCore | undefined,
|
22
|
+
ComposerRuntimePath
|
23
|
+
>;
|
24
|
+
|
25
|
+
export type ThreadComposerRuntimeCoreBinding = SubscribableWithState<
|
26
|
+
ThreadComposerRuntimeCore | undefined,
|
27
|
+
ComposerRuntimePath & { composerSource: "thread" }
|
28
|
+
>;
|
29
|
+
|
30
|
+
export type EditComposerRuntimeCoreBinding = SubscribableWithState<
|
31
|
+
ComposerRuntimeCore | undefined,
|
32
|
+
ComposerRuntimePath & { composerSource: "edit" }
|
33
|
+
>;
|
34
|
+
|
35
|
+
export type ThreadRuntimeCoreBinding = SubscribableWithState<
|
36
|
+
ThreadRuntimeCore,
|
37
|
+
ThreadRuntimePath
|
38
|
+
>;
|
39
|
+
|
40
|
+
export type ThreadListRuntimeCoreBinding = SubscribableWithState<
|
41
|
+
ThreadListRuntimeCore,
|
42
|
+
ThreadListItemRuntimePath
|
43
|
+
>;
|
44
|
+
|
45
|
+
export type MessageStateBinding = SubscribableWithState<
|
46
|
+
ThreadMessage & {
|
47
|
+
readonly parentId: string | null;
|
48
|
+
readonly isLast: boolean;
|
49
|
+
readonly branchNumber: number;
|
50
|
+
readonly branchCount: number;
|
51
|
+
readonly speech: SpeechState | undefined;
|
52
|
+
readonly submittedFeedback: SubmittedFeedback | undefined;
|
53
|
+
},
|
54
|
+
MessageRuntimePath
|
55
|
+
>;
|
56
|
+
|
57
|
+
export type ThreadListItemStatus = "archived" | "regular" | "new" | "deleted";
|
58
|
+
|
59
|
+
export type ThreadListItemState = {
|
60
|
+
readonly isMain: boolean;
|
61
|
+
readonly id: string;
|
62
|
+
readonly remoteId: string | undefined;
|
63
|
+
readonly externalId: string | undefined;
|
64
|
+
/**
|
65
|
+
* @deprecated Use `id` instead. This field will be removed in version 0.8.0.
|
66
|
+
*/
|
67
|
+
readonly threadId: string;
|
68
|
+
readonly status: ThreadListItemStatus;
|
69
|
+
readonly title?: string | undefined;
|
70
|
+
};
|
@@ -5,21 +5,12 @@ import { ThreadListRuntimeCoreBinding } from "./ThreadListRuntime";
|
|
5
5
|
|
6
6
|
export type ThreadListItemEventType = "switched-to" | "switched-away";
|
7
7
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
readonly remoteId: string | undefined;
|
13
|
-
readonly externalId: string | undefined;
|
14
|
-
|
15
|
-
/**
|
16
|
-
* @deprecated This field was renamed to `id`. This field will be removed in 0.8.0.
|
17
|
-
*/
|
18
|
-
readonly threadId: string;
|
8
|
+
import type {
|
9
|
+
ThreadListItemState,
|
10
|
+
ThreadListItemStatus,
|
11
|
+
} from "./RuntimeBindings";
|
19
12
|
|
20
|
-
|
21
|
-
readonly title?: string | undefined;
|
22
|
-
};
|
13
|
+
export type { ThreadListItemState, ThreadListItemStatus };
|
23
14
|
|
24
15
|
export type ThreadListItemRuntime = {
|
25
16
|
readonly path: ThreadListItemRuntimePath;
|
package/src/api/ThreadRuntime.ts
CHANGED
@@ -28,7 +28,7 @@ import {
|
|
28
28
|
ThreadListItemRuntimePath,
|
29
29
|
ThreadRuntimePath,
|
30
30
|
} from "./RuntimePathTypes";
|
31
|
-
import { ThreadListItemState } from "./
|
31
|
+
import type { ThreadListItemState } from "./RuntimeBindings";
|
32
32
|
import { RunConfig } from "../types/AssistantTypes";
|
33
33
|
import { EventSubscriptionSubject } from "./subscribable/EventSubscriptionSubject";
|
34
34
|
import { symbolInnerMessage } from "../runtimes/external-store/getExternalStoreMessage";
|
@@ -1,12 +1,13 @@
|
|
1
1
|
import { Unsubscribe } from "../../types";
|
2
2
|
import { ThreadRuntimeCore } from "./ThreadRuntimeCore";
|
3
|
+
import type { ThreadListItemStatus } from "../../api/RuntimeBindings";
|
3
4
|
|
4
5
|
type ThreadListItemCoreState = {
|
5
6
|
readonly threadId: string;
|
6
7
|
readonly remoteId?: string | undefined;
|
7
8
|
readonly externalId?: string | undefined;
|
8
9
|
|
9
|
-
readonly status:
|
10
|
+
readonly status: ThreadListItemStatus;
|
10
11
|
readonly title?: string | undefined;
|
11
12
|
|
12
13
|
readonly runtime?: ThreadRuntimeCore | undefined;
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { BaseAssistantRuntimeCore } from "
|
1
|
+
import { BaseAssistantRuntimeCore } from "../core/BaseAssistantRuntimeCore";
|
2
2
|
import { ExternalStoreThreadListRuntimeCore } from "./ExternalStoreThreadListRuntimeCore";
|
3
3
|
import { ExternalStoreAdapter } from "./ExternalStoreAdapter";
|
4
4
|
import { ExternalStoreThreadRuntimeCore } from "./ExternalStoreThreadRuntimeCore";
|
@@ -1,75 +1,32 @@
|
|
1
|
-
import { CompleteAttachment } from "./AttachmentTypes";
|
2
|
-
import {
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
export type ImageMessagePart = {
|
28
|
-
readonly type: "image";
|
29
|
-
readonly image: string;
|
1
|
+
import type { CompleteAttachment } from "./AttachmentTypes";
|
2
|
+
import type { ReadonlyJSONValue } from "assistant-stream/utils";
|
3
|
+
import type {
|
4
|
+
TextMessagePart,
|
5
|
+
ReasoningMessagePart,
|
6
|
+
SourceMessagePart,
|
7
|
+
ImageMessagePart,
|
8
|
+
FileMessagePart,
|
9
|
+
Unstable_AudioMessagePart,
|
10
|
+
ToolCallMessagePart,
|
11
|
+
ThreadUserMessagePart,
|
12
|
+
ThreadAssistantMessagePart,
|
13
|
+
} from "./MessagePartTypes";
|
14
|
+
|
15
|
+
// Re-export message part types for convenience
|
16
|
+
export type {
|
17
|
+
TextMessagePart,
|
18
|
+
ReasoningMessagePart,
|
19
|
+
SourceMessagePart,
|
20
|
+
ImageMessagePart,
|
21
|
+
FileMessagePart,
|
22
|
+
Unstable_AudioMessagePart,
|
23
|
+
ToolCallMessagePart,
|
24
|
+
ThreadUserMessagePart,
|
25
|
+
ThreadAssistantMessagePart,
|
30
26
|
};
|
31
27
|
|
32
|
-
|
33
|
-
|
34
|
-
readonly data: string;
|
35
|
-
readonly mimeType: string;
|
36
|
-
};
|
37
|
-
|
38
|
-
export type Unstable_AudioMessagePart = {
|
39
|
-
readonly type: "audio";
|
40
|
-
readonly audio: {
|
41
|
-
readonly data: string;
|
42
|
-
readonly format: "mp3" | "wav";
|
43
|
-
};
|
44
|
-
};
|
45
|
-
|
46
|
-
export type ToolCallMessagePart<
|
47
|
-
TArgs = ReadonlyJSONObject,
|
48
|
-
TResult = unknown,
|
49
|
-
> = {
|
50
|
-
readonly type: "tool-call";
|
51
|
-
readonly toolCallId: string;
|
52
|
-
readonly toolName: string;
|
53
|
-
readonly args: TArgs;
|
54
|
-
readonly result?: TResult | undefined;
|
55
|
-
readonly isError?: boolean | undefined;
|
56
|
-
readonly argsText: string;
|
57
|
-
readonly artifact?: unknown;
|
58
|
-
readonly parentId?: string;
|
59
|
-
};
|
60
|
-
|
61
|
-
export type ThreadUserMessagePart =
|
62
|
-
| TextMessagePart
|
63
|
-
| ImageMessagePart
|
64
|
-
| FileMessagePart
|
65
|
-
| Unstable_AudioMessagePart;
|
66
|
-
|
67
|
-
export type ThreadAssistantMessagePart =
|
68
|
-
| TextMessagePart
|
69
|
-
| ReasoningMessagePart
|
70
|
-
| ToolCallMessagePart
|
71
|
-
| SourceMessagePart
|
72
|
-
| FileMessagePart;
|
28
|
+
// Alias for the role of a thread message
|
29
|
+
export type MessageRole = ThreadMessage["role"];
|
73
30
|
|
74
31
|
type MessageCommonProps = {
|
75
32
|
readonly id: string;
|
@@ -0,0 +1,69 @@
|
|
1
|
+
import { ReadonlyJSONObject } from "assistant-stream/utils";
|
2
|
+
|
3
|
+
export type TextMessagePart = {
|
4
|
+
readonly type: "text";
|
5
|
+
readonly text: string;
|
6
|
+
readonly parentId?: string;
|
7
|
+
};
|
8
|
+
|
9
|
+
export type ReasoningMessagePart = {
|
10
|
+
readonly type: "reasoning";
|
11
|
+
readonly text: string;
|
12
|
+
readonly parentId?: string;
|
13
|
+
};
|
14
|
+
|
15
|
+
export type SourceMessagePart = {
|
16
|
+
readonly type: "source";
|
17
|
+
readonly sourceType: "url";
|
18
|
+
readonly id: string;
|
19
|
+
readonly url: string;
|
20
|
+
readonly title?: string;
|
21
|
+
readonly parentId?: string;
|
22
|
+
};
|
23
|
+
|
24
|
+
export type ImageMessagePart = {
|
25
|
+
readonly type: "image";
|
26
|
+
readonly image: string;
|
27
|
+
};
|
28
|
+
|
29
|
+
export type FileMessagePart = {
|
30
|
+
readonly type: "file";
|
31
|
+
readonly data: string;
|
32
|
+
readonly mimeType: string;
|
33
|
+
};
|
34
|
+
|
35
|
+
export type Unstable_AudioMessagePart = {
|
36
|
+
readonly type: "audio";
|
37
|
+
readonly audio: {
|
38
|
+
readonly data: string;
|
39
|
+
readonly format: "mp3" | "wav";
|
40
|
+
};
|
41
|
+
};
|
42
|
+
|
43
|
+
export type ToolCallMessagePart<
|
44
|
+
TArgs = ReadonlyJSONObject,
|
45
|
+
TResult = unknown,
|
46
|
+
> = {
|
47
|
+
readonly type: "tool-call";
|
48
|
+
readonly toolCallId: string;
|
49
|
+
readonly toolName: string;
|
50
|
+
readonly args: TArgs;
|
51
|
+
readonly result?: TResult | undefined;
|
52
|
+
readonly isError?: boolean | undefined;
|
53
|
+
readonly argsText: string;
|
54
|
+
readonly artifact?: unknown;
|
55
|
+
readonly parentId?: string;
|
56
|
+
};
|
57
|
+
|
58
|
+
export type ThreadUserMessagePart =
|
59
|
+
| TextMessagePart
|
60
|
+
| ImageMessagePart
|
61
|
+
| FileMessagePart
|
62
|
+
| Unstable_AudioMessagePart;
|
63
|
+
|
64
|
+
export type ThreadAssistantMessagePart =
|
65
|
+
| TextMessagePart
|
66
|
+
| ReasoningMessagePart
|
67
|
+
| ToolCallMessagePart
|
68
|
+
| SourceMessagePart
|
69
|
+
| FileMessagePart;
|
package/src/types/index.ts
CHANGED
@@ -87,4 +87,7 @@ export type {
|
|
87
87
|
ToolCallMessagePartProps as ToolCallContentPartProps,
|
88
88
|
} from "./MessagePartComponentTypes";
|
89
89
|
|
90
|
+
// Thread list item types
|
91
|
+
export type { ThreadListItemStatus } from "../api/ThreadListItemRuntime";
|
92
|
+
|
90
93
|
export type { Unsubscribe } from "./Unsubscribe";
|