@assistant-ui/react 0.10.28 → 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.
Files changed (57) hide show
  1. package/dist/api/AttachmentRuntime.d.ts +1 -1
  2. package/dist/api/AttachmentRuntime.d.ts.map +1 -1
  3. package/dist/api/AttachmentRuntime.js.map +1 -1
  4. package/dist/api/ComposerRuntime.d.ts +3 -10
  5. package/dist/api/ComposerRuntime.d.ts.map +1 -1
  6. package/dist/api/ComposerRuntime.js.map +1 -1
  7. package/dist/api/MessagePartRuntime.d.ts +1 -1
  8. package/dist/api/MessagePartRuntime.d.ts.map +1 -1
  9. package/dist/api/MessagePartRuntime.js.map +1 -1
  10. package/dist/api/MessageRuntime.d.ts +10 -4
  11. package/dist/api/MessageRuntime.d.ts.map +1 -1
  12. package/dist/api/MessageRuntime.js.map +1 -1
  13. package/dist/api/RuntimeBindings.d.ts +38 -0
  14. package/dist/api/RuntimeBindings.d.ts.map +1 -0
  15. package/dist/api/RuntimeBindings.js +1 -0
  16. package/dist/api/RuntimeBindings.js.map +1 -0
  17. package/dist/api/ThreadListItemRuntime.d.ts +2 -12
  18. package/dist/api/ThreadListItemRuntime.d.ts.map +1 -1
  19. package/dist/api/ThreadListItemRuntime.js.map +1 -1
  20. package/dist/api/ThreadRuntime.d.ts +1 -1
  21. package/dist/api/ThreadRuntime.d.ts.map +1 -1
  22. package/dist/api/ThreadRuntime.js.map +1 -1
  23. package/dist/context/react/AttachmentContext.d.ts +48 -48
  24. package/dist/runtimes/core/ThreadListRuntimeCore.d.ts +2 -1
  25. package/dist/runtimes/core/ThreadListRuntimeCore.d.ts.map +1 -1
  26. package/dist/runtimes/external-store/ExternalStoreRuntimeCore.d.ts +1 -1
  27. package/dist/runtimes/external-store/ExternalStoreRuntimeCore.d.ts.map +1 -1
  28. package/dist/runtimes/external-store/ExternalStoreRuntimeCore.js +1 -1
  29. package/dist/runtimes/external-store/ExternalStoreRuntimeCore.js.map +1 -1
  30. package/dist/runtimes/external-store/ExternalStoreThreadRuntimeCore.d.ts.map +1 -1
  31. package/dist/runtimes/external-store/ExternalStoreThreadRuntimeCore.js +1 -0
  32. package/dist/runtimes/external-store/ExternalStoreThreadRuntimeCore.js.map +1 -1
  33. package/dist/types/AssistantTypes.d.ts +4 -50
  34. package/dist/types/AssistantTypes.d.ts.map +1 -1
  35. package/dist/types/AttachmentTypes.d.ts +1 -1
  36. package/dist/types/AttachmentTypes.d.ts.map +1 -1
  37. package/dist/types/MessagePartTypes.d.ts +49 -0
  38. package/dist/types/MessagePartTypes.d.ts.map +1 -0
  39. package/dist/types/MessagePartTypes.js +1 -0
  40. package/dist/types/MessagePartTypes.js.map +1 -0
  41. package/dist/types/index.d.ts +1 -0
  42. package/dist/types/index.d.ts.map +1 -1
  43. package/package.json +2 -2
  44. package/src/api/AttachmentRuntime.ts +1 -1
  45. package/src/api/ComposerRuntime.ts +12 -16
  46. package/src/api/MessagePartRuntime.ts +1 -1
  47. package/src/api/MessageRuntime.ts +2 -5
  48. package/src/api/RuntimeBindings.ts +70 -0
  49. package/src/api/ThreadListItemRuntime.ts +5 -14
  50. package/src/api/ThreadRuntime.ts +1 -1
  51. package/src/runtimes/core/ThreadListRuntimeCore.tsx +2 -1
  52. package/src/runtimes/external-store/ExternalStoreRuntimeCore.tsx +1 -1
  53. package/src/runtimes/external-store/ExternalStoreThreadRuntimeCore.tsx +1 -0
  54. package/src/types/AssistantTypes.ts +27 -70
  55. package/src/types/AttachmentTypes.ts +1 -1
  56. package/src/types/MessagePartTypes.ts +69 -0
  57. package/src/types/index.ts +3 -0
@@ -0,0 +1,49 @@
1
+ import { ReadonlyJSONObject } from "assistant-stream/utils";
2
+ export type TextMessagePart = {
3
+ readonly type: "text";
4
+ readonly text: string;
5
+ readonly parentId?: string;
6
+ };
7
+ export type ReasoningMessagePart = {
8
+ readonly type: "reasoning";
9
+ readonly text: string;
10
+ readonly parentId?: string;
11
+ };
12
+ export type SourceMessagePart = {
13
+ readonly type: "source";
14
+ readonly sourceType: "url";
15
+ readonly id: string;
16
+ readonly url: string;
17
+ readonly title?: string;
18
+ readonly parentId?: string;
19
+ };
20
+ export type ImageMessagePart = {
21
+ readonly type: "image";
22
+ readonly image: string;
23
+ };
24
+ export type FileMessagePart = {
25
+ readonly type: "file";
26
+ readonly data: string;
27
+ readonly mimeType: string;
28
+ };
29
+ export type Unstable_AudioMessagePart = {
30
+ readonly type: "audio";
31
+ readonly audio: {
32
+ readonly data: string;
33
+ readonly format: "mp3" | "wav";
34
+ };
35
+ };
36
+ export type ToolCallMessagePart<TArgs = ReadonlyJSONObject, TResult = unknown> = {
37
+ readonly type: "tool-call";
38
+ readonly toolCallId: string;
39
+ readonly toolName: string;
40
+ readonly args: TArgs;
41
+ readonly result?: TResult | undefined;
42
+ readonly isError?: boolean | undefined;
43
+ readonly argsText: string;
44
+ readonly artifact?: unknown;
45
+ readonly parentId?: string;
46
+ };
47
+ export type ThreadUserMessagePart = TextMessagePart | ImageMessagePart | FileMessagePart | Unstable_AudioMessagePart;
48
+ export type ThreadAssistantMessagePart = TextMessagePart | ReasoningMessagePart | ToolCallMessagePart | SourceMessagePart | FileMessagePart;
49
+ //# sourceMappingURL=MessagePartTypes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MessagePartTypes.d.ts","sourceRoot":"","sources":["../../src/types/MessagePartTypes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAE5D,MAAM,MAAM,eAAe,GAAG;IAC5B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;CAC5B,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IACjC,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;IAC3B,QAAQ,CAAC,IAAI,EAAE,MAAM,C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AAG,SAAS,CAAC;IACtC,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IACvC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;CAC5B,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAC7B,eAAe,GACf,gBAAgB,GAChB,eAAe,GACf,yBAAyB,CAAC;AAE9B,MAAM,MAAM,0BAA0B,GAClC,eAAe,GACf,oBAAoB,GACpB,mBAAmB,GACnB,iBAAiB,GACjB,eAAe,CAAC"}
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=MessagePartTypes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -3,5 +3,6 @@ export type { AppendMessage, TextMessagePart, ReasoningMessagePart, SourceMessag
3
3
  export type { TextMessagePart as TextContentPart, ReasoningMessagePart as ReasoningContentPart, SourceMessagePart as SourceContentPart, ImageMessagePart as ImageContentPart, FileMessagePart as FileContentPart, Unstable_AudioMessagePart as AudioContentPart, ToolCallMessagePart as ToolCallContentPart, MessagePartStatus as ContentPartStatus, ToolCallMessagePartStatus as ToolCallContentPartStatus, ThreadUserMessagePart as ThreadUserContentPart, ThreadAssistantMessagePart as ThreadAssistantContentPart, ThreadSystemMessage as ThreadSystemContentPart, ThreadAssistantMessage as ThreadAssistantContent, ThreadUserMessage as ThreadUserContent, ThreadMessage as ThreadContent, } from "./AssistantTypes";
4
4
  export type { EmptyMessagePartComponent, EmptyMessagePartProps, TextMessagePartComponent, TextMessagePartProps, ReasoningMessagePartComponent, ReasoningMessagePartProps, SourceMessagePartComponent, SourceMessagePartProps, ImageMessagePartComponent, ImageMessagePartProps, FileMessagePartComponent, FileMessagePartProps, Unstable_AudioMessagePartComponent, Unstable_AudioMessagePartProps, ToolCallMessagePartComponent, ToolCallMessagePartProps, } from "./MessagePartComponentTypes";
5
5
  export type { EmptyMessagePartComponent as EmptyContentPartComponent, EmptyMessagePartProps as EmptyContentPartProps, TextMessagePartComponent as TextContentPartComponent, TextMessagePartProps as TextContentPartProps, ReasoningMessagePartComponent as ReasoningContentPartComponent, ReasoningMessagePartProps as ReasoningContentPartProps, SourceMessagePartComponent as SourceContentPartComponent, SourceMessagePartProps as SourceContentPartProps, ImageMessagePartComponent as ImageContentPartComponent, ImageMessagePartProps as ImageContentPartProps, FileMessagePartComponent as FileContentPartComponent, FileMessagePartProps as FileContentPartProps, Unstable_AudioMessagePartComponent as AudioContentPartComponent, Unstable_AudioMessagePartProps as AudioContentPartProps, ToolCallMessagePartComponent as ToolCallContentPartComponent, ToolCallMessagePartProps as ToolCallContentPartProps, } from "./MessagePartComponentTypes";
6
+ export type { ThreadListItemStatus } from "../api/ThreadListItemRuntime";
6
7
  export type { Unsubscribe } from "./Unsubscribe";
7
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,UAAU,EACV,iBAAiB,EACjB,kBAAkB,EAClB,gBAAgB,GACjB,MAAM,mBAAmB,CAAC;AAE3B,YAAY,EACV,aAAa,EACb,eAAe,EACf,oBAAoB,EACpB,iBAAiB,EACjB,gBAAgB,EAChB,eAAe,EACf,yBAAyB,EACzB,mBAAmB,EACnB,aAAa,EACb,iBAAiB,EACjB,yBAAyB,EAGzB,qBAAqB,EACrB,0BAA0B,EAC1B,mBAAmB,EACnB,sBAAsB,EACtB,iBAAiB,EACjB,aAAa,GACd,MAAM,kBAAkB,CAAC;AAG1B,YAAY,EACV,eAAe,IAAI,eAAe,EAClC,oBAAoB,IAAI,oBAAoB,EAC5C,iBAAiB,IAAI,iBAAiB,EACtC,gBAAgB,IAAI,gBAAgB,EACpC,eAAe,IAAI,eAAe,EAClC,yBAAyB,IAAI,gBA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AAyB,IAAI,yBAAyB,EACtD,0BAA0B,IAAI,0BAA0B,EACxD,sBAAsB,IAAI,sBAAsB,EAChD,yBAAyB,IAAI,yBAAyB,EACtD,qBAAqB,IAAI,qBAAqB,EAC9C,wBAAwB,IAAI,wBAAwB,EACpD,oBAAoB,IAAI,oBAAoB,EAC5C,kCAAkC,IAAI,yBAAyB,EAC/D,8BAA8B,IAAI,qBAAqB,EACvD,4BAA4B,IAAI,4BAA4B,EAC5D,wBAAwB,IAAI,wBAAwB,GACrD,MAAM,6BAA6B,CAAC;AAGrC,YAAY,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AAEzE,YAAY,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC"}
package/package.json CHANGED
@@ -28,7 +28,7 @@
28
28
  "conversational-ui",
29
29
  "conversational-ai"
30
30
  ],
31
- "version": "0.10.28",
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.20",
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",
@@ -1,6 +1,6 @@
1
1
  import { SubscribableWithState } from "./subscribable/Subscribable";
2
2
 
3
- import { ComposerRuntimeCoreBinding } from "./ComposerRuntime";
3
+ import type { ComposerRuntimeCoreBinding } from "./RuntimeBindings";
4
4
  import {
5
5
  Attachment,
6
6
  CompleteAttachment,
@@ -5,7 +5,7 @@ import {
5
5
  ThreadComposerRuntimeCore,
6
6
  } from "../runtimes/core/ComposerRuntimeCore";
7
7
  import { Unsubscribe } from "../types";
8
- import { SubscribableWithState } from "./subscribable/Subscribable";
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
- export type ThreadComposerRuntimeCoreBinding = SubscribableWithState<
23
- ThreadComposerRuntimeCore | undefined,
24
- ComposerRuntimePath & { composerSource: "thread" }
25
- >;
26
-
27
- export type EditComposerRuntimeCoreBinding = SubscribableWithState<
28
- ComposerRuntimeCore | undefined,
29
- ComposerRuntimePath & { composerSource: "edit" }
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 "./MessageRuntime";
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 { SubscribableWithState } from "./subscribable/Subscribable";
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 = SubscribableWithState<
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
- export type ThreadListItemState = {
9
- readonly isMain: boolean;
10
-
11
- readonly id: string;
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
- readonly status: "archived" | "regular" | "new" | "deleted";
21
- readonly title?: string | undefined;
22
- };
13
+ export type { ThreadListItemState, ThreadListItemStatus };
23
14
 
24
15
  export type ThreadListItemRuntime = {
25
16
  readonly path: ThreadListItemRuntimePath;
@@ -28,7 +28,7 @@ import {
28
28
  ThreadListItemRuntimePath,
29
29
  ThreadRuntimePath,
30
30
  } from "./RuntimePathTypes";
31
- import { ThreadListItemState } from "./ThreadListItemRuntime";
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: "archived" | "regular" | "new" | "deleted";
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 "../../internal";
1
+ import { BaseAssistantRuntimeCore } from "../core/BaseAssistantRuntimeCore";
2
2
  import { ExternalStoreThreadListRuntimeCore } from "./ExternalStoreThreadListRuntimeCore";
3
3
  import { ExternalStoreAdapter } from "./ExternalStoreAdapter";
4
4
  import { ExternalStoreThreadRuntimeCore } from "./ExternalStoreThreadRuntimeCore";
@@ -123,6 +123,7 @@ export class ExternalStoreThreadRuntimeCore
123
123
 
124
124
  // Clear and import the message repository
125
125
  this.repository.clear();
126
+ this.assistantOptimisticId = null;
126
127
  this.repository.import(store.messageRepository);
127
128
 
128
129
  messages = this.repository.getMessages();
@@ -1,75 +1,32 @@
1
- import { CompleteAttachment } from "./AttachmentTypes";
2
- import { ReadonlyJSONObject, ReadonlyJSONValue } from "assistant-stream/utils";
3
-
4
- export type MessageRole = ThreadMessage["role"];
5
-
6
- export type TextMessagePart = {
7
- readonly type: "text";
8
- readonly text: string;
9
- readonly parentId?: string;
10
- };
11
-
12
- export type ReasoningMessagePart = {
13
- readonly type: "reasoning";
14
- readonly text: string;
15
- readonly parentId?: string;
16
- };
17
-
18
- export type SourceMessagePart = {
19
- readonly type: "source";
20
- readonly sourceType: "url";
21
- readonly id: string;
22
- readonly url: string;
23
- readonly title?: string;
24
- readonly parentId?: string;
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
- export type FileMessagePart = {
33
- readonly type: "file";
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;
@@ -1,4 +1,4 @@
1
- import { ThreadUserMessagePart } from "./AssistantTypes";
1
+ import type { ThreadUserMessagePart } from "./MessagePartTypes";
2
2
 
3
3
  export type PendingAttachmentStatus =
4
4
  | {
@@ -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;
@@ -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";