@assistant-ui/react 0.14.26 → 0.14.27
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/README.md +1 -1
- package/dist/augmentations.d.ts.map +1 -1
- package/dist/client/ExternalThread.d.ts +6 -4
- package/dist/client/ExternalThread.d.ts.map +1 -1
- package/dist/client/ExternalThread.js +2 -1
- package/dist/client/ExternalThread.js.map +1 -1
- package/dist/client/InMemoryThreadList.d.ts +0 -1
- package/dist/client/InMemoryThreadList.d.ts.map +1 -1
- package/dist/client/InMemoryThreadList.js +4 -1
- package/dist/client/InMemoryThreadList.js.map +1 -1
- package/dist/client/SingleThreadList.d.ts +0 -1
- package/dist/client/SingleThreadList.d.ts.map +1 -1
- package/dist/context/ReadonlyStore.d.ts +0 -1
- package/dist/context/ReadonlyStore.d.ts.map +1 -1
- package/dist/context/providers/MessageProvider.d.ts +0 -1
- package/dist/context/providers/MessageProvider.d.ts.map +1 -1
- package/dist/context/providers/ThreadViewportProvider.d.ts +0 -1
- package/dist/context/providers/ThreadViewportProvider.d.ts.map +1 -1
- package/dist/context/react/ThreadViewportContext.d.ts +15 -16
- package/dist/context/react/ThreadViewportContext.d.ts.map +1 -1
- package/dist/context/react/utils/createContextHook.d.ts +0 -1
- package/dist/context/react/utils/createContextHook.d.ts.map +1 -1
- package/dist/context/react/utils/createContextStoreHook.d.ts +2 -3
- package/dist/context/react/utils/createContextStoreHook.d.ts.map +1 -1
- package/dist/context/react/utils/createStateHookForRuntime.d.ts +0 -1
- package/dist/context/react/utils/createStateHookForRuntime.d.ts.map +1 -1
- package/dist/context/react/utils/ensureBinding.d.ts.map +1 -1
- package/dist/context/react/utils/useRuntimeState.d.ts +0 -1
- package/dist/context/react/utils/useRuntimeState.d.ts.map +1 -1
- package/dist/context/stores/ThreadViewport.d.ts +25 -15
- package/dist/context/stores/ThreadViewport.d.ts.map +1 -1
- package/dist/devtools/DevToolsHooks.d.ts +0 -1
- package/dist/devtools/DevToolsHooks.d.ts.map +1 -1
- package/dist/hooks/useMessageQuote.d.ts +0 -1
- package/dist/hooks/useMessageQuote.d.ts.map +1 -1
- package/dist/hooks/useMessageTiming.d.ts +0 -1
- package/dist/hooks/useMessageTiming.d.ts.map +1 -1
- package/dist/hooks/useToolCallElapsed.d.ts.map +1 -1
- package/dist/index.d.ts +5 -3
- package/dist/internal.d.ts +0 -2
- package/dist/legacy-runtime/AssistantRuntimeProvider.d.ts +0 -1
- package/dist/legacy-runtime/AssistantRuntimeProvider.d.ts.map +1 -1
- package/dist/legacy-runtime/cloud/auiV0.d.ts +11 -2
- package/dist/legacy-runtime/cloud/auiV0.d.ts.map +1 -1
- package/dist/legacy-runtime/cloud/auiV0.js +31 -2
- package/dist/legacy-runtime/cloud/auiV0.js.map +1 -1
- package/dist/legacy-runtime/cloud/useCloudThreadListRuntime.d.ts +1 -5
- package/dist/legacy-runtime/cloud/useCloudThreadListRuntime.d.ts.map +1 -1
- package/dist/legacy-runtime/hooks/AssistantContext.d.ts +0 -1
- package/dist/legacy-runtime/hooks/AssistantContext.d.ts.map +1 -1
- package/dist/legacy-runtime/hooks/AttachmentContext.d.ts +12 -13
- package/dist/legacy-runtime/hooks/AttachmentContext.d.ts.map +1 -1
- package/dist/legacy-runtime/hooks/ComposerContext.d.ts +0 -1
- package/dist/legacy-runtime/hooks/ComposerContext.d.ts.map +1 -1
- package/dist/legacy-runtime/hooks/MessageContext.d.ts +0 -1
- package/dist/legacy-runtime/hooks/MessageContext.d.ts.map +1 -1
- package/dist/legacy-runtime/hooks/MessagePartContext.d.ts +0 -1
- package/dist/legacy-runtime/hooks/MessagePartContext.d.ts.map +1 -1
- package/dist/legacy-runtime/hooks/ThreadContext.d.ts +0 -1
- package/dist/legacy-runtime/hooks/ThreadContext.d.ts.map +1 -1
- package/dist/legacy-runtime/hooks/ThreadListItemContext.d.ts +0 -1
- package/dist/legacy-runtime/hooks/ThreadListItemContext.d.ts.map +1 -1
- package/dist/legacy-runtime/runtime-cores/assistant-transport/commandQueue.d.ts +0 -1
- package/dist/legacy-runtime/runtime-cores/assistant-transport/commandQueue.d.ts.map +1 -1
- package/dist/legacy-runtime/runtime-cores/assistant-transport/replayBoundaryStream.d.ts +1 -4
- package/dist/legacy-runtime/runtime-cores/assistant-transport/replayBoundaryStream.d.ts.map +1 -1
- package/dist/legacy-runtime/runtime-cores/assistant-transport/runManager.d.ts.map +1 -1
- package/dist/legacy-runtime/runtime-cores/assistant-transport/types.d.ts +0 -1
- package/dist/legacy-runtime/runtime-cores/assistant-transport/types.d.ts.map +1 -1
- package/dist/legacy-runtime/runtime-cores/assistant-transport/useAssistantTransportRuntime.d.ts +0 -1
- package/dist/legacy-runtime/runtime-cores/assistant-transport/useAssistantTransportRuntime.d.ts.map +1 -1
- package/dist/legacy-runtime/runtime-cores/assistant-transport/useConvertedState.d.ts +0 -1
- package/dist/legacy-runtime/runtime-cores/assistant-transport/useConvertedState.d.ts.map +1 -1
- package/dist/legacy-runtime/runtime-cores/assistant-transport/useLatestRef.d.ts.map +1 -1
- package/dist/mcp-apps/McpAppRenderer.d.ts +12 -7
- package/dist/mcp-apps/McpAppRenderer.d.ts.map +1 -1
- package/dist/mcp-apps/McpAppRenderer.js +29 -7
- package/dist/mcp-apps/McpAppRenderer.js.map +1 -1
- package/dist/mcp-apps/McpAppsRemoteHost.d.ts +0 -1
- package/dist/mcp-apps/McpAppsRemoteHost.d.ts.map +1 -1
- package/dist/mcp-apps/McpAppsRemoteHost.js +32 -1
- package/dist/mcp-apps/McpAppsRemoteHost.js.map +1 -1
- package/dist/mcp-apps/app-frame.d.ts +1 -12
- package/dist/mcp-apps/app-frame.d.ts.map +1 -1
- package/dist/mcp-apps/app-frame.js +1 -1
- package/dist/mcp-apps/app-frame.js.map +1 -1
- package/dist/mcp-apps/bridge.d.ts +0 -1
- package/dist/mcp-apps/bridge.d.ts.map +1 -1
- package/dist/mcp-apps/bridge.js +4 -3
- package/dist/mcp-apps/bridge.js.map +1 -1
- package/dist/mcp-apps/types.d.ts +10 -7
- package/dist/mcp-apps/types.d.ts.map +1 -1
- package/dist/mcp-apps/types.js.map +1 -1
- package/dist/mcp-apps/utils.d.ts +0 -1
- package/dist/mcp-apps/utils.d.ts.map +1 -1
- package/dist/model-context/frame/useAssistantFrameHost.d.ts +1 -6
- package/dist/model-context/frame/useAssistantFrameHost.d.ts.map +1 -1
- package/dist/model-context/makeAssistantVisible.d.ts +0 -1
- package/dist/model-context/makeAssistantVisible.d.ts.map +1 -1
- package/dist/primitives/actionBar/ActionBarCopy.d.ts +1 -4
- package/dist/primitives/actionBar/ActionBarCopy.d.ts.map +1 -1
- package/dist/primitives/actionBar/ActionBarEdit.d.ts +0 -1
- package/dist/primitives/actionBar/ActionBarEdit.d.ts.map +1 -1
- package/dist/primitives/actionBar/ActionBarExportMarkdown.d.ts +1 -5
- package/dist/primitives/actionBar/ActionBarExportMarkdown.d.ts.map +1 -1
- package/dist/primitives/actionBar/ActionBarFeedbackNegative.d.ts +0 -1
- package/dist/primitives/actionBar/ActionBarFeedbackNegative.d.ts.map +1 -1
- package/dist/primitives/actionBar/ActionBarFeedbackPositive.d.ts +0 -1
- package/dist/primitives/actionBar/ActionBarFeedbackPositive.d.ts.map +1 -1
- package/dist/primitives/actionBar/ActionBarInteractionContext.d.ts.map +1 -1
- package/dist/primitives/actionBar/ActionBarReload.d.ts +0 -1
- package/dist/primitives/actionBar/ActionBarReload.d.ts.map +1 -1
- package/dist/primitives/actionBar/ActionBarRoot.d.ts +0 -1
- package/dist/primitives/actionBar/ActionBarRoot.d.ts.map +1 -1
- package/dist/primitives/actionBar/ActionBarSpeak.d.ts +0 -1
- package/dist/primitives/actionBar/ActionBarSpeak.d.ts.map +1 -1
- package/dist/primitives/actionBar/ActionBarStopSpeaking.d.ts +0 -1
- package/dist/primitives/actionBar/ActionBarStopSpeaking.d.ts.map +1 -1
- package/dist/primitives/actionBar/useActionBarFloatStatus.d.ts +1 -6
- package/dist/primitives/actionBar/useActionBarFloatStatus.d.ts.map +1 -1
- package/dist/primitives/actionBar.d.ts +0 -2
- package/dist/primitives/actionBarMore/ActionBarMoreContent.d.ts +0 -1
- package/dist/primitives/actionBarMore/ActionBarMoreContent.d.ts.map +1 -1
- package/dist/primitives/actionBarMore/ActionBarMoreItem.d.ts +0 -1
- package/dist/primitives/actionBarMore/ActionBarMoreItem.d.ts.map +1 -1
- package/dist/primitives/actionBarMore/ActionBarMoreRoot.d.ts +0 -1
- package/dist/primitives/actionBarMore/ActionBarMoreRoot.d.ts.map +1 -1
- package/dist/primitives/actionBarMore/ActionBarMoreSeparator.d.ts +0 -1
- package/dist/primitives/actionBarMore/ActionBarMoreSeparator.d.ts.map +1 -1
- package/dist/primitives/actionBarMore/ActionBarMoreTrigger.d.ts +0 -1
- package/dist/primitives/actionBarMore/ActionBarMoreTrigger.d.ts.map +1 -1
- package/dist/primitives/actionBarMore/scope.d.ts +0 -1
- package/dist/primitives/actionBarMore/scope.d.ts.map +1 -1
- package/dist/primitives/actionBarMore.d.ts +0 -2
- package/dist/primitives/assistantModal/AssistantModalAnchor.d.ts +6 -4
- package/dist/primitives/assistantModal/AssistantModalAnchor.d.ts.map +1 -1
- package/dist/primitives/assistantModal/AssistantModalAnchor.js +2 -2
- package/dist/primitives/assistantModal/AssistantModalAnchor.js.map +1 -1
- package/dist/primitives/assistantModal/AssistantModalContent.d.ts +4 -2
- 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/assistantModal/AssistantModalRoot.d.ts +0 -1
- package/dist/primitives/assistantModal/AssistantModalRoot.d.ts.map +1 -1
- package/dist/primitives/assistantModal/AssistantModalTrigger.d.ts +6 -4
- package/dist/primitives/assistantModal/AssistantModalTrigger.d.ts.map +1 -1
- package/dist/primitives/assistantModal/AssistantModalTrigger.js +2 -2
- package/dist/primitives/assistantModal/AssistantModalTrigger.js.map +1 -1
- package/dist/primitives/assistantModal/popoverRenderPrimitives.d.ts +14 -0
- package/dist/primitives/assistantModal/popoverRenderPrimitives.d.ts.map +1 -0
- package/dist/primitives/assistantModal/popoverRenderPrimitives.js +10 -0
- package/dist/primitives/assistantModal/popoverRenderPrimitives.js.map +1 -0
- package/dist/primitives/assistantModal/scope.d.ts +0 -1
- package/dist/primitives/assistantModal/scope.d.ts.map +1 -1
- package/dist/primitives/assistantModal.d.ts +0 -2
- package/dist/primitives/attachment/AttachmentName.d.ts +0 -1
- package/dist/primitives/attachment/AttachmentName.d.ts.map +1 -1
- package/dist/primitives/attachment/AttachmentRemove.d.ts +0 -1
- package/dist/primitives/attachment/AttachmentRemove.d.ts.map +1 -1
- package/dist/primitives/attachment/AttachmentRoot.d.ts +0 -1
- package/dist/primitives/attachment/AttachmentRoot.d.ts.map +1 -1
- package/dist/primitives/attachment/AttachmentThumb.d.ts +0 -1
- package/dist/primitives/attachment/AttachmentThumb.d.ts.map +1 -1
- package/dist/primitives/attachment.d.ts +0 -2
- package/dist/primitives/branchPicker/BranchPickerCount.d.ts +0 -1
- package/dist/primitives/branchPicker/BranchPickerCount.d.ts.map +1 -1
- package/dist/primitives/branchPicker/BranchPickerNext.d.ts +0 -1
- package/dist/primitives/branchPicker/BranchPickerNext.d.ts.map +1 -1
- package/dist/primitives/branchPicker/BranchPickerNumber.d.ts +0 -1
- package/dist/primitives/branchPicker/BranchPickerNumber.d.ts.map +1 -1
- package/dist/primitives/branchPicker/BranchPickerPrevious.d.ts +0 -1
- package/dist/primitives/branchPicker/BranchPickerPrevious.d.ts.map +1 -1
- package/dist/primitives/branchPicker/BranchPickerRoot.d.ts +0 -1
- package/dist/primitives/branchPicker/BranchPickerRoot.d.ts.map +1 -1
- package/dist/primitives/branchPicker.d.ts +0 -2
- package/dist/primitives/chainOfThought/ChainOfThoughtAccordionTrigger.d.ts +0 -1
- package/dist/primitives/chainOfThought/ChainOfThoughtAccordionTrigger.d.ts.map +1 -1
- package/dist/primitives/chainOfThought/ChainOfThoughtRoot.d.ts +0 -1
- package/dist/primitives/chainOfThought/ChainOfThoughtRoot.d.ts.map +1 -1
- package/dist/primitives/chainOfThought.d.ts +0 -2
- package/dist/primitives/composer/ComposerAddAttachment.d.ts +5 -6
- package/dist/primitives/composer/ComposerAddAttachment.d.ts.map +1 -1
- package/dist/primitives/composer/ComposerAttachmentDropzone.d.ts +0 -1
- package/dist/primitives/composer/ComposerAttachmentDropzone.d.ts.map +1 -1
- package/dist/primitives/composer/ComposerCancel.d.ts +0 -1
- package/dist/primitives/composer/ComposerCancel.d.ts.map +1 -1
- package/dist/primitives/composer/ComposerCompactContext.d.ts +9 -0
- package/dist/primitives/composer/ComposerCompactContext.d.ts.map +1 -0
- package/dist/primitives/composer/ComposerCompactContext.js +11 -0
- package/dist/primitives/composer/ComposerCompactContext.js.map +1 -0
- package/dist/primitives/composer/ComposerDictate.d.ts +0 -1
- package/dist/primitives/composer/ComposerDictate.d.ts.map +1 -1
- package/dist/primitives/composer/ComposerDictationTranscript.d.ts +0 -1
- package/dist/primitives/composer/ComposerDictationTranscript.d.ts.map +1 -1
- package/dist/primitives/composer/ComposerInput.d.ts +0 -1
- package/dist/primitives/composer/ComposerInput.d.ts.map +1 -1
- package/dist/primitives/composer/ComposerInput.js +17 -2
- package/dist/primitives/composer/ComposerInput.js.map +1 -1
- package/dist/primitives/composer/ComposerInputPluginContext.d.ts +4 -3
- package/dist/primitives/composer/ComposerInputPluginContext.d.ts.map +1 -1
- package/dist/primitives/composer/ComposerQuote.d.ts +0 -1
- package/dist/primitives/composer/ComposerQuote.d.ts.map +1 -1
- package/dist/primitives/composer/ComposerRoot.d.ts +22 -3
- package/dist/primitives/composer/ComposerRoot.d.ts.map +1 -1
- package/dist/primitives/composer/ComposerRoot.js +63 -30
- package/dist/primitives/composer/ComposerRoot.js.map +1 -1
- package/dist/primitives/composer/ComposerSend.d.ts +0 -1
- package/dist/primitives/composer/ComposerSend.d.ts.map +1 -1
- package/dist/primitives/composer/ComposerStopDictation.d.ts +0 -1
- package/dist/primitives/composer/ComposerStopDictation.d.ts.map +1 -1
- package/dist/primitives/composer/trigger/TriggerPopover.d.ts +10 -5
- package/dist/primitives/composer/trigger/TriggerPopover.d.ts.map +1 -1
- package/dist/primitives/composer/trigger/TriggerPopoverAction.d.ts +5 -3
- package/dist/primitives/composer/trigger/TriggerPopoverAction.d.ts.map +1 -1
- package/dist/primitives/composer/trigger/TriggerPopoverAction.js +3 -2
- package/dist/primitives/composer/trigger/TriggerPopoverAction.js.map +1 -1
- package/dist/primitives/composer/trigger/TriggerPopoverBack.d.ts +0 -1
- package/dist/primitives/composer/trigger/TriggerPopoverBack.d.ts.map +1 -1
- package/dist/primitives/composer/trigger/TriggerPopoverCategories.d.ts +0 -1
- package/dist/primitives/composer/trigger/TriggerPopoverCategories.d.ts.map +1 -1
- package/dist/primitives/composer/trigger/TriggerPopoverDirective.d.ts +3 -2
- package/dist/primitives/composer/trigger/TriggerPopoverDirective.d.ts.map +1 -1
- package/dist/primitives/composer/trigger/TriggerPopoverItems.d.ts +0 -1
- package/dist/primitives/composer/trigger/TriggerPopoverItems.d.ts.map +1 -1
- package/dist/primitives/composer/trigger/TriggerPopoverResource.d.ts +10 -6
- package/dist/primitives/composer/trigger/TriggerPopoverResource.d.ts.map +1 -1
- package/dist/primitives/composer/trigger/TriggerPopoverRootContext.d.ts +8 -5
- package/dist/primitives/composer/trigger/TriggerPopoverRootContext.d.ts.map +1 -1
- package/dist/primitives/composer/trigger/index.d.ts +0 -1
- package/dist/primitives/composer/trigger/index.d.ts.map +1 -1
- package/dist/primitives/composer/trigger/triggerDetectionResource.d.ts +5 -2
- package/dist/primitives/composer/trigger/triggerDetectionResource.d.ts.map +1 -1
- package/dist/primitives/composer/trigger/triggerKeyboardResource.d.ts +7 -4
- package/dist/primitives/composer/trigger/triggerKeyboardResource.d.ts.map +1 -1
- package/dist/primitives/composer/trigger/triggerNavigationResource.d.ts +13 -7
- package/dist/primitives/composer/trigger/triggerNavigationResource.d.ts.map +1 -1
- package/dist/primitives/composer/trigger/triggerSelectionResource.d.ts +7 -4
- package/dist/primitives/composer/trigger/triggerSelectionResource.d.ts.map +1 -1
- package/dist/primitives/composer/useComposerInputState.d.ts.map +1 -1
- package/dist/primitives/composer.d.ts +0 -2
- package/dist/primitives/dropdownMenuRenderPrimitives.d.ts +0 -1
- package/dist/primitives/dropdownMenuRenderPrimitives.d.ts.map +1 -1
- package/dist/primitives/error/ErrorMessage.d.ts +0 -1
- package/dist/primitives/error/ErrorMessage.d.ts.map +1 -1
- package/dist/primitives/error/ErrorRoot.d.ts +0 -1
- package/dist/primitives/error/ErrorRoot.d.ts.map +1 -1
- package/dist/primitives/error.d.ts +0 -2
- package/dist/primitives/message/MessageError.d.ts +0 -1
- package/dist/primitives/message/MessageError.d.ts.map +1 -1
- package/dist/primitives/message/MessageIf.d.ts +0 -1
- package/dist/primitives/message/MessageIf.d.ts.map +1 -1
- package/dist/primitives/message/MessageParts.d.ts +0 -1
- package/dist/primitives/message/MessageParts.d.ts.map +1 -1
- package/dist/primitives/message/MessagePartsGrouped.d.ts +25 -12
- package/dist/primitives/message/MessagePartsGrouped.d.ts.map +1 -1
- package/dist/primitives/message/MessageRoot.d.ts +0 -1
- package/dist/primitives/message/MessageRoot.d.ts.map +1 -1
- package/dist/primitives/message.d.ts +0 -2
- package/dist/primitives/messagePart/MessagePartImage.d.ts +0 -1
- package/dist/primitives/messagePart/MessagePartImage.d.ts.map +1 -1
- package/dist/primitives/messagePart/MessagePartText.d.ts +0 -1
- package/dist/primitives/messagePart/MessagePartText.d.ts.map +1 -1
- package/dist/primitives/messagePart/useMessagePartData.d.ts +0 -1
- package/dist/primitives/messagePart/useMessagePartData.d.ts.map +1 -1
- package/dist/primitives/messagePart/useMessagePartFile.d.ts +0 -1
- package/dist/primitives/messagePart/useMessagePartFile.d.ts.map +1 -1
- package/dist/primitives/messagePart/useMessagePartImage.d.ts +0 -1
- package/dist/primitives/messagePart/useMessagePartImage.d.ts.map +1 -1
- package/dist/primitives/messagePart/useMessagePartReasoning.d.ts +0 -1
- package/dist/primitives/messagePart/useMessagePartReasoning.d.ts.map +1 -1
- package/dist/primitives/messagePart/useMessagePartSource.d.ts.map +1 -1
- package/dist/primitives/messagePart/useMessagePartText.d.ts +0 -1
- package/dist/primitives/messagePart/useMessagePartText.d.ts.map +1 -1
- package/dist/primitives/messagePart.d.ts +0 -2
- package/dist/primitives/queueItem/QueueItemRemove.d.ts +0 -1
- package/dist/primitives/queueItem/QueueItemRemove.d.ts.map +1 -1
- package/dist/primitives/queueItem/QueueItemSteer.d.ts +0 -1
- package/dist/primitives/queueItem/QueueItemSteer.d.ts.map +1 -1
- package/dist/primitives/queueItem/QueueItemText.d.ts +0 -1
- package/dist/primitives/queueItem/QueueItemText.d.ts.map +1 -1
- package/dist/primitives/queueItem.d.ts +0 -2
- package/dist/primitives/reasoning/useScrollLock.d.ts +0 -1
- package/dist/primitives/reasoning/useScrollLock.d.ts.map +1 -1
- package/dist/primitives/selectionToolbar/SelectionToolbarQuote.d.ts +0 -1
- package/dist/primitives/selectionToolbar/SelectionToolbarQuote.d.ts.map +1 -1
- package/dist/primitives/selectionToolbar/SelectionToolbarRoot.d.ts +0 -1
- package/dist/primitives/selectionToolbar/SelectionToolbarRoot.d.ts.map +1 -1
- package/dist/primitives/selectionToolbar/SelectionToolbarRoot.js +2 -1
- package/dist/primitives/selectionToolbar/SelectionToolbarRoot.js.map +1 -1
- package/dist/primitives/selectionToolbar.d.ts +0 -2
- package/dist/primitives/suggestion/SuggestionDescription.d.ts +0 -1
- package/dist/primitives/suggestion/SuggestionDescription.d.ts.map +1 -1
- package/dist/primitives/suggestion/SuggestionTitle.d.ts +0 -1
- package/dist/primitives/suggestion/SuggestionTitle.d.ts.map +1 -1
- package/dist/primitives/suggestion/SuggestionTrigger.d.ts +1 -5
- package/dist/primitives/suggestion/SuggestionTrigger.d.ts.map +1 -1
- package/dist/primitives/suggestion.d.ts +0 -2
- package/dist/primitives/thread/ThreadEmpty.d.ts +0 -1
- package/dist/primitives/thread/ThreadEmpty.d.ts.map +1 -1
- package/dist/primitives/thread/ThreadIf.d.ts +0 -1
- package/dist/primitives/thread/ThreadIf.d.ts.map +1 -1
- package/dist/primitives/thread/ThreadRoot.d.ts +0 -1
- package/dist/primitives/thread/ThreadRoot.d.ts.map +1 -1
- package/dist/primitives/thread/ThreadScrollToBottom.d.ts +1 -4
- package/dist/primitives/thread/ThreadScrollToBottom.d.ts.map +1 -1
- package/dist/primitives/thread/ThreadSuggestion.d.ts +13 -14
- package/dist/primitives/thread/ThreadSuggestion.d.ts.map +1 -1
- package/dist/primitives/thread/ThreadViewport.d.ts +0 -1
- package/dist/primitives/thread/ThreadViewport.d.ts.map +1 -1
- package/dist/primitives/thread/ThreadViewportFooter.d.ts +0 -1
- package/dist/primitives/thread/ThreadViewportFooter.d.ts.map +1 -1
- package/dist/primitives/thread/topAnchor/computeTopAnchorSlack.d.ts +2 -11
- package/dist/primitives/thread/topAnchor/computeTopAnchorSlack.d.ts.map +1 -1
- package/dist/primitives/thread/topAnchor/createReserveObservers.d.ts.map +1 -1
- package/dist/primitives/thread/topAnchor/mountTopAnchorReserve.d.ts.map +1 -1
- package/dist/primitives/thread/topAnchor/topAnchorTurn.d.ts +1 -4
- package/dist/primitives/thread/topAnchor/topAnchorTurn.d.ts.map +1 -1
- package/dist/primitives/thread/topAnchor/topAnchorUtils.d.ts.map +1 -1
- package/dist/primitives/thread/topAnchor/useTopAnchorReserve.d.ts.map +1 -1
- package/dist/primitives/thread/useThreadViewportAutoScroll.d.ts +1 -7
- package/dist/primitives/thread/useThreadViewportAutoScroll.d.ts.map +1 -1
- package/dist/primitives/thread.d.ts +0 -2
- package/dist/primitives/threadList/ThreadListLoadMore.d.ts +0 -1
- package/dist/primitives/threadList/ThreadListLoadMore.d.ts.map +1 -1
- package/dist/primitives/threadList/ThreadListNew.d.ts +0 -1
- package/dist/primitives/threadList/ThreadListNew.d.ts.map +1 -1
- package/dist/primitives/threadList/ThreadListRoot.d.ts +0 -1
- package/dist/primitives/threadList/ThreadListRoot.d.ts.map +1 -1
- package/dist/primitives/threadList.d.ts +0 -2
- package/dist/primitives/threadListFocusGroup.d.ts +0 -1
- package/dist/primitives/threadListFocusGroup.d.ts.map +1 -1
- package/dist/primitives/threadListItem/ThreadListItemArchive.d.ts +0 -1
- package/dist/primitives/threadListItem/ThreadListItemArchive.d.ts.map +1 -1
- package/dist/primitives/threadListItem/ThreadListItemDelete.d.ts +0 -1
- package/dist/primitives/threadListItem/ThreadListItemDelete.d.ts.map +1 -1
- package/dist/primitives/threadListItem/ThreadListItemRoot.d.ts +0 -1
- package/dist/primitives/threadListItem/ThreadListItemRoot.d.ts.map +1 -1
- package/dist/primitives/threadListItem/ThreadListItemTrigger.d.ts +0 -1
- package/dist/primitives/threadListItem/ThreadListItemTrigger.d.ts.map +1 -1
- package/dist/primitives/threadListItem/ThreadListItemUnarchive.d.ts +0 -1
- package/dist/primitives/threadListItem/ThreadListItemUnarchive.d.ts.map +1 -1
- package/dist/primitives/threadListItem.d.ts +0 -2
- package/dist/primitives/threadListItemMore/ThreadListItemMoreContent.d.ts +0 -1
- package/dist/primitives/threadListItemMore/ThreadListItemMoreContent.d.ts.map +1 -1
- package/dist/primitives/threadListItemMore/ThreadListItemMoreItem.d.ts +0 -1
- package/dist/primitives/threadListItemMore/ThreadListItemMoreItem.d.ts.map +1 -1
- package/dist/primitives/threadListItemMore/ThreadListItemMoreRoot.d.ts +0 -1
- package/dist/primitives/threadListItemMore/ThreadListItemMoreRoot.d.ts.map +1 -1
- package/dist/primitives/threadListItemMore/ThreadListItemMoreSeparator.d.ts +0 -1
- package/dist/primitives/threadListItemMore/ThreadListItemMoreSeparator.d.ts.map +1 -1
- package/dist/primitives/threadListItemMore/ThreadListItemMoreTrigger.d.ts +0 -1
- package/dist/primitives/threadListItemMore/ThreadListItemMoreTrigger.d.ts.map +1 -1
- package/dist/primitives/threadListItemMore/scope.d.ts +0 -1
- package/dist/primitives/threadListItemMore/scope.d.ts.map +1 -1
- package/dist/primitives/threadListItemMore.d.ts +0 -2
- package/dist/sandbox-host/SandboxHost.d.ts +1 -10
- package/dist/sandbox-host/SandboxHost.d.ts.map +1 -1
- package/dist/tests/remote-thread-list-test-helpers.d.ts +0 -1
- package/dist/tests/remote-thread-list-test-helpers.d.ts.map +1 -1
- package/dist/unstable/useComposerInput.d.ts +2 -2
- package/dist/unstable/useComposerInput.d.ts.map +1 -1
- package/dist/unstable/useComposerInputHistory.d.ts +2 -2
- package/dist/unstable/useComposerInputHistory.d.ts.map +1 -1
- package/dist/unstable/useLiveCompletionAdapter.d.ts +4 -3
- package/dist/unstable/useLiveCompletionAdapter.d.ts.map +1 -1
- package/dist/unstable/useMentionAdapter.d.ts +19 -10
- package/dist/unstable/useMentionAdapter.d.ts.map +1 -1
- package/dist/unstable/useMessageStallDetection.d.ts +3 -1
- package/dist/unstable/useMessageStallDetection.d.ts.map +1 -1
- package/dist/unstable/useSlashCommandAdapter.d.ts +6 -4
- package/dist/unstable/useSlashCommandAdapter.d.ts.map +1 -1
- package/dist/utils/Primitive.d.ts +0 -1
- package/dist/utils/Primitive.d.ts.map +1 -1
- package/dist/utils/RequireAtLeastOne.d.ts +1 -1
- package/dist/utils/RequireAtLeastOne.d.ts.map +1 -1
- package/dist/utils/createActionButton.d.ts +0 -1
- package/dist/utils/createActionButton.d.ts.map +1 -1
- package/dist/utils/getSelectionMessageId.d.ts.map +1 -1
- package/dist/utils/getSelectionMessageId.js +32 -7
- package/dist/utils/getSelectionMessageId.js.map +1 -1
- package/dist/utils/hooks/useManagedRef.d.ts.map +1 -1
- package/dist/utils/hooks/useMediaQuery.d.ts.map +1 -1
- package/dist/utils/hooks/useOnResizeContent.d.ts.map +1 -1
- package/dist/utils/hooks/useOnScrollToBottom.d.ts.map +1 -1
- package/dist/utils/hooks/useSizeHandle.d.ts +0 -1
- package/dist/utils/hooks/useSizeHandle.d.ts.map +1 -1
- package/dist/utils/smooth/SmoothContext.d.ts +71 -72
- package/dist/utils/smooth/SmoothContext.d.ts.map +1 -1
- package/dist/utils/smooth/useSmooth.d.ts +0 -1
- package/dist/utils/smooth/useSmooth.d.ts.map +1 -1
- package/dist/utils/useToolArgsFieldStatus.d.ts +2 -2
- package/dist/utils/useToolArgsFieldStatus.d.ts.map +1 -1
- package/package.json +18 -18
- package/src/index.ts +3 -0
- package/src/legacy-runtime/cloud/auiV0.ts +72 -3
- package/src/mcp-apps/McpAppRenderer.test.tsx +141 -0
- package/src/mcp-apps/McpAppRenderer.tsx +48 -10
- package/src/mcp-apps/McpAppsRemoteHost.test.ts +126 -0
- package/src/mcp-apps/McpAppsRemoteHost.ts +40 -1
- package/src/mcp-apps/app-frame.tsx +3 -1
- package/src/mcp-apps/bridge.ts +1 -1
- package/src/mcp-apps/types.ts +16 -8
- package/src/primitives/assistantModal/AssistantModalAnchor.tsx +6 -8
- package/src/primitives/assistantModal/AssistantModalContent.tsx +5 -5
- package/src/primitives/assistantModal/AssistantModalTrigger.test.tsx +80 -0
- package/src/primitives/assistantModal/AssistantModalTrigger.tsx +6 -8
- package/src/primitives/assistantModal/popoverRenderPrimitives.ts +6 -0
- package/src/primitives/composer/ComposerCompactContext.tsx +13 -0
- package/src/primitives/composer/ComposerInput.tsx +35 -0
- package/src/primitives/composer/ComposerRoot.test.tsx +161 -0
- package/src/primitives/composer/ComposerRoot.tsx +37 -7
- package/src/tests/LocalThreadRuntimeCore.test.ts +4 -1
- package/src/tests/auiV0Encode.test.ts +134 -1
- package/src/utils/getSelectionMessageId.test.ts +175 -0
- package/src/utils/getSelectionMessageId.ts +57 -6
- package/dist/utils/json/is-json-equal.d.ts +0 -5
- package/dist/utils/json/is-json-equal.d.ts.map +0 -1
- package/dist/utils/json/is-json-equal.js +0 -26
- package/dist/utils/json/is-json-equal.js.map +0 -1
- package/dist/utils/json/is-json.d.ts +0 -10
- package/dist/utils/json/is-json.d.ts.map +0 -1
- package/dist/utils/json/is-json.js +0 -22
- package/dist/utils/json/is-json.js.map +0 -1
- package/src/utils/json/is-json-equal.ts +0 -48
- package/src/utils/json/is-json.ts +0 -58
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSmooth.d.ts","names":[],"sources":["../../../src/utils/smooth/useSmooth.ts"],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"useSmooth.d.ts","names":[],"sources":["../../../src/utils/smooth/useSmooth.ts"],"mappings":";;;;;KAkBY;;;;;;EAMV;;;;;;EAMA;;;;;EAKA;;;;;;;;EAQA;;;;;;;;;;;;;;;;;;;;;;cA0GW,YACX,OAAO,oBAAoB,kBAAkB,uBAC7C,mBAAkB,kBACjB,oBAAoB,kBAAkB"}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
//#region src/utils/useToolArgsFieldStatus.d.ts
|
|
2
2
|
declare const useToolArgsFieldStatus: (fieldPath: (string | number)[]) => {
|
|
3
|
-
type: string;
|
|
4
|
-
} | {
|
|
5
3
|
readonly type: "running";
|
|
6
4
|
} | {
|
|
7
5
|
readonly type: "complete";
|
|
@@ -9,6 +7,8 @@ declare const useToolArgsFieldStatus: (fieldPath: (string | number)[]) => {
|
|
|
9
7
|
readonly type: "incomplete";
|
|
10
8
|
readonly reason: "cancelled" | "length" | "content-filter" | "other" | "error";
|
|
11
9
|
readonly error?: unknown;
|
|
10
|
+
} | {
|
|
11
|
+
type: string;
|
|
12
12
|
};
|
|
13
13
|
//#endregion
|
|
14
14
|
export { useToolArgsFieldStatus };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useToolArgsFieldStatus.d.ts","names":[],"sources":["../../src/utils/useToolArgsFieldStatus.ts"],"mappings":";cAKa,
|
|
1
|
+
{"version":3,"file":"useToolArgsFieldStatus.d.ts","names":[],"sources":["../../src/utils/useToolArgsFieldStatus.ts"],"mappings":";cAKa,yBAA0B"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@assistant-ui/react",
|
|
3
|
-
"version": "0.14.
|
|
3
|
+
"version": "0.14.27",
|
|
4
4
|
"description": "Open-source TypeScript/React library for building production-grade AI chat experiences",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ai",
|
|
@@ -55,23 +55,23 @@
|
|
|
55
55
|
],
|
|
56
56
|
"sideEffects": false,
|
|
57
57
|
"dependencies": {
|
|
58
|
-
"@assistant-ui/core": "^0.2.
|
|
59
|
-
"@assistant-ui/store": "^0.2.
|
|
60
|
-
"@assistant-ui/tap": "^0.9.
|
|
61
|
-
"@radix-ui/primitive": "^1.1.
|
|
62
|
-
"@radix-ui/react-collection": "^1.1.
|
|
58
|
+
"@assistant-ui/core": "^0.2.21",
|
|
59
|
+
"@assistant-ui/store": "^0.2.20",
|
|
60
|
+
"@assistant-ui/tap": "^0.9.4",
|
|
61
|
+
"@radix-ui/primitive": "^1.1.5",
|
|
62
|
+
"@radix-ui/react-collection": "^1.1.12",
|
|
63
63
|
"@radix-ui/react-compose-refs": "^1.1.3",
|
|
64
|
-
"@radix-ui/react-context": "^1.
|
|
65
|
-
"@radix-ui/react-primitive": "^2.1.
|
|
64
|
+
"@radix-ui/react-context": "^1.2.0",
|
|
65
|
+
"@radix-ui/react-primitive": "^2.1.7",
|
|
66
66
|
"@radix-ui/react-use-callback-ref": "^1.1.2",
|
|
67
67
|
"@radix-ui/react-use-controllable-state": "^1.2.3",
|
|
68
|
-
"@radix-ui/react-use-escape-keydown": "^1.1.
|
|
69
|
-
"assistant-cloud": "^0.1.
|
|
70
|
-
"assistant-stream": "^0.3.
|
|
71
|
-
"nanoid": "^
|
|
72
|
-
"radix-ui": "^1.6.
|
|
68
|
+
"@radix-ui/react-use-escape-keydown": "^1.1.3",
|
|
69
|
+
"assistant-cloud": "^0.1.35",
|
|
70
|
+
"assistant-stream": "^0.3.26",
|
|
71
|
+
"nanoid": "^6.0.0",
|
|
72
|
+
"radix-ui": "^1.6.2",
|
|
73
73
|
"react-textarea-autosize": "^8.5.9",
|
|
74
|
-
"safe-content-frame": "^0.0.
|
|
74
|
+
"safe-content-frame": "^0.0.23",
|
|
75
75
|
"zod": "^4.4.3",
|
|
76
76
|
"zustand": "^5.0.14"
|
|
77
77
|
},
|
|
@@ -92,15 +92,15 @@
|
|
|
92
92
|
"devDependencies": {
|
|
93
93
|
"@testing-library/react": "^16.3.2",
|
|
94
94
|
"@types/json-schema": "^7.0.15",
|
|
95
|
-
"@types/node": "^26.
|
|
95
|
+
"@types/node": "^26.1.1",
|
|
96
96
|
"@types/react": "^19.2.17",
|
|
97
97
|
"@types/react-dom": "^19.2.3",
|
|
98
98
|
"jsdom": "^29.1.1",
|
|
99
99
|
"react": "^19.2.7",
|
|
100
100
|
"react-dom": "^19.2.7",
|
|
101
|
-
"vitest": "^4.1.
|
|
102
|
-
"@assistant-ui/vite": "0.0.
|
|
103
|
-
"@assistant-ui/x-buildutils": "0.0.
|
|
101
|
+
"vitest": "^4.1.10",
|
|
102
|
+
"@assistant-ui/vite": "0.0.9",
|
|
103
|
+
"@assistant-ui/x-buildutils": "0.0.18"
|
|
104
104
|
},
|
|
105
105
|
"publishConfig": {
|
|
106
106
|
"access": "public",
|
package/src/index.ts
CHANGED
|
@@ -209,7 +209,9 @@ export {
|
|
|
209
209
|
providerTool,
|
|
210
210
|
type ProviderToolConfig,
|
|
211
211
|
defineMcpToolkit,
|
|
212
|
+
type McpToolkitEntry,
|
|
212
213
|
type McpToolkitDefinition,
|
|
214
|
+
type McpToolkitToolConfig,
|
|
213
215
|
Tools,
|
|
214
216
|
DataRenderers,
|
|
215
217
|
Interactables,
|
|
@@ -337,6 +339,7 @@ export type {
|
|
|
337
339
|
AppendMessage,
|
|
338
340
|
TextMessagePart,
|
|
339
341
|
ReasoningMessagePart,
|
|
342
|
+
PartProviderMetadata,
|
|
340
343
|
SourceProviderMetadata,
|
|
341
344
|
SourceMessagePart,
|
|
342
345
|
ImageMessagePart,
|
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
import type {
|
|
2
|
+
CompleteAttachment,
|
|
3
|
+
DataMessagePart,
|
|
4
|
+
FileMessagePart,
|
|
5
|
+
ImageMessagePart,
|
|
2
6
|
MessageStatus,
|
|
3
7
|
SourceProviderMetadata,
|
|
4
8
|
ThreadMessage,
|
|
9
|
+
TextMessagePart,
|
|
10
|
+
Unstable_AudioMessagePart,
|
|
5
11
|
} from "@assistant-ui/core";
|
|
6
12
|
import { fromThreadMessageLike } from "../runtime-cores/external-store/ThreadMessageLike";
|
|
7
13
|
import type { CloudMessage } from "assistant-cloud";
|
|
8
|
-
import { isJSONValue } from "
|
|
14
|
+
import { isJSONValue } from "@assistant-ui/core/internal";
|
|
9
15
|
import type {
|
|
10
16
|
ReadonlyJSONObject,
|
|
11
17
|
ReadonlyJSONValue,
|
|
@@ -65,10 +71,27 @@ type AuiV0MessagePart =
|
|
|
65
71
|
readonly filename?: string;
|
|
66
72
|
};
|
|
67
73
|
|
|
74
|
+
type AuiV0AttachmentPart =
|
|
75
|
+
| TextMessagePart
|
|
76
|
+
| ImageMessagePart
|
|
77
|
+
| FileMessagePart
|
|
78
|
+
| Unstable_AudioMessagePart
|
|
79
|
+
| DataMessagePart<ReadonlyJSONValue>;
|
|
80
|
+
|
|
81
|
+
type AuiV0Attachment = {
|
|
82
|
+
readonly id: string;
|
|
83
|
+
readonly type: CompleteAttachment["type"];
|
|
84
|
+
readonly name: string;
|
|
85
|
+
readonly contentType?: string;
|
|
86
|
+
readonly status: CompleteAttachment["status"];
|
|
87
|
+
readonly content: readonly AuiV0AttachmentPart[];
|
|
88
|
+
};
|
|
89
|
+
|
|
68
90
|
type AuiV0Message = {
|
|
69
91
|
readonly role: "assistant" | "user" | "system";
|
|
70
92
|
readonly status?: MessageStatus;
|
|
71
93
|
readonly content: readonly AuiV0MessagePart[];
|
|
94
|
+
readonly attachments?: readonly AuiV0Attachment[];
|
|
72
95
|
readonly metadata: {
|
|
73
96
|
readonly unstable_state?: ReadonlyJSONValue;
|
|
74
97
|
readonly unstable_annotations: readonly ReadonlyJSONValue[];
|
|
@@ -83,14 +106,59 @@ type AuiV0Message = {
|
|
|
83
106
|
};
|
|
84
107
|
};
|
|
85
108
|
|
|
109
|
+
const encodeAttachmentPart = (
|
|
110
|
+
part: CompleteAttachment["content"][number],
|
|
111
|
+
): AuiV0AttachmentPart => {
|
|
112
|
+
const type = part.type;
|
|
113
|
+
switch (type) {
|
|
114
|
+
case "text":
|
|
115
|
+
case "image":
|
|
116
|
+
case "file":
|
|
117
|
+
case "audio":
|
|
118
|
+
return part;
|
|
119
|
+
|
|
120
|
+
case "data": {
|
|
121
|
+
if (!isJSONValue(part.data)) {
|
|
122
|
+
console.warn(`attachment data is not JSON! ${JSON.stringify(part)}`);
|
|
123
|
+
}
|
|
124
|
+
return { ...part, data: part.data as ReadonlyJSONValue };
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
default: {
|
|
128
|
+
const unhandledType: never = type;
|
|
129
|
+
throw new Error(
|
|
130
|
+
`Attachment part type not supported by aui/v0: ${unhandledType}`,
|
|
131
|
+
);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
const encodeAttachments = (
|
|
137
|
+
message: ThreadMessage,
|
|
138
|
+
): readonly AuiV0Attachment[] | undefined => {
|
|
139
|
+
if (message.role !== "user" || message.attachments.length === 0) {
|
|
140
|
+
return undefined;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
return message.attachments.map(
|
|
144
|
+
({ id, type, name, contentType, status, content }) => ({
|
|
145
|
+
id,
|
|
146
|
+
type,
|
|
147
|
+
name,
|
|
148
|
+
status,
|
|
149
|
+
...(contentType != null ? { contentType } : undefined),
|
|
150
|
+
content: content.map(encodeAttachmentPart),
|
|
151
|
+
}),
|
|
152
|
+
);
|
|
153
|
+
};
|
|
154
|
+
|
|
86
155
|
export function auiV0Encode(message: ThreadMessage): AuiV0Message {
|
|
87
|
-
// TODO attachments are currently intentionally ignored
|
|
88
156
|
// info: ID and createdAt are ignored (we use the server value instead)
|
|
89
|
-
|
|
90
157
|
const status: MessageStatus | undefined =
|
|
91
158
|
message.status?.type === "running"
|
|
92
159
|
? { type: "incomplete", reason: "cancelled" }
|
|
93
160
|
: message.status;
|
|
161
|
+
const attachments = encodeAttachments(message);
|
|
94
162
|
|
|
95
163
|
return {
|
|
96
164
|
role: message.role,
|
|
@@ -172,6 +240,7 @@ export function auiV0Encode(message: ThreadMessage): AuiV0Message {
|
|
|
172
240
|
}),
|
|
173
241
|
metadata: message.metadata as AuiV0Message["metadata"],
|
|
174
242
|
...(status ? { status } : undefined),
|
|
243
|
+
...(attachments ? { attachments } : undefined),
|
|
175
244
|
};
|
|
176
245
|
}
|
|
177
246
|
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
// @vitest-environment jsdom
|
|
2
|
+
import { render, waitFor } from "@testing-library/react";
|
|
3
|
+
import { resource, useResource } from "@assistant-ui/tap";
|
|
4
|
+
import type { ToolCallMessagePartProps } from "@assistant-ui/core/react";
|
|
5
|
+
import { beforeEach, describe, expect, it, vi } from "vitest";
|
|
6
|
+
import type { McpAppBridgeHandlers, McpAppsHost } from "./types";
|
|
7
|
+
|
|
8
|
+
const { framePropsMock } = vi.hoisted(() => ({ framePropsMock: vi.fn() }));
|
|
9
|
+
|
|
10
|
+
vi.mock("@assistant-ui/store", async (importOriginal) => ({
|
|
11
|
+
...(await importOriginal()),
|
|
12
|
+
useAui: () => ({
|
|
13
|
+
thread: () => ({ append: vi.fn() }),
|
|
14
|
+
}),
|
|
15
|
+
}));
|
|
16
|
+
|
|
17
|
+
vi.mock("./app-frame", () => ({
|
|
18
|
+
McpAppFrame: (props: unknown) => {
|
|
19
|
+
framePropsMock(props);
|
|
20
|
+
return null;
|
|
21
|
+
},
|
|
22
|
+
}));
|
|
23
|
+
|
|
24
|
+
import { McpAppRenderer } from "./McpAppRenderer";
|
|
25
|
+
|
|
26
|
+
const useHost = ({ host }: { host: McpAppsHost }) => host;
|
|
27
|
+
const Host = resource(useHost);
|
|
28
|
+
|
|
29
|
+
const createPart = (serverId?: string): ToolCallMessagePartProps => ({
|
|
30
|
+
type: "tool-call",
|
|
31
|
+
toolCallId: "call-1",
|
|
32
|
+
toolName: "search",
|
|
33
|
+
args: {},
|
|
34
|
+
argsText: "{}",
|
|
35
|
+
status: { type: "complete" },
|
|
36
|
+
mcp: {
|
|
37
|
+
app: {
|
|
38
|
+
resourceUri: "ui://example/search",
|
|
39
|
+
...(serverId !== undefined ? { serverId } : {}),
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
addResult: vi.fn(),
|
|
43
|
+
resume: vi.fn(),
|
|
44
|
+
respondToApproval: vi.fn(),
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
function Harness({ host, serverId }: { host: McpAppsHost; serverId?: string }) {
|
|
48
|
+
const renderer = useResource(
|
|
49
|
+
McpAppRenderer({
|
|
50
|
+
host: Host({ host }),
|
|
51
|
+
}),
|
|
52
|
+
);
|
|
53
|
+
const Renderer = renderer.render;
|
|
54
|
+
return <Renderer {...createPart(serverId)} />;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
describe("McpAppRenderer", () => {
|
|
58
|
+
beforeEach(() => {
|
|
59
|
+
framePropsMock.mockReset();
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
it("injects serverId into loadResource and reloads when it changes", async () => {
|
|
63
|
+
const loadResource = vi.fn(async ({ uri }: { uri: string }) => ({
|
|
64
|
+
uri,
|
|
65
|
+
mimeType: "text/html;profile=mcp-app" as const,
|
|
66
|
+
html: "",
|
|
67
|
+
}));
|
|
68
|
+
const host: McpAppsHost = {
|
|
69
|
+
loadResource,
|
|
70
|
+
callTool: vi.fn(),
|
|
71
|
+
readResource: vi.fn(),
|
|
72
|
+
listResources: vi.fn(),
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
const view = render(<Harness host={host} serverId="server-a" />);
|
|
76
|
+
await waitFor(() =>
|
|
77
|
+
expect(loadResource).toHaveBeenCalledWith({
|
|
78
|
+
uri: "ui://example/search",
|
|
79
|
+
serverId: "server-a",
|
|
80
|
+
}),
|
|
81
|
+
);
|
|
82
|
+
|
|
83
|
+
view.rerender(<Harness host={host} serverId="server-b" />);
|
|
84
|
+
await waitFor(() => expect(loadResource).toHaveBeenCalledTimes(2));
|
|
85
|
+
expect(loadResource).toHaveBeenLastCalledWith({
|
|
86
|
+
uri: "ui://example/search",
|
|
87
|
+
serverId: "server-b",
|
|
88
|
+
});
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
it("gives the renderer serverId precedence in listResources", async () => {
|
|
92
|
+
const listResources = vi.fn();
|
|
93
|
+
const host: McpAppsHost = {
|
|
94
|
+
loadResource: vi.fn(async ({ uri }) => ({
|
|
95
|
+
uri,
|
|
96
|
+
mimeType: "text/html;profile=mcp-app" as const,
|
|
97
|
+
html: "",
|
|
98
|
+
})),
|
|
99
|
+
callTool: vi.fn(),
|
|
100
|
+
readResource: vi.fn(),
|
|
101
|
+
listResources,
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
render(<Harness host={host} serverId="host-server" />);
|
|
105
|
+
await waitFor(() => expect(framePropsMock).toHaveBeenCalled());
|
|
106
|
+
const handlers = framePropsMock.mock.lastCall?.[0]
|
|
107
|
+
.handlers as McpAppBridgeHandlers;
|
|
108
|
+
|
|
109
|
+
await handlers.listResources?.({
|
|
110
|
+
cursor: "next",
|
|
111
|
+
serverId: "widget-server",
|
|
112
|
+
});
|
|
113
|
+
expect(listResources).toHaveBeenCalledWith({
|
|
114
|
+
cursor: "next",
|
|
115
|
+
serverId: "host-server",
|
|
116
|
+
});
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
it("passes listResources params through unchanged without serverId", async () => {
|
|
120
|
+
const listResources = vi.fn();
|
|
121
|
+
const host: McpAppsHost = {
|
|
122
|
+
loadResource: vi.fn(async ({ uri }) => ({
|
|
123
|
+
uri,
|
|
124
|
+
mimeType: "text/html;profile=mcp-app" as const,
|
|
125
|
+
html: "",
|
|
126
|
+
})),
|
|
127
|
+
callTool: vi.fn(),
|
|
128
|
+
readResource: vi.fn(),
|
|
129
|
+
listResources,
|
|
130
|
+
};
|
|
131
|
+
const params = { cursor: "next" };
|
|
132
|
+
|
|
133
|
+
render(<Harness host={host} />);
|
|
134
|
+
await waitFor(() => expect(framePropsMock).toHaveBeenCalled());
|
|
135
|
+
const handlers = framePropsMock.mock.lastCall?.[0]
|
|
136
|
+
.handlers as McpAppBridgeHandlers;
|
|
137
|
+
|
|
138
|
+
await handlers.listResources?.(params);
|
|
139
|
+
expect(listResources).toHaveBeenCalledWith(params);
|
|
140
|
+
});
|
|
141
|
+
});
|
|
@@ -26,6 +26,7 @@ import type {
|
|
|
26
26
|
McpAppsHost,
|
|
27
27
|
} from "./types";
|
|
28
28
|
import { getMcpAppFromToolPart } from "./utils";
|
|
29
|
+
import { isRecord } from "@assistant-ui/core/internal";
|
|
29
30
|
|
|
30
31
|
export type McpAppRendererOptions = {
|
|
31
32
|
/**
|
|
@@ -55,6 +56,7 @@ export type McpAppRendererOptions = {
|
|
|
55
56
|
|
|
56
57
|
type LoadedResourceState = {
|
|
57
58
|
resourceUri: string;
|
|
59
|
+
serverId?: string;
|
|
58
60
|
resource?: McpAppResource;
|
|
59
61
|
error?: Error;
|
|
60
62
|
};
|
|
@@ -100,7 +102,11 @@ function InlineRenderer({
|
|
|
100
102
|
const aui = useAui();
|
|
101
103
|
const app = getMcpAppFromToolPart(part);
|
|
102
104
|
const cachedAppRef = useRef<McpAppMetadata | undefined>(undefined);
|
|
103
|
-
if (
|
|
105
|
+
if (
|
|
106
|
+
app != null &&
|
|
107
|
+
(cachedAppRef.current?.resourceUri !== app.resourceUri ||
|
|
108
|
+
cachedAppRef.current?.serverId !== app.serverId)
|
|
109
|
+
) {
|
|
104
110
|
cachedAppRef.current = app;
|
|
105
111
|
}
|
|
106
112
|
const appForRender = app ?? cachedAppRef.current;
|
|
@@ -108,21 +114,37 @@ function InlineRenderer({
|
|
|
108
114
|
const [loadedResource, setLoadedResource] = useState<LoadedResourceState>();
|
|
109
115
|
|
|
110
116
|
const resourceUri = appForRender?.resourceUri;
|
|
117
|
+
const serverId = appForRender?.serverId;
|
|
118
|
+
const serverIdRef = useRef<string | undefined>(undefined);
|
|
119
|
+
serverIdRef.current = serverId;
|
|
111
120
|
useEffect(() => {
|
|
112
121
|
if (appForRender == null || resourceUri == null) return;
|
|
113
122
|
let cancelled = false;
|
|
114
123
|
const targetUri = resourceUri;
|
|
124
|
+
const targetServerId = serverId;
|
|
115
125
|
|
|
116
126
|
internalsRef.current.host
|
|
117
|
-
.loadResource({
|
|
127
|
+
.loadResource({
|
|
128
|
+
uri: targetUri,
|
|
129
|
+
...(targetServerId ? { serverId: targetServerId } : {}),
|
|
130
|
+
})
|
|
118
131
|
.then((res) => {
|
|
119
132
|
if (!cancelled)
|
|
120
|
-
setLoadedResource({
|
|
133
|
+
setLoadedResource({
|
|
134
|
+
resourceUri: targetUri,
|
|
135
|
+
...(targetServerId !== undefined
|
|
136
|
+
? { serverId: targetServerId }
|
|
137
|
+
: {}),
|
|
138
|
+
resource: res,
|
|
139
|
+
});
|
|
121
140
|
})
|
|
122
141
|
.catch((error: unknown) => {
|
|
123
142
|
if (!cancelled) {
|
|
124
143
|
setLoadedResource({
|
|
125
144
|
resourceUri: targetUri,
|
|
145
|
+
...(targetServerId !== undefined
|
|
146
|
+
? { serverId: targetServerId }
|
|
147
|
+
: {}),
|
|
126
148
|
error: error instanceof Error ? error : new Error(String(error)),
|
|
127
149
|
});
|
|
128
150
|
}
|
|
@@ -131,8 +153,8 @@ function InlineRenderer({
|
|
|
131
153
|
return () => {
|
|
132
154
|
cancelled = true;
|
|
133
155
|
};
|
|
134
|
-
// oxlint-disable-next-line react/exhaustive-deps -- re-fetch only when URI changes; appForRender identity is unstable and internalsRef is a stable ref
|
|
135
|
-
}, [resourceUri]);
|
|
156
|
+
// oxlint-disable-next-line react/exhaustive-deps -- re-fetch only when URI or server identity changes; appForRender identity is unstable and internalsRef is a stable ref
|
|
157
|
+
}, [resourceUri, serverId]);
|
|
136
158
|
|
|
137
159
|
const bridgeHandlers = useMemo<McpAppBridgeHandlers>(
|
|
138
160
|
() => ({
|
|
@@ -143,16 +165,32 @@ function InlineRenderer({
|
|
|
143
165
|
aui.thread().append({ content: [{ type: "text", text }] });
|
|
144
166
|
return { ok: true };
|
|
145
167
|
},
|
|
146
|
-
callTool: (params) =>
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
168
|
+
callTool: (params) =>
|
|
169
|
+
internalsRef.current.host.callTool({
|
|
170
|
+
...params,
|
|
171
|
+
...(serverIdRef.current ? { serverId: serverIdRef.current } : {}),
|
|
172
|
+
}),
|
|
173
|
+
readResource: (params) =>
|
|
174
|
+
internalsRef.current.host.readResource({
|
|
175
|
+
...params,
|
|
176
|
+
...(serverIdRef.current ? { serverId: serverIdRef.current } : {}),
|
|
177
|
+
}),
|
|
178
|
+
listResources: (params) => {
|
|
179
|
+
if (!serverIdRef.current) {
|
|
180
|
+
return internalsRef.current.host.listResources(params);
|
|
181
|
+
}
|
|
182
|
+
return internalsRef.current.host.listResources({
|
|
183
|
+
...(isRecord(params) ? params : {}),
|
|
184
|
+
serverId: serverIdRef.current,
|
|
185
|
+
});
|
|
186
|
+
},
|
|
150
187
|
}),
|
|
151
188
|
[aui, internalsRef],
|
|
152
189
|
);
|
|
153
190
|
|
|
154
191
|
const loadedResourceForApp =
|
|
155
|
-
loadedResource?.resourceUri === appForRender?.resourceUri
|
|
192
|
+
loadedResource?.resourceUri === appForRender?.resourceUri &&
|
|
193
|
+
loadedResource?.serverId === appForRender?.serverId
|
|
156
194
|
? loadedResource
|
|
157
195
|
: undefined;
|
|
158
196
|
const appResource = loadedResourceForApp?.resource;
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { createTapRoot, useResource } from "@assistant-ui/tap";
|
|
2
|
+
import { describe, expect, it, vi } from "vitest";
|
|
3
|
+
import { McpAppsRemoteHost } from "./McpAppsRemoteHost";
|
|
4
|
+
|
|
5
|
+
const mount = (fetch: typeof globalThis.fetch) =>
|
|
6
|
+
createTapRoot(function Root() {
|
|
7
|
+
return useResource(
|
|
8
|
+
McpAppsRemoteHost({
|
|
9
|
+
url: "/api/mcp-apps",
|
|
10
|
+
fetch,
|
|
11
|
+
}),
|
|
12
|
+
);
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
describe("McpAppsRemoteHost", () => {
|
|
16
|
+
it("posts the requested method and params to the host route", async () => {
|
|
17
|
+
const fetch = vi.fn(async () =>
|
|
18
|
+
Response.json({ content: [{ type: "text", text: "ok" }] }),
|
|
19
|
+
) as unknown as typeof globalThis.fetch;
|
|
20
|
+
const root = mount(fetch);
|
|
21
|
+
|
|
22
|
+
try {
|
|
23
|
+
await expect(
|
|
24
|
+
root.getValue().callTool({
|
|
25
|
+
name: "search",
|
|
26
|
+
arguments: { query: "docs" },
|
|
27
|
+
}),
|
|
28
|
+
).resolves.toEqual({ content: [{ type: "text", text: "ok" }] });
|
|
29
|
+
|
|
30
|
+
expect(fetch).toHaveBeenCalledWith("/api/mcp-apps", {
|
|
31
|
+
method: "POST",
|
|
32
|
+
headers: { "content-type": "application/json" },
|
|
33
|
+
body: JSON.stringify({
|
|
34
|
+
method: "tools/call",
|
|
35
|
+
params: { name: "search", arguments: { query: "docs" } },
|
|
36
|
+
}),
|
|
37
|
+
});
|
|
38
|
+
} finally {
|
|
39
|
+
root.unmount();
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
it("posts serverId params verbatim for tool calls and resource loads", async () => {
|
|
44
|
+
const fetch = vi.fn(async () =>
|
|
45
|
+
Response.json({ content: [{ type: "text", text: "ok" }] }),
|
|
46
|
+
) as unknown as typeof globalThis.fetch;
|
|
47
|
+
const root = mount(fetch);
|
|
48
|
+
|
|
49
|
+
try {
|
|
50
|
+
await root.getValue().callTool({
|
|
51
|
+
name: "search",
|
|
52
|
+
arguments: { query: "docs" },
|
|
53
|
+
serverId: "search-server",
|
|
54
|
+
});
|
|
55
|
+
await root.getValue().loadResource({
|
|
56
|
+
uri: "ui://example/search",
|
|
57
|
+
serverId: "search-server",
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
expect(fetch).toHaveBeenNthCalledWith(1, "/api/mcp-apps", {
|
|
61
|
+
method: "POST",
|
|
62
|
+
headers: { "content-type": "application/json" },
|
|
63
|
+
body: JSON.stringify({
|
|
64
|
+
method: "tools/call",
|
|
65
|
+
params: {
|
|
66
|
+
name: "search",
|
|
67
|
+
arguments: { query: "docs" },
|
|
68
|
+
serverId: "search-server",
|
|
69
|
+
},
|
|
70
|
+
}),
|
|
71
|
+
});
|
|
72
|
+
expect(fetch).toHaveBeenNthCalledWith(2, "/api/mcp-apps", {
|
|
73
|
+
method: "POST",
|
|
74
|
+
headers: { "content-type": "application/json" },
|
|
75
|
+
body: JSON.stringify({
|
|
76
|
+
method: "mcp-apps/read-resource",
|
|
77
|
+
params: {
|
|
78
|
+
uri: "ui://example/search",
|
|
79
|
+
serverId: "search-server",
|
|
80
|
+
},
|
|
81
|
+
}),
|
|
82
|
+
});
|
|
83
|
+
} finally {
|
|
84
|
+
root.unmount();
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
it("includes method, url, status, and text body in host request errors", async () => {
|
|
89
|
+
const fetch = vi.fn(
|
|
90
|
+
async () =>
|
|
91
|
+
new Response("Missing tool name", {
|
|
92
|
+
status: 500,
|
|
93
|
+
statusText: "Internal Server Error",
|
|
94
|
+
}),
|
|
95
|
+
) as unknown as typeof globalThis.fetch;
|
|
96
|
+
const root = mount(fetch);
|
|
97
|
+
|
|
98
|
+
try {
|
|
99
|
+
await expect(
|
|
100
|
+
root.getValue().callTool({ name: "search" }),
|
|
101
|
+
).rejects.toThrow(
|
|
102
|
+
'MCP App host request "tools/call" to "/api/mcp-apps" failed with 500 Internal Server Error: Missing tool name',
|
|
103
|
+
);
|
|
104
|
+
} finally {
|
|
105
|
+
root.unmount();
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
it("uses JSON error messages from failed host responses", async () => {
|
|
110
|
+
const fetch = vi.fn(async () =>
|
|
111
|
+
Response.json(
|
|
112
|
+
{ error: { message: "resources/list is not supported" } },
|
|
113
|
+
{ status: 400, statusText: "Bad Request" },
|
|
114
|
+
),
|
|
115
|
+
) as unknown as typeof globalThis.fetch;
|
|
116
|
+
const root = mount(fetch);
|
|
117
|
+
|
|
118
|
+
try {
|
|
119
|
+
await expect(root.getValue().listResources()).rejects.toThrow(
|
|
120
|
+
'MCP App host request "resources/list" to "/api/mcp-apps" failed with 400 Bad Request: resources/list is not supported',
|
|
121
|
+
);
|
|
122
|
+
} finally {
|
|
123
|
+
root.unmount();
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
});
|
|
@@ -6,6 +6,39 @@ import type {
|
|
|
6
6
|
McpAppsRemoteHostOptions,
|
|
7
7
|
} from "./types";
|
|
8
8
|
|
|
9
|
+
const truncateBody = (body: string) =>
|
|
10
|
+
body.length > 500 ? `${body.slice(0, 500)}...` : body;
|
|
11
|
+
|
|
12
|
+
const extractErrorBody = (body: string): string | undefined => {
|
|
13
|
+
const trimmed = body.trim();
|
|
14
|
+
if (!trimmed) return undefined;
|
|
15
|
+
|
|
16
|
+
try {
|
|
17
|
+
const parsed = JSON.parse(trimmed) as unknown;
|
|
18
|
+
if (parsed && typeof parsed === "object") {
|
|
19
|
+
const record = parsed as Record<string, unknown>;
|
|
20
|
+
if (typeof record.message === "string") return record.message;
|
|
21
|
+
if (typeof record.error === "string") return record.error;
|
|
22
|
+
if (record.error && typeof record.error === "object") {
|
|
23
|
+
const error = record.error as Record<string, unknown>;
|
|
24
|
+
if (typeof error.message === "string") return error.message;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
} catch {
|
|
28
|
+
return truncateBody(trimmed);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
return truncateBody(trimmed);
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
const readErrorBody = async (res: Response): Promise<string | undefined> => {
|
|
35
|
+
try {
|
|
36
|
+
return extractErrorBody(await res.text());
|
|
37
|
+
} catch {
|
|
38
|
+
return undefined;
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
|
|
9
42
|
async function postToHost(
|
|
10
43
|
options: McpAppsRemoteHostOptions,
|
|
11
44
|
method: string,
|
|
@@ -22,7 +55,13 @@ async function postToHost(
|
|
|
22
55
|
body: JSON.stringify({ method, params }),
|
|
23
56
|
});
|
|
24
57
|
if (!res.ok) {
|
|
25
|
-
|
|
58
|
+
const status = res.statusText
|
|
59
|
+
? `${res.status} ${res.statusText}`
|
|
60
|
+
: `${res.status}`;
|
|
61
|
+
const body = await readErrorBody(res);
|
|
62
|
+
throw new Error(
|
|
63
|
+
`MCP App host request "${method}" to "${options.url}" failed with ${status}${body ? `: ${body}` : ""}`,
|
|
64
|
+
);
|
|
26
65
|
}
|
|
27
66
|
return res.json();
|
|
28
67
|
}
|
|
@@ -246,7 +246,9 @@ export function McpAppFrame({
|
|
|
246
246
|
return (
|
|
247
247
|
<SandboxHost
|
|
248
248
|
content={{ html: resource.html }}
|
|
249
|
-
contentKey={
|
|
249
|
+
contentKey={
|
|
250
|
+
app.serverId ? `${app.serverId} ${resource.uri}` : resource.uri
|
|
251
|
+
}
|
|
250
252
|
sandbox={{ ...sandbox, product: sandbox?.product ?? DEFAULT_PRODUCT }}
|
|
251
253
|
maxHeight={maxHeight}
|
|
252
254
|
createBridge={createBridge}
|