@assistant-ui/react 0.11.57 → 0.12.0
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/client/ModelContextClient.d.ts +2 -6
- package/dist/client/ModelContextClient.d.ts.map +1 -1
- package/dist/client/ModelContextClient.js +13 -10
- package/dist/client/ModelContextClient.js.map +1 -1
- package/dist/client/NoOpComposerClient.d.ts +4 -6
- package/dist/client/NoOpComposerClient.d.ts.map +1 -1
- package/dist/client/NoOpComposerClient.js +42 -40
- package/dist/client/NoOpComposerClient.js.map +1 -1
- package/dist/client/ThreadMessageClient.d.ts +2 -6
- package/dist/client/ThreadMessageClient.d.ts.map +1 -1
- package/dist/client/ThreadMessageClient.js +87 -81
- package/dist/client/ThreadMessageClient.js.map +1 -1
- package/dist/client/Tools.d.ts +4 -6
- package/dist/client/Tools.d.ts.map +1 -1
- package/dist/client/Tools.js +33 -31
- package/dist/client/Tools.js.map +1 -1
- package/dist/context/providers/AttachmentByIndexProvider.d.ts.map +1 -1
- package/dist/context/providers/AttachmentByIndexProvider.js +9 -12
- package/dist/context/providers/AttachmentByIndexProvider.js.map +1 -1
- package/dist/context/providers/MessageByIndexProvider.d.ts.map +1 -1
- package/dist/context/providers/MessageByIndexProvider.js +7 -22
- package/dist/context/providers/MessageByIndexProvider.js.map +1 -1
- package/dist/context/providers/MessageProvider.d.ts.map +1 -1
- package/dist/context/providers/MessageProvider.js +4 -13
- package/dist/context/providers/MessageProvider.js.map +1 -1
- package/dist/context/providers/PartByIndexProvider.d.ts.map +1 -1
- package/dist/context/providers/PartByIndexProvider.js +5 -7
- package/dist/context/providers/PartByIndexProvider.js.map +1 -1
- package/dist/context/providers/TextMessagePartProvider.d.ts.map +1 -1
- package/dist/context/providers/TextMessagePartProvider.js +16 -22
- package/dist/context/providers/TextMessagePartProvider.js.map +1 -1
- package/dist/context/providers/ThreadListItemProvider.d.ts.map +1 -1
- package/dist/context/providers/ThreadListItemProvider.js +9 -35
- package/dist/context/providers/ThreadListItemProvider.js.map +1 -1
- package/dist/context/react/index.d.ts +0 -4
- package/dist/context/react/index.d.ts.map +1 -1
- package/dist/context/react/index.js +0 -6
- package/dist/context/react/index.js.map +1 -1
- package/dist/devtools/DevToolsHooks.d.ts +3 -3
- package/dist/devtools/DevToolsHooks.d.ts.map +1 -1
- package/dist/devtools/DevToolsHooks.js +5 -5
- package/dist/devtools/DevToolsHooks.js.map +1 -1
- package/dist/index.d.ts +18 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +22 -0
- package/dist/index.js.map +1 -1
- package/dist/legacy-runtime/AssistantRuntimeProvider.d.ts.map +1 -1
- package/dist/legacy-runtime/AssistantRuntimeProvider.js +3 -3
- package/dist/legacy-runtime/AssistantRuntimeProvider.js.map +1 -1
- package/dist/legacy-runtime/RuntimeAdapter.d.ts +1 -5
- package/dist/legacy-runtime/RuntimeAdapter.d.ts.map +1 -1
- package/dist/legacy-runtime/RuntimeAdapter.js +25 -4
- package/dist/legacy-runtime/RuntimeAdapter.js.map +1 -1
- package/dist/legacy-runtime/client/AttachmentRuntimeClient.d.ts +4 -6
- package/dist/legacy-runtime/client/AttachmentRuntimeClient.d.ts.map +1 -1
- package/dist/legacy-runtime/client/AttachmentRuntimeClient.js +8 -8
- package/dist/legacy-runtime/client/AttachmentRuntimeClient.js.map +1 -1
- package/dist/legacy-runtime/client/ComposerRuntimeClient.d.ts +6 -6
- package/dist/legacy-runtime/client/ComposerRuntimeClient.d.ts.map +1 -1
- package/dist/legacy-runtime/client/ComposerRuntimeClient.js +38 -37
- package/dist/legacy-runtime/client/ComposerRuntimeClient.js.map +1 -1
- package/dist/legacy-runtime/client/MessagePartRuntimeClient.d.ts +4 -6
- package/dist/legacy-runtime/client/MessagePartRuntimeClient.d.ts.map +1 -1
- package/dist/legacy-runtime/client/MessagePartRuntimeClient.js +9 -12
- package/dist/legacy-runtime/client/MessagePartRuntimeClient.js.map +1 -1
- package/dist/legacy-runtime/client/MessageRuntimeClient.d.ts +5 -6
- package/dist/legacy-runtime/client/MessageRuntimeClient.d.ts.map +1 -1
- package/dist/legacy-runtime/client/MessageRuntimeClient.js +38 -44
- package/dist/legacy-runtime/client/MessageRuntimeClient.js.map +1 -1
- package/dist/legacy-runtime/client/ThreadListItemRuntimeClient.d.ts +4 -6
- package/dist/legacy-runtime/client/ThreadListItemRuntimeClient.d.ts.map +1 -1
- package/dist/legacy-runtime/client/ThreadListItemRuntimeClient.js +23 -23
- package/dist/legacy-runtime/client/ThreadListItemRuntimeClient.js.map +1 -1
- package/dist/legacy-runtime/client/ThreadListRuntimeClient.d.ts +5 -6
- package/dist/legacy-runtime/client/ThreadListRuntimeClient.d.ts.map +1 -1
- package/dist/legacy-runtime/client/ThreadListRuntimeClient.js +30 -31
- package/dist/legacy-runtime/client/ThreadListRuntimeClient.js.map +1 -1
- package/dist/legacy-runtime/client/ThreadRuntimeClient.d.ts +4 -6
- package/dist/legacy-runtime/client/ThreadRuntimeClient.d.ts.map +1 -1
- package/dist/legacy-runtime/client/ThreadRuntimeClient.js +40 -42
- package/dist/legacy-runtime/client/ThreadRuntimeClient.js.map +1 -1
- package/dist/legacy-runtime/cloud/AssistantCloudThreadHistoryAdapter.d.ts.map +1 -1
- package/dist/legacy-runtime/cloud/AssistantCloudThreadHistoryAdapter.js +13 -13
- package/dist/legacy-runtime/cloud/AssistantCloudThreadHistoryAdapter.js.map +1 -1
- package/dist/legacy-runtime/cloud/auiV0.d.ts +8 -0
- package/dist/legacy-runtime/cloud/auiV0.d.ts.map +1 -1
- package/dist/legacy-runtime/cloud/auiV0.js +14 -0
- package/dist/legacy-runtime/cloud/auiV0.js.map +1 -1
- package/dist/legacy-runtime/hooks/AssistantContext.d.ts +4 -4
- package/dist/legacy-runtime/hooks/AssistantContext.js +4 -4
- package/dist/legacy-runtime/hooks/AssistantContext.js.map +1 -1
- package/dist/legacy-runtime/hooks/AttachmentContext.d.ts +14 -14
- package/dist/legacy-runtime/hooks/AttachmentContext.js +5 -5
- package/dist/legacy-runtime/hooks/AttachmentContext.js.map +1 -1
- package/dist/legacy-runtime/hooks/ComposerContext.d.ts +10 -10
- package/dist/legacy-runtime/hooks/ComposerContext.js +8 -8
- package/dist/legacy-runtime/hooks/ComposerContext.js.map +1 -1
- package/dist/legacy-runtime/hooks/MessageContext.d.ts +9 -9
- package/dist/legacy-runtime/hooks/MessageContext.js +9 -9
- package/dist/legacy-runtime/hooks/MessageContext.js.map +1 -1
- package/dist/legacy-runtime/hooks/MessagePartContext.d.ts +2 -2
- package/dist/legacy-runtime/hooks/MessagePartContext.js +4 -4
- package/dist/legacy-runtime/hooks/MessagePartContext.js.map +1 -1
- package/dist/legacy-runtime/hooks/ThreadContext.d.ts +8 -8
- package/dist/legacy-runtime/hooks/ThreadContext.d.ts.map +1 -1
- package/dist/legacy-runtime/hooks/ThreadContext.js +8 -8
- package/dist/legacy-runtime/hooks/ThreadContext.js.map +1 -1
- package/dist/legacy-runtime/hooks/ThreadListItemContext.d.ts +2 -2
- package/dist/legacy-runtime/hooks/ThreadListItemContext.js +5 -5
- package/dist/legacy-runtime/hooks/ThreadListItemContext.js.map +1 -1
- package/dist/legacy-runtime/runtime/ThreadListItemRuntime.d.ts +1 -1
- package/dist/legacy-runtime/runtime/ThreadListItemRuntime.d.ts.map +1 -1
- package/dist/legacy-runtime/runtime/ThreadListItemRuntime.js +3 -3
- package/dist/legacy-runtime/runtime/ThreadListItemRuntime.js.map +1 -1
- package/dist/legacy-runtime/runtime-cores/assistant-transport/useAssistantTransportRuntime.d.ts.map +1 -1
- package/dist/legacy-runtime/runtime-cores/assistant-transport/useAssistantTransportRuntime.js +5 -5
- package/dist/legacy-runtime/runtime-cores/assistant-transport/useAssistantTransportRuntime.js.map +1 -1
- package/dist/legacy-runtime/runtime-cores/assistant-transport/useToolInvocations.d.ts.map +1 -1
- package/dist/legacy-runtime/runtime-cores/assistant-transport/useToolInvocations.js +15 -1
- package/dist/legacy-runtime/runtime-cores/assistant-transport/useToolInvocations.js.map +1 -1
- package/dist/legacy-runtime/runtime-cores/composer/BaseComposerRuntimeCore.js +1 -1
- package/dist/legacy-runtime/runtime-cores/composer/BaseComposerRuntimeCore.js.map +1 -1
- package/dist/legacy-runtime/runtime-cores/core/BaseThreadRuntimeCore.js +1 -1
- package/dist/legacy-runtime/runtime-cores/core/BaseThreadRuntimeCore.js.map +1 -1
- package/dist/legacy-runtime/runtime-cores/core/ComposerRuntimeCore.d.ts +1 -1
- package/dist/legacy-runtime/runtime-cores/core/ComposerRuntimeCore.d.ts.map +1 -1
- package/dist/legacy-runtime/runtime-cores/core/ThreadRuntimeCore.d.ts +1 -1
- package/dist/legacy-runtime/runtime-cores/core/ThreadRuntimeCore.d.ts.map +1 -1
- package/dist/legacy-runtime/runtime-cores/external-store/ExternalStoreThreadRuntimeCore.js +2 -2
- package/dist/legacy-runtime/runtime-cores/external-store/ExternalStoreThreadRuntimeCore.js.map +1 -1
- package/dist/legacy-runtime/runtime-cores/external-store/ThreadMessageLike.d.ts.map +1 -1
- package/dist/legacy-runtime/runtime-cores/external-store/ThreadMessageLike.js +2 -5
- package/dist/legacy-runtime/runtime-cores/external-store/ThreadMessageLike.js.map +1 -1
- package/dist/legacy-runtime/runtime-cores/external-store/createMessageConverter.js +5 -5
- package/dist/legacy-runtime/runtime-cores/external-store/createMessageConverter.js.map +1 -1
- package/dist/legacy-runtime/runtime-cores/external-store/external-message-converter.js +1 -1
- package/dist/legacy-runtime/runtime-cores/external-store/external-message-converter.js.map +1 -1
- package/dist/legacy-runtime/runtime-cores/local/LocalThreadRuntimeCore.d.ts.map +1 -1
- package/dist/legacy-runtime/runtime-cores/local/LocalThreadRuntimeCore.js +7 -2
- package/dist/legacy-runtime/runtime-cores/local/LocalThreadRuntimeCore.js.map +1 -1
- package/dist/legacy-runtime/runtime-cores/local/useLocalRuntime.d.ts.map +1 -1
- package/dist/legacy-runtime/runtime-cores/local/useLocalRuntime.js +5 -5
- package/dist/legacy-runtime/runtime-cores/local/useLocalRuntime.js.map +1 -1
- package/dist/legacy-runtime/runtime-cores/remote-thread-list/RemoteThreadListHookInstanceManager.d.ts.map +1 -1
- package/dist/legacy-runtime/runtime-cores/remote-thread-list/RemoteThreadListHookInstanceManager.js +9 -8
- package/dist/legacy-runtime/runtime-cores/remote-thread-list/RemoteThreadListHookInstanceManager.js.map +1 -1
- package/dist/legacy-runtime/runtime-cores/remote-thread-list/useRemoteThreadListRuntime.js +3 -3
- package/dist/legacy-runtime/runtime-cores/remote-thread-list/useRemoteThreadListRuntime.js.map +1 -1
- package/dist/model-context/makeAssistantVisible.js +4 -4
- package/dist/model-context/makeAssistantVisible.js.map +1 -1
- package/dist/model-context/useAssistantInstructions.js +4 -4
- package/dist/model-context/useAssistantInstructions.js.map +1 -1
- package/dist/model-context/useAssistantTool.js +6 -6
- package/dist/model-context/useAssistantTool.js.map +1 -1
- package/dist/model-context/useAssistantToolUI.js +4 -4
- package/dist/model-context/useAssistantToolUI.js.map +1 -1
- package/dist/primitives/actionBar/ActionBarCopy.js +10 -10
- package/dist/primitives/actionBar/ActionBarCopy.js.map +1 -1
- package/dist/primitives/actionBar/ActionBarEdit.js +5 -5
- package/dist/primitives/actionBar/ActionBarEdit.js.map +1 -1
- package/dist/primitives/actionBar/ActionBarExportMarkdown.js +5 -5
- package/dist/primitives/actionBar/ActionBarExportMarkdown.js.map +1 -1
- package/dist/primitives/actionBar/ActionBarFeedbackNegative.js +5 -5
- package/dist/primitives/actionBar/ActionBarFeedbackNegative.js.map +1 -1
- package/dist/primitives/actionBar/ActionBarFeedbackPositive.js +5 -5
- package/dist/primitives/actionBar/ActionBarFeedbackPositive.js.map +1 -1
- package/dist/primitives/actionBar/ActionBarReload.js +5 -5
- package/dist/primitives/actionBar/ActionBarReload.js.map +1 -1
- package/dist/primitives/actionBar/ActionBarSpeak.js +5 -5
- package/dist/primitives/actionBar/ActionBarSpeak.js.map +1 -1
- package/dist/primitives/actionBar/ActionBarStopSpeaking.js +5 -5
- package/dist/primitives/actionBar/ActionBarStopSpeaking.js.map +1 -1
- package/dist/primitives/actionBar/useActionBarFloatStatus.js +2 -2
- package/dist/primitives/actionBar/useActionBarFloatStatus.js.map +1 -1
- package/dist/primitives/assistantModal/AssistantModalRoot.js +4 -4
- package/dist/primitives/assistantModal/AssistantModalRoot.js.map +1 -1
- package/dist/primitives/attachment/AttachmentName.js +2 -2
- package/dist/primitives/attachment/AttachmentName.js.map +1 -1
- package/dist/primitives/attachment/AttachmentRemove.js +4 -4
- package/dist/primitives/attachment/AttachmentRemove.js.map +1 -1
- package/dist/primitives/attachment/AttachmentThumb.js +2 -2
- package/dist/primitives/attachment/AttachmentThumb.js.map +1 -1
- package/dist/primitives/branchPicker/BranchPickerCount.js +2 -2
- package/dist/primitives/branchPicker/BranchPickerCount.js.map +1 -1
- package/dist/primitives/branchPicker/BranchPickerNext.js +5 -5
- package/dist/primitives/branchPicker/BranchPickerNext.js.map +1 -1
- package/dist/primitives/branchPicker/BranchPickerNumber.js +2 -2
- package/dist/primitives/branchPicker/BranchPickerNumber.js.map +1 -1
- package/dist/primitives/branchPicker/BranchPickerPrevious.js +5 -5
- package/dist/primitives/branchPicker/BranchPickerPrevious.js.map +1 -1
- package/dist/primitives/composer/ComposerAddAttachment.js +6 -6
- package/dist/primitives/composer/ComposerAddAttachment.js.map +1 -1
- package/dist/primitives/composer/ComposerAttachmentDropzone.js +4 -4
- package/dist/primitives/composer/ComposerAttachmentDropzone.js.map +1 -1
- package/dist/primitives/composer/ComposerAttachments.d.ts.map +1 -1
- package/dist/primitives/composer/ComposerAttachments.js +4 -3
- package/dist/primitives/composer/ComposerAttachments.js.map +1 -1
- package/dist/primitives/composer/ComposerCancel.js +5 -5
- package/dist/primitives/composer/ComposerCancel.js.map +1 -1
- package/dist/primitives/composer/ComposerDictate.js +5 -5
- package/dist/primitives/composer/ComposerDictate.js.map +1 -1
- package/dist/primitives/composer/ComposerDictationTranscript.js +2 -2
- package/dist/primitives/composer/ComposerDictationTranscript.js.map +1 -1
- package/dist/primitives/composer/ComposerIf.d.ts +1 -1
- package/dist/primitives/composer/ComposerIf.js +3 -3
- package/dist/primitives/composer/ComposerIf.js.map +1 -1
- package/dist/primitives/composer/ComposerInput.js +19 -19
- package/dist/primitives/composer/ComposerInput.js.map +1 -1
- package/dist/primitives/composer/ComposerSend.js +5 -5
- package/dist/primitives/composer/ComposerSend.js.map +1 -1
- package/dist/primitives/composer/ComposerStopDictation.d.ts.map +1 -1
- package/dist/primitives/composer/ComposerStopDictation.js +6 -5
- package/dist/primitives/composer/ComposerStopDictation.js.map +1 -1
- package/dist/primitives/error/ErrorMessage.js +2 -2
- package/dist/primitives/error/ErrorMessage.js.map +1 -1
- package/dist/primitives/index.d.ts +0 -1
- package/dist/primitives/index.d.ts.map +1 -1
- package/dist/primitives/index.js +0 -1
- package/dist/primitives/index.js.map +1 -1
- package/dist/primitives/message/MessageAttachments.d.ts.map +1 -1
- package/dist/primitives/message/MessageAttachments.js +4 -3
- package/dist/primitives/message/MessageAttachments.js.map +1 -1
- package/dist/primitives/message/MessageError.js +2 -2
- package/dist/primitives/message/MessageError.js.map +1 -1
- package/dist/primitives/message/MessageIf.d.ts +1 -1
- package/dist/primitives/message/MessageIf.js +3 -3
- package/dist/primitives/message/MessageIf.js.map +1 -1
- package/dist/primitives/message/MessageParts.d.ts.map +1 -1
- package/dist/primitives/message/MessageParts.js +10 -9
- package/dist/primitives/message/MessageParts.js.map +1 -1
- package/dist/primitives/message/MessagePartsGrouped.d.ts.map +1 -1
- package/dist/primitives/message/MessagePartsGrouped.js +10 -9
- package/dist/primitives/message/MessagePartsGrouped.js.map +1 -1
- package/dist/primitives/message/MessageRoot.js +4 -4
- package/dist/primitives/message/MessageRoot.js.map +1 -1
- package/dist/primitives/messagePart/MessagePartInProgress.js +2 -2
- package/dist/primitives/messagePart/MessagePartInProgress.js.map +1 -1
- package/dist/primitives/messagePart/useMessagePartData.js +2 -2
- package/dist/primitives/messagePart/useMessagePartData.js.map +1 -1
- package/dist/primitives/messagePart/useMessagePartFile.js +2 -2
- package/dist/primitives/messagePart/useMessagePartFile.js.map +1 -1
- package/dist/primitives/messagePart/useMessagePartImage.js +2 -2
- package/dist/primitives/messagePart/useMessagePartImage.js.map +1 -1
- package/dist/primitives/messagePart/useMessagePartReasoning.js +2 -2
- package/dist/primitives/messagePart/useMessagePartReasoning.js.map +1 -1
- package/dist/primitives/messagePart/useMessagePartSource.js +2 -2
- package/dist/primitives/messagePart/useMessagePartSource.js.map +1 -1
- package/dist/primitives/messagePart/useMessagePartText.js +2 -2
- package/dist/primitives/messagePart/useMessagePartText.js.map +1 -1
- package/dist/primitives/thread/ThreadEmpty.js +2 -2
- package/dist/primitives/thread/ThreadEmpty.js.map +1 -1
- package/dist/primitives/thread/ThreadIf.d.ts +1 -1
- package/dist/primitives/thread/ThreadIf.js +3 -3
- package/dist/primitives/thread/ThreadIf.js.map +1 -1
- package/dist/primitives/thread/ThreadMessages.d.ts.map +1 -1
- package/dist/primitives/thread/ThreadMessages.js +5 -4
- package/dist/primitives/thread/ThreadMessages.js.map +1 -1
- package/dist/primitives/thread/ThreadSuggestion.js +10 -10
- package/dist/primitives/thread/ThreadSuggestion.js.map +1 -1
- package/dist/primitives/thread/ThreadViewportSlack.js +2 -2
- package/dist/primitives/thread/ThreadViewportSlack.js.map +1 -1
- package/dist/primitives/thread/useThreadViewportAutoScroll.js +4 -4
- package/dist/primitives/thread/useThreadViewportAutoScroll.js.map +1 -1
- package/dist/primitives/threadList/ThreadListItems.d.ts.map +1 -1
- package/dist/primitives/threadList/ThreadListItems.js +3 -2
- package/dist/primitives/threadList/ThreadListItems.js.map +1 -1
- package/dist/primitives/threadList/ThreadListNew.js +4 -4
- package/dist/primitives/threadList/ThreadListNew.js.map +1 -1
- package/dist/primitives/threadListItem/ThreadListItemArchive.js +4 -4
- package/dist/primitives/threadListItem/ThreadListItemArchive.js.map +1 -1
- package/dist/primitives/threadListItem/ThreadListItemDelete.js +4 -4
- package/dist/primitives/threadListItem/ThreadListItemDelete.js.map +1 -1
- package/dist/primitives/threadListItem/ThreadListItemRoot.js +2 -2
- package/dist/primitives/threadListItem/ThreadListItemRoot.js.map +1 -1
- package/dist/primitives/threadListItem/ThreadListItemTitle.js +2 -2
- package/dist/primitives/threadListItem/ThreadListItemTitle.js.map +1 -1
- package/dist/primitives/threadListItem/ThreadListItemTrigger.js +4 -4
- package/dist/primitives/threadListItem/ThreadListItemTrigger.js.map +1 -1
- package/dist/primitives/threadListItem/ThreadListItemUnarchive.js +4 -4
- package/dist/primitives/threadListItem/ThreadListItemUnarchive.js.map +1 -1
- package/dist/types/index.d.ts +0 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/scopes/attachment.d.ts +22 -0
- package/dist/types/scopes/attachment.d.ts.map +1 -0
- package/dist/types/scopes/attachment.js +2 -0
- package/dist/types/scopes/attachment.js.map +1 -0
- package/dist/{client/types/Composer.d.ts → types/scopes/composer.d.ts} +29 -9
- package/dist/types/scopes/composer.d.ts.map +1 -0
- package/dist/types/scopes/composer.js +2 -0
- package/dist/types/scopes/composer.js.map +1 -0
- package/dist/types/scopes/index.d.ts +10 -0
- package/dist/types/scopes/index.d.ts.map +1 -0
- package/dist/types/scopes/index.js +2 -0
- package/dist/types/scopes/index.js.map +1 -0
- package/dist/{client/types/Message.d.ts → types/scopes/message.d.ts} +35 -27
- package/dist/types/scopes/message.d.ts.map +1 -0
- package/dist/types/scopes/message.js +2 -0
- package/dist/types/scopes/message.js.map +1 -0
- package/dist/types/scopes/modelContext.d.ts +12 -0
- package/dist/types/scopes/modelContext.d.ts.map +1 -0
- package/dist/types/scopes/modelContext.js +2 -0
- package/dist/types/scopes/modelContext.js.map +1 -0
- package/dist/types/scopes/part.d.ts +37 -0
- package/dist/types/scopes/part.d.ts.map +1 -0
- package/dist/types/scopes/part.js +2 -0
- package/dist/types/scopes/part.js.map +1 -0
- package/dist/{client/types/Thread.d.ts → types/scopes/thread.d.ts} +45 -25
- package/dist/types/scopes/thread.d.ts.map +1 -0
- package/dist/types/scopes/thread.js +2 -0
- package/dist/types/scopes/thread.js.map +1 -0
- package/dist/types/scopes/threadListItem.d.ts +50 -0
- package/dist/types/scopes/threadListItem.d.ts.map +1 -0
- package/dist/types/scopes/threadListItem.js +2 -0
- package/dist/types/scopes/threadListItem.js.map +1 -0
- package/dist/types/scopes/threads.d.ts +28 -0
- package/dist/types/scopes/threads.d.ts.map +1 -0
- package/dist/types/scopes/threads.js +2 -0
- package/dist/types/scopes/threads.js.map +1 -0
- package/dist/types/scopes/tools.d.ts +14 -0
- package/dist/types/scopes/tools.d.ts.map +1 -0
- package/dist/types/scopes/tools.js +2 -0
- package/dist/types/scopes/tools.js.map +1 -0
- package/dist/types/store-augmentation.d.ts +24 -0
- package/dist/types/store-augmentation.d.ts.map +1 -0
- package/dist/types/store-augmentation.js +2 -0
- package/dist/types/store-augmentation.js.map +1 -0
- package/dist/utils/smooth/SmoothContext.js +3 -3
- package/dist/utils/smooth/SmoothContext.js.map +1 -1
- package/dist/utils/smooth/useSmooth.js +2 -2
- package/dist/utils/smooth/useSmooth.js.map +1 -1
- package/dist/utils/useToolArgsFieldStatus.js +2 -2
- package/dist/utils/useToolArgsFieldStatus.js.map +1 -1
- package/package.json +9 -8
- package/src/client/ModelContextClient.ts +19 -12
- package/src/client/NoOpComposerClient.tsx +45 -42
- package/src/client/ThreadMessageClient.tsx +99 -86
- package/src/client/Tools.ts +73 -62
- package/src/context/providers/AttachmentByIndexProvider.tsx +9 -17
- package/src/context/providers/MessageByIndexProvider.tsx +7 -32
- package/src/context/providers/MessageProvider.tsx +4 -16
- package/src/context/providers/PartByIndexProvider.tsx +5 -11
- package/src/context/providers/TextMessagePartProvider.tsx +24 -32
- package/src/context/providers/ThreadListItemProvider.tsx +9 -45
- package/src/context/react/index.ts +0 -13
- package/src/devtools/DevToolsHooks.ts +7 -7
- package/src/index.ts +42 -0
- package/src/legacy-runtime/AssistantRuntimeProvider.tsx +4 -7
- package/src/legacy-runtime/RuntimeAdapter.ts +32 -4
- package/src/legacy-runtime/client/AttachmentRuntimeClient.ts +7 -9
- package/src/legacy-runtime/client/ComposerRuntimeClient.ts +54 -50
- package/src/legacy-runtime/client/MessagePartRuntimeClient.ts +12 -17
- package/src/legacy-runtime/client/MessageRuntimeClient.ts +40 -34
- package/src/legacy-runtime/client/ThreadListItemRuntimeClient.ts +17 -17
- package/src/legacy-runtime/client/ThreadListRuntimeClient.ts +47 -42
- package/src/legacy-runtime/client/ThreadRuntimeClient.ts +52 -49
- package/src/legacy-runtime/cloud/AssistantCloudThreadHistoryAdapter.tsx +13 -16
- package/src/legacy-runtime/cloud/auiV0.ts +27 -1
- package/src/legacy-runtime/hooks/AssistantContext.ts +7 -7
- package/src/legacy-runtime/hooks/AttachmentContext.ts +7 -7
- package/src/legacy-runtime/hooks/ComposerContext.ts +15 -15
- package/src/legacy-runtime/hooks/MessageContext.ts +14 -14
- package/src/legacy-runtime/hooks/MessagePartContext.ts +6 -6
- package/src/legacy-runtime/hooks/ThreadContext.ts +13 -17
- package/src/legacy-runtime/hooks/ThreadListItemContext.ts +7 -7
- package/src/legacy-runtime/runtime/ThreadListItemRuntime.ts +4 -4
- package/src/legacy-runtime/runtime-cores/assistant-transport/useAssistantTransportRuntime.tsx +5 -7
- package/src/legacy-runtime/runtime-cores/assistant-transport/useToolInvocations.ts +17 -1
- package/src/legacy-runtime/runtime-cores/composer/BaseComposerRuntimeCore.tsx +1 -1
- package/src/legacy-runtime/runtime-cores/core/BaseThreadRuntimeCore.tsx +1 -1
- package/src/legacy-runtime/runtime-cores/core/ComposerRuntimeCore.tsx +1 -1
- package/src/legacy-runtime/runtime-cores/core/ThreadRuntimeCore.tsx +3 -3
- package/src/legacy-runtime/runtime-cores/external-store/ExternalStoreThreadRuntimeCore.tsx +2 -2
- package/src/legacy-runtime/runtime-cores/external-store/ThreadMessageLike.tsx +4 -6
- package/src/legacy-runtime/runtime-cores/external-store/createMessageConverter.tsx +5 -5
- package/src/legacy-runtime/runtime-cores/external-store/external-message-converter.tsx +1 -1
- package/src/legacy-runtime/runtime-cores/local/LocalThreadRuntimeCore.tsx +6 -2
- package/src/legacy-runtime/runtime-cores/local/useLocalRuntime.tsx +11 -14
- package/src/legacy-runtime/runtime-cores/remote-thread-list/RemoteThreadListHookInstanceManager.tsx +9 -8
- package/src/legacy-runtime/runtime-cores/remote-thread-list/useRemoteThreadListRuntime.tsx +3 -3
- package/src/model-context/makeAssistantVisible.tsx +4 -4
- package/src/model-context/useAssistantInstructions.tsx +4 -4
- package/src/model-context/useAssistantTool.tsx +6 -6
- package/src/model-context/useAssistantToolUI.tsx +4 -4
- package/src/primitives/actionBar/ActionBarCopy.tsx +10 -10
- package/src/primitives/actionBar/ActionBarEdit.tsx +5 -5
- package/src/primitives/actionBar/ActionBarExportMarkdown.tsx +5 -5
- package/src/primitives/actionBar/ActionBarFeedbackNegative.tsx +5 -5
- package/src/primitives/actionBar/ActionBarFeedbackPositive.tsx +5 -5
- package/src/primitives/actionBar/ActionBarReload.tsx +5 -5
- package/src/primitives/actionBar/ActionBarSpeak.tsx +5 -5
- package/src/primitives/actionBar/ActionBarStopSpeaking.tsx +5 -5
- package/src/primitives/actionBar/useActionBarFloatStatus.tsx +2 -2
- package/src/primitives/assistantModal/AssistantModalRoot.tsx +4 -4
- package/src/primitives/attachment/AttachmentName.tsx +2 -2
- package/src/primitives/attachment/AttachmentRemove.tsx +4 -4
- package/src/primitives/attachment/AttachmentThumb.tsx +2 -2
- package/src/primitives/branchPicker/BranchPickerCount.tsx +2 -2
- package/src/primitives/branchPicker/BranchPickerNext.tsx +5 -5
- package/src/primitives/branchPicker/BranchPickerNumber.tsx +2 -2
- package/src/primitives/branchPicker/BranchPickerPrevious.tsx +5 -5
- package/src/primitives/composer/ComposerAddAttachment.tsx +6 -6
- package/src/primitives/composer/ComposerAttachmentDropzone.tsx +4 -4
- package/src/primitives/composer/ComposerAttachments.tsx +4 -8
- package/src/primitives/composer/ComposerCancel.tsx +5 -5
- package/src/primitives/composer/ComposerDictate.tsx +5 -5
- package/src/primitives/composer/ComposerDictationTranscript.tsx +2 -2
- package/src/primitives/composer/ComposerIf.tsx +3 -3
- package/src/primitives/composer/ComposerInput.tsx +19 -19
- package/src/primitives/composer/ComposerSend.tsx +5 -5
- package/src/primitives/composer/ComposerStopDictation.tsx +6 -7
- package/src/primitives/error/ErrorMessage.tsx +2 -2
- package/src/primitives/index.ts +0 -2
- package/src/primitives/message/MessageAttachments.tsx +4 -6
- package/src/primitives/message/MessageError.tsx +2 -2
- package/src/primitives/message/MessageIf.tsx +3 -3
- package/src/primitives/message/MessageParts.tsx +10 -13
- package/src/primitives/message/MessagePartsGrouped.tsx +10 -13
- package/src/primitives/message/MessageRoot.tsx +4 -4
- package/src/primitives/messagePart/MessagePartInProgress.tsx +2 -2
- package/src/primitives/messagePart/useMessagePartData.tsx +2 -2
- package/src/primitives/messagePart/useMessagePartFile.tsx +2 -2
- package/src/primitives/messagePart/useMessagePartImage.tsx +2 -2
- package/src/primitives/messagePart/useMessagePartReasoning.tsx +2 -2
- package/src/primitives/messagePart/useMessagePartSource.tsx +2 -2
- package/src/primitives/messagePart/useMessagePartText.tsx +2 -2
- package/src/primitives/thread/ThreadEmpty.tsx +2 -2
- package/src/primitives/thread/ThreadIf.tsx +3 -3
- package/src/primitives/thread/ThreadMessages.tsx +5 -8
- package/src/primitives/thread/ThreadSuggestion.tsx +10 -10
- package/src/primitives/thread/ThreadViewportSlack.tsx +2 -2
- package/src/primitives/thread/useThreadViewportAutoScroll.tsx +4 -4
- package/src/primitives/threadList/ThreadListItems.tsx +3 -5
- package/src/primitives/threadList/ThreadListNew.tsx +4 -4
- package/src/primitives/threadListItem/ThreadListItemArchive.ts +4 -4
- package/src/primitives/threadListItem/ThreadListItemDelete.ts +4 -4
- package/src/primitives/threadListItem/ThreadListItemRoot.tsx +2 -2
- package/src/primitives/threadListItem/ThreadListItemTitle.tsx +2 -2
- package/src/primitives/threadListItem/ThreadListItemTrigger.ts +4 -4
- package/src/primitives/threadListItem/ThreadListItemUnarchive.ts +4 -4
- package/src/types/index.ts +0 -8
- package/src/types/scopes/attachment.ts +22 -0
- package/src/{client/types/Composer.ts → types/scopes/composer.ts} +26 -9
- package/src/types/scopes/index.ts +50 -0
- package/src/{client/types/Message.ts → types/scopes/message.ts} +30 -38
- package/src/types/scopes/modelContext.ts +14 -0
- package/src/{client/types/Part.ts → types/scopes/part.ts} +21 -14
- package/src/{client/types/Thread.ts → types/scopes/thread.ts} +44 -53
- package/src/types/scopes/threadListItem.ts +44 -0
- package/src/{client/types/ThreadList.ts → types/scopes/threads.ts} +17 -17
- package/src/types/scopes/tools.ts +19 -0
- package/src/types/store-augmentation.ts +25 -0
- package/src/utils/smooth/SmoothContext.tsx +3 -3
- package/src/utils/smooth/useSmooth.tsx +2 -2
- package/src/utils/useToolArgsFieldStatus.tsx +2 -2
- package/dist/client/AssistantClient.d.ts +0 -21
- package/dist/client/AssistantClient.d.ts.map +0 -1
- package/dist/client/AssistantClient.js +0 -96
- package/dist/client/AssistantClient.js.map +0 -1
- package/dist/client/EventContext.d.ts +0 -4
- package/dist/client/EventContext.d.ts.map +0 -1
- package/dist/client/EventContext.js +0 -12
- package/dist/client/EventContext.js.map +0 -1
- package/dist/client/ModelContext.d.ts +0 -8
- package/dist/client/ModelContext.d.ts.map +0 -1
- package/dist/client/ModelContext.js +0 -12
- package/dist/client/ModelContext.js.map +0 -1
- package/dist/client/types/Attachment.d.ts +0 -7
- package/dist/client/types/Attachment.d.ts.map +0 -1
- package/dist/client/types/Attachment.js +0 -2
- package/dist/client/types/Attachment.js.map +0 -1
- package/dist/client/types/Composer.d.ts.map +0 -1
- package/dist/client/types/Composer.js +0 -2
- package/dist/client/types/Composer.js.map +0 -1
- package/dist/client/types/Message.d.ts.map +0 -1
- package/dist/client/types/Message.js +0 -2
- package/dist/client/types/Message.js.map +0 -1
- package/dist/client/types/ModelContext.d.ts +0 -12
- package/dist/client/types/ModelContext.d.ts.map +0 -1
- package/dist/client/types/ModelContext.js +0 -2
- package/dist/client/types/ModelContext.js.map +0 -1
- package/dist/client/types/Part.d.ts +0 -22
- package/dist/client/types/Part.d.ts.map +0 -1
- package/dist/client/types/Part.js +0 -2
- package/dist/client/types/Part.js.map +0 -1
- package/dist/client/types/Thread.d.ts.map +0 -1
- package/dist/client/types/Thread.js +0 -2
- package/dist/client/types/Thread.js.map +0 -1
- package/dist/client/types/ThreadList.d.ts +0 -24
- package/dist/client/types/ThreadList.d.ts.map +0 -1
- package/dist/client/types/ThreadList.js +0 -2
- package/dist/client/types/ThreadList.js.map +0 -1
- package/dist/client/types/ThreadListItem.d.ts +0 -23
- package/dist/client/types/ThreadListItem.d.ts.map +0 -1
- package/dist/client/types/ThreadListItem.js +0 -2
- package/dist/client/types/ThreadListItem.js.map +0 -1
- package/dist/client/types/Tools.d.ts +0 -13
- package/dist/client/types/Tools.d.ts.map +0 -1
- package/dist/client/types/Tools.js +0 -2
- package/dist/client/types/Tools.js.map +0 -1
- package/dist/client/util-hooks/tapLookupResources.d.ts +0 -15
- package/dist/client/util-hooks/tapLookupResources.d.ts.map +0 -1
- package/dist/client/util-hooks/tapLookupResources.js +0 -26
- package/dist/client/util-hooks/tapLookupResources.js.map +0 -1
- package/dist/context/react/AssistantApiContext.d.ts +0 -138
- package/dist/context/react/AssistantApiContext.d.ts.map +0 -1
- package/dist/context/react/AssistantApiContext.js +0 -158
- package/dist/context/react/AssistantApiContext.js.map +0 -1
- package/dist/context/react/hooks/useAssistantEvent.d.ts +0 -3
- package/dist/context/react/hooks/useAssistantEvent.d.ts.map +0 -1
- package/dist/context/react/hooks/useAssistantEvent.js +0 -13
- package/dist/context/react/hooks/useAssistantEvent.js.map +0 -1
- package/dist/context/react/hooks/useAssistantState.d.ts +0 -3
- package/dist/context/react/hooks/useAssistantState.d.ts.map +0 -1
- package/dist/context/react/hooks/useAssistantState.js +0 -42
- package/dist/context/react/hooks/useAssistantState.js.map +0 -1
- package/dist/legacy-runtime/client/EventManagerRuntimeClient.d.ts +0 -11
- package/dist/legacy-runtime/client/EventManagerRuntimeClient.d.ts.map +0 -1
- package/dist/legacy-runtime/client/EventManagerRuntimeClient.js +0 -44
- package/dist/legacy-runtime/client/EventManagerRuntimeClient.js.map +0 -1
- package/dist/primitives/assistant/AssistantIf.d.ts +0 -12
- package/dist/primitives/assistant/AssistantIf.d.ts.map +0 -1
- package/dist/primitives/assistant/AssistantIf.js +0 -11
- package/dist/primitives/assistant/AssistantIf.js.map +0 -1
- package/dist/types/EventTypes.d.ts +0 -57
- package/dist/types/EventTypes.d.ts.map +0 -1
- package/dist/types/EventTypes.js +0 -17
- package/dist/types/EventTypes.js.map +0 -1
- package/dist/utils/tap-store/derived-scopes.d.ts +0 -75
- package/dist/utils/tap-store/derived-scopes.d.ts.map +0 -1
- package/dist/utils/tap-store/derived-scopes.js +0 -56
- package/dist/utils/tap-store/derived-scopes.js.map +0 -1
- package/dist/utils/tap-store/index.d.ts +0 -4
- package/dist/utils/tap-store/index.d.ts.map +0 -1
- package/dist/utils/tap-store/index.js +0 -4
- package/dist/utils/tap-store/index.js.map +0 -1
- package/dist/utils/tap-store/store.d.ts +0 -14
- package/dist/utils/tap-store/store.d.ts.map +0 -1
- package/dist/utils/tap-store/store.js +0 -9
- package/dist/utils/tap-store/store.js.map +0 -1
- package/dist/utils/tap-store/tap-api.d.ts +0 -13
- package/dist/utils/tap-store/tap-api.d.ts.map +0 -1
- package/dist/utils/tap-store/tap-api.js +0 -49
- package/dist/utils/tap-store/tap-api.js.map +0 -1
- package/src/client/AssistantClient.ts +0 -175
- package/src/client/EventContext.ts +0 -22
- package/src/client/ModelContext.ts +0 -28
- package/src/client/types/Attachment.ts +0 -13
- package/src/client/types/ModelContext.ts +0 -14
- package/src/client/types/ThreadListItem.ts +0 -26
- package/src/client/types/Tools.ts +0 -19
- package/src/client/util-hooks/tapLookupResources.ts +0 -45
- package/src/context/react/AssistantApiContext.tsx +0 -340
- package/src/context/react/hooks/useAssistantEvent.ts +0 -25
- package/src/context/react/hooks/useAssistantState.tsx +0 -65
- package/src/legacy-runtime/client/EventManagerRuntimeClient.ts +0 -81
- package/src/primitives/assistant/AssistantIf.tsx +0 -25
- package/src/types/EventTypes.ts +0 -103
- package/src/utils/tap-store/derived-scopes.ts +0 -175
- package/src/utils/tap-store/index.ts +0 -10
- package/src/utils/tap-store/store.ts +0 -35
- package/src/utils/tap-store/tap-api.ts +0 -70
|
@@ -6,18 +6,18 @@ import {
|
|
|
6
6
|
createActionButton,
|
|
7
7
|
} from "../../utils/createActionButton";
|
|
8
8
|
import { useCallback } from "react";
|
|
9
|
-
import {
|
|
9
|
+
import { useAuiState, useAui } from "@assistant-ui/store";
|
|
10
10
|
|
|
11
11
|
export const useComposerSend = () => {
|
|
12
|
-
const
|
|
12
|
+
const aui = useAui();
|
|
13
13
|
|
|
14
|
-
const disabled =
|
|
14
|
+
const disabled = useAuiState(
|
|
15
15
|
(s) => s.thread.isRunning || !s.composer.isEditing || s.composer.isEmpty,
|
|
16
16
|
);
|
|
17
17
|
|
|
18
18
|
const callback = useCallback(() => {
|
|
19
|
-
|
|
20
|
-
}, [
|
|
19
|
+
aui.composer().send();
|
|
20
|
+
}, [aui]);
|
|
21
21
|
|
|
22
22
|
if (disabled) return null;
|
|
23
23
|
return callback;
|
|
@@ -1,22 +1,21 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
import { useCallback } from "react";
|
|
4
|
-
import {
|
|
4
|
+
import { useAui } from "@assistant-ui/store";
|
|
5
5
|
import type {
|
|
6
6
|
ActionButtonElement,
|
|
7
7
|
ActionButtonProps,
|
|
8
8
|
} from "../../utils/createActionButton";
|
|
9
9
|
import { createActionButton } from "../../utils/createActionButton";
|
|
10
|
+
import { useAuiState } from "@assistant-ui/store";
|
|
10
11
|
|
|
11
12
|
const useComposerStopDictation = () => {
|
|
12
|
-
const
|
|
13
|
-
const isDictating =
|
|
14
|
-
({ composer }) => composer.dictation != null,
|
|
15
|
-
);
|
|
13
|
+
const aui = useAui();
|
|
14
|
+
const isDictating = useAuiState(({ composer }) => composer.dictation != null);
|
|
16
15
|
|
|
17
16
|
const callback = useCallback(() => {
|
|
18
|
-
|
|
19
|
-
}, [
|
|
17
|
+
aui.composer().stopDictation();
|
|
18
|
+
}, [aui]);
|
|
20
19
|
|
|
21
20
|
if (!isDictating) return null;
|
|
22
21
|
return callback;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { Primitive } from "@radix-ui/react-primitive";
|
|
4
4
|
import { type ComponentRef, forwardRef, ComponentPropsWithoutRef } from "react";
|
|
5
|
-
import {
|
|
5
|
+
import { useAuiState } from "@assistant-ui/store";
|
|
6
6
|
|
|
7
7
|
export namespace ErrorPrimitiveMessage {
|
|
8
8
|
export type Element = ComponentRef<typeof Primitive.span>;
|
|
@@ -13,7 +13,7 @@ export const ErrorPrimitiveMessage = forwardRef<
|
|
|
13
13
|
ErrorPrimitiveMessage.Element,
|
|
14
14
|
ErrorPrimitiveMessage.Props
|
|
15
15
|
>(({ children, ...props }, forwardRef) => {
|
|
16
|
-
const error =
|
|
16
|
+
const error = useAuiState(({ message }) => {
|
|
17
17
|
return message.status?.type === "incomplete" &&
|
|
18
18
|
message.status.reason === "error"
|
|
19
19
|
? message.status.error
|
package/src/primitives/index.ts
CHANGED
|
@@ -12,8 +12,6 @@ export * as ThreadListPrimitive from "./threadList";
|
|
|
12
12
|
export * as ThreadListItemPrimitive from "./threadListItem";
|
|
13
13
|
export * as ThreadListItemMorePrimitive from "./threadListItemMore";
|
|
14
14
|
|
|
15
|
-
export { AssistantIf } from "./assistant/AssistantIf";
|
|
16
|
-
|
|
17
15
|
export { useMessagePartText } from "./messagePart/useMessagePartText";
|
|
18
16
|
export { useMessagePartReasoning } from "./messagePart/useMessagePartReasoning";
|
|
19
17
|
export { useMessagePartSource } from "./messagePart/useMessagePartSource";
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
import { ComponentType, type FC, memo, useMemo } from "react";
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
MessageAttachmentByIndexProvider,
|
|
7
|
-
} from "../../context";
|
|
4
|
+
import { useAuiState } from "@assistant-ui/store";
|
|
5
|
+
import { MessageAttachmentByIndexProvider } from "../../context/providers";
|
|
8
6
|
import { CompleteAttachment } from "../../types";
|
|
9
7
|
|
|
10
8
|
export namespace MessagePrimitiveAttachments {
|
|
@@ -41,7 +39,7 @@ const getComponent = (
|
|
|
41
39
|
const AttachmentComponent: FC<{
|
|
42
40
|
components: MessagePrimitiveAttachments.Props["components"];
|
|
43
41
|
}> = ({ components }) => {
|
|
44
|
-
const attachment =
|
|
42
|
+
const attachment = useAuiState(({ attachment }) => attachment);
|
|
45
43
|
if (!attachment) return null;
|
|
46
44
|
|
|
47
45
|
const Component = getComponent(components, attachment as CompleteAttachment);
|
|
@@ -96,7 +94,7 @@ MessagePrimitiveAttachmentByIndex.displayName =
|
|
|
96
94
|
export const MessagePrimitiveAttachments: FC<
|
|
97
95
|
MessagePrimitiveAttachments.Props
|
|
98
96
|
> = ({ components }) => {
|
|
99
|
-
const attachmentsCount =
|
|
97
|
+
const attachmentsCount = useAuiState(({ message }) => {
|
|
100
98
|
if (message.role !== "user") return 0;
|
|
101
99
|
return message.attachments.length;
|
|
102
100
|
});
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
import { FC, PropsWithChildren } from "react";
|
|
4
|
-
import {
|
|
4
|
+
import { useAuiState } from "@assistant-ui/store";
|
|
5
5
|
|
|
6
6
|
export const MessagePrimitiveError: FC<PropsWithChildren> = ({ children }) => {
|
|
7
|
-
const hasError =
|
|
7
|
+
const hasError = useAuiState(
|
|
8
8
|
({ message }) =>
|
|
9
9
|
message.status?.type === "incomplete" &&
|
|
10
10
|
message.status.reason === "error",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
import type { FC, PropsWithChildren } from "react";
|
|
4
|
-
import {
|
|
4
|
+
import { useAuiState } from "@assistant-ui/store";
|
|
5
5
|
import type { RequireAtLeastOne } from "../../utils/RequireAtLeastOne";
|
|
6
6
|
|
|
7
7
|
type MessageIfFilters = {
|
|
@@ -20,7 +20,7 @@ type MessageIfFilters = {
|
|
|
20
20
|
type UseMessageIfProps = RequireAtLeastOne<MessageIfFilters>;
|
|
21
21
|
|
|
22
22
|
const useMessageIf = (props: UseMessageIfProps) => {
|
|
23
|
-
return
|
|
23
|
+
return useAuiState(({ message }) => {
|
|
24
24
|
const {
|
|
25
25
|
role,
|
|
26
26
|
attachments,
|
|
@@ -78,7 +78,7 @@ export namespace MessagePrimitiveIf {
|
|
|
78
78
|
}
|
|
79
79
|
|
|
80
80
|
/**
|
|
81
|
-
* @deprecated Use `<
|
|
81
|
+
* @deprecated Use `<AuiIf condition={({ message }) => ...} />` instead.
|
|
82
82
|
*/
|
|
83
83
|
export const MessagePrimitiveIf: FC<MessagePrimitiveIf.Props> = ({
|
|
84
84
|
children,
|
|
@@ -7,12 +7,11 @@ import {
|
|
|
7
7
|
PropsWithChildren,
|
|
8
8
|
useMemo,
|
|
9
9
|
} from "react";
|
|
10
|
+
import { useAuiState, useAui } from "@assistant-ui/store";
|
|
10
11
|
import {
|
|
11
|
-
useAssistantState,
|
|
12
|
-
useAssistantApi,
|
|
13
12
|
PartByIndexProvider,
|
|
14
13
|
TextMessagePartProvider,
|
|
15
|
-
} from "../../context";
|
|
14
|
+
} from "../../context/providers";
|
|
16
15
|
import { MessagePartPrimitiveText } from "../messagePart/MessagePartText";
|
|
17
16
|
import { MessagePartPrimitiveImage } from "../messagePart/MessagePartImage";
|
|
18
17
|
import type {
|
|
@@ -107,7 +106,7 @@ const groupMessageParts = (
|
|
|
107
106
|
};
|
|
108
107
|
|
|
109
108
|
const useMessagePartsGroups = (): MessagePartRange[] => {
|
|
110
|
-
const messageTypes =
|
|
109
|
+
const messageTypes = useAuiState(
|
|
111
110
|
useShallow((s) => s.message.parts.map((c: any) => c.type)),
|
|
112
111
|
);
|
|
113
112
|
|
|
@@ -252,7 +251,7 @@ const ToolUIDisplay = ({
|
|
|
252
251
|
}: {
|
|
253
252
|
Fallback: ToolCallMessagePartComponent | undefined;
|
|
254
253
|
} & ToolCallMessagePartProps) => {
|
|
255
|
-
const Render =
|
|
254
|
+
const Render = useAuiState(({ tools }) => {
|
|
256
255
|
const Render = tools.tools[props.toolName] ?? Fallback;
|
|
257
256
|
if (Array.isArray(Render)) return Render[0] ?? Fallback;
|
|
258
257
|
return Render;
|
|
@@ -294,13 +293,13 @@ const MessagePartComponent: FC<MessagePartComponentProps> = ({
|
|
|
294
293
|
tools = {},
|
|
295
294
|
} = {},
|
|
296
295
|
}) => {
|
|
297
|
-
const
|
|
298
|
-
const part =
|
|
296
|
+
const aui = useAui();
|
|
297
|
+
const part = useAuiState(({ part }) => part);
|
|
299
298
|
|
|
300
299
|
const type = part.type;
|
|
301
300
|
if (type === "tool-call") {
|
|
302
|
-
const addResult =
|
|
303
|
-
const resume =
|
|
301
|
+
const addResult = aui.part().addToolResult;
|
|
302
|
+
const resume = aui.part().resumeToolCall;
|
|
304
303
|
if ("Override" in tools)
|
|
305
304
|
return <tools.Override {...part} addResult={addResult} resume={resume} />;
|
|
306
305
|
const Tool = tools.by_name?.[part.toolName] ?? tools.Fallback;
|
|
@@ -409,7 +408,7 @@ const COMPLETE_STATUS: MessagePartStatus = Object.freeze({
|
|
|
409
408
|
});
|
|
410
409
|
|
|
411
410
|
const EmptyPartsImpl: FC<MessagePartComponentProps> = ({ components }) => {
|
|
412
|
-
const status =
|
|
411
|
+
const status = useAuiState(
|
|
413
412
|
(s) => (s.message.status ?? COMPLETE_STATUS) as MessagePartStatus,
|
|
414
413
|
);
|
|
415
414
|
|
|
@@ -457,9 +456,7 @@ const EmptyParts = memo(
|
|
|
457
456
|
export const MessagePrimitiveParts: FC<MessagePrimitiveParts.Props> = ({
|
|
458
457
|
components,
|
|
459
458
|
}) => {
|
|
460
|
-
const contentLength =
|
|
461
|
-
({ message }) => message.parts.length,
|
|
462
|
-
);
|
|
459
|
+
const contentLength = useAuiState(({ message }) => message.parts.length);
|
|
463
460
|
const messageRanges = useMessagePartsGroups();
|
|
464
461
|
|
|
465
462
|
const partsElements = useMemo(() => {
|
|
@@ -7,12 +7,11 @@ import {
|
|
|
7
7
|
PropsWithChildren,
|
|
8
8
|
useMemo,
|
|
9
9
|
} from "react";
|
|
10
|
+
import { useAuiState, useAui } from "@assistant-ui/store";
|
|
10
11
|
import {
|
|
11
|
-
useAssistantState,
|
|
12
12
|
PartByIndexProvider,
|
|
13
|
-
useAssistantApi,
|
|
14
13
|
TextMessagePartProvider,
|
|
15
|
-
} from "../../context";
|
|
14
|
+
} from "../../context/providers";
|
|
16
15
|
import { MessagePartPrimitiveText } from "../messagePart/MessagePartText";
|
|
17
16
|
import { MessagePartPrimitiveImage } from "../messagePart/MessagePartImage";
|
|
18
17
|
import type {
|
|
@@ -75,7 +74,7 @@ const groupMessagePartsByParentId: GroupingFunction = (
|
|
|
75
74
|
const useMessagePartsGrouped = (
|
|
76
75
|
groupingFunction: GroupingFunction,
|
|
77
76
|
): MessagePartGroup[] => {
|
|
78
|
-
const parts =
|
|
77
|
+
const parts = useAuiState(({ message }) => message.parts);
|
|
79
78
|
|
|
80
79
|
return useMemo(() => {
|
|
81
80
|
if (parts.length === 0) {
|
|
@@ -220,7 +219,7 @@ const ToolUIDisplay = ({
|
|
|
220
219
|
}: {
|
|
221
220
|
Fallback: ToolCallMessagePartComponent | undefined;
|
|
222
221
|
} & ToolCallMessagePartProps) => {
|
|
223
|
-
const Render =
|
|
222
|
+
const Render = useAuiState(({ tools }) => {
|
|
224
223
|
const Render = tools.tools[props.toolName] ?? Fallback;
|
|
225
224
|
if (Array.isArray(Render)) return Render[0] ?? Fallback;
|
|
226
225
|
return Render;
|
|
@@ -261,13 +260,13 @@ const MessagePartComponent: FC<MessagePartComponentProps> = ({
|
|
|
261
260
|
tools = {},
|
|
262
261
|
} = {},
|
|
263
262
|
}) => {
|
|
264
|
-
const
|
|
265
|
-
const part =
|
|
263
|
+
const aui = useAui();
|
|
264
|
+
const part = useAuiState(({ part }) => part);
|
|
266
265
|
|
|
267
266
|
const type = part.type;
|
|
268
267
|
if (type === "tool-call") {
|
|
269
|
-
const addResult = (result: any) =>
|
|
270
|
-
const resume =
|
|
268
|
+
const addResult = (result: any) => aui.part().addToolResult(result);
|
|
269
|
+
const resume = aui.part().resumeToolCall;
|
|
271
270
|
if ("Override" in tools)
|
|
272
271
|
return <tools.Override {...part} addResult={addResult} resume={resume} />;
|
|
273
272
|
const Tool = tools.by_name?.[part.toolName] ?? tools.Fallback;
|
|
@@ -355,7 +354,7 @@ const COMPLETE_STATUS: MessagePartStatus = Object.freeze({
|
|
|
355
354
|
});
|
|
356
355
|
|
|
357
356
|
const EmptyPartsImpl: FC<MessagePartComponentProps> = ({ components }) => {
|
|
358
|
-
const status =
|
|
357
|
+
const status = useAuiState(
|
|
359
358
|
(s) => (s.message.status ?? COMPLETE_STATUS) as MessagePartStatus,
|
|
360
359
|
);
|
|
361
360
|
|
|
@@ -427,9 +426,7 @@ const EmptyParts = memo(
|
|
|
427
426
|
export const MessagePrimitiveUnstable_PartsGrouped: FC<
|
|
428
427
|
MessagePrimitiveUnstable_PartsGrouped.Props
|
|
429
428
|
> = ({ groupingFunction, components }) => {
|
|
430
|
-
const contentLength =
|
|
431
|
-
({ message }) => message.parts.length,
|
|
432
|
-
);
|
|
429
|
+
const contentLength = useAuiState(({ message }) => message.parts.length);
|
|
433
430
|
const messageGroups = useMessagePartsGrouped(groupingFunction);
|
|
434
431
|
|
|
435
432
|
const partsElements = useMemo(() => {
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
ComponentPropsWithoutRef,
|
|
8
8
|
useCallback,
|
|
9
9
|
} from "react";
|
|
10
|
-
import {
|
|
10
|
+
import { useAui, useAuiState } from "@assistant-ui/store";
|
|
11
11
|
import { useManagedRef } from "../../utils/hooks/useManagedRef";
|
|
12
12
|
import { useSizeHandle } from "../../utils/hooks/useSizeHandle";
|
|
13
13
|
import { useComposedRefs } from "@radix-ui/react-compose-refs";
|
|
@@ -15,8 +15,8 @@ import { useThreadViewport } from "../../context/react/ThreadViewportContext";
|
|
|
15
15
|
import { ThreadPrimitiveViewportSlack } from "../thread/ThreadViewportSlack";
|
|
16
16
|
|
|
17
17
|
const useIsHoveringRef = () => {
|
|
18
|
-
const
|
|
19
|
-
const message =
|
|
18
|
+
const aui = useAui();
|
|
19
|
+
const message = useAuiState(() => aui.message());
|
|
20
20
|
|
|
21
21
|
const callbackRef = useCallback(
|
|
22
22
|
(el: HTMLElement) => {
|
|
@@ -59,7 +59,7 @@ const useMessageViewportRef = () => {
|
|
|
59
59
|
|
|
60
60
|
// inset rules:
|
|
61
61
|
// - the previous user message before the last assistant message registers its full height
|
|
62
|
-
const shouldRegisterAsInset =
|
|
62
|
+
const shouldRegisterAsInset = useAuiState(
|
|
63
63
|
({ thread, message }) =>
|
|
64
64
|
turnAnchor === "top" &&
|
|
65
65
|
message.role === "user" &&
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
import { FC, PropsWithChildren } from "react";
|
|
4
|
-
import {
|
|
4
|
+
import { useAuiState } from "@assistant-ui/store";
|
|
5
5
|
|
|
6
6
|
export namespace MessagePartPrimitiveInProgress {
|
|
7
7
|
export type Props = PropsWithChildren;
|
|
@@ -11,7 +11,7 @@ export namespace MessagePartPrimitiveInProgress {
|
|
|
11
11
|
export const MessagePartPrimitiveInProgress: FC<
|
|
12
12
|
MessagePartPrimitiveInProgress.Props
|
|
13
13
|
> = ({ children }) => {
|
|
14
|
-
const isInProgress =
|
|
14
|
+
const isInProgress = useAuiState(
|
|
15
15
|
({ part }) => part.status.type === "running",
|
|
16
16
|
);
|
|
17
17
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { useAuiState } from "@assistant-ui/store";
|
|
4
4
|
import { DataMessagePart } from "../../types";
|
|
5
5
|
|
|
6
6
|
export const useMessagePartData = <T = any>(name?: string) => {
|
|
7
|
-
const part =
|
|
7
|
+
const part = useAuiState(({ part }) => {
|
|
8
8
|
if (part.type !== "data") {
|
|
9
9
|
return null;
|
|
10
10
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
import { MessagePartState } from "../../legacy-runtime/runtime/MessagePartRuntime";
|
|
4
|
-
import {
|
|
4
|
+
import { useAuiState } from "@assistant-ui/store";
|
|
5
5
|
import { FileMessagePart } from "../../types";
|
|
6
6
|
|
|
7
7
|
export const useMessagePartFile = () => {
|
|
8
|
-
const file =
|
|
8
|
+
const file = useAuiState(({ part }) => {
|
|
9
9
|
if (part.type !== "file")
|
|
10
10
|
throw new Error(
|
|
11
11
|
"MessagePartFile can only be used inside file message parts.",
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
import { MessagePartState } from "../../legacy-runtime/runtime/MessagePartRuntime";
|
|
4
|
-
import {
|
|
4
|
+
import { useAuiState } from "@assistant-ui/store";
|
|
5
5
|
import { ImageMessagePart } from "../../types";
|
|
6
6
|
|
|
7
7
|
export const useMessagePartImage = () => {
|
|
8
|
-
const image =
|
|
8
|
+
const image = useAuiState(({ part }) => {
|
|
9
9
|
if (part.type !== "image")
|
|
10
10
|
throw new Error(
|
|
11
11
|
"MessagePartImage can only be used inside image message parts.",
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
import { MessagePartState } from "../../legacy-runtime/runtime/MessagePartRuntime";
|
|
4
|
-
import {
|
|
4
|
+
import { useAuiState } from "@assistant-ui/store";
|
|
5
5
|
import { ReasoningMessagePart } from "../../types";
|
|
6
6
|
|
|
7
7
|
export const useMessagePartReasoning = () => {
|
|
8
|
-
const text =
|
|
8
|
+
const text = useAuiState(({ part }) => {
|
|
9
9
|
if (part.type !== "reasoning")
|
|
10
10
|
throw new Error(
|
|
11
11
|
"MessagePartReasoning can only be used inside reasoning message parts.",
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
import type { MessagePartState } from "../../legacy-runtime/runtime/MessagePartRuntime";
|
|
4
|
-
import {
|
|
4
|
+
import { useAuiState } from "@assistant-ui/store";
|
|
5
5
|
import { SourceMessagePart } from "../../types";
|
|
6
6
|
|
|
7
7
|
export const useMessagePartSource = () => {
|
|
8
|
-
const source =
|
|
8
|
+
const source = useAuiState(({ part }) => {
|
|
9
9
|
if (part.type !== "source")
|
|
10
10
|
throw new Error(
|
|
11
11
|
"MessagePartSource can only be used inside source message parts.",
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
import { MessagePartState } from "../../legacy-runtime/runtime/MessagePartRuntime";
|
|
4
|
-
import {
|
|
4
|
+
import { useAuiState } from "@assistant-ui/store";
|
|
5
5
|
import { TextMessagePart, ReasoningMessagePart } from "../../types";
|
|
6
6
|
|
|
7
7
|
export const useMessagePartText = () => {
|
|
8
|
-
const text =
|
|
8
|
+
const text = useAuiState(({ part }) => {
|
|
9
9
|
if (part.type !== "text" && part.type !== "reasoning")
|
|
10
10
|
throw new Error(
|
|
11
11
|
"MessagePartText can only be used inside text or reasoning message parts.",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
import type { FC, PropsWithChildren } from "react";
|
|
4
|
-
import {
|
|
4
|
+
import { useAuiState } from "@assistant-ui/store";
|
|
5
5
|
|
|
6
6
|
export namespace ThreadPrimitiveEmpty {
|
|
7
7
|
export type Props = PropsWithChildren;
|
|
@@ -10,7 +10,7 @@ export namespace ThreadPrimitiveEmpty {
|
|
|
10
10
|
export const ThreadPrimitiveEmpty: FC<ThreadPrimitiveEmpty.Props> = ({
|
|
11
11
|
children,
|
|
12
12
|
}) => {
|
|
13
|
-
const empty =
|
|
13
|
+
const empty = useAuiState(
|
|
14
14
|
({ thread }) => thread.messages.length === 0 && !thread.isLoading,
|
|
15
15
|
);
|
|
16
16
|
return empty ? children : null;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
import type { FC, PropsWithChildren } from "react";
|
|
4
|
-
import {
|
|
4
|
+
import { useAuiState } from "@assistant-ui/store";
|
|
5
5
|
import type { RequireAtLeastOne } from "../../utils/RequireAtLeastOne";
|
|
6
6
|
|
|
7
7
|
type ThreadIfFilters = {
|
|
@@ -13,7 +13,7 @@ type ThreadIfFilters = {
|
|
|
13
13
|
type UseThreadIfProps = RequireAtLeastOne<ThreadIfFilters>;
|
|
14
14
|
|
|
15
15
|
const useThreadIf = (props: UseThreadIfProps) => {
|
|
16
|
-
return
|
|
16
|
+
return useAuiState(({ thread }) => {
|
|
17
17
|
if (props.empty === true && !thread.isEmpty) return false;
|
|
18
18
|
if (props.empty === false && thread.isEmpty) return false;
|
|
19
19
|
|
|
@@ -31,7 +31,7 @@ export namespace ThreadPrimitiveIf {
|
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
/**
|
|
34
|
-
* @deprecated Use `<
|
|
34
|
+
* @deprecated Use `<AuiIf condition={({ thread }) => ...} />` instead.
|
|
35
35
|
*/
|
|
36
36
|
export const ThreadPrimitiveIf: FC<ThreadPrimitiveIf.Props> = ({
|
|
37
37
|
children,
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
import { type ComponentType, type FC, memo, useMemo } from "react";
|
|
4
|
-
import {
|
|
4
|
+
import { useAuiState } from "@assistant-ui/store";
|
|
5
|
+
import { MessageByIndexProvider } from "../../context/providers";
|
|
5
6
|
import { ThreadMessage as ThreadMessageType } from "../../types";
|
|
6
7
|
|
|
7
8
|
export namespace ThreadPrimitiveMessages {
|
|
@@ -128,10 +129,8 @@ type ThreadMessageComponentProps = {
|
|
|
128
129
|
const ThreadMessageComponent: FC<ThreadMessageComponentProps> = ({
|
|
129
130
|
components,
|
|
130
131
|
}) => {
|
|
131
|
-
const role =
|
|
132
|
-
const isEditing =
|
|
133
|
-
({ message }) => message.composer.isEditing,
|
|
134
|
-
);
|
|
132
|
+
const role = useAuiState(({ message }) => message.role);
|
|
133
|
+
const isEditing = useAuiState(({ message }) => message.composer.isEditing);
|
|
135
134
|
const Component = getComponent(components, role, isEditing);
|
|
136
135
|
|
|
137
136
|
return <Component />;
|
|
@@ -197,9 +196,7 @@ ThreadPrimitiveMessageByIndex.displayName = "ThreadPrimitive.MessageByIndex";
|
|
|
197
196
|
export const ThreadPrimitiveMessagesImpl: FC<ThreadPrimitiveMessages.Props> = ({
|
|
198
197
|
components,
|
|
199
198
|
}) => {
|
|
200
|
-
const messagesLength =
|
|
201
|
-
({ thread }) => thread.messages.length,
|
|
202
|
-
);
|
|
199
|
+
const messagesLength = useAuiState(({ thread }) => thread.messages.length);
|
|
203
200
|
|
|
204
201
|
const messageElements = useMemo(() => {
|
|
205
202
|
if (messagesLength === 0) return null;
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
createActionButton,
|
|
7
7
|
} from "../../utils/createActionButton";
|
|
8
8
|
import { useCallback } from "react";
|
|
9
|
-
import {
|
|
9
|
+
import { useAuiState, useAui } from "@assistant-ui/store";
|
|
10
10
|
|
|
11
11
|
const useThreadSuggestion = ({
|
|
12
12
|
prompt,
|
|
@@ -39,32 +39,32 @@ const useThreadSuggestion = ({
|
|
|
39
39
|
/** @deprecated Use `clearComposer` instead. */
|
|
40
40
|
method?: "replace";
|
|
41
41
|
}) => {
|
|
42
|
-
const
|
|
43
|
-
const disabled =
|
|
42
|
+
const aui = useAui();
|
|
43
|
+
const disabled = useAuiState(({ thread }) => thread.isDisabled);
|
|
44
44
|
|
|
45
45
|
// ========== Deprecation Mapping ==========
|
|
46
46
|
const resolvedSend = send ?? autoSend ?? false;
|
|
47
47
|
// ==========================================
|
|
48
48
|
|
|
49
49
|
const callback = useCallback(() => {
|
|
50
|
-
const isRunning =
|
|
50
|
+
const isRunning = aui.thread().getState().isRunning;
|
|
51
51
|
|
|
52
52
|
if (resolvedSend && !isRunning) {
|
|
53
|
-
|
|
53
|
+
aui.thread().append(prompt);
|
|
54
54
|
if (clearComposer) {
|
|
55
|
-
|
|
55
|
+
aui.composer().setText("");
|
|
56
56
|
}
|
|
57
57
|
} else {
|
|
58
58
|
if (clearComposer) {
|
|
59
|
-
|
|
59
|
+
aui.composer().setText(prompt);
|
|
60
60
|
} else {
|
|
61
|
-
const currentText =
|
|
62
|
-
|
|
61
|
+
const currentText = aui.composer().getState().text;
|
|
62
|
+
aui
|
|
63
63
|
.composer()
|
|
64
64
|
.setText(currentText.trim() ? `${currentText} ${prompt}` : prompt);
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
|
-
}, [
|
|
67
|
+
}, [aui, resolvedSend, clearComposer, prompt]);
|
|
68
68
|
|
|
69
69
|
if (disabled) return null;
|
|
70
70
|
return callback;
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
useContext,
|
|
10
10
|
} from "react";
|
|
11
11
|
import { useThreadViewportStore } from "../../context/react/ThreadViewportContext";
|
|
12
|
-
import {
|
|
12
|
+
import { useAuiState } from "@assistant-ui/store";
|
|
13
13
|
import { useManagedRef } from "../../utils/hooks/useManagedRef";
|
|
14
14
|
|
|
15
15
|
const SlackNestingContext = createContext(false);
|
|
@@ -57,7 +57,7 @@ export const ThreadPrimitiveViewportSlack: FC<ThreadViewportSlackProps> = ({
|
|
|
57
57
|
fillClampThreshold = "10em",
|
|
58
58
|
fillClampOffset = "6em",
|
|
59
59
|
}) => {
|
|
60
|
-
const shouldApplySlack =
|
|
60
|
+
const shouldApplySlack = useAuiState(
|
|
61
61
|
// only add slack to the last assistant message following a user message (valid turn)
|
|
62
62
|
({ thread, message }) =>
|
|
63
63
|
message.isLast &&
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { useComposedRefs } from "@radix-ui/react-compose-refs";
|
|
4
4
|
import { useCallback, useRef, type RefCallback } from "react";
|
|
5
|
-
import {
|
|
5
|
+
import { useAuiEvent } from "@assistant-ui/store";
|
|
6
6
|
import { useOnResizeContent } from "../../utils/hooks/useOnResizeContent";
|
|
7
7
|
import { useOnScrollToBottom } from "../../utils/hooks/useOnScrollToBottom";
|
|
8
8
|
import { useManagedRef } from "../../utils/hooks/useManagedRef";
|
|
@@ -122,7 +122,7 @@ export const useThreadViewportAutoScroll = <TElement extends HTMLElement>({
|
|
|
122
122
|
});
|
|
123
123
|
|
|
124
124
|
// autoscroll on run start
|
|
125
|
-
|
|
125
|
+
useAuiEvent("thread.runStart", () => {
|
|
126
126
|
if (!scrollToBottomOnRunStart) return;
|
|
127
127
|
scrollingToBottomBehaviorRef.current = "auto";
|
|
128
128
|
requestAnimationFrame(() => {
|
|
@@ -131,7 +131,7 @@ export const useThreadViewportAutoScroll = <TElement extends HTMLElement>({
|
|
|
131
131
|
});
|
|
132
132
|
|
|
133
133
|
// scroll to bottom instantly when thread history is first loaded
|
|
134
|
-
|
|
134
|
+
useAuiEvent("thread.initialize", () => {
|
|
135
135
|
if (!scrollToBottomOnInitialize) return;
|
|
136
136
|
scrollingToBottomBehaviorRef.current = "instant";
|
|
137
137
|
requestAnimationFrame(() => {
|
|
@@ -140,7 +140,7 @@ export const useThreadViewportAutoScroll = <TElement extends HTMLElement>({
|
|
|
140
140
|
});
|
|
141
141
|
|
|
142
142
|
// scroll to bottom instantly when switching threads
|
|
143
|
-
|
|
143
|
+
useAuiEvent("threadListItem.switchedTo", () => {
|
|
144
144
|
if (!scrollToBottomOnThreadSwitch) return;
|
|
145
145
|
scrollingToBottomBehaviorRef.current = "instant";
|
|
146
146
|
requestAnimationFrame(() => {
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
import { ComponentType, FC, memo, useMemo } from "react";
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
useAssistantState,
|
|
7
|
-
} from "../../context";
|
|
4
|
+
import { useAuiState } from "@assistant-ui/store";
|
|
5
|
+
import { ThreadListItemByIndexProvider } from "../../context/providers";
|
|
8
6
|
|
|
9
7
|
export namespace ThreadListPrimitiveItems {
|
|
10
8
|
export type Props = {
|
|
@@ -62,7 +60,7 @@ export const ThreadListPrimitiveItems: FC<ThreadListPrimitiveItems.Props> = ({
|
|
|
62
60
|
archived = false,
|
|
63
61
|
components,
|
|
64
62
|
}) => {
|
|
65
|
-
const contentLength =
|
|
63
|
+
const contentLength = useAuiState(({ threads }) =>
|
|
66
64
|
archived ? threads.archivedThreadIds.length : threads.threadIds.length,
|
|
67
65
|
);
|
|
68
66
|
|