@assistant-ui/react 0.7.27 → 0.7.29

Sign up to get free protection for your applications and to get access to all the features.
Files changed (144) hide show
  1. package/dist/context/providers/AssistantRuntimeProvider.d.ts.map +1 -1
  2. package/dist/context/providers/AssistantRuntimeProvider.js +12 -9
  3. package/dist/context/providers/AssistantRuntimeProvider.js.map +1 -1
  4. package/dist/context/providers/AssistantRuntimeProvider.mjs +14 -11
  5. package/dist/context/providers/AssistantRuntimeProvider.mjs.map +1 -1
  6. package/dist/context/react/ThreadListItemContext.d.ts +0 -5
  7. package/dist/context/react/ThreadListItemContext.d.ts.map +1 -1
  8. package/dist/context/react/ThreadListItemContext.js +6 -5
  9. package/dist/context/react/ThreadListItemContext.js.map +1 -1
  10. package/dist/context/react/ThreadListItemContext.mjs +5 -3
  11. package/dist/context/react/ThreadListItemContext.mjs.map +1 -1
  12. package/dist/context/react/index.d.ts +1 -0
  13. package/dist/context/react/index.d.ts.map +1 -1
  14. package/dist/context/react/index.js +5 -0
  15. package/dist/context/react/index.js.map +1 -1
  16. package/dist/context/react/index.mjs +6 -0
  17. package/dist/context/react/index.mjs.map +1 -1
  18. package/dist/runtimes/core/AssistantRuntimeCore.d.ts +4 -5
  19. package/dist/runtimes/core/AssistantRuntimeCore.d.ts.map +1 -1
  20. package/dist/runtimes/core/AssistantRuntimeCore.js.map +1 -1
  21. package/dist/runtimes/core/BaseAssistantRuntimeCore.d.ts +0 -2
  22. package/dist/runtimes/core/BaseAssistantRuntimeCore.d.ts.map +1 -1
  23. package/dist/runtimes/core/BaseAssistantRuntimeCore.js.map +1 -1
  24. package/dist/runtimes/core/BaseAssistantRuntimeCore.mjs.map +1 -1
  25. package/dist/runtimes/core/ThreadRuntimeCore.d.ts +0 -4
  26. package/dist/runtimes/core/ThreadRuntimeCore.d.ts.map +1 -1
  27. package/dist/runtimes/core/ThreadRuntimeCore.js.map +1 -1
  28. package/dist/runtimes/dangerous-in-browser/DangerousInBrowserAdapter.d.ts +1 -1
  29. package/dist/runtimes/edge/EdgeRuntimeRequestOptions.d.ts +26 -26
  30. package/dist/runtimes/edge/EdgeRuntimeRequestOptions.d.ts.map +1 -1
  31. package/dist/runtimes/edge/EdgeRuntimeRequestOptions.js +5 -5
  32. package/dist/runtimes/edge/EdgeRuntimeRequestOptions.js.map +1 -1
  33. package/dist/runtimes/edge/EdgeRuntimeRequestOptions.mjs +5 -5
  34. package/dist/runtimes/edge/EdgeRuntimeRequestOptions.mjs.map +1 -1
  35. package/dist/runtimes/edge/converters/fromCoreMessage.js +1 -1
  36. package/dist/runtimes/edge/converters/fromCoreMessage.js.map +1 -1
  37. package/dist/runtimes/edge/converters/fromCoreMessage.mjs +1 -1
  38. package/dist/runtimes/edge/converters/fromCoreMessage.mjs.map +1 -1
  39. package/dist/runtimes/edge/converters/fromLanguageModelMessages.d.ts.map +1 -1
  40. package/dist/runtimes/edge/converters/fromLanguageModelMessages.js +4 -1
  41. package/dist/runtimes/edge/converters/fromLanguageModelMessages.js.map +1 -1
  42. package/dist/runtimes/edge/converters/fromLanguageModelMessages.mjs +4 -1
  43. package/dist/runtimes/edge/converters/fromLanguageModelMessages.mjs.map +1 -1
  44. package/dist/runtimes/edge/createEdgeRuntimeAPI.d.ts.map +1 -1
  45. package/dist/runtimes/edge/createEdgeRuntimeAPI.js +3 -4
  46. package/dist/runtimes/edge/createEdgeRuntimeAPI.js.map +1 -1
  47. package/dist/runtimes/edge/createEdgeRuntimeAPI.mjs +3 -4
  48. package/dist/runtimes/edge/createEdgeRuntimeAPI.mjs.map +1 -1
  49. package/dist/runtimes/edge/streams/AssistantStreamChunkType.d.ts +4 -2
  50. package/dist/runtimes/edge/streams/AssistantStreamChunkType.d.ts.map +1 -1
  51. package/dist/runtimes/edge/streams/AssistantStreamChunkType.js +1 -0
  52. package/dist/runtimes/edge/streams/AssistantStreamChunkType.js.map +1 -1
  53. package/dist/runtimes/edge/streams/AssistantStreamChunkType.mjs +1 -0
  54. package/dist/runtimes/edge/streams/AssistantStreamChunkType.mjs.map +1 -1
  55. package/dist/runtimes/edge/streams/assistantDecoderStream.d.ts.map +1 -1
  56. package/dist/runtimes/edge/streams/assistantDecoderStream.js +7 -1
  57. package/dist/runtimes/edge/streams/assistantDecoderStream.js.map +1 -1
  58. package/dist/runtimes/edge/streams/assistantDecoderStream.mjs +7 -1
  59. package/dist/runtimes/edge/streams/assistantDecoderStream.mjs.map +1 -1
  60. package/dist/runtimes/edge/streams/assistantEncoderStream.d.ts.map +1 -1
  61. package/dist/runtimes/edge/streams/assistantEncoderStream.js +7 -0
  62. package/dist/runtimes/edge/streams/assistantEncoderStream.js.map +1 -1
  63. package/dist/runtimes/edge/streams/assistantEncoderStream.mjs +7 -0
  64. package/dist/runtimes/edge/streams/assistantEncoderStream.mjs.map +1 -1
  65. package/dist/runtimes/edge/streams/runResultStream.d.ts +2 -2
  66. package/dist/runtimes/edge/streams/runResultStream.d.ts.map +1 -1
  67. package/dist/runtimes/edge/streams/runResultStream.js +17 -2
  68. package/dist/runtimes/edge/streams/runResultStream.js.map +1 -1
  69. package/dist/runtimes/edge/streams/runResultStream.mjs +17 -2
  70. package/dist/runtimes/edge/streams/runResultStream.mjs.map +1 -1
  71. package/dist/runtimes/edge/streams/toolResultStream.d.ts +4 -1
  72. package/dist/runtimes/edge/streams/toolResultStream.d.ts.map +1 -1
  73. package/dist/runtimes/edge/streams/toolResultStream.js +1 -0
  74. package/dist/runtimes/edge/streams/toolResultStream.js.map +1 -1
  75. package/dist/runtimes/edge/streams/toolResultStream.mjs +1 -0
  76. package/dist/runtimes/edge/streams/toolResultStream.mjs.map +1 -1
  77. package/dist/runtimes/external-store/ExternalStoreAdapter.d.ts +0 -6
  78. package/dist/runtimes/external-store/ExternalStoreAdapter.d.ts.map +1 -1
  79. package/dist/runtimes/external-store/ExternalStoreAdapter.js.map +1 -1
  80. package/dist/runtimes/external-store/ExternalStoreRuntimeCore.d.ts +0 -3
  81. package/dist/runtimes/external-store/ExternalStoreRuntimeCore.d.ts.map +1 -1
  82. package/dist/runtimes/external-store/ExternalStoreRuntimeCore.js +0 -15
  83. package/dist/runtimes/external-store/ExternalStoreRuntimeCore.js.map +1 -1
  84. package/dist/runtimes/external-store/ExternalStoreRuntimeCore.mjs +0 -15
  85. package/dist/runtimes/external-store/ExternalStoreRuntimeCore.mjs.map +1 -1
  86. package/dist/runtimes/external-store/ThreadMessageLike.d.ts +4 -3
  87. package/dist/runtimes/external-store/ThreadMessageLike.d.ts.map +1 -1
  88. package/dist/runtimes/external-store/ThreadMessageLike.js +1 -0
  89. package/dist/runtimes/external-store/ThreadMessageLike.js.map +1 -1
  90. package/dist/runtimes/external-store/ThreadMessageLike.mjs +1 -0
  91. package/dist/runtimes/external-store/ThreadMessageLike.mjs.map +1 -1
  92. package/dist/runtimes/external-store/external-message-converter.js.map +1 -1
  93. package/dist/runtimes/external-store/external-message-converter.mjs.map +1 -1
  94. package/dist/runtimes/local/ChatModelAdapter.d.ts +5 -1
  95. package/dist/runtimes/local/ChatModelAdapter.d.ts.map +1 -1
  96. package/dist/runtimes/local/ChatModelAdapter.js.map +1 -1
  97. package/dist/runtimes/local/LocalThreadRuntimeCore.js +1 -1
  98. package/dist/runtimes/local/LocalThreadRuntimeCore.js.map +1 -1
  99. package/dist/runtimes/local/LocalThreadRuntimeCore.mjs +1 -1
  100. package/dist/runtimes/local/LocalThreadRuntimeCore.mjs.map +1 -1
  101. package/dist/runtimes/remote-thread-list/RemoteThreadListThreadListRuntimeCore.d.ts +3 -3
  102. package/dist/runtimes/remote-thread-list/RemoteThreadListThreadListRuntimeCore.d.ts.map +1 -1
  103. package/dist/runtimes/remote-thread-list/RemoteThreadListThreadListRuntimeCore.js +13 -14
  104. package/dist/runtimes/remote-thread-list/RemoteThreadListThreadListRuntimeCore.js.map +1 -1
  105. package/dist/runtimes/remote-thread-list/RemoteThreadListThreadListRuntimeCore.mjs +11 -14
  106. package/dist/runtimes/remote-thread-list/RemoteThreadListThreadListRuntimeCore.mjs.map +1 -1
  107. package/dist/runtimes/remote-thread-list/cloud/useCloudThreadListRuntime.d.ts +2 -2
  108. package/dist/runtimes/remote-thread-list/cloud/useCloudThreadListRuntime.d.ts.map +1 -1
  109. package/dist/runtimes/remote-thread-list/cloud/useCloudThreadListRuntime.js.map +1 -1
  110. package/dist/runtimes/remote-thread-list/cloud/useCloudThreadListRuntime.mjs.map +1 -1
  111. package/dist/runtimes/remote-thread-list/useRemoteThreadListRuntime.d.ts.map +1 -1
  112. package/dist/runtimes/remote-thread-list/useRemoteThreadListRuntime.js +2 -2
  113. package/dist/runtimes/remote-thread-list/useRemoteThreadListRuntime.js.map +1 -1
  114. package/dist/runtimes/remote-thread-list/useRemoteThreadListRuntime.mjs +2 -2
  115. package/dist/runtimes/remote-thread-list/useRemoteThreadListRuntime.mjs.map +1 -1
  116. package/dist/types/AssistantTypes.d.ts +10 -8
  117. package/dist/types/AssistantTypes.d.ts.map +1 -1
  118. package/dist/types/AssistantTypes.js.map +1 -1
  119. package/package.json +3 -3
  120. package/src/context/providers/AssistantRuntimeProvider.tsx +9 -12
  121. package/src/context/react/ThreadListItemContext.ts +4 -2
  122. package/src/context/react/index.ts +6 -0
  123. package/src/runtimes/core/AssistantRuntimeCore.tsx +4 -5
  124. package/src/runtimes/core/BaseAssistantRuntimeCore.tsx +0 -4
  125. package/src/runtimes/core/ThreadRuntimeCore.tsx +5 -4
  126. package/src/runtimes/edge/EdgeRuntimeRequestOptions.ts +7 -5
  127. package/src/runtimes/edge/converters/fromCoreMessage.ts +1 -1
  128. package/src/runtimes/edge/converters/fromLanguageModelMessages.ts +4 -1
  129. package/src/runtimes/edge/createEdgeRuntimeAPI.ts +6 -11
  130. package/src/runtimes/edge/streams/AssistantStreamChunkType.ts +4 -3
  131. package/src/runtimes/edge/streams/assistantDecoderStream.ts +8 -1
  132. package/src/runtimes/edge/streams/assistantEncoderStream.ts +8 -0
  133. package/src/runtimes/edge/streams/runResultStream.ts +38 -15
  134. package/src/runtimes/edge/streams/toolResultStream.ts +6 -1
  135. package/src/runtimes/external-store/ExternalStoreAdapter.tsx +0 -8
  136. package/src/runtimes/external-store/ExternalStoreRuntimeCore.tsx +0 -20
  137. package/src/runtimes/external-store/ThreadMessageLike.tsx +5 -3
  138. package/src/runtimes/external-store/external-message-converter.tsx +1 -1
  139. package/src/runtimes/local/ChatModelAdapter.tsx +7 -0
  140. package/src/runtimes/local/LocalThreadRuntimeCore.tsx +1 -1
  141. package/src/runtimes/remote-thread-list/RemoteThreadListThreadListRuntimeCore.tsx +11 -15
  142. package/src/runtimes/remote-thread-list/cloud/useCloudThreadListRuntime.tsx +1 -1
  143. package/src/runtimes/remote-thread-list/useRemoteThreadListRuntime.tsx +7 -3
  144. package/src/types/AssistantTypes.ts +10 -8
@@ -71,14 +71,14 @@ export type MessageStatus = {
71
71
  };
72
72
  export type ThreadSystemMessage = MessageCommonProps & {
73
73
  readonly role: "system";
74
- readonly content: [TextContentPart];
74
+ readonly content: readonly [TextContentPart];
75
75
  readonly metadata: {
76
76
  readonly custom: Record<string, unknown>;
77
77
  };
78
78
  };
79
79
  export type ThreadUserMessage = MessageCommonProps & {
80
80
  readonly role: "user";
81
- readonly content: ThreadUserContentPart[];
81
+ readonly content: readonly ThreadUserContentPart[];
82
82
  readonly attachments: readonly CompleteAttachment[];
83
83
  readonly metadata: {
84
84
  readonly custom: Record<string, unknown>;
@@ -86,10 +86,11 @@ export type ThreadUserMessage = MessageCommonProps & {
86
86
  };
87
87
  export type ThreadAssistantMessage = MessageCommonProps & {
88
88
  readonly role: "assistant";
89
- readonly content: ThreadAssistantContentPart[];
89
+ readonly content: readonly ThreadAssistantContentPart[];
90
90
  readonly status: MessageStatus;
91
91
  readonly metadata: {
92
- readonly steps: ThreadStep[];
92
+ readonly unstable_data: readonly unknown[];
93
+ readonly steps: readonly ThreadStep[];
93
94
  readonly custom: Record<string, unknown>;
94
95
  };
95
96
  };
@@ -106,7 +107,8 @@ export type AppendMessage = CoreMessage & {
106
107
  type BaseThreadMessage = {
107
108
  readonly status?: ThreadAssistantMessage["status"];
108
109
  readonly metadata: {
109
- readonly steps?: ThreadStep[];
110
+ readonly unstable_data?: readonly unknown[];
111
+ readonly steps?: readonly ThreadStep[];
110
112
  readonly custom: Record<string, unknown>;
111
113
  };
112
114
  readonly attachments?: ThreadUserMessage["attachments"];
@@ -117,15 +119,15 @@ export type CoreUserContentPart = TextContentPart | ImageContentPart | Unstable_
117
119
  export type CoreAssistantContentPart = TextContentPart | CoreToolCallContentPart;
118
120
  export type CoreSystemMessage = {
119
121
  role: "system";
120
- content: [TextContentPart];
122
+ content: readonly [TextContentPart];
121
123
  };
122
124
  export type CoreUserMessage = {
123
125
  role: "user";
124
- content: CoreUserContentPart[];
126
+ content: readonly CoreUserContentPart[];
125
127
  };
126
128
  export type CoreAssistantMessage = {
127
129
  role: "assistant";
128
- content: CoreAssistantContentPart[];
130
+ content: readonly CoreAssistantContentPart[];
129
131
  };
130
132
  export type CoreMessage = CoreSystemMessage | CoreUserMessage | CoreAssistantMessage;
131
133
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"AssistantTypes.d.ts","sourceRoot":"","sources":["../../src/types/AssistantTypes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAEvD,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,WAAW,GAAG,QAAQ,CAAC;AAE1D,MAAM,MAAM,eAAe,GAAG;IAC5B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,yBAAyB,GAAG;IACtC,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,QAAQ,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B,GAAG,sBAAsB,CAAC,CAAC;AAErE,oDAAoD;AAEpD,MAAM,MAAM,mBAAmB,GAC3B,eAAe,GACf,gBAAgB,GAChB,yBAAyB,CAAC;AAC9B,MAAM,MAAM,wBAAwB,GAChC,eAAe,GACf,uBAAuB,CAAC;AAE5B,MAAM,MAAM,iBAAiB,GAAG;IAC9B,IAAI,EAAE,QAAQ,CAAC;IACf,OAAO,EAAE,SAAS,CAAC,eAAe,CAAC,CAAC;CACrC,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,SAAS,mBAAmB,EAAE,CAAC;CACzC,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IACjC,IAAI,EAAE,WAAW,CAAC;IAClB,OAAO,EAAE,SAAS,wBAAwB,EAAE,CAAC;CAC9C,CAAC;AAEF,MAAM,MAAM,WAAW,GACnB,iBAAiB,GACjB,eAAe,GACf,oBAAoB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/types/AssistantTypes.ts"],"sourcesContent":["import type { ReactNode } from \"react\";\nimport { CompleteAttachment } from \"./AttachmentTypes\";\n\nexport type MessageRole = \"user\" | \"assistant\" | \"system\";\n\nexport type TextContentPart = {\n readonly type: \"text\";\n readonly text: string;\n};\n\nexport type ImageContentPart = {\n readonly type: \"image\";\n readonly image: string;\n};\n\nexport type Unstable_AudioContentPart = {\n readonly type: \"audio\";\n readonly audio: {\n readonly data: string;\n readonly format: \"mp3\" | \"wav\";\n };\n};\n\nexport type UIContentPart = {\n readonly type: \"ui\";\n readonly display: ReactNode;\n};\n\nexport type CoreToolCallContentPart<\n TArgs extends Record<string, unknown> = Record<string | number, unknown>,\n TResult = unknown,\n> = {\n readonly type: \"tool-call\";\n readonly toolCallId: string;\n readonly toolName: string;\n readonly args: TArgs;\n readonly result?: TResult | undefined;\n readonly isError?: boolean | undefined;\n};\n\nexport type ToolCallContentPart<\n TArgs extends Record<string, unknown> = Record<string | number, unknown>,\n TResult = unknown,\n> = CoreToolCallContentPart<TArgs, TResult> & {\n readonly argsText: string;\n};\n\nexport type ThreadUserContentPart =\n | TextContentPart\n | ImageContentPart\n | Unstable_AudioContentPart\n | UIContentPart;\n\nexport type ThreadAssistantContentPart =\n | TextContentPart\n | ToolCallContentPart\n | UIContentPart;\n\ntype MessageCommonProps = {\n readonly id: string;\n readonly createdAt: Date;\n};\n\nexport type ThreadStep = {\n readonly usage?:\n | {\n readonly promptTokens: number;\n readonly completionTokens: number;\n }\n | undefined;\n};\n\nexport type ContentPartStatus =\n | {\n readonly type: \"running\";\n }\n | {\n readonly type: \"complete\";\n }\n | {\n readonly type: \"incomplete\";\n readonly reason:\n | \"cancelled\"\n | \"length\"\n | \"content-filter\"\n | \"other\"\n | \"error\";\n readonly error?: unknown;\n };\n\nexport type ToolCallContentPartStatus =\n | {\n readonly type: \"requires-action\";\n readonly reason: \"tool-calls\";\n }\n | ContentPartStatus;\n\nexport type MessageStatus =\n | {\n readonly type: \"running\";\n }\n | {\n readonly type: \"requires-action\";\n readonly reason: \"tool-calls\";\n }\n | {\n readonly type: \"complete\";\n readonly reason: \"stop\" | \"unknown\";\n }\n | {\n readonly type: \"incomplete\";\n readonly reason:\n | \"cancelled\"\n | \"tool-calls\"\n | \"length\"\n | \"content-filter\"\n | \"other\"\n | \"error\";\n readonly error?: unknown;\n };\n\nexport type ThreadSystemMessage = MessageCommonProps & {\n readonly role: \"system\";\n readonly content: [TextContentPart];\n readonly metadata: {\n readonly custom: Record<string, unknown>;\n };\n};\n\nexport type ThreadUserMessage = MessageCommonProps & {\n readonly role: \"user\";\n readonly content: ThreadUserContentPart[];\n readonly attachments: readonly CompleteAttachment[];\n readonly metadata: {\n readonly custom: Record<string, unknown>;\n };\n};\n\nexport type ThreadAssistantMessage = MessageCommonProps & {\n readonly role: \"assistant\";\n readonly content: ThreadAssistantContentPart[];\n readonly status: MessageStatus;\n readonly metadata: {\n readonly steps: ThreadStep[];\n readonly custom: Record<string, unknown>;\n };\n};\n\nexport type RunConfig = {\n // TODO allow user customization via global type overrides\n readonly custom?: Record<string, unknown>;\n};\n\nexport type AppendMessage = CoreMessage & {\n parentId: string | null;\n attachments: readonly CompleteAttachment[];\n startRun?: boolean | undefined;\n /** TODO: make required in 0.8.0 */\n runConfig?: RunConfig | undefined;\n};\n\ntype BaseThreadMessage = {\n readonly status?: ThreadAssistantMessage[\"status\"];\n readonly metadata: {\n readonly steps?: ThreadStep[];\n readonly custom: Record<string, unknown>;\n };\n readonly attachments?: ThreadUserMessage[\"attachments\"];\n};\n\nexport type ThreadMessage = BaseThreadMessage &\n (ThreadSystemMessage | ThreadUserMessage | ThreadAssistantMessage);\n\n/** Core Message Types (without UI content parts) */\n\nexport type CoreUserContentPart =\n | TextContentPart\n | ImageContentPart\n | Unstable_AudioContentPart;\nexport type CoreAssistantContentPart =\n | TextContentPart\n | CoreToolCallContentPart;\n\nexport type CoreSystemMessage = {\n role: \"system\";\n content: [TextContentPart];\n};\n\nexport type CoreUserMessage = {\n role: \"user\";\n content: CoreUserContentPart[];\n};\n\nexport type CoreAssistantMessage = {\n role: \"assistant\";\n content: CoreAssistantContentPart[];\n};\n\nexport type CoreMessage =\n | CoreSystemMessage\n | CoreUserMessage\n | CoreAssistantMessage;\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
1
+ {"version":3,"sources":["../../src/types/AssistantTypes.ts"],"sourcesContent":["import type { ReactNode } from \"react\";\nimport { CompleteAttachment } from \"./AttachmentTypes\";\n\nexport type MessageRole = \"user\" | \"assistant\" | \"system\";\n\nexport type TextContentPart = {\n readonly type: \"text\";\n readonly text: string;\n};\n\nexport type ImageContentPart = {\n readonly type: \"image\";\n readonly image: string;\n};\n\nexport type Unstable_AudioContentPart = {\n readonly type: \"audio\";\n readonly audio: {\n readonly data: string;\n readonly format: \"mp3\" | \"wav\";\n };\n};\n\nexport type UIContentPart = {\n readonly type: \"ui\";\n readonly display: ReactNode;\n};\n\nexport type CoreToolCallContentPart<\n TArgs extends Record<string, unknown> = Record<string | number, unknown>,\n TResult = unknown,\n> = {\n readonly type: \"tool-call\";\n readonly toolCallId: string;\n readonly toolName: string;\n readonly args: TArgs;\n readonly result?: TResult | undefined;\n readonly isError?: boolean | undefined;\n};\n\nexport type ToolCallContentPart<\n TArgs extends Record<string, unknown> = Record<string | number, unknown>,\n TResult = unknown,\n> = CoreToolCallContentPart<TArgs, TResult> & {\n readonly argsText: string;\n};\n\nexport type ThreadUserContentPart =\n | TextContentPart\n | ImageContentPart\n | Unstable_AudioContentPart\n | UIContentPart;\n\nexport type ThreadAssistantContentPart =\n | TextContentPart\n | ToolCallContentPart\n | UIContentPart;\n\ntype MessageCommonProps = {\n readonly id: string;\n readonly createdAt: Date;\n};\n\nexport type ThreadStep = {\n readonly usage?:\n | {\n readonly promptTokens: number;\n readonly completionTokens: number;\n }\n | undefined;\n};\n\nexport type ContentPartStatus =\n | {\n readonly type: \"running\";\n }\n | {\n readonly type: \"complete\";\n }\n | {\n readonly type: \"incomplete\";\n readonly reason:\n | \"cancelled\"\n | \"length\"\n | \"content-filter\"\n | \"other\"\n | \"error\";\n readonly error?: unknown;\n };\n\nexport type ToolCallContentPartStatus =\n | {\n readonly type: \"requires-action\";\n readonly reason: \"tool-calls\";\n }\n | ContentPartStatus;\n\nexport type MessageStatus =\n | {\n readonly type: \"running\";\n }\n | {\n readonly type: \"requires-action\";\n readonly reason: \"tool-calls\";\n }\n | {\n readonly type: \"complete\";\n readonly reason: \"stop\" | \"unknown\";\n }\n | {\n readonly type: \"incomplete\";\n readonly reason:\n | \"cancelled\"\n | \"tool-calls\"\n | \"length\"\n | \"content-filter\"\n | \"other\"\n | \"error\";\n readonly error?: unknown;\n };\n\nexport type ThreadSystemMessage = MessageCommonProps & {\n readonly role: \"system\";\n readonly content: readonly [TextContentPart];\n readonly metadata: {\n readonly custom: Record<string, unknown>;\n };\n};\n\nexport type ThreadUserMessage = MessageCommonProps & {\n readonly role: \"user\";\n readonly content: readonly ThreadUserContentPart[];\n readonly attachments: readonly CompleteAttachment[];\n readonly metadata: {\n readonly custom: Record<string, unknown>;\n };\n};\n\nexport type ThreadAssistantMessage = MessageCommonProps & {\n readonly role: \"assistant\";\n readonly content: readonly ThreadAssistantContentPart[];\n readonly status: MessageStatus;\n readonly metadata: {\n readonly unstable_data: readonly unknown[];\n readonly steps: readonly ThreadStep[];\n readonly custom: Record<string, unknown>;\n };\n};\n\nexport type RunConfig = {\n // TODO allow user customization via global type overrides\n readonly custom?: Record<string, unknown>;\n};\n\nexport type AppendMessage = CoreMessage & {\n parentId: string | null;\n attachments: readonly CompleteAttachment[];\n startRun?: boolean | undefined;\n /** TODO: make required in 0.8.0 */\n runConfig?: RunConfig | undefined;\n};\n\ntype BaseThreadMessage = {\n readonly status?: ThreadAssistantMessage[\"status\"];\n readonly metadata: {\n readonly unstable_data?: readonly unknown[];\n readonly steps?: readonly ThreadStep[];\n readonly custom: Record<string, unknown>;\n };\n readonly attachments?: ThreadUserMessage[\"attachments\"];\n};\n\nexport type ThreadMessage = BaseThreadMessage &\n (ThreadSystemMessage | ThreadUserMessage | ThreadAssistantMessage);\n\n/** Core Message Types (without UI content parts) */\n\nexport type CoreUserContentPart =\n | TextContentPart\n | ImageContentPart\n | Unstable_AudioContentPart;\nexport type CoreAssistantContentPart =\n | TextContentPart\n | CoreToolCallContentPart;\n\nexport type CoreSystemMessage = {\n role: \"system\";\n content: readonly [TextContentPart];\n};\n\nexport type CoreUserMessage = {\n role: \"user\";\n content: readonly CoreUserContentPart[];\n};\n\nexport type CoreAssistantMessage = {\n role: \"assistant\";\n content: readonly CoreAssistantContentPart[];\n};\n\nexport type CoreMessage =\n | CoreSystemMessage\n | CoreUserMessage\n | CoreAssistantMessage;\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
package/package.json CHANGED
@@ -29,7 +29,7 @@
29
29
  "conversational-ui",
30
30
  "conversational-ai"
31
31
  ],
32
- "version": "0.7.27",
32
+ "version": "0.7.29",
33
33
  "license": "MIT",
34
34
  "exports": {
35
35
  ".": {
@@ -120,9 +120,9 @@
120
120
  "tailwindcss-animate": "^1.0.7",
121
121
  "tsup": "8.3.5",
122
122
  "tsx": "^4.19.2",
123
- "@assistant-ui/tailwindcss-transformer": "0.1.0",
124
123
  "@assistant-ui/tsbuildutils": "^0.0.1",
125
- "@assistant-ui/tsconfig": "0.0.0"
124
+ "@assistant-ui/tsconfig": "0.0.0",
125
+ "@assistant-ui/tailwindcss-transformer": "0.1.0"
126
126
  },
127
127
  "publishConfig": {
128
128
  "access": "public",
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
 
3
3
  import type { FC, PropsWithChildren } from "react";
4
- import { Fragment, memo, useEffect, useMemo, useState } from "react";
4
+ import { memo, useEffect, useMemo, useState } from "react";
5
5
  import { AssistantContext } from "../react/AssistantContext";
6
6
  import { makeAssistantToolUIsStore } from "../stores/AssistantToolUIs";
7
7
  import { ThreadRuntimeProvider } from "./ThreadRuntimeProvider";
@@ -47,9 +47,7 @@ const useThreadListStore = (runtime: AssistantRuntime) => {
47
47
  };
48
48
 
49
49
  const getRenderComponent = (runtime: AssistantRuntime) => {
50
- return (
51
- (runtime as { _core?: AssistantRuntimeCore })._core?.Provider ?? Fragment
52
- );
50
+ return (runtime as { _core?: AssistantRuntimeCore })._core?.RenderComponent;
53
51
  };
54
52
 
55
53
  export const AssistantRuntimeProviderImpl: FC<
@@ -70,14 +68,13 @@ export const AssistantRuntimeProviderImpl: FC<
70
68
 
71
69
  return (
72
70
  <AssistantContext.Provider value={context}>
73
- <RenderComponent>
74
- <ThreadRuntimeProvider
75
- runtime={runtime.thread}
76
- listItemRuntime={runtime.threadList.mainItem}
77
- >
78
- {children}
79
- </ThreadRuntimeProvider>
80
- </RenderComponent>
71
+ {RenderComponent && <RenderComponent />}
72
+ <ThreadRuntimeProvider
73
+ runtime={runtime.thread}
74
+ listItemRuntime={runtime.threadList.mainItem}
75
+ >
76
+ {children}
77
+ </ThreadRuntimeProvider>
81
78
  </AssistantContext.Provider>
82
79
  );
83
80
  };
@@ -35,5 +35,7 @@ export function useThreadListItemRuntime(options?: {
35
35
  return context.useThreadListItemRuntime();
36
36
  }
37
37
 
38
- export const { useThreadListItem, useThreadListItemStore } =
39
- createContextStoreHook(useThreadListItemContext, "useThreadListItem");
38
+ export const { useThreadListItem } = createContextStoreHook(
39
+ useThreadListItemContext,
40
+ "useThreadListItem",
41
+ );
@@ -13,6 +13,12 @@ export {
13
13
  useThreadViewport,
14
14
  useThreadViewportStore,
15
15
  } from "./ThreadContext";
16
+
17
+ export {
18
+ useThreadListItemRuntime,
19
+ useThreadListItem,
20
+ } from "./ThreadListItemContext";
21
+
16
22
  export {
17
23
  useMessageRuntime,
18
24
  useMessage,
@@ -1,4 +1,4 @@
1
- import { ComponentType, PropsWithChildren } from "react";
1
+ import { ComponentType } from "react";
2
2
  import type { ModelConfigProvider } from "../../types/ModelConfigTypes";
3
3
  import type { Unsubscribe } from "../../types/Unsubscribe";
4
4
  import { ThreadListRuntimeCore } from "./ThreadListRuntimeCore";
@@ -9,11 +9,10 @@ export type AssistantRuntimeCore = {
9
9
  registerModelConfigProvider: (provider: ModelConfigProvider) => Unsubscribe;
10
10
 
11
11
  /**
12
- * A Provider component that wraps the app via `AssistantRuntimeProvider`.
12
+ * EXPERIMENTAL: A component that is rendered inside the AssistantRuntimeProvider.
13
13
  *
14
14
  * Note: This field is expected to never change.
15
- * Refer to the source implementation of `ExternalStoreRuntimeCore`
16
- * for an example of updating the provider via a zustand store.
15
+ * To update the component, use a zustand store.
17
16
  */
18
- readonly Provider: ComponentType<PropsWithChildren> | undefined;
17
+ readonly RenderComponent?: ComponentType | undefined;
19
18
  };
@@ -3,14 +3,10 @@ import type { Unsubscribe } from "../../types/Unsubscribe";
3
3
  import type { AssistantRuntimeCore } from "./AssistantRuntimeCore";
4
4
  import { ProxyConfigProvider } from "../../utils/ProxyConfigProvider";
5
5
  import { ThreadListRuntimeCore } from "./ThreadListRuntimeCore";
6
- import { ComponentType } from "react";
7
6
 
8
7
  export abstract class BaseAssistantRuntimeCore implements AssistantRuntimeCore {
9
8
  protected readonly _proxyConfigProvider = new ProxyConfigProvider();
10
9
  public abstract get threadList(): ThreadListRuntimeCore;
11
- public abstract get Provider():
12
- | ComponentType<React.PropsWithChildren>
13
- | undefined;
14
10
 
15
11
  constructor() {}
16
12
 
@@ -90,10 +90,11 @@ export type ThreadRuntimeCore = Readonly<{
90
90
  messages: readonly ThreadMessage[];
91
91
  suggestions: readonly ThreadSuggestion[];
92
92
 
93
- /**
94
- * @deprecated This field is deprecated and will be removed in 0.8.0.
95
- * Please migrate to using `AssistantRuntimeCore.Provider` instead.
96
- */
93
+ // TODO deprecate for a more elegant solution
94
+ // /**
95
+ // * @deprecated This field is deprecated and will be removed in 0.8.0.
96
+ // * Please migrate to using `AssistantRuntimeCore.Provider` instead.
97
+ // */
97
98
  extras: unknown;
98
99
 
99
100
  subscribe: (callback: () => void) => Unsubscribe;
@@ -52,7 +52,8 @@ const CoreUserMessageSchema = z.object({
52
52
  Unstable_AudioContentPart,
53
53
  ]),
54
54
  )
55
- .min(1),
55
+ .min(1)
56
+ .readonly(),
56
57
  });
57
58
 
58
59
  const CoreAssistantMessageSchema = z.object({
@@ -64,12 +65,13 @@ const CoreAssistantMessageSchema = z.object({
64
65
  CoreToolCallContentPartSchema,
65
66
  ]),
66
67
  )
67
- .min(1),
68
+ .min(1)
69
+ .readonly(),
68
70
  });
69
71
 
70
72
  const CoreSystemMessageSchema = z.object({
71
73
  role: z.literal("system"),
72
- content: z.tuple([TextContentPartSchema]),
74
+ content: z.tuple([TextContentPartSchema]).readonly(),
73
75
  });
74
76
 
75
77
  const CoreMessageSchema = z.discriminatedUnion("role", [
@@ -81,13 +83,13 @@ const CoreMessageSchema = z.discriminatedUnion("role", [
81
83
  export const EdgeRuntimeRequestOptionsSchema = z
82
84
  .object({
83
85
  system: z.string().optional(),
84
- messages: z.array(CoreMessageSchema).min(1),
86
+ messages: z.array(CoreMessageSchema).min(1).readonly(),
85
87
  runConfig: z
86
88
  .object({
87
89
  custom: z.record(z.unknown()).optional(),
88
90
  })
89
91
  .optional(),
90
- tools: z.array(LanguageModelV1FunctionToolSchema).optional(),
92
+ tools: z.array(LanguageModelV1FunctionToolSchema).readonly().optional(),
91
93
  unstable_assistantMessageId: z.string().optional(),
92
94
  })
93
95
  .merge(LanguageModelV1CallSettingsSchema)
@@ -43,7 +43,7 @@ export const fromCoreMessage = (
43
43
  }),
44
44
  status,
45
45
 
46
- metadata: { steps: [], custom: {} },
46
+ metadata: { unstable_data: [], steps: [], custom: {} },
47
47
  } satisfies ThreadMessage;
48
48
 
49
49
  case "user":
@@ -78,7 +78,10 @@ export const fromLanguageModelMessages = (
78
78
  if (mergeSteps) {
79
79
  const previousMessage = messages[messages.length - 1];
80
80
  if (previousMessage?.role === "assistant") {
81
- previousMessage.content.push(...newContent);
81
+ previousMessage.content = [
82
+ ...previousMessage.content,
83
+ ...newContent,
84
+ ];
82
85
  break;
83
86
  }
84
87
  }
@@ -5,11 +5,7 @@ import {
5
5
  LanguageModelV1Prompt,
6
6
  LanguageModelV1CallOptions,
7
7
  } from "@ai-sdk/provider";
8
- import {
9
- CoreMessage,
10
- ThreadMessage,
11
- ThreadStep,
12
- } from "../../types/AssistantTypes";
8
+ import { CoreMessage, ThreadStep } from "../../types/AssistantTypes";
13
9
  import { assistantEncoderStream } from "./streams/assistantEncoderStream";
14
10
  import { EdgeRuntimeRequestOptionsSchema } from "./EdgeRuntimeRequestOptions";
15
11
  import { toLanguageModelMessages } from "./converters/toLanguageModelMessages";
@@ -25,8 +21,7 @@ import {
25
21
  LanguageModelV1CallSettings,
26
22
  LanguageModelV1CallSettingsSchema,
27
23
  } from "../../types/ModelConfigTypes";
28
- import { ChatModelRunResult } from "../local/ChatModelAdapter";
29
- import { toCoreMessage } from "./converters/toCoreMessages";
24
+ import { CoreChatModelRunResult } from "../local/ChatModelAdapter";
30
25
  import { streamPartEncoderStream } from "./streams/utils/streamPartEncoderStream";
31
26
  import { z } from "zod";
32
27
 
@@ -116,7 +111,7 @@ export const getEdgeRuntimeStream = async ({
116
111
  abortSignal,
117
112
 
118
113
  ...(!!system ? { system } : undefined),
119
- messages,
114
+ messages: [...messages],
120
115
  tools: lmServerTools.concat(clientTools as LanguageModelV1FunctionTool[]),
121
116
  ...(toolChoice ? { toolChoice } : undefined),
122
117
  });
@@ -135,7 +130,7 @@ export const getEdgeRuntimeStream = async ({
135
130
  let serverStream = tees[1];
136
131
 
137
132
  if (onFinish) {
138
- let lastChunk: ChatModelRunResult;
133
+ let lastChunk: CoreChatModelRunResult | undefined;
139
134
  serverStream = serverStream.pipeThrough(runResultStream()).pipeThrough(
140
135
  new TransformStream({
141
136
  transform(chunk) {
@@ -147,10 +142,10 @@ export const getEdgeRuntimeStream = async ({
147
142
 
148
143
  const resultingMessages = [
149
144
  ...messages,
150
- toCoreMessage({
145
+ {
151
146
  role: "assistant",
152
147
  content: lastChunk.content,
153
- } as ThreadMessage),
148
+ } satisfies CoreMessage,
154
149
  ];
155
150
  onFinish({
156
151
  messages: resultingMessages,
@@ -1,9 +1,10 @@
1
- import { LanguageModelV1StreamPart } from "@ai-sdk/provider";
1
+ import { JSONValue, LanguageModelV1StreamPart } from "@ai-sdk/provider";
2
2
 
3
3
  export enum AssistantStreamChunkType {
4
4
  TextDelta = "0",
5
5
  Data = "2",
6
6
  Error = "3",
7
+ Annotation = "8",
7
8
  ToolCall = "9",
8
9
  ToolCallResult = "a",
9
10
  ToolCallBegin = "b",
@@ -14,7 +15,8 @@ export enum AssistantStreamChunkType {
14
15
 
15
16
  export type AssistantStreamChunk = {
16
17
  [AssistantStreamChunkType.TextDelta]: string;
17
- [AssistantStreamChunkType.Data]: unknown;
18
+ [AssistantStreamChunkType.Data]: JSONValue[];
19
+ [AssistantStreamChunkType.Annotation]: JSONValue[];
18
20
  [AssistantStreamChunkType.ToolCall]: {
19
21
  toolCallId: string;
20
22
  toolName: string;
@@ -55,4 +57,3 @@ export type AssistantStreamChunk = {
55
57
  "type"
56
58
  >;
57
59
  };
58
-
@@ -131,8 +131,15 @@ export function assistantDecoderStream() {
131
131
  break;
132
132
  }
133
133
 
134
- // TODO
135
134
  case AssistantStreamChunkType.Data:
135
+ controller.enqueue({
136
+ type: "data",
137
+ data: value,
138
+ });
139
+ break;
140
+
141
+ // TODO
142
+ case AssistantStreamChunkType.Annotation:
136
143
  break;
137
144
 
138
145
  default: {
@@ -44,6 +44,14 @@ export function assistantEncoderStream() {
44
44
  break;
45
45
  }
46
46
 
47
+ case "data": {
48
+ controller.enqueue({
49
+ type: AssistantStreamChunkType.Data,
50
+ value: chunk.data,
51
+ });
52
+ break;
53
+ }
54
+
47
55
  // ignore
48
56
  case "tool-call":
49
57
  case "response-metadata":
@@ -1,16 +1,16 @@
1
- import { ChatModelRunResult } from "../../local/ChatModelAdapter";
1
+ import { CoreChatModelRunResult } from "../../local/ChatModelAdapter";
2
2
  import { parsePartialJson } from "../partial-json/parse-partial-json";
3
3
  import { LanguageModelV1StreamPart } from "@ai-sdk/provider";
4
4
  import { ToolResultStreamPart } from "./toolResultStream";
5
5
  import { MessageStatus, ToolCallContentPart } from "../../../types";
6
6
 
7
7
  export function runResultStream() {
8
- let message: ChatModelRunResult = {
8
+ let message: CoreChatModelRunResult = {
9
9
  content: [],
10
10
  status: { type: "running" },
11
11
  };
12
12
 
13
- return new TransformStream<ToolResultStreamPart, ChatModelRunResult>({
13
+ return new TransformStream<ToolResultStreamPart, CoreChatModelRunResult>({
14
14
  transform(chunk, controller) {
15
15
  const chunkType = chunk.type;
16
16
  switch (chunkType) {
@@ -34,9 +34,16 @@ export function runResultStream() {
34
34
  }
35
35
 
36
36
  case "tool-call":
37
+ // ignoring tool call events because they are converted to tool-call-delta as well
37
38
  case "response-metadata":
38
39
  break;
39
40
 
41
+ case "data": {
42
+ message = appendData(message, chunk);
43
+ controller.enqueue(message);
44
+ break;
45
+ }
46
+
40
47
  case "tool-result": {
41
48
  message = appendOrUpdateToolResult(
42
49
  message,
@@ -48,7 +55,7 @@ export function runResultStream() {
48
55
  break;
49
56
  }
50
57
  case "step-finish": {
51
- message = appendOrUpdateStepFinish(message, chunk);
58
+ message = appendStepFinish(message, chunk);
52
59
  controller.enqueue(message);
53
60
  break;
54
61
  }
@@ -92,7 +99,10 @@ export function runResultStream() {
92
99
  });
93
100
  }
94
101
 
95
- const appendOrUpdateText = (message: ChatModelRunResult, textDelta: string) => {
102
+ const appendOrUpdateText = (
103
+ message: CoreChatModelRunResult,
104
+ textDelta: string,
105
+ ) => {
96
106
  let contentParts = message.content ?? [];
97
107
  let contentPart = message.content?.at(-1);
98
108
  if (contentPart?.type !== "text") {
@@ -108,11 +118,11 @@ const appendOrUpdateText = (message: ChatModelRunResult, textDelta: string) => {
108
118
  };
109
119
 
110
120
  const appendOrUpdateToolCall = (
111
- message: ChatModelRunResult,
121
+ message: CoreChatModelRunResult,
112
122
  toolCallId: string,
113
123
  toolName: string,
114
124
  argsTextDelta: string,
115
- ): ChatModelRunResult => {
125
+ ): CoreChatModelRunResult => {
116
126
  let contentParts = message.content ?? [];
117
127
  const contentPartIdx = contentParts.findIndex(
118
128
  (c) => c.type === "tool-call" && c.toolCallId === toolCallId,
@@ -152,7 +162,7 @@ const appendOrUpdateToolCall = (
152
162
  };
153
163
 
154
164
  const appendOrUpdateToolResult = (
155
- message: ChatModelRunResult,
165
+ message: CoreChatModelRunResult,
156
166
  toolCallId: string,
157
167
  toolName: string,
158
168
  result: any,
@@ -184,10 +194,23 @@ const appendOrUpdateToolResult = (
184
194
  };
185
195
  };
186
196
 
187
- const appendOrUpdateStepFinish = (
188
- message: ChatModelRunResult,
197
+ const appendData = (
198
+ message: CoreChatModelRunResult,
199
+ chunk: ToolResultStreamPart & { type: "data" },
200
+ ): CoreChatModelRunResult => {
201
+ return {
202
+ ...message,
203
+ metadata: {
204
+ ...message.metadata,
205
+ unstable_data: [...(message.metadata?.unstable_data ?? []), chunk.data],
206
+ },
207
+ };
208
+ };
209
+
210
+ const appendStepFinish = (
211
+ message: CoreChatModelRunResult,
189
212
  chunk: ToolResultStreamPart & { type: "step-finish" },
190
- ): ChatModelRunResult => {
213
+ ): CoreChatModelRunResult => {
191
214
  const { type, ...rest } = chunk;
192
215
  const steps = [
193
216
  ...(message.metadata?.steps ?? []),
@@ -205,9 +228,9 @@ const appendOrUpdateStepFinish = (
205
228
  };
206
229
 
207
230
  const appendOrUpdateFinish = (
208
- message: ChatModelRunResult,
231
+ message: CoreChatModelRunResult,
209
232
  chunk: LanguageModelV1StreamPart & { type: "finish" },
210
- ): ChatModelRunResult => {
233
+ ): CoreChatModelRunResult => {
211
234
  const { type, ...rest } = chunk;
212
235
 
213
236
  const steps = [
@@ -254,8 +277,8 @@ const getStatus = (
254
277
  };
255
278
 
256
279
  const appendOrUpdateCancel = (
257
- message: ChatModelRunResult,
258
- ): ChatModelRunResult => {
280
+ message: CoreChatModelRunResult,
281
+ ): CoreChatModelRunResult => {
259
282
  return {
260
283
  ...message,
261
284
  status: {
@@ -1,10 +1,14 @@
1
1
  import { Tool } from "../../../types/ModelConfigTypes";
2
- import { LanguageModelV1StreamPart } from "@ai-sdk/provider";
2
+ import { JSONValue, LanguageModelV1StreamPart } from "@ai-sdk/provider";
3
3
  import { z } from "zod";
4
4
  import sjson from "secure-json-parse";
5
5
 
6
6
  export type ToolResultStreamPart =
7
7
  | LanguageModelV1StreamPart
8
+ | {
9
+ type: "data";
10
+ data: JSONValue[];
11
+ }
8
12
  | {
9
13
  type: "tool-result";
10
14
  toolCallType: "function";
@@ -107,6 +111,7 @@ export function toolResultStream(
107
111
  case "finish":
108
112
  case "error":
109
113
  case "response-metadata":
114
+ case "data":
110
115
  break;
111
116
 
112
117
  default: {
@@ -1,4 +1,3 @@
1
- import { PropsWithChildren } from "react";
2
1
  import { AppendMessage, ThreadMessage } from "../../types";
3
2
  import { AttachmentAdapter } from "../attachment";
4
3
  import {
@@ -54,11 +53,6 @@ type ExternalStoreAdapterBase<T> = {
54
53
  isRunning?: boolean | undefined;
55
54
  messages: T[];
56
55
  suggestions?: readonly ThreadSuggestion[] | undefined;
57
-
58
- /**
59
- * @deprecated This field is deprecated and will be removed in 0.8.0.
60
- * Please migrate to `Provider` and a custom react context provider component instead.
61
- */
62
56
  extras?: unknown;
63
57
 
64
58
  setMessages?: ((messages: T[]) => void) | undefined;
@@ -88,8 +82,6 @@ type ExternalStoreAdapterBase<T> = {
88
82
  copy?: boolean | undefined;
89
83
  }
90
84
  | undefined;
91
-
92
- unstable_Provider?: React.ComponentType<PropsWithChildren> | undefined;
93
85
  };
94
86
 
95
87
  export type ExternalStoreAdapter<T = ThreadMessage> =
@@ -2,9 +2,6 @@ import { BaseAssistantRuntimeCore } from "../../internal";
2
2
  import { ExternalStoreThreadListRuntimeCore } from "./ExternalStoreThreadListRuntimeCore";
3
3
  import { ExternalStoreAdapter } from "./ExternalStoreAdapter";
4
4
  import { ExternalStoreThreadRuntimeCore } from "./ExternalStoreThreadRuntimeCore";
5
- import { Fragment } from "react/jsx-runtime";
6
- import { PropsWithChildren } from "react";
7
- import { create } from "zustand";
8
5
 
9
6
  const getThreadListAdapter = (store: ExternalStoreAdapter<any>) => {
10
7
  return {
@@ -15,13 +12,8 @@ const getThreadListAdapter = (store: ExternalStoreAdapter<any>) => {
15
12
  export class ExternalStoreRuntimeCore extends BaseAssistantRuntimeCore {
16
13
  public readonly threadList;
17
14
 
18
- private useRenderComponent;
19
-
20
15
  constructor(adapter: ExternalStoreAdapter<any>) {
21
16
  super();
22
- this.useRenderComponent = create(() => ({
23
- RenderComponent: adapter.unstable_Provider ?? Fragment,
24
- }));
25
17
  this.threadList = new ExternalStoreThreadListRuntimeCore(
26
18
  getThreadListAdapter(adapter),
27
19
  () =>
@@ -33,17 +25,5 @@ export class ExternalStoreRuntimeCore extends BaseAssistantRuntimeCore {
33
25
  // Update the thread list adapter and propagate store changes to the main thread
34
26
  this.threadList.__internal_setAdapter(getThreadListAdapter(adapter));
35
27
  this.threadList.getMainThreadRuntimeCore().__internal_setAdapter(adapter);
36
-
37
- const RenderComponent = adapter.unstable_Provider ?? Fragment;
38
- if (
39
- RenderComponent !== this.useRenderComponent.getState().RenderComponent
40
- ) {
41
- this.useRenderComponent.setState({ RenderComponent }, true);
42
- }
43
28
  }
44
-
45
- public readonly Provider = ({ children }: PropsWithChildren) => {
46
- const RenderComponent = this.useRenderComponent.getState().RenderComponent;
47
- return <RenderComponent>{children}</RenderComponent>;
48
- };
49
29
  }