@assistant-ui/react 0.12.11 → 0.12.12
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 +68 -58
- package/dist/client/ExternalThread.d.ts.map +1 -1
- package/dist/client/ExternalThread.js +25 -13
- package/dist/client/ExternalThread.js.map +1 -1
- package/dist/client/InMemoryThreadList.d.ts.map +1 -1
- package/dist/client/InMemoryThreadList.js +1 -2
- package/dist/client/InMemoryThreadList.js.map +1 -1
- package/dist/client/index.d.ts +1 -2
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +2 -2
- package/dist/client/index.js.map +1 -1
- package/dist/context/providers/AttachmentByIndexProvider.d.ts +1 -7
- package/dist/context/providers/AttachmentByIndexProvider.d.ts.map +1 -1
- package/dist/context/providers/AttachmentByIndexProvider.js +1 -22
- package/dist/context/providers/AttachmentByIndexProvider.js.map +1 -1
- package/dist/context/providers/ChainOfThoughtByIndicesProvider.d.ts +1 -5
- package/dist/context/providers/ChainOfThoughtByIndicesProvider.d.ts.map +1 -1
- package/dist/context/providers/ChainOfThoughtByIndicesProvider.js +1 -19
- package/dist/context/providers/ChainOfThoughtByIndicesProvider.js.map +1 -1
- package/dist/context/providers/ChainOfThoughtPartByIndexProvider.d.ts +1 -4
- package/dist/context/providers/ChainOfThoughtPartByIndexProvider.d.ts.map +1 -1
- package/dist/context/providers/ChainOfThoughtPartByIndexProvider.js +1 -12
- package/dist/context/providers/ChainOfThoughtPartByIndexProvider.js.map +1 -1
- package/dist/context/providers/MessageByIndexProvider.d.ts +1 -4
- package/dist/context/providers/MessageByIndexProvider.d.ts.map +1 -1
- package/dist/context/providers/MessageByIndexProvider.js +1 -17
- package/dist/context/providers/MessageByIndexProvider.js.map +1 -1
- package/dist/context/providers/PartByIndexProvider.d.ts +1 -4
- package/dist/context/providers/PartByIndexProvider.d.ts.map +1 -1
- package/dist/context/providers/PartByIndexProvider.js +1 -12
- package/dist/context/providers/PartByIndexProvider.js.map +1 -1
- package/dist/context/providers/SuggestionByIndexProvider.d.ts +1 -5
- package/dist/context/providers/SuggestionByIndexProvider.d.ts.map +1 -1
- package/dist/context/providers/SuggestionByIndexProvider.js +1 -12
- package/dist/context/providers/SuggestionByIndexProvider.js.map +1 -1
- package/dist/context/providers/TextMessagePartProvider.d.ts +1 -5
- package/dist/context/providers/TextMessagePartProvider.d.ts.map +1 -1
- package/dist/context/providers/TextMessagePartProvider.js +1 -25
- package/dist/context/providers/TextMessagePartProvider.js.map +1 -1
- package/dist/context/providers/ThreadListItemProvider.d.ts +1 -9
- package/dist/context/providers/ThreadListItemProvider.d.ts.map +1 -1
- package/dist/context/providers/ThreadListItemProvider.js +1 -19
- package/dist/context/providers/ThreadListItemProvider.js.map +1 -1
- package/dist/context/providers/index.d.ts +1 -0
- package/dist/context/providers/index.d.ts.map +1 -1
- package/dist/context/providers/index.js +1 -0
- package/dist/context/providers/index.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/legacy-runtime/AssistantRuntimeProvider.d.ts.map +1 -1
- package/dist/legacy-runtime/AssistantRuntimeProvider.js +8 -9
- package/dist/legacy-runtime/AssistantRuntimeProvider.js.map +1 -1
- package/dist/legacy-runtime/RuntimeAdapter.d.ts +1 -2
- package/dist/legacy-runtime/RuntimeAdapter.d.ts.map +1 -1
- package/dist/legacy-runtime/RuntimeAdapter.js +1 -48
- package/dist/legacy-runtime/RuntimeAdapter.js.map +1 -1
- package/dist/legacy-runtime/hooks/AttachmentContext.d.ts +280 -112
- package/dist/legacy-runtime/hooks/AttachmentContext.d.ts.map +1 -1
- package/dist/legacy-runtime/runtime-cores/adapters/attachment/CloudFileAttachmentAdapter.js +1 -1
- package/dist/legacy-runtime/runtime-cores/adapters/attachment/CloudFileAttachmentAdapter.js.map +1 -1
- package/dist/legacy-runtime/runtime-cores/assistant-transport/index.d.ts +1 -1
- package/dist/legacy-runtime/runtime-cores/assistant-transport/index.d.ts.map +1 -1
- package/dist/legacy-runtime/runtime-cores/assistant-transport/types.d.ts +22 -0
- package/dist/legacy-runtime/runtime-cores/assistant-transport/types.d.ts.map +1 -1
- package/dist/legacy-runtime/runtime-cores/assistant-transport/types.js.map +1 -1
- package/dist/legacy-runtime/runtime-cores/assistant-transport/useAssistantTransportRuntime.d.ts.map +1 -1
- package/dist/legacy-runtime/runtime-cores/assistant-transport/useAssistantTransportRuntime.js +17 -13
- package/dist/legacy-runtime/runtime-cores/assistant-transport/useAssistantTransportRuntime.js.map +1 -1
- package/dist/legacy-runtime/runtime-cores/external-store/external-message-converter.d.ts.map +1 -1
- package/dist/legacy-runtime/runtime-cores/external-store/external-message-converter.js +8 -6
- package/dist/legacy-runtime/runtime-cores/external-store/external-message-converter.js.map +1 -1
- package/dist/legacy-runtime/runtime-cores/external-store/getExternalStoreMessage.d.ts +1 -1
- package/dist/legacy-runtime/runtime-cores/external-store/getExternalStoreMessage.d.ts.map +1 -1
- package/dist/legacy-runtime/runtime-cores/external-store/getExternalStoreMessage.js +1 -1
- package/dist/legacy-runtime/runtime-cores/external-store/getExternalStoreMessage.js.map +1 -1
- package/dist/legacy-runtime/runtime-cores/external-store/index.d.ts +1 -1
- package/dist/legacy-runtime/runtime-cores/external-store/index.d.ts.map +1 -1
- package/dist/legacy-runtime/runtime-cores/external-store/index.js +1 -1
- package/dist/legacy-runtime/runtime-cores/external-store/index.js.map +1 -1
- package/dist/legacy-runtime/runtime-cores/remote-thread-list/useRemoteThreadListRuntime.d.ts.map +1 -1
- package/dist/legacy-runtime/runtime-cores/remote-thread-list/useRemoteThreadListRuntime.js +14 -4
- package/dist/legacy-runtime/runtime-cores/remote-thread-list/useRemoteThreadListRuntime.js.map +1 -1
- package/dist/model-context/index.d.ts +4 -13
- package/dist/model-context/index.d.ts.map +1 -1
- package/dist/model-context/index.js +6 -11
- package/dist/model-context/index.js.map +1 -1
- package/dist/primitives/actionBarMore/ActionBarMoreContent.d.ts +1 -1
- package/dist/primitives/actionBarMore/ActionBarMoreContent.d.ts.map +1 -1
- package/dist/primitives/actionBarMore/ActionBarMoreContent.js +1 -1
- package/dist/primitives/actionBarMore/ActionBarMoreContent.js.map +1 -1
- package/dist/primitives/actionBarMore/ActionBarMoreItem.d.ts +1 -1
- package/dist/primitives/actionBarMore/ActionBarMoreItem.d.ts.map +1 -1
- package/dist/primitives/actionBarMore/ActionBarMoreItem.js +1 -1
- package/dist/primitives/actionBarMore/ActionBarMoreItem.js.map +1 -1
- package/dist/primitives/actionBarMore/ActionBarMoreRoot.d.ts +1 -1
- package/dist/primitives/actionBarMore/ActionBarMoreRoot.d.ts.map +1 -1
- package/dist/primitives/actionBarMore/ActionBarMoreRoot.js +1 -1
- package/dist/primitives/actionBarMore/ActionBarMoreRoot.js.map +1 -1
- package/dist/primitives/actionBarMore/ActionBarMoreSeparator.d.ts +1 -1
- package/dist/primitives/actionBarMore/ActionBarMoreSeparator.d.ts.map +1 -1
- package/dist/primitives/actionBarMore/ActionBarMoreSeparator.js +1 -1
- package/dist/primitives/actionBarMore/ActionBarMoreSeparator.js.map +1 -1
- package/dist/primitives/actionBarMore/ActionBarMoreTrigger.d.ts +1 -1
- package/dist/primitives/actionBarMore/ActionBarMoreTrigger.d.ts.map +1 -1
- package/dist/primitives/actionBarMore/ActionBarMoreTrigger.js +1 -1
- package/dist/primitives/actionBarMore/ActionBarMoreTrigger.js.map +1 -1
- package/dist/primitives/actionBarMore/scope.d.ts +1 -1
- package/dist/primitives/actionBarMore/scope.d.ts.map +1 -1
- package/dist/primitives/actionBarMore/scope.js +1 -1
- package/dist/primitives/actionBarMore/scope.js.map +1 -1
- package/dist/primitives/assistantModal/AssistantModalAnchor.d.ts +1 -1
- package/dist/primitives/assistantModal/AssistantModalAnchor.d.ts.map +1 -1
- package/dist/primitives/assistantModal/AssistantModalAnchor.js +1 -1
- package/dist/primitives/assistantModal/AssistantModalAnchor.js.map +1 -1
- package/dist/primitives/assistantModal/AssistantModalContent.d.ts +1 -1
- package/dist/primitives/assistantModal/AssistantModalContent.d.ts.map +1 -1
- package/dist/primitives/assistantModal/AssistantModalContent.js +1 -1
- package/dist/primitives/assistantModal/AssistantModalContent.js.map +1 -1
- package/dist/primitives/assistantModal/AssistantModalRoot.d.ts +1 -1
- package/dist/primitives/assistantModal/AssistantModalRoot.d.ts.map +1 -1
- package/dist/primitives/assistantModal/AssistantModalRoot.js +1 -1
- package/dist/primitives/assistantModal/AssistantModalRoot.js.map +1 -1
- package/dist/primitives/assistantModal/AssistantModalTrigger.d.ts +1 -1
- package/dist/primitives/assistantModal/AssistantModalTrigger.d.ts.map +1 -1
- package/dist/primitives/assistantModal/AssistantModalTrigger.js +1 -1
- package/dist/primitives/assistantModal/AssistantModalTrigger.js.map +1 -1
- package/dist/primitives/assistantModal/scope.d.ts +1 -1
- package/dist/primitives/assistantModal/scope.d.ts.map +1 -1
- package/dist/primitives/assistantModal/scope.js +1 -1
- package/dist/primitives/assistantModal/scope.js.map +1 -1
- package/dist/primitives/chainOfThought/ChainOfThoughtParts.d.ts +1 -38
- package/dist/primitives/chainOfThought/ChainOfThoughtParts.d.ts.map +1 -1
- package/dist/primitives/chainOfThought/ChainOfThoughtParts.js +1 -38
- package/dist/primitives/chainOfThought/ChainOfThoughtParts.js.map +1 -1
- package/dist/primitives/composer/ComposerAttachmentDropzone.js +2 -2
- package/dist/primitives/composer/ComposerAttachmentDropzone.js.map +1 -1
- package/dist/primitives/composer/ComposerAttachments.d.ts +1 -36
- package/dist/primitives/composer/ComposerAttachments.d.ts.map +1 -1
- package/dist/primitives/composer/ComposerAttachments.js +1 -61
- package/dist/primitives/composer/ComposerAttachments.js.map +1 -1
- package/dist/primitives/composer/ComposerIf.d.ts +2 -17
- package/dist/primitives/composer/ComposerIf.d.ts.map +1 -1
- package/dist/primitives/composer/ComposerIf.js +1 -23
- package/dist/primitives/composer/ComposerIf.js.map +1 -1
- package/dist/primitives/composer/ComposerInput.js +2 -2
- package/dist/primitives/composer/ComposerInput.js.map +1 -1
- package/dist/primitives/message/MessageAttachments.d.ts +1 -36
- package/dist/primitives/message/MessageAttachments.d.ts.map +1 -1
- package/dist/primitives/message/MessageAttachments.js +1 -65
- package/dist/primitives/message/MessageAttachments.js.map +1 -1
- package/dist/primitives/message/MessageIf.d.ts +1 -1
- package/dist/primitives/message/MessageIf.js +1 -1
- package/dist/primitives/message/MessageParts.d.ts +5 -219
- package/dist/primitives/message/MessageParts.d.ts.map +1 -1
- package/dist/primitives/message/MessageParts.js +29 -270
- package/dist/primitives/message/MessageParts.js.map +1 -1
- package/dist/primitives/message/MessagePartsGrouped.d.ts +1 -1
- package/dist/primitives/message/MessagePartsGrouped.d.ts.map +1 -1
- package/dist/primitives/message/MessagePartsGrouped.js +2 -2
- package/dist/primitives/message/MessagePartsGrouped.js.map +1 -1
- package/dist/primitives/thread/ThreadEmpty.d.ts +3 -0
- package/dist/primitives/thread/ThreadEmpty.d.ts.map +1 -1
- package/dist/primitives/thread/ThreadEmpty.js +4 -1
- package/dist/primitives/thread/ThreadEmpty.js.map +1 -1
- package/dist/primitives/thread/ThreadIf.d.ts +1 -1
- package/dist/primitives/thread/ThreadIf.js +1 -1
- package/dist/primitives/thread/ThreadMessages.d.ts +1 -94
- package/dist/primitives/thread/ThreadMessages.d.ts.map +1 -1
- package/dist/primitives/thread/ThreadMessages.js +1 -109
- package/dist/primitives/thread/ThreadMessages.js.map +1 -1
- package/dist/primitives/thread/ThreadSuggestions.d.ts +1 -52
- package/dist/primitives/thread/ThreadSuggestions.d.ts.map +1 -1
- package/dist/primitives/thread/ThreadSuggestions.js +1 -56
- package/dist/primitives/thread/ThreadSuggestions.js.map +1 -1
- package/dist/primitives/thread/ThreadViewportSlack.js +2 -2
- package/dist/primitives/thread/ThreadViewportSlack.js.map +1 -1
- package/dist/primitives/threadList/ThreadListItems.d.ts +1 -34
- package/dist/primitives/threadList/ThreadListItems.d.ts.map +1 -1
- package/dist/primitives/threadList/ThreadListItems.js +1 -35
- package/dist/primitives/threadList/ThreadListItems.js.map +1 -1
- package/dist/primitives/threadListItem/ThreadListItemTitle.d.ts +1 -7
- package/dist/primitives/threadListItem/ThreadListItemTitle.d.ts.map +1 -1
- package/dist/primitives/threadListItem/ThreadListItemTitle.js +1 -7
- package/dist/primitives/threadListItem/ThreadListItemTitle.js.map +1 -1
- package/dist/primitives/threadListItemMore/ThreadListItemMoreContent.d.ts +1 -1
- package/dist/primitives/threadListItemMore/ThreadListItemMoreContent.d.ts.map +1 -1
- package/dist/primitives/threadListItemMore/ThreadListItemMoreContent.js +1 -1
- package/dist/primitives/threadListItemMore/ThreadListItemMoreContent.js.map +1 -1
- package/dist/primitives/threadListItemMore/ThreadListItemMoreItem.d.ts +1 -1
- package/dist/primitives/threadListItemMore/ThreadListItemMoreItem.d.ts.map +1 -1
- package/dist/primitives/threadListItemMore/ThreadListItemMoreItem.js +1 -1
- package/dist/primitives/threadListItemMore/ThreadListItemMoreItem.js.map +1 -1
- package/dist/primitives/threadListItemMore/ThreadListItemMoreRoot.d.ts +1 -1
- package/dist/primitives/threadListItemMore/ThreadListItemMoreRoot.d.ts.map +1 -1
- package/dist/primitives/threadListItemMore/ThreadListItemMoreRoot.js +1 -1
- package/dist/primitives/threadListItemMore/ThreadListItemMoreRoot.js.map +1 -1
- package/dist/primitives/threadListItemMore/ThreadListItemMoreSeparator.d.ts +1 -1
- package/dist/primitives/threadListItemMore/ThreadListItemMoreSeparator.d.ts.map +1 -1
- package/dist/primitives/threadListItemMore/ThreadListItemMoreSeparator.js +1 -1
- package/dist/primitives/threadListItemMore/ThreadListItemMoreSeparator.js.map +1 -1
- package/dist/primitives/threadListItemMore/ThreadListItemMoreTrigger.d.ts +1 -1
- package/dist/primitives/threadListItemMore/ThreadListItemMoreTrigger.d.ts.map +1 -1
- package/dist/primitives/threadListItemMore/ThreadListItemMoreTrigger.js +1 -1
- package/dist/primitives/threadListItemMore/ThreadListItemMoreTrigger.js.map +1 -1
- package/dist/primitives/threadListItemMore/scope.d.ts +1 -1
- package/dist/primitives/threadListItemMore/scope.d.ts.map +1 -1
- package/dist/primitives/threadListItemMore/scope.js +1 -1
- package/dist/primitives/threadListItemMore/scope.js.map +1 -1
- package/dist/types/index.d.ts +2 -2
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/scopes/index.d.ts +1 -2
- package/dist/types/scopes/index.d.ts.map +1 -1
- package/package.json +10 -12
- package/src/client/ExternalThread.ts +25 -13
- package/src/client/InMemoryThreadList.ts +1 -2
- package/src/client/index.ts +3 -2
- package/src/context/providers/AttachmentByIndexProvider.tsx +4 -34
- package/src/context/providers/ChainOfThoughtByIndicesProvider.tsx +1 -34
- package/src/context/providers/ChainOfThoughtPartByIndexProvider.tsx +1 -18
- package/src/context/providers/MessageByIndexProvider.tsx +1 -23
- package/src/context/providers/PartByIndexProvider.tsx +1 -18
- package/src/context/providers/SuggestionByIndexProvider.tsx +4 -21
- package/src/context/providers/TextMessagePartProvider.tsx +1 -46
- package/src/context/providers/ThreadListItemProvider.tsx +4 -33
- package/src/context/providers/index.ts +1 -0
- package/src/index.ts +1 -1
- package/src/legacy-runtime/AssistantRuntimeProvider.tsx +13 -21
- package/src/legacy-runtime/RuntimeAdapter.ts +1 -66
- package/src/legacy-runtime/runtime-cores/adapters/attachment/CloudFileAttachmentAdapter.ts +1 -1
- package/src/legacy-runtime/runtime-cores/assistant-transport/index.ts +1 -0
- package/src/legacy-runtime/runtime-cores/assistant-transport/types.ts +25 -0
- package/src/legacy-runtime/runtime-cores/assistant-transport/useAssistantTransportRuntime.ts +22 -13
- package/src/legacy-runtime/runtime-cores/external-store/external-message-converter.ts +19 -21
- package/src/legacy-runtime/runtime-cores/external-store/getExternalStoreMessage.ts +1 -0
- package/src/legacy-runtime/runtime-cores/external-store/index.ts +1 -0
- package/src/legacy-runtime/runtime-cores/remote-thread-list/useRemoteThreadListRuntime.ts +20 -4
- package/src/model-context/index.ts +29 -22
- package/src/primitives/actionBarMore/ActionBarMoreContent.tsx +1 -1
- package/src/primitives/actionBarMore/ActionBarMoreItem.tsx +1 -1
- package/src/primitives/actionBarMore/ActionBarMoreRoot.tsx +1 -1
- package/src/primitives/actionBarMore/ActionBarMoreSeparator.tsx +1 -1
- package/src/primitives/actionBarMore/ActionBarMoreTrigger.tsx +1 -1
- package/src/primitives/actionBarMore/scope.ts +1 -1
- package/src/primitives/assistantModal/AssistantModalAnchor.tsx +1 -1
- package/src/primitives/assistantModal/AssistantModalContent.tsx +1 -1
- package/src/primitives/assistantModal/AssistantModalRoot.tsx +1 -1
- package/src/primitives/assistantModal/AssistantModalTrigger.tsx +1 -1
- package/src/primitives/assistantModal/scope.ts +1 -1
- package/src/primitives/chainOfThought/ChainOfThoughtParts.tsx +1 -85
- package/src/primitives/composer/ComposerAttachmentDropzone.tsx +2 -2
- package/src/primitives/composer/ComposerAttachments.tsx +4 -110
- package/src/primitives/composer/ComposerIf.ts +2 -42
- package/src/primitives/composer/ComposerInput.tsx +2 -2
- package/src/primitives/message/MessageAttachments.tsx +4 -113
- package/src/primitives/message/MessageIf.ts +1 -1
- package/src/primitives/message/MessageParts.tsx +43 -642
- package/src/primitives/message/MessagePartsGrouped.tsx +3 -3
- package/src/primitives/thread/ThreadEmpty.ts +4 -3
- package/src/primitives/thread/ThreadIf.ts +1 -1
- package/src/primitives/thread/ThreadMessages.tsx +4 -217
- package/src/primitives/thread/ThreadSuggestions.tsx +4 -106
- package/src/primitives/thread/ThreadViewportSlack.tsx +2 -2
- package/src/primitives/threadList/ThreadListItems.tsx +4 -79
- package/src/primitives/threadListItem/ThreadListItemTitle.test.tsx +7 -3
- package/src/primitives/threadListItem/ThreadListItemTitle.tsx +1 -17
- package/src/primitives/threadListItemMore/ThreadListItemMoreContent.tsx +1 -1
- package/src/primitives/threadListItemMore/ThreadListItemMoreItem.tsx +1 -1
- package/src/primitives/threadListItemMore/ThreadListItemMoreRoot.tsx +1 -1
- package/src/primitives/threadListItemMore/ThreadListItemMoreSeparator.tsx +1 -1
- package/src/primitives/threadListItemMore/ThreadListItemMoreTrigger.tsx +1 -1
- package/src/primitives/threadListItemMore/scope.ts +1 -1
- package/src/tests/BaseComposerRuntimeCore.test.ts +106 -1
- package/src/tests/DataRenderers.test.ts +1 -2
- package/src/types/index.ts +3 -2
- package/src/types/scopes/index.ts +5 -3
- package/dist/client/DataRenderers.d.ts +0 -3
- package/dist/client/DataRenderers.d.ts.map +0 -1
- package/dist/client/DataRenderers.js +0 -33
- package/dist/client/DataRenderers.js.map +0 -1
- package/dist/client/Tools.d.ts +0 -8
- package/dist/client/Tools.d.ts.map +0 -1
- package/dist/client/Tools.js +0 -68
- package/dist/client/Tools.js.map +0 -1
- package/dist/model-context/makeAssistantDataUI.d.ts +0 -7
- package/dist/model-context/makeAssistantDataUI.d.ts.map +0 -1
- package/dist/model-context/makeAssistantDataUI.js +0 -11
- package/dist/model-context/makeAssistantDataUI.js.map +0 -1
- package/dist/model-context/makeAssistantTool.d.ts +0 -7
- package/dist/model-context/makeAssistantTool.d.ts.map +0 -1
- package/dist/model-context/makeAssistantTool.js +0 -11
- package/dist/model-context/makeAssistantTool.js.map +0 -1
- package/dist/model-context/makeAssistantToolUI.d.ts +0 -7
- package/dist/model-context/makeAssistantToolUI.d.ts.map +0 -1
- package/dist/model-context/makeAssistantToolUI.js +0 -11
- package/dist/model-context/makeAssistantToolUI.js.map +0 -1
- package/dist/model-context/toolbox.d.ts +0 -10
- package/dist/model-context/toolbox.d.ts.map +0 -1
- package/dist/model-context/toolbox.js +0 -3
- package/dist/model-context/toolbox.js.map +0 -1
- package/dist/model-context/useAssistantDataUI.d.ts +0 -7
- package/dist/model-context/useAssistantDataUI.d.ts.map +0 -1
- package/dist/model-context/useAssistantDataUI.js +0 -12
- package/dist/model-context/useAssistantDataUI.js.map +0 -1
- package/dist/model-context/useAssistantInstructions.d.ts +0 -4
- package/dist/model-context/useAssistantInstructions.d.ts.map +0 -1
- package/dist/model-context/useAssistantInstructions.js +0 -23
- package/dist/model-context/useAssistantInstructions.js.map +0 -1
- package/dist/model-context/useAssistantTool.d.ts +0 -7
- package/dist/model-context/useAssistantTool.d.ts.map +0 -1
- package/dist/model-context/useAssistantTool.js +0 -23
- package/dist/model-context/useAssistantTool.js.map +0 -1
- package/dist/model-context/useAssistantToolUI.d.ts +0 -7
- package/dist/model-context/useAssistantToolUI.d.ts.map +0 -1
- package/dist/model-context/useAssistantToolUI.js +0 -12
- package/dist/model-context/useAssistantToolUI.js.map +0 -1
- package/dist/model-context/useInlineRender.d.ts +0 -4
- package/dist/model-context/useInlineRender.d.ts.map +0 -1
- package/dist/model-context/useInlineRender.js +0 -16
- package/dist/model-context/useInlineRender.js.map +0 -1
- package/dist/types/MessagePartComponentTypes.d.ts +0 -33
- package/dist/types/MessagePartComponentTypes.d.ts.map +0 -1
- package/dist/types/MessagePartComponentTypes.js +0 -2
- package/dist/types/MessagePartComponentTypes.js.map +0 -1
- package/dist/types/scopes/dataRenderers.d.ts +0 -13
- package/dist/types/scopes/dataRenderers.d.ts.map +0 -1
- package/dist/types/scopes/dataRenderers.js +0 -2
- package/dist/types/scopes/dataRenderers.js.map +0 -1
- package/dist/types/scopes/tools.d.ts +0 -13
- package/dist/types/scopes/tools.d.ts.map +0 -1
- package/dist/types/scopes/tools.js +0 -2
- package/dist/types/scopes/tools.js.map +0 -1
- package/dist/types/store-augmentation.d.ts +0 -10
- package/dist/types/store-augmentation.d.ts.map +0 -1
- package/dist/types/store-augmentation.js +0 -2
- package/dist/types/store-augmentation.js.map +0 -1
- package/src/client/DataRenderers.ts +0 -42
- package/src/client/Tools.ts +0 -97
- package/src/model-context/makeAssistantDataUI.ts +0 -22
- package/src/model-context/makeAssistantTool.ts +0 -22
- package/src/model-context/makeAssistantToolUI.ts +0 -22
- package/src/model-context/toolbox.ts +0 -17
- package/src/model-context/useAssistantDataUI.ts +0 -18
- package/src/model-context/useAssistantInstructions.ts +0 -32
- package/src/model-context/useAssistantTool.ts +0 -39
- package/src/model-context/useAssistantToolUI.ts +0 -20
- package/src/model-context/useInlineRender.ts +0 -27
- package/src/types/MessagePartComponentTypes.ts +0 -66
- package/src/types/scopes/dataRenderers.ts +0 -15
- package/src/types/scopes/tools.ts +0 -18
- package/src/types/store-augmentation.ts +0 -11
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AACA,YAAY,EACV,UAAU,EACV,iBAAiB,EACjB,kBAAkB,EAClB,gBAAgB,EAChB,aAAa,EACb,eAAe,EACf,oBAAoB,EACpB,iBAAiB,EACjB,gBAAgB,EAChB,eAAe,EACf,eAAe,EACf,yBAAyB,EACzB,mBAAmB,EACnB,aAAa,EACb,iBAAiB,EACjB,yBAAyB,EACzB,aAAa,EACb,qBAAqB,EACrB,0BAA0B,EAC1B,mBAAmB,EACnB,sBAAsB,EACtB,iBAAiB,EACjB,aAAa,EACb,WAAW,EACX,SAAS,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AACA,YAAY,EACV,UAAU,EACV,iBAAiB,EACjB,kBAAkB,EAClB,gBAAgB,EAChB,aAAa,EACb,eAAe,EACf,oBAAoB,EACpB,iBAAiB,EACjB,gBAAgB,EAChB,eAAe,EACf,eAAe,EACf,yBAAyB,EACzB,mBAAmB,EACnB,aAAa,EACb,iBAAiB,EACjB,yBAAyB,EACzB,aAAa,EACb,qBAAqB,EACrB,0BAA0B,EAC1B,mBAAmB,EACnB,sBAAsB,EACtB,iBAAiB,EACjB,aAAa,EACb,WAAW,EACX,SAAS,EACT,gBAAgB,GACjB,MAAM,oBAAoB,CAAC;AAG5B,YAAY,EACV,yBAAyB,EACzB,qBAAqB,EACrB,wBAAwB,EACxB,oBAAoB,EACpB,6BAA6B,EAC7B,yBAAyB,EACzB,0BAA0B,EAC1B,sBAAsB,EACtB,yBAAyB,EACzB,qBAAqB,EACrB,wBAAwB,EACxB,oBAAoB,EACpB,kCAAkC,EAClC,8BAA8B,EAC9B,wBAAwB,EACxB,oBAAoB,EACpB,4BAA4B,EAC5B,wBAAwB,EACxB,mBAAmB,EACnB,uBAAuB,GACxB,MAAM,0BAA0B,CAAC;AAGlC,YAAY,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
export type { ThreadsState, ThreadsMethods, ThreadsClientSchema, ThreadListItemState, ThreadListItemMethods, ThreadListItemMeta, ThreadListItemEvents, ThreadListItemClientSchema, ThreadState, ThreadMethods, ThreadMeta, ThreadEvents, ThreadClientSchema, MessageState, MessageMethods, MessageMeta, MessageClientSchema, PartState, PartMethods, PartMeta, PartClientSchema, ComposerState, ComposerMethods, ComposerMeta, ComposerEvents, ComposerClientSchema, AttachmentState, AttachmentMethods, AttachmentMeta, AttachmentClientSchema, SuggestionsState, SuggestionsMethods, SuggestionsClientSchema, Suggestion, SuggestionState, SuggestionMethods, SuggestionMeta, SuggestionClientSchema, ModelContextState, ModelContextMethods, ModelContextClientSchema, ChainOfThoughtState, ChainOfThoughtMethods, ChainOfThoughtMeta, ChainOfThoughtClientSchema, ChainOfThoughtPart, } from "@assistant-ui/core/store";
|
|
2
|
-
export type { ToolsState, ToolsMethods, ToolsClientSchema } from "
|
|
3
|
-
export type { DataRenderersState, DataRenderersMethods, DataRenderersClientSchema, } from "./dataRenderers.js";
|
|
2
|
+
export type { ToolsState, ToolsMethods, ToolsClientSchema, DataRenderersState, DataRenderersMethods, DataRenderersClientSchema, } from "@assistant-ui/core/react";
|
|
4
3
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/scopes/index.ts"],"names":[],"mappings":"AACA,YAAY,EACV,YAAY,EACZ,cAAc,EACd,mBAAmB,EACnB,mBAAmB,EACnB,qBAAqB,EACrB,kBAAkB,EAClB,oBAAoB,EACpB,0BAA0B,EAC1B,WAAW,EACX,aAAa,EACb,UAAU,EACV,YAAY,EACZ,kBAAkB,EAClB,YAAY,EACZ,cAAc,EACd,WAAW,EACX,mBAAmB,EACnB,SAAS,EACT,WAAW,EACX,QAAQ,EACR,gBAAgB,EAChB,aAAa,EACb,eAAe,EACf,YAAY,EACZ,cAAc,EACd,oBAAoB,EACpB,eAAe,EACf,iBAAiB,EACjB,cAAc,EACd,sBAAsB,EACtB,gBAAgB,EAChB,kBAAkB,EAClB,uBAAuB,EACvB,UAAU,EACV,eAAe,EACf,iBAAiB,EACjB,cAAc,EACd,sBAAsB,EACtB,iBAAiB,EACjB,mBAAmB,EACnB,wBAAwB,EACxB,mBAAmB,EACnB,qBAAqB,EACrB,kBAAkB,EAClB,0BAA0B,EAC1B,kBAAkB,GACnB,MAAM,0BAA0B,CAAC;AAGlC,YAAY,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/scopes/index.ts"],"names":[],"mappings":"AACA,YAAY,EACV,YAAY,EACZ,cAAc,EACd,mBAAmB,EACnB,mBAAmB,EACnB,qBAAqB,EACrB,kBAAkB,EAClB,oBAAoB,EACpB,0BAA0B,EAC1B,WAAW,EACX,aAAa,EACb,UAAU,EACV,YAAY,EACZ,kBAAkB,EAClB,YAAY,EACZ,cAAc,EACd,WAAW,EACX,mBAAmB,EACnB,SAAS,EACT,WAAW,EACX,QAAQ,EACR,gBAAgB,EAChB,aAAa,EACb,eAAe,EACf,YAAY,EACZ,cAAc,EACd,oBAAoB,EACpB,eAAe,EACf,iBAAiB,EACjB,cAAc,EACd,sBAAsB,EACtB,gBAAgB,EAChB,kBAAkB,EAClB,uBAAuB,EACvB,UAAU,EACV,eAAe,EACf,iBAAiB,EACjB,cAAc,EACd,sBAAsB,EACtB,iBAAiB,EACjB,mBAAmB,EACnB,wBAAwB,EACxB,mBAAmB,EACnB,qBAAqB,EACrB,kBAAkB,EAClB,0BAA0B,EAC1B,kBAAkB,GACnB,MAAM,0BAA0B,CAAC;AAGlC,YAAY,EACV,UAAU,EACV,YAAY,EACZ,iBAAiB,EACjB,kBAAkB,EAClB,oBAAoB,EACpB,yBAAyB,GAC1B,MAAM,0BAA0B,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@assistant-ui/react",
|
|
3
|
-
"version": "0.12.
|
|
3
|
+
"version": "0.12.12",
|
|
4
4
|
"description": "TypeScript/React library for AI Chat",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"radix-ui",
|
|
@@ -49,20 +49,18 @@
|
|
|
49
49
|
],
|
|
50
50
|
"sideEffects": false,
|
|
51
51
|
"dependencies": {
|
|
52
|
-
"assistant-cloud": "^0.1.
|
|
53
|
-
"@assistant-ui/core": "^0.1.
|
|
54
|
-
"@assistant-ui/tap": "^0.5.
|
|
55
|
-
"@assistant-ui/store": "^0.2.
|
|
52
|
+
"assistant-cloud": "^0.1.19",
|
|
53
|
+
"@assistant-ui/core": "^0.1.1",
|
|
54
|
+
"@assistant-ui/tap": "^0.5.1",
|
|
55
|
+
"@assistant-ui/store": "^0.2.1",
|
|
56
56
|
"@radix-ui/primitive": "^1.1.3",
|
|
57
57
|
"@radix-ui/react-compose-refs": "^1.1.2",
|
|
58
58
|
"@radix-ui/react-context": "^1.1.3",
|
|
59
|
-
"@radix-ui/react-dropdown-menu": "^2.1.16",
|
|
60
|
-
"@radix-ui/react-popover": "^1.1.15",
|
|
61
59
|
"@radix-ui/react-primitive": "^2.1.4",
|
|
62
|
-
"@radix-ui/react-slot": "^1.2.4",
|
|
63
60
|
"@radix-ui/react-use-callback-ref": "^1.1.1",
|
|
64
61
|
"@radix-ui/react-use-escape-keydown": "^1.1.1",
|
|
65
|
-
"
|
|
62
|
+
"radix-ui": "^1.4.3",
|
|
63
|
+
"assistant-stream": "^0.3.4",
|
|
66
64
|
"nanoid": "^5.1.6",
|
|
67
65
|
"react-textarea-autosize": "^8.5.9",
|
|
68
66
|
"zod": "^4.3.6",
|
|
@@ -85,10 +83,10 @@
|
|
|
85
83
|
"devDependencies": {
|
|
86
84
|
"@testing-library/react": "^16.3.2",
|
|
87
85
|
"@types/json-schema": "^7.0.15",
|
|
88
|
-
"@types/node": "^25.
|
|
89
|
-
"@types/react": "^19.2.
|
|
86
|
+
"@types/node": "^25.3.0",
|
|
87
|
+
"@types/react": "^19.2.14",
|
|
90
88
|
"@types/react-dom": "^19.2.3",
|
|
91
|
-
"jsdom": "^28.
|
|
89
|
+
"jsdom": "^28.1.0",
|
|
92
90
|
"react": "^19.2.4",
|
|
93
91
|
"react-dom": "^19.2.4",
|
|
94
92
|
"vitest": "^4.0.18",
|
|
@@ -15,13 +15,13 @@ import {
|
|
|
15
15
|
import { withKey } from "@assistant-ui/tap";
|
|
16
16
|
import type {
|
|
17
17
|
Attachment,
|
|
18
|
+
CreateAttachment,
|
|
18
19
|
ThreadAssistantMessagePart,
|
|
19
20
|
ThreadUserMessagePart,
|
|
20
21
|
ThreadMessage,
|
|
21
22
|
} from "@assistant-ui/core";
|
|
22
23
|
import { ModelContext, Suggestions } from "@assistant-ui/core/store";
|
|
23
|
-
import { Tools } from "
|
|
24
|
-
import { DataRenderers } from "./DataRenderers";
|
|
24
|
+
import { Tools, DataRenderers } from "@assistant-ui/core/react";
|
|
25
25
|
|
|
26
26
|
export type ExternalThreadMessage = ThreadMessage & {
|
|
27
27
|
id: string;
|
|
@@ -308,17 +308,29 @@ const ComposerClientResource = resource(
|
|
|
308
308
|
setText,
|
|
309
309
|
setRole,
|
|
310
310
|
setRunConfig,
|
|
311
|
-
addAttachment: async (
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
311
|
+
addAttachment: async (fileOrAttachment: File | CreateAttachment) => {
|
|
312
|
+
if (fileOrAttachment instanceof File) {
|
|
313
|
+
const newAttachment: Attachment = {
|
|
314
|
+
id: Math.random().toString(36).substring(7),
|
|
315
|
+
type: "file",
|
|
316
|
+
name: fileOrAttachment.name,
|
|
317
|
+
contentType: fileOrAttachment.type,
|
|
318
|
+
file: fileOrAttachment,
|
|
319
|
+
status: { type: "complete" },
|
|
320
|
+
content: [],
|
|
321
|
+
};
|
|
322
|
+
setAttachments([...attachments, newAttachment]);
|
|
323
|
+
} else {
|
|
324
|
+
const newAttachment: Attachment = {
|
|
325
|
+
id: fileOrAttachment.id ?? Math.random().toString(36).substring(7),
|
|
326
|
+
type: fileOrAttachment.type ?? "document",
|
|
327
|
+
name: fileOrAttachment.name,
|
|
328
|
+
contentType: fileOrAttachment.contentType,
|
|
329
|
+
content: fileOrAttachment.content,
|
|
330
|
+
status: { type: "complete" },
|
|
331
|
+
};
|
|
332
|
+
setAttachments([...attachments, newAttachment]);
|
|
333
|
+
}
|
|
322
334
|
},
|
|
323
335
|
clearAttachments: async () => {
|
|
324
336
|
setAttachments([]);
|
|
@@ -10,8 +10,7 @@ import { withKey } from "@assistant-ui/tap";
|
|
|
10
10
|
import type { ResourceElement } from "@assistant-ui/tap";
|
|
11
11
|
|
|
12
12
|
import { ModelContext, Suggestions } from "@assistant-ui/core/store";
|
|
13
|
-
import { Tools } from "
|
|
14
|
-
import { DataRenderers } from "./DataRenderers";
|
|
13
|
+
import { Tools, DataRenderers } from "@assistant-ui/core/react";
|
|
15
14
|
|
|
16
15
|
export type InMemoryThreadListProps = {
|
|
17
16
|
thread: (threadId: string) => ResourceElement<ClientOutput<"thread">>;
|
package/src/client/index.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
+
// Re-export shared clients from core/react
|
|
2
|
+
export { Tools, DataRenderers } from "@assistant-ui/core/react";
|
|
3
|
+
|
|
1
4
|
// Re-export moved clients from core (matching previous public API)
|
|
2
5
|
export { ModelContext as ModelContextClient } from "@assistant-ui/core/store";
|
|
3
6
|
export { Suggestions, type SuggestionConfig } from "@assistant-ui/core/store";
|
|
4
7
|
export { ChainOfThoughtClient } from "@assistant-ui/core/store";
|
|
5
8
|
|
|
6
9
|
// Local clients (React-specific)
|
|
7
|
-
export { Tools } from "./Tools";
|
|
8
|
-
export { DataRenderers } from "./DataRenderers";
|
|
9
10
|
export {
|
|
10
11
|
ExternalThread,
|
|
11
12
|
type ExternalThreadProps,
|
|
@@ -1,36 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
PropsWithChildren<{
|
|
8
|
-
index: number;
|
|
9
|
-
}>
|
|
10
|
-
> = ({ index, children }) => {
|
|
11
|
-
const aui = useAui({
|
|
12
|
-
attachment: Derived({
|
|
13
|
-
source: "message",
|
|
14
|
-
query: { type: "index", index },
|
|
15
|
-
get: (aui) => aui.message().attachment({ index }),
|
|
16
|
-
}),
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
return <AuiProvider value={aui}>{children}</AuiProvider>;
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
export const ComposerAttachmentByIndexProvider: FC<
|
|
23
|
-
PropsWithChildren<{
|
|
24
|
-
index: number;
|
|
25
|
-
}>
|
|
26
|
-
> = ({ index, children }) => {
|
|
27
|
-
const aui = useAui({
|
|
28
|
-
attachment: Derived({
|
|
29
|
-
source: "composer",
|
|
30
|
-
query: { type: "index", index },
|
|
31
|
-
get: (aui) => aui.composer().attachment({ index }),
|
|
32
|
-
}),
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
return <AuiProvider value={aui}>{children}</AuiProvider>;
|
|
36
|
-
};
|
|
3
|
+
export {
|
|
4
|
+
MessageAttachmentByIndexProvider,
|
|
5
|
+
ComposerAttachmentByIndexProvider,
|
|
6
|
+
} from "@assistant-ui/core/react";
|
|
@@ -1,36 +1,3 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
import { useAui, useAuiState, AuiProvider } from "@assistant-ui/store";
|
|
5
|
-
import { ChainOfThoughtClient } from "@assistant-ui/core/store";
|
|
6
|
-
import type { ChainOfThoughtPart } from "@assistant-ui/core/store";
|
|
7
|
-
|
|
8
|
-
export const ChainOfThoughtByIndicesProvider: FC<
|
|
9
|
-
PropsWithChildren<{
|
|
10
|
-
startIndex: number;
|
|
11
|
-
endIndex: number;
|
|
12
|
-
}>
|
|
13
|
-
> = ({ startIndex, endIndex, children }) => {
|
|
14
|
-
const parts = useAuiState((s) => s.message.parts).slice(
|
|
15
|
-
startIndex,
|
|
16
|
-
endIndex + 1,
|
|
17
|
-
) as ChainOfThoughtPart[];
|
|
18
|
-
|
|
19
|
-
const parentAui = useAui();
|
|
20
|
-
|
|
21
|
-
const aui = useAui({
|
|
22
|
-
chainOfThought: ChainOfThoughtClient({
|
|
23
|
-
parts,
|
|
24
|
-
getMessagePart: ({ index }) => {
|
|
25
|
-
if (index < 0 || index >= parts.length) {
|
|
26
|
-
throw new Error(
|
|
27
|
-
`ChainOfThought part index ${index} is out of bounds (0..${parts.length - 1})`,
|
|
28
|
-
);
|
|
29
|
-
}
|
|
30
|
-
return parentAui.message().part({ index: startIndex + index });
|
|
31
|
-
},
|
|
32
|
-
}),
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
return <AuiProvider value={aui}>{children}</AuiProvider>;
|
|
36
|
-
};
|
|
3
|
+
export { ChainOfThoughtByIndicesProvider } from "@assistant-ui/core/react";
|
|
@@ -1,20 +1,3 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
import { useAui, AuiProvider, Derived } from "@assistant-ui/store";
|
|
5
|
-
|
|
6
|
-
export const ChainOfThoughtPartByIndexProvider: FC<
|
|
7
|
-
PropsWithChildren<{
|
|
8
|
-
index: number;
|
|
9
|
-
}>
|
|
10
|
-
> = ({ index, children }) => {
|
|
11
|
-
const aui = useAui({
|
|
12
|
-
part: Derived({
|
|
13
|
-
source: "chainOfThought",
|
|
14
|
-
query: { type: "index", index },
|
|
15
|
-
get: (aui) => aui.chainOfThought().part({ index }),
|
|
16
|
-
}),
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
return <AuiProvider value={aui}>{children}</AuiProvider>;
|
|
20
|
-
};
|
|
3
|
+
export { ChainOfThoughtPartByIndexProvider } from "@assistant-ui/core/react";
|
|
@@ -1,25 +1,3 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
import { useAui, AuiProvider, Derived } from "@assistant-ui/store";
|
|
5
|
-
|
|
6
|
-
export const MessageByIndexProvider: FC<
|
|
7
|
-
PropsWithChildren<{
|
|
8
|
-
index: number;
|
|
9
|
-
}>
|
|
10
|
-
> = ({ index, children }) => {
|
|
11
|
-
const aui = useAui({
|
|
12
|
-
message: Derived({
|
|
13
|
-
source: "thread",
|
|
14
|
-
query: { type: "index", index },
|
|
15
|
-
get: (aui) => aui.thread().message({ index }),
|
|
16
|
-
}),
|
|
17
|
-
composer: Derived({
|
|
18
|
-
source: "message",
|
|
19
|
-
query: {},
|
|
20
|
-
get: (aui) => aui.thread().message({ index }).composer(),
|
|
21
|
-
}),
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
return <AuiProvider value={aui}>{children}</AuiProvider>;
|
|
25
|
-
};
|
|
3
|
+
export { MessageByIndexProvider } from "@assistant-ui/core/react";
|
|
@@ -1,20 +1,3 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
import { useAui, AuiProvider, Derived } from "@assistant-ui/store";
|
|
5
|
-
|
|
6
|
-
export const PartByIndexProvider: FC<
|
|
7
|
-
PropsWithChildren<{
|
|
8
|
-
index: number;
|
|
9
|
-
}>
|
|
10
|
-
> = ({ index, children }) => {
|
|
11
|
-
const aui = useAui({
|
|
12
|
-
part: Derived({
|
|
13
|
-
source: "message",
|
|
14
|
-
query: { type: "index", index },
|
|
15
|
-
get: (aui) => aui.message().part({ index }),
|
|
16
|
-
}),
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
return <AuiProvider value={aui}>{children}</AuiProvider>;
|
|
20
|
-
};
|
|
3
|
+
export { PartByIndexProvider } from "@assistant-ui/core/react";
|
|
@@ -1,23 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
index: number;
|
|
8
|
-
}>;
|
|
9
|
-
|
|
10
|
-
export const SuggestionByIndexProvider: FC<SuggestionByIndexProviderProps> = ({
|
|
11
|
-
index,
|
|
12
|
-
children,
|
|
13
|
-
}) => {
|
|
14
|
-
const aui = useAui({
|
|
15
|
-
suggestion: Derived({
|
|
16
|
-
source: "suggestions",
|
|
17
|
-
query: { index },
|
|
18
|
-
get: (aui) => aui.suggestions().suggestion({ index }),
|
|
19
|
-
}),
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
return <AuiProvider value={aui}>{children}</AuiProvider>;
|
|
23
|
-
};
|
|
3
|
+
export {
|
|
4
|
+
SuggestionByIndexProvider,
|
|
5
|
+
type SuggestionByIndexProviderProps,
|
|
6
|
+
} from "@assistant-ui/core/react";
|
|
@@ -1,48 +1,3 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
import { useAui, AuiProvider, type ClientOutput } from "@assistant-ui/store";
|
|
5
|
-
import { PartState } from "../../types/scopes";
|
|
6
|
-
import { resource, tapMemo } from "@assistant-ui/tap";
|
|
7
|
-
|
|
8
|
-
const TextMessagePartClient = resource(
|
|
9
|
-
({
|
|
10
|
-
text,
|
|
11
|
-
isRunning,
|
|
12
|
-
}: {
|
|
13
|
-
text: string;
|
|
14
|
-
isRunning: boolean;
|
|
15
|
-
}): ClientOutput<"part"> => {
|
|
16
|
-
const state = tapMemo<PartState>(
|
|
17
|
-
() => ({
|
|
18
|
-
type: "text",
|
|
19
|
-
text,
|
|
20
|
-
status: isRunning ? { type: "running" } : { type: "complete" },
|
|
21
|
-
}),
|
|
22
|
-
[text, isRunning],
|
|
23
|
-
);
|
|
24
|
-
|
|
25
|
-
return {
|
|
26
|
-
getState: () => state,
|
|
27
|
-
addToolResult: () => {
|
|
28
|
-
throw new Error("Not supported");
|
|
29
|
-
},
|
|
30
|
-
resumeToolCall: () => {
|
|
31
|
-
throw new Error("Not supported");
|
|
32
|
-
},
|
|
33
|
-
};
|
|
34
|
-
},
|
|
35
|
-
);
|
|
36
|
-
|
|
37
|
-
export const TextMessagePartProvider: FC<
|
|
38
|
-
PropsWithChildren<{
|
|
39
|
-
text: string;
|
|
40
|
-
isRunning?: boolean;
|
|
41
|
-
}>
|
|
42
|
-
> = ({ text, isRunning = false, children }) => {
|
|
43
|
-
const aui = useAui({
|
|
44
|
-
part: TextMessagePartClient({ text, isRunning }),
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
return <AuiProvider value={aui}>{children}</AuiProvider>;
|
|
48
|
-
};
|
|
3
|
+
export { TextMessagePartProvider } from "@assistant-ui/core/react";
|
|
@@ -1,35 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
export const ThreadListItemByIndexProvider: FC<
|
|
9
|
-
PropsWithChildren<{
|
|
10
|
-
index: number;
|
|
11
|
-
archived: boolean;
|
|
12
|
-
}>
|
|
13
|
-
> = ({ index, archived, children }) => {
|
|
14
|
-
const aui = useAui({
|
|
15
|
-
threadListItem: Derived({
|
|
16
|
-
source: "threads",
|
|
17
|
-
query: { type: "index", index, archived },
|
|
18
|
-
get: (aui) => aui.threads().item({ index, archived }),
|
|
19
|
-
}),
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
return <AuiProvider value={aui}>{children}</AuiProvider>;
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
export const ThreadListItemRuntimeProvider: FC<
|
|
26
|
-
PropsWithChildren<{
|
|
27
|
-
runtime: ThreadListItemRuntime;
|
|
28
|
-
}>
|
|
29
|
-
> = ({ runtime, children }) => {
|
|
30
|
-
const aui = useAui({
|
|
31
|
-
threadListItem: ThreadListItemClient({ runtime }),
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
return <AuiProvider value={aui}>{children}</AuiProvider>;
|
|
35
|
-
};
|
|
3
|
+
export {
|
|
4
|
+
ThreadListItemByIndexProvider,
|
|
5
|
+
ThreadListItemRuntimeProvider,
|
|
6
|
+
} from "@assistant-ui/core/react";
|
package/src/index.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { FC, memo, PropsWithChildren, useEffect } from "react";
|
|
4
|
+
import { AssistantClient, useAui } from "@assistant-ui/store";
|
|
5
5
|
import { AssistantRuntime } from "./runtime/AssistantRuntime";
|
|
6
|
-
import {
|
|
7
|
-
import { RuntimeAdapter } from "./RuntimeAdapter";
|
|
6
|
+
import { AssistantProviderBase } from "@assistant-ui/core/react";
|
|
8
7
|
import { ThreadPrimitiveViewportProvider } from "../context/providers/ThreadViewportProvider";
|
|
9
8
|
import { DevToolsProviderApi } from "../devtools";
|
|
10
9
|
|
|
@@ -22,35 +21,28 @@ export namespace AssistantRuntimeProvider {
|
|
|
22
21
|
}>;
|
|
23
22
|
}
|
|
24
23
|
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
| ComponentType
|
|
28
|
-
| undefined;
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
export const AssistantRuntimeProviderImpl: FC<
|
|
32
|
-
AssistantRuntimeProvider.Props
|
|
33
|
-
> = ({ children, aui: parent = null, runtime }) => {
|
|
34
|
-
const aui = useAui({ threads: RuntimeAdapter(runtime) }, { parent: parent });
|
|
35
|
-
|
|
24
|
+
const DevToolsRegistration: FC = () => {
|
|
25
|
+
const aui = useAui();
|
|
36
26
|
useEffect(() => {
|
|
37
27
|
if (typeof process === "undefined" || process.env.NODE_ENV === "production")
|
|
38
28
|
return;
|
|
39
29
|
return DevToolsProviderApi.register(aui);
|
|
40
30
|
}, [aui]);
|
|
31
|
+
return null;
|
|
32
|
+
};
|
|
41
33
|
|
|
42
|
-
|
|
43
|
-
|
|
34
|
+
export const AssistantRuntimeProviderImpl: FC<
|
|
35
|
+
AssistantRuntimeProvider.Props
|
|
36
|
+
> = ({ children, aui, runtime }) => {
|
|
44
37
|
return (
|
|
45
|
-
<
|
|
46
|
-
|
|
47
|
-
|
|
38
|
+
<AssistantProviderBase runtime={runtime} aui={aui ?? null}>
|
|
39
|
+
<DevToolsRegistration />
|
|
48
40
|
{/* TODO temporarily allow accessing viewport state from outside the viewport */}
|
|
49
41
|
{/* TODO figure out if this behavior should be deprecated, since it is quite hacky */}
|
|
50
42
|
<ThreadPrimitiveViewportProvider>
|
|
51
43
|
{children}
|
|
52
44
|
</ThreadPrimitiveViewportProvider>
|
|
53
|
-
</
|
|
45
|
+
</AssistantProviderBase>
|
|
54
46
|
);
|
|
55
47
|
};
|
|
56
48
|
|
|
@@ -1,66 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import type { AssistantRuntime } from "./runtime/AssistantRuntime";
|
|
3
|
-
import { ThreadListClient } from "@assistant-ui/core/store/internal";
|
|
4
|
-
import {
|
|
5
|
-
tapAssistantClientRef,
|
|
6
|
-
Derived,
|
|
7
|
-
attachTransformScopes,
|
|
8
|
-
} from "@assistant-ui/store";
|
|
9
|
-
import { ModelContext } from "@assistant-ui/core/store";
|
|
10
|
-
import { Tools, Suggestions } from "../model-context";
|
|
11
|
-
|
|
12
|
-
export const RuntimeAdapter = resource((runtime: AssistantRuntime) => {
|
|
13
|
-
const clientRef = tapAssistantClientRef();
|
|
14
|
-
|
|
15
|
-
tapEffect(() => {
|
|
16
|
-
return runtime.registerModelContextProvider(
|
|
17
|
-
clientRef.current!.modelContext(),
|
|
18
|
-
);
|
|
19
|
-
}, [runtime, clientRef]);
|
|
20
|
-
|
|
21
|
-
return tapResource(
|
|
22
|
-
ThreadListClient({
|
|
23
|
-
runtime: runtime.threads,
|
|
24
|
-
__internal_assistantRuntime: runtime,
|
|
25
|
-
}),
|
|
26
|
-
);
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
attachTransformScopes(RuntimeAdapter, (scopes, parent) => {
|
|
30
|
-
const result = {
|
|
31
|
-
...scopes,
|
|
32
|
-
thread:
|
|
33
|
-
scopes.thread ??
|
|
34
|
-
Derived({
|
|
35
|
-
source: "threads",
|
|
36
|
-
query: { type: "main" },
|
|
37
|
-
get: (aui) => aui.threads().thread("main"),
|
|
38
|
-
}),
|
|
39
|
-
threadListItem:
|
|
40
|
-
scopes.threadListItem ??
|
|
41
|
-
Derived({
|
|
42
|
-
source: "threads",
|
|
43
|
-
query: { type: "main" },
|
|
44
|
-
get: (aui) => aui.threads().item("main"),
|
|
45
|
-
}),
|
|
46
|
-
composer:
|
|
47
|
-
scopes.composer ??
|
|
48
|
-
Derived({
|
|
49
|
-
source: "thread",
|
|
50
|
-
query: {},
|
|
51
|
-
get: (aui) => aui.threads().thread("main").composer(),
|
|
52
|
-
}),
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
if (!result.modelContext && parent.modelContext.source === null) {
|
|
56
|
-
result.modelContext = ModelContext();
|
|
57
|
-
}
|
|
58
|
-
if (!result.tools && parent.tools.source === null) {
|
|
59
|
-
result.tools = Tools({});
|
|
60
|
-
}
|
|
61
|
-
if (!result.suggestions && parent.suggestions.source === null) {
|
|
62
|
-
result.suggestions = Suggestions();
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
return result;
|
|
66
|
-
});
|
|
1
|
+
export { RuntimeAdapter } from "@assistant-ui/core/react";
|
|
@@ -83,6 +83,16 @@ export type HeadersValue = Record<string, string> | Headers;
|
|
|
83
83
|
|
|
84
84
|
export type AssistantTransportProtocol = "data-stream" | "assistant-transport";
|
|
85
85
|
|
|
86
|
+
export type SendCommandsRequestBody = {
|
|
87
|
+
commands: QueuedCommand[];
|
|
88
|
+
state: unknown;
|
|
89
|
+
system: string | undefined;
|
|
90
|
+
tools: Record<string, unknown> | undefined;
|
|
91
|
+
threadId: string | null;
|
|
92
|
+
parentId?: string | null;
|
|
93
|
+
[key: string]: unknown;
|
|
94
|
+
};
|
|
95
|
+
|
|
86
96
|
export type AssistantTransportOptions<T> = {
|
|
87
97
|
initialState: T;
|
|
88
98
|
api: string;
|
|
@@ -91,6 +101,21 @@ export type AssistantTransportOptions<T> = {
|
|
|
91
101
|
converter: AssistantTransportStateConverter<T>;
|
|
92
102
|
headers: HeadersValue | (() => Promise<HeadersValue>);
|
|
93
103
|
body?: object | (() => Promise<object | undefined>);
|
|
104
|
+
/**
|
|
105
|
+
* Transform the request body before it is sent to the API.
|
|
106
|
+
* Receives the fully assembled body and returns the (potentially transformed) body.
|
|
107
|
+
*
|
|
108
|
+
* @example
|
|
109
|
+
* ```ts
|
|
110
|
+
* prepareSendCommandsRequest: (body) => ({
|
|
111
|
+
* ...body,
|
|
112
|
+
* trackingId: crypto.randomUUID(),
|
|
113
|
+
* })
|
|
114
|
+
* ```
|
|
115
|
+
*/
|
|
116
|
+
prepareSendCommandsRequest?: (
|
|
117
|
+
body: SendCommandsRequestBody,
|
|
118
|
+
) => Record<string, unknown> | Promise<Record<string, unknown>>;
|
|
94
119
|
onResponse?: (response: Response) => void;
|
|
95
120
|
onFinish?: () => void;
|
|
96
121
|
onError?: (
|