@assistant-ui/react 0.14.27 → 0.14.28

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 (180) hide show
  1. package/dist/client/ExternalThread.d.ts.map +1 -1
  2. package/dist/client/ExternalThread.js +2 -2
  3. package/dist/client/ExternalThread.js.map +1 -1
  4. package/dist/context/react/utils/createContextStoreHook.d.ts.map +1 -1
  5. package/dist/context/react/utils/createStateHookForRuntime.d.ts.map +1 -1
  6. package/dist/legacy-runtime/AssistantRuntimeProvider.js.map +1 -1
  7. package/dist/legacy-runtime/runtime-cores/assistant-transport/commandQueue.d.ts.map +1 -1
  8. package/dist/mcp-apps/McpAppRenderer.d.ts.map +1 -1
  9. package/dist/model-context/makeAssistantVisible.d.ts.map +1 -1
  10. package/dist/model-context/makeAssistantVisible.js +7 -1
  11. package/dist/model-context/makeAssistantVisible.js.map +1 -1
  12. package/dist/primitives/actionBar/ActionBarCopy.d.ts.map +1 -1
  13. package/dist/primitives/actionBar/ActionBarEdit.d.ts.map +1 -1
  14. package/dist/primitives/actionBar/ActionBarExportMarkdown.d.ts.map +1 -1
  15. package/dist/primitives/actionBar/ActionBarFeedbackNegative.d.ts.map +1 -1
  16. package/dist/primitives/actionBar/ActionBarFeedbackPositive.d.ts.map +1 -1
  17. package/dist/primitives/actionBar/ActionBarReload.d.ts.map +1 -1
  18. package/dist/primitives/actionBar/ActionBarRoot.d.ts.map +1 -1
  19. package/dist/primitives/actionBar/ActionBarRoot.js.map +1 -1
  20. package/dist/primitives/actionBar/ActionBarSpeak.d.ts.map +1 -1
  21. package/dist/primitives/actionBar/ActionBarStopSpeaking.d.ts.map +1 -1
  22. package/dist/primitives/actionBarMore/ActionBarMoreContent.d.ts.map +1 -1
  23. package/dist/primitives/actionBarMore/ActionBarMoreContent.js.map +1 -1
  24. package/dist/primitives/actionBarMore/ActionBarMoreItem.d.ts.map +1 -1
  25. package/dist/primitives/actionBarMore/ActionBarMoreSeparator.d.ts.map +1 -1
  26. package/dist/primitives/actionBarMore/ActionBarMoreTrigger.d.ts.map +1 -1
  27. package/dist/primitives/assistantModal/AssistantModalAnchor.d.ts.map +1 -1
  28. package/dist/primitives/assistantModal/AssistantModalContent.d.ts.map +1 -1
  29. package/dist/primitives/assistantModal/AssistantModalContent.js.map +1 -1
  30. package/dist/primitives/assistantModal/AssistantModalTrigger.d.ts.map +1 -1
  31. package/dist/primitives/assistantModal/popoverRenderPrimitives.d.ts.map +1 -1
  32. package/dist/primitives/attachment/AttachmentRemove.d.ts.map +1 -1
  33. package/dist/primitives/attachment/AttachmentRoot.d.ts.map +1 -1
  34. package/dist/primitives/attachment/AttachmentThumb.d.ts.map +1 -1
  35. package/dist/primitives/attachment/AttachmentThumb.js.map +1 -1
  36. package/dist/primitives/branchPicker/BranchPickerNext.d.ts.map +1 -1
  37. package/dist/primitives/branchPicker/BranchPickerPrevious.d.ts.map +1 -1
  38. package/dist/primitives/branchPicker/BranchPickerRoot.d.ts.map +1 -1
  39. package/dist/primitives/branchPicker/BranchPickerRoot.js.map +1 -1
  40. package/dist/primitives/chainOfThought/ChainOfThoughtAccordionTrigger.d.ts.map +1 -1
  41. package/dist/primitives/chainOfThought/ChainOfThoughtRoot.d.ts.map +1 -1
  42. package/dist/primitives/composer/ComposerAddAttachment.d.ts.map +1 -1
  43. package/dist/primitives/composer/ComposerAttachmentDropzone.d.ts.map +1 -1
  44. package/dist/primitives/composer/ComposerAttachmentDropzone.js.map +1 -1
  45. package/dist/primitives/composer/ComposerCancel.d.ts.map +1 -1
  46. package/dist/primitives/composer/ComposerDictate.d.ts.map +1 -1
  47. package/dist/primitives/composer/ComposerDictationTranscript.d.ts.map +1 -1
  48. package/dist/primitives/composer/ComposerDictationTranscript.js.map +1 -1
  49. package/dist/primitives/composer/ComposerInput.js.map +1 -1
  50. package/dist/primitives/composer/ComposerQuote.d.ts.map +1 -1
  51. package/dist/primitives/composer/ComposerQuote.js.map +1 -1
  52. package/dist/primitives/composer/ComposerRoot.d.ts +5 -0
  53. package/dist/primitives/composer/ComposerRoot.d.ts.map +1 -1
  54. package/dist/primitives/composer/ComposerRoot.js +86 -40
  55. package/dist/primitives/composer/ComposerRoot.js.map +1 -1
  56. package/dist/primitives/composer/ComposerSend.d.ts.map +1 -1
  57. package/dist/primitives/composer/ComposerStopDictation.d.ts.map +1 -1
  58. package/dist/primitives/composer/trigger/TriggerPopover.d.ts.map +1 -1
  59. package/dist/primitives/composer/trigger/TriggerPopover.js.map +1 -1
  60. package/dist/primitives/composer/trigger/TriggerPopoverBack.d.ts.map +1 -1
  61. package/dist/primitives/composer/trigger/TriggerPopoverCategories.d.ts.map +1 -1
  62. package/dist/primitives/composer/trigger/TriggerPopoverCategories.js.map +1 -1
  63. package/dist/primitives/composer/trigger/TriggerPopoverItems.d.ts.map +1 -1
  64. package/dist/primitives/composer/trigger/TriggerPopoverItems.js.map +1 -1
  65. package/dist/primitives/composer/trigger/TriggerPopoverResource.d.ts.map +1 -1
  66. package/dist/primitives/composer/trigger/TriggerPopoverRootContext.js.map +1 -1
  67. package/dist/primitives/composer/trigger/detectTrigger.d.ts +1 -1
  68. package/dist/primitives/composer/trigger/triggerDetectionResource.d.ts.map +1 -1
  69. package/dist/primitives/composer/trigger/triggerKeyboardResource.d.ts.map +1 -1
  70. package/dist/primitives/composer/trigger/triggerNavigationResource.d.ts.map +1 -1
  71. package/dist/primitives/composer/trigger/triggerSelectionResource.d.ts.map +1 -1
  72. package/dist/primitives/dropdownMenuRenderPrimitives.d.ts.map +1 -1
  73. package/dist/primitives/error/ErrorMessage.d.ts.map +1 -1
  74. package/dist/primitives/error/ErrorMessage.js.map +1 -1
  75. package/dist/primitives/error/ErrorRoot.d.ts.map +1 -1
  76. package/dist/primitives/message/MessageParts.js.map +1 -1
  77. package/dist/primitives/message/MessagePartsGrouped.js.map +1 -1
  78. package/dist/primitives/message/MessageRoot.d.ts.map +1 -1
  79. package/dist/primitives/messagePart/MessagePartImage.d.ts.map +1 -1
  80. package/dist/primitives/messagePart/MessagePartText.d.ts.map +1 -1
  81. package/dist/primitives/messagePart/MessagePartText.js.map +1 -1
  82. package/dist/primitives/messagePart/useMessagePartData.d.ts +3 -2
  83. package/dist/primitives/messagePart/useMessagePartData.d.ts.map +1 -1
  84. package/dist/primitives/messagePart/useMessagePartData.js +3 -2
  85. package/dist/primitives/messagePart/useMessagePartData.js.map +1 -1
  86. package/dist/primitives/messagePart/useMessagePartFile.d.ts +5 -4
  87. package/dist/primitives/messagePart/useMessagePartFile.d.ts.map +1 -1
  88. package/dist/primitives/messagePart/useMessagePartFile.js +11 -3
  89. package/dist/primitives/messagePart/useMessagePartFile.js.map +1 -1
  90. package/dist/primitives/messagePart/useMessagePartImage.d.ts +5 -4
  91. package/dist/primitives/messagePart/useMessagePartImage.d.ts.map +1 -1
  92. package/dist/primitives/messagePart/useMessagePartImage.js +10 -3
  93. package/dist/primitives/messagePart/useMessagePartImage.js.map +1 -1
  94. package/dist/primitives/messagePart/useMessagePartReasoning.d.ts +5 -4
  95. package/dist/primitives/messagePart/useMessagePartReasoning.d.ts.map +1 -1
  96. package/dist/primitives/messagePart/useMessagePartReasoning.js +10 -3
  97. package/dist/primitives/messagePart/useMessagePartReasoning.js.map +1 -1
  98. package/dist/primitives/messagePart/useMessagePartSource.d.ts +6 -4
  99. package/dist/primitives/messagePart/useMessagePartSource.d.ts.map +1 -1
  100. package/dist/primitives/messagePart/useMessagePartSource.js +12 -3
  101. package/dist/primitives/messagePart/useMessagePartSource.js.map +1 -1
  102. package/dist/primitives/messagePart/useMessagePartText.d.ts +6 -5
  103. package/dist/primitives/messagePart/useMessagePartText.d.ts.map +1 -1
  104. package/dist/primitives/messagePart/useMessagePartText.js +10 -3
  105. package/dist/primitives/messagePart/useMessagePartText.js.map +1 -1
  106. package/dist/primitives/queueItem/QueueItemRemove.d.ts.map +1 -1
  107. package/dist/primitives/queueItem/QueueItemSteer.d.ts.map +1 -1
  108. package/dist/primitives/queueItem/QueueItemText.d.ts.map +1 -1
  109. package/dist/primitives/queueItem/QueueItemText.js.map +1 -1
  110. package/dist/primitives/selectionToolbar/SelectionToolbarQuote.d.ts.map +1 -1
  111. package/dist/primitives/selectionToolbar/SelectionToolbarRoot.d.ts.map +1 -1
  112. package/dist/primitives/selectionToolbar/SelectionToolbarRoot.js.map +1 -1
  113. package/dist/primitives/suggestion/SuggestionDescription.d.ts.map +1 -1
  114. package/dist/primitives/suggestion/SuggestionDescription.js.map +1 -1
  115. package/dist/primitives/suggestion/SuggestionTitle.d.ts.map +1 -1
  116. package/dist/primitives/suggestion/SuggestionTitle.js.map +1 -1
  117. package/dist/primitives/suggestion/SuggestionTrigger.d.ts.map +1 -1
  118. package/dist/primitives/thread/ThreadRoot.d.ts.map +1 -1
  119. package/dist/primitives/thread/ThreadScrollToBottom.d.ts.map +1 -1
  120. package/dist/primitives/thread/ThreadSuggestion.d.ts.map +1 -1
  121. package/dist/primitives/thread/ThreadViewport.d.ts.map +1 -1
  122. package/dist/primitives/thread/ThreadViewport.js +53 -19
  123. package/dist/primitives/thread/ThreadViewport.js.map +1 -1
  124. package/dist/primitives/thread/ThreadViewportFooter.d.ts.map +1 -1
  125. package/dist/primitives/thread/topAnchor/createReserveObservers.d.ts.map +1 -1
  126. package/dist/primitives/thread/topAnchor/mountTopAnchorReserve.d.ts +4 -0
  127. package/dist/primitives/thread/topAnchor/mountTopAnchorReserve.d.ts.map +1 -1
  128. package/dist/primitives/thread/topAnchor/mountTopAnchorReserve.js +14 -1
  129. package/dist/primitives/thread/topAnchor/mountTopAnchorReserve.js.map +1 -1
  130. package/dist/primitives/thread/topAnchor/topAnchorTurn.d.ts +13 -1
  131. package/dist/primitives/thread/topAnchor/topAnchorTurn.d.ts.map +1 -1
  132. package/dist/primitives/thread/topAnchor/topAnchorTurn.js +14 -1
  133. package/dist/primitives/thread/topAnchor/topAnchorTurn.js.map +1 -1
  134. package/dist/primitives/thread/useThreadViewportAutoScroll.js +2 -1
  135. package/dist/primitives/thread/useThreadViewportAutoScroll.js.map +1 -1
  136. package/dist/primitives/threadList/ThreadListLoadMore.d.ts.map +1 -1
  137. package/dist/primitives/threadList/ThreadListNew.d.ts.map +1 -1
  138. package/dist/primitives/threadList/ThreadListRoot.d.ts.map +1 -1
  139. package/dist/primitives/threadList/ThreadListRoot.js.map +1 -1
  140. package/dist/primitives/threadListFocusGroup.d.ts.map +1 -1
  141. package/dist/primitives/threadListItem/ThreadListItemArchive.d.ts.map +1 -1
  142. package/dist/primitives/threadListItem/ThreadListItemDelete.d.ts.map +1 -1
  143. package/dist/primitives/threadListItem/ThreadListItemRoot.d.ts.map +1 -1
  144. package/dist/primitives/threadListItem/ThreadListItemRoot.js.map +1 -1
  145. package/dist/primitives/threadListItem/ThreadListItemTrigger.d.ts.map +1 -1
  146. package/dist/primitives/threadListItem/ThreadListItemTrigger.js.map +1 -1
  147. package/dist/primitives/threadListItem/ThreadListItemUnarchive.d.ts.map +1 -1
  148. package/dist/primitives/threadListItemMore/ThreadListItemMoreContent.d.ts.map +1 -1
  149. package/dist/primitives/threadListItemMore/ThreadListItemMoreContent.js.map +1 -1
  150. package/dist/primitives/threadListItemMore/ThreadListItemMoreItem.d.ts.map +1 -1
  151. package/dist/primitives/threadListItemMore/ThreadListItemMoreRoot.js.map +1 -1
  152. package/dist/primitives/threadListItemMore/ThreadListItemMoreSeparator.d.ts.map +1 -1
  153. package/dist/primitives/threadListItemMore/ThreadListItemMoreTrigger.d.ts.map +1 -1
  154. package/dist/tests/setup.d.ts +1 -1
  155. package/dist/utils/Primitive.d.ts.map +1 -1
  156. package/dist/utils/Primitive.js.map +1 -1
  157. package/dist/utils/createActionButton.d.ts.map +1 -1
  158. package/package.json +20 -20
  159. package/src/client/ExternalThread.ts +2 -1
  160. package/src/model-context/makeAssistantVisible.test.tsx +146 -0
  161. package/src/model-context/makeAssistantVisible.tsx +18 -1
  162. package/src/primitives/composer/ComposerRoot.test.tsx +226 -5
  163. package/src/primitives/composer/ComposerRoot.tsx +50 -1
  164. package/src/primitives/messagePart/useMessagePartData.ts +3 -2
  165. package/src/primitives/messagePart/useMessagePartFile.ts +19 -7
  166. package/src/primitives/messagePart/useMessagePartImage.ts +18 -7
  167. package/src/primitives/messagePart/useMessagePartReasoning.ts +15 -6
  168. package/src/primitives/messagePart/useMessagePartSource.ts +20 -7
  169. package/src/primitives/messagePart/useMessagePartText.ts +15 -5
  170. package/src/primitives/thread/ThreadViewport.tsx +15 -0
  171. package/src/primitives/thread/topAnchor/mountTopAnchorReserve.test.ts +243 -0
  172. package/src/primitives/thread/topAnchor/mountTopAnchorReserve.ts +28 -7
  173. package/src/primitives/thread/topAnchor/topAnchorTurn.test.ts +69 -0
  174. package/src/primitives/thread/topAnchor/topAnchorTurn.ts +29 -0
  175. package/src/primitives/thread/useThreadViewportAutoScroll.test.tsx +86 -1
  176. package/src/primitives/thread/useThreadViewportAutoScroll.ts +6 -1
  177. package/src/tests/BaseComposerRuntimeCore.test.ts +12 -3
  178. package/src/tests/external-thread-attachments.test.tsx +81 -0
  179. package/src/tests/messagePartSwitchRace.test.tsx +158 -0
  180. package/src/tests/messagePartTypeMismatch.test.tsx +146 -0
@@ -3,8 +3,9 @@ import { useAuiState } from "@assistant-ui/store";
3
3
  //#region src/primitives/messagePart/useMessagePartData.ts
4
4
  /**
5
5
  * @deprecated Use {@link useAuiState} to select and narrow `s.part`.
6
- * Return `null` for optional rendering, or throw inside the selector to
7
- * preserve the old hook's strict behavior.
6
+ * Return `null` for optional rendering. Do not throw inside the selector:
7
+ * selectors run inside `useSyncExternalStore`'s `getSnapshot`, so a transient
8
+ * part mismatch during thread switches can unmount the React root.
8
9
  *
9
10
  * @example
10
11
  * ```tsx
@@ -1 +1 @@
1
- {"version":3,"file":"useMessagePartData.js","names":["DataMessagePart","useAuiState","useMessagePartData","name","part","_temp","s","type","T"],"sources":["../../../src/primitives/messagePart/useMessagePartData.ts"],"sourcesContent":["\"use client\";\n\nimport type { DataMessagePart } from \"@assistant-ui/core\";\nimport { useAuiState } from \"@assistant-ui/store\";\n\n/**\n * @deprecated Use {@link useAuiState} to select and narrow `s.part`.\n * Return `null` for optional rendering, or throw inside the selector to\n * preserve the old hook's strict behavior.\n *\n * @example\n * ```tsx\n * const part = useAuiState((s) =>\n * s.part.type === \"data\" && (!name || s.part.name === name)\n * ? s.part\n * : null,\n * );\n * ```\n *\n * See the {@link https://assistant-ui.com/docs/migrations/v0-12 migration guide}.\n */\nexport const useMessagePartData = <T = any>(name?: string) => {\n const part = useAuiState((s) => {\n if (s.part.type !== \"data\") {\n return null;\n }\n return s.part as DataMessagePart<T>;\n });\n\n if (!part) {\n return null;\n }\n\n if (name && part.name !== name) {\n return null;\n }\n\n return part;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAqBA,MAAaE,sBAAqBC,SAAA;CAChC,MAAAC,OAAaH,YAAYI,KAKxB;CAED,IAAI,CAACD,MAAI,OACA;CAGT,IAAID,QAAQC,KAAID,SAAUA,MAAI,OACrB;CACR,OAEMC;AAAI;AAhBqB,SAAAC,MAAAC,GAAA;CAE9B,IAAIA,EAACF,KAAKG,SAAU,QAAM,OACjB;CACR,OACMD,EAACF;AAA2B"}
1
+ {"version":3,"file":"useMessagePartData.js","names":["DataMessagePart","useAuiState","useMessagePartData","name","part","_temp","s","type","T"],"sources":["../../../src/primitives/messagePart/useMessagePartData.ts"],"sourcesContent":["\"use client\";\n\nimport type { DataMessagePart } from \"@assistant-ui/core\";\nimport { useAuiState } from \"@assistant-ui/store\";\n\n/**\n * @deprecated Use {@link useAuiState} to select and narrow `s.part`.\n * Return `null` for optional rendering. Do not throw inside the selector:\n * selectors run inside `useSyncExternalStore`'s `getSnapshot`, so a transient\n * part mismatch during thread switches can unmount the React root.\n *\n * @example\n * ```tsx\n * const part = useAuiState((s) =>\n * s.part.type === \"data\" && (!name || s.part.name === name)\n * ? s.part\n * : null,\n * );\n * ```\n *\n * See the {@link https://assistant-ui.com/docs/migrations/v0-12 migration guide}.\n */\nexport const useMessagePartData = <T = any>(name?: string) => {\n const part = useAuiState((s) => {\n if (s.part.type !== \"data\") {\n return null;\n }\n return s.part as DataMessagePart<T>;\n });\n\n if (!part) {\n return null;\n }\n\n if (name && part.name !== name) {\n return null;\n }\n\n return part;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAsBA,MAAaE,sBAAqBC,SAAA;CAChC,MAAAC,OAAaH,YAAYI,KAKxB;CAED,IAAI,CAACD,MAAI,OACA;CAGT,IAAID,QAAQC,KAAID,SAAUA,MAAI,OACrB;CACR,OAEMC;AAAI;AAhBqB,SAAAC,MAAAC,GAAA;CAE9B,IAAIA,EAACF,KAAKG,SAAU,QAAM,OACjB;CACR,OACMD,EAACF;AAA2B"}
@@ -1,9 +1,10 @@
1
- import { FileMessagePart } from "@assistant-ui/core";
1
+ import { FileMessagePart, MessagePartStatus } from "@assistant-ui/core";
2
2
  //#region src/primitives/messagePart/useMessagePartFile.d.ts
3
3
  /**
4
4
  * @deprecated Use {@link useAuiState} to select and narrow `s.part`.
5
- * Return `null` for optional rendering, or throw inside the selector to
6
- * preserve the old hook's strict behavior.
5
+ * Return `null` for optional rendering. Do not throw inside the selector:
6
+ * selectors run inside `useSyncExternalStore`'s `getSnapshot`, so a transient
7
+ * part mismatch during thread switches can unmount the React root.
7
8
  *
8
9
  * @example
9
10
  * ```tsx
@@ -16,7 +17,7 @@ import { FileMessagePart } from "@assistant-ui/core";
16
17
  * See the {@link https://assistant-ui.com/docs/migrations/v0-12 migration guide}.
17
18
  */
18
19
  declare const useMessagePartFile: () => FileMessagePart & {
19
- readonly status: import("@assistant-ui/core").MessagePartStatus | import("@assistant-ui/core").ToolCallMessagePartStatus;
20
+ readonly status: MessagePartStatus | import("@assistant-ui/core").ToolCallMessagePartStatus;
20
21
  };
21
22
  //#endregion
22
23
  export { useMessagePartFile };
@@ -1 +1 @@
1
- {"version":3,"file":"useMessagePartFile.d.ts","names":[],"sources":["../../../src/primitives/messagePart/useMessagePartFile.ts"],"mappings":";;;;;;;;;;;;;;;;;cAoBa,0BAAkB"}
1
+ {"version":3,"file":"useMessagePartFile.d.ts","names":[],"sources":["../../../src/primitives/messagePart/useMessagePartFile.ts"],"mappings":";;;;;;;;;;;;;;;;;;cAkCa,0BAAkB;mBAAA"}
@@ -1,10 +1,18 @@
1
1
  "use client";
2
2
  import { useAuiState } from "@assistant-ui/store";
3
3
  //#region src/primitives/messagePart/useMessagePartFile.ts
4
+ const COMPLETE_STATUS = Object.freeze({ type: "complete" });
5
+ const EMPTY_FILE_PART = Object.freeze({
6
+ type: "file",
7
+ data: "",
8
+ mimeType: "",
9
+ status: COMPLETE_STATUS
10
+ });
4
11
  /**
5
12
  * @deprecated Use {@link useAuiState} to select and narrow `s.part`.
6
- * Return `null` for optional rendering, or throw inside the selector to
7
- * preserve the old hook's strict behavior.
13
+ * Return `null` for optional rendering. Do not throw inside the selector:
14
+ * selectors run inside `useSyncExternalStore`'s `getSnapshot`, so a transient
15
+ * part mismatch during thread switches can unmount the React root.
8
16
  *
9
17
  * @example
10
18
  * ```tsx
@@ -20,7 +28,7 @@ const useMessagePartFile = () => {
20
28
  return useAuiState(_temp);
21
29
  };
22
30
  function _temp(s) {
23
- if (s.part.type !== "file") throw new Error("MessagePartFile can only be used inside file message parts.");
31
+ if (s.part.type !== "file") return EMPTY_FILE_PART;
24
32
  return s.part;
25
33
  }
26
34
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"useMessagePartFile.js","names":["FileMessagePart","MessagePartState","useAuiState","useMessagePartFile","file","_temp","s","part","type","Error"],"sources":["../../../src/primitives/messagePart/useMessagePartFile.ts"],"sourcesContent":["\"use client\";\n\nimport type { FileMessagePart, MessagePartState } from \"@assistant-ui/core\";\nimport { useAuiState } from \"@assistant-ui/store\";\n\n/**\n * @deprecated Use {@link useAuiState} to select and narrow `s.part`.\n * Return `null` for optional rendering, or throw inside the selector to\n * preserve the old hook's strict behavior.\n *\n * @example\n * ```tsx\n * const file = useAuiState((s) => {\n * if (s.part.type !== \"file\") return null;\n * return s.part;\n * });\n * ```\n *\n * See the {@link https://assistant-ui.com/docs/migrations/v0-12 migration guide}.\n */\nexport const useMessagePartFile = () => {\n const file = useAuiState((s) => {\n if (s.part.type !== \"file\")\n throw new Error(\n \"MessagePartFile can only be used inside file message parts.\",\n );\n\n return s.part as MessagePartState & FileMessagePart;\n });\n\n return file;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAoBA,MAAaG,2BAAqB;CAQ7B,OAPUD,YAAYG,KASlBD;AAAI;AAVqB,SAAAC,MAAAC,GAAA;CAE9B,IAAIA,EAACC,KAAKC,SAAU,QAClB,MAAM,IAAIC,MACR,6DACF;CAAE,OAEGH,EAACC;AAA2C"}
1
+ {"version":3,"file":"useMessagePartFile.js","names":["FileMessagePart","MessagePartState","MessagePartStatus","useAuiState","COMPLETE_STATUS","Object","freeze","type","EMPTY_FILE_PART","data","mimeType","status","useMessagePartFile","file","_temp","s","part"],"sources":["../../../src/primitives/messagePart/useMessagePartFile.ts"],"sourcesContent":["\"use client\";\n\nimport type {\n FileMessagePart,\n MessagePartState,\n MessagePartStatus,\n} from \"@assistant-ui/core\";\nimport { useAuiState } from \"@assistant-ui/store\";\n\nconst COMPLETE_STATUS: MessagePartStatus = Object.freeze({ type: \"complete\" });\n\nconst EMPTY_FILE_PART: MessagePartState & FileMessagePart = Object.freeze({\n type: \"file\",\n data: \"\",\n mimeType: \"\",\n status: COMPLETE_STATUS,\n});\n\n/**\n * @deprecated Use {@link useAuiState} to select and narrow `s.part`.\n * Return `null` for optional rendering. Do not throw inside the selector:\n * selectors run inside `useSyncExternalStore`'s `getSnapshot`, so a transient\n * part mismatch during thread switches can unmount the React root.\n *\n * @example\n * ```tsx\n * const file = useAuiState((s) => {\n * if (s.part.type !== \"file\") return null;\n * return s.part;\n * });\n * ```\n *\n * See the {@link https://assistant-ui.com/docs/migrations/v0-12 migration guide}.\n */\nexport const useMessagePartFile = () => {\n // Sentinel instead of throw: see useMessagePartText for the invariant.\n const file = useAuiState((s) => {\n if (s.part.type !== \"file\") return EMPTY_FILE_PART;\n\n return s.part as MessagePartState & FileMessagePart;\n });\n\n return file;\n};\n"],"mappings":";;;AASA,MAAMI,kBAAqCC,OAAOC,OAAO,EAAEC,MAAM,WAAW,CAAC;AAE7E,MAAMC,kBAAsDH,OAAOC,OAAO;CACxEC,MAAM;CACNE,MAAM;CACNC,UAAU;CACVC,QAAQP;AACV,CAAC;;;;;;;;;;;;;;;;;AAkBD,MAAaQ,2BAAqB;CAM7B,OAJUT,YAAYW,KAMlBD;AAAI;AARqB,SAAAC,MAAAC,GAAA;CAG9B,IAAIA,EAACC,KAAKT,SAAU,QAAM,OAASC;CAAgB,OAE5CO,EAACC;AAA2C"}
@@ -1,9 +1,10 @@
1
- import { ImageMessagePart } from "@assistant-ui/core";
1
+ import { ImageMessagePart, MessagePartStatus } from "@assistant-ui/core";
2
2
  //#region src/primitives/messagePart/useMessagePartImage.d.ts
3
3
  /**
4
4
  * @deprecated Use {@link useAuiState} to select and narrow `s.part`.
5
- * Return `null` for optional rendering, or throw inside the selector to
6
- * preserve the old hook's strict behavior.
5
+ * Return `null` for optional rendering. Do not throw inside the selector:
6
+ * selectors run inside `useSyncExternalStore`'s `getSnapshot`, so a transient
7
+ * part mismatch during thread switches can unmount the React root.
7
8
  *
8
9
  * @example
9
10
  * ```tsx
@@ -16,7 +17,7 @@ import { ImageMessagePart } from "@assistant-ui/core";
16
17
  * See the {@link https://assistant-ui.com/docs/migrations/v0-12 migration guide}.
17
18
  */
18
19
  declare const useMessagePartImage: () => ImageMessagePart & {
19
- readonly status: import("@assistant-ui/core").MessagePartStatus | import("@assistant-ui/core").ToolCallMessagePartStatus;
20
+ readonly status: MessagePartStatus | import("@assistant-ui/core").ToolCallMessagePartStatus;
20
21
  };
21
22
  //#endregion
22
23
  export { useMessagePartImage };
@@ -1 +1 @@
1
- {"version":3,"file":"useMessagePartImage.d.ts","names":[],"sources":["../../../src/primitives/messagePart/useMessagePartImage.ts"],"mappings":";;;;;;;;;;;;;;;;;cAoBa,2BAAmB"}
1
+ {"version":3,"file":"useMessagePartImage.d.ts","names":[],"sources":["../../../src/primitives/messagePart/useMessagePartImage.ts"],"mappings":";;;;;;;;;;;;;;;;;;cAiCa,2BAAmB;mBAAA"}
@@ -1,10 +1,17 @@
1
1
  "use client";
2
2
  import { useAuiState } from "@assistant-ui/store";
3
3
  //#region src/primitives/messagePart/useMessagePartImage.ts
4
+ const COMPLETE_STATUS = Object.freeze({ type: "complete" });
5
+ const EMPTY_IMAGE_PART = Object.freeze({
6
+ type: "image",
7
+ image: "",
8
+ status: COMPLETE_STATUS
9
+ });
4
10
  /**
5
11
  * @deprecated Use {@link useAuiState} to select and narrow `s.part`.
6
- * Return `null` for optional rendering, or throw inside the selector to
7
- * preserve the old hook's strict behavior.
12
+ * Return `null` for optional rendering. Do not throw inside the selector:
13
+ * selectors run inside `useSyncExternalStore`'s `getSnapshot`, so a transient
14
+ * part mismatch during thread switches can unmount the React root.
8
15
  *
9
16
  * @example
10
17
  * ```tsx
@@ -20,7 +27,7 @@ const useMessagePartImage = () => {
20
27
  return useAuiState(_temp);
21
28
  };
22
29
  function _temp(s) {
23
- if (s.part.type !== "image") throw new Error("MessagePartImage can only be used inside image message parts.");
30
+ if (s.part.type !== "image") return EMPTY_IMAGE_PART;
24
31
  return s.part;
25
32
  }
26
33
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"useMessagePartImage.js","names":["ImageMessagePart","MessagePartState","useAuiState","useMessagePartImage","image","_temp","s","part","type","Error"],"sources":["../../../src/primitives/messagePart/useMessagePartImage.ts"],"sourcesContent":["\"use client\";\n\nimport type { ImageMessagePart, MessagePartState } from \"@assistant-ui/core\";\nimport { useAuiState } from \"@assistant-ui/store\";\n\n/**\n * @deprecated Use {@link useAuiState} to select and narrow `s.part`.\n * Return `null` for optional rendering, or throw inside the selector to\n * preserve the old hook's strict behavior.\n *\n * @example\n * ```tsx\n * const image = useAuiState((s) => {\n * if (s.part.type !== \"image\") return null;\n * return s.part;\n * });\n * ```\n *\n * See the {@link https://assistant-ui.com/docs/migrations/v0-12 migration guide}.\n */\nexport const useMessagePartImage = () => {\n const image = useAuiState((s) => {\n if (s.part.type !== \"image\")\n throw new Error(\n \"MessagePartImage can only be used inside image message parts.\",\n );\n\n return s.part as MessagePartState & ImageMessagePart;\n });\n\n return image;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAoBA,MAAaG,4BAAsB;CAQ9B,OAPWD,YAAYG,KASnBD;AAAK;AAVqB,SAAAC,MAAAC,GAAA;CAE/B,IAAIA,EAACC,KAAKC,SAAU,SAClB,MAAM,IAAIC,MACR,+DACF;CAAE,OAEGH,EAACC;AAA4C"}
1
+ {"version":3,"file":"useMessagePartImage.js","names":["ImageMessagePart","MessagePartState","MessagePartStatus","useAuiState","COMPLETE_STATUS","Object","freeze","type","EMPTY_IMAGE_PART","image","status","useMessagePartImage","_temp","s","part"],"sources":["../../../src/primitives/messagePart/useMessagePartImage.ts"],"sourcesContent":["\"use client\";\n\nimport type {\n ImageMessagePart,\n MessagePartState,\n MessagePartStatus,\n} from \"@assistant-ui/core\";\nimport { useAuiState } from \"@assistant-ui/store\";\n\nconst COMPLETE_STATUS: MessagePartStatus = Object.freeze({ type: \"complete\" });\n\nconst EMPTY_IMAGE_PART: MessagePartState & ImageMessagePart = Object.freeze({\n type: \"image\",\n image: \"\",\n status: COMPLETE_STATUS,\n});\n\n/**\n * @deprecated Use {@link useAuiState} to select and narrow `s.part`.\n * Return `null` for optional rendering. Do not throw inside the selector:\n * selectors run inside `useSyncExternalStore`'s `getSnapshot`, so a transient\n * part mismatch during thread switches can unmount the React root.\n *\n * @example\n * ```tsx\n * const image = useAuiState((s) => {\n * if (s.part.type !== \"image\") return null;\n * return s.part;\n * });\n * ```\n *\n * See the {@link https://assistant-ui.com/docs/migrations/v0-12 migration guide}.\n */\nexport const useMessagePartImage = () => {\n // Sentinel instead of throw: see useMessagePartText for the invariant.\n const image = useAuiState((s) => {\n if (s.part.type !== \"image\") return EMPTY_IMAGE_PART;\n\n return s.part as MessagePartState & ImageMessagePart;\n });\n\n return image;\n};\n"],"mappings":";;;AASA,MAAMI,kBAAqCC,OAAOC,OAAO,EAAEC,MAAM,WAAW,CAAC;AAE7E,MAAMC,mBAAwDH,OAAOC,OAAO;CAC1EC,MAAM;CACNE,OAAO;CACPC,QAAQN;AACV,CAAC;;;;;;;;;;;;;;;;;AAkBD,MAAaO,4BAAsB;CAM9B,OAJWR,YAAYS,KAMnBH;AAAK;AARqB,SAAAG,MAAAC,GAAA;CAG/B,IAAIA,EAACC,KAAKP,SAAU,SAAO,OAASC;CAAiB,OAE9CK,EAACC;AAA4C"}
@@ -1,9 +1,10 @@
1
- import { ReasoningMessagePart } from "@assistant-ui/core";
1
+ import { MessagePartStatus, ReasoningMessagePart } from "@assistant-ui/core";
2
2
  //#region src/primitives/messagePart/useMessagePartReasoning.d.ts
3
3
  /**
4
4
  * @deprecated Use {@link useAuiState} to select and narrow `s.part`.
5
- * Return `null` for optional rendering, or throw inside the selector to
6
- * preserve the old hook's strict behavior.
5
+ * Return `null` for optional rendering. Do not throw inside the selector:
6
+ * selectors run inside `useSyncExternalStore`'s `getSnapshot`, so a transient
7
+ * part mismatch during thread switches can unmount the React root.
7
8
  *
8
9
  * @example
9
10
  * ```tsx
@@ -16,7 +17,7 @@ import { ReasoningMessagePart } from "@assistant-ui/core";
16
17
  * See the {@link https://assistant-ui.com/docs/migrations/v0-12 migration guide}.
17
18
  */
18
19
  declare const useMessagePartReasoning: () => ReasoningMessagePart & {
19
- readonly status: import("@assistant-ui/core").MessagePartStatus | import("@assistant-ui/core").ToolCallMessagePartStatus;
20
+ readonly status: MessagePartStatus | import("@assistant-ui/core").ToolCallMessagePartStatus;
20
21
  };
21
22
  //#endregion
22
23
  export { useMessagePartReasoning };
@@ -1 +1 @@
1
- {"version":3,"file":"useMessagePartReasoning.d.ts","names":[],"sources":["../../../src/primitives/messagePart/useMessagePartReasoning.ts"],"mappings":";;;;;;;;;;;;;;;;;cAuBa,+BAAuB"}
1
+ {"version":3,"file":"useMessagePartReasoning.d.ts","names":[],"sources":["../../../src/primitives/messagePart/useMessagePartReasoning.ts"],"mappings":";;;;;;;;;;;;;;;;;;cAkCa,+BAAuB;mBAAA"}
@@ -1,10 +1,17 @@
1
1
  "use client";
2
2
  import { useAuiState } from "@assistant-ui/store";
3
3
  //#region src/primitives/messagePart/useMessagePartReasoning.ts
4
+ const COMPLETE_STATUS = Object.freeze({ type: "complete" });
5
+ const EMPTY_REASONING_PART = Object.freeze({
6
+ type: "reasoning",
7
+ text: "",
8
+ status: COMPLETE_STATUS
9
+ });
4
10
  /**
5
11
  * @deprecated Use {@link useAuiState} to select and narrow `s.part`.
6
- * Return `null` for optional rendering, or throw inside the selector to
7
- * preserve the old hook's strict behavior.
12
+ * Return `null` for optional rendering. Do not throw inside the selector:
13
+ * selectors run inside `useSyncExternalStore`'s `getSnapshot`, so a transient
14
+ * part mismatch during thread switches can unmount the React root.
8
15
  *
9
16
  * @example
10
17
  * ```tsx
@@ -20,7 +27,7 @@ const useMessagePartReasoning = () => {
20
27
  return useAuiState(_temp);
21
28
  };
22
29
  function _temp(s) {
23
- if (s.part.type !== "reasoning") throw new Error("MessagePartReasoning can only be used inside reasoning message parts.");
30
+ if (s.part.type !== "reasoning") return EMPTY_REASONING_PART;
24
31
  return s.part;
25
32
  }
26
33
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"useMessagePartReasoning.js","names":["ReasoningMessagePart","MessagePartState","useAuiState","useMessagePartReasoning","text","_temp","s","part","type","Error"],"sources":["../../../src/primitives/messagePart/useMessagePartReasoning.ts"],"sourcesContent":["\"use client\";\n\nimport type {\n ReasoningMessagePart,\n MessagePartState,\n} from \"@assistant-ui/core\";\nimport { useAuiState } from \"@assistant-ui/store\";\n\n/**\n * @deprecated Use {@link useAuiState} to select and narrow `s.part`.\n * Return `null` for optional rendering, or throw inside the selector to\n * preserve the old hook's strict behavior.\n *\n * @example\n * ```tsx\n * const reasoning = useAuiState((s) => {\n * if (s.part.type !== \"reasoning\") return null;\n * return s.part;\n * });\n * ```\n *\n * See the {@link https://assistant-ui.com/docs/migrations/v0-12 migration guide}.\n */\nexport const useMessagePartReasoning = () => {\n const text = useAuiState((s) => {\n if (s.part.type !== \"reasoning\")\n throw new Error(\n \"MessagePartReasoning can only be used inside reasoning message parts.\",\n );\n\n return s.part as MessagePartState & ReasoningMessagePart;\n });\n\n return text;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAuBA,MAAaG,gCAA0B;CAQlC,OAPUD,YAAYG,KASlBD;AAAI;AAV0B,SAAAC,MAAAC,GAAA;CAEnC,IAAIA,EAACC,KAAKC,SAAU,aAClB,MAAM,IAAIC,MACR,uEACF;CAAE,OAEGH,EAACC;AAAgD"}
1
+ {"version":3,"file":"useMessagePartReasoning.js","names":["ReasoningMessagePart","MessagePartState","MessagePartStatus","useAuiState","COMPLETE_STATUS","Object","freeze","type","EMPTY_REASONING_PART","text","status","useMessagePartReasoning","_temp","s","part"],"sources":["../../../src/primitives/messagePart/useMessagePartReasoning.ts"],"sourcesContent":["\"use client\";\n\nimport type {\n ReasoningMessagePart,\n MessagePartState,\n MessagePartStatus,\n} from \"@assistant-ui/core\";\nimport { useAuiState } from \"@assistant-ui/store\";\n\nconst COMPLETE_STATUS: MessagePartStatus = Object.freeze({ type: \"complete\" });\n\nconst EMPTY_REASONING_PART: MessagePartState & ReasoningMessagePart =\n Object.freeze({\n type: \"reasoning\",\n text: \"\",\n status: COMPLETE_STATUS,\n });\n\n/**\n * @deprecated Use {@link useAuiState} to select and narrow `s.part`.\n * Return `null` for optional rendering. Do not throw inside the selector:\n * selectors run inside `useSyncExternalStore`'s `getSnapshot`, so a transient\n * part mismatch during thread switches can unmount the React root.\n *\n * @example\n * ```tsx\n * const reasoning = useAuiState((s) => {\n * if (s.part.type !== \"reasoning\") return null;\n * return s.part;\n * });\n * ```\n *\n * See the {@link https://assistant-ui.com/docs/migrations/v0-12 migration guide}.\n */\nexport const useMessagePartReasoning = () => {\n // Sentinel instead of throw: see useMessagePartText for the invariant.\n const text = useAuiState((s) => {\n if (s.part.type !== \"reasoning\") return EMPTY_REASONING_PART;\n\n return s.part as MessagePartState & ReasoningMessagePart;\n });\n\n return text;\n};\n"],"mappings":";;;AASA,MAAMI,kBAAqCC,OAAOC,OAAO,EAAEC,MAAM,WAAW,CAAC;AAE7E,MAAMC,uBACJH,OAAOC,OAAO;CACZC,MAAM;CACNE,MAAM;CACNC,QAAQN;AACV,CAAC;;;;;;;;;;;;;;;;;AAkBH,MAAaO,gCAA0B;CAMlC,OAJUR,YAAYS,KAMlBH;AAAI;AAR0B,SAAAG,MAAAC,GAAA;CAGnC,IAAIA,EAACC,KAAKP,SAAU,aAAW,OAASC;CAAqB,OAEtDK,EAACC;AAAgD"}
@@ -1,8 +1,10 @@
1
+ import { MessagePartStatus } from "@assistant-ui/core";
1
2
  //#region src/primitives/messagePart/useMessagePartSource.d.ts
2
3
  /**
3
4
  * @deprecated Use {@link useAuiState} to select and narrow `s.part`.
4
- * Return `null` for optional rendering, or throw inside the selector to
5
- * preserve the old hook's strict behavior.
5
+ * Return `null` for optional rendering. Do not throw inside the selector:
6
+ * selectors run inside `useSyncExternalStore`'s `getSnapshot`, so a transient
7
+ * part mismatch during thread switches can unmount the React root.
6
8
  *
7
9
  * @example
8
10
  * ```tsx
@@ -23,7 +25,7 @@ declare const useMessagePartSource: () => ({
23
25
  readonly providerMetadata?: import("@assistant-ui/core").SourceProviderMetadata;
24
26
  readonly parentId?: string;
25
27
  } & {
26
- readonly status: import("@assistant-ui/core").MessagePartStatus | import("@assistant-ui/core").ToolCallMessagePartStatus;
28
+ readonly status: MessagePartStatus | import("@assistant-ui/core").ToolCallMessagePartStatus;
27
29
  }) | ({
28
30
  readonly type: "source";
29
31
  readonly sourceType: "document";
@@ -35,7 +37,7 @@ declare const useMessagePartSource: () => ({
35
37
  readonly providerMetadata?: import("@assistant-ui/core").SourceProviderMetadata;
36
38
  readonly parentId?: string;
37
39
  } & {
38
- readonly status: import("@assistant-ui/core").MessagePartStatus | import("@assistant-ui/core").ToolCallMessagePartStatus;
40
+ readonly status: MessagePartStatus | import("@assistant-ui/core").ToolCallMessagePartStatus;
39
41
  });
40
42
  //#endregion
41
43
  export { useMessagePartSource };
@@ -1 +1 @@
1
- {"version":3,"file":"useMessagePartSource.d.ts","names":[],"sources":["../../../src/primitives/messagePart/useMessagePartSource.ts"],"mappings":";;;;;;;;;;;;;;;;cAoBa"}
1
+ {"version":3,"file":"useMessagePartSource.d.ts","names":[],"sources":["../../../src/primitives/messagePart/useMessagePartSource.ts"],"mappings":";;;;;;;;;;;;;;;;;;cAmCa;;;;;;;;;mBAAA;;;;;;;;;;;;mBAAA"}
@@ -1,10 +1,19 @@
1
1
  "use client";
2
2
  import { useAuiState } from "@assistant-ui/store";
3
3
  //#region src/primitives/messagePart/useMessagePartSource.ts
4
+ const COMPLETE_STATUS = Object.freeze({ type: "complete" });
5
+ const EMPTY_SOURCE_PART = Object.freeze({
6
+ type: "source",
7
+ sourceType: "url",
8
+ id: "",
9
+ url: "",
10
+ status: COMPLETE_STATUS
11
+ });
4
12
  /**
5
13
  * @deprecated Use {@link useAuiState} to select and narrow `s.part`.
6
- * Return `null` for optional rendering, or throw inside the selector to
7
- * preserve the old hook's strict behavior.
14
+ * Return `null` for optional rendering. Do not throw inside the selector:
15
+ * selectors run inside `useSyncExternalStore`'s `getSnapshot`, so a transient
16
+ * part mismatch during thread switches can unmount the React root.
8
17
  *
9
18
  * @example
10
19
  * ```tsx
@@ -20,7 +29,7 @@ const useMessagePartSource = () => {
20
29
  return useAuiState(_temp);
21
30
  };
22
31
  function _temp(s) {
23
- if (s.part.type !== "source") throw new Error("MessagePartSource can only be used inside source message parts.");
32
+ if (s.part.type !== "source") return EMPTY_SOURCE_PART;
24
33
  return s.part;
25
34
  }
26
35
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"useMessagePartSource.js","names":["SourceMessagePart","MessagePartState","useAuiState","useMessagePartSource","source","_temp","s","part","type","Error"],"sources":["../../../src/primitives/messagePart/useMessagePartSource.ts"],"sourcesContent":["\"use client\";\n\nimport type { SourceMessagePart, MessagePartState } from \"@assistant-ui/core\";\nimport { useAuiState } from \"@assistant-ui/store\";\n\n/**\n * @deprecated Use {@link useAuiState} to select and narrow `s.part`.\n * Return `null` for optional rendering, or throw inside the selector to\n * preserve the old hook's strict behavior.\n *\n * @example\n * ```tsx\n * const source = useAuiState((s) => {\n * if (s.part.type !== \"source\") return null;\n * return s.part;\n * });\n * ```\n *\n * See the {@link https://assistant-ui.com/docs/migrations/v0-12 migration guide}.\n */\nexport const useMessagePartSource = () => {\n const source = useAuiState((s) => {\n if (s.part.type !== \"source\")\n throw new Error(\n \"MessagePartSource can only be used inside source message parts.\",\n );\n\n return s.part as MessagePartState & SourceMessagePart;\n });\n\n return source;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAoBA,MAAaG,6BAAuB;CAQ/B,OAPYD,YAAYG,KASpBD;AAAM;AAVqB,SAAAC,MAAAC,GAAA;CAEhC,IAAIA,EAACC,KAAKC,SAAU,UAClB,MAAM,IAAIC,MACR,iEACF;CAAE,OAEGH,EAACC;AAA6C"}
1
+ {"version":3,"file":"useMessagePartSource.js","names":["SourceMessagePart","MessagePartState","MessagePartStatus","useAuiState","COMPLETE_STATUS","Object","freeze","type","EMPTY_SOURCE_PART","sourceType","id","url","status","useMessagePartSource","source","_temp","s","part"],"sources":["../../../src/primitives/messagePart/useMessagePartSource.ts"],"sourcesContent":["\"use client\";\n\nimport type {\n SourceMessagePart,\n MessagePartState,\n MessagePartStatus,\n} from \"@assistant-ui/core\";\nimport { useAuiState } from \"@assistant-ui/store\";\n\nconst COMPLETE_STATUS: MessagePartStatus = Object.freeze({ type: \"complete\" });\n\nconst EMPTY_SOURCE_PART: MessagePartState & SourceMessagePart = Object.freeze({\n type: \"source\",\n sourceType: \"url\",\n id: \"\",\n url: \"\",\n status: COMPLETE_STATUS,\n});\n\n/**\n * @deprecated Use {@link useAuiState} to select and narrow `s.part`.\n * Return `null` for optional rendering. Do not throw inside the selector:\n * selectors run inside `useSyncExternalStore`'s `getSnapshot`, so a transient\n * part mismatch during thread switches can unmount the React root.\n *\n * @example\n * ```tsx\n * const source = useAuiState((s) => {\n * if (s.part.type !== \"source\") return null;\n * return s.part;\n * });\n * ```\n *\n * See the {@link https://assistant-ui.com/docs/migrations/v0-12 migration guide}.\n */\nexport const useMessagePartSource = () => {\n // Sentinel instead of throw: see useMessagePartText for the invariant.\n const source = useAuiState((s) => {\n if (s.part.type !== \"source\") return EMPTY_SOURCE_PART;\n\n return s.part as MessagePartState & SourceMessagePart;\n });\n\n return source;\n};\n"],"mappings":";;;AASA,MAAMI,kBAAqCC,OAAOC,OAAO,EAAEC,MAAM,WAAW,CAAC;AAE7E,MAAMC,oBAA0DH,OAAOC,OAAO;CAC5EC,MAAM;CACNE,YAAY;CACZC,IAAI;CACJC,KAAK;CACLC,QAAQR;AACV,CAAC;;;;;;;;;;;;;;;;;AAkBD,MAAaS,6BAAuB;CAM/B,OAJYV,YAAYY,KAMpBD;AAAM;AARqB,SAAAC,MAAAC,GAAA;CAGhC,IAAIA,EAACC,KAAKV,SAAU,UAAQ,OAASC;CAAkB,OAEhDQ,EAACC;AAA6C"}
@@ -1,9 +1,10 @@
1
- import { ReasoningMessagePart, TextMessagePart } from "@assistant-ui/core";
1
+ import { MessagePartStatus, ReasoningMessagePart, TextMessagePart } from "@assistant-ui/core";
2
2
  //#region src/primitives/messagePart/useMessagePartText.d.ts
3
3
  /**
4
4
  * @deprecated Use {@link useAuiState} to select and narrow `s.part`.
5
- * Return `null` for optional rendering, or throw inside the selector to
6
- * preserve the old hook's strict behavior.
5
+ * Return `null` for optional rendering. Do not throw inside the selector:
6
+ * selectors run inside `useSyncExternalStore`'s `getSnapshot`, so a transient
7
+ * part mismatch during thread switches can unmount the React root.
7
8
  *
8
9
  * @example
9
10
  * ```tsx
@@ -16,9 +17,9 @@ import { ReasoningMessagePart, TextMessagePart } from "@assistant-ui/core";
16
17
  * See the {@link https://assistant-ui.com/docs/migrations/v0-12 migration guide}.
17
18
  */
18
19
  declare const useMessagePartText: () => (TextMessagePart & {
19
- readonly status: import("@assistant-ui/core").MessagePartStatus | import("@assistant-ui/core").ToolCallMessagePartStatus;
20
+ readonly status: MessagePartStatus | import("@assistant-ui/core").ToolCallMessagePartStatus;
20
21
  }) | (ReasoningMessagePart & {
21
- readonly status: import("@assistant-ui/core").MessagePartStatus | import("@assistant-ui/core").ToolCallMessagePartStatus;
22
+ readonly status: MessagePartStatus | import("@assistant-ui/core").ToolCallMessagePartStatus;
22
23
  });
23
24
  //#endregion
24
25
  export { useMessagePartText };
@@ -1 +1 @@
1
- {"version":3,"file":"useMessagePartText.d.ts","names":[],"sources":["../../../src/primitives/messagePart/useMessagePartText.ts"],"mappings":";;;;;;;;;;;;;;;;;cAwBa,2BAAkB;;MAAA"}
1
+ {"version":3,"file":"useMessagePartText.d.ts","names":[],"sources":["../../../src/primitives/messagePart/useMessagePartText.ts"],"mappings":";;;;;;;;;;;;;;;;;;cAkCa,2BAAkB"}
@@ -1,10 +1,17 @@
1
1
  "use client";
2
2
  import { useAuiState } from "@assistant-ui/store";
3
3
  //#region src/primitives/messagePart/useMessagePartText.ts
4
+ const COMPLETE_STATUS = Object.freeze({ type: "complete" });
5
+ const EMPTY_TEXT_PART = Object.freeze({
6
+ type: "text",
7
+ text: "",
8
+ status: COMPLETE_STATUS
9
+ });
4
10
  /**
5
11
  * @deprecated Use {@link useAuiState} to select and narrow `s.part`.
6
- * Return `null` for optional rendering, or throw inside the selector to
7
- * preserve the old hook's strict behavior.
12
+ * Return `null` for optional rendering. Do not throw inside the selector:
13
+ * selectors run inside `useSyncExternalStore`'s `getSnapshot`, so a transient
14
+ * part mismatch during thread switches can unmount the React root.
8
15
  *
9
16
  * @example
10
17
  * ```tsx
@@ -20,7 +27,7 @@ const useMessagePartText = () => {
20
27
  return useAuiState(_temp);
21
28
  };
22
29
  function _temp(s) {
23
- if (s.part.type !== "text" && s.part.type !== "reasoning") throw new Error("MessagePartText can only be used inside text or reasoning message parts.");
30
+ if (s.part.type !== "text" && s.part.type !== "reasoning") return EMPTY_TEXT_PART;
24
31
  return s.part;
25
32
  }
26
33
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"useMessagePartText.js","names":["TextMessagePart","ReasoningMessagePart","MessagePartState","useAuiState","useMessagePartText","text","_temp","s","part","type","Error"],"sources":["../../../src/primitives/messagePart/useMessagePartText.ts"],"sourcesContent":["\"use client\";\n\nimport type {\n TextMessagePart,\n ReasoningMessagePart,\n MessagePartState,\n} from \"@assistant-ui/core\";\nimport { useAuiState } from \"@assistant-ui/store\";\n\n/**\n * @deprecated Use {@link useAuiState} to select and narrow `s.part`.\n * Return `null` for optional rendering, or throw inside the selector to\n * preserve the old hook's strict behavior.\n *\n * @example\n * ```tsx\n * const text = useAuiState((s) => {\n * if (s.part.type !== \"text\" && s.part.type !== \"reasoning\") return null;\n * return s.part;\n * });\n * ```\n *\n * See the {@link https://assistant-ui.com/docs/migrations/v0-12 migration guide}.\n */\nexport const useMessagePartText = () => {\n const text = useAuiState((s) => {\n if (s.part.type !== \"text\" && s.part.type !== \"reasoning\")\n throw new Error(\n \"MessagePartText can only be used inside text or reasoning message parts.\",\n );\n\n return s.part as MessagePartState &\n (TextMessagePart | ReasoningMessagePart);\n });\n\n return text;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAwBA,MAAaI,2BAAqB;CAS7B,OARUD,YAAYG,KAUlBD;AAAI;AAXqB,SAAAC,MAAAC,GAAA;CAE9B,IAAIA,EAACC,KAAKC,SAAU,UAAUF,EAACC,KAAKC,SAAU,aAC5C,MAAM,IAAIC,MACR,0EACF;CAAE,OAEGH,EAACC;AACkC"}
1
+ {"version":3,"file":"useMessagePartText.js","names":["TextMessagePart","ReasoningMessagePart","MessagePartState","MessagePartStatus","useAuiState","COMPLETE_STATUS","Object","freeze","type","EMPTY_TEXT_PART","text","status","useMessagePartText","_temp","s","part"],"sources":["../../../src/primitives/messagePart/useMessagePartText.ts"],"sourcesContent":["\"use client\";\n\nimport type {\n TextMessagePart,\n ReasoningMessagePart,\n MessagePartState,\n MessagePartStatus,\n} from \"@assistant-ui/core\";\nimport { useAuiState } from \"@assistant-ui/store\";\n\nconst COMPLETE_STATUS: MessagePartStatus = Object.freeze({ type: \"complete\" });\n\nconst EMPTY_TEXT_PART: MessagePartState & TextMessagePart = Object.freeze({\n type: \"text\",\n text: \"\",\n status: COMPLETE_STATUS,\n});\n\n/**\n * @deprecated Use {@link useAuiState} to select and narrow `s.part`.\n * Return `null` for optional rendering. Do not throw inside the selector:\n * selectors run inside `useSyncExternalStore`'s `getSnapshot`, so a transient\n * part mismatch during thread switches can unmount the React root.\n *\n * @example\n * ```tsx\n * const text = useAuiState((s) => {\n * if (s.part.type !== \"text\" && s.part.type !== \"reasoning\") return null;\n * return s.part;\n * });\n * ```\n *\n * See the {@link https://assistant-ui.com/docs/migrations/v0-12 migration guide}.\n */\nexport const useMessagePartText = () => {\n // Runs inside useSyncExternalStore's getSnapshot, where a throw tears down\n // the React root; the module-level frozen sentinel keeps snapshots stable.\n const text = useAuiState((s) => {\n if (s.part.type !== \"text\" && s.part.type !== \"reasoning\")\n return EMPTY_TEXT_PART;\n\n return s.part as MessagePartState &\n (TextMessagePart | ReasoningMessagePart);\n });\n\n return text;\n};\n"],"mappings":";;;AAUA,MAAMK,kBAAqCC,OAAOC,OAAO,EAAEC,MAAM,WAAW,CAAC;AAE7E,MAAMC,kBAAsDH,OAAOC,OAAO;CACxEC,MAAM;CACNE,MAAM;CACNC,QAAQN;AACV,CAAC;;;;;;;;;;;;;;;;;AAkBD,MAAaO,2BAAqB;CAS7B,OANUR,YAAYS,KAQlBH;AAAI;AAXqB,SAAAG,MAAAC,GAAA;CAI9B,IAAIA,EAACC,KAAKP,SAAU,UAAUM,EAACC,KAAKP,SAAU,aAAW,OAChDC;CAAgB,OAElBK,EAACC;AACkC"}
@@ -1 +1 @@
1
- {"version":3,"file":"QueueItemRemove.d.ts","names":[],"sources":["../../../src/primitives/queueItem/QueueItemRemove.ts"],"mappings":";;cAUM;kBAUW;OACH,UAAU;OACV,QAAQ,yBAAyB;;;;;;;;;;cAWlC,0CAAwB,0BAAA,KAAA,qBAAA,gBAAA,qCAAA,qBAAA"}
1
+ {"version":3,"file":"QueueItemRemove.d.ts","names":[],"sources":["../../../src/primitives/queueItem/QueueItemRemove.ts"],"mappings":";;cAUM;kBAUW;OACH,UAAU;OACV,QAAQ,yBAAyB;;;;;;;;;;cAWlC,0CAAwB,0BAAA,KAAA,qBAAA,gBAAA,qCAAA,qBAAA;;;;oBAGpC,cAAA,6CAAA,cAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"QueueItemSteer.d.ts","names":[],"sources":["../../../src/primitives/queueItem/QueueItemSteer.ts"],"mappings":";;cAUM;kBAUW;OACH,UAAU;OACV,QAAQ,yBAAyB;;;;;;;;;;cAWlC,yCAAuB,0BAAA,KAAA,qBAAA,gBAAA,qCAAA,qBAAA"}
1
+ {"version":3,"file":"QueueItemSteer.d.ts","names":[],"sources":["../../../src/primitives/queueItem/QueueItemSteer.ts"],"mappings":";;cAUM;kBAUW;OACH,UAAU;OACV,QAAQ,yBAAyB;;;;;;;;;;cAWlC,yCAAuB,0BAAA,KAAA,qBAAA,gBAAA,qCAAA,qBAAA;;;;oBAGnC,cAAA,6CAAA,cAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"QueueItemText.d.ts","names":[],"sources":["../../../src/primitives/queueItem/QueueItemText.tsx"],"mappings":";;;kBAUiB;OACH,UAAU,oBAAoB,UAAU;OACxC,QAAQ,gCAAgC,UAAU;;;;;;;;;;cAWnD,wCAAsB,0BAAA,KAAA,qBAAA,gBAAA,mCAAA,eAAA"}
1
+ {"version":3,"file":"QueueItemText.d.ts","names":[],"sources":["../../../src/primitives/queueItem/QueueItemText.tsx"],"mappings":";;;kBAUiB;OACH,UAAU,oBAAoB,UAAU;OACxC,QAAQ,gCAAgC,UAAU;;;;;;;;;;cAWnD,wCAAsB,0BAAA,KAAA,qBAAA,gBAAA,mCAAA,eAAA;;;;oBAWjC,cAAA,2CAAA,cAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"QueueItemText.js","names":["c","_c","Primitive","ComponentRef","ComponentPropsWithoutRef","forwardRef","useAuiState","QueueItemPrimitiveText","Element","span","Props","props","ref","$","prompt","_temp","t0","children","t1","displayName","s","queueItem"],"sources":["../../../src/primitives/queueItem/QueueItemText.tsx"],"sourcesContent":["\"use client\";\n\nimport { Primitive } from \"../../utils/Primitive\";\nimport {\n type ComponentRef,\n type ComponentPropsWithoutRef,\n forwardRef,\n} from \"react\";\nimport { useAuiState } from \"@assistant-ui/store\";\n\nexport namespace QueueItemPrimitiveText {\n export type Element = ComponentRef<typeof Primitive.span>;\n export type Props = ComponentPropsWithoutRef<typeof Primitive.span>;\n}\n\n/**\n * Renders the prompt text of a queue item.\n *\n * @example\n * ```tsx\n * <QueueItemPrimitive.Text />\n * ```\n */\nexport const QueueItemPrimitiveText = forwardRef<\n QueueItemPrimitiveText.Element,\n QueueItemPrimitiveText.Props\n>((props, ref) => {\n const prompt = useAuiState((s) => s.queueItem.prompt);\n\n return (\n <Primitive.span {...props} ref={ref}>\n {props.children ?? prompt}\n </Primitive.span>\n );\n});\n\nQueueItemPrimitiveText.displayName = \"QueueItemPrimitive.Text\";\n"],"mappings":";;;;;;;;;;;;;;;AAuBA,MAAaO,yBAAyBF,YAGpCM,OAAAC,QAAA;CAAA,MAAAC,IAAAZ,EAAA,CAAA;CACA,MAAAa,SAAeR,YAAYS,KAAyB;CAI/C,MAAAC,KAAAL,MAAKM,YAALH;CAAwB,IAAAI;CAAA,IAAAL,EAAA,OAAAF,SAAAE,EAAA,OAAAD,OAAAC,EAAA,OAAAG,IAAA;EAD3BE,KAAA,oBAAA,UAAA,MAAA;GAAA,GAAoBP;GAAYC;aAC7BI;EACH,CAAA;EAAiBH,EAAA,KAAAF;EAAAE,EAAA,KAAAD;EAAAC,EAAA,KAAAG;EAAAH,EAAA,KAAAK;CAAA,OAAAA,KAAAL,EAAA;CAAA,OAFjBK;AAEiB,CAEpB;AAEDX,uBAAuBY,cAAc;AAVnC,SAAAJ,MAAAK,GAAA;CAAA,OACkCA,EAACC,UAAUP;AAAO"}
1
+ {"version":3,"file":"QueueItemText.js","names":["c","_c","Primitive","ComponentRef","ComponentPropsWithoutRef","forwardRef","useAuiState","QueueItemPrimitiveText","Element","span","Props","props","ref","$","prompt","_temp","t0","children","t1","displayName","s","queueItem"],"sources":["../../../src/primitives/queueItem/QueueItemText.tsx"],"sourcesContent":["\"use client\";\n\nimport { Primitive } from \"../../utils/Primitive\";\nimport {\n type ComponentRef,\n type ComponentPropsWithoutRef,\n forwardRef,\n} from \"react\";\nimport { useAuiState } from \"@assistant-ui/store\";\n\nexport namespace QueueItemPrimitiveText {\n export type Element = ComponentRef<typeof Primitive.span>;\n export type Props = ComponentPropsWithoutRef<typeof Primitive.span>;\n}\n\n/**\n * Renders the prompt text of a queue item.\n *\n * @example\n * ```tsx\n * <QueueItemPrimitive.Text />\n * ```\n */\nexport const QueueItemPrimitiveText = forwardRef<\n QueueItemPrimitiveText.Element,\n QueueItemPrimitiveText.Props\n>((props, ref) => {\n const prompt = useAuiState((s) => s.queueItem.prompt);\n\n return (\n <Primitive.span {...props} ref={ref}>\n {props.children ?? prompt}\n </Primitive.span>\n );\n});\n\nQueueItemPrimitiveText.displayName = \"QueueItemPrimitive.Text\";\n"],"mappings":";;;;;;;;;;;;;;;AAuBA,MAAaO,yBAAyBF,YAGpCM,OAAAC,QAAA;CAAA,MAAAC,IAAAZ,EAAA,CAAA;CACA,MAAAa,SAAeR,YAAYS,KAAyB;CAI/C,MAAAC,KAAAL,MAAKM,YAALH;CAAwB,IAAAI;CAAA,IAAAL,EAAA,OAAAF,SAAAE,EAAA,OAAAD,OAAAC,EAAA,OAAAG,IAAA;EAD3BE,KAAA,oBAAA,UAAA,MAAA;GAAA,GAAoBP;GAAYC;GAC7BI,UAAAA;EACH,CAAA;EAAiBH,EAAA,KAAAF;EAAAE,EAAA,KAAAD;EAAAC,EAAA,KAAAG;EAAAH,EAAA,KAAAK;CAAA,OAAAA,KAAAL,EAAA;CAAA,OAFjBK;AAEiB,CAEpB;AAEDX,uBAAuBY,cAAc;AAVnC,SAAAJ,MAAAK,GAAA;CAAA,OACkCA,EAACC,UAAUP;AAAO"}
@@ -1 +1 @@
1
- {"version":3,"file":"SelectionToolbarQuote.d.ts","names":[],"sources":["../../../src/primitives/selectionToolbar/SelectionToolbarQuote.tsx"],"mappings":";;;kBAaiB;OACH,UAAU,oBAAoB,UAAU;OACxC,QAAQ,gCAAgC,UAAU;;;;;;;;;;;;;;;;cAiBnD,gDAA8B,0BAAA,KAAA,qBAAA,gBAAA,qCAAA,qBAAA"}
1
+ {"version":3,"file":"SelectionToolbarQuote.d.ts","names":[],"sources":["../../../src/primitives/selectionToolbar/SelectionToolbarQuote.tsx"],"mappings":";;;kBAaiB;OACH,UAAU,oBAAoB,UAAU;OACxC,QAAQ,gCAAgC,UAAU;;;;;;;;;;;;;;;;cAiBnD,gDAA8B,0BAAA,KAAA,qBAAA,gBAAA,qCAAA,qBAAA;;;;oBA2BzC,cAAA,6CAAA,cAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"SelectionToolbarRoot.d.ts","names":[],"sources":["../../../src/primitives/selectionToolbar/SelectionToolbarRoot.tsx"],"mappings":";;;KAeK;EACH;EACA;EACA,MAAM;;cAKK,+BAAuB;kBAGnB;OACH,UAAU,oBAAoB,UAAU;OACxC,QAAQ,gCAAgC,UAAU;;;;;;;;;;;;;;;;cAiBnD,+CAA6B,0BAAA,KAAA,qBAAA,gBAAA,kCAAA,eAAA"}
1
+ {"version":3,"file":"SelectionToolbarRoot.d.ts","names":[],"sources":["../../../src/primitives/selectionToolbar/SelectionToolbarRoot.tsx"],"mappings":";;;KAeK;EACH;EACA;EACA,MAAM;;cAKK,+BAAuB;kBAGnB;OACH,UAAU,oBAAoB,UAAU;OACxC,QAAQ,gCAAgC,UAAU;;;;;;;;;;;;;;;;cAiBnD,+CAA6B,0BAAA,KAAA,qBAAA,gBAAA,kCAAA,eAAA;;;;oBAmFxC,cAAA,0CAAA,cAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"SelectionToolbarRoot.js","names":["c","_c","Primitive","ComponentPropsWithoutRef","ComponentRef","createContext","forwardRef","useContext","useEffect","useState","createPortal","getSelectionMessageId","SelectionInfo","text","messageId","rect","DOMRect","SelectionToolbarContext","useSelectionToolbarInfo","SelectionToolbarPrimitiveRoot","Element","div","Props","t0","forwardedRef","$","onMouseDown","props","style","info","setInfo","t1","t2","Symbol","for","checkSelection","requestAnimationFrame","sel","window","getSelection","isCollapsed","toString","trim","range","getRangeAt","getBoundingClientRect","handleSelectionCollapse","sel_0","handleScroll","document","addEventListener","removeEventListener","t3","top","t4","left","width","t5","position","transform","zIndex","positionStyle","t6","e","preventDefault","t7","t8","body","displayName"],"sources":["../../../src/primitives/selectionToolbar/SelectionToolbarRoot.tsx"],"sourcesContent":["\"use client\";\n\nimport { Primitive } from \"../../utils/Primitive\";\nimport {\n type ComponentPropsWithoutRef,\n type ComponentRef,\n createContext,\n forwardRef,\n useContext,\n useEffect,\n useState,\n} from \"react\";\nimport { createPortal } from \"react-dom\";\nimport { getSelectionMessageId } from \"../../utils/getSelectionMessageId\";\n\ntype SelectionInfo = {\n text: string;\n messageId: string;\n rect: DOMRect;\n};\n\nconst SelectionToolbarContext = createContext<SelectionInfo | null>(null);\n\nexport const useSelectionToolbarInfo = () =>\n useContext(SelectionToolbarContext);\n\nexport namespace SelectionToolbarPrimitiveRoot {\n export type Element = ComponentRef<typeof Primitive.div>;\n export type Props = ComponentPropsWithoutRef<typeof Primitive.div>;\n}\n\n/**\n * A floating toolbar that appears when text is selected within a message.\n *\n * Listens for mouse and keyboard selection events, validates that the\n * selection is within a single message, and renders a positioned portal\n * near the selection. Prevents mousedown from clearing the selection.\n *\n * @example\n * ```tsx\n * <SelectionToolbarPrimitive.Root>\n * <SelectionToolbarPrimitive.Quote>Quote</SelectionToolbarPrimitive.Quote>\n * </SelectionToolbarPrimitive.Root>\n * ```\n */\nexport const SelectionToolbarPrimitiveRoot = forwardRef<\n SelectionToolbarPrimitiveRoot.Element,\n SelectionToolbarPrimitiveRoot.Props\n>(({ onMouseDown, style, ...props }, forwardedRef) => {\n const [info, setInfo] = useState<SelectionInfo | null>(null);\n\n useEffect(() => {\n const checkSelection = () => {\n requestAnimationFrame(() => {\n const sel = window.getSelection();\n if (!sel || sel.isCollapsed) {\n setInfo(null);\n return;\n }\n\n const text = sel.toString().trim();\n if (!text) {\n setInfo(null);\n return;\n }\n\n const messageId = getSelectionMessageId(sel);\n if (!messageId) {\n setInfo(null);\n return;\n }\n\n const range = sel.getRangeAt(0);\n const rect = range.getBoundingClientRect();\n setInfo({ text, messageId, rect });\n });\n };\n\n const handleSelectionCollapse = () => {\n const sel = window.getSelection();\n if (!sel || sel.isCollapsed) {\n setInfo(null);\n }\n };\n\n const handleScroll = () => {\n setInfo(null);\n };\n\n document.addEventListener(\"mouseup\", checkSelection);\n document.addEventListener(\"keyup\", checkSelection);\n document.addEventListener(\"selectionchange\", handleSelectionCollapse);\n document.addEventListener(\"scroll\", handleScroll, true);\n\n return () => {\n document.removeEventListener(\"mouseup\", checkSelection);\n document.removeEventListener(\"keyup\", checkSelection);\n document.removeEventListener(\"selectionchange\", handleSelectionCollapse);\n document.removeEventListener(\"scroll\", handleScroll, true);\n };\n }, []);\n\n if (!info) return null;\n\n const positionStyle: React.CSSProperties = {\n position: \"fixed\",\n top: `${info.rect.top - 8}px`,\n left: `${info.rect.left + info.rect.width / 2}px`,\n transform: \"translate(-50%, -100%)\",\n zIndex: 50,\n ...style,\n };\n\n return createPortal(\n <SelectionToolbarContext.Provider value={info}>\n <Primitive.div\n {...props}\n ref={forwardedRef}\n style={positionStyle}\n onMouseDown={(e) => {\n // Prevent mousedown from clearing the text selection\n e.preventDefault();\n onMouseDown?.(e);\n }}\n />\n </SelectionToolbarContext.Provider>,\n document.body,\n );\n});\n\nSelectionToolbarPrimitiveRoot.displayName = \"SelectionToolbarPrimitive.Root\";\n"],"mappings":"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"}
1
+ {"version":3,"file":"SelectionToolbarRoot.js","names":["c","_c","Primitive","ComponentPropsWithoutRef","ComponentRef","createContext","forwardRef","useContext","useEffect","useState","createPortal","getSelectionMessageId","SelectionInfo","text","messageId","rect","DOMRect","SelectionToolbarContext","useSelectionToolbarInfo","SelectionToolbarPrimitiveRoot","Element","div","Props","t0","forwardedRef","$","onMouseDown","props","style","info","setInfo","t1","t2","Symbol","for","checkSelection","requestAnimationFrame","sel","window","getSelection","isCollapsed","toString","trim","range","getRangeAt","getBoundingClientRect","handleSelectionCollapse","sel_0","handleScroll","document","addEventListener","removeEventListener","t3","top","t4","left","width","t5","position","transform","zIndex","positionStyle","t6","e","preventDefault","t7","t8","body","displayName"],"sources":["../../../src/primitives/selectionToolbar/SelectionToolbarRoot.tsx"],"sourcesContent":["\"use client\";\n\nimport { Primitive } from \"../../utils/Primitive\";\nimport {\n type ComponentPropsWithoutRef,\n type ComponentRef,\n createContext,\n forwardRef,\n useContext,\n useEffect,\n useState,\n} from \"react\";\nimport { createPortal } from \"react-dom\";\nimport { getSelectionMessageId } from \"../../utils/getSelectionMessageId\";\n\ntype SelectionInfo = {\n text: string;\n messageId: string;\n rect: DOMRect;\n};\n\nconst SelectionToolbarContext = createContext<SelectionInfo | null>(null);\n\nexport const useSelectionToolbarInfo = () =>\n useContext(SelectionToolbarContext);\n\nexport namespace SelectionToolbarPrimitiveRoot {\n export type Element = ComponentRef<typeof Primitive.div>;\n export type Props = ComponentPropsWithoutRef<typeof Primitive.div>;\n}\n\n/**\n * A floating toolbar that appears when text is selected within a message.\n *\n * Listens for mouse and keyboard selection events, validates that the\n * selection is within a single message, and renders a positioned portal\n * near the selection. Prevents mousedown from clearing the selection.\n *\n * @example\n * ```tsx\n * <SelectionToolbarPrimitive.Root>\n * <SelectionToolbarPrimitive.Quote>Quote</SelectionToolbarPrimitive.Quote>\n * </SelectionToolbarPrimitive.Root>\n * ```\n */\nexport const SelectionToolbarPrimitiveRoot = forwardRef<\n SelectionToolbarPrimitiveRoot.Element,\n SelectionToolbarPrimitiveRoot.Props\n>(({ onMouseDown, style, ...props }, forwardedRef) => {\n const [info, setInfo] = useState<SelectionInfo | null>(null);\n\n useEffect(() => {\n const checkSelection = () => {\n requestAnimationFrame(() => {\n const sel = window.getSelection();\n if (!sel || sel.isCollapsed) {\n setInfo(null);\n return;\n }\n\n const text = sel.toString().trim();\n if (!text) {\n setInfo(null);\n return;\n }\n\n const messageId = getSelectionMessageId(sel);\n if (!messageId) {\n setInfo(null);\n return;\n }\n\n const range = sel.getRangeAt(0);\n const rect = range.getBoundingClientRect();\n setInfo({ text, messageId, rect });\n });\n };\n\n const handleSelectionCollapse = () => {\n const sel = window.getSelection();\n if (!sel || sel.isCollapsed) {\n setInfo(null);\n }\n };\n\n const handleScroll = () => {\n setInfo(null);\n };\n\n document.addEventListener(\"mouseup\", checkSelection);\n document.addEventListener(\"keyup\", checkSelection);\n document.addEventListener(\"selectionchange\", handleSelectionCollapse);\n document.addEventListener(\"scroll\", handleScroll, true);\n\n return () => {\n document.removeEventListener(\"mouseup\", checkSelection);\n document.removeEventListener(\"keyup\", checkSelection);\n document.removeEventListener(\"selectionchange\", handleSelectionCollapse);\n document.removeEventListener(\"scroll\", handleScroll, true);\n };\n }, []);\n\n if (!info) return null;\n\n const positionStyle: React.CSSProperties = {\n position: \"fixed\",\n top: `${info.rect.top - 8}px`,\n left: `${info.rect.left + info.rect.width / 2}px`,\n transform: \"translate(-50%, -100%)\",\n zIndex: 50,\n ...style,\n };\n\n return createPortal(\n <SelectionToolbarContext.Provider value={info}>\n <Primitive.div\n {...props}\n ref={forwardedRef}\n style={positionStyle}\n onMouseDown={(e) => {\n // Prevent mousedown from clearing the text selection\n e.preventDefault();\n onMouseDown?.(e);\n }}\n />\n </SelectionToolbarContext.Provider>,\n document.body,\n );\n});\n\nSelectionToolbarPrimitiveRoot.displayName = \"SelectionToolbarPrimitive.Root\";\n"],"mappings":"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"}
@@ -1 +1 @@
1
- {"version":3,"file":"SuggestionDescription.d.ts","names":[],"sources":["../../../src/primitives/suggestion/SuggestionDescription.tsx"],"mappings":";;;kBAUiB;OACH,UAAU,kBAAkB,UAAU;OACtC,QAAQ,gCAAgC,UAAU;;;;;;;;;;cAWnD,gDAA8B,0BAAA,KAAA,qBAAA,gBAAA,mCAAA,eAAA"}
1
+ {"version":3,"file":"SuggestionDescription.d.ts","names":[],"sources":["../../../src/primitives/suggestion/SuggestionDescription.tsx"],"mappings":";;;kBAUiB;OACH,UAAU,kBAAkB,UAAU;OACtC,QAAQ,gCAAgC,UAAU;;;;;;;;;;cAWnD,gDAA8B,0BAAA,KAAA,qBAAA,gBAAA,mCAAA,eAAA;;;;oBAWzC,cAAA,2CAAA,cAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"SuggestionDescription.js","names":["c","_c","Primitive","ElementRef","forwardRef","ComponentPropsWithoutRef","useAuiState","SuggestionPrimitiveDescription","Element","span","Props","props","ref","$","label","_temp","t0","children","t1","displayName","s","suggestion"],"sources":["../../../src/primitives/suggestion/SuggestionDescription.tsx"],"sourcesContent":["\"use client\";\n\nimport { Primitive } from \"../../utils/Primitive\";\nimport {\n type ElementRef,\n forwardRef,\n type ComponentPropsWithoutRef,\n} from \"react\";\nimport { useAuiState } from \"@assistant-ui/store\";\n\nexport namespace SuggestionPrimitiveDescription {\n export type Element = ElementRef<typeof Primitive.span>;\n export type Props = ComponentPropsWithoutRef<typeof Primitive.span>;\n}\n\n/**\n * Renders the description/label of the suggestion.\n *\n * @example\n * ```tsx\n * <SuggestionPrimitive.Description />\n * ```\n */\nexport const SuggestionPrimitiveDescription = forwardRef<\n SuggestionPrimitiveDescription.Element,\n SuggestionPrimitiveDescription.Props\n>((props, ref) => {\n const label = useAuiState((s) => s.suggestion.label);\n\n return (\n <Primitive.span {...props} ref={ref}>\n {props.children ?? label}\n </Primitive.span>\n );\n});\n\nSuggestionPrimitiveDescription.displayName = \"SuggestionPrimitive.Description\";\n"],"mappings":";;;;;;;;;;;;;;;AAuBA,MAAaO,iCAAiCH,YAG5CO,OAAAC,QAAA;CAAA,MAAAC,IAAAZ,EAAA,CAAA;CACA,MAAAa,QAAcR,YAAYS,KAAyB;CAI9C,MAAAC,KAAAL,MAAKM,YAALH;CAAuB,IAAAI;CAAA,IAAAL,EAAA,OAAAF,SAAAE,EAAA,OAAAD,OAAAC,EAAA,OAAAG,IAAA;EAD1BE,KAAA,oBAAA,UAAA,MAAA;GAAA,GAAoBP;GAAYC;aAC7BI;EACH,CAAA;EAAiBH,EAAA,KAAAF;EAAAE,EAAA,KAAAD;EAAAC,EAAA,KAAAG;EAAAH,EAAA,KAAAK;CAAA,OAAAA,KAAAL,EAAA;CAAA,OAFjBK;AAEiB,CAEpB;AAEDX,+BAA+BY,cAAc;AAV3C,SAAAJ,MAAAK,GAAA;CAAA,OACiCA,EAACC,WAAWP;AAAM"}
1
+ {"version":3,"file":"SuggestionDescription.js","names":["c","_c","Primitive","ElementRef","forwardRef","ComponentPropsWithoutRef","useAuiState","SuggestionPrimitiveDescription","Element","span","Props","props","ref","$","label","_temp","t0","children","t1","displayName","s","suggestion"],"sources":["../../../src/primitives/suggestion/SuggestionDescription.tsx"],"sourcesContent":["\"use client\";\n\nimport { Primitive } from \"../../utils/Primitive\";\nimport {\n type ElementRef,\n forwardRef,\n type ComponentPropsWithoutRef,\n} from \"react\";\nimport { useAuiState } from \"@assistant-ui/store\";\n\nexport namespace SuggestionPrimitiveDescription {\n export type Element = ElementRef<typeof Primitive.span>;\n export type Props = ComponentPropsWithoutRef<typeof Primitive.span>;\n}\n\n/**\n * Renders the description/label of the suggestion.\n *\n * @example\n * ```tsx\n * <SuggestionPrimitive.Description />\n * ```\n */\nexport const SuggestionPrimitiveDescription = forwardRef<\n SuggestionPrimitiveDescription.Element,\n SuggestionPrimitiveDescription.Props\n>((props, ref) => {\n const label = useAuiState((s) => s.suggestion.label);\n\n return (\n <Primitive.span {...props} ref={ref}>\n {props.children ?? label}\n </Primitive.span>\n );\n});\n\nSuggestionPrimitiveDescription.displayName = \"SuggestionPrimitive.Description\";\n"],"mappings":";;;;;;;;;;;;;;;AAuBA,MAAaO,iCAAiCH,YAG5CO,OAAAC,QAAA;CAAA,MAAAC,IAAAZ,EAAA,CAAA;CACA,MAAAa,QAAcR,YAAYS,KAAyB;CAI9C,MAAAC,KAAAL,MAAKM,YAALH;CAAuB,IAAAI;CAAA,IAAAL,EAAA,OAAAF,SAAAE,EAAA,OAAAD,OAAAC,EAAA,OAAAG,IAAA;EAD1BE,KAAA,oBAAA,UAAA,MAAA;GAAA,GAAoBP;GAAYC;GAC7BI,UAAAA;EACH,CAAA;EAAiBH,EAAA,KAAAF;EAAAE,EAAA,KAAAD;EAAAC,EAAA,KAAAG;EAAAH,EAAA,KAAAK;CAAA,OAAAA,KAAAL,EAAA;CAAA,OAFjBK;AAEiB,CAEpB;AAEDX,+BAA+BY,cAAc;AAV3C,SAAAJ,MAAAK,GAAA;CAAA,OACiCA,EAACC,WAAWP;AAAM"}
@@ -1 +1 @@
1
- {"version":3,"file":"SuggestionTitle.d.ts","names":[],"sources":["../../../src/primitives/suggestion/SuggestionTitle.tsx"],"mappings":";;;kBAUiB;OACH,UAAU,kBAAkB,UAAU;OACtC,QAAQ,gCAAgC,UAAU;;;;;;;;;;cAWnD,0CAAwB,0BAAA,KAAA,qBAAA,gBAAA,mCAAA,eAAA"}
1
+ {"version":3,"file":"SuggestionTitle.d.ts","names":[],"sources":["../../../src/primitives/suggestion/SuggestionTitle.tsx"],"mappings":";;;kBAUiB;OACH,UAAU,kBAAkB,UAAU;OACtC,QAAQ,gCAAgC,UAAU;;;;;;;;;;cAWnD,0CAAwB,0BAAA,KAAA,qBAAA,gBAAA,mCAAA,eAAA;;;;oBAWnC,cAAA,2CAAA,cAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"SuggestionTitle.js","names":["c","_c","Primitive","ElementRef","forwardRef","ComponentPropsWithoutRef","useAuiState","SuggestionPrimitiveTitle","Element","span","Props","props","ref","$","title","_temp","t0","children","t1","displayName","s","suggestion"],"sources":["../../../src/primitives/suggestion/SuggestionTitle.tsx"],"sourcesContent":["\"use client\";\n\nimport { Primitive } from \"../../utils/Primitive\";\nimport {\n type ElementRef,\n forwardRef,\n type ComponentPropsWithoutRef,\n} from \"react\";\nimport { useAuiState } from \"@assistant-ui/store\";\n\nexport namespace SuggestionPrimitiveTitle {\n export type Element = ElementRef<typeof Primitive.span>;\n export type Props = ComponentPropsWithoutRef<typeof Primitive.span>;\n}\n\n/**\n * Renders the title of the suggestion.\n *\n * @example\n * ```tsx\n * <SuggestionPrimitive.Title />\n * ```\n */\nexport const SuggestionPrimitiveTitle = forwardRef<\n SuggestionPrimitiveTitle.Element,\n SuggestionPrimitiveTitle.Props\n>((props, ref) => {\n const title = useAuiState((s) => s.suggestion.title);\n\n return (\n <Primitive.span {...props} ref={ref}>\n {props.children ?? title}\n </Primitive.span>\n );\n});\n\nSuggestionPrimitiveTitle.displayName = \"SuggestionPrimitive.Title\";\n"],"mappings":";;;;;;;;;;;;;;;AAuBA,MAAaO,2BAA2BH,YAGtCO,OAAAC,QAAA;CAAA,MAAAC,IAAAZ,EAAA,CAAA;CACA,MAAAa,QAAcR,YAAYS,KAAyB;CAI9C,MAAAC,KAAAL,MAAKM,YAALH;CAAuB,IAAAI;CAAA,IAAAL,EAAA,OAAAF,SAAAE,EAAA,OAAAD,OAAAC,EAAA,OAAAG,IAAA;EAD1BE,KAAA,oBAAA,UAAA,MAAA;GAAA,GAAoBP;GAAYC;aAC7BI;EACH,CAAA;EAAiBH,EAAA,KAAAF;EAAAE,EAAA,KAAAD;EAAAC,EAAA,KAAAG;EAAAH,EAAA,KAAAK;CAAA,OAAAA,KAAAL,EAAA;CAAA,OAFjBK;AAEiB,CAEpB;AAEDX,yBAAyBY,cAAc;AAVrC,SAAAJ,MAAAK,GAAA;CAAA,OACiCA,EAACC,WAAWP;AAAM"}
1
+ {"version":3,"file":"SuggestionTitle.js","names":["c","_c","Primitive","ElementRef","forwardRef","ComponentPropsWithoutRef","useAuiState","SuggestionPrimitiveTitle","Element","span","Props","props","ref","$","title","_temp","t0","children","t1","displayName","s","suggestion"],"sources":["../../../src/primitives/suggestion/SuggestionTitle.tsx"],"sourcesContent":["\"use client\";\n\nimport { Primitive } from \"../../utils/Primitive\";\nimport {\n type ElementRef,\n forwardRef,\n type ComponentPropsWithoutRef,\n} from \"react\";\nimport { useAuiState } from \"@assistant-ui/store\";\n\nexport namespace SuggestionPrimitiveTitle {\n export type Element = ElementRef<typeof Primitive.span>;\n export type Props = ComponentPropsWithoutRef<typeof Primitive.span>;\n}\n\n/**\n * Renders the title of the suggestion.\n *\n * @example\n * ```tsx\n * <SuggestionPrimitive.Title />\n * ```\n */\nexport const SuggestionPrimitiveTitle = forwardRef<\n SuggestionPrimitiveTitle.Element,\n SuggestionPrimitiveTitle.Props\n>((props, ref) => {\n const title = useAuiState((s) => s.suggestion.title);\n\n return (\n <Primitive.span {...props} ref={ref}>\n {props.children ?? title}\n </Primitive.span>\n );\n});\n\nSuggestionPrimitiveTitle.displayName = \"SuggestionPrimitive.Title\";\n"],"mappings":";;;;;;;;;;;;;;;AAuBA,MAAaO,2BAA2BH,YAGtCO,OAAAC,QAAA;CAAA,MAAAC,IAAAZ,EAAA,CAAA;CACA,MAAAa,QAAcR,YAAYS,KAAyB;CAI9C,MAAAC,KAAAL,MAAKM,YAALH;CAAuB,IAAAI;CAAA,IAAAL,EAAA,OAAAF,SAAAE,EAAA,OAAAD,OAAAC,EAAA,OAAAG,IAAA;EAD1BE,KAAA,oBAAA,UAAA,MAAA;GAAA,GAAoBP;GAAYC;GAC7BI,UAAAA;EACH,CAAA;EAAiBH,EAAA,KAAAF;EAAAE,EAAA,KAAAD;EAAAC,EAAA,KAAAG;EAAAH,EAAA,KAAAK;CAAA,OAAAA,KAAAL,EAAA;CAAA,OAFjBK;AAEiB,CAEpB;AAEDX,yBAAyBY,cAAc;AAVrC,SAAAJ,MAAAK,GAAA;CAAA,OACiCA,EAACC,WAAWP;AAAM"}
@@ -1 +1 @@
1
- {"version":3,"file":"SuggestionTrigger.d.ts","names":[],"sources":["../../../src/primitives/suggestion/SuggestionTrigger.ts"],"mappings":";;cAUM,yBAAwB,MAAA;;;;;EAQ5B;;;;;;;;EASA;;kBAmCe;OACH,UAAU;OACV,QAAQ,yBAAyB;;;;;;;;;;;;cAalC,4CAA0B,0BAAA,KAAA,qBAAA,gBAAA,qCAAA,qBAAA"}
1
+ {"version":3,"file":"SuggestionTrigger.d.ts","names":[],"sources":["../../../src/primitives/suggestion/SuggestionTrigger.ts"],"mappings":";;cAUM,yBAAwB,MAAA;;;;;EAQ5B;;;;;;;;EASA;;kBAmCe;OACH,UAAU;OACV,QAAQ,yBAAyB;;;;;;;;;;;;cAalC,4CAA0B,0BAAA,KAAA,qBAAA,gBAAA,qCAAA,qBAAA;;;;;;;;;EA3D9B;;;;;;;;EASS;oBAsDjB,cAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"ThreadRoot.d.ts","names":[],"sources":["../../../src/primitives/thread/ThreadRoot.tsx"],"mappings":";;;kBASiB;OACH,UAAU,oBAAoB,UAAU;;;;;OAKxC,QAAQ,gCAAgC,UAAU;;;;;;;;;;;;;;;;;;;cAoBnD,qCAAmB,0BAAA,KAAA,qBAAA,gBAAA,kCAAA,eAAA"}
1
+ {"version":3,"file":"ThreadRoot.d.ts","names":[],"sources":["../../../src/primitives/thread/ThreadRoot.tsx"],"mappings":";;;kBASiB;OACH,UAAU,oBAAoB,UAAU;;;;;OAKxC,QAAQ,gCAAgC,UAAU;;;;;;;;;;;;;;;;;;;cAoBnD,qCAAmB,0BAAA,KAAA,qBAAA,gBAAA,kCAAA,eAAA;;;;oBAK9B,cAAA,0CAAA,cAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"ThreadScrollToBottom.d.ts","names":[],"sources":["../../../src/primitives/thread/ThreadScrollToBottom.ts"],"mappings":";;kBAaiB;OACH;IACV,WAAW;;;cAIT,4BAA2B,aAE9B,wBAAwB;kBAaV;OACH,UAAU;OACV,QAAQ,yBAAyB;;cAGlC,+CAA6B,0BAAA,KAAA,qBAAA,gBAAA,qCAAA,qBAAA"}
1
+ {"version":3,"file":"ThreadScrollToBottom.d.ts","names":[],"sources":["../../../src/primitives/thread/ThreadScrollToBottom.ts"],"mappings":";;kBAaiB;OACH;IACV,WAAW;;;cAIT,4BAA2B,aAE9B,wBAAwB;kBAaV;OACH,UAAU;OACV,QAAQ,yBAAyB;;cAGlC,+CAA6B,0BAAA,KAAA,qBAAA,gBAAA,qCAAA,qBAAA;;;;oBAIzC,cAAA,6BAAA,wBAAA,0BAAA,cAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"ThreadSuggestion.d.ts","names":[],"sources":["../../../src/primitives/thread/ThreadSuggestion.ts"],"mappings":";;cASM,wBAAuB,QAAA,MAAA,eAAA,UAAA,QAAA;;EAQ3B;;;;;EAMA;;;;;;;;EASA;;EAGA;;EAGA;;kBAae;OACH,UAAU;OACV,QAAQ,yBAAyB;;cAGlC,2CAAyB,0BAAA,KAAA,qBAAA,gBAAA,qCAAA,qBAAA"}
1
+ {"version":3,"file":"ThreadSuggestion.d.ts","names":[],"sources":["../../../src/primitives/thread/ThreadSuggestion.ts"],"mappings":";;cASM,wBAAuB,QAAA,MAAA,eAAA,UAAA,QAAA;;EAQ3B;;;;;EAMA;;;;;;;;EASA;;EAGA;;EAGA;;kBAae;OACH,UAAU;OACV,QAAQ,yBAAyB;;cAGlC,2CAAyB,0BAAA,KAAA,qBAAA,gBAAA,qCAAA,qBAAA;;;;;;EAvC5B;;;;;EAMD;;;;;;;;EASS;;EAGL;;EAGF;oBAsBV,cAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"ThreadViewport.d.ts","names":[],"sources":["../../../src/primitives/thread/ThreadViewport.tsx"],"mappings":";;;kBA2BiB;OACH,UAAU,oBAAoB,UAAU;OACxC,QAAQ,gCAAgC,UAAU;;;;;;;IAO5D;;;;;;IAOA;;;;;;IAOA;;;;;;MAME;;;;;;MAMA;;;;;;;IAQF;;;;;;IAOA;;;;;;IAOA;;;;;;;;;;;;;;;;;;;cAsHS,yCAAuB,0BAAA,KAAA,qBAAA,gBAAA,kCAAA,eAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAlJ9B;;;;;;IAMA"}
1
+ {"version":3,"file":"ThreadViewport.d.ts","names":[],"sources":["../../../src/primitives/thread/ThreadViewport.tsx"],"mappings":";;;kBA4BiB;OACH,UAAU,oBAAoB,UAAU;OACxC,QAAQ,gCAAgC,UAAU;;;;;;;IAO5D;;;;;;IAOA;;;;;;IAOA;;;;;;MAME;;;;;;MAMA;;;;;;;IAQF;;;;;;IAOA;;;;;;IAOA;;;;;;;;;;;;;;;;;;;cAoIS,yCAAuB,0BAAA,KAAA,qBAAA,gBAAA,kCAAA,eAAA;;;;;;;;;;;EApLnB;;;;;;EAOA;;;;;;EAOW;;;;;;IAMtB;;;;;;IAMA;;;;;;;EAQyB;;;;;;EAOE;;;;;;EAOE;oBA+IjC,cAAA"}