@assistant-ui/react 0.15.30 → 0.15.31
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/cloud-renderer/CloudRendererHost.d.ts.map +1 -1
- package/dist/cloud-renderer/CloudRendererHost.js +1 -2
- package/dist/cloud-renderer/CloudRendererHost.js.map +1 -1
- package/dist/context/providers/AttachmentByIndexProvider.js +1 -2
- package/dist/context/providers/ChainOfThoughtByIndicesProvider.js +1 -2
- package/dist/context/providers/MessageByIndexProvider.js +1 -2
- package/dist/context/providers/PartByIndexProvider.js +1 -2
- package/dist/context/providers/SuggestionByIndexProvider.js +1 -2
- package/dist/context/providers/TextMessagePartProvider.js +1 -2
- package/dist/context/providers/ThreadListItemProvider.js +1 -2
- package/dist/index.d.ts +9 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -9
- package/dist/internal.d.ts +1 -1
- package/dist/internal.d.ts.map +1 -1
- package/dist/internal.js +1 -1
- package/dist/internal.js.map +1 -1
- package/dist/legacy-runtime/AssistantRuntimeProvider.d.ts +1 -1
- package/dist/legacy-runtime/AssistantRuntimeProvider.d.ts.map +1 -1
- package/dist/legacy-runtime/AssistantRuntimeProvider.js.map +1 -1
- package/dist/primitives/actionBar/ActionBarCopy.d.ts +1 -1
- package/dist/primitives/actionBar/ActionBarEdit.d.ts +1 -1
- package/dist/primitives/actionBar/ActionBarExportMarkdown.d.ts +1 -1
- package/dist/primitives/actionBar/ActionBarFeedbackNegative.d.ts +1 -1
- package/dist/primitives/actionBar/ActionBarFeedbackPositive.d.ts +1 -1
- package/dist/primitives/actionBar/ActionBarReload.d.ts +1 -1
- package/dist/primitives/actionBar/ActionBarRoot.d.ts +1 -1
- package/dist/primitives/actionBar/ActionBarSpeak.d.ts +1 -1
- package/dist/primitives/actionBar/ActionBarStopSpeaking.d.ts +1 -1
- package/dist/primitives/attachment/AttachmentRemove.d.ts +1 -1
- package/dist/primitives/attachment/AttachmentRoot.d.ts +1 -1
- package/dist/primitives/attachment/AttachmentThumb.d.ts +1 -1
- package/dist/primitives/branchPicker/BranchPickerNext.d.ts +1 -1
- package/dist/primitives/branchPicker/BranchPickerPrevious.d.ts +1 -1
- package/dist/primitives/branchPicker/BranchPickerRoot.d.ts +1 -1
- package/dist/primitives/chainOfThought/ChainOfThoughtAccordionTrigger.d.ts +1 -1
- package/dist/primitives/chainOfThought/ChainOfThoughtParts.js +1 -2
- package/dist/primitives/chainOfThought/ChainOfThoughtRoot.d.ts +1 -1
- package/dist/primitives/composer/ComposerAddAttachment.d.ts +1 -1
- package/dist/primitives/composer/ComposerAttachments.js +1 -2
- package/dist/primitives/composer/ComposerCancel.d.ts +1 -1
- package/dist/primitives/composer/ComposerDictate.d.ts +1 -1
- package/dist/primitives/composer/ComposerDictationTranscript.d.ts +1 -1
- package/dist/primitives/composer/ComposerIf.js +1 -2
- package/dist/primitives/composer/ComposerInput.d.ts.map +1 -1
- package/dist/primitives/composer/ComposerInput.js +3 -3
- package/dist/primitives/composer/ComposerInput.js.map +1 -1
- package/dist/primitives/composer/ComposerQueue.js +1 -2
- package/dist/primitives/composer/ComposerQuote.d.ts +3 -3
- package/dist/primitives/composer/ComposerResume.d.ts +1 -1
- package/dist/primitives/composer/ComposerRoot.d.ts +1 -1
- package/dist/primitives/composer/ComposerSend.d.ts +1 -1
- package/dist/primitives/composer/ComposerStopDictation.d.ts +1 -1
- package/dist/primitives/composer/trigger/TriggerPopover.d.ts +1 -1
- package/dist/primitives/composer/trigger/TriggerPopoverBack.d.ts +1 -1
- package/dist/primitives/composer/trigger/TriggerPopoverCategories.d.ts +2 -2
- package/dist/primitives/composer/trigger/TriggerPopoverItems.d.ts +2 -2
- package/dist/primitives/composer/trigger/index.d.ts +1 -1
- package/dist/primitives/composer/trigger/triggerSelectionResource.d.ts.map +1 -1
- package/dist/primitives/composer/trigger/triggerSelectionResource.js +2 -2
- package/dist/primitives/composer/trigger/triggerSelectionResource.js.map +1 -1
- package/dist/primitives/error/ErrorMessage.d.ts +1 -1
- package/dist/primitives/error/ErrorRoot.d.ts +1 -1
- package/dist/primitives/message/MessageAttachments.js +1 -2
- package/dist/primitives/message/MessageRoot.d.ts +1 -1
- package/dist/primitives/messagePart/MessagePartImage.d.ts +1 -1
- package/dist/primitives/messagePart/MessagePartInProgress.js +1 -2
- package/dist/primitives/messagePart/MessagePartText.d.ts +1 -1
- package/dist/primitives/queueItem/QueueItemRemove.d.ts +1 -1
- package/dist/primitives/queueItem/QueueItemSteer.d.ts +1 -1
- package/dist/primitives/queueItem/QueueItemText.d.ts +1 -1
- package/dist/primitives/selectionToolbar/SelectionToolbarQuote.d.ts +1 -1
- package/dist/primitives/selectionToolbar/SelectionToolbarRoot.d.ts +1 -1
- package/dist/primitives/suggestion/SuggestionDescription.d.ts +1 -1
- package/dist/primitives/suggestion/SuggestionTitle.d.ts +1 -1
- package/dist/primitives/suggestion/SuggestionTrigger.d.ts +1 -1
- package/dist/primitives/thread/ThreadLoadEarlier.d.ts +1 -1
- package/dist/primitives/thread/ThreadMessages.js +1 -2
- package/dist/primitives/thread/ThreadRoot.d.ts +1 -1
- package/dist/primitives/thread/ThreadScrollToBottom.d.ts +1 -1
- package/dist/primitives/thread/ThreadSuggestion.d.ts +1 -1
- package/dist/primitives/thread/ThreadSuggestions.js +1 -2
- package/dist/primitives/thread/ThreadViewport.d.ts +1 -1
- package/dist/primitives/thread/ThreadViewportFooter.d.ts +1 -1
- package/dist/primitives/thread/useThreadViewportAutoScroll.d.ts.map +1 -1
- package/dist/primitives/thread/useThreadViewportAutoScroll.js +6 -3
- package/dist/primitives/thread/useThreadViewportAutoScroll.js.map +1 -1
- package/dist/primitives/threadList/ThreadListItems.js +1 -2
- package/dist/primitives/threadList/ThreadListLoadMore.d.ts +1 -1
- package/dist/primitives/threadList/ThreadListNew.d.ts +1 -1
- package/dist/primitives/threadList/ThreadListRoot.d.ts +1 -1
- package/dist/primitives/threadListFocusGroup.d.ts +1 -1
- package/dist/primitives/threadListFocusGroup.d.ts.map +1 -1
- package/dist/primitives/threadListItem/ThreadListItemArchive.d.ts +1 -1
- package/dist/primitives/threadListItem/ThreadListItemDelete.d.ts +1 -1
- package/dist/primitives/threadListItem/ThreadListItemRoot.d.ts +1 -1
- package/dist/primitives/threadListItem/ThreadListItemTitle.js +1 -2
- package/dist/primitives/threadListItem/ThreadListItemTrigger.d.ts +1 -1
- package/dist/primitives/threadListItem/ThreadListItemUnarchive.d.ts +2 -2
- package/dist/primitives/threadListItem/ThreadListItemUnarchive.d.ts.map +1 -1
- package/dist/primitives/threadListItem/ThreadListItemUnarchive.js +2 -2
- package/dist/primitives/threadListItem/ThreadListItemUnarchive.js.map +1 -1
- package/dist/unstable/useComposerInput.js +1 -1
- package/dist/unstable/useComposerInput.js.map +1 -1
- package/dist/unstable/useComposerInputHistory.d.ts.map +1 -1
- package/dist/unstable/useComposerInputHistory.js +2 -2
- package/dist/unstable/useComposerInputHistory.js.map +1 -1
- package/dist/unstable/useLiveCompletionAdapter.d.ts.map +1 -1
- package/dist/unstable/useLiveCompletionAdapter.js +3 -2
- package/dist/unstable/useLiveCompletionAdapter.js.map +1 -1
- package/dist/utils/Primitive.d.ts +17 -17
- package/dist/utils/createActionButton.d.ts +1 -1
- package/package.json +12 -12
- package/src/adapters/OpenAIRealtimeVoiceAdapter.test.ts +14 -1
- package/src/cloud-renderer/CloudRendererHost.tsx +4 -2
- package/src/index.ts +9 -8
- package/src/internal.ts +1 -1
- package/src/legacy-runtime/AssistantRuntimeProvider.tsx +1 -1
- package/src/primitives/actionBar/ActionBarCopy.test.tsx +57 -0
- package/src/primitives/actionBar/ActionBarExportMarkdown.test.tsx +24 -5
- package/src/primitives/assistantModal/AssistantModalRoot.test.tsx +1 -1
- package/src/primitives/composer/ComposerInput.focus-on-run-start.test.tsx +1 -1
- package/src/primitives/composer/ComposerInput.test.tsx +1 -0
- package/src/primitives/composer/ComposerInput.text-change.test.tsx +68 -0
- package/src/primitives/composer/ComposerInput.thread-scope.test.tsx +82 -0
- package/src/primitives/composer/ComposerInput.tsx +4 -3
- package/src/primitives/composer/trigger/triggerSelectionResource.test.ts +6 -4
- package/src/primitives/composer/trigger/triggerSelectionResource.ts +2 -0
- package/src/primitives/thread/ThreadRoot.test.tsx +1 -1
- package/src/primitives/thread/ThreadViewport.thread-scope.test.tsx +51 -0
- package/src/primitives/thread/useThreadViewportAutoScroll.ts +8 -2
- package/src/primitives/threadListItem/ThreadListItemUnarchive.test.tsx +52 -0
- package/src/primitives/threadListItem/ThreadListItemUnarchive.ts +2 -2
- package/src/tests/DataRenderers.test.tsx +1 -1
- package/src/tests/MessageParts.loading.test.tsx +1 -1
- package/src/tests/RemoteThreadListRuntime.adapterProvider.test.tsx +1 -1
- package/src/tests/RemoteThreadListRuntime.deferredProvider.test.tsx +4 -2
- package/src/tests/RemoteThreadListRuntime.reloadMainThread.test.tsx +4 -2
- package/src/tests/generative-ui.primitive.test.tsx +1 -1
- package/src/tests/local-runtime-queue.test.tsx +2 -2
- package/src/tests/messagePartSwitchRace.test.tsx +2 -2
- package/src/tests/messagePartTypeMismatch.test.tsx +1 -1
- package/src/tests/threadListItemIsRunning.test.tsx +5 -3
- package/src/tests/toolCallTiming.test.tsx +1 -1
- package/src/unstable/useComposerInput.test.tsx +1 -1
- package/src/unstable/useComposerInput.ts +1 -1
- package/src/unstable/useComposerInputHistory.test.tsx +10 -7
- package/src/unstable/useComposerInputHistory.thread-scope.test.tsx +123 -0
- package/src/unstable/useComposerInputHistory.ts +3 -2
- package/src/unstable/useLiveCompletionAdapter.test.tsx +44 -0
- package/src/unstable/useLiveCompletionAdapter.ts +3 -2
- package/src/unstable/webmcp/convertTools.test.ts +11 -1
- package/src/utils/hooks/useMediaQuery.test.tsx +35 -0
- package/src/utils/smooth/useSmooth.test.tsx +37 -10
- package/dist/context/providers/ChainOfThoughtPartByIndexProvider.d.ts +0 -2
- package/dist/context/providers/ChainOfThoughtPartByIndexProvider.d.ts.map +0 -1
- package/dist/context/providers/ChainOfThoughtPartByIndexProvider.js +0 -3
- package/dist/legacy-runtime/RuntimeAdapter.d.ts +0 -2
- package/dist/legacy-runtime/RuntimeAdapter.d.ts.map +0 -1
- package/dist/legacy-runtime/RuntimeAdapter.js +0 -2
- package/dist/legacy-runtime/cloud/AssistantCloudThreadHistoryAdapter.d.ts +0 -2
- package/dist/legacy-runtime/cloud/AssistantCloudThreadHistoryAdapter.d.ts.map +0 -1
- package/dist/legacy-runtime/cloud/AssistantCloudThreadHistoryAdapter.js +0 -3
- package/dist/legacy-runtime/runtime/AssistantRuntime.d.ts +0 -3
- package/dist/legacy-runtime/runtime/AssistantRuntime.d.ts.map +0 -1
- package/dist/legacy-runtime/runtime/AssistantRuntime.js +0 -2
- package/dist/legacy-runtime/runtime/AttachmentRuntime.d.ts +0 -3
- package/dist/legacy-runtime/runtime/AttachmentRuntime.d.ts.map +0 -1
- package/dist/legacy-runtime/runtime/AttachmentRuntime.js +0 -2
- package/dist/legacy-runtime/runtime/ComposerRuntime.d.ts +0 -4
- package/dist/legacy-runtime/runtime/ComposerRuntime.d.ts.map +0 -1
- package/dist/legacy-runtime/runtime/ComposerRuntime.js +0 -2
- package/dist/legacy-runtime/runtime/RuntimeBindings.d.ts +0 -3
- package/dist/legacy-runtime/runtime/RuntimeBindings.d.ts.map +0 -1
- package/dist/legacy-runtime/runtime/RuntimeBindings.js +0 -0
- package/dist/legacy-runtime/runtime/RuntimePathTypes.d.ts +0 -2
- package/dist/legacy-runtime/runtime/RuntimePathTypes.d.ts.map +0 -1
- package/dist/legacy-runtime/runtime/RuntimePathTypes.js +0 -0
- package/dist/legacy-runtime/runtime/ThreadListItemRuntime.d.ts +0 -5
- package/dist/legacy-runtime/runtime/ThreadListItemRuntime.d.ts.map +0 -1
- package/dist/legacy-runtime/runtime/ThreadListItemRuntime.js +0 -2
- package/dist/legacy-runtime/runtime/ThreadRuntime.d.ts +0 -4
- package/dist/legacy-runtime/runtime/ThreadRuntime.d.ts.map +0 -1
- package/dist/legacy-runtime/runtime/ThreadRuntime.js +0 -2
- package/dist/legacy-runtime/runtime-cores/adapters/RuntimeAdapterProvider.d.ts +0 -2
- package/dist/legacy-runtime/runtime-cores/adapters/RuntimeAdapterProvider.d.ts.map +0 -1
- package/dist/legacy-runtime/runtime-cores/adapters/RuntimeAdapterProvider.js +0 -3
- package/dist/legacy-runtime/runtime-cores/adapters/attachment/CloudFileAttachmentAdapter.d.ts +0 -2
- package/dist/legacy-runtime/runtime-cores/adapters/attachment/CloudFileAttachmentAdapter.d.ts.map +0 -1
- package/dist/legacy-runtime/runtime-cores/adapters/attachment/CloudFileAttachmentAdapter.js +0 -3
- package/dist/legacy-runtime/runtime-cores/composer/BaseComposerRuntimeCore.d.ts +0 -2
- package/dist/legacy-runtime/runtime-cores/composer/BaseComposerRuntimeCore.d.ts.map +0 -1
- package/dist/legacy-runtime/runtime-cores/composer/BaseComposerRuntimeCore.js +0 -2
- package/dist/legacy-runtime/runtime-cores/composer/DefaultEditComposerRuntimeCore.d.ts +0 -2
- package/dist/legacy-runtime/runtime-cores/composer/DefaultEditComposerRuntimeCore.d.ts.map +0 -1
- package/dist/legacy-runtime/runtime-cores/composer/DefaultEditComposerRuntimeCore.js +0 -2
- package/dist/legacy-runtime/runtime-cores/composer/DefaultThreadComposerRuntimeCore.d.ts +0 -2
- package/dist/legacy-runtime/runtime-cores/composer/DefaultThreadComposerRuntimeCore.d.ts.map +0 -1
- package/dist/legacy-runtime/runtime-cores/composer/DefaultThreadComposerRuntimeCore.js +0 -2
- package/dist/legacy-runtime/runtime-cores/core/AssistantRuntimeCore.d.ts +0 -2
- package/dist/legacy-runtime/runtime-cores/core/AssistantRuntimeCore.d.ts.map +0 -1
- package/dist/legacy-runtime/runtime-cores/core/AssistantRuntimeCore.js +0 -0
- package/dist/legacy-runtime/runtime-cores/core/BaseAssistantRuntimeCore.d.ts +0 -2
- package/dist/legacy-runtime/runtime-cores/core/BaseAssistantRuntimeCore.d.ts.map +0 -1
- package/dist/legacy-runtime/runtime-cores/core/BaseAssistantRuntimeCore.js +0 -2
- package/dist/legacy-runtime/runtime-cores/core/BaseThreadRuntimeCore.d.ts +0 -2
- package/dist/legacy-runtime/runtime-cores/core/BaseThreadRuntimeCore.d.ts.map +0 -1
- package/dist/legacy-runtime/runtime-cores/core/BaseThreadRuntimeCore.js +0 -2
- package/dist/legacy-runtime/runtime-cores/core/ComposerRuntimeCore.d.ts +0 -2
- package/dist/legacy-runtime/runtime-cores/core/ComposerRuntimeCore.d.ts.map +0 -1
- package/dist/legacy-runtime/runtime-cores/core/ComposerRuntimeCore.js +0 -0
- package/dist/legacy-runtime/runtime-cores/core/ThreadListRuntimeCore.d.ts +0 -2
- package/dist/legacy-runtime/runtime-cores/core/ThreadListRuntimeCore.d.ts.map +0 -1
- package/dist/legacy-runtime/runtime-cores/core/ThreadListRuntimeCore.js +0 -0
- package/dist/legacy-runtime/runtime-cores/core/ThreadRuntimeCore.d.ts +0 -2
- package/dist/legacy-runtime/runtime-cores/core/ThreadRuntimeCore.d.ts.map +0 -1
- package/dist/legacy-runtime/runtime-cores/core/ThreadRuntimeCore.js +0 -0
- package/dist/legacy-runtime/runtime-cores/external-store/ExternalStoreAdapter.d.ts +0 -2
- package/dist/legacy-runtime/runtime-cores/external-store/ExternalStoreAdapter.d.ts.map +0 -1
- package/dist/legacy-runtime/runtime-cores/external-store/ExternalStoreAdapter.js +0 -0
- package/dist/legacy-runtime/runtime-cores/external-store/ExternalStoreRuntimeCore.d.ts +0 -2
- package/dist/legacy-runtime/runtime-cores/external-store/ExternalStoreRuntimeCore.d.ts.map +0 -1
- package/dist/legacy-runtime/runtime-cores/external-store/ExternalStoreRuntimeCore.js +0 -2
- package/dist/legacy-runtime/runtime-cores/external-store/ExternalStoreThreadListRuntimeCore.d.ts +0 -3
- package/dist/legacy-runtime/runtime-cores/external-store/ExternalStoreThreadListRuntimeCore.d.ts.map +0 -1
- package/dist/legacy-runtime/runtime-cores/external-store/ExternalStoreThreadListRuntimeCore.js +0 -2
- package/dist/legacy-runtime/runtime-cores/external-store/ExternalStoreThreadRuntimeCore.d.ts +0 -2
- package/dist/legacy-runtime/runtime-cores/external-store/ExternalStoreThreadRuntimeCore.d.ts.map +0 -1
- package/dist/legacy-runtime/runtime-cores/external-store/ExternalStoreThreadRuntimeCore.js +0 -2
- package/dist/legacy-runtime/runtime-cores/external-store/ThreadMessageConverter.d.ts +0 -3
- package/dist/legacy-runtime/runtime-cores/external-store/ThreadMessageConverter.d.ts.map +0 -1
- package/dist/legacy-runtime/runtime-cores/external-store/ThreadMessageConverter.js +0 -2
- package/dist/legacy-runtime/runtime-cores/external-store/ThreadMessageLike.d.ts +0 -3
- package/dist/legacy-runtime/runtime-cores/external-store/ThreadMessageLike.d.ts.map +0 -1
- package/dist/legacy-runtime/runtime-cores/external-store/ThreadMessageLike.js +0 -2
- package/dist/legacy-runtime/runtime-cores/external-store/auto-status.d.ts +0 -2
- package/dist/legacy-runtime/runtime-cores/external-store/auto-status.d.ts.map +0 -1
- package/dist/legacy-runtime/runtime-cores/external-store/auto-status.js +0 -2
- package/dist/legacy-runtime/runtime-cores/external-store/createMessageConverter.d.ts +0 -2
- package/dist/legacy-runtime/runtime-cores/external-store/createMessageConverter.d.ts.map +0 -1
- package/dist/legacy-runtime/runtime-cores/external-store/createMessageConverter.js +0 -3
- package/dist/legacy-runtime/runtime-cores/external-store/external-message-converter.d.ts +0 -2
- package/dist/legacy-runtime/runtime-cores/external-store/external-message-converter.d.ts.map +0 -1
- package/dist/legacy-runtime/runtime-cores/external-store/external-message-converter.js +0 -3
- package/dist/legacy-runtime/runtime-cores/external-store/useExternalStoreRuntime.d.ts +0 -2
- package/dist/legacy-runtime/runtime-cores/external-store/useExternalStoreRuntime.d.ts.map +0 -1
- package/dist/legacy-runtime/runtime-cores/external-store/useExternalStoreRuntime.js +0 -3
- package/dist/legacy-runtime/runtime-cores/local/ChatModelAdapter.d.ts +0 -2
- package/dist/legacy-runtime/runtime-cores/local/ChatModelAdapter.d.ts.map +0 -1
- package/dist/legacy-runtime/runtime-cores/local/ChatModelAdapter.js +0 -0
- package/dist/legacy-runtime/runtime-cores/local/LocalRuntimeCore.d.ts +0 -2
- package/dist/legacy-runtime/runtime-cores/local/LocalRuntimeCore.d.ts.map +0 -1
- package/dist/legacy-runtime/runtime-cores/local/LocalRuntimeCore.js +0 -2
- package/dist/legacy-runtime/runtime-cores/local/LocalRuntimeOptions.d.ts +0 -4
- package/dist/legacy-runtime/runtime-cores/local/LocalRuntimeOptions.d.ts.map +0 -1
- package/dist/legacy-runtime/runtime-cores/local/LocalRuntimeOptions.js +0 -2
- package/dist/legacy-runtime/runtime-cores/local/LocalThreadListRuntimeCore.d.ts +0 -3
- package/dist/legacy-runtime/runtime-cores/local/LocalThreadListRuntimeCore.d.ts.map +0 -1
- package/dist/legacy-runtime/runtime-cores/local/LocalThreadListRuntimeCore.js +0 -2
- package/dist/legacy-runtime/runtime-cores/local/LocalThreadRuntimeCore.d.ts +0 -2
- package/dist/legacy-runtime/runtime-cores/local/LocalThreadRuntimeCore.d.ts.map +0 -1
- package/dist/legacy-runtime/runtime-cores/local/LocalThreadRuntimeCore.js +0 -2
- package/dist/legacy-runtime/runtime-cores/local/shouldContinue.d.ts +0 -2
- package/dist/legacy-runtime/runtime-cores/local/shouldContinue.d.ts.map +0 -1
- package/dist/legacy-runtime/runtime-cores/local/shouldContinue.js +0 -2
- package/dist/legacy-runtime/runtime-cores/local/useLocalRuntime.d.ts +0 -2
- package/dist/legacy-runtime/runtime-cores/local/useLocalRuntime.d.ts.map +0 -1
- package/dist/legacy-runtime/runtime-cores/local/useLocalRuntime.js +0 -3
- package/dist/legacy-runtime/runtime-cores/remote-thread-list/BaseSubscribable.d.ts +0 -2
- package/dist/legacy-runtime/runtime-cores/remote-thread-list/BaseSubscribable.d.ts.map +0 -1
- package/dist/legacy-runtime/runtime-cores/remote-thread-list/BaseSubscribable.js +0 -2
- package/dist/legacy-runtime/runtime-cores/remote-thread-list/EMPTY_THREAD_CORE.d.ts +0 -2
- package/dist/legacy-runtime/runtime-cores/remote-thread-list/EMPTY_THREAD_CORE.d.ts.map +0 -1
- package/dist/legacy-runtime/runtime-cores/remote-thread-list/EMPTY_THREAD_CORE.js +0 -2
- package/dist/legacy-runtime/runtime-cores/remote-thread-list/OptimisticState.d.ts +0 -2
- package/dist/legacy-runtime/runtime-cores/remote-thread-list/OptimisticState.d.ts.map +0 -1
- package/dist/legacy-runtime/runtime-cores/remote-thread-list/OptimisticState.js +0 -2
- package/dist/legacy-runtime/runtime-cores/remote-thread-list/RemoteThreadListHookInstanceManager.d.ts +0 -2
- package/dist/legacy-runtime/runtime-cores/remote-thread-list/RemoteThreadListHookInstanceManager.d.ts.map +0 -1
- package/dist/legacy-runtime/runtime-cores/remote-thread-list/RemoteThreadListHookInstanceManager.js +0 -3
- package/dist/legacy-runtime/runtime-cores/remote-thread-list/RemoteThreadListThreadListRuntimeCore.d.ts +0 -2
- package/dist/legacy-runtime/runtime-cores/remote-thread-list/RemoteThreadListThreadListRuntimeCore.d.ts.map +0 -1
- package/dist/legacy-runtime/runtime-cores/remote-thread-list/RemoteThreadListThreadListRuntimeCore.js +0 -3
- package/dist/legacy-runtime/runtime-cores/remote-thread-list/adapter/cloud.d.ts +0 -2
- package/dist/legacy-runtime/runtime-cores/remote-thread-list/adapter/cloud.d.ts.map +0 -1
- package/dist/legacy-runtime/runtime-cores/remote-thread-list/adapter/cloud.js +0 -3
- package/dist/legacy-runtime/runtime-cores/remote-thread-list/adapter/in-memory.d.ts +0 -2
- package/dist/legacy-runtime/runtime-cores/remote-thread-list/adapter/in-memory.d.ts.map +0 -1
- package/dist/legacy-runtime/runtime-cores/remote-thread-list/adapter/in-memory.js +0 -2
- package/dist/legacy-runtime/runtime-cores/remote-thread-list/types.d.ts +0 -2
- package/dist/legacy-runtime/runtime-cores/remote-thread-list/types.d.ts.map +0 -1
- package/dist/legacy-runtime/runtime-cores/remote-thread-list/types.js +0 -0
- package/dist/legacy-runtime/runtime-cores/remote-thread-list/useRemoteThreadListRuntime.d.ts +0 -2
- package/dist/legacy-runtime/runtime-cores/remote-thread-list/useRemoteThreadListRuntime.d.ts.map +0 -1
- package/dist/legacy-runtime/runtime-cores/remote-thread-list/useRemoteThreadListRuntime.js +0 -3
- package/dist/legacy-runtime/runtime-cores/utils/MessageRepository.d.ts +0 -4
- package/dist/legacy-runtime/runtime-cores/utils/MessageRepository.d.ts.map +0 -1
- package/dist/legacy-runtime/runtime-cores/utils/MessageRepository.js +0 -3
- package/dist/utils/hooks/useOnResizeContent.d.ts +0 -2
- package/dist/utils/hooks/useOnResizeContent.d.ts.map +0 -1
- package/dist/utils/hooks/useOnResizeContent.js +0 -21
- package/dist/utils/hooks/useOnResizeContent.js.map +0 -1
- package/src/context/providers/ChainOfThoughtPartByIndexProvider.tsx +0 -3
- package/src/legacy-runtime/RuntimeAdapter.ts +0 -1
- package/src/legacy-runtime/cloud/AssistantCloudThreadHistoryAdapter.ts +0 -3
- package/src/legacy-runtime/runtime/AssistantRuntime.ts +0 -2
- package/src/legacy-runtime/runtime/AttachmentRuntime.ts +0 -7
- package/src/legacy-runtime/runtime/ComposerRuntime.ts +0 -20
- package/src/legacy-runtime/runtime/RuntimeBindings.ts +0 -12
- package/src/legacy-runtime/runtime/RuntimePathTypes.ts +0 -8
- package/src/legacy-runtime/runtime/ThreadListItemRuntime.ts +0 -10
- package/src/legacy-runtime/runtime/ThreadRuntime.ts +0 -14
- package/src/legacy-runtime/runtime-cores/adapters/RuntimeAdapterProvider.tsx +0 -7
- package/src/legacy-runtime/runtime-cores/adapters/attachment/CloudFileAttachmentAdapter.ts +0 -3
- package/src/legacy-runtime/runtime-cores/composer/BaseComposerRuntimeCore.ts +0 -1
- package/src/legacy-runtime/runtime-cores/composer/DefaultEditComposerRuntimeCore.ts +0 -1
- package/src/legacy-runtime/runtime-cores/composer/DefaultThreadComposerRuntimeCore.ts +0 -1
- package/src/legacy-runtime/runtime-cores/core/AssistantRuntimeCore.ts +0 -1
- package/src/legacy-runtime/runtime-cores/core/BaseAssistantRuntimeCore.ts +0 -1
- package/src/legacy-runtime/runtime-cores/core/BaseThreadRuntimeCore.ts +0 -1
- package/src/legacy-runtime/runtime-cores/core/ComposerRuntimeCore.ts +0 -6
- package/src/legacy-runtime/runtime-cores/core/ThreadListRuntimeCore.ts +0 -4
- package/src/legacy-runtime/runtime-cores/core/ThreadRuntimeCore.ts +0 -13
- package/src/legacy-runtime/runtime-cores/external-store/ExternalStoreAdapter.ts +0 -6
- package/src/legacy-runtime/runtime-cores/external-store/ExternalStoreRuntimeCore.ts +0 -1
- package/src/legacy-runtime/runtime-cores/external-store/ExternalStoreThreadListRuntimeCore.ts +0 -2
- package/src/legacy-runtime/runtime-cores/external-store/ExternalStoreThreadRuntimeCore.ts +0 -4
- package/src/legacy-runtime/runtime-cores/external-store/ThreadMessageConverter.ts +0 -2
- package/src/legacy-runtime/runtime-cores/external-store/ThreadMessageLike.ts +0 -2
- package/src/legacy-runtime/runtime-cores/external-store/auto-status.ts +0 -1
- package/src/legacy-runtime/runtime-cores/external-store/createMessageConverter.ts +0 -2
- package/src/legacy-runtime/runtime-cores/external-store/external-message-converter.ts +0 -7
- package/src/legacy-runtime/runtime-cores/external-store/useExternalStoreRuntime.ts +0 -3
- package/src/legacy-runtime/runtime-cores/local/ChatModelAdapter.ts +0 -7
- package/src/legacy-runtime/runtime-cores/local/LocalRuntimeCore.ts +0 -1
- package/src/legacy-runtime/runtime-cores/local/LocalRuntimeOptions.ts +0 -3
- package/src/legacy-runtime/runtime-cores/local/LocalThreadListRuntimeCore.ts +0 -2
- package/src/legacy-runtime/runtime-cores/local/LocalThreadRuntimeCore.ts +0 -1
- package/src/legacy-runtime/runtime-cores/local/shouldContinue.ts +0 -1
- package/src/legacy-runtime/runtime-cores/local/useLocalRuntime.ts +0 -3
- package/src/legacy-runtime/runtime-cores/remote-thread-list/BaseSubscribable.ts +0 -1
- package/src/legacy-runtime/runtime-cores/remote-thread-list/EMPTY_THREAD_CORE.ts +0 -1
- package/src/legacy-runtime/runtime-cores/remote-thread-list/OptimisticState.ts +0 -1
- package/src/legacy-runtime/runtime-cores/remote-thread-list/RemoteThreadListHookInstanceManager.tsx +0 -3
- package/src/legacy-runtime/runtime-cores/remote-thread-list/RemoteThreadListThreadListRuntimeCore.tsx +0 -3
- package/src/legacy-runtime/runtime-cores/remote-thread-list/adapter/cloud.tsx +0 -3
- package/src/legacy-runtime/runtime-cores/remote-thread-list/adapter/in-memory.ts +0 -1
- package/src/legacy-runtime/runtime-cores/remote-thread-list/types.ts +0 -7
- package/src/legacy-runtime/runtime-cores/remote-thread-list/useRemoteThreadListRuntime.ts +0 -3
- package/src/legacy-runtime/runtime-cores/utils/MessageRepository.ts +0 -3
- package/src/utils/hooks/useOnResizeContent.ts +0 -15
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
// @vitest-environment jsdom
|
|
2
|
+
|
|
3
|
+
import { cleanup, fireEvent, render } from "@testing-library/react";
|
|
4
|
+
import { afterEach, describe, expect, it, vi } from "vitest";
|
|
5
|
+
import {
|
|
6
|
+
AssistantRuntimeProvider,
|
|
7
|
+
ThreadListItemByIndexProvider,
|
|
8
|
+
} from "@assistant-ui/core/react";
|
|
9
|
+
import {
|
|
10
|
+
AssistantRuntimeImpl,
|
|
11
|
+
ExternalStoreRuntimeCore,
|
|
12
|
+
} from "@assistant-ui/core/internal";
|
|
13
|
+
import { ThreadListItemPrimitiveUnarchive } from "./ThreadListItemUnarchive";
|
|
14
|
+
|
|
15
|
+
afterEach(cleanup);
|
|
16
|
+
|
|
17
|
+
describe("ThreadListItemPrimitive.Unarchive", () => {
|
|
18
|
+
it.each([true, false])(
|
|
19
|
+
"renders an actionable button only when unarchive is supported (%s)",
|
|
20
|
+
(supported) => {
|
|
21
|
+
const onUnarchive = vi.fn();
|
|
22
|
+
const runtime = new AssistantRuntimeImpl(
|
|
23
|
+
new ExternalStoreRuntimeCore({
|
|
24
|
+
messages: [],
|
|
25
|
+
onNew: async () => {},
|
|
26
|
+
adapters: {
|
|
27
|
+
threadList: {
|
|
28
|
+
archivedThreads: [{ id: "archived", status: "archived" }],
|
|
29
|
+
onUnarchive: supported ? onUnarchive : undefined,
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
}),
|
|
33
|
+
);
|
|
34
|
+
const { getByRole } = render(
|
|
35
|
+
<AssistantRuntimeProvider runtime={runtime}>
|
|
36
|
+
<ThreadListItemByIndexProvider index={0} archived>
|
|
37
|
+
<ThreadListItemPrimitiveUnarchive disabled={false}>
|
|
38
|
+
Restore
|
|
39
|
+
</ThreadListItemPrimitiveUnarchive>
|
|
40
|
+
</ThreadListItemByIndexProvider>
|
|
41
|
+
</AssistantRuntimeProvider>,
|
|
42
|
+
);
|
|
43
|
+
const button = getByRole("button", {
|
|
44
|
+
name: "Restore",
|
|
45
|
+
}) as HTMLButtonElement;
|
|
46
|
+
expect(button.disabled).toBe(!supported);
|
|
47
|
+
fireEvent.click(button);
|
|
48
|
+
if (supported) expect(onUnarchive).toHaveBeenCalledWith("archived");
|
|
49
|
+
else expect(onUnarchive).not.toHaveBeenCalled();
|
|
50
|
+
},
|
|
51
|
+
);
|
|
52
|
+
});
|
|
@@ -8,8 +8,8 @@ import {
|
|
|
8
8
|
import { useThreadListItemUnarchive as useThreadListItemUnarchiveBehavior } from "@assistant-ui/core/react";
|
|
9
9
|
|
|
10
10
|
const useThreadListItemUnarchive = () => {
|
|
11
|
-
const { unarchive } = useThreadListItemUnarchiveBehavior();
|
|
12
|
-
return unarchive;
|
|
11
|
+
const { unarchive, disabled } = useThreadListItemUnarchiveBehavior();
|
|
12
|
+
return disabled ? null : unarchive;
|
|
13
13
|
};
|
|
14
14
|
|
|
15
15
|
export namespace ThreadListItemPrimitiveUnarchive {
|
|
@@ -15,7 +15,7 @@ import { useAui } from "@assistant-ui/store";
|
|
|
15
15
|
import { AssistantRuntimeProvider } from "../context";
|
|
16
16
|
import * as MessagePrimitive from "../primitives/message";
|
|
17
17
|
import * as ThreadPrimitive from "../primitives/thread";
|
|
18
|
-
import { useLocalRuntime } from "
|
|
18
|
+
import { useLocalRuntime } from "@assistant-ui/core/react";
|
|
19
19
|
import {
|
|
20
20
|
useAssistantDataUI,
|
|
21
21
|
type ChatModelAdapter,
|
|
@@ -7,7 +7,7 @@ import { AssistantRuntimeProvider } from "../context";
|
|
|
7
7
|
import * as MessagePartPrimitive from "../primitives/messagePart";
|
|
8
8
|
import * as MessagePrimitive from "../primitives/message";
|
|
9
9
|
import * as ThreadPrimitive from "../primitives/thread";
|
|
10
|
-
import { useLocalRuntime } from "
|
|
10
|
+
import { useLocalRuntime } from "@assistant-ui/core/react";
|
|
11
11
|
import type { ChatModelAdapter, ThreadMessageLike } from "../index";
|
|
12
12
|
|
|
13
13
|
const noOpAdapter: ChatModelAdapter = {
|
|
@@ -8,9 +8,9 @@ import {
|
|
|
8
8
|
useRemoteThreadListRuntime,
|
|
9
9
|
useRuntimeAdapters,
|
|
10
10
|
type RuntimeAdapters as RuntimeAdaptersShape,
|
|
11
|
+
useLocalRuntime,
|
|
11
12
|
} from "@assistant-ui/core/react";
|
|
12
13
|
import { makeAdapter } from "./remote-thread-list-test-helpers";
|
|
13
|
-
import { useLocalRuntime } from "../legacy-runtime/runtime-cores/local/useLocalRuntime";
|
|
14
14
|
import { AssistantRuntimeProvider } from "../context";
|
|
15
15
|
import type { ChatModelAdapter, RemoteThreadListAdapter } from "../index";
|
|
16
16
|
import type { ThreadHistoryAdapter } from "@assistant-ui/core";
|
|
@@ -3,12 +3,14 @@
|
|
|
3
3
|
import { act, render } from "@testing-library/react";
|
|
4
4
|
import { type FC, type PropsWithChildren, useState } from "react";
|
|
5
5
|
import { afterEach, describe, expect, it, vi } from "vitest";
|
|
6
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
useRemoteThreadListRuntime,
|
|
8
|
+
useLocalRuntime,
|
|
9
|
+
} from "@assistant-ui/core/react";
|
|
7
10
|
import { makeAdapter } from "./remote-thread-list-test-helpers";
|
|
8
11
|
import type { AssistantRuntime } from "@assistant-ui/core";
|
|
9
12
|
import { useAui } from "@assistant-ui/store";
|
|
10
13
|
import { AssistantRuntimeProvider } from "../context";
|
|
11
|
-
import { useLocalRuntime } from "../legacy-runtime/runtime-cores/local/useLocalRuntime";
|
|
12
14
|
import type { ChatModelAdapter, RemoteThreadListAdapter } from "../index";
|
|
13
15
|
|
|
14
16
|
const noOpAdapter: ChatModelAdapter = {
|
|
@@ -4,12 +4,14 @@ import { act, render, waitFor } from "@testing-library/react";
|
|
|
4
4
|
import { type FC, useEffect } from "react";
|
|
5
5
|
import { describe, expect, it } from "vitest";
|
|
6
6
|
import type { AssistantRuntime } from "@assistant-ui/core";
|
|
7
|
-
import {
|
|
7
|
+
import {
|
|
8
|
+
useRemoteThreadListRuntime,
|
|
9
|
+
useLocalRuntime,
|
|
10
|
+
} from "@assistant-ui/core/react";
|
|
8
11
|
import {
|
|
9
12
|
makeAdapter,
|
|
10
13
|
settleOutsideAct,
|
|
11
14
|
} from "./remote-thread-list-test-helpers";
|
|
12
|
-
import { useLocalRuntime } from "../legacy-runtime/runtime-cores/local/useLocalRuntime";
|
|
13
15
|
import { AssistantRuntimeProvider } from "../context";
|
|
14
16
|
import type { ChatModelAdapter } from "../index";
|
|
15
17
|
|
|
@@ -6,7 +6,7 @@ import { describe, expect, it, vi } from "vitest";
|
|
|
6
6
|
import { AssistantRuntimeProvider } from "../context";
|
|
7
7
|
import * as MessagePrimitive from "../primitives/message";
|
|
8
8
|
import * as ThreadPrimitive from "../primitives/thread";
|
|
9
|
-
import { useLocalRuntime } from "
|
|
9
|
+
import { useLocalRuntime } from "@assistant-ui/core/react";
|
|
10
10
|
import type {
|
|
11
11
|
ChatModelAdapter,
|
|
12
12
|
GenerativeUISpec,
|
|
@@ -5,8 +5,8 @@ import type { FC } from "react";
|
|
|
5
5
|
import { describe, it, expect } from "vitest";
|
|
6
6
|
import { useAui } from "@assistant-ui/store";
|
|
7
7
|
import { AssistantRuntimeProvider } from "../context";
|
|
8
|
-
import { useLocalRuntime } from "
|
|
9
|
-
import type { ChatModelAdapter } from "
|
|
8
|
+
import { useLocalRuntime } from "@assistant-ui/core/react";
|
|
9
|
+
import type { ChatModelAdapter } from "@assistant-ui/core";
|
|
10
10
|
|
|
11
11
|
const flush = () => new Promise<void>((resolve) => setTimeout(resolve, 0));
|
|
12
12
|
|
|
@@ -6,8 +6,8 @@ import { Component, useEffect, useState, type FC, type ReactNode } from "react";
|
|
|
6
6
|
import { afterEach, describe, expect, it, vi } from "vitest";
|
|
7
7
|
import { useAui, useAuiState } from "@assistant-ui/store";
|
|
8
8
|
import { AssistantRuntimeProvider, PartByIndexProvider } from "../context";
|
|
9
|
-
import { useLocalRuntime } from "
|
|
10
|
-
import type { ChatModelAdapter } from "
|
|
9
|
+
import { useLocalRuntime } from "@assistant-ui/core/react";
|
|
10
|
+
import type { ChatModelAdapter } from "@assistant-ui/core";
|
|
11
11
|
import * as ThreadPrimitive from "../primitives/thread";
|
|
12
12
|
import * as MessagePrimitive from "../primitives/message";
|
|
13
13
|
import { useMessagePartText } from "../primitives/messagePart/useMessagePartText";
|
|
@@ -7,7 +7,7 @@ import { AssistantRuntimeProvider } from "../context";
|
|
|
7
7
|
import * as MessagePartPrimitive from "../primitives/messagePart";
|
|
8
8
|
import * as MessagePrimitive from "../primitives/message";
|
|
9
9
|
import * as ThreadPrimitive from "../primitives/thread";
|
|
10
|
-
import { useLocalRuntime } from "
|
|
10
|
+
import { useLocalRuntime } from "@assistant-ui/core/react";
|
|
11
11
|
import {
|
|
12
12
|
useMessagePartReasoning,
|
|
13
13
|
useMessagePartSource,
|
|
@@ -4,7 +4,11 @@ import { act, render, screen, waitFor } from "@testing-library/react";
|
|
|
4
4
|
import { type FC, useEffect, useReducer } from "react";
|
|
5
5
|
import { describe, expect, it } from "vitest";
|
|
6
6
|
import type { ThreadMessage } from "@assistant-ui/core";
|
|
7
|
-
import {
|
|
7
|
+
import {
|
|
8
|
+
useRemoteThreadListRuntime,
|
|
9
|
+
useLocalRuntime,
|
|
10
|
+
useExternalStoreRuntime,
|
|
11
|
+
} from "@assistant-ui/core/react";
|
|
8
12
|
import {
|
|
9
13
|
makeAdapter,
|
|
10
14
|
settleOutsideAct,
|
|
@@ -17,8 +21,6 @@ import {
|
|
|
17
21
|
type AssistantRuntime,
|
|
18
22
|
type ChatModelAdapter,
|
|
19
23
|
} from "../index";
|
|
20
|
-
import { useExternalStoreRuntime } from "../legacy-runtime/runtime-cores/external-store/useExternalStoreRuntime";
|
|
21
|
-
import { useLocalRuntime } from "../legacy-runtime/runtime-cores/local/useLocalRuntime";
|
|
22
24
|
|
|
23
25
|
const Probe: FC = () => {
|
|
24
26
|
const id = useAuiState((s) => s.threadListItem.id);
|
|
@@ -6,7 +6,7 @@ import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
|
|
6
6
|
import { AssistantRuntimeProvider } from "../context";
|
|
7
7
|
import * as MessagePrimitive from "../primitives/message";
|
|
8
8
|
import * as ThreadPrimitive from "../primitives/thread";
|
|
9
|
-
import { useLocalRuntime } from "
|
|
9
|
+
import { useLocalRuntime } from "@assistant-ui/core/react";
|
|
10
10
|
import {
|
|
11
11
|
type ChatModelAdapter,
|
|
12
12
|
type ThreadMessageLike,
|
|
@@ -100,7 +100,7 @@ describe("unstable_useComposerInput", () => {
|
|
|
100
100
|
it("writes text via flushTapSync when editing", () => {
|
|
101
101
|
renderInput()().setText("world");
|
|
102
102
|
expect(flushTapSync).toHaveBeenCalledTimes(1);
|
|
103
|
-
expect(composerSetText).toHaveBeenCalledWith("world");
|
|
103
|
+
expect(composerSetText).toHaveBeenCalledWith("world", { origin: "user" });
|
|
104
104
|
});
|
|
105
105
|
|
|
106
106
|
it("ignores setText when the composer is not editing (editing guard)", () => {
|
|
@@ -12,6 +12,7 @@ const setText = vi.fn();
|
|
|
12
12
|
|
|
13
13
|
vi.mock("@assistant-ui/store", () => ({
|
|
14
14
|
useAui: () => ({
|
|
15
|
+
optional: { threads: {} },
|
|
15
16
|
composer: {
|
|
16
17
|
getState: () => ({ type: fixture.composerType }),
|
|
17
18
|
setText,
|
|
@@ -81,7 +82,7 @@ describe("unstable_useComposerInputHistory", () => {
|
|
|
81
82
|
const { textarea } = setup("");
|
|
82
83
|
const notPrevented = arrow(textarea, "ArrowUp");
|
|
83
84
|
expect(notPrevented).toBe(false);
|
|
84
|
-
expect(setText).toHaveBeenCalledWith("second");
|
|
85
|
+
expect(setText).toHaveBeenCalledWith("second", { origin: "recall" });
|
|
85
86
|
});
|
|
86
87
|
|
|
87
88
|
it("steps to older entries and consumes the key at the oldest", () => {
|
|
@@ -89,7 +90,7 @@ describe("unstable_useComposerInputHistory", () => {
|
|
|
89
90
|
arrow(textarea, "ArrowUp");
|
|
90
91
|
textarea.value = "second";
|
|
91
92
|
arrow(textarea, "ArrowUp");
|
|
92
|
-
expect(setText).toHaveBeenLastCalledWith("first");
|
|
93
|
+
expect(setText).toHaveBeenLastCalledWith("first", { origin: "recall" });
|
|
93
94
|
|
|
94
95
|
textarea.value = "first";
|
|
95
96
|
const notPrevented = arrow(textarea, "ArrowUp");
|
|
@@ -102,7 +103,7 @@ describe("unstable_useComposerInputHistory", () => {
|
|
|
102
103
|
arrow(textarea, "ArrowUp");
|
|
103
104
|
textarea.value = "second";
|
|
104
105
|
arrow(textarea, "ArrowDown");
|
|
105
|
-
expect(setText).toHaveBeenLastCalledWith(" ");
|
|
106
|
+
expect(setText).toHaveBeenLastCalledWith(" ", { origin: "recall" });
|
|
106
107
|
|
|
107
108
|
textarea.value = " ";
|
|
108
109
|
const notPrevented = arrow(textarea, "ArrowDown");
|
|
@@ -121,7 +122,9 @@ describe("unstable_useComposerInputHistory", () => {
|
|
|
121
122
|
fixture.messages = [user("other"), user("line1\nline2")];
|
|
122
123
|
const { textarea } = setup("");
|
|
123
124
|
arrow(textarea, "ArrowUp");
|
|
124
|
-
expect(setText).toHaveBeenLastCalledWith("line1\nline2"
|
|
125
|
+
expect(setText).toHaveBeenLastCalledWith("line1\nline2", {
|
|
126
|
+
origin: "recall",
|
|
127
|
+
});
|
|
125
128
|
textarea.value = "line1\nline2";
|
|
126
129
|
textarea.setSelectionRange(8, 8);
|
|
127
130
|
const notPrevented = arrow(textarea, "ArrowUp");
|
|
@@ -164,10 +167,10 @@ describe("unstable_useComposerInputHistory", () => {
|
|
|
164
167
|
];
|
|
165
168
|
const { textarea } = setup("");
|
|
166
169
|
arrow(textarea, "ArrowUp");
|
|
167
|
-
expect(setText).toHaveBeenLastCalledWith("second");
|
|
170
|
+
expect(setText).toHaveBeenLastCalledWith("second", { origin: "recall" });
|
|
168
171
|
textarea.value = "second";
|
|
169
172
|
arrow(textarea, "ArrowUp");
|
|
170
|
-
expect(setText).toHaveBeenLastCalledWith("first");
|
|
173
|
+
expect(setText).toHaveBeenLastCalledWith("first", { origin: "recall" });
|
|
171
174
|
textarea.value = "first";
|
|
172
175
|
arrow(textarea, "ArrowUp");
|
|
173
176
|
expect(setText).toHaveBeenCalledTimes(2);
|
|
@@ -179,7 +182,7 @@ describe("unstable_useComposerInputHistory", () => {
|
|
|
179
182
|
fixture.messages = [...fixture.messages, user("third")];
|
|
180
183
|
textarea.value = "";
|
|
181
184
|
arrow(textarea, "ArrowUp");
|
|
182
|
-
expect(setText).toHaveBeenLastCalledWith("third");
|
|
185
|
+
expect(setText).toHaveBeenLastCalledWith("third", { origin: "recall" });
|
|
183
186
|
});
|
|
184
187
|
|
|
185
188
|
it("is inert on edit composers", () => {
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
// @vitest-environment jsdom
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
act,
|
|
5
|
+
cleanup,
|
|
6
|
+
fireEvent,
|
|
7
|
+
render,
|
|
8
|
+
screen,
|
|
9
|
+
waitFor,
|
|
10
|
+
} from "@testing-library/react";
|
|
11
|
+
import { afterEach, expect, it } from "vitest";
|
|
12
|
+
import {
|
|
13
|
+
AuiConfig,
|
|
14
|
+
AuiProvider,
|
|
15
|
+
Derived,
|
|
16
|
+
useAui,
|
|
17
|
+
useAuiState,
|
|
18
|
+
} from "@assistant-ui/store";
|
|
19
|
+
import { ExternalThread, InMemoryThreadList } from "@assistant-ui/core/store";
|
|
20
|
+
import { resource, useResource } from "@assistant-ui/tap";
|
|
21
|
+
import type { ThreadMessage } from "@assistant-ui/core";
|
|
22
|
+
import { unstable_useComposerInputHistory } from "./useComposerInputHistory";
|
|
23
|
+
|
|
24
|
+
const messages: ThreadMessage[] = [
|
|
25
|
+
{
|
|
26
|
+
id: "user-1",
|
|
27
|
+
role: "user",
|
|
28
|
+
createdAt: new Date(0),
|
|
29
|
+
content: [{ type: "text", text: "Previous question" }],
|
|
30
|
+
attachments: [],
|
|
31
|
+
metadata: { custom: {} },
|
|
32
|
+
},
|
|
33
|
+
];
|
|
34
|
+
const StandaloneThread = resource(function useStandaloneThread() {
|
|
35
|
+
return useResource(ExternalThread({ messages }));
|
|
36
|
+
});
|
|
37
|
+
const Input = () => {
|
|
38
|
+
const aui = useAui();
|
|
39
|
+
const value = useAuiState((s) => s.composer.text);
|
|
40
|
+
const history = unstable_useComposerInputHistory();
|
|
41
|
+
return (
|
|
42
|
+
<textarea
|
|
43
|
+
aria-label="Composer"
|
|
44
|
+
value={value}
|
|
45
|
+
onChange={(e) => aui.composer.setText(e.target.value)}
|
|
46
|
+
{...history}
|
|
47
|
+
/>
|
|
48
|
+
);
|
|
49
|
+
};
|
|
50
|
+
const StandaloneApp = () => {
|
|
51
|
+
const config = AuiConfig({
|
|
52
|
+
thread: StandaloneThread(),
|
|
53
|
+
composer: Derived({
|
|
54
|
+
source: "thread",
|
|
55
|
+
query: {},
|
|
56
|
+
get: (aui) => aui.thread.composer(),
|
|
57
|
+
}),
|
|
58
|
+
});
|
|
59
|
+
return (
|
|
60
|
+
<AuiProvider config={config}>
|
|
61
|
+
<Input />
|
|
62
|
+
</AuiProvider>
|
|
63
|
+
);
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
afterEach(cleanup);
|
|
67
|
+
|
|
68
|
+
it("recalls history without a thread-list scope", async () => {
|
|
69
|
+
render(<StandaloneApp />);
|
|
70
|
+
const input = screen.getByRole("textbox", {
|
|
71
|
+
name: "Composer",
|
|
72
|
+
}) as HTMLTextAreaElement;
|
|
73
|
+
await act(async () => {
|
|
74
|
+
fireEvent.keyDown(input, { key: "ArrowUp" });
|
|
75
|
+
});
|
|
76
|
+
expect(input.value).toBe("Previous question");
|
|
77
|
+
await act(async () => {
|
|
78
|
+
fireEvent.keyDown(input, { key: "ArrowDown" });
|
|
79
|
+
});
|
|
80
|
+
expect(input.value).toBe("");
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
it("resets browsing when the thread switches without remounting the input", async () => {
|
|
84
|
+
let captured!: ReturnType<typeof useAui>;
|
|
85
|
+
const App = () => {
|
|
86
|
+
const aui = useAui({
|
|
87
|
+
threads: InMemoryThreadList({
|
|
88
|
+
thread: () => ExternalThread({ messages }),
|
|
89
|
+
}),
|
|
90
|
+
});
|
|
91
|
+
captured = aui;
|
|
92
|
+
return (
|
|
93
|
+
<AuiProvider value={aui}>
|
|
94
|
+
<Input />
|
|
95
|
+
</AuiProvider>
|
|
96
|
+
);
|
|
97
|
+
};
|
|
98
|
+
render(<App />);
|
|
99
|
+
const input = screen.getByRole("textbox", {
|
|
100
|
+
name: "Composer",
|
|
101
|
+
}) as HTMLTextAreaElement;
|
|
102
|
+
await act(async () => {
|
|
103
|
+
fireEvent.keyDown(input, { key: "ArrowUp" });
|
|
104
|
+
});
|
|
105
|
+
expect(input.value).toBe("Previous question");
|
|
106
|
+
|
|
107
|
+
const oldId = captured.threads.getState().mainThreadId;
|
|
108
|
+
await act(async () => {
|
|
109
|
+
captured.threads.switchToNewThread();
|
|
110
|
+
});
|
|
111
|
+
await waitFor(() =>
|
|
112
|
+
expect(captured.threads.getState().mainThreadId).not.toBe(oldId),
|
|
113
|
+
);
|
|
114
|
+
await act(async () => {
|
|
115
|
+
fireEvent.change(input, { target: { value: "Previous question" } });
|
|
116
|
+
});
|
|
117
|
+
input.setSelectionRange(input.value.length, input.value.length);
|
|
118
|
+
await act(async () => {
|
|
119
|
+
fireEvent.keyDown(input, { key: "ArrowDown" });
|
|
120
|
+
});
|
|
121
|
+
expect(screen.getByRole("textbox", { name: "Composer" })).toBe(input);
|
|
122
|
+
expect(input.value).toBe("Previous question");
|
|
123
|
+
});
|
|
@@ -71,7 +71,8 @@ export function unstable_useComposerInputHistory(): Unstable_ComposerInputHistor
|
|
|
71
71
|
const browseRef = useRef<BrowseState | null>(null);
|
|
72
72
|
|
|
73
73
|
useEffect(() => {
|
|
74
|
-
if (aui.composer.getState().type !== "thread"
|
|
74
|
+
if (aui.composer.getState().type !== "thread" || !aui.optional.threads)
|
|
75
|
+
return undefined;
|
|
75
76
|
|
|
76
77
|
return aui.on("threads.selectionChanged", () => {
|
|
77
78
|
browseRef.current = null;
|
|
@@ -97,7 +98,7 @@ export function unstable_useComposerInputHistory(): Unstable_ComposerInputHistor
|
|
|
97
98
|
const browse = browseRef.current;
|
|
98
99
|
|
|
99
100
|
const commitText = (text: string): void => {
|
|
100
|
-
flushTapSync(() => aui.composer.setText(text));
|
|
101
|
+
flushTapSync(() => aui.composer.setText(text, { origin: "recall" }));
|
|
101
102
|
// React's controlled-value commit restores the pre-recall caret;
|
|
102
103
|
// reposition after the commit, before paint.
|
|
103
104
|
requestAnimationFrame(() => {
|
|
@@ -243,6 +243,50 @@ describe("unstable_useLiveCompletionAdapter", () => {
|
|
|
243
243
|
expect(result.current.isLoading).toBe(false);
|
|
244
244
|
});
|
|
245
245
|
|
|
246
|
+
it.each(["queued", "debounced"] as const)(
|
|
247
|
+
"cancels a %s search when disabled and allows searching after re-enabling",
|
|
248
|
+
async (phase) => {
|
|
249
|
+
const fetcher = vi.fn(async () => [item("alice")]);
|
|
250
|
+
const { result, rerender } = renderHook(
|
|
251
|
+
({ enabled }) =>
|
|
252
|
+
unstable_useLiveCompletionAdapter({
|
|
253
|
+
fetcher,
|
|
254
|
+
enabled,
|
|
255
|
+
debounceMs: 50,
|
|
256
|
+
}),
|
|
257
|
+
{ initialProps: { enabled: true } },
|
|
258
|
+
);
|
|
259
|
+
|
|
260
|
+
if (phase === "debounced") {
|
|
261
|
+
await act(async () => {
|
|
262
|
+
result.current.adapter.search!("alice");
|
|
263
|
+
});
|
|
264
|
+
rerender({ enabled: false });
|
|
265
|
+
} else {
|
|
266
|
+
act(() => {
|
|
267
|
+
result.current.adapter.search!("alice");
|
|
268
|
+
rerender({ enabled: false });
|
|
269
|
+
});
|
|
270
|
+
}
|
|
271
|
+
await act(async () => {
|
|
272
|
+
await vi.advanceTimersByTimeAsync(50);
|
|
273
|
+
});
|
|
274
|
+
|
|
275
|
+
expect(fetcher).not.toHaveBeenCalled();
|
|
276
|
+
expect(result.current.adapter.search!("alice")).toEqual([]);
|
|
277
|
+
expect(result.current.isLoading).toBe(false);
|
|
278
|
+
|
|
279
|
+
rerender({ enabled: true });
|
|
280
|
+
await act(async () => {
|
|
281
|
+
result.current.adapter.search!("alice");
|
|
282
|
+
await vi.advanceTimersByTimeAsync(50);
|
|
283
|
+
});
|
|
284
|
+
expect(fetcher).toHaveBeenCalledExactlyOnceWith("alice");
|
|
285
|
+
expect(result.current.adapter.search!("alice")).toEqual([item("alice")]);
|
|
286
|
+
expect(result.current.isLoading).toBe(false);
|
|
287
|
+
},
|
|
288
|
+
);
|
|
289
|
+
|
|
246
290
|
it("drops a stale in-flight result when the query changes", async () => {
|
|
247
291
|
const resolvers: Record<
|
|
248
292
|
string,
|
|
@@ -192,10 +192,11 @@ export function unstable_useLiveCompletionAdapter(
|
|
|
192
192
|
categories: () => [],
|
|
193
193
|
categoryItems: () => [],
|
|
194
194
|
search: (query: string) => {
|
|
195
|
+
if (!enabled) return [];
|
|
195
196
|
// search() runs inside the popover's render; defer state updates with
|
|
196
197
|
// queueMicrotask so they are not dispatched while another component renders.
|
|
197
198
|
if (query !== state.query || retryableQueryRef.current === query) {
|
|
198
|
-
queueMicrotask(() =>
|
|
199
|
+
queueMicrotask(() => scheduleFetchRef.current(query));
|
|
199
200
|
} else {
|
|
200
201
|
queueMicrotask(() => {
|
|
201
202
|
if (
|
|
@@ -215,7 +216,7 @@ export function unstable_useLiveCompletionAdapter(
|
|
|
215
216
|
return state.items;
|
|
216
217
|
},
|
|
217
218
|
}),
|
|
218
|
-
[
|
|
219
|
+
[enabled, state, invalidatePending],
|
|
219
220
|
);
|
|
220
221
|
|
|
221
222
|
return { adapter, isLoading };
|
|
@@ -466,15 +466,25 @@ describe("toWebMcpTool cancellation", () => {
|
|
|
466
466
|
const caller = new AbortController();
|
|
467
467
|
const callerRemove = vi.spyOn(caller.signal, "removeEventListener");
|
|
468
468
|
const lifecycleRemove = vi.spyOn(lifecycle.signal, "removeEventListener");
|
|
469
|
+
const onAbort = vi.fn();
|
|
469
470
|
|
|
470
471
|
const result = await descriptorFor(
|
|
471
|
-
{
|
|
472
|
+
{
|
|
473
|
+
execute: async (_args, context) => {
|
|
474
|
+
context.abortSignal.addEventListener("abort", onAbort);
|
|
475
|
+
return "ok";
|
|
476
|
+
},
|
|
477
|
+
},
|
|
472
478
|
lifecycle.signal,
|
|
473
479
|
).execute({}, { signal: caller.signal });
|
|
474
480
|
|
|
475
481
|
expect(result).toEqual({ content: [text("ok")] });
|
|
476
482
|
expect(callerRemove).toHaveBeenCalledTimes(1);
|
|
477
483
|
expect(lifecycleRemove).toHaveBeenCalledTimes(1);
|
|
484
|
+
|
|
485
|
+
caller.abort();
|
|
486
|
+
lifecycle.abort();
|
|
487
|
+
expect(onAbort).not.toHaveBeenCalled();
|
|
478
488
|
});
|
|
479
489
|
|
|
480
490
|
it("merges a caller signal that is not a native AbortSignal", async () => {
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// @vitest-environment jsdom
|
|
2
|
+
|
|
3
|
+
import { act, cleanup, renderHook } from "@testing-library/react";
|
|
4
|
+
import { afterEach, expect, it, vi } from "vitest";
|
|
5
|
+
import { useMediaQuery } from "./useMediaQuery";
|
|
6
|
+
|
|
7
|
+
afterEach(() => {
|
|
8
|
+
cleanup();
|
|
9
|
+
vi.unstubAllGlobals();
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
it("updates when a media query changes after mounting", () => {
|
|
13
|
+
const media = Object.assign(new EventTarget(), {
|
|
14
|
+
matches: false,
|
|
15
|
+
media: "(prefers-reduced-motion: reduce)",
|
|
16
|
+
});
|
|
17
|
+
vi.stubGlobal(
|
|
18
|
+
"matchMedia",
|
|
19
|
+
vi.fn(() => media),
|
|
20
|
+
);
|
|
21
|
+
const { result } = renderHook(() => useMediaQuery(media.media));
|
|
22
|
+
expect(result.current).toBe(false);
|
|
23
|
+
|
|
24
|
+
act(() => {
|
|
25
|
+
media.matches = true;
|
|
26
|
+
media.dispatchEvent(new Event("change"));
|
|
27
|
+
});
|
|
28
|
+
expect(result.current).toBe(true);
|
|
29
|
+
|
|
30
|
+
act(() => {
|
|
31
|
+
media.matches = false;
|
|
32
|
+
media.dispatchEvent(new Event("change"));
|
|
33
|
+
});
|
|
34
|
+
expect(result.current).toBe(false);
|
|
35
|
+
});
|
|
@@ -163,17 +163,44 @@ describe("useSmooth", () => {
|
|
|
163
163
|
expect(result.current.status.type).toBe("running");
|
|
164
164
|
});
|
|
165
165
|
|
|
166
|
-
it(
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
166
|
+
it.each([
|
|
167
|
+
{ name: "negative drain time", options: { drainMs: -1 } },
|
|
168
|
+
{ name: "NaN character interval", options: { maxCharIntervalMs: NaN } },
|
|
169
|
+
{ name: "zero frame cap", options: { maxCharsPerFrame: 0 } },
|
|
170
|
+
])("uses default animation timing for $name", ({ options }) => {
|
|
171
|
+
const frames = new Map<number, FrameRequestCallback>();
|
|
172
|
+
let nextFrame = 0;
|
|
173
|
+
vi.spyOn(globalThis, "requestAnimationFrame").mockImplementation(
|
|
174
|
+
(callback) => {
|
|
175
|
+
const id = ++nextFrame;
|
|
176
|
+
frames.set(id, callback);
|
|
177
|
+
return id;
|
|
178
|
+
},
|
|
174
179
|
);
|
|
175
|
-
|
|
176
|
-
|
|
180
|
+
vi.spyOn(globalThis, "cancelAnimationFrame").mockImplementation((id) => {
|
|
181
|
+
frames.delete(id);
|
|
182
|
+
});
|
|
183
|
+
let now = 0;
|
|
184
|
+
vi.spyOn(performance, "now").mockImplementation(() => now);
|
|
185
|
+
const frame = (time: number) => {
|
|
186
|
+
now = time;
|
|
187
|
+
const queued = [...frames.values()];
|
|
188
|
+
frames.clear();
|
|
189
|
+
act(() => queued.forEach((callback) => callback(now)));
|
|
190
|
+
};
|
|
191
|
+
|
|
192
|
+
const { result, unmount } = renderHook(() =>
|
|
193
|
+
useSmooth(runningState("hello"), options),
|
|
194
|
+
);
|
|
195
|
+
try {
|
|
196
|
+
expect(result.current.text).toBe("");
|
|
197
|
+
frame(16);
|
|
198
|
+
expect(result.current.text).toBe("hel");
|
|
199
|
+
frame(32);
|
|
200
|
+
expect(result.current.text).toBe("hello");
|
|
201
|
+
} finally {
|
|
202
|
+
unmount();
|
|
203
|
+
}
|
|
177
204
|
});
|
|
178
205
|
|
|
179
206
|
it("accepts a SmoothOptions object as the enabled form", () => {
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ChainOfThoughtPartByIndexProvider.d.ts","sourceRoot":"","sources":["../../../src/context/providers/ChainOfThoughtPartByIndexProvider.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,iCAAiC,EAAE,MAAM,0BAA0B,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"RuntimeAdapter.d.ts","sourceRoot":"","sources":["../../src/legacy-runtime/RuntimeAdapter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC"}
|