@assistant-ui/core 0.2.4 → 0.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/adapters/attachment.d.ts +43 -39
- package/dist/adapters/attachment.d.ts.map +1 -1
- package/dist/adapters/attachment.js +148 -183
- package/dist/adapters/attachment.js.map +1 -1
- package/dist/adapters/directive-formatter.d.ts +6 -2
- package/dist/adapters/directive-formatter.d.ts.map +1 -1
- package/dist/adapters/directive-formatter.js +36 -33
- package/dist/adapters/directive-formatter.js.map +1 -1
- package/dist/adapters/feedback.d.ts +9 -6
- package/dist/adapters/feedback.d.ts.map +1 -1
- package/dist/adapters/feedback.js +0 -2
- package/dist/adapters/index.d.ts +9 -13
- package/dist/adapters/index.js +5 -6
- package/dist/adapters/speech.d.ts +66 -63
- package/dist/adapters/speech.d.ts.map +1 -1
- package/dist/adapters/speech.js +170 -174
- package/dist/adapters/speech.js.map +1 -1
- package/dist/adapters/suggestion.d.ts +9 -6
- package/dist/adapters/suggestion.d.ts.map +1 -1
- package/dist/adapters/suggestion.js +0 -2
- package/dist/adapters/thread-history.d.ts +40 -37
- package/dist/adapters/thread-history.d.ts.map +1 -1
- package/dist/adapters/thread-history.js +0 -2
- package/dist/adapters/trigger.d.ts +9 -8
- package/dist/adapters/trigger.d.ts.map +1 -1
- package/dist/adapters/trigger.js +0 -2
- package/dist/adapters/voice.d.ts +46 -42
- package/dist/adapters/voice.d.ts.map +1 -1
- package/dist/adapters/voice.js +98 -107
- package/dist/adapters/voice.js.map +1 -1
- package/dist/index.d.ts +45 -53
- package/dist/index.js +16 -20
- package/dist/internal.d.ts +37 -8
- package/dist/internal.js +34 -18
- package/dist/model-context/frame/host.d.ts +23 -19
- package/dist/model-context/frame/host.d.ts.map +1 -1
- package/dist/model-context/frame/host.js +121 -135
- package/dist/model-context/frame/host.js.map +1 -1
- package/dist/model-context/frame/provider.d.ts +20 -16
- package/dist/model-context/frame/provider.d.ts.map +1 -1
- package/dist/model-context/frame/provider.js +115 -126
- package/dist/model-context/frame/provider.js.map +1 -1
- package/dist/model-context/frame/types.d.ts +25 -22
- package/dist/model-context/frame/types.d.ts.map +1 -1
- package/dist/model-context/frame/types.js +5 -1
- package/dist/model-context/frame/types.js.map +1 -1
- package/dist/model-context/registry-handles.d.ts +13 -9
- package/dist/model-context/registry-handles.d.ts.map +1 -1
- package/dist/model-context/registry-handles.js +0 -2
- package/dist/model-context/registry.d.ts +19 -15
- package/dist/model-context/registry.d.ts.map +1 -1
- package/dist/model-context/registry.js +93 -107
- package/dist/model-context/registry.js.map +1 -1
- package/dist/model-context/tool.d.ts +6 -2
- package/dist/model-context/tool.d.ts.map +1 -1
- package/dist/model-context/tool.js +30 -27
- package/dist/model-context/tool.js.map +1 -1
- package/dist/model-context/types.d.ts +37 -33
- package/dist/model-context/types.d.ts.map +1 -1
- package/dist/model-context/types.js +24 -38
- package/dist/model-context/types.js.map +1 -1
- package/dist/react/AssistantProvider.d.ts +12 -8
- package/dist/react/AssistantProvider.d.ts.map +1 -1
- package/dist/react/AssistantProvider.js +16 -9
- package/dist/react/AssistantProvider.js.map +1 -1
- package/dist/react/AssistantRuntimeProvider.d.ts +26 -18
- package/dist/react/AssistantRuntimeProvider.d.ts.map +1 -1
- package/dist/react/AssistantRuntimeProvider.js +33 -25
- package/dist/react/AssistantRuntimeProvider.js.map +1 -1
- package/dist/react/RuntimeAdapter.d.ts +5 -2
- package/dist/react/RuntimeAdapter.d.ts.map +1 -1
- package/dist/react/RuntimeAdapter.js +11 -11
- package/dist/react/RuntimeAdapter.js.map +1 -1
- package/dist/react/adapters/LocalStorageThreadListAdapter.d.ts +14 -11
- package/dist/react/adapters/LocalStorageThreadListAdapter.d.ts.map +1 -1
- package/dist/react/adapters/LocalStorageThreadListAdapter.js +136 -147
- package/dist/react/adapters/LocalStorageThreadListAdapter.js.map +1 -1
- package/dist/react/adapters/TitleGenerationAdapter.d.ts +8 -4
- package/dist/react/adapters/TitleGenerationAdapter.d.ts.map +1 -1
- package/dist/react/adapters/TitleGenerationAdapter.js +13 -13
- package/dist/react/adapters/TitleGenerationAdapter.js.map +1 -1
- package/dist/react/client/DataRenderers.d.ts +6 -2
- package/dist/react/client/DataRenderers.d.ts.map +1 -1
- package/dist/react/client/DataRenderers.js +53 -51
- package/dist/react/client/DataRenderers.js.map +1 -1
- package/dist/react/client/Interactables.d.ts +6 -2
- package/dist/react/client/Interactables.d.ts.map +1 -1
- package/dist/react/client/Interactables.js +251 -257
- package/dist/react/client/Interactables.js.map +1 -1
- package/dist/react/client/Tools.d.ts +13 -14
- package/dist/react/client/Tools.d.ts.map +1 -1
- package/dist/react/client/Tools.js +57 -68
- package/dist/react/client/Tools.js.map +1 -1
- package/dist/react/client/interactable-model-context.d.ts +10 -6
- package/dist/react/client/interactable-model-context.d.ts.map +1 -1
- package/dist/react/client/interactable-model-context.js +51 -59
- package/dist/react/client/interactable-model-context.js.map +1 -1
- package/dist/react/index.d.ts +95 -90
- package/dist/react/index.js +88 -96
- package/dist/react/model-context/makeAssistantDataUI.d.ts +9 -6
- package/dist/react/model-context/makeAssistantDataUI.d.ts.map +1 -1
- package/dist/react/model-context/makeAssistantDataUI.js +17 -13
- package/dist/react/model-context/makeAssistantDataUI.js.map +1 -1
- package/dist/react/model-context/makeAssistantTool.d.ts +9 -6
- package/dist/react/model-context/makeAssistantTool.d.ts.map +1 -1
- package/dist/react/model-context/makeAssistantTool.js +18 -14
- package/dist/react/model-context/makeAssistantTool.js.map +1 -1
- package/dist/react/model-context/makeAssistantToolUI.d.ts +9 -6
- package/dist/react/model-context/makeAssistantToolUI.d.ts.map +1 -1
- package/dist/react/model-context/makeAssistantToolUI.js +19 -15
- package/dist/react/model-context/makeAssistantToolUI.js.map +1 -1
- package/dist/react/model-context/toolbox.d.ts +13 -11
- package/dist/react/model-context/toolbox.d.ts.map +1 -1
- package/dist/react/model-context/toolbox.js +0 -2
- package/dist/react/model-context/useAssistantContext.d.ts +5 -3
- package/dist/react/model-context/useAssistantContext.d.ts.map +1 -1
- package/dist/react/model-context/useAssistantContext.js +13 -14
- package/dist/react/model-context/useAssistantContext.js.map +1 -1
- package/dist/react/model-context/useAssistantDataUI.d.ts +9 -7
- package/dist/react/model-context/useAssistantDataUI.d.ts.map +1 -1
- package/dist/react/model-context/useAssistantDataUI.js +19 -12
- package/dist/react/model-context/useAssistantDataUI.js.map +1 -1
- package/dist/react/model-context/useAssistantInstructions.d.ts +5 -3
- package/dist/react/model-context/useAssistantInstructions.d.ts.map +1 -1
- package/dist/react/model-context/useAssistantInstructions.js +18 -16
- package/dist/react/model-context/useAssistantInstructions.js.map +1 -1
- package/dist/react/model-context/useAssistantInteractable.d.ts +12 -8
- package/dist/react/model-context/useAssistantInteractable.d.ts.map +1 -1
- package/dist/react/model-context/useAssistantInteractable.js +36 -26
- package/dist/react/model-context/useAssistantInteractable.js.map +1 -1
- package/dist/react/model-context/useAssistantTool.d.ts +9 -6
- package/dist/react/model-context/useAssistantTool.d.ts.map +1 -1
- package/dist/react/model-context/useAssistantTool.js +48 -47
- package/dist/react/model-context/useAssistantTool.js.map +1 -1
- package/dist/react/model-context/useAssistantToolUI.d.ts +9 -7
- package/dist/react/model-context/useAssistantToolUI.d.ts.map +1 -1
- package/dist/react/model-context/useAssistantToolUI.js +22 -15
- package/dist/react/model-context/useAssistantToolUI.js.map +1 -1
- package/dist/react/model-context/useInlineRender.d.ts +7 -3
- package/dist/react/model-context/useInlineRender.d.ts.map +1 -1
- package/dist/react/model-context/useInlineRender.js +12 -12
- package/dist/react/model-context/useInlineRender.js.map +1 -1
- package/dist/react/model-context/useInteractableState.d.ts +9 -7
- package/dist/react/model-context/useInteractableState.d.ts.map +1 -1
- package/dist/react/model-context/useInteractableState.js +29 -31
- package/dist/react/model-context/useInteractableState.js.map +1 -1
- package/dist/react/model-context/useToolArgsStatus.d.ts +7 -7
- package/dist/react/model-context/useToolArgsStatus.d.ts.map +1 -1
- package/dist/react/model-context/useToolArgsStatus.js +44 -50
- package/dist/react/model-context/useToolArgsStatus.js.map +1 -1
- package/dist/react/primitive-hooks/useActionBarCopy.d.ts +13 -7
- package/dist/react/primitive-hooks/useActionBarCopy.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useActionBarCopy.js +31 -23
- package/dist/react/primitive-hooks/useActionBarCopy.js.map +1 -1
- package/dist/react/primitive-hooks/useActionBarEdit.d.ts +6 -3
- package/dist/react/primitive-hooks/useActionBarEdit.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useActionBarEdit.js +13 -7
- package/dist/react/primitive-hooks/useActionBarEdit.js.map +1 -1
- package/dist/react/primitive-hooks/useActionBarFeedback.d.ts +9 -6
- package/dist/react/primitive-hooks/useActionBarFeedback.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useActionBarFeedback.js +22 -14
- package/dist/react/primitive-hooks/useActionBarFeedback.js.map +1 -1
- package/dist/react/primitive-hooks/useActionBarReload.d.ts +6 -3
- package/dist/react/primitive-hooks/useActionBarReload.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useActionBarReload.js +13 -9
- package/dist/react/primitive-hooks/useActionBarReload.js.map +1 -1
- package/dist/react/primitive-hooks/useActionBarSpeak.d.ts +6 -3
- package/dist/react/primitive-hooks/useActionBarSpeak.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useActionBarSpeak.js +15 -11
- package/dist/react/primitive-hooks/useActionBarSpeak.js.map +1 -1
- package/dist/react/primitive-hooks/useActionBarStopSpeaking.d.ts +6 -3
- package/dist/react/primitive-hooks/useActionBarStopSpeaking.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useActionBarStopSpeaking.js +13 -7
- package/dist/react/primitive-hooks/useActionBarStopSpeaking.js.map +1 -1
- package/dist/react/primitive-hooks/useBranchPickerNext.d.ts +6 -3
- package/dist/react/primitive-hooks/useBranchPickerNext.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useBranchPickerNext.js +17 -14
- package/dist/react/primitive-hooks/useBranchPickerNext.js.map +1 -1
- package/dist/react/primitive-hooks/useBranchPickerPrevious.d.ts +6 -3
- package/dist/react/primitive-hooks/useBranchPickerPrevious.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useBranchPickerPrevious.js +17 -14
- package/dist/react/primitive-hooks/useBranchPickerPrevious.js.map +1 -1
- package/dist/react/primitive-hooks/useComposerAddAttachment.d.ts +8 -4
- package/dist/react/primitive-hooks/useComposerAddAttachment.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useComposerAddAttachment.js +13 -7
- package/dist/react/primitive-hooks/useComposerAddAttachment.js.map +1 -1
- package/dist/react/primitive-hooks/useComposerCancel.d.ts +6 -3
- package/dist/react/primitive-hooks/useComposerCancel.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useComposerCancel.js +13 -7
- package/dist/react/primitive-hooks/useComposerCancel.js.map +1 -1
- package/dist/react/primitive-hooks/useComposerDictate.d.ts +6 -3
- package/dist/react/primitive-hooks/useComposerDictate.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useComposerDictate.js +13 -9
- package/dist/react/primitive-hooks/useComposerDictate.js.map +1 -1
- package/dist/react/primitive-hooks/useComposerSend.d.ts +8 -4
- package/dist/react/primitive-hooks/useComposerSend.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useComposerSend.js +13 -8
- package/dist/react/primitive-hooks/useComposerSend.js.map +1 -1
- package/dist/react/primitive-hooks/useEditComposerCancel.d.ts +5 -2
- package/dist/react/primitive-hooks/useEditComposerCancel.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useEditComposerCancel.js +9 -6
- package/dist/react/primitive-hooks/useEditComposerCancel.js.map +1 -1
- package/dist/react/primitive-hooks/useEditComposerSend.d.ts +6 -3
- package/dist/react/primitive-hooks/useEditComposerSend.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useEditComposerSend.js +13 -7
- package/dist/react/primitive-hooks/useEditComposerSend.js.map +1 -1
- package/dist/react/primitive-hooks/useMessageBranching.d.ts +8 -5
- package/dist/react/primitive-hooks/useMessageBranching.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useMessageBranching.js +16 -11
- package/dist/react/primitive-hooks/useMessageBranching.js.map +1 -1
- package/dist/react/primitive-hooks/useMessageError.d.ts +4 -1
- package/dist/react/primitive-hooks/useMessageError.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useMessageError.js +6 -5
- package/dist/react/primitive-hooks/useMessageError.js.map +1 -1
- package/dist/react/primitive-hooks/useMessageReload.d.ts +6 -3
- package/dist/react/primitive-hooks/useMessageReload.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useMessageReload.js +13 -7
- package/dist/react/primitive-hooks/useMessageReload.js.map +1 -1
- package/dist/react/primitive-hooks/useSuggestionTrigger.d.ts +14 -7
- package/dist/react/primitive-hooks/useSuggestionTrigger.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useSuggestionTrigger.js +33 -28
- package/dist/react/primitive-hooks/useSuggestionTrigger.js.map +1 -1
- package/dist/react/primitive-hooks/useThreadIsEmpty.d.ts +4 -1
- package/dist/react/primitive-hooks/useThreadIsEmpty.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useThreadIsEmpty.js +6 -2
- package/dist/react/primitive-hooks/useThreadIsEmpty.js.map +1 -1
- package/dist/react/primitive-hooks/useThreadIsRunning.d.ts +4 -1
- package/dist/react/primitive-hooks/useThreadIsRunning.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useThreadIsRunning.js +6 -2
- package/dist/react/primitive-hooks/useThreadIsRunning.js.map +1 -1
- package/dist/react/primitive-hooks/useThreadListItemArchive.d.ts +5 -2
- package/dist/react/primitive-hooks/useThreadListItemArchive.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useThreadListItemArchive.js +9 -6
- package/dist/react/primitive-hooks/useThreadListItemArchive.js.map +1 -1
- package/dist/react/primitive-hooks/useThreadListItemDelete.d.ts +5 -2
- package/dist/react/primitive-hooks/useThreadListItemDelete.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useThreadListItemDelete.js +9 -6
- package/dist/react/primitive-hooks/useThreadListItemDelete.js.map +1 -1
- package/dist/react/primitive-hooks/useThreadListItemTrigger.d.ts +5 -2
- package/dist/react/primitive-hooks/useThreadListItemTrigger.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useThreadListItemTrigger.js +9 -6
- package/dist/react/primitive-hooks/useThreadListItemTrigger.js.map +1 -1
- package/dist/react/primitive-hooks/useThreadListItemUnarchive.d.ts +5 -2
- package/dist/react/primitive-hooks/useThreadListItemUnarchive.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useThreadListItemUnarchive.js +9 -6
- package/dist/react/primitive-hooks/useThreadListItemUnarchive.js.map +1 -1
- package/dist/react/primitive-hooks/useThreadListLoadMore.d.ts +6 -3
- package/dist/react/primitive-hooks/useThreadListLoadMore.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useThreadListLoadMore.js +13 -7
- package/dist/react/primitive-hooks/useThreadListLoadMore.js.map +1 -1
- package/dist/react/primitive-hooks/useThreadListNew.d.ts +5 -2
- package/dist/react/primitive-hooks/useThreadListNew.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useThreadListNew.js +9 -6
- package/dist/react/primitive-hooks/useThreadListNew.js.map +1 -1
- package/dist/react/primitive-hooks/useThreadMessages.d.ts +6 -2
- package/dist/react/primitive-hooks/useThreadMessages.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useThreadMessages.js +6 -2
- package/dist/react/primitive-hooks/useThreadMessages.js.map +1 -1
- package/dist/react/primitive-hooks/useVoice.d.ts +12 -8
- package/dist/react/primitive-hooks/useVoice.d.ts.map +1 -1
- package/dist/react/primitive-hooks/useVoice.js +25 -21
- package/dist/react/primitive-hooks/useVoice.js.map +1 -1
- package/dist/react/primitives/chainOfThought/ChainOfThoughtParts.d.ts +26 -27
- package/dist/react/primitives/chainOfThought/ChainOfThoughtParts.d.ts.map +1 -1
- package/dist/react/primitives/chainOfThought/ChainOfThoughtParts.js +30 -28
- package/dist/react/primitives/chainOfThought/ChainOfThoughtParts.js.map +1 -1
- package/dist/react/primitives/composer/ComposerAttachments.d.ts +27 -26
- package/dist/react/primitives/composer/ComposerAttachments.d.ts.map +1 -1
- package/dist/react/primitives/composer/ComposerAttachments.js +44 -48
- package/dist/react/primitives/composer/ComposerAttachments.js.map +1 -1
- package/dist/react/primitives/composer/ComposerIf.d.ts +12 -13
- package/dist/react/primitives/composer/ComposerIf.d.ts.map +1 -1
- package/dist/react/primitives/composer/ComposerIf.js +16 -17
- package/dist/react/primitives/composer/ComposerIf.js.map +1 -1
- package/dist/react/primitives/composer/ComposerQueue.d.ts +16 -13
- package/dist/react/primitives/composer/ComposerQueue.d.ts.map +1 -1
- package/dist/react/primitives/composer/ComposerQueue.js +31 -23
- package/dist/react/primitives/composer/ComposerQueue.js.map +1 -1
- package/dist/react/primitives/generativeUI/GenerativeUI.d.ts +64 -0
- package/dist/react/primitives/generativeUI/GenerativeUI.d.ts.map +1 -0
- package/dist/react/primitives/generativeUI/GenerativeUI.js +91 -0
- package/dist/react/primitives/generativeUI/GenerativeUI.js.map +1 -0
- package/dist/react/primitives/message/MessageAttachments.d.ts +27 -26
- package/dist/react/primitives/message/MessageAttachments.d.ts.map +1 -1
- package/dist/react/primitives/message/MessageAttachments.js +47 -52
- package/dist/react/primitives/message/MessageAttachments.js.map +1 -1
- package/dist/react/primitives/message/MessageGroupedParts.d.ts +73 -66
- package/dist/react/primitives/message/MessageGroupedParts.d.ts.map +1 -1
- package/dist/react/primitives/message/MessageGroupedParts.js +64 -61
- package/dist/react/primitives/message/MessageGroupedParts.js.map +1 -1
- package/dist/react/primitives/message/MessageParts.d.ts +147 -145
- package/dist/react/primitives/message/MessageParts.d.ts.map +1 -1
- package/dist/react/primitives/message/MessageParts.js +358 -335
- package/dist/react/primitives/message/MessageParts.js.map +1 -1
- package/dist/react/primitives/message/MessageQuote.d.ts +11 -8
- package/dist/react/primitives/message/MessageQuote.d.ts.map +1 -1
- package/dist/react/primitives/message/MessageQuote.js +24 -21
- package/dist/react/primitives/message/MessageQuote.js.map +1 -1
- package/dist/react/primitives/messagePart/MessagePartInProgress.d.ts +8 -4
- package/dist/react/primitives/messagePart/MessagePartInProgress.d.ts.map +1 -1
- package/dist/react/primitives/messagePart/MessagePartInProgress.js +6 -3
- package/dist/react/primitives/messagePart/MessagePartInProgress.js.map +1 -1
- package/dist/react/primitives/part/PartMessages.d.ts +16 -13
- package/dist/react/primitives/part/PartMessages.d.ts.map +1 -1
- package/dist/react/primitives/part/PartMessages.js +45 -41
- package/dist/react/primitives/part/PartMessages.js.map +1 -1
- package/dist/react/primitives/thread/ThreadMessages.d.ts +40 -55
- package/dist/react/primitives/thread/ThreadMessages.d.ts.map +1 -1
- package/dist/react/primitives/thread/ThreadMessages.js +58 -92
- package/dist/react/primitives/thread/ThreadMessages.js.map +1 -1
- package/dist/react/primitives/thread/ThreadSuggestions.d.ts +25 -25
- package/dist/react/primitives/thread/ThreadSuggestions.d.ts.map +1 -1
- package/dist/react/primitives/thread/ThreadSuggestions.js +39 -35
- package/dist/react/primitives/thread/ThreadSuggestions.js.map +1 -1
- package/dist/react/primitives/threadList/ThreadListItems.d.ts +27 -26
- package/dist/react/primitives/threadList/ThreadListItems.d.ts.map +1 -1
- package/dist/react/primitives/threadList/ThreadListItems.js +47 -23
- package/dist/react/primitives/threadList/ThreadListItems.js.map +1 -1
- package/dist/react/primitives/threadListItem/ThreadListItemTitle.d.ts +10 -6
- package/dist/react/primitives/threadListItem/ThreadListItemTitle.d.ts.map +1 -1
- package/dist/react/primitives/threadListItem/ThreadListItemTitle.js +7 -4
- package/dist/react/primitives/threadListItem/ThreadListItemTitle.js.map +1 -1
- package/dist/react/providers/AttachmentByIndexProvider.d.ts +9 -5
- package/dist/react/providers/AttachmentByIndexProvider.d.ts.map +1 -1
- package/dist/react/providers/AttachmentByIndexProvider.js +30 -20
- package/dist/react/providers/AttachmentByIndexProvider.js.map +1 -1
- package/dist/react/providers/ChainOfThoughtByIndicesProvider.d.ts +8 -4
- package/dist/react/providers/ChainOfThoughtByIndicesProvider.d.ts.map +1 -1
- package/dist/react/providers/ChainOfThoughtByIndicesProvider.js +19 -17
- package/dist/react/providers/ChainOfThoughtByIndicesProvider.js.map +1 -1
- package/dist/react/providers/ChainOfThoughtPartByIndexProvider.d.ts +7 -3
- package/dist/react/providers/ChainOfThoughtPartByIndexProvider.d.ts.map +1 -1
- package/dist/react/providers/ChainOfThoughtPartByIndexProvider.js +18 -11
- package/dist/react/providers/ChainOfThoughtPartByIndexProvider.js.map +1 -1
- package/dist/react/providers/MessageByIndexProvider.d.ts +7 -3
- package/dist/react/providers/MessageByIndexProvider.d.ts.map +1 -1
- package/dist/react/providers/MessageByIndexProvider.js +25 -16
- package/dist/react/providers/MessageByIndexProvider.js.map +1 -1
- package/dist/react/providers/PartByIndexProvider.d.ts +7 -3
- package/dist/react/providers/PartByIndexProvider.d.ts.map +1 -1
- package/dist/react/providers/PartByIndexProvider.js +18 -11
- package/dist/react/providers/PartByIndexProvider.js.map +1 -1
- package/dist/react/providers/QueueItemByIndexProvider.d.ts +8 -4
- package/dist/react/providers/QueueItemByIndexProvider.d.ts.map +1 -1
- package/dist/react/providers/QueueItemByIndexProvider.js +14 -10
- package/dist/react/providers/QueueItemByIndexProvider.js.map +1 -1
- package/dist/react/providers/ReadonlyThreadProvider.d.ts +11 -7
- package/dist/react/providers/ReadonlyThreadProvider.d.ts.map +1 -1
- package/dist/react/providers/ReadonlyThreadProvider.js +46 -42
- package/dist/react/providers/ReadonlyThreadProvider.js.map +1 -1
- package/dist/react/providers/SuggestionByIndexProvider.d.ts +8 -4
- package/dist/react/providers/SuggestionByIndexProvider.d.ts.map +1 -1
- package/dist/react/providers/SuggestionByIndexProvider.js +14 -10
- package/dist/react/providers/SuggestionByIndexProvider.js.map +1 -1
- package/dist/react/providers/TextMessagePartProvider.d.ts +8 -4
- package/dist/react/providers/TextMessagePartProvider.d.ts.map +1 -1
- package/dist/react/providers/TextMessagePartProvider.js +29 -22
- package/dist/react/providers/TextMessagePartProvider.js.map +1 -1
- package/dist/react/providers/ThreadListItemByIndexProvider.d.ts +8 -4
- package/dist/react/providers/ThreadListItemByIndexProvider.d.ts.map +1 -1
- package/dist/react/providers/ThreadListItemByIndexProvider.js +22 -11
- package/dist/react/providers/ThreadListItemByIndexProvider.js.map +1 -1
- package/dist/react/providers/ThreadListItemRuntimeProvider.d.ts +8 -4
- package/dist/react/providers/ThreadListItemRuntimeProvider.d.ts.map +1 -1
- package/dist/react/providers/ThreadListItemRuntimeProvider.js +12 -8
- package/dist/react/providers/ThreadListItemRuntimeProvider.js.map +1 -1
- package/dist/react/runtimes/RemoteThreadListHookInstanceManager.d.ts +119 -109
- package/dist/react/runtimes/RemoteThreadListHookInstanceManager.d.ts.map +1 -1
- package/dist/react/runtimes/RemoteThreadListHookInstanceManager.js +123 -129
- package/dist/react/runtimes/RemoteThreadListHookInstanceManager.js.map +1 -1
- package/dist/react/runtimes/RemoteThreadListThreadListRuntimeCore.d.ts +147 -135
- package/dist/react/runtimes/RemoteThreadListThreadListRuntimeCore.d.ts.map +1 -1
- package/dist/react/runtimes/RemoteThreadListThreadListRuntimeCore.js +460 -515
- package/dist/react/runtimes/RemoteThreadListThreadListRuntimeCore.js.map +1 -1
- package/dist/react/runtimes/RuntimeAdapterProvider.d.ts +19 -15
- package/dist/react/runtimes/RuntimeAdapterProvider.d.ts.map +1 -1
- package/dist/react/runtimes/RuntimeAdapterProvider.js +16 -9
- package/dist/react/runtimes/RuntimeAdapterProvider.js.map +1 -1
- package/dist/react/runtimes/cloud/AssistantCloudThreadHistoryAdapter.d.ts +8 -4
- package/dist/react/runtimes/cloud/AssistantCloudThreadHistoryAdapter.d.ts.map +1 -1
- package/dist/react/runtimes/cloud/AssistantCloudThreadHistoryAdapter.js +372 -485
- package/dist/react/runtimes/cloud/AssistantCloudThreadHistoryAdapter.js.map +1 -1
- package/dist/react/runtimes/cloud/CloudFileAttachmentAdapter.d.ts +19 -13
- package/dist/react/runtimes/cloud/CloudFileAttachmentAdapter.d.ts.map +1 -1
- package/dist/react/runtimes/cloud/CloudFileAttachmentAdapter.js +83 -80
- package/dist/react/runtimes/cloud/CloudFileAttachmentAdapter.js.map +1 -1
- package/dist/react/runtimes/cloud/auiV0.d.ts +61 -58
- package/dist/react/runtimes/cloud/auiV0.d.ts.map +1 -1
- package/dist/react/runtimes/cloud/auiV0.js +80 -87
- package/dist/react/runtimes/cloud/auiV0.js.map +1 -1
- package/dist/react/runtimes/cloud/useCloudThreadListAdapter.d.ts +10 -7
- package/dist/react/runtimes/cloud/useCloudThreadListAdapter.d.ts.map +1 -1
- package/dist/react/runtimes/cloud/useCloudThreadListAdapter.js +101 -101
- package/dist/react/runtimes/cloud/useCloudThreadListAdapter.js.map +1 -1
- package/dist/react/runtimes/createMessageConverter.d.ts +23 -14
- package/dist/react/runtimes/createMessageConverter.d.ts.map +1 -1
- package/dist/react/runtimes/createMessageConverter.js +43 -46
- package/dist/react/runtimes/createMessageConverter.js.map +1 -1
- package/dist/react/runtimes/external-message-converter.d.ts +40 -31
- package/dist/react/runtimes/external-message-converter.d.ts.map +1 -1
- package/dist/react/runtimes/external-message-converter.js +222 -296
- package/dist/react/runtimes/external-message-converter.js.map +1 -1
- package/dist/react/runtimes/useExternalStoreRuntime.d.ts +7 -3
- package/dist/react/runtimes/useExternalStoreRuntime.d.ts.map +1 -1
- package/dist/react/runtimes/useExternalStoreRuntime.js +18 -15
- package/dist/react/runtimes/useExternalStoreRuntime.js.map +1 -1
- package/dist/react/runtimes/useLocalRuntime.d.ts +41 -26
- package/dist/react/runtimes/useLocalRuntime.d.ts.map +1 -1
- package/dist/react/runtimes/useLocalRuntime.js +58 -67
- package/dist/react/runtimes/useLocalRuntime.js.map +1 -1
- package/dist/react/runtimes/useRemoteThreadListRuntime.d.ts +7 -3
- package/dist/react/runtimes/useRemoteThreadListRuntime.d.ts.map +1 -1
- package/dist/react/runtimes/useRemoteThreadListRuntime.js +51 -62
- package/dist/react/runtimes/useRemoteThreadListRuntime.js.map +1 -1
- package/dist/react/runtimes/useToolInvocations.d.ts +39 -34
- package/dist/react/runtimes/useToolInvocations.d.ts.map +1 -1
- package/dist/react/runtimes/useToolInvocations.js +371 -481
- package/dist/react/runtimes/useToolInvocations.js.map +1 -1
- package/dist/react/types/MessagePartComponentTypes.d.ts +65 -41
- package/dist/react/types/MessagePartComponentTypes.d.ts.map +1 -1
- package/dist/react/types/MessagePartComponentTypes.js +0 -2
- package/dist/react/types/scopes/dataRenderers.d.ts +15 -11
- package/dist/react/types/scopes/dataRenderers.d.ts.map +1 -1
- package/dist/react/types/scopes/dataRenderers.js +0 -2
- package/dist/react/types/scopes/interactables.d.ts +44 -42
- package/dist/react/types/scopes/interactables.d.ts.map +1 -1
- package/dist/react/types/scopes/interactables.js +0 -2
- package/dist/react/types/scopes/tools.d.ts +16 -12
- package/dist/react/types/scopes/tools.d.ts.map +1 -1
- package/dist/react/types/scopes/tools.js +0 -2
- package/dist/react/types/store-augmentation.d.ts +11 -9
- package/dist/react/types/store-augmentation.d.ts.map +1 -1
- package/dist/react/types/store-augmentation.js +0 -2
- package/dist/react/utils/getMessageQuote.d.ts +9 -6
- package/dist/react/utils/getMessageQuote.d.ts.map +1 -1
- package/dist/react/utils/getMessageQuote.js +8 -5
- package/dist/react/utils/getMessageQuote.js.map +1 -1
- package/dist/react/utils/groupParts.d.ts +22 -19
- package/dist/react/utils/groupParts.d.ts.map +1 -1
- package/dist/react/utils/groupParts.js +62 -89
- package/dist/react/utils/groupParts.js.map +1 -1
- package/dist/runtime/api/assistant-runtime.d.ts +32 -28
- package/dist/runtime/api/assistant-runtime.d.ts.map +1 -1
- package/dist/runtime/api/assistant-runtime.js +25 -22
- package/dist/runtime/api/assistant-runtime.js.map +1 -1
- package/dist/runtime/api/attachment-runtime.d.ts +48 -45
- package/dist/runtime/api/attachment-runtime.d.ts.map +1 -1
- package/dist/runtime/api/attachment-runtime.js +55 -52
- package/dist/runtime/api/attachment-runtime.js.map +1 -1
- package/dist/runtime/api/bindings.d.ts +30 -25
- package/dist/runtime/api/bindings.d.ts.map +1 -1
- package/dist/runtime/api/bindings.js +0 -2
- package/dist/runtime/api/composer-runtime.d.ts +184 -182
- package/dist/runtime/api/composer-runtime.d.ts.map +1 -1
- package/dist/runtime/api/composer-runtime.js +239 -245
- package/dist/runtime/api/composer-runtime.js.map +1 -1
- package/dist/runtime/api/message-part-runtime.d.ts +29 -27
- package/dist/runtime/api/message-part-runtime.d.ts.map +1 -1
- package/dist/runtime/api/message-part-runtime.js +61 -65
- package/dist/runtime/api/message-part-runtime.js.map +1 -1
- package/dist/runtime/api/message-runtime.d.ts +91 -80
- package/dist/runtime/api/message-runtime.d.ts.map +1 -1
- package/dist/runtime/api/message-runtime.js +169 -194
- package/dist/runtime/api/message-runtime.js.map +1 -1
- package/dist/runtime/api/paths.d.ts +57 -54
- package/dist/runtime/api/paths.d.ts.map +1 -1
- package/dist/runtime/api/paths.js +0 -2
- package/dist/runtime/api/thread-list-item-runtime.d.ts +68 -61
- package/dist/runtime/api/thread-list-item-runtime.d.ts.map +1 -1
- package/dist/runtime/api/thread-list-item-runtime.js +85 -84
- package/dist/runtime/api/thread-list-item-runtime.js.map +1 -1
- package/dist/runtime/api/thread-list-runtime.d.ts +57 -48
- package/dist/runtime/api/thread-list-runtime.d.ts.map +1 -1
- package/dist/runtime/api/thread-list-runtime.js +160 -147
- package/dist/runtime/api/thread-list-runtime.js.map +1 -1
- package/dist/runtime/api/thread-runtime.d.ts +278 -272
- package/dist/runtime/api/thread-runtime.d.ts.map +1 -1
- package/dist/runtime/api/thread-runtime.js +244 -244
- package/dist/runtime/api/thread-runtime.js.map +1 -1
- package/dist/runtime/base/base-assistant-runtime-core.d.ts +13 -9
- package/dist/runtime/base/base-assistant-runtime-core.d.ts.map +1 -1
- package/dist/runtime/base/base-assistant-runtime-core.js +13 -9
- package/dist/runtime/base/base-assistant-runtime-core.js.map +1 -1
- package/dist/runtime/base/base-composer-runtime-core.d.ts +60 -57
- package/dist/runtime/base/base-composer-runtime-core.d.ts.map +1 -1
- package/dist/runtime/base/base-composer-runtime-core.js +348 -392
- package/dist/runtime/base/base-composer-runtime-core.js.map +1 -1
- package/dist/runtime/base/base-thread-runtime-core.d.ts +89 -84
- package/dist/runtime/base/base-thread-runtime-core.d.ts.map +1 -1
- package/dist/runtime/base/base-thread-runtime-core.js +349 -357
- package/dist/runtime/base/base-thread-runtime-core.js.map +1 -1
- package/dist/runtime/base/default-edit-composer-runtime-core.d.ts +37 -30
- package/dist/runtime/base/default-edit-composer-runtime-core.d.ts.map +1 -1
- package/dist/runtime/base/default-edit-composer-runtime-core.js +70 -77
- package/dist/runtime/base/default-edit-composer-runtime-core.js.map +1 -1
- package/dist/runtime/base/default-thread-composer-runtime-core.d.ts +25 -21
- package/dist/runtime/base/default-thread-composer-runtime-core.d.ts.map +1 -1
- package/dist/runtime/base/default-thread-composer-runtime-core.js +51 -48
- package/dist/runtime/base/default-thread-composer-runtime-core.js.map +1 -1
- package/dist/runtime/interfaces/assistant-runtime-core.d.ts +12 -8
- package/dist/runtime/interfaces/assistant-runtime-core.d.ts.map +1 -1
- package/dist/runtime/interfaces/assistant-runtime-core.js +0 -2
- package/dist/runtime/interfaces/composer-runtime-core.d.ts +70 -67
- package/dist/runtime/interfaces/composer-runtime-core.d.ts.map +1 -1
- package/dist/runtime/interfaces/composer-runtime-core.js +0 -2
- package/dist/runtime/interfaces/thread-list-runtime-core.d.ts +45 -39
- package/dist/runtime/interfaces/thread-list-runtime-core.d.ts.map +1 -1
- package/dist/runtime/interfaces/thread-list-runtime-core.js +0 -2
- package/dist/runtime/interfaces/thread-runtime-core.d.ts +149 -145
- package/dist/runtime/interfaces/thread-runtime-core.d.ts.map +1 -1
- package/dist/runtime/interfaces/thread-runtime-core.js +0 -2
- package/dist/runtime/internal.d.ts +19 -23
- package/dist/runtime/internal.js +18 -22
- package/dist/runtime/utils/auto-status.d.ts +8 -4
- package/dist/runtime/utils/auto-status.d.ts.map +1 -1
- package/dist/runtime/utils/auto-status.js +18 -22
- package/dist/runtime/utils/auto-status.js.map +1 -1
- package/dist/runtime/utils/chat-model-adapter.d.ts +34 -31
- package/dist/runtime/utils/chat-model-adapter.d.ts.map +1 -1
- package/dist/runtime/utils/chat-model-adapter.js +0 -2
- package/dist/runtime/utils/external-store-message.d.ts +9 -5
- package/dist/runtime/utils/external-store-message.d.ts.map +1 -1
- package/dist/runtime/utils/external-store-message.js +21 -21
- package/dist/runtime/utils/external-store-message.js.map +1 -1
- package/dist/runtime/utils/message-repository.d.ts +48 -42
- package/dist/runtime/utils/message-repository.d.ts.map +1 -1
- package/dist/runtime/utils/message-repository.js +213 -267
- package/dist/runtime/utils/message-repository.js.map +1 -1
- package/dist/runtime/utils/thread-message-like.d.ts +41 -39
- package/dist/runtime/utils/thread-message-like.d.ts.map +1 -1
- package/dist/runtime/utils/thread-message-like.js +125 -139
- package/dist/runtime/utils/thread-message-like.js.map +1 -1
- package/dist/runtimes/assistant-transport/utils.d.ts +4 -1
- package/dist/runtimes/assistant-transport/utils.d.ts.map +1 -1
- package/dist/runtimes/assistant-transport/utils.js +9 -5
- package/dist/runtimes/assistant-transport/utils.js.map +1 -1
- package/dist/runtimes/external-store/external-store-adapter.d.ts +100 -97
- package/dist/runtimes/external-store/external-store-adapter.d.ts.map +1 -1
- package/dist/runtimes/external-store/external-store-adapter.js +0 -2
- package/dist/runtimes/external-store/external-store-runtime-core.d.ts +9 -5
- package/dist/runtimes/external-store/external-store-runtime-core.d.ts.map +1 -1
- package/dist/runtimes/external-store/external-store-runtime-core.js +16 -13
- package/dist/runtimes/external-store/external-store-runtime-core.js.map +1 -1
- package/dist/runtimes/external-store/external-store-thread-list-runtime-core.d.ts +46 -40
- package/dist/runtimes/external-store/external-store-thread-list-runtime-core.d.ts.map +1 -1
- package/dist/runtimes/external-store/external-store-thread-list-runtime-core.js +141 -171
- package/dist/runtimes/external-store/external-store-thread-list-runtime-core.js.map +1 -1
- package/dist/runtimes/external-store/external-store-thread-runtime-core.d.ts +53 -47
- package/dist/runtimes/external-store/external-store-thread-runtime-core.d.ts.map +1 -1
- package/dist/runtimes/external-store/external-store-thread-runtime-core.js +212 -288
- package/dist/runtimes/external-store/external-store-thread-runtime-core.js.map +1 -1
- package/dist/runtimes/external-store/thread-message-converter.d.ts +9 -5
- package/dist/runtimes/external-store/thread-message-converter.d.ts.map +1 -1
- package/dist/runtimes/external-store/thread-message-converter.js +14 -11
- package/dist/runtimes/external-store/thread-message-converter.js.map +1 -1
- package/dist/runtimes/internal.d.ts +15 -19
- package/dist/runtimes/internal.js +13 -17
- package/dist/runtimes/local/local-runtime-core.d.ts +11 -7
- package/dist/runtimes/local/local-runtime-core.d.ts.map +1 -1
- package/dist/runtimes/local/local-runtime-core.js +18 -18
- package/dist/runtimes/local/local-runtime-core.js.map +1 -1
- package/dist/runtimes/local/local-runtime-options.d.ts +27 -23
- package/dist/runtimes/local/local-runtime-options.d.ts.map +1 -1
- package/dist/runtimes/local/local-runtime-options.js +0 -2
- package/dist/runtimes/local/local-thread-list-runtime-core.d.ts +46 -42
- package/dist/runtimes/local/local-thread-list-runtime-core.d.ts.map +1 -1
- package/dist/runtimes/local/local-thread-list-runtime-core.js +84 -83
- package/dist/runtimes/local/local-thread-list-runtime-core.js.map +1 -1
- package/dist/runtimes/local/local-thread-runtime-core.d.ts +80 -59
- package/dist/runtimes/local/local-thread-runtime-core.d.ts.map +1 -1
- package/dist/runtimes/local/local-thread-runtime-core.js +342 -424
- package/dist/runtimes/local/local-thread-runtime-core.js.map +1 -1
- package/dist/runtimes/local/should-continue.d.ts +6 -2
- package/dist/runtimes/local/should-continue.d.ts.map +1 -1
- package/dist/runtimes/local/should-continue.js +7 -12
- package/dist/runtimes/local/should-continue.js.map +1 -1
- package/dist/runtimes/readonly/ReadonlyThreadRuntimeCore.d.ts +96 -92
- package/dist/runtimes/readonly/ReadonlyThreadRuntimeCore.d.ts.map +1 -1
- package/dist/runtimes/readonly/ReadonlyThreadRuntimeCore.js +164 -176
- package/dist/runtimes/readonly/ReadonlyThreadRuntimeCore.js.map +1 -1
- package/dist/runtimes/remote-thread-list/adapter/in-memory.d.ts +15 -11
- package/dist/runtimes/remote-thread-list/adapter/in-memory.d.ts.map +1 -1
- package/dist/runtimes/remote-thread-list/adapter/in-memory.js +33 -28
- package/dist/runtimes/remote-thread-list/adapter/in-memory.js.map +1 -1
- package/dist/runtimes/remote-thread-list/empty-thread-core.d.ts +6 -2
- package/dist/runtimes/remote-thread-list/empty-thread-core.d.ts.map +1 -1
- package/dist/runtimes/remote-thread-list/empty-thread-core.js +152 -160
- package/dist/runtimes/remote-thread-list/empty-thread-core.js.map +1 -1
- package/dist/runtimes/remote-thread-list/optimistic-state.d.ts +27 -27
- package/dist/runtimes/remote-thread-list/optimistic-state.d.ts.map +1 -1
- package/dist/runtimes/remote-thread-list/optimistic-state.js +63 -73
- package/dist/runtimes/remote-thread-list/optimistic-state.js.map +1 -1
- package/dist/runtimes/remote-thread-list/remote-thread-state.d.ts +46 -43
- package/dist/runtimes/remote-thread-list/remote-thread-state.d.ts.map +1 -1
- package/dist/runtimes/remote-thread-list/remote-thread-state.js +81 -91
- package/dist/runtimes/remote-thread-list/remote-thread-state.js.map +1 -1
- package/dist/runtimes/remote-thread-list/types.d.ts +65 -61
- package/dist/runtimes/remote-thread-list/types.d.ts.map +1 -1
- package/dist/runtimes/remote-thread-list/types.js +0 -2
- package/dist/store/clients/chain-of-thought-client.d.ts +16 -12
- package/dist/store/clients/chain-of-thought-client.d.ts.map +1 -1
- package/dist/store/clients/chain-of-thought-client.js +24 -15
- package/dist/store/clients/chain-of-thought-client.js.map +1 -1
- package/dist/store/clients/model-context-client.d.ts +6 -2
- package/dist/store/clients/model-context-client.d.ts.map +1 -1
- package/dist/store/clients/model-context-client.js +32 -26
- package/dist/store/clients/model-context-client.js.map +1 -1
- package/dist/store/clients/no-op-composer-client.d.ts +8 -4
- package/dist/store/clients/no-op-composer-client.d.ts.map +1 -1
- package/dist/store/clients/no-op-composer-client.js +67 -63
- package/dist/store/clients/no-op-composer-client.js.map +1 -1
- package/dist/store/clients/runtime-adapter.d.ts +8 -4
- package/dist/store/clients/runtime-adapter.d.ts.map +1 -1
- package/dist/store/clients/runtime-adapter.js +33 -33
- package/dist/store/clients/runtime-adapter.js.map +1 -1
- package/dist/store/clients/suggestions.d.ts +12 -8
- package/dist/store/clients/suggestions.d.ts.map +1 -1
- package/dist/store/clients/suggestions.js +28 -32
- package/dist/store/clients/suggestions.js.map +1 -1
- package/dist/store/clients/thread-message-client.d.ts +13 -9
- package/dist/store/clients/thread-message-client.d.ts.map +1 -1
- package/dist/store/clients/thread-message-client.js +95 -105
- package/dist/store/clients/thread-message-client.js.map +1 -1
- package/dist/store/index.d.ts +18 -18
- package/dist/store/index.js +6 -8
- package/dist/store/internal.d.ts +9 -9
- package/dist/store/internal.js +9 -9
- package/dist/store/runtime-clients/attachment-runtime-client.d.ts +9 -5
- package/dist/store/runtime-clients/attachment-runtime-client.d.ts.map +1 -1
- package/dist/store/runtime-clients/attachment-runtime-client.js +12 -8
- package/dist/store/runtime-clients/attachment-runtime-client.js.map +1 -1
- package/dist/store/runtime-clients/composer-runtime-client.d.ts +14 -10
- package/dist/store/runtime-clients/composer-runtime-client.d.ts.map +1 -1
- package/dist/store/runtime-clients/composer-runtime-client.js +86 -89
- package/dist/store/runtime-clients/composer-runtime-client.js.map +1 -1
- package/dist/store/runtime-clients/message-part-runtime-client.d.ts +9 -5
- package/dist/store/runtime-clients/message-part-runtime-client.d.ts.map +1 -1
- package/dist/store/runtime-clients/message-part-runtime-client.js +13 -9
- package/dist/store/runtime-clients/message-part-runtime-client.js.map +1 -1
- package/dist/store/runtime-clients/message-runtime-client.d.ts +12 -8
- package/dist/store/runtime-clients/message-runtime-client.d.ts.map +1 -1
- package/dist/store/runtime-clients/message-runtime-client.js +66 -70
- package/dist/store/runtime-clients/message-runtime-client.js.map +1 -1
- package/dist/store/runtime-clients/tap-subscribable.d.ts +6 -2
- package/dist/store/runtime-clients/tap-subscribable.d.ts.map +1 -1
- package/dist/store/runtime-clients/tap-subscribable.js +14 -10
- package/dist/store/runtime-clients/tap-subscribable.js.map +1 -1
- package/dist/store/runtime-clients/thread-list-item-runtime-client.d.ts +9 -5
- package/dist/store/runtime-clients/thread-list-item-runtime-client.d.ts.map +1 -1
- package/dist/store/runtime-clients/thread-list-item-runtime-client.js +33 -38
- package/dist/store/runtime-clients/thread-list-item-runtime-client.js.map +1 -1
- package/dist/store/runtime-clients/thread-list-runtime-client.d.ts +12 -8
- package/dist/store/runtime-clients/thread-list-runtime-client.d.ts.map +1 -1
- package/dist/store/runtime-clients/thread-list-runtime-client.js +53 -53
- package/dist/store/runtime-clients/thread-list-runtime-client.js.map +1 -1
- package/dist/store/runtime-clients/thread-runtime-client.d.ts +9 -5
- package/dist/store/runtime-clients/thread-runtime-client.d.ts.map +1 -1
- package/dist/store/runtime-clients/thread-runtime-client.js +93 -85
- package/dist/store/runtime-clients/thread-runtime-client.js.map +1 -1
- package/dist/store/scope-registration.d.ts +29 -27
- package/dist/store/scope-registration.d.ts.map +1 -1
- package/dist/store/scope-registration.js +0 -2
- package/dist/store/scopes/attachment.d.ts +23 -19
- package/dist/store/scopes/attachment.d.ts.map +1 -1
- package/dist/store/scopes/attachment.js +0 -2
- package/dist/store/scopes/chain-of-thought.d.ts +36 -33
- package/dist/store/scopes/chain-of-thought.d.ts.map +1 -1
- package/dist/store/scopes/chain-of-thought.js +0 -2
- package/dist/store/scopes/composer.d.ts +118 -115
- package/dist/store/scopes/composer.d.ts.map +1 -1
- package/dist/store/scopes/composer.js +0 -2
- package/dist/store/scopes/message.d.ts +81 -81
- package/dist/store/scopes/message.d.ts.map +1 -1
- package/dist/store/scopes/message.js +0 -2
- package/dist/store/scopes/model-context.d.ts +14 -10
- package/dist/store/scopes/model-context.d.ts.map +1 -1
- package/dist/store/scopes/model-context.js +0 -2
- package/dist/store/scopes/part.d.ts +42 -39
- package/dist/store/scopes/part.d.ts.map +1 -1
- package/dist/store/scopes/part.js +0 -2
- package/dist/store/scopes/queue-item.d.ts +18 -15
- package/dist/store/scopes/queue-item.d.ts.map +1 -1
- package/dist/store/scopes/queue-item.js +0 -2
- package/dist/store/scopes/suggestion.d.ts +17 -14
- package/dist/store/scopes/suggestion.d.ts.map +1 -1
- package/dist/store/scopes/suggestion.js +0 -2
- package/dist/store/scopes/suggestions.d.ts +18 -14
- package/dist/store/scopes/suggestions.d.ts.map +1 -1
- package/dist/store/scopes/suggestions.js +0 -2
- package/dist/store/scopes/thread-list-item.d.ts +62 -56
- package/dist/store/scopes/thread-list-item.d.ts.map +1 -1
- package/dist/store/scopes/thread-list-item.js +0 -2
- package/dist/store/scopes/thread.d.ts +151 -149
- package/dist/store/scopes/thread.d.ts.map +1 -1
- package/dist/store/scopes/thread.js +0 -2
- package/dist/store/scopes/threads.d.ts +36 -30
- package/dist/store/scopes/threads.d.ts.map +1 -1
- package/dist/store/scopes/threads.js +0 -2
- package/dist/subscribable/subscribable.d.ts +62 -58
- package/dist/subscribable/subscribable.d.ts.map +1 -1
- package/dist/subscribable/subscribable.js +196 -220
- package/dist/subscribable/subscribable.js.map +1 -1
- package/dist/tests/remote-thread-list-test-helpers.d.ts +13 -9
- package/dist/tests/remote-thread-list-test-helpers.d.ts.map +1 -1
- package/dist/tests/remote-thread-list-test-helpers.js +49 -42
- package/dist/tests/remote-thread-list-test-helpers.js.map +1 -1
- package/dist/types/attachment.d.ts +35 -32
- package/dist/types/attachment.d.ts.map +1 -1
- package/dist/types/attachment.js +0 -2
- package/dist/types/directive.d.ts +15 -13
- package/dist/types/directive.d.ts.map +1 -1
- package/dist/types/directive.js +0 -2
- package/dist/types/index.d.ts +7 -7
- package/dist/types/index.js +0 -2
- package/dist/types/message.d.ts +238 -214
- package/dist/types/message.d.ts.map +1 -1
- package/dist/types/message.js +6 -2
- package/dist/types/message.js.map +1 -1
- package/dist/types/quote.d.ts +6 -3
- package/dist/types/quote.d.ts.map +1 -1
- package/dist/types/quote.js +0 -2
- package/dist/types/trigger.d.ts +14 -10
- package/dist/types/trigger.d.ts.map +1 -1
- package/dist/types/trigger.js +0 -2
- package/dist/types/unsubscribe.d.ts +4 -1
- package/dist/types/unsubscribe.d.ts.map +1 -1
- package/dist/types/unsubscribe.js +0 -2
- package/dist/utils/composite-context-provider.d.ts +11 -8
- package/dist/utils/composite-context-provider.d.ts.map +1 -1
- package/dist/utils/composite-context-provider.js +31 -28
- package/dist/utils/composite-context-provider.js.map +1 -1
- package/dist/utils/id.d.ts +8 -5
- package/dist/utils/id.d.ts.map +1 -1
- package/dist/utils/id.js +9 -5
- package/dist/utils/id.js.map +1 -1
- package/dist/utils/json/is-json-equal.d.ts +4 -1
- package/dist/utils/json/is-json-equal.d.ts.map +1 -1
- package/dist/utils/json/is-json-equal.js +20 -25
- package/dist/utils/json/is-json-equal.js.map +1 -1
- package/dist/utils/json/is-json.d.ts +9 -5
- package/dist/utils/json/is-json.d.ts.map +1 -1
- package/dist/utils/json/is-json.js +17 -28
- package/dist/utils/json/is-json.js.map +1 -1
- package/dist/utils/text.d.ts +6 -2
- package/dist/utils/text.d.ts.map +1 -1
- package/dist/utils/text.js +6 -3
- package/dist/utils/text.js.map +1 -1
- package/package.json +12 -12
- package/src/index.ts +3 -0
- package/src/react/index.ts +17 -0
- package/src/react/primitives/generativeUI/GenerativeUI.tsx +182 -0
- package/src/react/primitives/message/MessageParts.tsx +50 -1
- package/src/react/runtimes/RemoteThreadListHookInstanceManager.tsx +11 -7
- package/src/react/runtimes/RemoteThreadListThreadListRuntimeCore.tsx +7 -2
- package/src/react/runtimes/cloud/auiV0.ts +1 -1
- package/src/react/types/MessagePartComponentTypes.ts +26 -0
- package/src/runtime/api/thread-list-item-runtime.ts +3 -3
- package/src/runtime/api/thread-list-runtime.ts +9 -3
- package/src/runtime/base/base-thread-runtime-core.ts +8 -0
- package/src/runtime/interfaces/thread-list-runtime-core.ts +4 -1
- package/src/runtime/interfaces/thread-runtime-core.ts +6 -5
- package/src/runtime/utils/thread-message-like.ts +11 -3
- package/src/runtimes/external-store/external-store-thread-list-runtime-core.ts +4 -1
- package/src/store/runtime-clients/thread-list-runtime-client.ts +2 -2
- package/src/store/scopes/thread-list-item.ts +1 -1
- package/src/store/scopes/threads.ts +1 -1
- package/src/tests/RemoteThreadListThreadListRuntimeCore-switchToThread-unarchive.test.ts +88 -0
- package/src/tests/external-store-thread-runtime-core.test.ts +83 -0
- package/src/types/index.ts +3 -0
- package/src/types/message.ts +49 -1
- package/dist/adapters/feedback.js.map +0 -1
- package/dist/adapters/index.d.ts.map +0 -1
- package/dist/adapters/index.js.map +0 -1
- package/dist/adapters/suggestion.js.map +0 -1
- package/dist/adapters/thread-history.js.map +0 -1
- package/dist/adapters/trigger.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/internal.d.ts.map +0 -1
- package/dist/internal.js.map +0 -1
- package/dist/model-context/registry-handles.js.map +0 -1
- package/dist/react/index.d.ts.map +0 -1
- package/dist/react/index.js.map +0 -1
- package/dist/react/model-context/toolbox.js.map +0 -1
- package/dist/react/types/MessagePartComponentTypes.js.map +0 -1
- package/dist/react/types/scopes/dataRenderers.js.map +0 -1
- package/dist/react/types/scopes/interactables.js.map +0 -1
- package/dist/react/types/scopes/tools.js.map +0 -1
- package/dist/react/types/store-augmentation.js.map +0 -1
- package/dist/runtime/api/bindings.js.map +0 -1
- package/dist/runtime/api/paths.js.map +0 -1
- package/dist/runtime/interfaces/assistant-runtime-core.js.map +0 -1
- package/dist/runtime/interfaces/composer-runtime-core.js.map +0 -1
- package/dist/runtime/interfaces/thread-list-runtime-core.js.map +0 -1
- package/dist/runtime/interfaces/thread-runtime-core.js.map +0 -1
- package/dist/runtime/internal.d.ts.map +0 -1
- package/dist/runtime/internal.js.map +0 -1
- package/dist/runtime/utils/chat-model-adapter.js.map +0 -1
- package/dist/runtimes/external-store/external-store-adapter.js.map +0 -1
- package/dist/runtimes/internal.d.ts.map +0 -1
- package/dist/runtimes/internal.js.map +0 -1
- package/dist/runtimes/local/local-runtime-options.js.map +0 -1
- package/dist/runtimes/remote-thread-list/types.js.map +0 -1
- package/dist/store/index.d.ts.map +0 -1
- package/dist/store/index.js.map +0 -1
- package/dist/store/internal.d.ts.map +0 -1
- package/dist/store/internal.js.map +0 -1
- package/dist/store/scope-registration.js.map +0 -1
- package/dist/store/scopes/attachment.js.map +0 -1
- package/dist/store/scopes/chain-of-thought.js.map +0 -1
- package/dist/store/scopes/composer.js.map +0 -1
- package/dist/store/scopes/message.js.map +0 -1
- package/dist/store/scopes/model-context.js.map +0 -1
- package/dist/store/scopes/part.js.map +0 -1
- package/dist/store/scopes/queue-item.js.map +0 -1
- package/dist/store/scopes/suggestion.js.map +0 -1
- package/dist/store/scopes/suggestions.js.map +0 -1
- package/dist/store/scopes/thread-list-item.js.map +0 -1
- package/dist/store/scopes/thread.js.map +0 -1
- package/dist/store/scopes/threads.js.map +0 -1
- package/dist/types/attachment.js.map +0 -1
- package/dist/types/directive.js.map +0 -1
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/index.js.map +0 -1
- package/dist/types/quote.js.map +0 -1
- package/dist/types/trigger.js.map +0 -1
- package/dist/types/unsubscribe.js.map +0 -1
|
@@ -1,30 +1,38 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { QueueItemByIndexProvider } from "../../providers/QueueItemByIndexProvider.js";
|
|
2
2
|
import { memo, useMemo } from "react";
|
|
3
3
|
import { RenderChildrenWithAccessor, useAuiState } from "@assistant-ui/store";
|
|
4
|
-
import {
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
//#region src/react/primitives/composer/ComposerQueue.tsx
|
|
5
6
|
const ComposerPrimitiveQueueInner = ({ children }) => {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
const queue = useAuiState((s) => s.composer.queue.length);
|
|
8
|
+
return useMemo(() => Array.from({ length: queue }, (_, index) => /* @__PURE__ */ jsx(QueueItemByIndexProvider, {
|
|
9
|
+
index,
|
|
10
|
+
children: /* @__PURE__ */ jsx(RenderChildrenWithAccessor, {
|
|
11
|
+
getItemState: (aui) => aui.composer().queueItem({ index }).getState(),
|
|
12
|
+
children: (getItem) => children({ get queueItem() {
|
|
13
|
+
return getItem();
|
|
14
|
+
} })
|
|
15
|
+
})
|
|
16
|
+
}, index)), [queue, children]);
|
|
12
17
|
};
|
|
13
18
|
/**
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
19
|
+
* Renders all queue items in the composer.
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```tsx
|
|
23
|
+
* <ComposerPrimitive.Queue>
|
|
24
|
+
* {({ queueItem }) => (
|
|
25
|
+
* <div>
|
|
26
|
+
* <QueueItemPrimitive.Text />
|
|
27
|
+
* <QueueItemPrimitive.Steer>Run Now</QueueItemPrimitive.Steer>
|
|
28
|
+
* </div>
|
|
29
|
+
* )}
|
|
30
|
+
* </ComposerPrimitive.Queue>
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
const ComposerPrimitiveQueue = memo(ComposerPrimitiveQueueInner);
|
|
29
34
|
ComposerPrimitiveQueue.displayName = "ComposerPrimitive.Queue";
|
|
35
|
+
//#endregion
|
|
36
|
+
export { ComposerPrimitiveQueue };
|
|
37
|
+
|
|
30
38
|
//# sourceMappingURL=ComposerQueue.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ComposerQueue.js","
|
|
1
|
+
{"version":3,"file":"ComposerQueue.js","names":[],"sources":["../../../../src/react/primitives/composer/ComposerQueue.tsx"],"sourcesContent":["import { type FC, type ReactNode, memo, useMemo } from \"react\";\nimport { RenderChildrenWithAccessor, useAuiState } from \"@assistant-ui/store\";\nimport type { QueueItemState } from \"../../../store/scopes/queue-item\";\nimport { QueueItemByIndexProvider } from \"../../providers/QueueItemByIndexProvider\";\n\nexport namespace ComposerPrimitiveQueue {\n export type Props = {\n /** Render function called for each queue item. Receives the queue item state. */\n children: (value: { queueItem: QueueItemState }) => ReactNode;\n };\n}\n\nconst ComposerPrimitiveQueueInner: FC<{\n children: (value: { queueItem: QueueItemState }) => ReactNode;\n}> = ({ children }) => {\n const queue = useAuiState((s) => s.composer.queue.length);\n\n return useMemo(\n () =>\n Array.from({ length: queue }, (_, index) => (\n <QueueItemByIndexProvider key={index} index={index}>\n <RenderChildrenWithAccessor\n getItemState={(aui) =>\n aui.composer().queueItem({ index }).getState()\n }\n >\n {(getItem) =>\n children({\n get queueItem() {\n return getItem();\n },\n })\n }\n </RenderChildrenWithAccessor>\n </QueueItemByIndexProvider>\n )),\n [queue, children],\n );\n};\n\n/**\n * Renders all queue items in the composer.\n *\n * @example\n * ```tsx\n * <ComposerPrimitive.Queue>\n * {({ queueItem }) => (\n * <div>\n * <QueueItemPrimitive.Text />\n * <QueueItemPrimitive.Steer>Run Now</QueueItemPrimitive.Steer>\n * </div>\n * )}\n * </ComposerPrimitive.Queue>\n * ```\n */\nexport const ComposerPrimitiveQueue = memo(ComposerPrimitiveQueueInner);\n\nComposerPrimitiveQueue.displayName = \"ComposerPrimitive.Queue\";\n"],"mappings":";;;;;AAYA,MAAM,+BAEA,EAAE,eAAe;CACrB,MAAM,QAAQ,aAAa,MAAM,EAAE,SAAS,MAAM,MAAM;CAExD,OAAO,cAEH,MAAM,KAAK,EAAE,QAAQ,MAAM,IAAI,GAAG,UAChC,oBAAC,0BAAD;EAA6C;YAC3C,oBAAC,4BAAD;GACE,eAAe,QACb,IAAI,SAAS,EAAE,UAAU,EAAE,MAAM,CAAC,EAAE,SAAS;cAG7C,YACA,SAAS,EACP,IAAI,YAAY;IACd,OAAO,QAAQ;GACjB,EACF,CAAC;EAEuB,CAAA;CACJ,GAdK,KAcL,CAC3B,GACH,CAAC,OAAO,QAAQ,CAClB;AACF;;;;;;;;;;;;;;;;AAiBA,MAAa,yBAAyB,KAAK,2BAA2B;AAEtE,uBAAuB,cAAc"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { GenerativeUISpec } from "../../../types/message.js";
|
|
2
|
+
import { GenerativeUIComponentRegistry, GenerativeUIRenderProps } from "../../types/MessagePartComponentTypes.js";
|
|
3
|
+
import { ComponentType, FC } from "react";
|
|
4
|
+
|
|
5
|
+
//#region src/react/primitives/generativeUI/GenerativeUI.d.ts
|
|
6
|
+
/**
|
|
7
|
+
* Thrown when a generative-ui spec references a component name that is not
|
|
8
|
+
* present in the consumer-provided allowlist. The allowlist is the security
|
|
9
|
+
* boundary in the same-realm rendering path — there is no fallback by
|
|
10
|
+
* default. Pass `Fallback` to opt into a soft-fail UX.
|
|
11
|
+
*/
|
|
12
|
+
declare class GenerativeUIRenderError extends Error {
|
|
13
|
+
readonly componentName: string;
|
|
14
|
+
constructor(componentName: string, message?: string);
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Internal renderer. Resolves a {@link GenerativeUISpec} against the consumer
|
|
18
|
+
* allowlist. Used by `MessagePrimitive.GenerativeUI` and by
|
|
19
|
+
* `MessagePrimitive.Parts` when handling a `generative-ui` part.
|
|
20
|
+
*/
|
|
21
|
+
declare const GenerativeUIRender: FC<GenerativeUIRenderProps>;
|
|
22
|
+
declare namespace MessagePrimitiveGenerativeUI {
|
|
23
|
+
type Props = {
|
|
24
|
+
/**
|
|
25
|
+
* The component allowlist. Keys are the names referenced in the spec
|
|
26
|
+
* (e.g. `"Card"`, `"Button"`), values are the React components.
|
|
27
|
+
*
|
|
28
|
+
* This is the security boundary — any name not in the allowlist is
|
|
29
|
+
* rejected with {@link GenerativeUIRenderError}.
|
|
30
|
+
*/
|
|
31
|
+
components: GenerativeUIComponentRegistry;
|
|
32
|
+
/**
|
|
33
|
+
* Optional override spec. If omitted, the primitive reads the
|
|
34
|
+
* `generative-ui` part from the surrounding `MessagePartProvider` /
|
|
35
|
+
* `PartByIndexProvider` context.
|
|
36
|
+
*/
|
|
37
|
+
spec?: GenerativeUISpec | undefined; /** Optional fallback for unknown component names. */
|
|
38
|
+
Fallback?: ComponentType<{
|
|
39
|
+
component: string;
|
|
40
|
+
props?: unknown;
|
|
41
|
+
}> | undefined;
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Renders a generative-ui message part using a consumer-provided allowlist.
|
|
46
|
+
*
|
|
47
|
+
* The agent emits a `generative-ui` message part containing a JSON spec
|
|
48
|
+
* (see {@link GenerativeUISpec}). This primitive walks the spec and resolves
|
|
49
|
+
* each `component` name against the allowlist. Names not in the allowlist
|
|
50
|
+
* throw {@link GenerativeUIRenderError} unless a `Fallback` is provided.
|
|
51
|
+
*
|
|
52
|
+
* Stream-friendly: a partial spec renders progressively as it is filled in.
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
* ```tsx
|
|
56
|
+
* <MessagePrimitive.GenerativeUI
|
|
57
|
+
* components={{ Card: MyCard, Button: MyButton }}
|
|
58
|
+
* />
|
|
59
|
+
* ```
|
|
60
|
+
*/
|
|
61
|
+
declare const MessagePrimitiveGenerativeUI: FC<MessagePrimitiveGenerativeUI.Props>;
|
|
62
|
+
//#endregion
|
|
63
|
+
export { GenerativeUIRender, GenerativeUIRenderError, MessagePrimitiveGenerativeUI };
|
|
64
|
+
//# sourceMappingURL=GenerativeUI.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GenerativeUI.d.ts","names":[],"sources":["../../../../src/react/primitives/generativeUI/GenerativeUI.tsx"],"mappings":";;;;;;;AAyBA;;;;cAAa,uBAAA,SAAgC,KAAK;EAAA,SAChC,aAAA;cAGd,aAAA,UACA,OAAA;AAAA;;;AAA+E;AAuEnF;;cAAa,kBAAA,EAAoB,EAAE,CAAC,uBAAA;AAAA,kBAgBnB,4BAAA;EAAA,KACH,KAAA;IADG;;;;;;;IASb,UAAA,EAAY,6BAAA;IARF;;;;;IAcV,IAAA,GAAO,gBAAA,cAGH;IADJ,QAAA,GACI,aAAA;MAAgB,SAAA;MAAmB,KAAA;IAAA;EAAA;AAAA;;;;;;;AAuBP;;;;;;;;;;;cADvB,4BAAA,EAA8B,EAAE,CAC3C,4BAAA,CAA6B,KAAA"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { createElement, useMemo } from "react";
|
|
3
|
+
import { useAuiState } from "@assistant-ui/store";
|
|
4
|
+
import { Fragment as Fragment$1, jsx } from "react/jsx-runtime";
|
|
5
|
+
//#region src/react/primitives/generativeUI/GenerativeUI.tsx
|
|
6
|
+
/**
|
|
7
|
+
* Thrown when a generative-ui spec references a component name that is not
|
|
8
|
+
* present in the consumer-provided allowlist. The allowlist is the security
|
|
9
|
+
* boundary in the same-realm rendering path — there is no fallback by
|
|
10
|
+
* default. Pass `Fallback` to opt into a soft-fail UX.
|
|
11
|
+
*/
|
|
12
|
+
var GenerativeUIRenderError = class extends Error {
|
|
13
|
+
componentName;
|
|
14
|
+
constructor(componentName, message = `Component "${componentName}" is not in the generative-ui allowlist.`) {
|
|
15
|
+
super(message);
|
|
16
|
+
this.name = "GenerativeUIRenderError";
|
|
17
|
+
this.componentName = componentName;
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
const isObjectNode = (node) => typeof node === "object" && node !== null;
|
|
21
|
+
const renderNode = (node, components, Fallback, path) => {
|
|
22
|
+
if (node === void 0 || node === null) return null;
|
|
23
|
+
if (typeof node === "string") return node;
|
|
24
|
+
if (!isObjectNode(node) || !("component" in node)) {
|
|
25
|
+
if (typeof process !== "undefined" && process.env?.NODE_ENV !== "production") console.warn(`[generative-ui] Skipping malformed node at ${path}:`, node);
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
const { component, props, children, key } = node;
|
|
29
|
+
const Resolved = components[component];
|
|
30
|
+
if (!Resolved) {
|
|
31
|
+
if (Fallback) return /* @__PURE__ */ jsx(Fallback, {
|
|
32
|
+
component,
|
|
33
|
+
props
|
|
34
|
+
}, key ?? path);
|
|
35
|
+
throw new GenerativeUIRenderError(component);
|
|
36
|
+
}
|
|
37
|
+
const renderedChildren = children?.length ? children.map((child, i) => renderNode(child, components, Fallback, `${path}/${i}`)) : void 0;
|
|
38
|
+
return createElement(Resolved, {
|
|
39
|
+
...props ?? {},
|
|
40
|
+
key: key ?? path
|
|
41
|
+
}, ...renderedChildren ?? []);
|
|
42
|
+
};
|
|
43
|
+
const normalizeRoot = (spec) => {
|
|
44
|
+
if (!spec || spec.root === void 0 || spec.root === null) return [];
|
|
45
|
+
const root = spec.root;
|
|
46
|
+
return Array.isArray(root) ? root : [root];
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* Internal renderer. Resolves a {@link GenerativeUISpec} against the consumer
|
|
50
|
+
* allowlist. Used by `MessagePrimitive.GenerativeUI` and by
|
|
51
|
+
* `MessagePrimitive.Parts` when handling a `generative-ui` part.
|
|
52
|
+
*/
|
|
53
|
+
const GenerativeUIRender = ({ spec, components, Fallback }) => {
|
|
54
|
+
return /* @__PURE__ */ jsx(Fragment$1, { children: useMemo(() => normalizeRoot(spec), [spec]).map((node, i) => renderNode(node, components, Fallback, `${i}`)) });
|
|
55
|
+
};
|
|
56
|
+
GenerativeUIRender.displayName = "GenerativeUIRender";
|
|
57
|
+
/**
|
|
58
|
+
* Renders a generative-ui message part using a consumer-provided allowlist.
|
|
59
|
+
*
|
|
60
|
+
* The agent emits a `generative-ui` message part containing a JSON spec
|
|
61
|
+
* (see {@link GenerativeUISpec}). This primitive walks the spec and resolves
|
|
62
|
+
* each `component` name against the allowlist. Names not in the allowlist
|
|
63
|
+
* throw {@link GenerativeUIRenderError} unless a `Fallback` is provided.
|
|
64
|
+
*
|
|
65
|
+
* Stream-friendly: a partial spec renders progressively as it is filled in.
|
|
66
|
+
*
|
|
67
|
+
* @example
|
|
68
|
+
* ```tsx
|
|
69
|
+
* <MessagePrimitive.GenerativeUI
|
|
70
|
+
* components={{ Card: MyCard, Button: MyButton }}
|
|
71
|
+
* />
|
|
72
|
+
* ```
|
|
73
|
+
*/
|
|
74
|
+
const MessagePrimitiveGenerativeUI = ({ components, spec, Fallback }) => {
|
|
75
|
+
const storeSpec = useAuiState((s) => {
|
|
76
|
+
const part = s.part;
|
|
77
|
+
return part?.type === "generative-ui" ? part.spec : void 0;
|
|
78
|
+
});
|
|
79
|
+
const partSpec = spec ?? storeSpec;
|
|
80
|
+
if (!partSpec) return null;
|
|
81
|
+
return /* @__PURE__ */ jsx(GenerativeUIRender, {
|
|
82
|
+
spec: partSpec,
|
|
83
|
+
components,
|
|
84
|
+
Fallback
|
|
85
|
+
});
|
|
86
|
+
};
|
|
87
|
+
MessagePrimitiveGenerativeUI.displayName = "MessagePrimitive.GenerativeUI";
|
|
88
|
+
//#endregion
|
|
89
|
+
export { GenerativeUIRender, GenerativeUIRenderError, MessagePrimitiveGenerativeUI };
|
|
90
|
+
|
|
91
|
+
//# sourceMappingURL=GenerativeUI.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GenerativeUI.js","names":[],"sources":["../../../../src/react/primitives/generativeUI/GenerativeUI.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n type ComponentType,\n type FC,\n type ReactNode,\n createElement,\n useMemo,\n} from \"react\";\nimport { useAuiState } from \"@assistant-ui/store\";\nimport type {\n GenerativeUINode,\n GenerativeUISpec,\n} from \"../../../types/message\";\nimport type {\n GenerativeUIComponentRegistry,\n GenerativeUIRenderProps,\n} from \"../../types/MessagePartComponentTypes\";\n\n/**\n * Thrown when a generative-ui spec references a component name that is not\n * present in the consumer-provided allowlist. The allowlist is the security\n * boundary in the same-realm rendering path — there is no fallback by\n * default. Pass `Fallback` to opt into a soft-fail UX.\n */\nexport class GenerativeUIRenderError extends Error {\n public readonly componentName: string;\n\n constructor(\n componentName: string,\n message = `Component \"${componentName}\" is not in the generative-ui allowlist.`,\n ) {\n super(message);\n this.name = \"GenerativeUIRenderError\";\n this.componentName = componentName;\n }\n}\n\nconst isObjectNode = (\n node: GenerativeUINode,\n): node is Exclude<GenerativeUINode, string> =>\n typeof node === \"object\" && node !== null;\n\nconst renderNode = (\n node: GenerativeUINode | undefined,\n components: GenerativeUIComponentRegistry,\n Fallback: GenerativeUIRenderProps[\"Fallback\"],\n path: string,\n): ReactNode => {\n if (node === undefined || node === null) return null;\n\n if (typeof node === \"string\") return node;\n\n if (!isObjectNode(node) || !(\"component\" in node)) {\n if (\n typeof process !== \"undefined\" &&\n process.env?.NODE_ENV !== \"production\"\n ) {\n console.warn(`[generative-ui] Skipping malformed node at ${path}:`, node);\n }\n return null;\n }\n\n const { component, props, children, key } = node;\n\n const Resolved = components[component];\n if (!Resolved) {\n if (Fallback) {\n return <Fallback key={key ?? path} component={component} props={props} />;\n }\n throw new GenerativeUIRenderError(component);\n }\n\n const renderedChildren = children?.length\n ? children.map((child, i) =>\n renderNode(child, components, Fallback, `${path}/${i}`),\n )\n : undefined;\n\n return createElement(\n Resolved,\n { ...(props ?? {}), key: key ?? path },\n ...(renderedChildren ?? []),\n );\n};\n\nconst normalizeRoot = (\n spec: GenerativeUISpec | undefined,\n): readonly GenerativeUINode[] => {\n if (!spec || spec.root === undefined || spec.root === null) return [];\n const root = spec.root;\n return Array.isArray(root)\n ? (root as readonly GenerativeUINode[])\n : [root as GenerativeUINode];\n};\n\n/**\n * Internal renderer. Resolves a {@link GenerativeUISpec} against the consumer\n * allowlist. Used by `MessagePrimitive.GenerativeUI` and by\n * `MessagePrimitive.Parts` when handling a `generative-ui` part.\n */\nexport const GenerativeUIRender: FC<GenerativeUIRenderProps> = ({\n spec,\n components,\n Fallback,\n}) => {\n const nodes = useMemo(() => normalizeRoot(spec), [spec]);\n\n return (\n <>\n {nodes.map((node, i) => renderNode(node, components, Fallback, `${i}`))}\n </>\n );\n};\n\nGenerativeUIRender.displayName = \"GenerativeUIRender\";\n\nexport namespace MessagePrimitiveGenerativeUI {\n export type Props = {\n /**\n * The component allowlist. Keys are the names referenced in the spec\n * (e.g. `\"Card\"`, `\"Button\"`), values are the React components.\n *\n * This is the security boundary — any name not in the allowlist is\n * rejected with {@link GenerativeUIRenderError}.\n */\n components: GenerativeUIComponentRegistry;\n /**\n * Optional override spec. If omitted, the primitive reads the\n * `generative-ui` part from the surrounding `MessagePartProvider` /\n * `PartByIndexProvider` context.\n */\n spec?: GenerativeUISpec | undefined;\n /** Optional fallback for unknown component names. */\n Fallback?:\n | ComponentType<{ component: string; props?: unknown }>\n | undefined;\n };\n}\n\n/**\n * Renders a generative-ui message part using a consumer-provided allowlist.\n *\n * The agent emits a `generative-ui` message part containing a JSON spec\n * (see {@link GenerativeUISpec}). This primitive walks the spec and resolves\n * each `component` name against the allowlist. Names not in the allowlist\n * throw {@link GenerativeUIRenderError} unless a `Fallback` is provided.\n *\n * Stream-friendly: a partial spec renders progressively as it is filled in.\n *\n * @example\n * ```tsx\n * <MessagePrimitive.GenerativeUI\n * components={{ Card: MyCard, Button: MyButton }}\n * />\n * ```\n */\nexport const MessagePrimitiveGenerativeUI: FC<\n MessagePrimitiveGenerativeUI.Props\n> = ({ components, spec, Fallback }) => {\n // Selector reads store state only — combining with the `spec` prop inside\n // the selector closes over a value that may change identity per render and\n // would trigger spurious tearing-detection re-renders in\n // `useSyncExternalStore`.\n const storeSpec = useAuiState((s) => {\n const part = s.part as { type?: string; spec?: GenerativeUISpec };\n return part?.type === \"generative-ui\" ? part.spec : undefined;\n });\n const partSpec = spec ?? storeSpec;\n\n if (!partSpec) return null;\n\n return (\n <GenerativeUIRender\n spec={partSpec}\n components={components}\n Fallback={Fallback}\n />\n );\n};\n\nMessagePrimitiveGenerativeUI.displayName = \"MessagePrimitive.GenerativeUI\";\n"],"mappings":";;;;;;;;;;;AAyBA,IAAa,0BAAb,cAA6C,MAAM;CACjD;CAEA,YACE,eACA,UAAU,cAAc,cAAc,2CACtC;EACA,MAAM,OAAO;EACb,KAAK,OAAO;EACZ,KAAK,gBAAgB;CACvB;AACF;AAEA,MAAM,gBACJ,SAEA,OAAO,SAAS,YAAY,SAAS;AAEvC,MAAM,cACJ,MACA,YACA,UACA,SACc;CACd,IAAI,SAAS,KAAA,KAAa,SAAS,MAAM,OAAO;CAEhD,IAAI,OAAO,SAAS,UAAU,OAAO;CAErC,IAAI,CAAC,aAAa,IAAI,KAAK,EAAE,eAAe,OAAO;EACjD,IACE,OAAO,YAAY,eACnB,QAAQ,KAAK,aAAa,cAE1B,QAAQ,KAAK,8CAA8C,KAAK,IAAI,IAAI;EAE1E,OAAO;CACT;CAEA,MAAM,EAAE,WAAW,OAAO,UAAU,QAAQ;CAE5C,MAAM,WAAW,WAAW;CAC5B,IAAI,CAAC,UAAU;EACb,IAAI,UACF,OAAO,oBAAC,UAAD;GAAuC;GAAkB;EAAQ,GAAlD,OAAO,IAA2C;EAE1E,MAAM,IAAI,wBAAwB,SAAS;CAC7C;CAEA,MAAM,mBAAmB,UAAU,SAC/B,SAAS,KAAK,OAAO,MACnB,WAAW,OAAO,YAAY,UAAU,GAAG,KAAK,GAAG,GAAG,CACxD,IACA,KAAA;CAEJ,OAAO,cACL,UACA;EAAE,GAAI,SAAS,CAAC;EAAI,KAAK,OAAO;CAAK,GACrC,GAAI,oBAAoB,CAAC,CAC3B;AACF;AAEA,MAAM,iBACJ,SACgC;CAChC,IAAI,CAAC,QAAQ,KAAK,SAAS,KAAA,KAAa,KAAK,SAAS,MAAM,OAAO,CAAC;CACpE,MAAM,OAAO,KAAK;CAClB,OAAO,MAAM,QAAQ,IAAI,IACpB,OACD,CAAC,IAAwB;AAC/B;;;;;;AAOA,MAAa,sBAAmD,EAC9D,MACA,YACA,eACI;CAGJ,OACE,oBAAA,YAAA,EAAA,UAHY,cAAc,cAAc,IAAI,GAAG,CAAC,IAAI,CAI7C,EAAE,KAAK,MAAM,MAAM,WAAW,MAAM,YAAY,UAAU,GAAG,GAAG,CAAC,EACtE,CAAA;AAEN;AAEA,mBAAmB,cAAc;;;;;;;;;;;;;;;;;;AA0CjC,MAAa,gCAER,EAAE,YAAY,MAAM,eAAe;CAKtC,MAAM,YAAY,aAAa,MAAM;EACnC,MAAM,OAAO,EAAE;EACf,OAAO,MAAM,SAAS,kBAAkB,KAAK,OAAO,KAAA;CACtD,CAAC;CACD,MAAM,WAAW,QAAQ;CAEzB,IAAI,CAAC,UAAU,OAAO;CAEtB,OACE,oBAAC,oBAAD;EACE,MAAM;EACM;EACF;CACX,CAAA;AAEL;AAEA,6BAA6B,cAAc"}
|
|
@@ -1,34 +1,35 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
1
|
+
import { CompleteAttachment } from "../../../types/attachment.js";
|
|
2
|
+
import { ComponentType, FC, ReactNode } from "react";
|
|
3
|
+
|
|
4
|
+
//#region src/react/primitives/message/MessageAttachments.d.ts
|
|
3
5
|
type MessageAttachmentsComponentConfig = {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
Image?: ComponentType | undefined;
|
|
7
|
+
Document?: ComponentType | undefined;
|
|
8
|
+
File?: ComponentType | undefined;
|
|
9
|
+
Attachment?: ComponentType | undefined;
|
|
8
10
|
};
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
components?: never;
|
|
20
|
-
};
|
|
11
|
+
declare namespace MessagePrimitiveAttachments {
|
|
12
|
+
type Props = {
|
|
13
|
+
/** @deprecated Use the children render function instead. */components: MessageAttachmentsComponentConfig;
|
|
14
|
+
children?: never;
|
|
15
|
+
} | {
|
|
16
|
+
/** Render function called for each attachment. Receives the attachment. */children: (value: {
|
|
17
|
+
attachment: CompleteAttachment;
|
|
18
|
+
}) => ReactNode;
|
|
19
|
+
components?: never;
|
|
20
|
+
};
|
|
21
21
|
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
22
|
+
declare namespace MessagePrimitiveAttachmentByIndex {
|
|
23
|
+
type Props = {
|
|
24
|
+
index: number;
|
|
25
|
+
components?: MessageAttachmentsComponentConfig;
|
|
26
|
+
};
|
|
27
27
|
}
|
|
28
28
|
/**
|
|
29
29
|
* Renders a single attachment at the specified index within the current message.
|
|
30
30
|
*/
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
declare const MessagePrimitiveAttachmentByIndex: FC<MessagePrimitiveAttachmentByIndex.Props>;
|
|
32
|
+
declare const MessagePrimitiveAttachments: FC<MessagePrimitiveAttachments.Props>;
|
|
33
|
+
//#endregion
|
|
34
|
+
export { MessagePrimitiveAttachmentByIndex, MessagePrimitiveAttachments };
|
|
34
35
|
//# sourceMappingURL=MessageAttachments.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MessageAttachments.d.ts","
|
|
1
|
+
{"version":3,"file":"MessageAttachments.d.ts","names":[],"sources":["../../../../src/react/primitives/message/MessageAttachments.tsx"],"mappings":";;;;KAWK,iCAAA;EACH,KAAA,GAAQ,aAAA;EACR,QAAA,GAAW,aAAA;EACX,IAAA,GAAO,aAAA;EACP,UAAA,GAAa,aAAA;AAAA;AAAA,kBAGE,2BAAA;EAAA,KACH,KAAA;IAJC,4DAOP,UAAA,EAAY,iCAAA;IACZ,QAAA;EAAA;IAXE,2EAeF,QAAA,GAAW,KAAA;MAAS,UAAA,EAAY,kBAAA;IAAA,MAAyB,SAAA;IACzD,UAAA;EAAA;AAAA;AAAA,kBAgCS,iCAAA;EAAA,KACH,KAAA;IACV,KAAA;IACA,UAAA,GAAa,iCAAiC;EAAA;AAAA;;;;cAOrC,iCAAA,EAAmC,EAAE,CAAC,iCAAA,CAAkC,KAAA;AAAA,cAmDxE,2BAAA,EAA6B,EAAE,CAC1C,2BAAA,CAA4B,KAAA"}
|
|
@@ -1,63 +1,58 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { memo, useMemo, } from "react";
|
|
3
|
-
import { RenderChildrenWithAccessor, useAuiState } from "@assistant-ui/store";
|
|
4
1
|
import { MessageAttachmentByIndexProvider } from "../../providers/AttachmentByIndexProvider.js";
|
|
2
|
+
import { memo, useMemo } from "react";
|
|
3
|
+
import { RenderChildrenWithAccessor, useAuiState } from "@assistant-ui/store";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
//#region src/react/primitives/message/MessageAttachments.tsx
|
|
5
6
|
const getComponent = (components, attachment) => {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
case "file":
|
|
13
|
-
return components?.File ?? components?.Attachment;
|
|
14
|
-
default:
|
|
15
|
-
return components?.Attachment;
|
|
16
|
-
}
|
|
7
|
+
switch (attachment.type) {
|
|
8
|
+
case "image": return components?.Image ?? components?.Attachment;
|
|
9
|
+
case "document": return components?.Document ?? components?.Attachment;
|
|
10
|
+
case "file": return components?.File ?? components?.Attachment;
|
|
11
|
+
default: return components?.Attachment;
|
|
12
|
+
}
|
|
17
13
|
};
|
|
18
14
|
const AttachmentComponent = ({ components }) => {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
return null;
|
|
25
|
-
return _jsx(Component, {});
|
|
15
|
+
const attachment = useAuiState((s) => s.attachment);
|
|
16
|
+
if (!attachment) return null;
|
|
17
|
+
const Component = getComponent(components, attachment);
|
|
18
|
+
if (!Component) return null;
|
|
19
|
+
return /* @__PURE__ */ jsx(Component, {});
|
|
26
20
|
};
|
|
27
21
|
/**
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
MessagePrimitiveAttachmentByIndex.displayName =
|
|
38
|
-
"MessagePrimitive.AttachmentByIndex";
|
|
22
|
+
* Renders a single attachment at the specified index within the current message.
|
|
23
|
+
*/
|
|
24
|
+
const MessagePrimitiveAttachmentByIndex = memo(({ index, components }) => {
|
|
25
|
+
return /* @__PURE__ */ jsx(MessageAttachmentByIndexProvider, {
|
|
26
|
+
index,
|
|
27
|
+
children: /* @__PURE__ */ jsx(AttachmentComponent, { components })
|
|
28
|
+
});
|
|
29
|
+
}, (prev, next) => prev.index === next.index && prev.components?.Image === next.components?.Image && prev.components?.Document === next.components?.Document && prev.components?.File === next.components?.File && prev.components?.Attachment === next.components?.Attachment);
|
|
30
|
+
MessagePrimitiveAttachmentByIndex.displayName = "MessagePrimitive.AttachmentByIndex";
|
|
39
31
|
const MessagePrimitiveAttachmentsInner = ({ children }) => {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
32
|
+
const attachmentsCount = useAuiState((s) => {
|
|
33
|
+
if (s.message.role !== "user") return 0;
|
|
34
|
+
return (s.message.attachments ?? []).length;
|
|
35
|
+
});
|
|
36
|
+
return useMemo(() => Array.from({ length: attachmentsCount }, (_, index) => /* @__PURE__ */ jsx(MessageAttachmentByIndexProvider, {
|
|
37
|
+
index,
|
|
38
|
+
children: /* @__PURE__ */ jsx(RenderChildrenWithAccessor, {
|
|
39
|
+
getItemState: (aui) => aui.message().attachment({ index }).getState(),
|
|
40
|
+
children: (getItem) => children({ get attachment() {
|
|
41
|
+
return getItem();
|
|
42
|
+
} })
|
|
43
|
+
})
|
|
44
|
+
}, index)), [attachmentsCount, children]);
|
|
50
45
|
};
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
} }));
|
|
59
|
-
}
|
|
60
|
-
return (_jsx(MessagePrimitiveAttachmentsInner, { children: children }));
|
|
46
|
+
const MessagePrimitiveAttachments = ({ components, children }) => {
|
|
47
|
+
if (components) return /* @__PURE__ */ jsx(MessagePrimitiveAttachmentsInner, { children: ({ attachment }) => {
|
|
48
|
+
const Component = getComponent(components, attachment);
|
|
49
|
+
if (!Component) return null;
|
|
50
|
+
return /* @__PURE__ */ jsx(Component, {});
|
|
51
|
+
} });
|
|
52
|
+
return /* @__PURE__ */ jsx(MessagePrimitiveAttachmentsInner, { children });
|
|
61
53
|
};
|
|
62
54
|
MessagePrimitiveAttachments.displayName = "MessagePrimitive.Attachments";
|
|
55
|
+
//#endregion
|
|
56
|
+
export { MessagePrimitiveAttachmentByIndex, MessagePrimitiveAttachments };
|
|
57
|
+
|
|
63
58
|
//# sourceMappingURL=MessageAttachments.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MessageAttachments.js","
|
|
1
|
+
{"version":3,"file":"MessageAttachments.js","names":[],"sources":["../../../../src/react/primitives/message/MessageAttachments.tsx"],"sourcesContent":["import type { CompleteAttachment } from \"../../../types/attachment\";\nimport {\n type ComponentType,\n type FC,\n type ReactNode,\n memo,\n useMemo,\n} from \"react\";\nimport { RenderChildrenWithAccessor, useAuiState } from \"@assistant-ui/store\";\nimport { MessageAttachmentByIndexProvider } from \"../../providers/AttachmentByIndexProvider\";\n\ntype MessageAttachmentsComponentConfig = {\n Image?: ComponentType | undefined;\n Document?: ComponentType | undefined;\n File?: ComponentType | undefined;\n Attachment?: ComponentType | undefined;\n};\n\nexport namespace MessagePrimitiveAttachments {\n export type Props =\n | {\n /** @deprecated Use the children render function instead. */\n components: MessageAttachmentsComponentConfig;\n children?: never;\n }\n | {\n /** Render function called for each attachment. Receives the attachment. */\n children: (value: { attachment: CompleteAttachment }) => ReactNode;\n components?: never;\n };\n}\n\nconst getComponent = (\n components: MessageAttachmentsComponentConfig | undefined,\n attachment: CompleteAttachment,\n) => {\n const type = attachment.type;\n switch (type) {\n case \"image\":\n return components?.Image ?? components?.Attachment;\n case \"document\":\n return components?.Document ?? components?.Attachment;\n case \"file\":\n return components?.File ?? components?.Attachment;\n default:\n return components?.Attachment;\n }\n};\n\nconst AttachmentComponent: FC<{\n components: MessageAttachmentsComponentConfig | undefined;\n}> = ({ components }) => {\n const attachment = useAuiState((s) => s.attachment);\n if (!attachment) return null;\n\n const Component = getComponent(components, attachment as CompleteAttachment);\n if (!Component) return null;\n return <Component />;\n};\n\nexport namespace MessagePrimitiveAttachmentByIndex {\n export type Props = {\n index: number;\n components?: MessageAttachmentsComponentConfig;\n };\n}\n\n/**\n * Renders a single attachment at the specified index within the current message.\n */\nexport const MessagePrimitiveAttachmentByIndex: FC<MessagePrimitiveAttachmentByIndex.Props> =\n memo(\n ({ index, components }) => {\n return (\n <MessageAttachmentByIndexProvider index={index}>\n <AttachmentComponent components={components} />\n </MessageAttachmentByIndexProvider>\n );\n },\n (prev, next) =>\n prev.index === next.index &&\n prev.components?.Image === next.components?.Image &&\n prev.components?.Document === next.components?.Document &&\n prev.components?.File === next.components?.File &&\n prev.components?.Attachment === next.components?.Attachment,\n );\n\nMessagePrimitiveAttachmentByIndex.displayName =\n \"MessagePrimitive.AttachmentByIndex\";\n\nconst MessagePrimitiveAttachmentsInner: FC<{\n children: (value: { attachment: CompleteAttachment }) => ReactNode;\n}> = ({ children }) => {\n const attachmentsCount = useAuiState((s) => {\n if (s.message.role !== \"user\") return 0;\n return (s.message.attachments ?? []).length;\n });\n\n return useMemo(\n () =>\n Array.from({ length: attachmentsCount }, (_, index) => (\n <MessageAttachmentByIndexProvider key={index} index={index}>\n <RenderChildrenWithAccessor\n getItemState={(aui) =>\n aui.message().attachment({ index }).getState()\n }\n >\n {(getItem) =>\n children({\n get attachment() {\n return getItem() as CompleteAttachment;\n },\n })\n }\n </RenderChildrenWithAccessor>\n </MessageAttachmentByIndexProvider>\n )),\n [attachmentsCount, children],\n );\n};\n\nexport const MessagePrimitiveAttachments: FC<\n MessagePrimitiveAttachments.Props\n> = ({ components, children }) => {\n if (components) {\n return (\n <MessagePrimitiveAttachmentsInner>\n {({ attachment }) => {\n const Component = getComponent(components, attachment);\n if (!Component) return null;\n return <Component />;\n }}\n </MessagePrimitiveAttachmentsInner>\n );\n }\n return (\n <MessagePrimitiveAttachmentsInner>\n {children}\n </MessagePrimitiveAttachmentsInner>\n );\n};\n\nMessagePrimitiveAttachments.displayName = \"MessagePrimitive.Attachments\";\n"],"mappings":";;;;;AAgCA,MAAM,gBACJ,YACA,eACG;CAEH,QADa,WAAW,MACxB;EACE,KAAK,SACH,OAAO,YAAY,SAAS,YAAY;EAC1C,KAAK,YACH,OAAO,YAAY,YAAY,YAAY;EAC7C,KAAK,QACH,OAAO,YAAY,QAAQ,YAAY;EACzC,SACE,OAAO,YAAY;CACvB;AACF;AAEA,MAAM,uBAEA,EAAE,iBAAiB;CACvB,MAAM,aAAa,aAAa,MAAM,EAAE,UAAU;CAClD,IAAI,CAAC,YAAY,OAAO;CAExB,MAAM,YAAY,aAAa,YAAY,UAAgC;CAC3E,IAAI,CAAC,WAAW,OAAO;CACvB,OAAO,oBAAC,WAAD,CAAY,CAAA;AACrB;;;;AAYA,MAAa,oCACX,MACG,EAAE,OAAO,iBAAiB;CACzB,OACE,oBAAC,kCAAD;EAAyC;YACvC,oBAAC,qBAAD,EAAiC,WAAa,CAAA;CACd,CAAA;AAEtC,IACC,MAAM,SACL,KAAK,UAAU,KAAK,SACpB,KAAK,YAAY,UAAU,KAAK,YAAY,SAC5C,KAAK,YAAY,aAAa,KAAK,YAAY,YAC/C,KAAK,YAAY,SAAS,KAAK,YAAY,QAC3C,KAAK,YAAY,eAAe,KAAK,YAAY,UACrD;AAEF,kCAAkC,cAChC;AAEF,MAAM,oCAEA,EAAE,eAAe;CACrB,MAAM,mBAAmB,aAAa,MAAM;EAC1C,IAAI,EAAE,QAAQ,SAAS,QAAQ,OAAO;EACtC,QAAQ,EAAE,QAAQ,eAAe,CAAC,GAAG;CACvC,CAAC;CAED,OAAO,cAEH,MAAM,KAAK,EAAE,QAAQ,iBAAiB,IAAI,GAAG,UAC3C,oBAAC,kCAAD;EAAqD;YACnD,oBAAC,4BAAD;GACE,eAAe,QACb,IAAI,QAAQ,EAAE,WAAW,EAAE,MAAM,CAAC,EAAE,SAAS;cAG7C,YACA,SAAS,EACP,IAAI,aAAa;IACf,OAAO,QAAQ;GACjB,EACF,CAAC;EAEuB,CAAA;CACI,GAdK,KAcL,CACnC,GACH,CAAC,kBAAkB,QAAQ,CAC7B;AACF;AAEA,MAAa,+BAER,EAAE,YAAY,eAAe;CAChC,IAAI,YACF,OACE,oBAAC,kCAAD,EAAA,WACI,EAAE,iBAAiB;EACnB,MAAM,YAAY,aAAa,YAAY,UAAU;EACrD,IAAI,CAAC,WAAW,OAAO;EACvB,OAAO,oBAAC,WAAD,CAAY,CAAA;CACrB,EACgC,CAAA;CAGtC,OACE,oBAAC,kCAAD,EACG,SAC+B,CAAA;AAEtC;AAEA,4BAA4B,cAAc"}
|
|
@@ -1,68 +1,70 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
1
|
+
import { MessagePartStatus, ToolCallMessagePartStatus } from "../../../types/message.js";
|
|
2
|
+
import { PartState } from "../../../store/scopes/part.js";
|
|
3
|
+
import { EnrichedPartState } from "./MessageParts.js";
|
|
4
|
+
import { GroupKey } from "../../utils/groupParts.js";
|
|
5
|
+
import { ReactNode } from "react";
|
|
6
|
+
|
|
7
|
+
//#region src/react/primitives/message/MessageGroupedParts.d.ts
|
|
8
|
+
declare namespace MessagePrimitiveGroupedParts {
|
|
9
|
+
/**
|
|
10
|
+
* A coalesced group of adjacent parts. Surfaced through the same
|
|
11
|
+
* `{ part }` channel as a leaf {@link EnrichedPartState} so consumers
|
|
12
|
+
* dispatch on a single `switch (part.type)`. `type` is the group key
|
|
13
|
+
* (always `"group-…"`); `status` mirrors the last contained part.
|
|
14
|
+
*/
|
|
15
|
+
type GroupPart<TKey extends `group-${string}` = `group-${string}`> = {
|
|
16
|
+
readonly type: TKey;
|
|
17
|
+
readonly status: MessagePartStatus | ToolCallMessagePartStatus;
|
|
18
|
+
readonly indices: readonly number[];
|
|
19
|
+
};
|
|
20
|
+
type RenderInfo<TKey extends `group-${string}` = `group-${string}`> = {
|
|
7
21
|
/**
|
|
8
|
-
*
|
|
9
|
-
* `
|
|
10
|
-
*
|
|
11
|
-
* (always `"group-…"`); `status` mirrors the last contained part.
|
|
22
|
+
* Either a coalesced group ({@link GroupPart}, identified by a
|
|
23
|
+
* `group-…` `type`) or a single enriched part. Use one switch over
|
|
24
|
+
* `part.type` to handle both.
|
|
12
25
|
*/
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* Render function called once per group node and once per leaf part.
|
|
57
|
-
* Switch on `part.type`: `"group-…"` cases wrap `children`; real
|
|
58
|
-
* part types (`"text"`, `"tool-call"`, …) render the part directly.
|
|
59
|
-
*
|
|
60
|
-
* Leaf parts receive the same {@link EnrichedPartState} that
|
|
61
|
-
* `<MessagePrimitive.Parts>` would produce (`toolUI`, `addResult`,
|
|
62
|
-
* `resume`, `dataRendererUI`).
|
|
63
|
-
*/
|
|
64
|
-
readonly children: (info: RenderInfo<TKey>) => ReactNode;
|
|
65
|
-
};
|
|
26
|
+
readonly part: GroupPart<TKey> | EnrichedPartState;
|
|
27
|
+
/**
|
|
28
|
+
* For group nodes: the recursively-rendered subtree (subgroups +
|
|
29
|
+
* leaf parts). For leaf parts: a sentinel that throws when rendered
|
|
30
|
+
* — accidental fall-through (`default: return children;`) errors
|
|
31
|
+
* loudly instead of silently rendering nothing.
|
|
32
|
+
*/
|
|
33
|
+
readonly children: ReactNode;
|
|
34
|
+
};
|
|
35
|
+
type Props<TKey extends `group-${string}` = `group-${string}`> = {
|
|
36
|
+
/**
|
|
37
|
+
* Maps each part to its group key path. Adjacent parts that share a
|
|
38
|
+
* prefix coalesce up to that prefix. Return `null`, `undefined`, or
|
|
39
|
+
* `[]` to leave a part ungrouped — it will be rendered as a leaf
|
|
40
|
+
* through `children` with `part` set to its {@link EnrichedPartState}.
|
|
41
|
+
*
|
|
42
|
+
* Keys must start with `"group-"` so the renderer's
|
|
43
|
+
* `switch (part.type)` can distinguish groups from real part types.
|
|
44
|
+
*
|
|
45
|
+
* For best performance, pass a stable reference (module-level
|
|
46
|
+
* constant or `useCallback`).
|
|
47
|
+
*
|
|
48
|
+
* @example
|
|
49
|
+
* ```ts
|
|
50
|
+
* const groupBy = (part) =>
|
|
51
|
+
* part.type === "reasoning" ? ["group-thought", "group-reasoning"] :
|
|
52
|
+
* part.type === "tool-call" ? ["group-thought", "group-tool"] :
|
|
53
|
+
* null;
|
|
54
|
+
* ```
|
|
55
|
+
*/
|
|
56
|
+
readonly groupBy: (part: PartState, index: number, parts: readonly PartState[]) => GroupKey<TKey>;
|
|
57
|
+
/**
|
|
58
|
+
* Render function called once per group node and once per leaf part.
|
|
59
|
+
* Switch on `part.type`: `"group-…"` cases wrap `children`; real
|
|
60
|
+
* part types (`"text"`, `"tool-call"`, …) render the part directly.
|
|
61
|
+
*
|
|
62
|
+
* Leaf parts receive the same {@link EnrichedPartState} that
|
|
63
|
+
* `<MessagePrimitive.Parts>` would produce (`toolUI`, `addResult`,
|
|
64
|
+
* `resume`, `dataRendererUI`).
|
|
65
|
+
*/
|
|
66
|
+
readonly children: (info: RenderInfo<TKey>) => ReactNode;
|
|
67
|
+
};
|
|
66
68
|
}
|
|
67
69
|
/**
|
|
68
70
|
* Groups adjacent message parts into a tree of coalesced runs and
|
|
@@ -97,8 +99,13 @@ export declare namespace MessagePrimitiveGroupedParts {
|
|
|
97
99
|
* </MessagePrimitive.GroupedParts>
|
|
98
100
|
* ```
|
|
99
101
|
*/
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
102
|
+
declare const MessagePrimitiveGroupedParts: {
|
|
103
|
+
<TKey extends `group-${string}`>({
|
|
104
|
+
groupBy,
|
|
105
|
+
children
|
|
106
|
+
}: MessagePrimitiveGroupedParts.Props<TKey>): ReactNode;
|
|
107
|
+
displayName: string;
|
|
103
108
|
};
|
|
109
|
+
//#endregion
|
|
110
|
+
export { MessagePrimitiveGroupedParts };
|
|
104
111
|
//# sourceMappingURL=MessageGroupedParts.d.ts.map
|