@assistant-ui/react 0.10.23 → 0.10.25
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/api/{ContentPartRuntime.d.ts → MessagePartRuntime.d.ts} +14 -14
- package/dist/api/{ContentPartRuntime.d.ts.map → MessagePartRuntime.d.ts.map} +1 -1
- package/dist/api/{ContentPartRuntime.js → MessagePartRuntime.js} +6 -6
- package/dist/api/{ContentPartRuntime.js.map → MessagePartRuntime.js.map} +1 -1
- package/dist/api/MessageRuntime.d.ts +8 -8
- package/dist/api/MessageRuntime.js +17 -17
- package/dist/api/MessageRuntime.js.map +1 -1
- package/dist/api/RuntimePathTypes.d.ts +2 -2
- package/dist/api/ThreadListRuntime.d.ts +3 -0
- package/dist/api/ThreadListRuntime.d.ts.map +1 -1
- package/dist/api/ThreadListRuntime.js +5 -1
- package/dist/api/ThreadListRuntime.js.map +1 -1
- package/dist/api/ThreadRuntime.d.ts +5 -0
- package/dist/api/ThreadRuntime.d.ts.map +1 -1
- package/dist/api/ThreadRuntime.js +1 -0
- package/dist/api/ThreadRuntime.js.map +1 -1
- package/dist/api/index.d.ts +2 -1
- package/dist/api/index.d.ts.map +1 -1
- package/dist/cloud/AssistantCloudThreadHistoryAdapter.d.ts +1 -1
- package/dist/cloud/AssistantCloudThreadHistoryAdapter.d.ts.map +1 -1
- package/dist/cloud/AssistantCloudThreadHistoryAdapter.js.map +1 -1
- package/dist/cloud/auiV0.d.ts +3 -3
- package/dist/cloud/auiV0.d.ts.map +1 -1
- package/dist/cloud/auiV0.js +1 -1
- package/dist/cloud/auiV0.js.map +1 -1
- package/dist/cloud/index.d.ts +1 -1
- package/dist/cloud/index.d.ts.map +1 -1
- package/dist/cloud/index.js +1 -1
- package/dist/cloud/index.js.map +1 -1
- package/dist/cloud/useCloudThreadListRuntime.d.ts +1 -1
- package/dist/cloud/useCloudThreadListRuntime.d.ts.map +1 -1
- package/dist/cloud/useCloudThreadListRuntime.js.map +1 -1
- package/dist/context/providers/MessagePartRuntimeProvider.d.ts +9 -0
- package/dist/context/providers/{ContentPartRuntimeProvider.d.ts.map → MessagePartRuntimeProvider.d.ts.map} +1 -1
- package/dist/context/providers/{ContentPartRuntimeProvider.js → MessagePartRuntimeProvider.js} +9 -9
- package/dist/context/providers/MessagePartRuntimeProvider.js.map +1 -0
- package/dist/context/providers/{TextContentPartProvider.d.ts → TextMessagePartProvider.d.ts} +3 -3
- package/dist/context/providers/{TextContentPartProvider.d.ts.map → TextMessagePartProvider.d.ts.map} +1 -1
- package/dist/context/providers/{TextContentPartProvider.js → TextMessagePartProvider.js} +19 -19
- package/dist/context/providers/{TextContentPartProvider.js.map → TextMessagePartProvider.js.map} +1 -1
- package/dist/context/providers/index.d.ts +2 -1
- package/dist/context/providers/index.d.ts.map +1 -1
- package/dist/context/providers/index.js +4 -2
- package/dist/context/providers/index.js.map +1 -1
- package/dist/context/react/AssistantContext.d.ts +23 -0
- package/dist/context/react/AssistantContext.d.ts.map +1 -1
- package/dist/context/react/AssistantContext.js.map +1 -1
- package/dist/context/react/AttachmentContext.d.ts +72 -72
- package/dist/context/react/ComposerContext.d.ts +64 -0
- package/dist/context/react/ComposerContext.d.ts.map +1 -1
- package/dist/context/react/ComposerContext.js.map +1 -1
- package/dist/context/react/MessageContext.d.ts +56 -0
- package/dist/context/react/MessageContext.d.ts.map +1 -1
- package/dist/context/react/MessageContext.js.map +1 -1
- package/dist/context/react/MessagePartContext.d.ts +41 -0
- package/dist/context/react/{ContentPartContext.d.ts.map → MessagePartContext.d.ts.map} +1 -1
- package/dist/context/react/MessagePartContext.js +25 -0
- package/dist/context/react/MessagePartContext.js.map +1 -0
- package/dist/context/react/ThreadContext.d.ts +42 -0
- package/dist/context/react/ThreadContext.d.ts.map +1 -1
- package/dist/context/react/ThreadContext.js.map +1 -1
- package/dist/context/react/index.d.ts +1 -1
- package/dist/context/react/index.js +3 -3
- package/dist/context/react/index.js.map +1 -1
- package/dist/context/stores/AssistantToolUIs.d.ts +3 -3
- package/dist/context/stores/AssistantToolUIs.js.map +1 -1
- package/dist/model-context/useAssistantTool.d.ts +2 -2
- package/dist/model-context/useAssistantTool.js.map +1 -1
- package/dist/model-context/useAssistantToolUI.d.ts +2 -2
- package/dist/model-context/useAssistantToolUI.js.map +1 -1
- package/dist/model-context/useInlineRender.d.ts +2 -2
- package/dist/model-context/useInlineRender.js.map +1 -1
- package/dist/primitives/actionBar/ActionBarCopy.d.ts +42 -0
- package/dist/primitives/actionBar/ActionBarCopy.d.ts.map +1 -1
- package/dist/primitives/actionBar/ActionBarCopy.js.map +1 -1
- package/dist/primitives/actionBar/ActionBarEdit.d.ts +38 -0
- package/dist/primitives/actionBar/ActionBarEdit.d.ts.map +1 -1
- package/dist/primitives/actionBar/ActionBarEdit.js.map +1 -1
- package/dist/primitives/actionBar/ActionBarReload.d.ts +39 -0
- package/dist/primitives/actionBar/ActionBarReload.d.ts.map +1 -1
- package/dist/primitives/actionBar/ActionBarReload.js.map +1 -1
- package/dist/primitives/actionBar/ActionBarRoot.d.ts +56 -0
- package/dist/primitives/actionBar/ActionBarRoot.d.ts.map +1 -1
- package/dist/primitives/actionBar/ActionBarRoot.js.map +1 -1
- package/dist/primitives/assistantModal/AssistantModalContent.d.ts +2 -0
- package/dist/primitives/assistantModal/AssistantModalContent.d.ts.map +1 -1
- package/dist/primitives/assistantModal/AssistantModalContent.js +2 -1
- package/dist/primitives/assistantModal/AssistantModalContent.js.map +1 -1
- package/dist/primitives/attachment/AttachmentRoot.d.ts +18 -0
- package/dist/primitives/attachment/AttachmentRoot.d.ts.map +1 -1
- package/dist/primitives/attachment/AttachmentRoot.js.map +1 -1
- package/dist/primitives/branchPicker/BranchPickerCount.d.ts +17 -0
- package/dist/primitives/branchPicker/BranchPickerCount.d.ts.map +1 -1
- package/dist/primitives/branchPicker/BranchPickerCount.js.map +1 -1
- package/dist/primitives/branchPicker/BranchPickerNext.d.ts +17 -0
- package/dist/primitives/branchPicker/BranchPickerNext.d.ts.map +1 -1
- package/dist/primitives/branchPicker/BranchPickerNext.js.map +1 -1
- package/dist/primitives/branchPicker/BranchPickerPrevious.d.ts +38 -0
- package/dist/primitives/branchPicker/BranchPickerPrevious.d.ts.map +1 -1
- package/dist/primitives/branchPicker/BranchPickerPrevious.js.map +1 -1
- package/dist/primitives/branchPicker/BranchPickerRoot.d.ts +27 -0
- package/dist/primitives/branchPicker/BranchPickerRoot.d.ts.map +1 -1
- package/dist/primitives/branchPicker/BranchPickerRoot.js.map +1 -1
- package/dist/primitives/composer/ComposerAttachments.d.ts.map +1 -1
- package/dist/primitives/composer/ComposerAttachments.js +11 -8
- package/dist/primitives/composer/ComposerAttachments.js.map +1 -1
- package/dist/primitives/composer/ComposerCancel.d.ts +17 -0
- package/dist/primitives/composer/ComposerCancel.d.ts.map +1 -1
- package/dist/primitives/composer/ComposerCancel.js.map +1 -1
- package/dist/primitives/composer/ComposerInput.d.ts +72 -0
- package/dist/primitives/composer/ComposerInput.d.ts.map +1 -1
- package/dist/primitives/composer/ComposerInput.js.map +1 -1
- package/dist/primitives/composer/ComposerRoot.d.ts +19 -0
- package/dist/primitives/composer/ComposerRoot.d.ts.map +1 -1
- package/dist/primitives/composer/ComposerRoot.js.map +1 -1
- package/dist/primitives/composer/ComposerSend.d.ts +18 -0
- package/dist/primitives/composer/ComposerSend.d.ts.map +1 -1
- package/dist/primitives/composer/ComposerSend.js.map +1 -1
- package/dist/primitives/index.d.ts +12 -6
- package/dist/primitives/index.d.ts.map +1 -1
- package/dist/primitives/index.js +23 -11
- package/dist/primitives/index.js.map +1 -1
- package/dist/primitives/message/MessageAttachments.d.ts.map +1 -1
- package/dist/primitives/message/MessageAttachments.js +11 -8
- package/dist/primitives/message/MessageAttachments.js.map +1 -1
- package/dist/primitives/message/MessageParts.d.ts +116 -0
- package/dist/primitives/message/MessageParts.d.ts.map +1 -0
- package/dist/primitives/message/MessageParts.js +208 -0
- package/dist/primitives/message/MessageParts.js.map +1 -0
- package/dist/primitives/message/MessageRoot.d.ts +22 -0
- package/dist/primitives/message/MessageRoot.d.ts.map +1 -1
- package/dist/primitives/message/MessageRoot.js.map +1 -1
- package/dist/primitives/message/index.d.ts +2 -1
- package/dist/primitives/message/index.d.ts.map +1 -1
- package/dist/primitives/message/index.js +4 -2
- package/dist/primitives/message/index.js.map +1 -1
- package/dist/primitives/messagePart/MessagePartImage.d.ts +29 -0
- package/dist/primitives/messagePart/MessagePartImage.d.ts.map +1 -0
- package/dist/primitives/messagePart/MessagePartImage.js +16 -0
- package/dist/primitives/messagePart/MessagePartImage.js.map +1 -0
- package/dist/primitives/messagePart/MessagePartInProgress.d.ts +6 -0
- package/dist/primitives/{contentPart/ContentPartInProgress.d.ts.map → messagePart/MessagePartInProgress.d.ts.map} +1 -1
- package/dist/primitives/messagePart/MessagePartInProgress.js +13 -0
- package/dist/primitives/messagePart/MessagePartInProgress.js.map +1 -0
- package/dist/primitives/messagePart/MessagePartText.d.ts +50 -0
- package/dist/primitives/messagePart/MessagePartText.d.ts.map +1 -0
- package/dist/primitives/messagePart/MessagePartText.js +18 -0
- package/dist/primitives/messagePart/MessagePartText.js.map +1 -0
- package/dist/primitives/messagePart/index.d.ts +4 -0
- package/dist/primitives/{contentPart → messagePart}/index.d.ts.map +1 -1
- package/dist/primitives/messagePart/index.js +10 -0
- package/dist/primitives/messagePart/index.js.map +1 -0
- package/dist/primitives/messagePart/useMessagePartFile.d.ts +5 -0
- package/dist/primitives/messagePart/useMessagePartFile.d.ts.map +1 -0
- package/dist/primitives/messagePart/useMessagePartFile.js +18 -0
- package/dist/primitives/messagePart/useMessagePartFile.js.map +1 -0
- package/dist/primitives/messagePart/useMessagePartImage.d.ts +5 -0
- package/dist/primitives/messagePart/useMessagePartImage.d.ts.map +1 -0
- package/dist/primitives/messagePart/useMessagePartImage.js +18 -0
- package/dist/primitives/messagePart/useMessagePartImage.js.map +1 -0
- package/dist/primitives/messagePart/useMessagePartReasoning.d.ts +5 -0
- package/dist/primitives/messagePart/useMessagePartReasoning.d.ts.map +1 -0
- package/dist/primitives/messagePart/useMessagePartReasoning.js +18 -0
- package/dist/primitives/messagePart/useMessagePartReasoning.js.map +1 -0
- package/dist/primitives/messagePart/useMessagePartSource.d.ts +5 -0
- package/dist/primitives/messagePart/useMessagePartSource.d.ts.map +1 -0
- package/dist/primitives/messagePart/useMessagePartSource.js +18 -0
- package/dist/primitives/messagePart/useMessagePartSource.js.map +1 -0
- package/dist/primitives/messagePart/useMessagePartText.d.ts +7 -0
- package/dist/primitives/messagePart/useMessagePartText.d.ts.map +1 -0
- package/dist/primitives/messagePart/useMessagePartText.js +18 -0
- package/dist/primitives/messagePart/useMessagePartText.js.map +1 -0
- package/dist/primitives/thread/ThreadMessages.d.ts +44 -0
- package/dist/primitives/thread/ThreadMessages.d.ts.map +1 -1
- package/dist/primitives/thread/ThreadMessages.js +5 -2
- package/dist/primitives/thread/ThreadMessages.js.map +1 -1
- package/dist/primitives/thread/ThreadRoot.d.ts +19 -0
- package/dist/primitives/thread/ThreadRoot.d.ts.map +1 -1
- package/dist/primitives/thread/ThreadRoot.js.map +1 -1
- package/dist/primitives/thread/ThreadViewport.d.ts +24 -0
- package/dist/primitives/thread/ThreadViewport.d.ts.map +1 -1
- package/dist/primitives/thread/ThreadViewport.js.map +1 -1
- package/dist/primitives/threadList/ThreadListItems.d.ts.map +1 -1
- package/dist/primitives/threadList/ThreadListItems.js +12 -9
- package/dist/primitives/threadList/ThreadListItems.js.map +1 -1
- package/dist/runtimes/adapters/attachment/AttachmentAdapter.d.ts +54 -0
- package/dist/runtimes/adapters/attachment/AttachmentAdapter.d.ts.map +1 -1
- package/dist/runtimes/adapters/feedback/FeedbackAdapter.d.ts +33 -0
- package/dist/runtimes/adapters/feedback/FeedbackAdapter.d.ts.map +1 -1
- package/dist/runtimes/adapters/speech/SpeechAdapterTypes.d.ts +47 -0
- package/dist/runtimes/adapters/speech/SpeechAdapterTypes.d.ts.map +1 -1
- package/dist/runtimes/core/BaseThreadRuntimeCore.d.ts +1 -0
- package/dist/runtimes/core/BaseThreadRuntimeCore.d.ts.map +1 -1
- package/dist/runtimes/core/BaseThreadRuntimeCore.js.map +1 -1
- package/dist/runtimes/core/ThreadListRuntimeCore.d.ts +1 -0
- package/dist/runtimes/core/ThreadListRuntimeCore.d.ts.map +1 -1
- package/dist/runtimes/core/ThreadRuntimeCore.d.ts +1 -0
- package/dist/runtimes/core/ThreadRuntimeCore.d.ts.map +1 -1
- package/dist/runtimes/external-store/ExternalStoreAdapter.d.ts +2 -0
- package/dist/runtimes/external-store/ExternalStoreAdapter.d.ts.map +1 -1
- package/dist/runtimes/external-store/ExternalStoreThreadListRuntimeCore.d.ts +1 -0
- package/dist/runtimes/external-store/ExternalStoreThreadListRuntimeCore.d.ts.map +1 -1
- package/dist/runtimes/external-store/ExternalStoreThreadListRuntimeCore.js +3 -0
- package/dist/runtimes/external-store/ExternalStoreThreadListRuntimeCore.js.map +1 -1
- package/dist/runtimes/external-store/ExternalStoreThreadRuntimeCore.d.ts +1 -0
- package/dist/runtimes/external-store/ExternalStoreThreadRuntimeCore.d.ts.map +1 -1
- package/dist/runtimes/external-store/ExternalStoreThreadRuntimeCore.js +3 -0
- package/dist/runtimes/external-store/ExternalStoreThreadRuntimeCore.js.map +1 -1
- package/dist/runtimes/external-store/ThreadMessageLike.d.ts +3 -3
- package/dist/runtimes/external-store/ThreadMessageLike.js +3 -3
- package/dist/runtimes/external-store/ThreadMessageLike.js.map +1 -1
- package/dist/runtimes/external-store/createMessageConverter.js +3 -3
- package/dist/runtimes/external-store/createMessageConverter.js.map +1 -1
- package/dist/runtimes/external-store/external-message-converter.js.map +1 -1
- package/dist/runtimes/local/ChatModelAdapter.d.ts +4 -4
- package/dist/runtimes/local/LocalRuntimeOptions.d.ts +2 -2
- package/dist/runtimes/local/LocalRuntimeOptions.d.ts.map +1 -1
- package/dist/runtimes/local/LocalRuntimeOptions.js.map +1 -1
- package/dist/runtimes/local/LocalThreadListRuntimeCore.d.ts +1 -0
- package/dist/runtimes/local/LocalThreadListRuntimeCore.d.ts.map +1 -1
- package/dist/runtimes/local/LocalThreadListRuntimeCore.js +3 -0
- package/dist/runtimes/local/LocalThreadListRuntimeCore.js.map +1 -1
- package/dist/runtimes/local/LocalThreadRuntimeCore.d.ts +2 -0
- package/dist/runtimes/local/LocalThreadRuntimeCore.d.ts.map +1 -1
- package/dist/runtimes/local/LocalThreadRuntimeCore.js +12 -1
- package/dist/runtimes/local/LocalThreadRuntimeCore.js.map +1 -1
- package/dist/runtimes/remote-thread-list/EMPTY_THREAD_CORE.d.ts.map +1 -1
- package/dist/runtimes/remote-thread-list/EMPTY_THREAD_CORE.js +1 -0
- package/dist/runtimes/remote-thread-list/EMPTY_THREAD_CORE.js.map +1 -1
- package/dist/runtimes/remote-thread-list/RemoteThreadListHookInstanceManager.d.ts +2 -0
- package/dist/runtimes/remote-thread-list/RemoteThreadListHookInstanceManager.d.ts.map +1 -1
- package/dist/runtimes/remote-thread-list/RemoteThreadListThreadListRuntimeCore.d.ts +3 -0
- package/dist/runtimes/remote-thread-list/RemoteThreadListThreadListRuntimeCore.d.ts.map +1 -1
- package/dist/runtimes/remote-thread-list/RemoteThreadListThreadListRuntimeCore.js +3 -0
- package/dist/runtimes/remote-thread-list/RemoteThreadListThreadListRuntimeCore.js.map +1 -1
- package/dist/runtimes/remote-thread-list/adapter/cloud.d.ts +1 -1
- package/dist/runtimes/remote-thread-list/adapter/cloud.d.ts.map +1 -1
- package/dist/runtimes/remote-thread-list/adapter/cloud.js +1 -1
- package/dist/runtimes/remote-thread-list/adapter/cloud.js.map +1 -1
- package/dist/runtimes/utils/MessageRepository.js +1 -1
- package/dist/runtimes/utils/MessageRepository.js.map +1 -1
- package/dist/tests/setup.js +8 -8
- package/dist/tests/setup.js.map +1 -1
- package/dist/types/AssistantTypes.d.ts +15 -15
- package/dist/types/AttachmentTypes.d.ts +3 -3
- package/dist/types/MessagePartComponentTypes.d.ts +25 -0
- package/dist/types/{ContentPartComponentTypes.d.ts.map → MessagePartComponentTypes.d.ts.map} +1 -1
- package/dist/types/MessagePartComponentTypes.js +1 -0
- package/dist/types/index.d.ts +4 -2
- package/dist/types/index.d.ts.map +1 -1
- package/dist/utils/getThreadMessageText.js.map +1 -1
- package/dist/utils/smooth/SmoothContext.js +3 -3
- package/dist/utils/smooth/SmoothContext.js.map +1 -1
- package/dist/utils/smooth/useSmooth.d.ts +3 -3
- package/dist/utils/smooth/useSmooth.js.map +1 -1
- package/dist/utils/useToolArgsFieldStatus.js +3 -3
- package/dist/utils/useToolArgsFieldStatus.js.map +1 -1
- package/package.json +9 -8
- package/src/api/{ContentPartRuntime.ts → MessagePartRuntime.ts} +20 -20
- package/src/api/MessageRuntime.ts +32 -32
- package/src/api/RuntimePathTypes.ts +2 -2
- package/src/api/ThreadListRuntime.ts +8 -0
- package/src/api/ThreadRuntime.ts +6 -0
- package/src/api/index.ts +11 -3
- package/src/cloud/AssistantCloudThreadHistoryAdapter.tsx +1 -1
- package/src/cloud/auiV0.ts +4 -4
- package/src/cloud/index.ts +1 -1
- package/src/cloud/useCloudThreadListRuntime.tsx +1 -1
- package/src/context/providers/MessagePartRuntimeProvider.tsx +42 -0
- package/src/context/providers/{TextContentPartProvider.tsx → TextMessagePartProvider.tsx} +27 -27
- package/src/context/providers/index.ts +4 -1
- package/src/context/react/AssistantContext.ts +23 -0
- package/src/context/react/ComposerContext.ts +64 -0
- package/src/context/react/MessageContext.ts +56 -0
- package/src/context/react/MessagePartContext.ts +37 -0
- package/src/context/react/ThreadContext.ts +42 -0
- package/src/context/react/index.ts +1 -1
- package/src/context/stores/AssistantToolUIs.ts +4 -4
- package/src/model-context/useAssistantTool.tsx +2 -2
- package/src/model-context/useAssistantToolUI.tsx +2 -2
- package/src/model-context/useInlineRender.tsx +3 -3
- package/src/primitives/actionBar/ActionBarCopy.tsx +42 -0
- package/src/primitives/actionBar/ActionBarEdit.tsx +38 -0
- package/src/primitives/actionBar/ActionBarReload.tsx +39 -0
- package/src/primitives/actionBar/ActionBarRoot.tsx +38 -0
- package/src/primitives/assistantModal/AssistantModalContent.tsx +5 -1
- package/src/primitives/attachment/AttachmentRoot.tsx +18 -0
- package/src/primitives/branchPicker/BranchPickerCount.tsx +17 -0
- package/src/primitives/branchPicker/BranchPickerNext.tsx +17 -0
- package/src/primitives/branchPicker/BranchPickerPrevious.tsx +38 -0
- package/src/primitives/branchPicker/BranchPickerRoot.tsx +22 -0
- package/src/primitives/composer/ComposerAttachments.tsx +11 -7
- package/src/primitives/composer/ComposerCancel.tsx +17 -0
- package/src/primitives/composer/ComposerInput.tsx +44 -0
- package/src/primitives/composer/ComposerRoot.tsx +19 -0
- package/src/primitives/composer/ComposerSend.tsx +18 -0
- package/src/primitives/index.ts +14 -6
- package/src/primitives/message/MessageAttachments.tsx +11 -7
- package/src/primitives/message/MessageParts.tsx +423 -0
- package/src/primitives/message/MessageRoot.tsx +22 -0
- package/src/primitives/message/index.ts +2 -1
- package/src/primitives/messagePart/MessagePartImage.tsx +39 -0
- package/src/primitives/messagePart/MessagePartInProgress.tsx +19 -0
- package/src/primitives/messagePart/MessagePartText.tsx +62 -0
- package/src/primitives/messagePart/index.ts +3 -0
- package/src/primitives/messagePart/useMessagePartFile.tsx +18 -0
- package/src/primitives/messagePart/useMessagePartImage.tsx +18 -0
- package/src/primitives/messagePart/useMessagePartReasoning.tsx +18 -0
- package/src/primitives/messagePart/useMessagePartSource.tsx +18 -0
- package/src/primitives/messagePart/useMessagePartText.tsx +18 -0
- package/src/primitives/thread/ThreadMessages.tsx +52 -4
- package/src/primitives/thread/ThreadRoot.tsx +19 -0
- package/src/primitives/thread/ThreadViewport.tsx +19 -0
- package/src/primitives/threadList/ThreadListItems.tsx +12 -8
- package/src/runtimes/adapters/attachment/AttachmentAdapter.ts +56 -0
- package/src/runtimes/adapters/feedback/FeedbackAdapter.ts +33 -0
- package/src/runtimes/adapters/speech/SpeechAdapterTypes.ts +47 -0
- package/src/runtimes/core/BaseThreadRuntimeCore.tsx +1 -0
- package/src/runtimes/core/ThreadListRuntimeCore.tsx +1 -0
- package/src/runtimes/core/ThreadRuntimeCore.tsx +1 -0
- package/src/runtimes/external-store/ExternalStoreAdapter.tsx +2 -0
- package/src/runtimes/external-store/ExternalStoreThreadListRuntimeCore.tsx +4 -0
- package/src/runtimes/external-store/ExternalStoreThreadRuntimeCore.tsx +3 -0
- package/src/runtimes/external-store/ThreadMessageLike.tsx +20 -20
- package/src/runtimes/external-store/createMessageConverter.tsx +3 -3
- package/src/runtimes/external-store/external-message-converter.tsx +2 -2
- package/src/runtimes/local/ChatModelAdapter.tsx +13 -13
- package/src/runtimes/local/LocalRuntimeOptions.tsx +1 -1
- package/src/runtimes/local/LocalThreadListRuntimeCore.tsx +4 -0
- package/src/runtimes/local/LocalThreadRuntimeCore.tsx +30 -15
- package/src/runtimes/remote-thread-list/EMPTY_THREAD_CORE.tsx +1 -0
- package/src/runtimes/remote-thread-list/RemoteThreadListThreadListRuntimeCore.tsx +4 -0
- package/src/runtimes/remote-thread-list/adapter/cloud.tsx +1 -1
- package/src/runtimes/utils/MessageRepository.tsx +1 -1
- package/src/tests/MessageRepository.test.ts +6 -6
- package/src/types/AssistantTypes.ts +24 -24
- package/src/types/AttachmentTypes.ts +3 -3
- package/src/types/MessagePartComponentTypes.tsx +52 -0
- package/src/types/index.ts +69 -28
- package/src/utils/getThreadMessageText.tsx +2 -2
- package/src/utils/smooth/SmoothContext.tsx +7 -7
- package/src/utils/smooth/useSmooth.tsx +7 -7
- package/src/utils/useToolArgsFieldStatus.tsx +3 -3
- package/dist/cloud/AssistantCloud.d.ts +0 -15
- package/dist/cloud/AssistantCloud.d.ts.map +0 -1
- package/dist/cloud/AssistantCloud.js +0 -25
- package/dist/cloud/AssistantCloud.js.map +0 -1
- package/dist/cloud/AssistantCloudAPI.d.ts +0 -28
- package/dist/cloud/AssistantCloudAPI.d.ts.map +0 -1
- package/dist/cloud/AssistantCloudAPI.js +0 -87
- package/dist/cloud/AssistantCloudAPI.js.map +0 -1
- package/dist/cloud/AssistantCloudAuthStrategy.d.ts +0 -30
- package/dist/cloud/AssistantCloudAuthStrategy.d.ts.map +0 -1
- package/dist/cloud/AssistantCloudAuthStrategy.js +0 -139
- package/dist/cloud/AssistantCloudAuthStrategy.js.map +0 -1
- package/dist/cloud/AssistantCloudAuthTokens.d.ts +0 -11
- package/dist/cloud/AssistantCloudAuthTokens.d.ts.map +0 -1
- package/dist/cloud/AssistantCloudAuthTokens.js +0 -13
- package/dist/cloud/AssistantCloudAuthTokens.js.map +0 -1
- package/dist/cloud/AssistantCloudFiles.d.ts +0 -27
- package/dist/cloud/AssistantCloudFiles.d.ts.map +0 -1
- package/dist/cloud/AssistantCloudFiles.js +0 -25
- package/dist/cloud/AssistantCloudFiles.js.map +0 -1
- package/dist/cloud/AssistantCloudRuns.d.ts +0 -26
- package/dist/cloud/AssistantCloudRuns.d.ts.map +0 -1
- package/dist/cloud/AssistantCloudRuns.js +0 -39
- package/dist/cloud/AssistantCloudRuns.js.map +0 -1
- package/dist/cloud/AssistantCloudThreadMessages.d.ts +0 -30
- package/dist/cloud/AssistantCloudThreadMessages.d.ts.map +0 -1
- package/dist/cloud/AssistantCloudThreadMessages.js +0 -21
- package/dist/cloud/AssistantCloudThreadMessages.js.map +0 -1
- package/dist/cloud/AssistantCloudThreads.d.ts +0 -48
- package/dist/cloud/AssistantCloudThreads.d.ts.map +0 -1
- package/dist/cloud/AssistantCloudThreads.js +0 -30
- package/dist/cloud/AssistantCloudThreads.js.map +0 -1
- package/dist/context/providers/ContentPartRuntimeProvider.d.ts +0 -9
- package/dist/context/providers/ContentPartRuntimeProvider.js.map +0 -1
- package/dist/context/react/ContentPartContext.d.ts +0 -41
- package/dist/context/react/ContentPartContext.js +0 -25
- package/dist/context/react/ContentPartContext.js.map +0 -1
- package/dist/primitives/contentPart/ContentPartImage.d.ts +0 -10
- package/dist/primitives/contentPart/ContentPartImage.d.ts.map +0 -1
- package/dist/primitives/contentPart/ContentPartImage.js +0 -16
- package/dist/primitives/contentPart/ContentPartImage.js.map +0 -1
- package/dist/primitives/contentPart/ContentPartInProgress.d.ts +0 -6
- package/dist/primitives/contentPart/ContentPartInProgress.js +0 -13
- package/dist/primitives/contentPart/ContentPartInProgress.js.map +0 -1
- package/dist/primitives/contentPart/ContentPartText.d.ts +0 -16
- package/dist/primitives/contentPart/ContentPartText.d.ts.map +0 -1
- package/dist/primitives/contentPart/ContentPartText.js +0 -18
- package/dist/primitives/contentPart/ContentPartText.js.map +0 -1
- package/dist/primitives/contentPart/index.d.ts +0 -4
- package/dist/primitives/contentPart/index.js +0 -10
- package/dist/primitives/contentPart/index.js.map +0 -1
- package/dist/primitives/contentPart/useContentPartFile.d.ts +0 -5
- package/dist/primitives/contentPart/useContentPartFile.d.ts.map +0 -1
- package/dist/primitives/contentPart/useContentPartFile.js +0 -18
- package/dist/primitives/contentPart/useContentPartFile.js.map +0 -1
- package/dist/primitives/contentPart/useContentPartImage.d.ts +0 -5
- package/dist/primitives/contentPart/useContentPartImage.d.ts.map +0 -1
- package/dist/primitives/contentPart/useContentPartImage.js +0 -18
- package/dist/primitives/contentPart/useContentPartImage.js.map +0 -1
- package/dist/primitives/contentPart/useContentPartReasoning.d.ts +0 -5
- package/dist/primitives/contentPart/useContentPartReasoning.d.ts.map +0 -1
- package/dist/primitives/contentPart/useContentPartReasoning.js +0 -18
- package/dist/primitives/contentPart/useContentPartReasoning.js.map +0 -1
- package/dist/primitives/contentPart/useContentPartSource.d.ts +0 -5
- package/dist/primitives/contentPart/useContentPartSource.d.ts.map +0 -1
- package/dist/primitives/contentPart/useContentPartSource.js +0 -18
- package/dist/primitives/contentPart/useContentPartSource.js.map +0 -1
- package/dist/primitives/contentPart/useContentPartText.d.ts +0 -7
- package/dist/primitives/contentPart/useContentPartText.d.ts.map +0 -1
- package/dist/primitives/contentPart/useContentPartText.js +0 -18
- package/dist/primitives/contentPart/useContentPartText.js.map +0 -1
- package/dist/primitives/message/MessageContent.d.ts +0 -23
- package/dist/primitives/message/MessageContent.d.ts.map +0 -1
- package/dist/primitives/message/MessageContent.js +0 -138
- package/dist/primitives/message/MessageContent.js.map +0 -1
- package/dist/types/ContentPartComponentTypes.d.ts +0 -25
- package/dist/types/ContentPartComponentTypes.js +0 -1
- package/src/cloud/AssistantCloud.tsx +0 -22
- package/src/cloud/AssistantCloudAPI.tsx +0 -121
- package/src/cloud/AssistantCloudAuthStrategy.tsx +0 -193
- package/src/cloud/AssistantCloudAuthTokens.tsx +0 -13
- package/src/cloud/AssistantCloudFiles.tsx +0 -48
- package/src/cloud/AssistantCloudRuns.tsx +0 -45
- package/src/cloud/AssistantCloudThreadMessages.tsx +0 -48
- package/src/cloud/AssistantCloudThreads.tsx +0 -79
- package/src/context/providers/ContentPartRuntimeProvider.tsx +0 -42
- package/src/context/react/ContentPartContext.ts +0 -37
- package/src/primitives/contentPart/ContentPartImage.tsx +0 -20
- package/src/primitives/contentPart/ContentPartInProgress.tsx +0 -19
- package/src/primitives/contentPart/ContentPartText.tsx +0 -37
- package/src/primitives/contentPart/index.ts +0 -3
- package/src/primitives/contentPart/useContentPartFile.tsx +0 -18
- package/src/primitives/contentPart/useContentPartImage.tsx +0 -18
- package/src/primitives/contentPart/useContentPartReasoning.tsx +0 -18
- package/src/primitives/contentPart/useContentPartSource.tsx +0 -18
- package/src/primitives/contentPart/useContentPartText.tsx +0 -18
- package/src/primitives/message/MessageContent.tsx +0 -241
- package/src/tests/AssistantCloudFiles.test.ts +0 -564
- package/src/types/ContentPartComponentTypes.tsx +0 -52
- /package/dist/types/{ContentPartComponentTypes.js.map → MessagePartComponentTypes.js.map} +0 -0
@@ -12,6 +12,30 @@ import {
|
|
12
12
|
} from "../../context/react/MessageContext";
|
13
13
|
import { useComposerRuntime } from "../../context";
|
14
14
|
|
15
|
+
/**
|
16
|
+
* Hook that provides copy functionality for action bar buttons.
|
17
|
+
*
|
18
|
+
* This hook returns a callback function that copies message content to the clipboard,
|
19
|
+
* or null if copying is not available. It handles both regular message content and
|
20
|
+
* composer text when in editing mode.
|
21
|
+
*
|
22
|
+
* @param options Configuration options
|
23
|
+
* @param options.copiedDuration Duration in milliseconds to show the copied state
|
24
|
+
* @returns A copy callback function, or null if copying is disabled
|
25
|
+
*
|
26
|
+
* @example
|
27
|
+
* ```tsx
|
28
|
+
* function CustomCopyButton() {
|
29
|
+
* const copy = useActionBarPrimitiveCopy({ copiedDuration: 2000 });
|
30
|
+
*
|
31
|
+
* return (
|
32
|
+
* <button onClick={copy} disabled={!copy}>
|
33
|
+
* {copy ? "Copy" : "Cannot Copy"}
|
34
|
+
* </button>
|
35
|
+
* );
|
36
|
+
* }
|
37
|
+
* ```
|
38
|
+
*/
|
15
39
|
const useActionBarPrimitiveCopy = ({
|
16
40
|
copiedDuration = 3000,
|
17
41
|
}: { copiedDuration?: number | undefined } = {}) => {
|
@@ -44,9 +68,27 @@ const useActionBarPrimitiveCopy = ({
|
|
44
68
|
|
45
69
|
export namespace ActionBarPrimitiveCopy {
|
46
70
|
export type Element = HTMLButtonElement;
|
71
|
+
/**
|
72
|
+
* Props for the ActionBarPrimitive.Copy component.
|
73
|
+
* Inherits all button element props and action button functionality.
|
74
|
+
*/
|
47
75
|
export type Props = ActionButtonProps<typeof useActionBarPrimitiveCopy>;
|
48
76
|
}
|
49
77
|
|
78
|
+
/**
|
79
|
+
* A button component that copies message content to the clipboard.
|
80
|
+
*
|
81
|
+
* This component automatically handles copying message text to the clipboard
|
82
|
+
* and provides visual feedback through the data-copied attribute. It's disabled
|
83
|
+
* when there's no copyable content available.
|
84
|
+
*
|
85
|
+
* @example
|
86
|
+
* ```tsx
|
87
|
+
* <ActionBarPrimitive.Copy copiedDuration={2000}>
|
88
|
+
* Copy Message
|
89
|
+
* </ActionBarPrimitive.Copy>
|
90
|
+
* ```
|
91
|
+
*/
|
50
92
|
export const ActionBarPrimitiveCopy = forwardRef<
|
51
93
|
ActionBarPrimitiveCopy.Element,
|
52
94
|
ActionBarPrimitiveCopy.Props
|
@@ -8,6 +8,27 @@ import {
|
|
8
8
|
import { useCallback } from "react";
|
9
9
|
import { useEditComposer, useMessageRuntime } from "../../context";
|
10
10
|
|
11
|
+
/**
|
12
|
+
* Hook that provides edit functionality for action bar buttons.
|
13
|
+
*
|
14
|
+
* This hook returns a callback function that starts editing the current message,
|
15
|
+
* or null if editing is not available (e.g., already in editing mode).
|
16
|
+
*
|
17
|
+
* @returns An edit callback function, or null if editing is disabled
|
18
|
+
*
|
19
|
+
* @example
|
20
|
+
* ```tsx
|
21
|
+
* function CustomEditButton() {
|
22
|
+
* const edit = useActionBarEdit();
|
23
|
+
*
|
24
|
+
* return (
|
25
|
+
* <button onClick={edit} disabled={!edit}>
|
26
|
+
* {edit ? "Edit Message" : "Cannot Edit"}
|
27
|
+
* </button>
|
28
|
+
* );
|
29
|
+
* }
|
30
|
+
* ```
|
31
|
+
*/
|
11
32
|
const useActionBarEdit = () => {
|
12
33
|
const messageRuntime = useMessageRuntime();
|
13
34
|
const disabled = useEditComposer((c) => c.isEditing);
|
@@ -22,9 +43,26 @@ const useActionBarEdit = () => {
|
|
22
43
|
|
23
44
|
export namespace ActionBarPrimitiveEdit {
|
24
45
|
export type Element = ActionButtonElement;
|
46
|
+
/**
|
47
|
+
* Props for the ActionBarPrimitive.Edit component.
|
48
|
+
* Inherits all button element props and action button functionality.
|
49
|
+
*/
|
25
50
|
export type Props = ActionButtonProps<typeof useActionBarEdit>;
|
26
51
|
}
|
27
52
|
|
53
|
+
/**
|
54
|
+
* A button component that starts editing the current message.
|
55
|
+
*
|
56
|
+
* This component automatically handles starting the edit mode for the current message
|
57
|
+
* and is disabled when editing is not available (e.g., already in editing mode).
|
58
|
+
*
|
59
|
+
* @example
|
60
|
+
* ```tsx
|
61
|
+
* <ActionBarPrimitive.Edit>
|
62
|
+
* Edit Message
|
63
|
+
* </ActionBarPrimitive.Edit>
|
64
|
+
* ```
|
65
|
+
*/
|
28
66
|
export const ActionBarPrimitiveEdit = createActionButton(
|
29
67
|
"ActionBarPrimitive.Edit",
|
30
68
|
useActionBarEdit,
|
@@ -10,6 +10,27 @@ import { useMessageRuntime } from "../../context";
|
|
10
10
|
import { useThreadRuntime } from "../../context/react/ThreadContext";
|
11
11
|
import { useCombinedStore } from "../../utils/combined/useCombinedStore";
|
12
12
|
|
13
|
+
/**
|
14
|
+
* Hook that provides reload functionality for action bar buttons.
|
15
|
+
*
|
16
|
+
* This hook returns a callback function that reloads/regenerates the current assistant message,
|
17
|
+
* or null if reloading is not available (e.g., thread is running, disabled, or message is not from assistant).
|
18
|
+
*
|
19
|
+
* @returns A reload callback function, or null if reloading is disabled
|
20
|
+
*
|
21
|
+
* @example
|
22
|
+
* ```tsx
|
23
|
+
* function CustomReloadButton() {
|
24
|
+
* const reload = useActionBarReload();
|
25
|
+
*
|
26
|
+
* return (
|
27
|
+
* <button onClick={reload} disabled={!reload}>
|
28
|
+
* {reload ? "Reload Message" : "Cannot Reload"}
|
29
|
+
* </button>
|
30
|
+
* );
|
31
|
+
* }
|
32
|
+
* ```
|
33
|
+
*/
|
13
34
|
const useActionBarReload = () => {
|
14
35
|
const messageRuntime = useMessageRuntime();
|
15
36
|
const threadRuntime = useThreadRuntime();
|
@@ -29,9 +50,27 @@ const useActionBarReload = () => {
|
|
29
50
|
|
30
51
|
export namespace ActionBarPrimitiveReload {
|
31
52
|
export type Element = ActionButtonElement;
|
53
|
+
/**
|
54
|
+
* Props for the ActionBarPrimitive.Reload component.
|
55
|
+
* Inherits all button element props and action button functionality.
|
56
|
+
*/
|
32
57
|
export type Props = ActionButtonProps<typeof useActionBarReload>;
|
33
58
|
}
|
34
59
|
|
60
|
+
/**
|
61
|
+
* A button component that reloads/regenerates the current assistant message.
|
62
|
+
*
|
63
|
+
* This component automatically handles reloading the current assistant message
|
64
|
+
* and is disabled when reloading is not available (e.g., thread is running,
|
65
|
+
* disabled, or message is not from assistant).
|
66
|
+
*
|
67
|
+
* @example
|
68
|
+
* ```tsx
|
69
|
+
* <ActionBarPrimitive.Reload>
|
70
|
+
* Reload Message
|
71
|
+
* </ActionBarPrimitive.Reload>
|
72
|
+
* ```
|
73
|
+
*/
|
35
74
|
export const ActionBarPrimitiveReload = createActionButton(
|
36
75
|
"ActionBarPrimitive.Reload",
|
37
76
|
useActionBarReload,
|
@@ -12,12 +12,50 @@ type PrimitiveDivProps = ComponentPropsWithoutRef<typeof Primitive.div>;
|
|
12
12
|
export namespace ActionBarPrimitiveRoot {
|
13
13
|
export type Element = ComponentRef<typeof Primitive.div>;
|
14
14
|
export type Props = PrimitiveDivProps & {
|
15
|
+
/**
|
16
|
+
* Whether to hide the action bar when the thread is running.
|
17
|
+
* @default false
|
18
|
+
*/
|
15
19
|
hideWhenRunning?: boolean | undefined;
|
20
|
+
/**
|
21
|
+
* Controls when the action bar should automatically hide.
|
22
|
+
* - "always": Always hide unless hovered
|
23
|
+
* - "not-last": Hide unless this is the last message
|
24
|
+
* - "never": Never auto-hide
|
25
|
+
* @default "never"
|
26
|
+
*/
|
16
27
|
autohide?: "always" | "not-last" | "never" | undefined;
|
28
|
+
/**
|
29
|
+
* Controls floating behavior when auto-hidden.
|
30
|
+
* - "always": Always float when hidden
|
31
|
+
* - "single-branch": Float only for single-branch messages
|
32
|
+
* - "never": Never float
|
33
|
+
* @default "never"
|
34
|
+
*/
|
17
35
|
autohideFloat?: "always" | "single-branch" | "never" | undefined;
|
18
36
|
};
|
19
37
|
}
|
20
38
|
|
39
|
+
/**
|
40
|
+
* The root container for action bar components.
|
41
|
+
*
|
42
|
+
* This component provides intelligent visibility and floating behavior for action bars,
|
43
|
+
* automatically hiding and showing based on message state, hover status, and configuration.
|
44
|
+
* It supports floating mode for better UX when space is limited.
|
45
|
+
*
|
46
|
+
* @example
|
47
|
+
* ```tsx
|
48
|
+
* <ActionBarPrimitive.Root
|
49
|
+
* hideWhenRunning={true}
|
50
|
+
* autohide="not-last"
|
51
|
+
* autohideFloat="single-branch"
|
52
|
+
* >
|
53
|
+
* <ActionBarPrimitive.Copy />
|
54
|
+
* <ActionBarPrimitive.Edit />
|
55
|
+
* <ActionBarPrimitive.Reload />
|
56
|
+
* </ActionBarPrimitive.Root>
|
57
|
+
* ```
|
58
|
+
*/
|
21
59
|
export const ActionBarPrimitiveRoot = forwardRef<
|
22
60
|
ActionBarPrimitiveRoot.Element,
|
23
61
|
ActionBarPrimitiveRoot.Props
|
@@ -10,6 +10,9 @@ export namespace AssistantModalPrimitiveContent {
|
|
10
10
|
export type Props = ComponentPropsWithoutRef<
|
11
11
|
typeof PopoverPrimitive.Content
|
12
12
|
> & {
|
13
|
+
portalProps?:
|
14
|
+
| ComponentPropsWithoutRef<typeof PopoverPrimitive.Portal>
|
15
|
+
| undefined;
|
13
16
|
dissmissOnInteractOutside?: boolean | undefined;
|
14
17
|
};
|
15
18
|
}
|
@@ -25,6 +28,7 @@ export const AssistantModalPrimitiveContent = forwardRef<
|
|
25
28
|
align,
|
26
29
|
onInteractOutside,
|
27
30
|
dissmissOnInteractOutside = false,
|
31
|
+
portalProps,
|
28
32
|
...props
|
29
33
|
}: ScopedProps<AssistantModalPrimitiveContent.Props>,
|
30
34
|
forwardedRef,
|
@@ -32,7 +36,7 @@ export const AssistantModalPrimitiveContent = forwardRef<
|
|
32
36
|
const scope = usePopoverScope(__scopeAssistantModal);
|
33
37
|
|
34
38
|
return (
|
35
|
-
<PopoverPrimitive.Portal {...scope}>
|
39
|
+
<PopoverPrimitive.Portal {...scope} {...portalProps}>
|
36
40
|
<PopoverPrimitive.Content
|
37
41
|
{...scope}
|
38
42
|
{...props}
|
@@ -7,9 +7,27 @@ type PrimitiveDivProps = ComponentPropsWithoutRef<typeof Primitive.div>;
|
|
7
7
|
|
8
8
|
export namespace AttachmentPrimitiveRoot {
|
9
9
|
export type Element = ComponentRef<typeof Primitive.div>;
|
10
|
+
/**
|
11
|
+
* Props for the AttachmentPrimitive.Root component.
|
12
|
+
* Accepts all standard div element props.
|
13
|
+
*/
|
10
14
|
export type Props = PrimitiveDivProps;
|
11
15
|
}
|
12
16
|
|
17
|
+
/**
|
18
|
+
* The root container component for an attachment.
|
19
|
+
*
|
20
|
+
* This component provides the foundational wrapper for attachment-related components
|
21
|
+
* and content. It serves as the context provider for attachment state and actions.
|
22
|
+
*
|
23
|
+
* @example
|
24
|
+
* ```tsx
|
25
|
+
* <AttachmentPrimitive.Root>
|
26
|
+
* <AttachmentPrimitive.Name />
|
27
|
+
* <AttachmentPrimitive.Remove />
|
28
|
+
* </AttachmentPrimitive.Root>
|
29
|
+
* ```
|
30
|
+
*/
|
13
31
|
export const AttachmentPrimitiveRoot = forwardRef<
|
14
32
|
AttachmentPrimitiveRoot.Element,
|
15
33
|
AttachmentPrimitiveRoot.Props
|
@@ -9,9 +9,26 @@ const useBranchPickerCount = () => {
|
|
9
9
|
};
|
10
10
|
|
11
11
|
export namespace BranchPickerPrimitiveCount {
|
12
|
+
/**
|
13
|
+
* Props for the BranchPickerPrimitive.Count component.
|
14
|
+
* This component takes no props.
|
15
|
+
*/
|
12
16
|
export type Props = Record<string, never>;
|
13
17
|
}
|
14
18
|
|
19
|
+
/**
|
20
|
+
* A component that displays the total number of branches for the current message.
|
21
|
+
*
|
22
|
+
* This component renders the branch count as plain text, useful for showing
|
23
|
+
* users how many alternative responses are available.
|
24
|
+
*
|
25
|
+
* @example
|
26
|
+
* ```tsx
|
27
|
+
* <div>
|
28
|
+
* Branch <BranchPickerPrimitive.Count /> of {totalBranches}
|
29
|
+
* </div>
|
30
|
+
* ```
|
31
|
+
*/
|
15
32
|
export const BranchPickerPrimitiveCount: FC<
|
16
33
|
BranchPickerPrimitiveCount.Props
|
17
34
|
> = () => {
|
@@ -25,9 +25,26 @@ const useBranchPickerNext = () => {
|
|
25
25
|
|
26
26
|
export namespace BranchPickerPrimitiveNext {
|
27
27
|
export type Element = ActionButtonElement;
|
28
|
+
/**
|
29
|
+
* Props for the BranchPickerPrimitive.Next component.
|
30
|
+
* Inherits all button element props and action button functionality.
|
31
|
+
*/
|
28
32
|
export type Props = ActionButtonProps<typeof useBranchPickerNext>;
|
29
33
|
}
|
30
34
|
|
35
|
+
/**
|
36
|
+
* A button component that navigates to the next branch in the message tree.
|
37
|
+
*
|
38
|
+
* This component automatically handles switching to the next available branch
|
39
|
+
* and is disabled when there are no more branches to navigate to.
|
40
|
+
*
|
41
|
+
* @example
|
42
|
+
* ```tsx
|
43
|
+
* <BranchPickerPrimitive.Next>
|
44
|
+
* Next →
|
45
|
+
* </BranchPickerPrimitive.Next>
|
46
|
+
* ```
|
47
|
+
*/
|
31
48
|
export const BranchPickerPrimitiveNext = createActionButton(
|
32
49
|
"BranchPickerPrimitive.Next",
|
33
50
|
useBranchPickerNext,
|
@@ -11,6 +11,27 @@ import {
|
|
11
11
|
useMessageRuntime,
|
12
12
|
} from "../../context/react/MessageContext";
|
13
13
|
|
14
|
+
/**
|
15
|
+
* Hook that provides navigation to the previous branch functionality.
|
16
|
+
*
|
17
|
+
* This hook returns a callback function that switches to the previous branch
|
18
|
+
* in the message branch tree, or null if there is no previous branch available.
|
19
|
+
*
|
20
|
+
* @returns A previous branch callback function, or null if navigation is disabled
|
21
|
+
*
|
22
|
+
* @example
|
23
|
+
* ```tsx
|
24
|
+
* function CustomPreviousButton() {
|
25
|
+
* const previous = useBranchPickerPrevious();
|
26
|
+
*
|
27
|
+
* return (
|
28
|
+
* <button onClick={previous} disabled={!previous}>
|
29
|
+
* {previous ? "Previous Branch" : "No Previous Branch"}
|
30
|
+
* </button>
|
31
|
+
* );
|
32
|
+
* }
|
33
|
+
* ```
|
34
|
+
*/
|
14
35
|
const useBranchPickerPrevious = () => {
|
15
36
|
const messageRuntime = useMessageRuntime();
|
16
37
|
const disabled = useMessage((m) => m.branchNumber <= 1);
|
@@ -25,9 +46,26 @@ const useBranchPickerPrevious = () => {
|
|
25
46
|
|
26
47
|
export namespace BranchPickerPrimitivePrevious {
|
27
48
|
export type Element = ActionButtonElement;
|
49
|
+
/**
|
50
|
+
* Props for the BranchPickerPrimitive.Previous component.
|
51
|
+
* Inherits all button element props and action button functionality.
|
52
|
+
*/
|
28
53
|
export type Props = ActionButtonProps<typeof useBranchPickerPrevious>;
|
29
54
|
}
|
30
55
|
|
56
|
+
/**
|
57
|
+
* A button component that navigates to the previous branch in the message tree.
|
58
|
+
*
|
59
|
+
* This component automatically handles switching to the previous available branch
|
60
|
+
* and is disabled when there are no previous branches to navigate to.
|
61
|
+
*
|
62
|
+
* @example
|
63
|
+
* ```tsx
|
64
|
+
* <BranchPickerPrimitive.Previous>
|
65
|
+
* ← Previous
|
66
|
+
* </BranchPickerPrimitive.Previous>
|
67
|
+
* ```
|
68
|
+
*/
|
31
69
|
export const BranchPickerPrimitivePrevious = createActionButton(
|
32
70
|
"BranchPickerPrimitive.Previous",
|
33
71
|
useBranchPickerPrevious,
|
@@ -7,10 +7,32 @@ import { If } from "../message";
|
|
7
7
|
export namespace BranchPickerPrimitiveRoot {
|
8
8
|
export type Element = ComponentRef<typeof Primitive.div>;
|
9
9
|
export type Props = ComponentPropsWithoutRef<typeof Primitive.div> & {
|
10
|
+
/**
|
11
|
+
* Whether to hide the branch picker when there's only one branch available.
|
12
|
+
* When true, the component will only render when multiple branches exist.
|
13
|
+
* @default false
|
14
|
+
*/
|
10
15
|
hideWhenSingleBranch?: boolean | undefined;
|
11
16
|
};
|
12
17
|
}
|
13
18
|
|
19
|
+
/**
|
20
|
+
* The root container for branch picker components.
|
21
|
+
*
|
22
|
+
* This component provides a container for branch navigation controls,
|
23
|
+
* with optional conditional rendering based on the number of available branches.
|
24
|
+
* It integrates with the message branching system to allow users to navigate
|
25
|
+
* between different response variations.
|
26
|
+
*
|
27
|
+
* @example
|
28
|
+
* ```tsx
|
29
|
+
* <BranchPickerPrimitive.Root hideWhenSingleBranch={true}>
|
30
|
+
* <BranchPickerPrimitive.Previous />
|
31
|
+
* <BranchPickerPrimitive.Count />
|
32
|
+
* <BranchPickerPrimitive.Next />
|
33
|
+
* </BranchPickerPrimitive.Root>
|
34
|
+
* ```
|
35
|
+
*/
|
14
36
|
export const BranchPickerPrimitiveRoot = forwardRef<
|
15
37
|
BranchPickerPrimitiveRoot.Element,
|
16
38
|
BranchPickerPrimitiveRoot.Props
|
@@ -79,13 +79,17 @@ export const ComposerPrimitiveAttachments: FC<
|
|
79
79
|
> = ({ components }) => {
|
80
80
|
const attachmentsCount = useComposer((s) => s.attachments.length);
|
81
81
|
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
82
|
+
const attachmentElements = useMemo(() => {
|
83
|
+
return Array.from({ length: attachmentsCount }, (_, index) => (
|
84
|
+
<ComposerAttachment
|
85
|
+
key={index}
|
86
|
+
attachmentIndex={index}
|
87
|
+
components={components}
|
88
|
+
/>
|
89
|
+
));
|
90
|
+
}, [attachmentsCount, components]);
|
91
|
+
|
92
|
+
return attachmentElements;
|
89
93
|
};
|
90
94
|
|
91
95
|
ComposerPrimitiveAttachments.displayName = "ComposerPrimitive.Attachments";
|
@@ -22,9 +22,26 @@ const useComposerCancel = () => {
|
|
22
22
|
|
23
23
|
export namespace ComposerPrimitiveCancel {
|
24
24
|
export type Element = ActionButtonElement;
|
25
|
+
/**
|
26
|
+
* Props for the ComposerPrimitive.Cancel component.
|
27
|
+
* Inherits all button element props and action button functionality.
|
28
|
+
*/
|
25
29
|
export type Props = ActionButtonProps<typeof useComposerCancel>;
|
26
30
|
}
|
27
31
|
|
32
|
+
/**
|
33
|
+
* A button component that cancels the current message composition.
|
34
|
+
*
|
35
|
+
* This component automatically handles the cancel functionality and is disabled
|
36
|
+
* when canceling is not available.
|
37
|
+
*
|
38
|
+
* @example
|
39
|
+
* ```tsx
|
40
|
+
* <ComposerPrimitive.Cancel>
|
41
|
+
* Cancel
|
42
|
+
* </ComposerPrimitive.Cancel>
|
43
|
+
* ```
|
44
|
+
*/
|
28
45
|
export const ComposerPrimitiveCancel = createActionButton(
|
29
46
|
"ComposerPrimitive.Cancel",
|
30
47
|
useComposerCancel,
|
@@ -26,16 +26,60 @@ import { useThreadListItemRuntime } from "../../context/react/ThreadListItemCont
|
|
26
26
|
export namespace ComposerPrimitiveInput {
|
27
27
|
export type Element = HTMLTextAreaElement;
|
28
28
|
export type Props = TextareaAutosizeProps & {
|
29
|
+
/**
|
30
|
+
* Whether to render as a child component using Slot.
|
31
|
+
* When true, the component will merge its props with its child.
|
32
|
+
*/
|
29
33
|
asChild?: boolean | undefined;
|
34
|
+
/**
|
35
|
+
* Whether to submit the message when Enter is pressed (without Shift).
|
36
|
+
* @default true
|
37
|
+
*/
|
30
38
|
submitOnEnter?: boolean | undefined;
|
39
|
+
/**
|
40
|
+
* Whether to cancel message composition when Escape is pressed.
|
41
|
+
* @default true
|
42
|
+
*/
|
31
43
|
cancelOnEscape?: boolean | undefined;
|
44
|
+
/**
|
45
|
+
* Whether to automatically focus the input when a new run starts.
|
46
|
+
* @default true
|
47
|
+
*/
|
32
48
|
unstable_focusOnRunStart?: boolean | undefined;
|
49
|
+
/**
|
50
|
+
* Whether to automatically focus the input when scrolling to bottom.
|
51
|
+
* @default true
|
52
|
+
*/
|
33
53
|
unstable_focusOnScrollToBottom?: boolean | undefined;
|
54
|
+
/**
|
55
|
+
* Whether to automatically focus the input when switching threads.
|
56
|
+
* @default true
|
57
|
+
*/
|
34
58
|
unstable_focusOnThreadSwitched?: boolean | undefined;
|
59
|
+
/**
|
60
|
+
* Whether to automatically add pasted files as attachments.
|
61
|
+
* @default true
|
62
|
+
*/
|
35
63
|
addAttachmentOnPaste?: boolean | undefined;
|
36
64
|
};
|
37
65
|
}
|
38
66
|
|
67
|
+
/**
|
68
|
+
* A text input component for composing messages.
|
69
|
+
*
|
70
|
+
* This component provides a rich text input experience with automatic resizing,
|
71
|
+
* keyboard shortcuts, file paste support, and intelligent focus management.
|
72
|
+
* It integrates with the composer context to manage message state and submission.
|
73
|
+
*
|
74
|
+
* @example
|
75
|
+
* ```tsx
|
76
|
+
* <ComposerPrimitive.Input
|
77
|
+
* placeholder="Type your message..."
|
78
|
+
* submitOnEnter={true}
|
79
|
+
* addAttachmentOnPaste={true}
|
80
|
+
* />
|
81
|
+
* ```
|
82
|
+
*/
|
39
83
|
export const ComposerPrimitiveInput = forwardRef<
|
40
84
|
ComposerPrimitiveInput.Element,
|
41
85
|
ComposerPrimitiveInput.Props
|
@@ -12,9 +12,28 @@ import { useComposerSend } from "./ComposerSend";
|
|
12
12
|
|
13
13
|
export namespace ComposerPrimitiveRoot {
|
14
14
|
export type Element = ComponentRef<typeof Primitive.form>;
|
15
|
+
/**
|
16
|
+
* Props for the ComposerPrimitive.Root component.
|
17
|
+
* Accepts all standard form element props.
|
18
|
+
*/
|
15
19
|
export type Props = ComponentPropsWithoutRef<typeof Primitive.form>;
|
16
20
|
}
|
17
21
|
|
22
|
+
/**
|
23
|
+
* The root form container for message composition.
|
24
|
+
*
|
25
|
+
* This component provides a form wrapper that handles message submission when the form
|
26
|
+
* is submitted (e.g., via Enter key or submit button). It automatically prevents the
|
27
|
+
* default form submission and triggers the composer's send functionality.
|
28
|
+
*
|
29
|
+
* @example
|
30
|
+
* ```tsx
|
31
|
+
* <ComposerPrimitive.Root>
|
32
|
+
* <ComposerPrimitive.Input placeholder="Type your message..." />
|
33
|
+
* <ComposerPrimitive.Send>Send</ComposerPrimitive.Send>
|
34
|
+
* </ComposerPrimitive.Root>
|
35
|
+
* ```
|
36
|
+
*/
|
18
37
|
export const ComposerPrimitiveRoot = forwardRef<
|
19
38
|
ComposerPrimitiveRoot.Element,
|
20
39
|
ComposerPrimitiveRoot.Props
|
@@ -29,9 +29,27 @@ export const useComposerSend = () => {
|
|
29
29
|
|
30
30
|
export namespace ComposerPrimitiveSend {
|
31
31
|
export type Element = ActionButtonElement;
|
32
|
+
/**
|
33
|
+
* Props for the ComposerPrimitive.Send component.
|
34
|
+
* Inherits all button element props and action button functionality.
|
35
|
+
*/
|
32
36
|
export type Props = ActionButtonProps<typeof useComposerSend>;
|
33
37
|
}
|
34
38
|
|
39
|
+
/**
|
40
|
+
* A button component that sends the current message in the composer.
|
41
|
+
*
|
42
|
+
* This component automatically handles the send functionality and is disabled
|
43
|
+
* when sending is not available (e.g., when the thread is running, the composer
|
44
|
+
* is empty, or not in editing mode).
|
45
|
+
*
|
46
|
+
* @example
|
47
|
+
* ```tsx
|
48
|
+
* <ComposerPrimitive.Send>
|
49
|
+
* Send Message
|
50
|
+
* </ComposerPrimitive.Send>
|
51
|
+
* ```
|
52
|
+
*/
|
35
53
|
export const ComposerPrimitiveSend = createActionButton(
|
36
54
|
"ComposerPrimitive.Send",
|
37
55
|
useComposerSend,
|
package/src/primitives/index.ts
CHANGED
@@ -3,16 +3,24 @@ export * as AssistantModalPrimitive from "./assistantModal";
|
|
3
3
|
export * as AttachmentPrimitive from "./attachment";
|
4
4
|
export * as BranchPickerPrimitive from "./branchPicker";
|
5
5
|
export * as ComposerPrimitive from "./composer";
|
6
|
-
export * as
|
6
|
+
export * as MessagePartPrimitive from "./messagePart";
|
7
7
|
export * as ErrorPrimitive from "./error";
|
8
8
|
export * as MessagePrimitive from "./message";
|
9
9
|
export * as ThreadPrimitive from "./thread";
|
10
10
|
export * as ThreadListPrimitive from "./threadList";
|
11
11
|
export * as ThreadListItemPrimitive from "./threadListItem";
|
12
12
|
|
13
|
-
export {
|
14
|
-
export {
|
15
|
-
export {
|
16
|
-
export {
|
17
|
-
export {
|
13
|
+
export { useMessagePartText } from "./messagePart/useMessagePartText";
|
14
|
+
export { useMessagePartReasoning } from "./messagePart/useMessagePartReasoning";
|
15
|
+
export { useMessagePartSource } from "./messagePart/useMessagePartSource";
|
16
|
+
export { useMessagePartFile } from "./messagePart/useMessagePartFile";
|
17
|
+
export { useMessagePartImage } from "./messagePart/useMessagePartImage";
|
18
18
|
export { useThreadViewportAutoScroll } from "./thread/useThreadViewportAutoScroll";
|
19
|
+
|
20
|
+
// TODO remove in v0.11
|
21
|
+
export * as ContentPartPrimitive from "./messagePart";
|
22
|
+
export { useMessagePartText as useContentPartText } from "./messagePart/useMessagePartText";
|
23
|
+
export { useMessagePartReasoning as useContentPartReasoning } from "./messagePart/useMessagePartReasoning";
|
24
|
+
export { useMessagePartSource as useContentPartSource } from "./messagePart/useMessagePartSource";
|
25
|
+
export { useMessagePartFile as useContentPartFile } from "./messagePart/useMessagePartFile";
|
26
|
+
export { useMessagePartImage as useContentPartImage } from "./messagePart/useMessagePartImage";
|
@@ -80,13 +80,17 @@ export const MessagePrimitiveAttachments: FC<
|
|
80
80
|
return message.attachments.length;
|
81
81
|
});
|
82
82
|
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
83
|
+
const attachmentElements = useMemo(() => {
|
84
|
+
return Array.from({ length: attachmentsCount }, (_, index) => (
|
85
|
+
<MessageAttachment
|
86
|
+
key={index}
|
87
|
+
attachmentIndex={index}
|
88
|
+
components={components}
|
89
|
+
/>
|
90
|
+
));
|
91
|
+
}, [attachmentsCount, components]);
|
92
|
+
|
93
|
+
return attachmentElements;
|
90
94
|
};
|
91
95
|
|
92
96
|
MessagePrimitiveAttachments.displayName = "MessagePrimitive.Attachments";
|