@assistant-ui/core 0.2.12 → 0.2.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/adapters/attachment.js.map +1 -1
- package/dist/adapters/directive-formatter.js.map +1 -1
- package/dist/adapters/speech.js.map +1 -1
- package/dist/adapters/thread-history.d.ts +3 -1
- package/dist/adapters/thread-history.d.ts.map +1 -1
- package/dist/adapters/voice.js.map +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.js.map +1 -1
- package/dist/internal/duplicate-detection.js.map +1 -1
- package/dist/internal.d.ts +2 -1
- package/dist/internal.js +2 -1
- package/dist/model-context/frame/host.js.map +1 -1
- package/dist/model-context/frame/provider.js.map +1 -1
- package/dist/model-context/frame/types.js.map +1 -1
- package/dist/model-context/registry.js.map +1 -1
- package/dist/model-context/tool.js.map +1 -1
- package/dist/model-context/types.d.ts +1 -0
- package/dist/model-context/types.d.ts.map +1 -1
- package/dist/model-context/types.js.map +1 -1
- package/dist/react/AssistantProvider.js +7 -1
- package/dist/react/AssistantProvider.js.map +1 -1
- package/dist/react/AssistantRuntimeProvider.js +18 -6
- package/dist/react/AssistantRuntimeProvider.js.map +1 -1
- package/dist/react/RuntimeAdapter.d.ts +1 -1
- package/dist/react/RuntimeAdapter.d.ts.map +1 -1
- package/dist/react/RuntimeAdapter.js +35 -6
- package/dist/react/RuntimeAdapter.js.map +1 -1
- package/dist/react/adapters/LocalStorageThreadListAdapter.js +29 -7
- package/dist/react/adapters/LocalStorageThreadListAdapter.js.map +1 -1
- package/dist/react/adapters/TitleGenerationAdapter.js.map +1 -1
- package/dist/react/client/DataRenderers.d.ts +1 -8
- package/dist/react/client/DataRenderers.d.ts.map +1 -1
- package/dist/react/client/DataRenderers.js +56 -36
- package/dist/react/client/DataRenderers.js.map +1 -1
- package/dist/react/client/Interactables.d.ts +1 -1
- package/dist/react/client/Interactables.d.ts.map +1 -1
- package/dist/react/client/Interactables.js +71 -70
- package/dist/react/client/Interactables.js.map +1 -1
- package/dist/react/client/Tools.d.ts +2 -13
- package/dist/react/client/Tools.d.ts.map +1 -1
- package/dist/react/client/Tools.js +121 -57
- package/dist/react/client/Tools.js.map +1 -1
- package/dist/react/client/interactable-model-context.js.map +1 -1
- package/dist/react/model-context/define-mcp-toolkit.js.map +1 -1
- package/dist/react/model-context/define-toolkit.js.map +1 -1
- package/dist/react/model-context/external-tool.js.map +1 -1
- package/dist/react/model-context/human-tool.js.map +1 -1
- package/dist/react/model-context/makeAssistantDataUI.js.map +1 -1
- package/dist/react/model-context/makeAssistantTool.js.map +1 -1
- package/dist/react/model-context/makeAssistantToolUI.js.map +1 -1
- package/dist/react/model-context/provider-tool.js.map +1 -1
- package/dist/react/model-context/stub-tool.js.map +1 -1
- package/dist/react/model-context/toolbox.js.map +1 -1
- package/dist/react/model-context/useAssistantContext.js.map +1 -1
- package/dist/react/model-context/useAssistantDataUI.js +27 -8
- package/dist/react/model-context/useAssistantDataUI.js.map +1 -1
- package/dist/react/model-context/useAssistantInstructions.js +33 -10
- package/dist/react/model-context/useAssistantInstructions.js.map +1 -1
- package/dist/react/model-context/useAssistantInteractable.js.map +1 -1
- package/dist/react/model-context/useAssistantTool.js +59 -17
- package/dist/react/model-context/useAssistantTool.js.map +1 -1
- package/dist/react/model-context/useAssistantToolUI.js +30 -9
- package/dist/react/model-context/useAssistantToolUI.js.map +1 -1
- package/dist/react/model-context/useAuiToolOverrides.js.map +1 -1
- package/dist/react/model-context/useInlineRender.js +35 -8
- package/dist/react/model-context/useInlineRender.js.map +1 -1
- package/dist/react/model-context/useInteractableState.js +65 -19
- package/dist/react/model-context/useInteractableState.js.map +1 -1
- package/dist/react/model-context/useToolArgsStatus.js +42 -14
- package/dist/react/model-context/useToolArgsStatus.js.map +1 -1
- package/dist/react/primitive-hooks/useActionBarCopy.js +59 -22
- package/dist/react/primitive-hooks/useActionBarCopy.js.map +1 -1
- package/dist/react/primitive-hooks/useActionBarEdit.js +25 -7
- package/dist/react/primitive-hooks/useActionBarEdit.js.map +1 -1
- package/dist/react/primitive-hooks/useActionBarFeedback.js +49 -13
- package/dist/react/primitive-hooks/useActionBarFeedback.js.map +1 -1
- package/dist/react/primitive-hooks/useActionBarReload.js +25 -7
- package/dist/react/primitive-hooks/useActionBarReload.js.map +1 -1
- package/dist/react/primitive-hooks/useActionBarSpeak.js +28 -9
- package/dist/react/primitive-hooks/useActionBarSpeak.js.map +1 -1
- package/dist/react/primitive-hooks/useActionBarStopSpeaking.js +25 -7
- package/dist/react/primitive-hooks/useActionBarStopSpeaking.js.map +1 -1
- package/dist/react/primitive-hooks/useBranchPickerNext.js +27 -11
- package/dist/react/primitive-hooks/useBranchPickerNext.js.map +1 -1
- package/dist/react/primitive-hooks/useBranchPickerPrevious.js +27 -11
- package/dist/react/primitive-hooks/useBranchPickerPrevious.js.map +1 -1
- package/dist/react/primitive-hooks/useComposerAddAttachment.js +24 -8
- package/dist/react/primitive-hooks/useComposerAddAttachment.js.map +1 -1
- package/dist/react/primitive-hooks/useComposerCancel.js +25 -7
- package/dist/react/primitive-hooks/useComposerCancel.js.map +1 -1
- package/dist/react/primitive-hooks/useComposerDictate.js +25 -7
- package/dist/react/primitive-hooks/useComposerDictate.js.map +1 -1
- package/dist/react/primitive-hooks/useComposerSend.js +25 -7
- package/dist/react/primitive-hooks/useComposerSend.js.map +1 -1
- package/dist/react/primitive-hooks/useEditComposerCancel.js +18 -4
- package/dist/react/primitive-hooks/useEditComposerCancel.js.map +1 -1
- package/dist/react/primitive-hooks/useEditComposerSend.js +25 -7
- package/dist/react/primitive-hooks/useEditComposerSend.js.map +1 -1
- package/dist/react/primitive-hooks/useMessageBranching.js +41 -9
- package/dist/react/primitive-hooks/useMessageBranching.js.map +1 -1
- package/dist/react/primitive-hooks/useMessageError.js +4 -1
- package/dist/react/primitive-hooks/useMessageError.js.map +1 -1
- package/dist/react/primitive-hooks/useMessageReload.js +25 -7
- package/dist/react/primitive-hooks/useMessageReload.js.map +1 -1
- package/dist/react/primitive-hooks/useSuggestionTrigger.js +31 -13
- package/dist/react/primitive-hooks/useSuggestionTrigger.js.map +1 -1
- package/dist/react/primitive-hooks/useThreadIsEmpty.js +4 -1
- package/dist/react/primitive-hooks/useThreadIsEmpty.js.map +1 -1
- package/dist/react/primitive-hooks/useThreadIsRunning.js +4 -1
- package/dist/react/primitive-hooks/useThreadIsRunning.js.map +1 -1
- package/dist/react/primitive-hooks/useThreadListItemArchive.js +18 -4
- package/dist/react/primitive-hooks/useThreadListItemArchive.js.map +1 -1
- package/dist/react/primitive-hooks/useThreadListItemDelete.js +18 -4
- package/dist/react/primitive-hooks/useThreadListItemDelete.js.map +1 -1
- package/dist/react/primitive-hooks/useThreadListItemTrigger.js +18 -4
- package/dist/react/primitive-hooks/useThreadListItemTrigger.js.map +1 -1
- package/dist/react/primitive-hooks/useThreadListItemUnarchive.js +18 -4
- package/dist/react/primitive-hooks/useThreadListItemUnarchive.js.map +1 -1
- package/dist/react/primitive-hooks/useThreadListLoadMore.js +25 -7
- package/dist/react/primitive-hooks/useThreadListLoadMore.js.map +1 -1
- package/dist/react/primitive-hooks/useThreadListNew.js +18 -4
- package/dist/react/primitive-hooks/useThreadListNew.js.map +1 -1
- package/dist/react/primitive-hooks/useThreadMessages.js +4 -1
- package/dist/react/primitive-hooks/useThreadMessages.js.map +1 -1
- package/dist/react/primitive-hooks/useVoice.js +63 -13
- package/dist/react/primitive-hooks/useVoice.js.map +1 -1
- package/dist/react/primitives/chainOfThought/ChainOfThoughtParts.js +42 -7
- package/dist/react/primitives/chainOfThought/ChainOfThoughtParts.js.map +1 -1
- package/dist/react/primitives/composer/ComposerAttachments.js +67 -16
- package/dist/react/primitives/composer/ComposerAttachments.js.map +1 -1
- package/dist/react/primitives/composer/ComposerIf.js +30 -9
- package/dist/react/primitives/composer/ComposerIf.js.map +1 -1
- package/dist/react/primitives/composer/ComposerQueue.js.map +1 -1
- package/dist/react/primitives/generativeUI/GenerativeUI.js +55 -13
- package/dist/react/primitives/generativeUI/GenerativeUI.js.map +1 -1
- package/dist/react/primitives/message/MessageAttachments.js +68 -16
- package/dist/react/primitives/message/MessageAttachments.js.map +1 -1
- package/dist/react/primitives/message/MessageGroupedParts.d.ts +3 -2
- package/dist/react/primitives/message/MessageGroupedParts.d.ts.map +1 -1
- package/dist/react/primitives/message/MessageGroupedParts.js +6 -6
- package/dist/react/primitives/message/MessageGroupedParts.js.map +1 -1
- package/dist/react/primitives/message/MessageParts.d.ts +28 -1
- package/dist/react/primitives/message/MessageParts.d.ts.map +1 -1
- package/dist/react/primitives/message/MessageParts.js +665 -163
- package/dist/react/primitives/message/MessageParts.js.map +1 -1
- package/dist/react/primitives/message/MessageQuote.js +18 -2
- package/dist/react/primitives/message/MessageQuote.js.map +1 -1
- package/dist/react/primitives/messagePart/MessagePartInProgress.js +6 -2
- package/dist/react/primitives/messagePart/MessagePartInProgress.js.map +1 -1
- package/dist/react/primitives/part/PartMessages.js +46 -14
- package/dist/react/primitives/part/PartMessages.js.map +1 -1
- package/dist/react/primitives/thread/ThreadMessages.js +67 -10
- package/dist/react/primitives/thread/ThreadMessages.js.map +1 -1
- package/dist/react/primitives/thread/ThreadSuggestions.js +50 -10
- package/dist/react/primitives/thread/ThreadSuggestions.js.map +1 -1
- package/dist/react/primitives/threadList/ThreadListItems.js +55 -14
- package/dist/react/primitives/threadList/ThreadListItems.js.map +1 -1
- package/dist/react/primitives/threadListItem/ThreadListItemTitle.js +15 -2
- package/dist/react/primitives/threadListItem/ThreadListItemTitle.js.map +1 -1
- package/dist/react/providers/AttachmentByIndexProvider.js +57 -12
- package/dist/react/providers/AttachmentByIndexProvider.js.map +1 -1
- package/dist/react/providers/ChainOfThoughtByIndicesProvider.js +33 -11
- package/dist/react/providers/ChainOfThoughtByIndicesProvider.js.map +1 -1
- package/dist/react/providers/ChainOfThoughtPartByIndexProvider.js +29 -6
- package/dist/react/providers/ChainOfThoughtPartByIndexProvider.js.map +1 -1
- package/dist/react/providers/MessageByIndexProvider.js +49 -19
- package/dist/react/providers/MessageByIndexProvider.js.map +1 -1
- package/dist/react/providers/PartByIndexProvider.js +29 -6
- package/dist/react/providers/PartByIndexProvider.js.map +1 -1
- package/dist/react/providers/QueueItemByIndexProvider.js +29 -6
- package/dist/react/providers/QueueItemByIndexProvider.js.map +1 -1
- package/dist/react/providers/ReadonlyThreadProvider.js +83 -28
- package/dist/react/providers/ReadonlyThreadProvider.js.map +1 -1
- package/dist/react/providers/SuggestionByIndexProvider.js +29 -6
- package/dist/react/providers/SuggestionByIndexProvider.js.map +1 -1
- package/dist/react/providers/TextMessagePartProvider.d.ts.map +1 -1
- package/dist/react/providers/TextMessagePartProvider.js +75 -26
- package/dist/react/providers/TextMessagePartProvider.js.map +1 -1
- package/dist/react/providers/ThreadListItemByIndexProvider.js +30 -6
- package/dist/react/providers/ThreadListItemByIndexProvider.js.map +1 -1
- package/dist/react/providers/ThreadListItemRuntimeProvider.js +28 -5
- package/dist/react/providers/ThreadListItemRuntimeProvider.js.map +1 -1
- package/dist/react/runtimes/RemoteThreadListHookInstanceManager.d.ts +2 -0
- package/dist/react/runtimes/RemoteThreadListHookInstanceManager.d.ts.map +1 -1
- package/dist/react/runtimes/RemoteThreadListHookInstanceManager.js +19 -4
- package/dist/react/runtimes/RemoteThreadListHookInstanceManager.js.map +1 -1
- package/dist/react/runtimes/RemoteThreadListThreadListRuntimeCore.d.ts +2 -0
- package/dist/react/runtimes/RemoteThreadListThreadListRuntimeCore.d.ts.map +1 -1
- package/dist/react/runtimes/RemoteThreadListThreadListRuntimeCore.js +1 -0
- package/dist/react/runtimes/RemoteThreadListThreadListRuntimeCore.js.map +1 -1
- package/dist/react/runtimes/RuntimeAdapterProvider.js +27 -10
- package/dist/react/runtimes/RuntimeAdapterProvider.js.map +1 -1
- package/dist/react/runtimes/cloud/AssistantCloudThreadHistoryAdapter.d.ts.map +1 -1
- package/dist/react/runtimes/cloud/AssistantCloudThreadHistoryAdapter.js +16 -1
- package/dist/react/runtimes/cloud/AssistantCloudThreadHistoryAdapter.js.map +1 -1
- package/dist/react/runtimes/cloud/CloudFileAttachmentAdapter.js.map +1 -1
- package/dist/react/runtimes/cloud/auiV0.js.map +1 -1
- package/dist/react/runtimes/cloud/useCloudThreadListAdapter.d.ts.map +1 -1
- package/dist/react/runtimes/cloud/useCloudThreadListAdapter.js +19 -17
- package/dist/react/runtimes/cloud/useCloudThreadListAdapter.js.map +1 -1
- package/dist/react/runtimes/createMessageConverter.js.map +1 -1
- package/dist/react/runtimes/external-message-converter.d.ts.map +1 -1
- package/dist/react/runtimes/external-message-converter.js +67 -30
- package/dist/react/runtimes/external-message-converter.js.map +1 -1
- package/dist/react/runtimes/useExternalStoreRuntime.js +44 -10
- package/dist/react/runtimes/useExternalStoreRuntime.js.map +1 -1
- package/dist/react/runtimes/useExternalStoreSharedOptions.js +17 -12
- package/dist/react/runtimes/useExternalStoreSharedOptions.js.map +1 -1
- package/dist/react/runtimes/useLocalRuntime.js.map +1 -1
- package/dist/react/runtimes/useRemoteThreadListRuntime.js +34 -6
- package/dist/react/runtimes/useRemoteThreadListRuntime.js.map +1 -1
- package/dist/react/types/MessagePartComponentTypes.d.ts +5 -6
- package/dist/react/types/MessagePartComponentTypes.d.ts.map +1 -1
- package/dist/react/utils/getMessageQuote.js.map +1 -1
- package/dist/react/utils/groupParts.d.ts +13 -1
- package/dist/react/utils/groupParts.d.ts.map +1 -1
- package/dist/react/utils/groupParts.js +17 -5
- package/dist/react/utils/groupParts.js.map +1 -1
- package/dist/runtime/api/assistant-runtime.js.map +1 -1
- package/dist/runtime/api/attachment-runtime.js.map +1 -1
- package/dist/runtime/api/bindings.d.ts +1 -0
- package/dist/runtime/api/bindings.d.ts.map +1 -1
- package/dist/runtime/api/composer-runtime.js.map +1 -1
- package/dist/runtime/api/message-part-runtime.d.ts +3 -9
- package/dist/runtime/api/message-part-runtime.d.ts.map +1 -1
- package/dist/runtime/api/message-part-runtime.js +3 -6
- package/dist/runtime/api/message-part-runtime.js.map +1 -1
- package/dist/runtime/api/message-runtime.d.ts +2 -0
- package/dist/runtime/api/message-runtime.d.ts.map +1 -1
- package/dist/runtime/api/message-runtime.js +5 -0
- package/dist/runtime/api/message-runtime.js.map +1 -1
- package/dist/runtime/api/thread-list-item-runtime.js.map +1 -1
- package/dist/runtime/api/thread-list-runtime.d.ts.map +1 -1
- package/dist/runtime/api/thread-list-runtime.js +1 -0
- package/dist/runtime/api/thread-list-runtime.js.map +1 -1
- package/dist/runtime/api/thread-runtime.d.ts +3 -0
- package/dist/runtime/api/thread-runtime.d.ts.map +1 -1
- package/dist/runtime/api/thread-runtime.js +4 -0
- package/dist/runtime/api/thread-runtime.js.map +1 -1
- package/dist/runtime/base/base-assistant-runtime-core.js.map +1 -1
- package/dist/runtime/base/base-composer-runtime-core.js.map +1 -1
- package/dist/runtime/base/base-thread-runtime-core.d.ts +1 -0
- package/dist/runtime/base/base-thread-runtime-core.d.ts.map +1 -1
- package/dist/runtime/base/base-thread-runtime-core.js.map +1 -1
- package/dist/runtime/base/default-edit-composer-runtime-core.js.map +1 -1
- package/dist/runtime/base/default-thread-composer-runtime-core.js.map +1 -1
- package/dist/runtime/branch/external-thread-branch-adapter.d.ts +30 -0
- package/dist/runtime/branch/external-thread-branch-adapter.d.ts.map +1 -0
- package/dist/runtime/branch/external-thread-branch-adapter.js +0 -0
- package/dist/runtime/interfaces/thread-list-runtime-core.d.ts +1 -0
- package/dist/runtime/interfaces/thread-list-runtime-core.d.ts.map +1 -1
- package/dist/runtime/interfaces/thread-runtime-core.d.ts +4 -1
- package/dist/runtime/interfaces/thread-runtime-core.d.ts.map +1 -1
- package/dist/runtime/queue/message-queue.js.map +1 -1
- package/dist/runtime/utils/auto-status.js.map +1 -1
- package/dist/runtime/utils/external-store-message.js.map +1 -1
- package/dist/runtime/utils/message-repository.js.map +1 -1
- package/dist/runtime/utils/resolveToolApprovalResponse.d.ts +15 -0
- package/dist/runtime/utils/resolveToolApprovalResponse.d.ts.map +1 -0
- package/dist/runtime/utils/resolveToolApprovalResponse.js +35 -0
- package/dist/runtime/utils/resolveToolApprovalResponse.js.map +1 -0
- package/dist/runtime/utils/thread-message-like.d.ts +5 -1
- package/dist/runtime/utils/thread-message-like.d.ts.map +1 -1
- package/dist/runtime/utils/thread-message-like.js.map +1 -1
- package/dist/runtimes/assistant-transport/utils.js.map +1 -1
- package/dist/runtimes/external-store/external-store-adapter.d.ts +1 -0
- package/dist/runtimes/external-store/external-store-adapter.d.ts.map +1 -1
- package/dist/runtimes/external-store/external-store-runtime-core.js.map +1 -1
- package/dist/runtimes/external-store/external-store-shared-options.js.map +1 -1
- package/dist/runtimes/external-store/external-store-thread-list-runtime-core.js.map +1 -1
- package/dist/runtimes/external-store/external-store-thread-runtime-core.d.ts +1 -0
- package/dist/runtimes/external-store/external-store-thread-runtime-core.d.ts.map +1 -1
- package/dist/runtimes/external-store/external-store-thread-runtime-core.js +13 -0
- package/dist/runtimes/external-store/external-store-thread-runtime-core.js.map +1 -1
- package/dist/runtimes/external-store/thread-message-converter.js.map +1 -1
- package/dist/runtimes/local/local-runtime-core.js.map +1 -1
- package/dist/runtimes/local/local-runtime-options.d.ts +1 -1
- package/dist/runtimes/local/local-thread-list-runtime-core.js.map +1 -1
- package/dist/runtimes/local/local-thread-runtime-core.d.ts +9 -1
- package/dist/runtimes/local/local-thread-runtime-core.d.ts.map +1 -1
- package/dist/runtimes/local/local-thread-runtime-core.js +65 -5
- package/dist/runtimes/local/local-thread-runtime-core.js.map +1 -1
- package/dist/runtimes/local/should-continue.js +4 -2
- package/dist/runtimes/local/should-continue.js.map +1 -1
- package/dist/runtimes/readonly/ReadonlyThreadRuntimeCore.d.ts +2 -0
- package/dist/runtimes/readonly/ReadonlyThreadRuntimeCore.d.ts.map +1 -1
- package/dist/runtimes/readonly/ReadonlyThreadRuntimeCore.js +4 -0
- package/dist/runtimes/readonly/ReadonlyThreadRuntimeCore.js.map +1 -1
- package/dist/runtimes/remote-thread-list/adapter/in-memory.js.map +1 -1
- package/dist/runtimes/remote-thread-list/empty-thread-core.d.ts.map +1 -1
- package/dist/runtimes/remote-thread-list/empty-thread-core.js +4 -0
- package/dist/runtimes/remote-thread-list/empty-thread-core.js.map +1 -1
- package/dist/runtimes/remote-thread-list/optimistic-state.js.map +1 -1
- package/dist/runtimes/remote-thread-list/remote-thread-state.d.ts +1 -0
- package/dist/runtimes/remote-thread-list/remote-thread-state.d.ts.map +1 -1
- package/dist/runtimes/remote-thread-list/remote-thread-state.js +1 -0
- package/dist/runtimes/remote-thread-list/remote-thread-state.js.map +1 -1
- package/dist/runtimes/remote-thread-list/types.d.ts +1 -0
- package/dist/runtimes/remote-thread-list/types.d.ts.map +1 -1
- package/dist/runtimes/tool-invocations/ToolInvocationTracker.js.map +1 -1
- package/dist/store/clients/chain-of-thought-client.d.ts +2 -7
- package/dist/store/clients/chain-of-thought-client.d.ts.map +1 -1
- package/dist/store/clients/chain-of-thought-client.js +39 -20
- package/dist/store/clients/chain-of-thought-client.js.map +1 -1
- package/dist/store/clients/model-context-client.d.ts +1 -1
- package/dist/store/clients/model-context-client.d.ts.map +1 -1
- package/dist/store/clients/model-context-client.js +67 -16
- package/dist/store/clients/model-context-client.js.map +1 -1
- package/dist/store/clients/no-op-composer-client.d.ts +2 -4
- package/dist/store/clients/no-op-composer-client.d.ts.map +1 -1
- package/dist/store/clients/no-op-composer-client.js +96 -54
- package/dist/store/clients/no-op-composer-client.js.map +1 -1
- package/dist/store/clients/runtime-adapter.d.ts +1 -3
- package/dist/store/clients/runtime-adapter.d.ts.map +1 -1
- package/dist/store/clients/runtime-adapter.js +2 -15
- package/dist/store/clients/runtime-adapter.js.map +1 -1
- package/dist/store/clients/suggestions.d.ts +1 -4
- package/dist/store/clients/suggestions.d.ts.map +1 -1
- package/dist/store/clients/suggestions.js +63 -23
- package/dist/store/clients/suggestions.js.map +1 -1
- package/dist/store/clients/thread-message-client.d.ts +1 -1
- package/dist/store/clients/thread-message-client.d.ts.map +1 -1
- package/dist/store/clients/thread-message-client.js +184 -73
- package/dist/store/clients/thread-message-client.js.map +1 -1
- package/dist/store/internal.d.ts +2 -2
- package/dist/store/internal.js +2 -2
- package/dist/store/runtime-clients/attachment-runtime-client.d.ts +2 -4
- package/dist/store/runtime-clients/attachment-runtime-client.d.ts.map +1 -1
- package/dist/store/runtime-clients/attachment-runtime-client.js +31 -7
- package/dist/store/runtime-clients/attachment-runtime-client.js.map +1 -1
- package/dist/store/runtime-clients/composer-runtime-client.d.ts +2 -10
- package/dist/store/runtime-clients/composer-runtime-client.d.ts.map +1 -1
- package/dist/store/runtime-clients/composer-runtime-client.js +195 -72
- package/dist/store/runtime-clients/composer-runtime-client.js.map +1 -1
- package/dist/store/runtime-clients/liveRef.d.ts +7 -0
- package/dist/store/runtime-clients/liveRef.d.ts.map +1 -0
- package/dist/store/runtime-clients/liveRef.js +8 -0
- package/dist/store/runtime-clients/liveRef.js.map +1 -0
- package/dist/store/runtime-clients/message-part-runtime-client.d.ts +2 -4
- package/dist/store/runtime-clients/message-part-runtime-client.d.ts.map +1 -1
- package/dist/store/runtime-clients/message-part-runtime-client.js +49 -9
- package/dist/store/runtime-clients/message-part-runtime-client.js.map +1 -1
- package/dist/store/runtime-clients/message-runtime-client.d.ts +2 -7
- package/dist/store/runtime-clients/message-runtime-client.d.ts.map +1 -1
- package/dist/store/runtime-clients/message-runtime-client.js +220 -54
- package/dist/store/runtime-clients/message-runtime-client.js.map +1 -1
- package/dist/store/runtime-clients/thread-list-item-runtime-client.d.ts +2 -4
- package/dist/store/runtime-clients/thread-list-item-runtime-client.d.ts.map +1 -1
- package/dist/store/runtime-clients/thread-list-item-runtime-client.js +71 -26
- package/dist/store/runtime-clients/thread-list-item-runtime-client.js.map +1 -1
- package/dist/store/runtime-clients/thread-list-runtime-client.d.ts +2 -5
- package/dist/store/runtime-clients/thread-list-runtime-client.d.ts.map +1 -1
- package/dist/store/runtime-clients/thread-list-runtime-client.js +141 -36
- package/dist/store/runtime-clients/thread-list-runtime-client.js.map +1 -1
- package/dist/store/runtime-clients/thread-runtime-client.d.ts +2 -4
- package/dist/store/runtime-clients/thread-runtime-client.d.ts.map +1 -1
- package/dist/store/runtime-clients/thread-runtime-client.js +196 -72
- package/dist/store/runtime-clients/thread-runtime-client.js.map +1 -1
- package/dist/store/runtime-clients/useSubscribable.js +2 -9
- package/dist/store/runtime-clients/useSubscribable.js.map +1 -1
- package/dist/store/scopes/message.d.ts +1 -0
- package/dist/store/scopes/message.d.ts.map +1 -1
- package/dist/store/scopes/part.d.ts +5 -6
- package/dist/store/scopes/part.d.ts.map +1 -1
- package/dist/store/scopes/queue-item.js.map +1 -1
- package/dist/store/scopes/thread-list-item.d.ts +1 -0
- package/dist/store/scopes/thread-list-item.d.ts.map +1 -1
- package/dist/store/scopes/thread.d.ts +1 -0
- package/dist/store/scopes/thread.d.ts.map +1 -1
- package/dist/subscribable/subscribable.js.map +1 -1
- package/dist/tests/remote-thread-list-test-helpers.js.map +1 -1
- package/dist/types/message.d.ts +38 -5
- package/dist/types/message.d.ts.map +1 -1
- package/dist/types/message.js.map +1 -1
- package/dist/utils/composite-context-provider.js.map +1 -1
- package/dist/utils/id.js.map +1 -1
- package/dist/utils/json/is-json-equal.js.map +1 -1
- package/dist/utils/json/is-json.js.map +1 -1
- package/dist/utils/text.js.map +1 -1
- package/package.json +6 -6
- package/src/adapters/thread-history.ts +2 -0
- package/src/index.ts +5 -0
- package/src/internal.ts +1 -0
- package/src/model-context/types.ts +1 -0
- package/src/react/AssistantProvider.tsx +10 -1
- package/src/react/RuntimeAdapter.ts +25 -8
- package/src/react/client/DataRenderers.ts +42 -45
- package/src/react/client/Interactables.ts +261 -261
- package/src/react/client/Tools.ts +9 -9
- package/src/react/primitives/message/MessageGroupedParts.tsx +19 -7
- package/src/react/primitives/message/MessageParts.tsx +64 -13
- package/src/react/providers/TextMessagePartProvider.tsx +5 -3
- package/src/react/runtimes/RemoteThreadListThreadListRuntimeCore.tsx +1 -0
- package/src/react/runtimes/cloud/AssistantCloudThreadHistoryAdapter.ts +11 -0
- package/src/react/runtimes/cloud/useCloudThreadListAdapter.tsx +6 -0
- package/src/react/runtimes/external-message-converter.ts +3 -1
- package/src/react/types/MessagePartComponentTypes.ts +5 -5
- package/src/react/utils/groupParts.ts +27 -0
- package/src/runtime/api/bindings.ts +1 -0
- package/src/runtime/api/message-part-runtime.ts +14 -11
- package/src/runtime/api/message-runtime.ts +7 -0
- package/src/runtime/api/thread-list-runtime.ts +1 -0
- package/src/runtime/api/thread-runtime.ts +7 -0
- package/src/runtime/base/base-thread-runtime-core.ts +1 -0
- package/src/runtime/branch/external-thread-branch-adapter.ts +26 -0
- package/src/runtime/interfaces/thread-list-runtime-core.ts +1 -0
- package/src/runtime/interfaces/thread-runtime-core.ts +4 -0
- package/src/runtime/utils/resolveToolApprovalResponse.test.ts +91 -0
- package/src/runtime/utils/resolveToolApprovalResponse.ts +55 -0
- package/src/runtime/utils/thread-message-like.ts +10 -1
- package/src/runtimes/external-store/external-store-adapter.ts +1 -0
- package/src/runtimes/external-store/external-store-thread-runtime-core.ts +24 -0
- package/src/runtimes/local/local-runtime-options.ts +1 -1
- package/src/runtimes/local/local-thread-runtime-core.test.ts +370 -0
- package/src/runtimes/local/local-thread-runtime-core.ts +113 -7
- package/src/runtimes/local/should-continue.ts +24 -13
- package/src/runtimes/readonly/ReadonlyThreadRuntimeCore.ts +5 -0
- package/src/runtimes/remote-thread-list/empty-thread-core.ts +5 -0
- package/src/runtimes/remote-thread-list/remote-thread-state.ts +2 -0
- package/src/runtimes/remote-thread-list/types.ts +1 -0
- package/src/store/clients/chain-of-thought-client.ts +5 -3
- package/src/store/clients/model-context-client.test.ts +5 -4
- package/src/store/clients/model-context-client.ts +21 -21
- package/src/store/clients/no-op-composer-client.ts +5 -3
- package/src/store/clients/runtime-adapter.ts +0 -24
- package/src/store/clients/suggestions.ts +12 -23
- package/src/store/clients/thread-message-client.ts +42 -40
- package/src/store/internal.ts +1 -4
- package/src/store/runtime-clients/attachment-runtime-client.ts +14 -14
- package/src/store/runtime-clients/composer-runtime-client.ts +48 -45
- package/src/store/runtime-clients/liveRef.ts +5 -0
- package/src/store/runtime-clients/message-part-runtime-client.ts +5 -3
- package/src/store/runtime-clients/message-runtime-client.ts +42 -40
- package/src/store/runtime-clients/thread-list-item-runtime-client.ts +5 -3
- package/src/store/runtime-clients/thread-list-runtime-client.ts +13 -11
- package/src/store/runtime-clients/thread-runtime-client.ts +20 -16
- package/src/store/runtime-clients/useSubscribable.ts +2 -10
- package/src/store/scopes/message.ts +1 -0
- package/src/store/scopes/part.ts +5 -2
- package/src/store/scopes/thread-list-item.ts +1 -0
- package/src/store/scopes/thread.ts +1 -0
- package/src/tests/external-store-thread-runtime-core.test.ts +57 -0
- package/src/tests/groupMessageParts.test.ts +84 -0
- package/src/tests/groupParts.test.ts +55 -0
- package/src/types/message.ts +45 -3
|
@@ -4,8 +4,9 @@ import { TextMessagePartProvider } from "../../providers/TextMessagePartProvider
|
|
|
4
4
|
import { ChainOfThoughtByIndicesProvider } from "../../providers/ChainOfThoughtByIndicesProvider.js";
|
|
5
5
|
import { getMessageQuote } from "../../utils/getMessageQuote.js";
|
|
6
6
|
import { GenerativeUIRender } from "../generativeUI/GenerativeUI.js";
|
|
7
|
-
import { memo
|
|
7
|
+
import { memo } from "@assistant-ui/tap/react-shim";
|
|
8
8
|
import { RenderChildrenWithAccessor, useAui, useAuiState } from "@assistant-ui/store";
|
|
9
|
+
import { c } from "@assistant-ui/tap/react-shim/compiler-runtime";
|
|
9
10
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
10
11
|
import { useShallow } from "zustand/shallow";
|
|
11
12
|
//#region src/react/primitives/message/MessageParts.tsx
|
|
@@ -42,8 +43,10 @@ const createGroupState = (groupType) => {
|
|
|
42
43
|
* Groups consecutive tool-call and reasoning message parts into ranges.
|
|
43
44
|
* Always groups tool calls and reasoning parts, even if there's only one.
|
|
44
45
|
* When useChainOfThought is true, groups tool-call and reasoning parts together.
|
|
46
|
+
* `partIds[i]` optionally carries a stable identity for part `i`; group
|
|
47
|
+
* ranges derive an `idKey` from their first part's id (first claim wins).
|
|
45
48
|
*/
|
|
46
|
-
const groupMessageParts = (messageTypes, useChainOfThought) => {
|
|
49
|
+
const groupMessageParts = (messageTypes, useChainOfThought, partIds) => {
|
|
47
50
|
const ranges = [];
|
|
48
51
|
if (useChainOfThought) {
|
|
49
52
|
const chainOfThoughtGroup = createGroupState("chainOfThoughtGroup");
|
|
@@ -82,29 +85,131 @@ const groupMessageParts = (messageTypes, useChainOfThought) => {
|
|
|
82
85
|
toolGroup.finalize(messageTypes.length - 1, ranges);
|
|
83
86
|
reasoningGroup.finalize(messageTypes.length - 1, ranges);
|
|
84
87
|
}
|
|
88
|
+
if (partIds) {
|
|
89
|
+
const claimed = /* @__PURE__ */ new Set();
|
|
90
|
+
for (const range of ranges) {
|
|
91
|
+
if (range.type === "single") continue;
|
|
92
|
+
const id = partIds[range.startIndex];
|
|
93
|
+
if (id !== void 0 && !claimed.has(id)) {
|
|
94
|
+
claimed.add(id);
|
|
95
|
+
range.idKey = `id:${id}`;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
85
99
|
return ranges;
|
|
86
100
|
};
|
|
87
101
|
const useMessagePartsGroups = (useChainOfThought) => {
|
|
88
|
-
const
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
102
|
+
const $ = c(10);
|
|
103
|
+
const messageTypes = useAuiState(useShallow(_temp2));
|
|
104
|
+
const partIds = useAuiState(useShallow(_temp4));
|
|
105
|
+
let t0;
|
|
106
|
+
bb0: {
|
|
107
|
+
if (messageTypes.length === 0) {
|
|
108
|
+
let t1;
|
|
109
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
110
|
+
t1 = [];
|
|
111
|
+
$[0] = t1;
|
|
112
|
+
} else t1 = $[0];
|
|
113
|
+
let t2;
|
|
114
|
+
if ($[1] !== partIds) {
|
|
115
|
+
t2 = {
|
|
116
|
+
ranges: t1,
|
|
117
|
+
partIds
|
|
118
|
+
};
|
|
119
|
+
$[1] = partIds;
|
|
120
|
+
$[2] = t2;
|
|
121
|
+
} else t2 = $[2];
|
|
122
|
+
t0 = t2;
|
|
123
|
+
break bb0;
|
|
124
|
+
}
|
|
125
|
+
let t1;
|
|
126
|
+
if ($[3] !== messageTypes || $[4] !== partIds || $[5] !== useChainOfThought) {
|
|
127
|
+
t1 = groupMessageParts(messageTypes, useChainOfThought, partIds);
|
|
128
|
+
$[3] = messageTypes;
|
|
129
|
+
$[4] = partIds;
|
|
130
|
+
$[5] = useChainOfThought;
|
|
131
|
+
$[6] = t1;
|
|
132
|
+
} else t1 = $[6];
|
|
133
|
+
let t2;
|
|
134
|
+
if ($[7] !== partIds || $[8] !== t1) {
|
|
135
|
+
t2 = {
|
|
136
|
+
ranges: t1,
|
|
137
|
+
partIds
|
|
138
|
+
};
|
|
139
|
+
$[7] = partIds;
|
|
140
|
+
$[8] = t1;
|
|
141
|
+
$[9] = t2;
|
|
142
|
+
} else t2 = $[9];
|
|
143
|
+
t0 = t2;
|
|
144
|
+
}
|
|
145
|
+
return t0;
|
|
93
146
|
};
|
|
94
|
-
const ToolUIDisplay = (
|
|
95
|
-
const
|
|
147
|
+
const ToolUIDisplay = (t0) => {
|
|
148
|
+
const $ = c(9);
|
|
149
|
+
let Fallback;
|
|
150
|
+
let props;
|
|
151
|
+
if ($[0] !== t0) {
|
|
152
|
+
({Fallback, ...props} = t0);
|
|
153
|
+
$[0] = t0;
|
|
154
|
+
$[1] = Fallback;
|
|
155
|
+
$[2] = props;
|
|
156
|
+
} else {
|
|
157
|
+
Fallback = $[1];
|
|
158
|
+
props = $[2];
|
|
159
|
+
}
|
|
160
|
+
let t1;
|
|
161
|
+
if ($[3] !== Fallback || $[4] !== props.toolName) {
|
|
162
|
+
t1 = (s) => s.tools.toolUIs[props.toolName]?.[0]?.render ?? Fallback;
|
|
163
|
+
$[3] = Fallback;
|
|
164
|
+
$[4] = props.toolName;
|
|
165
|
+
$[5] = t1;
|
|
166
|
+
} else t1 = $[5];
|
|
167
|
+
const Render = useAuiState(t1);
|
|
96
168
|
if (!Render) return null;
|
|
97
|
-
|
|
169
|
+
let t2;
|
|
170
|
+
if ($[6] !== Render || $[7] !== props) {
|
|
171
|
+
t2 = /* @__PURE__ */ jsx(Render, { ...props });
|
|
172
|
+
$[6] = Render;
|
|
173
|
+
$[7] = props;
|
|
174
|
+
$[8] = t2;
|
|
175
|
+
} else t2 = $[8];
|
|
176
|
+
return t2;
|
|
98
177
|
};
|
|
99
178
|
const getDataRenderer = (dataRenderers, name, inlineFallback) => {
|
|
100
179
|
const named = dataRenderers.renderers[name]?.[0];
|
|
101
180
|
if (named) return named;
|
|
102
181
|
return dataRenderers.fallbacks[0] ?? inlineFallback;
|
|
103
182
|
};
|
|
104
|
-
const DataUIDisplay = (
|
|
105
|
-
const
|
|
183
|
+
const DataUIDisplay = (t0) => {
|
|
184
|
+
const $ = c(9);
|
|
185
|
+
let Fallback;
|
|
186
|
+
let props;
|
|
187
|
+
if ($[0] !== t0) {
|
|
188
|
+
({Fallback, ...props} = t0);
|
|
189
|
+
$[0] = t0;
|
|
190
|
+
$[1] = Fallback;
|
|
191
|
+
$[2] = props;
|
|
192
|
+
} else {
|
|
193
|
+
Fallback = $[1];
|
|
194
|
+
props = $[2];
|
|
195
|
+
}
|
|
196
|
+
let t1;
|
|
197
|
+
if ($[3] !== Fallback || $[4] !== props.name) {
|
|
198
|
+
t1 = (s) => getDataRenderer(s.dataRenderers, props.name, Fallback);
|
|
199
|
+
$[3] = Fallback;
|
|
200
|
+
$[4] = props.name;
|
|
201
|
+
$[5] = t1;
|
|
202
|
+
} else t1 = $[5];
|
|
203
|
+
const Render = useAuiState(t1);
|
|
106
204
|
if (!Render) return null;
|
|
107
|
-
|
|
205
|
+
let t2;
|
|
206
|
+
if ($[6] !== Render || $[7] !== props) {
|
|
207
|
+
t2 = /* @__PURE__ */ jsx(Render, { ...props });
|
|
208
|
+
$[6] = Render;
|
|
209
|
+
$[7] = props;
|
|
210
|
+
$[8] = t2;
|
|
211
|
+
} else t2 = $[8];
|
|
212
|
+
return t2;
|
|
108
213
|
};
|
|
109
214
|
/**
|
|
110
215
|
* Platform-agnostic no-op default components.
|
|
@@ -120,54 +225,187 @@ const defaultComponents = {
|
|
|
120
225
|
ToolGroup: ({ children }) => children,
|
|
121
226
|
ReasoningGroup: ({ children }) => children
|
|
122
227
|
};
|
|
123
|
-
const MessagePartComponent = (
|
|
228
|
+
const MessagePartComponent = (t0) => {
|
|
229
|
+
const $ = c(47);
|
|
230
|
+
const { components: t1 } = t0;
|
|
231
|
+
let t2;
|
|
232
|
+
if ($[0] !== t1) {
|
|
233
|
+
t2 = t1 === void 0 ? {} : t1;
|
|
234
|
+
$[0] = t1;
|
|
235
|
+
$[1] = t2;
|
|
236
|
+
} else t2 = $[1];
|
|
237
|
+
const { Text: t3, Reasoning: t4, Image: t5, Source: t6, File: t7, Unstable_Audio: t8, tools: t9, data, generativeUI } = t2;
|
|
238
|
+
const Text = t3 === void 0 ? defaultComponents.Text : t3;
|
|
239
|
+
const Reasoning = t4 === void 0 ? defaultComponents.Reasoning : t4;
|
|
240
|
+
const Image = t5 === void 0 ? defaultComponents.Image : t5;
|
|
241
|
+
const Source = t6 === void 0 ? defaultComponents.Source : t6;
|
|
242
|
+
const File = t7 === void 0 ? defaultComponents.File : t7;
|
|
243
|
+
const Audio = t8 === void 0 ? defaultComponents.Unstable_Audio : t8;
|
|
244
|
+
let t10;
|
|
245
|
+
if ($[2] !== t9) {
|
|
246
|
+
t10 = t9 === void 0 ? {} : t9;
|
|
247
|
+
$[2] = t9;
|
|
248
|
+
$[3] = t10;
|
|
249
|
+
} else t10 = $[3];
|
|
250
|
+
const tools = t10;
|
|
124
251
|
const aui = useAui();
|
|
125
|
-
const part = useAuiState(
|
|
252
|
+
const part = useAuiState(_temp5);
|
|
126
253
|
const type = part.type;
|
|
127
254
|
if (type === "tool-call") {
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
255
|
+
let t11;
|
|
256
|
+
if ($[4] !== aui) {
|
|
257
|
+
t11 = aui.part();
|
|
258
|
+
$[4] = aui;
|
|
259
|
+
$[5] = t11;
|
|
260
|
+
} else t11 = $[5];
|
|
261
|
+
const addResult = t11.addToolResult;
|
|
262
|
+
let t12;
|
|
263
|
+
if ($[6] !== aui) {
|
|
264
|
+
t12 = aui.part();
|
|
265
|
+
$[6] = aui;
|
|
266
|
+
$[7] = t12;
|
|
267
|
+
} else t12 = $[7];
|
|
268
|
+
const resume = t12.resumeToolCall;
|
|
269
|
+
let t13;
|
|
270
|
+
if ($[8] !== aui) {
|
|
271
|
+
t13 = aui.part();
|
|
272
|
+
$[8] = aui;
|
|
273
|
+
$[9] = t13;
|
|
274
|
+
} else t13 = $[9];
|
|
275
|
+
const respondToApproval = t13.respondToToolApproval;
|
|
276
|
+
if ("Override" in tools) {
|
|
277
|
+
let t14;
|
|
278
|
+
if ($[10] !== addResult || $[11] !== part || $[12] !== respondToApproval || $[13] !== resume || $[14] !== tools.Override) {
|
|
279
|
+
t14 = /* @__PURE__ */ jsx(tools.Override, {
|
|
280
|
+
...part,
|
|
281
|
+
addResult,
|
|
282
|
+
resume,
|
|
283
|
+
respondToApproval
|
|
284
|
+
});
|
|
285
|
+
$[10] = addResult;
|
|
286
|
+
$[11] = part;
|
|
287
|
+
$[12] = respondToApproval;
|
|
288
|
+
$[13] = resume;
|
|
289
|
+
$[14] = tools.Override;
|
|
290
|
+
$[15] = t14;
|
|
291
|
+
} else t14 = $[15];
|
|
292
|
+
return t14;
|
|
293
|
+
}
|
|
137
294
|
const Tool = tools.by_name?.[part.toolName] ?? tools.Fallback;
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
295
|
+
let t14;
|
|
296
|
+
if ($[16] !== Tool || $[17] !== addResult || $[18] !== part || $[19] !== respondToApproval || $[20] !== resume) {
|
|
297
|
+
t14 = /* @__PURE__ */ jsx(ToolUIDisplay, {
|
|
298
|
+
...part,
|
|
299
|
+
Fallback: Tool,
|
|
300
|
+
addResult,
|
|
301
|
+
resume,
|
|
302
|
+
respondToApproval
|
|
303
|
+
});
|
|
304
|
+
$[16] = Tool;
|
|
305
|
+
$[17] = addResult;
|
|
306
|
+
$[18] = part;
|
|
307
|
+
$[19] = respondToApproval;
|
|
308
|
+
$[20] = resume;
|
|
309
|
+
$[21] = t14;
|
|
310
|
+
} else t14 = $[21];
|
|
311
|
+
return t14;
|
|
145
312
|
}
|
|
146
313
|
if (part.status?.type === "requires-action") throw new Error("Encountered unexpected requires-action status");
|
|
147
314
|
switch (type) {
|
|
148
|
-
case "text":
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
315
|
+
case "text": {
|
|
316
|
+
let t11;
|
|
317
|
+
if ($[22] !== Text || $[23] !== part) {
|
|
318
|
+
t11 = /* @__PURE__ */ jsx(Text, { ...part });
|
|
319
|
+
$[22] = Text;
|
|
320
|
+
$[23] = part;
|
|
321
|
+
$[24] = t11;
|
|
322
|
+
} else t11 = $[24];
|
|
323
|
+
return t11;
|
|
324
|
+
}
|
|
325
|
+
case "reasoning": {
|
|
326
|
+
let t11;
|
|
327
|
+
if ($[25] !== Reasoning || $[26] !== part) {
|
|
328
|
+
t11 = /* @__PURE__ */ jsx(Reasoning, { ...part });
|
|
329
|
+
$[25] = Reasoning;
|
|
330
|
+
$[26] = part;
|
|
331
|
+
$[27] = t11;
|
|
332
|
+
} else t11 = $[27];
|
|
333
|
+
return t11;
|
|
334
|
+
}
|
|
335
|
+
case "source": {
|
|
336
|
+
let t11;
|
|
337
|
+
if ($[28] !== Source || $[29] !== part) {
|
|
338
|
+
t11 = /* @__PURE__ */ jsx(Source, { ...part });
|
|
339
|
+
$[28] = Source;
|
|
340
|
+
$[29] = part;
|
|
341
|
+
$[30] = t11;
|
|
342
|
+
} else t11 = $[30];
|
|
343
|
+
return t11;
|
|
344
|
+
}
|
|
345
|
+
case "image": {
|
|
346
|
+
let t11;
|
|
347
|
+
if ($[31] !== Image || $[32] !== part) {
|
|
348
|
+
t11 = /* @__PURE__ */ jsx(Image, { ...part });
|
|
349
|
+
$[31] = Image;
|
|
350
|
+
$[32] = part;
|
|
351
|
+
$[33] = t11;
|
|
352
|
+
} else t11 = $[33];
|
|
353
|
+
return t11;
|
|
354
|
+
}
|
|
355
|
+
case "file": {
|
|
356
|
+
let t11;
|
|
357
|
+
if ($[34] !== File || $[35] !== part) {
|
|
358
|
+
t11 = /* @__PURE__ */ jsx(File, { ...part });
|
|
359
|
+
$[34] = File;
|
|
360
|
+
$[35] = part;
|
|
361
|
+
$[36] = t11;
|
|
362
|
+
} else t11 = $[36];
|
|
363
|
+
return t11;
|
|
364
|
+
}
|
|
365
|
+
case "audio": {
|
|
366
|
+
let t11;
|
|
367
|
+
if ($[37] !== Audio || $[38] !== part) {
|
|
368
|
+
t11 = /* @__PURE__ */ jsx(Audio, { ...part });
|
|
369
|
+
$[37] = Audio;
|
|
370
|
+
$[38] = part;
|
|
371
|
+
$[39] = t11;
|
|
372
|
+
} else t11 = $[39];
|
|
373
|
+
return t11;
|
|
374
|
+
}
|
|
154
375
|
case "data": {
|
|
155
376
|
const Data = data?.by_name?.[part.name] ?? data?.Fallback;
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
377
|
+
let t11;
|
|
378
|
+
if ($[40] !== Data || $[41] !== part) {
|
|
379
|
+
t11 = /* @__PURE__ */ jsx(DataUIDisplay, {
|
|
380
|
+
...part,
|
|
381
|
+
Fallback: Data
|
|
382
|
+
});
|
|
383
|
+
$[40] = Data;
|
|
384
|
+
$[41] = part;
|
|
385
|
+
$[42] = t11;
|
|
386
|
+
} else t11 = $[42];
|
|
387
|
+
return t11;
|
|
160
388
|
}
|
|
161
|
-
case "generative-ui":
|
|
389
|
+
case "generative-ui": {
|
|
162
390
|
if (!generativeUI?.components) {
|
|
163
391
|
if (typeof process !== "undefined" && process.env?.NODE_ENV !== "production") console.warn("MessagePrimitive.Parts received a generative-ui part but no `components.generativeUI.components` allowlist was provided. Pass an allowlist or render with <MessagePrimitive.GenerativeUI />.");
|
|
164
392
|
return null;
|
|
165
393
|
}
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
394
|
+
const t11 = part;
|
|
395
|
+
let t12;
|
|
396
|
+
if ($[43] !== generativeUI.Fallback || $[44] !== generativeUI.components || $[45] !== t11.spec) {
|
|
397
|
+
t12 = /* @__PURE__ */ jsx(GenerativeUIRender, {
|
|
398
|
+
spec: t11.spec,
|
|
399
|
+
components: generativeUI.components,
|
|
400
|
+
Fallback: generativeUI.Fallback
|
|
401
|
+
});
|
|
402
|
+
$[43] = generativeUI.Fallback;
|
|
403
|
+
$[44] = generativeUI.components;
|
|
404
|
+
$[45] = t11.spec;
|
|
405
|
+
$[46] = t12;
|
|
406
|
+
} else t12 = $[46];
|
|
407
|
+
return t12;
|
|
408
|
+
}
|
|
171
409
|
default:
|
|
172
410
|
console.warn(`Unknown message part type: ${type}`);
|
|
173
411
|
return null;
|
|
@@ -176,53 +414,128 @@ const MessagePartComponent = ({ components: { Text = defaultComponents.Text, Rea
|
|
|
176
414
|
/**
|
|
177
415
|
* Renders a single message part at the specified index.
|
|
178
416
|
*/
|
|
179
|
-
const MessagePrimitivePartByIndex = memo((
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
417
|
+
const MessagePrimitivePartByIndex = memo((t0) => {
|
|
418
|
+
const $ = c(5);
|
|
419
|
+
const { index, components } = t0;
|
|
420
|
+
let t1;
|
|
421
|
+
if ($[0] !== components) {
|
|
422
|
+
t1 = /* @__PURE__ */ jsx(MessagePartComponent, { components });
|
|
423
|
+
$[0] = components;
|
|
424
|
+
$[1] = t1;
|
|
425
|
+
} else t1 = $[1];
|
|
426
|
+
let t2;
|
|
427
|
+
if ($[2] !== index || $[3] !== t1) {
|
|
428
|
+
t2 = /* @__PURE__ */ jsx(PartByIndexProvider, {
|
|
429
|
+
index,
|
|
430
|
+
children: t1
|
|
431
|
+
});
|
|
432
|
+
$[2] = index;
|
|
433
|
+
$[3] = t1;
|
|
434
|
+
$[4] = t2;
|
|
435
|
+
} else t2 = $[4];
|
|
436
|
+
return t2;
|
|
184
437
|
}, (prev, next) => prev.index === next.index && prev.components?.Text === next.components?.Text && prev.components?.Reasoning === next.components?.Reasoning && prev.components?.Source === next.components?.Source && prev.components?.Image === next.components?.Image && prev.components?.File === next.components?.File && prev.components?.Unstable_Audio === next.components?.Unstable_Audio && prev.components?.tools === next.components?.tools && prev.components?.data === next.components?.data && prev.components?.generativeUI === next.components?.generativeUI && prev.components?.ToolGroup === next.components?.ToolGroup && prev.components?.ReasoningGroup === next.components?.ReasoningGroup);
|
|
185
438
|
MessagePrimitivePartByIndex.displayName = "MessagePrimitive.PartByIndex";
|
|
186
|
-
const EmptyPartFallback = (
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
439
|
+
const EmptyPartFallback = (t0) => {
|
|
440
|
+
const $ = c(6);
|
|
441
|
+
const { status, component: Component } = t0;
|
|
442
|
+
const t1 = status.type === "running";
|
|
443
|
+
let t2;
|
|
444
|
+
if ($[0] !== Component || $[1] !== status) {
|
|
445
|
+
t2 = /* @__PURE__ */ jsx(Component, {
|
|
191
446
|
type: "text",
|
|
192
447
|
text: "",
|
|
193
448
|
status
|
|
194
|
-
})
|
|
195
|
-
|
|
449
|
+
});
|
|
450
|
+
$[0] = Component;
|
|
451
|
+
$[1] = status;
|
|
452
|
+
$[2] = t2;
|
|
453
|
+
} else t2 = $[2];
|
|
454
|
+
let t3;
|
|
455
|
+
if ($[3] !== t1 || $[4] !== t2) {
|
|
456
|
+
t3 = /* @__PURE__ */ jsx(TextMessagePartProvider, {
|
|
457
|
+
text: "",
|
|
458
|
+
isRunning: t1,
|
|
459
|
+
children: t2
|
|
460
|
+
});
|
|
461
|
+
$[3] = t1;
|
|
462
|
+
$[4] = t2;
|
|
463
|
+
$[5] = t3;
|
|
464
|
+
} else t3 = $[5];
|
|
465
|
+
return t3;
|
|
196
466
|
};
|
|
197
467
|
const COMPLETE_STATUS = Object.freeze({ type: "complete" });
|
|
198
468
|
const RUNNING_STATUS = Object.freeze({ type: "running" });
|
|
199
|
-
const EmptyPartsImpl = (
|
|
200
|
-
const
|
|
201
|
-
|
|
469
|
+
const EmptyPartsImpl = (t0) => {
|
|
470
|
+
const $ = c(6);
|
|
471
|
+
const { components } = t0;
|
|
472
|
+
const status = useAuiState(_temp6);
|
|
473
|
+
if (components?.Empty) {
|
|
474
|
+
let t1;
|
|
475
|
+
if ($[0] !== components.Empty || $[1] !== status) {
|
|
476
|
+
t1 = /* @__PURE__ */ jsx(components.Empty, { status });
|
|
477
|
+
$[0] = components.Empty;
|
|
478
|
+
$[1] = status;
|
|
479
|
+
$[2] = t1;
|
|
480
|
+
} else t1 = $[2];
|
|
481
|
+
return t1;
|
|
482
|
+
}
|
|
202
483
|
if (status.type !== "running") return null;
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
484
|
+
const t1 = components?.Text ?? defaultComponents.Text;
|
|
485
|
+
let t2;
|
|
486
|
+
if ($[3] !== status || $[4] !== t1) {
|
|
487
|
+
t2 = /* @__PURE__ */ jsx(EmptyPartFallback, {
|
|
488
|
+
status,
|
|
489
|
+
component: t1
|
|
490
|
+
});
|
|
491
|
+
$[3] = status;
|
|
492
|
+
$[4] = t1;
|
|
493
|
+
$[5] = t2;
|
|
494
|
+
} else t2 = $[5];
|
|
495
|
+
return t2;
|
|
207
496
|
};
|
|
208
497
|
const EmptyParts = memo(EmptyPartsImpl, (prev, next) => prev.components?.Empty === next.components?.Empty && prev.components?.Text === next.components?.Text);
|
|
209
|
-
const ConditionalEmptyImpl = (
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
498
|
+
const ConditionalEmptyImpl = (t0) => {
|
|
499
|
+
const $ = c(4);
|
|
500
|
+
const { components, enabled } = t0;
|
|
501
|
+
let t1;
|
|
502
|
+
if ($[0] !== enabled) {
|
|
503
|
+
t1 = (s) => {
|
|
504
|
+
if (!enabled) return false;
|
|
505
|
+
if (s.message.parts.length === 0) return false;
|
|
506
|
+
const lastPart = s.message.parts[s.message.parts.length - 1];
|
|
507
|
+
return lastPart?.type !== "text" && lastPart?.type !== "reasoning";
|
|
508
|
+
};
|
|
509
|
+
$[0] = enabled;
|
|
510
|
+
$[1] = t1;
|
|
511
|
+
} else t1 = $[1];
|
|
512
|
+
if (!useAuiState(t1)) return null;
|
|
513
|
+
let t2;
|
|
514
|
+
if ($[2] !== components) {
|
|
515
|
+
t2 = /* @__PURE__ */ jsx(EmptyParts, { components });
|
|
516
|
+
$[2] = components;
|
|
517
|
+
$[3] = t2;
|
|
518
|
+
} else t2 = $[3];
|
|
519
|
+
return t2;
|
|
217
520
|
};
|
|
218
521
|
const ConditionalEmpty = memo(ConditionalEmptyImpl, (prev, next) => prev.enabled === next.enabled && prev.components?.Empty === next.components?.Empty && prev.components?.Text === next.components?.Text);
|
|
219
|
-
const QuoteRendererImpl = (
|
|
522
|
+
const QuoteRendererImpl = (t0) => {
|
|
523
|
+
const $ = c(4);
|
|
524
|
+
const { Quote } = t0;
|
|
220
525
|
const quoteInfo = useAuiState(getMessageQuote);
|
|
221
526
|
if (!quoteInfo) return null;
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
527
|
+
let t1;
|
|
528
|
+
if ($[0] !== Quote || $[1] !== quoteInfo.messageId || $[2] !== quoteInfo.text) {
|
|
529
|
+
t1 = /* @__PURE__ */ jsx(Quote, {
|
|
530
|
+
text: quoteInfo.text,
|
|
531
|
+
messageId: quoteInfo.messageId
|
|
532
|
+
});
|
|
533
|
+
$[0] = Quote;
|
|
534
|
+
$[1] = quoteInfo.messageId;
|
|
535
|
+
$[2] = quoteInfo.text;
|
|
536
|
+
$[3] = t1;
|
|
537
|
+
} else t1 = $[3];
|
|
538
|
+
return t1;
|
|
226
539
|
};
|
|
227
540
|
const QuoteRenderer = memo(QuoteRendererImpl);
|
|
228
541
|
function resolveToolRender(toolsState, part) {
|
|
@@ -236,26 +549,66 @@ function resolveToolRender(toolsState, part) {
|
|
|
236
549
|
* current part context. Reads tool registry and part state from context.
|
|
237
550
|
*/
|
|
238
551
|
const RegisteredToolUI = () => {
|
|
552
|
+
const $ = c(12);
|
|
239
553
|
const aui = useAui();
|
|
240
|
-
const part = useAuiState(
|
|
241
|
-
const Render = useAuiState(
|
|
554
|
+
const part = useAuiState(_temp7);
|
|
555
|
+
const Render = useAuiState(_temp8);
|
|
242
556
|
if (!Render || part.type !== "tool-call") return null;
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
}
|
|
557
|
+
let t0;
|
|
558
|
+
if ($[0] !== aui) {
|
|
559
|
+
t0 = aui.part();
|
|
560
|
+
$[0] = aui;
|
|
561
|
+
$[1] = t0;
|
|
562
|
+
} else t0 = $[1];
|
|
563
|
+
const t1 = t0.addToolResult;
|
|
564
|
+
let t2;
|
|
565
|
+
if ($[2] !== aui) {
|
|
566
|
+
t2 = aui.part();
|
|
567
|
+
$[2] = aui;
|
|
568
|
+
$[3] = t2;
|
|
569
|
+
} else t2 = $[3];
|
|
570
|
+
const t3 = t2.resumeToolCall;
|
|
571
|
+
let t4;
|
|
572
|
+
if ($[4] !== aui) {
|
|
573
|
+
t4 = aui.part();
|
|
574
|
+
$[4] = aui;
|
|
575
|
+
$[5] = t4;
|
|
576
|
+
} else t4 = $[5];
|
|
577
|
+
let t5;
|
|
578
|
+
if ($[6] !== Render || $[7] !== part || $[8] !== t0.addToolResult || $[9] !== t2.resumeToolCall || $[10] !== t4.respondToToolApproval) {
|
|
579
|
+
t5 = /* @__PURE__ */ jsx(Render, {
|
|
580
|
+
...part,
|
|
581
|
+
addResult: t1,
|
|
582
|
+
resume: t3,
|
|
583
|
+
respondToApproval: t4.respondToToolApproval
|
|
584
|
+
});
|
|
585
|
+
$[6] = Render;
|
|
586
|
+
$[7] = part;
|
|
587
|
+
$[8] = t0.addToolResult;
|
|
588
|
+
$[9] = t2.resumeToolCall;
|
|
589
|
+
$[10] = t4.respondToToolApproval;
|
|
590
|
+
$[11] = t5;
|
|
591
|
+
} else t5 = $[11];
|
|
592
|
+
return t5;
|
|
249
593
|
};
|
|
250
594
|
/**
|
|
251
595
|
* Stable propless component that renders the registered data renderer UI
|
|
252
596
|
* for the current part context.
|
|
253
597
|
*/
|
|
254
598
|
const RegisteredDataRendererUI = () => {
|
|
255
|
-
const
|
|
256
|
-
const
|
|
599
|
+
const $ = c(3);
|
|
600
|
+
const part = useAuiState(_temp9);
|
|
601
|
+
const Render = useAuiState(_temp0);
|
|
257
602
|
if (!Render || part.type !== "data") return null;
|
|
258
|
-
|
|
603
|
+
const t0 = part;
|
|
604
|
+
let t1;
|
|
605
|
+
if ($[0] !== Render || $[1] !== t0) {
|
|
606
|
+
t1 = /* @__PURE__ */ jsx(Render, { ...t0 });
|
|
607
|
+
$[0] = Render;
|
|
608
|
+
$[1] = t0;
|
|
609
|
+
$[2] = t1;
|
|
610
|
+
} else t1 = $[2];
|
|
611
|
+
return t1;
|
|
259
612
|
};
|
|
260
613
|
/**
|
|
261
614
|
* Fallback component rendered when the children render function returns null.
|
|
@@ -271,9 +624,24 @@ const RegisteredDataRendererUI = () => {
|
|
|
271
624
|
* To explicitly render nothing (suppressing registered UIs), return <></>.
|
|
272
625
|
*/
|
|
273
626
|
const DefaultPartFallback = () => {
|
|
274
|
-
const
|
|
275
|
-
|
|
276
|
-
if (partType === "
|
|
627
|
+
const $ = c(2);
|
|
628
|
+
const partType = useAuiState(_temp1);
|
|
629
|
+
if (partType === "tool-call") {
|
|
630
|
+
let t0;
|
|
631
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
632
|
+
t0 = /* @__PURE__ */ jsx(RegisteredToolUI, {});
|
|
633
|
+
$[0] = t0;
|
|
634
|
+
} else t0 = $[0];
|
|
635
|
+
return t0;
|
|
636
|
+
}
|
|
637
|
+
if (partType === "data") {
|
|
638
|
+
let t0;
|
|
639
|
+
if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
|
|
640
|
+
t0 = /* @__PURE__ */ jsx(RegisteredDataRendererUI, {});
|
|
641
|
+
$[1] = t0;
|
|
642
|
+
} else t0 = $[1];
|
|
643
|
+
return t0;
|
|
644
|
+
}
|
|
277
645
|
return null;
|
|
278
646
|
};
|
|
279
647
|
const EMPTY_RUNNING_TEXT_PART = Object.freeze({
|
|
@@ -295,7 +663,7 @@ const MessagePartChildren = ({ index, children }) => {
|
|
|
295
663
|
return /* @__PURE__ */ jsx(PartByIndexProvider, {
|
|
296
664
|
index,
|
|
297
665
|
children: /* @__PURE__ */ jsx(RenderChildrenWithAccessor, {
|
|
298
|
-
getItemState: (
|
|
666
|
+
getItemState: (aui_0) => aui_0.message().part({ index }).getState(),
|
|
299
667
|
children: (getItem) => children({ get part() {
|
|
300
668
|
const state = getItem();
|
|
301
669
|
if (state.type === "tool-call") {
|
|
@@ -321,22 +689,49 @@ const MessagePartChildren = ({ index, children }) => {
|
|
|
321
689
|
})
|
|
322
690
|
});
|
|
323
691
|
};
|
|
324
|
-
const MessagePrimitivePartsInner = (
|
|
325
|
-
const
|
|
326
|
-
const
|
|
692
|
+
const MessagePrimitivePartsInner = (t0) => {
|
|
693
|
+
const $ = c(9);
|
|
694
|
+
const { children } = t0;
|
|
695
|
+
const contentLength = useAuiState(_temp10);
|
|
696
|
+
const isRunning = useAuiState(_temp11);
|
|
327
697
|
const isEmptyRunning = contentLength === 0 && isRunning;
|
|
328
698
|
if (contentLength === 0) {
|
|
329
699
|
if (!isEmptyRunning) return null;
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
700
|
+
let t1;
|
|
701
|
+
if ($[0] !== children) {
|
|
702
|
+
t1 = children({ part: EMPTY_RUNNING_TEXT_PART });
|
|
703
|
+
$[0] = children;
|
|
704
|
+
$[1] = t1;
|
|
705
|
+
} else t1 = $[1];
|
|
706
|
+
let t2;
|
|
707
|
+
if ($[2] !== t1) {
|
|
708
|
+
t2 = /* @__PURE__ */ jsx(TextMessagePartProvider, {
|
|
709
|
+
text: "",
|
|
710
|
+
isRunning: true,
|
|
711
|
+
children: t1
|
|
712
|
+
});
|
|
713
|
+
$[2] = t1;
|
|
714
|
+
$[3] = t2;
|
|
715
|
+
} else t2 = $[3];
|
|
716
|
+
return t2;
|
|
335
717
|
}
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
718
|
+
let t1;
|
|
719
|
+
if ($[4] !== children || $[5] !== contentLength) {
|
|
720
|
+
let t2;
|
|
721
|
+
if ($[7] !== children) {
|
|
722
|
+
t2 = (_, index) => /* @__PURE__ */ jsx(MessagePartChildren, {
|
|
723
|
+
index,
|
|
724
|
+
children: (value) => children(value) ?? /* @__PURE__ */ jsx(DefaultPartFallback, {})
|
|
725
|
+
}, index);
|
|
726
|
+
$[7] = children;
|
|
727
|
+
$[8] = t2;
|
|
728
|
+
} else t2 = $[8];
|
|
729
|
+
t1 = /* @__PURE__ */ jsx(Fragment$1, { children: Array.from({ length: contentLength }, t2) });
|
|
730
|
+
$[4] = children;
|
|
731
|
+
$[5] = contentLength;
|
|
732
|
+
$[6] = t1;
|
|
733
|
+
} else t1 = $[6];
|
|
734
|
+
return t1;
|
|
340
735
|
};
|
|
341
736
|
/**
|
|
342
737
|
* Renders the parts of a message with support for multiple content types.
|
|
@@ -344,70 +739,177 @@ const MessagePrimitivePartsInner = ({ children }) => {
|
|
|
344
739
|
* This is the platform-agnostic base. Each platform wraps this with its own
|
|
345
740
|
* default components (web uses `<p>`, `<span>`; RN would use `<Text>`, etc.).
|
|
346
741
|
*/
|
|
347
|
-
const MessagePrimitiveParts = (
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
742
|
+
const MessagePrimitiveParts = (t0) => {
|
|
743
|
+
const $ = c(5);
|
|
744
|
+
const { components, unstable_showEmptyOnNonTextEnd: t1, children } = t0;
|
|
745
|
+
const unstable_showEmptyOnNonTextEnd = t1 === void 0 ? true : t1;
|
|
746
|
+
if (children) {
|
|
747
|
+
let t2;
|
|
748
|
+
if ($[0] !== children) {
|
|
749
|
+
t2 = /* @__PURE__ */ jsx(MessagePrimitivePartsInner, { children });
|
|
750
|
+
$[0] = children;
|
|
751
|
+
$[1] = t2;
|
|
752
|
+
} else t2 = $[1];
|
|
753
|
+
return t2;
|
|
754
|
+
}
|
|
755
|
+
let t2;
|
|
756
|
+
if ($[2] !== components || $[3] !== unstable_showEmptyOnNonTextEnd) {
|
|
757
|
+
t2 = /* @__PURE__ */ jsx(MessagePrimitivePartsCompat, {
|
|
758
|
+
components,
|
|
759
|
+
unstable_showEmptyOnNonTextEnd
|
|
760
|
+
});
|
|
761
|
+
$[2] = components;
|
|
762
|
+
$[3] = unstable_showEmptyOnNonTextEnd;
|
|
763
|
+
$[4] = t2;
|
|
764
|
+
} else t2 = $[4];
|
|
765
|
+
return t2;
|
|
353
766
|
};
|
|
354
767
|
MessagePrimitiveParts.displayName = "MessagePrimitive.Parts";
|
|
355
|
-
const MessagePrimitivePartsCompat = (
|
|
356
|
-
const
|
|
357
|
-
const
|
|
358
|
-
const
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
768
|
+
const MessagePrimitivePartsCompat = (t0) => {
|
|
769
|
+
const $ = c(15);
|
|
770
|
+
const { components, unstable_showEmptyOnNonTextEnd } = t0;
|
|
771
|
+
const contentLength = useAuiState(_temp12);
|
|
772
|
+
const { ranges: messageRanges, partIds } = useMessagePartsGroups(!!components?.ChainOfThought);
|
|
773
|
+
let t1;
|
|
774
|
+
bb0: {
|
|
775
|
+
if (contentLength === 0) {
|
|
776
|
+
let t2;
|
|
777
|
+
if ($[0] !== components) {
|
|
778
|
+
t2 = /* @__PURE__ */ jsx(EmptyParts, { components });
|
|
779
|
+
$[0] = components;
|
|
780
|
+
$[1] = t2;
|
|
781
|
+
} else t2 = $[1];
|
|
782
|
+
t1 = t2;
|
|
783
|
+
break bb0;
|
|
784
|
+
}
|
|
785
|
+
let t2;
|
|
786
|
+
if ($[2] !== components || $[3] !== messageRanges || $[4] !== partIds) {
|
|
787
|
+
const claimed = /* @__PURE__ */ new Set();
|
|
788
|
+
const toolLeafKey = (partIndex) => {
|
|
789
|
+
const id = partIds[partIndex];
|
|
790
|
+
if (id !== void 0 && !claimed.has(id)) {
|
|
791
|
+
claimed.add(id);
|
|
792
|
+
return `part-id:${id}`;
|
|
793
|
+
}
|
|
794
|
+
return `part-${partIndex}`;
|
|
795
|
+
};
|
|
796
|
+
t2 = messageRanges.map((range) => {
|
|
797
|
+
if (range.type === "single") return /* @__PURE__ */ jsx(MessagePrimitivePartByIndex, {
|
|
798
|
+
index: range.index,
|
|
799
|
+
components
|
|
800
|
+
}, range.index);
|
|
801
|
+
else if (range.type === "chainOfThoughtGroup") {
|
|
802
|
+
const ChainOfThoughtComponent = components?.ChainOfThought;
|
|
803
|
+
if (!ChainOfThoughtComponent) return null;
|
|
804
|
+
return /* @__PURE__ */ jsx(ChainOfThoughtByIndicesProvider, {
|
|
805
|
+
startIndex: range.startIndex,
|
|
806
|
+
endIndex: range.endIndex,
|
|
807
|
+
children: /* @__PURE__ */ jsx(ChainOfThoughtComponent, {})
|
|
808
|
+
}, `chainOfThought-${range.idKey ?? range.startIndex}`);
|
|
809
|
+
} else if (range.type === "toolGroup") return /* @__PURE__ */ jsx(components?.ToolGroup ?? defaultComponents.ToolGroup, {
|
|
369
810
|
startIndex: range.startIndex,
|
|
370
811
|
endIndex: range.endIndex,
|
|
371
|
-
children:
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
}
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
])
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
812
|
+
children: Array.from({ length: range.endIndex - range.startIndex + 1 }, (_, i) => {
|
|
813
|
+
const partIndex_0 = range.startIndex + i;
|
|
814
|
+
return /* @__PURE__ */ jsx(MessagePrimitivePartByIndex, {
|
|
815
|
+
index: partIndex_0,
|
|
816
|
+
components
|
|
817
|
+
}, toolLeafKey(partIndex_0));
|
|
818
|
+
})
|
|
819
|
+
}, `tool-${range.idKey ?? range.startIndex}`);
|
|
820
|
+
else return /* @__PURE__ */ jsx(components?.ReasoningGroup ?? defaultComponents.ReasoningGroup, {
|
|
821
|
+
startIndex: range.startIndex,
|
|
822
|
+
endIndex: range.endIndex,
|
|
823
|
+
children: Array.from({ length: range.endIndex - range.startIndex + 1 }, (__0, i_0) => {
|
|
824
|
+
const partIndex_1 = range.startIndex + i_0;
|
|
825
|
+
return /* @__PURE__ */ jsx(MessagePrimitivePartByIndex, {
|
|
826
|
+
index: partIndex_1,
|
|
827
|
+
components
|
|
828
|
+
}, `part-${partIndex_1}`);
|
|
829
|
+
})
|
|
830
|
+
}, `reasoning-${range.startIndex}`);
|
|
831
|
+
});
|
|
832
|
+
$[2] = components;
|
|
833
|
+
$[3] = messageRanges;
|
|
834
|
+
$[4] = partIds;
|
|
835
|
+
$[5] = t2;
|
|
836
|
+
} else t2 = $[5];
|
|
837
|
+
t1 = t2;
|
|
838
|
+
}
|
|
839
|
+
const partsElements = t1;
|
|
840
|
+
let t2;
|
|
841
|
+
if ($[6] !== components) {
|
|
842
|
+
t2 = components?.Quote && /* @__PURE__ */ jsx(QuoteRenderer, { Quote: components.Quote });
|
|
843
|
+
$[6] = components;
|
|
844
|
+
$[7] = t2;
|
|
845
|
+
} else t2 = $[7];
|
|
846
|
+
let t3;
|
|
847
|
+
if ($[8] !== components || $[9] !== unstable_showEmptyOnNonTextEnd) {
|
|
848
|
+
t3 = /* @__PURE__ */ jsx(ConditionalEmpty, {
|
|
405
849
|
components,
|
|
406
850
|
enabled: unstable_showEmptyOnNonTextEnd
|
|
407
|
-
})
|
|
408
|
-
|
|
851
|
+
});
|
|
852
|
+
$[8] = components;
|
|
853
|
+
$[9] = unstable_showEmptyOnNonTextEnd;
|
|
854
|
+
$[10] = t3;
|
|
855
|
+
} else t3 = $[10];
|
|
856
|
+
let t4;
|
|
857
|
+
if ($[11] !== partsElements || $[12] !== t2 || $[13] !== t3) {
|
|
858
|
+
t4 = /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
859
|
+
t2,
|
|
860
|
+
partsElements,
|
|
861
|
+
t3
|
|
862
|
+
] });
|
|
863
|
+
$[11] = partsElements;
|
|
864
|
+
$[12] = t2;
|
|
865
|
+
$[13] = t3;
|
|
866
|
+
$[14] = t4;
|
|
867
|
+
} else t4 = $[14];
|
|
868
|
+
return t4;
|
|
409
869
|
};
|
|
870
|
+
function _temp(c) {
|
|
871
|
+
return c.type;
|
|
872
|
+
}
|
|
873
|
+
function _temp2(s) {
|
|
874
|
+
return s.message.parts.map(_temp);
|
|
875
|
+
}
|
|
876
|
+
function _temp3(c_0) {
|
|
877
|
+
return c_0.type === "tool-call" ? c_0.toolCallId : void 0;
|
|
878
|
+
}
|
|
879
|
+
function _temp4(s_0) {
|
|
880
|
+
return s_0.message.parts.map(_temp3);
|
|
881
|
+
}
|
|
882
|
+
function _temp5(s) {
|
|
883
|
+
return s.part;
|
|
884
|
+
}
|
|
885
|
+
function _temp6(s) {
|
|
886
|
+
return s.message.status ?? COMPLETE_STATUS;
|
|
887
|
+
}
|
|
888
|
+
function _temp7(s) {
|
|
889
|
+
return s.part;
|
|
890
|
+
}
|
|
891
|
+
function _temp8(s_0) {
|
|
892
|
+
return s_0.part.type === "tool-call" ? resolveToolRender(s_0.tools, s_0.part) : null;
|
|
893
|
+
}
|
|
894
|
+
function _temp9(s) {
|
|
895
|
+
return s.part;
|
|
896
|
+
}
|
|
897
|
+
function _temp0(s_0) {
|
|
898
|
+
return s_0.part.type === "data" ? getDataRenderer(s_0.dataRenderers, s_0.part.name, void 0) ?? null : null;
|
|
899
|
+
}
|
|
900
|
+
function _temp1(s) {
|
|
901
|
+
return s.part.type;
|
|
902
|
+
}
|
|
903
|
+
function _temp10(s) {
|
|
904
|
+
return s.message.parts.length;
|
|
905
|
+
}
|
|
906
|
+
function _temp11(s_0) {
|
|
907
|
+
return (s_0.message.status?.type ?? "complete") === "running";
|
|
908
|
+
}
|
|
909
|
+
function _temp12(s) {
|
|
910
|
+
return s.message.parts.length;
|
|
911
|
+
}
|
|
410
912
|
//#endregion
|
|
411
|
-
export { MessagePartChildren, MessagePartComponent, MessagePrimitivePartByIndex, MessagePrimitiveParts, defaultComponents };
|
|
913
|
+
export { MessagePartChildren, MessagePartComponent, MessagePrimitivePartByIndex, MessagePrimitiveParts, defaultComponents, groupMessageParts };
|
|
412
914
|
|
|
413
915
|
//# sourceMappingURL=MessageParts.js.map
|