@assistant-ui/react 0.5.66 → 0.5.68

Sign up to get free protection for your applications and to get access to all the features.
@@ -3,18 +3,38 @@ import { ReactNode } from 'react';
3
3
  import { JSONSchema7 } from 'json-schema';
4
4
  import { z } from 'zod';
5
5
 
6
+ type PendingAttachmentStatus = {
7
+ type: "running";
8
+ reason: "uploading";
9
+ progress: number;
10
+ } | {
11
+ type: "requires-action";
12
+ reason: "composer-send";
13
+ } | {
14
+ type: "incomplete";
15
+ reason: "error" | "upload-paused";
16
+ };
17
+ type CompleteAttachmentStatus = {
18
+ type: "complete";
19
+ };
20
+ type AttachmentStatus = PendingAttachmentStatus | CompleteAttachmentStatus;
6
21
  type BaseAttachment = {
7
22
  id: string;
8
23
  type: "image" | "document" | "file";
9
24
  name: string;
25
+ contentType?: string;
26
+ file?: File;
27
+ content?: CoreUserContentPart[];
10
28
  };
11
- type ThreadComposerAttachment = BaseAttachment & {
29
+ type PendingAttachment = BaseAttachment & {
30
+ status: PendingAttachmentStatus;
12
31
  file: File;
13
32
  };
14
- type MessageAttachment = BaseAttachment & {
15
- file?: File;
33
+ type CompleteAttachment = BaseAttachment & {
34
+ status: CompleteAttachmentStatus;
16
35
  content: CoreUserContentPart[];
17
36
  };
37
+ type Attachment = PendingAttachment | CompleteAttachment;
18
38
 
19
39
  type TextContentPart = {
20
40
  type: "text";
@@ -88,7 +108,7 @@ type ThreadSystemMessage = MessageCommonProps & {
88
108
  type ThreadUserMessage = MessageCommonProps & {
89
109
  role: "user";
90
110
  content: ThreadUserContentPart[];
91
- attachments: readonly MessageAttachment[];
111
+ attachments: readonly CompleteAttachment[];
92
112
  status?: undefined;
93
113
  metadata?: undefined;
94
114
  };
@@ -108,7 +128,7 @@ type ThreadAssistantMessage = MessageCommonProps & {
108
128
  };
109
129
  type AppendMessage = CoreMessage & {
110
130
  parentId: string | null;
111
- attachments?: readonly MessageAttachment[];
131
+ attachments?: readonly CompleteAttachment[] | undefined;
112
132
  };
113
133
  type ThreadMessage = ThreadSystemMessage | ThreadUserMessage | ThreadAssistantMessage;
114
134
  /** Core Message Types (without UI content parts) */
@@ -464,4 +484,4 @@ declare const createEdgeRuntimeAPI: (options: CreateEdgeRuntimeAPIOptions) => {
464
484
  POST: (request: Request) => Promise<Response>;
465
485
  };
466
486
 
467
- export { type AppendMessage as A, type ContentPartStatus as C, type EdgeRuntimeRequestOptions as E, type ImageContentPart as I, type ModelConfig as M, type TextContentPart as T, type UIContentPart as U, type ToolCallContentPart as a, type ToolCallContentPartStatus as b, type ThreadMessage as c, type CoreMessage as d, type ThreadComposerAttachment as e, type ModelConfigProvider as f, type ThreadAssistantContentPart as g, type MessageStatus as h, type ThreadRoundtrip as i, type MessageAttachment as j, type Tool as k, type CoreToolCallContentPart as l, type CreateEdgeRuntimeAPIOptions as m, type ThreadUserContentPart as n, type ThreadSystemMessage as o, type ThreadAssistantMessage as p, type ThreadUserMessage as q, type CoreUserContentPart as r, type CoreAssistantContentPart as s, type CoreSystemMessage as t, type CoreUserMessage as u, type CoreAssistantMessage as v, createEdgeRuntimeAPI as w, getEdgeRuntimeResponse as x };
487
+ export { type Attachment as A, getEdgeRuntimeResponse as B, type CoreMessage as C, type EdgeRuntimeRequestOptions as E, type ImageContentPart as I, type ModelConfig as M, type PendingAttachment as P, type ThreadMessage as T, type UIContentPart as U, type AppendMessage as a, type ModelConfigProvider as b, type ThreadAssistantContentPart as c, type MessageStatus as d, type ThreadRoundtrip as e, type PendingAttachmentStatus as f, type CompleteAttachment as g, type CompleteAttachmentStatus as h, type Tool as i, type TextContentPart as j, type ToolCallContentPart as k, type CoreToolCallContentPart as l, type CreateEdgeRuntimeAPIOptions as m, type ThreadUserContentPart as n, type ContentPartStatus as o, type ToolCallContentPartStatus as p, type AttachmentStatus as q, type ThreadSystemMessage as r, type ThreadAssistantMessage as s, type ThreadUserMessage as t, type CoreUserContentPart as u, type CoreAssistantContentPart as v, type CoreSystemMessage as w, type CoreUserMessage as x, type CoreAssistantMessage as y, createEdgeRuntimeAPI as z };
@@ -3,18 +3,38 @@ import { ReactNode } from 'react';
3
3
  import { JSONSchema7 } from 'json-schema';
4
4
  import { z } from 'zod';
5
5
 
6
+ type PendingAttachmentStatus = {
7
+ type: "running";
8
+ reason: "uploading";
9
+ progress: number;
10
+ } | {
11
+ type: "requires-action";
12
+ reason: "composer-send";
13
+ } | {
14
+ type: "incomplete";
15
+ reason: "error" | "upload-paused";
16
+ };
17
+ type CompleteAttachmentStatus = {
18
+ type: "complete";
19
+ };
20
+ type AttachmentStatus = PendingAttachmentStatus | CompleteAttachmentStatus;
6
21
  type BaseAttachment = {
7
22
  id: string;
8
23
  type: "image" | "document" | "file";
9
24
  name: string;
25
+ contentType?: string;
26
+ file?: File;
27
+ content?: CoreUserContentPart[];
10
28
  };
11
- type ThreadComposerAttachment = BaseAttachment & {
29
+ type PendingAttachment = BaseAttachment & {
30
+ status: PendingAttachmentStatus;
12
31
  file: File;
13
32
  };
14
- type MessageAttachment = BaseAttachment & {
15
- file?: File;
33
+ type CompleteAttachment = BaseAttachment & {
34
+ status: CompleteAttachmentStatus;
16
35
  content: CoreUserContentPart[];
17
36
  };
37
+ type Attachment = PendingAttachment | CompleteAttachment;
18
38
 
19
39
  type TextContentPart = {
20
40
  type: "text";
@@ -88,7 +108,7 @@ type ThreadSystemMessage = MessageCommonProps & {
88
108
  type ThreadUserMessage = MessageCommonProps & {
89
109
  role: "user";
90
110
  content: ThreadUserContentPart[];
91
- attachments: readonly MessageAttachment[];
111
+ attachments: readonly CompleteAttachment[];
92
112
  status?: undefined;
93
113
  metadata?: undefined;
94
114
  };
@@ -108,7 +128,7 @@ type ThreadAssistantMessage = MessageCommonProps & {
108
128
  };
109
129
  type AppendMessage = CoreMessage & {
110
130
  parentId: string | null;
111
- attachments?: readonly MessageAttachment[];
131
+ attachments?: readonly CompleteAttachment[] | undefined;
112
132
  };
113
133
  type ThreadMessage = ThreadSystemMessage | ThreadUserMessage | ThreadAssistantMessage;
114
134
  /** Core Message Types (without UI content parts) */
@@ -464,4 +484,4 @@ declare const createEdgeRuntimeAPI: (options: CreateEdgeRuntimeAPIOptions) => {
464
484
  POST: (request: Request) => Promise<Response>;
465
485
  };
466
486
 
467
- export { type AppendMessage as A, type ContentPartStatus as C, type EdgeRuntimeRequestOptions as E, type ImageContentPart as I, type ModelConfig as M, type TextContentPart as T, type UIContentPart as U, type ToolCallContentPart as a, type ToolCallContentPartStatus as b, type ThreadMessage as c, type CoreMessage as d, type ThreadComposerAttachment as e, type ModelConfigProvider as f, type ThreadAssistantContentPart as g, type MessageStatus as h, type ThreadRoundtrip as i, type MessageAttachment as j, type Tool as k, type CoreToolCallContentPart as l, type CreateEdgeRuntimeAPIOptions as m, type ThreadUserContentPart as n, type ThreadSystemMessage as o, type ThreadAssistantMessage as p, type ThreadUserMessage as q, type CoreUserContentPart as r, type CoreAssistantContentPart as s, type CoreSystemMessage as t, type CoreUserMessage as u, type CoreAssistantMessage as v, createEdgeRuntimeAPI as w, getEdgeRuntimeResponse as x };
487
+ export { type Attachment as A, getEdgeRuntimeResponse as B, type CoreMessage as C, type EdgeRuntimeRequestOptions as E, type ImageContentPart as I, type ModelConfig as M, type PendingAttachment as P, type ThreadMessage as T, type UIContentPart as U, type AppendMessage as a, type ModelConfigProvider as b, type ThreadAssistantContentPart as c, type MessageStatus as d, type ThreadRoundtrip as e, type PendingAttachmentStatus as f, type CompleteAttachment as g, type CompleteAttachmentStatus as h, type Tool as i, type TextContentPart as j, type ToolCallContentPart as k, type CoreToolCallContentPart as l, type CreateEdgeRuntimeAPIOptions as m, type ThreadUserContentPart as n, type ContentPartStatus as o, type ToolCallContentPartStatus as p, type AttachmentStatus as q, type ThreadSystemMessage as r, type ThreadAssistantMessage as s, type ThreadUserMessage as t, type CoreUserContentPart as u, type CoreAssistantContentPart as v, type CoreSystemMessage as w, type CoreUserMessage as x, type CoreAssistantMessage as y, createEdgeRuntimeAPI as z };