@assistant-ui/core 0.2.14 → 0.2.16
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/voice.js.map +1 -1
- package/dist/index.d.ts +2 -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 +1 -0
- 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.js +26 -7
- 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.js +54 -35
- package/dist/react/client/DataRenderers.js.map +1 -1
- package/dist/react/client/Interactables.js +67 -67
- package/dist/react/client/Interactables.js.map +1 -1
- package/dist/react/client/Tools.d.ts.map +1 -1
- package/dist/react/client/Tools.js +118 -55
- 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.d.ts +3 -3
- package/dist/react/model-context/toolbox.d.ts.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.js +3 -3
- package/dist/react/primitives/message/MessageGroupedParts.js.map +1 -1
- package/dist/react/primitives/message/MessageParts.js +649 -181
- 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.js +73 -25
- 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.js +19 -4
- package/dist/react/runtimes/RemoteThreadListHookInstanceManager.js.map +1 -1
- 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.js +10 -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.js +17 -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.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/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.js.map +1 -1
- package/dist/runtime/api/thread-list-item-runtime.js.map +1 -1
- package/dist/runtime/api/thread-list-runtime.js.map +1 -1
- 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.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/interfaces/thread-runtime-core.d.ts +2 -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-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.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-thread-list-runtime-core.js.map +1 -1
- package/dist/runtimes/local/local-thread-runtime-core.d.ts +1 -0
- package/dist/runtimes/local/local-thread-runtime-core.d.ts.map +1 -1
- package/dist/runtimes/local/local-thread-runtime-core.js +9 -7
- package/dist/runtimes/local/local-thread-runtime-core.js.map +1 -1
- package/dist/runtimes/local/should-continue.js +1 -1
- package/dist/runtimes/local/should-continue.js.map +1 -1
- 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.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.js.map +1 -1
- package/dist/runtimes/tool-invocations/ToolInvocationTracker.js.map +1 -1
- package/dist/store/clients/chain-of-thought-client.js +37 -19
- package/dist/store/clients/chain-of-thought-client.js.map +1 -1
- package/dist/store/clients/model-context-client.js +64 -14
- package/dist/store/clients/model-context-client.js.map +1 -1
- package/dist/store/clients/no-op-composer-client.js +94 -53
- package/dist/store/clients/no-op-composer-client.js.map +1 -1
- package/dist/store/clients/runtime-adapter.js.map +1 -1
- package/dist/store/clients/suggestions.d.ts.map +1 -1
- package/dist/store/clients/suggestions.js +59 -21
- package/dist/store/clients/suggestions.js.map +1 -1
- package/dist/store/clients/thread-message-client.d.ts.map +1 -1
- package/dist/store/clients/thread-message-client.js +176 -69
- package/dist/store/clients/thread-message-client.js.map +1 -1
- package/dist/store/runtime-clients/attachment-runtime-client.js +29 -6
- package/dist/store/runtime-clients/attachment-runtime-client.js.map +1 -1
- package/dist/store/runtime-clients/composer-runtime-client.d.ts.map +1 -1
- package/dist/store/runtime-clients/composer-runtime-client.js +188 -68
- 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.js +47 -8
- package/dist/store/runtime-clients/message-part-runtime-client.js.map +1 -1
- package/dist/store/runtime-clients/message-runtime-client.d.ts.map +1 -1
- package/dist/store/runtime-clients/message-runtime-client.js +214 -52
- package/dist/store/runtime-clients/message-runtime-client.js.map +1 -1
- package/dist/store/runtime-clients/thread-list-item-runtime-client.js +69 -25
- 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.map +1 -1
- package/dist/store/runtime-clients/thread-list-runtime-client.js +137 -34
- package/dist/store/runtime-clients/thread-list-runtime-client.js.map +1 -1
- package/dist/store/runtime-clients/thread-runtime-client.d.ts.map +1 -1
- package/dist/store/runtime-clients/thread-runtime-client.js +192 -71
- 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/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/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 +8 -8
- package/src/index.ts +4 -0
- package/src/internal.ts +1 -0
- package/src/model-context/types.ts +1 -0
- package/src/react/AssistantProvider.tsx +7 -0
- package/src/react/client/Tools.ts +3 -5
- package/src/react/model-context/toolbox.test.ts +2 -1
- package/src/react/model-context/toolbox.ts +2 -6
- package/src/react/runtimes/external-message-converter.ts +3 -1
- package/src/react/types/MessagePartComponentTypes.ts +5 -5
- package/src/runtime/api/message-part-runtime.ts +14 -11
- package/src/runtime/interfaces/thread-runtime-core.ts +2 -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/local/local-thread-runtime-core.test.ts +61 -2
- package/src/runtimes/local/local-thread-runtime-core.ts +17 -8
- package/src/runtimes/local/should-continue.ts +2 -1
- package/src/store/clients/suggestions.ts +3 -5
- package/src/store/clients/thread-message-client.ts +13 -14
- package/src/store/runtime-clients/composer-runtime-client.ts +18 -21
- package/src/store/runtime-clients/liveRef.ts +5 -0
- package/src/store/runtime-clients/message-runtime-client.ts +16 -21
- package/src/store/runtime-clients/thread-list-runtime-client.ts +3 -5
- package/src/store/runtime-clients/thread-runtime-client.ts +9 -10
- package/src/store/runtime-clients/useSubscribable.ts +2 -10
- package/src/store/scopes/part.ts +5 -2
- 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
|
|
@@ -98,37 +99,117 @@ const groupMessageParts = (messageTypes, useChainOfThought, partIds) => {
|
|
|
98
99
|
return ranges;
|
|
99
100
|
};
|
|
100
101
|
const useMessagePartsGroups = (useChainOfThought) => {
|
|
101
|
-
const
|
|
102
|
-
const
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
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;
|
|
117
146
|
};
|
|
118
|
-
const ToolUIDisplay = (
|
|
119
|
-
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);
|
|
120
168
|
if (!Render) return null;
|
|
121
|
-
|
|
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;
|
|
122
177
|
};
|
|
123
178
|
const getDataRenderer = (dataRenderers, name, inlineFallback) => {
|
|
124
179
|
const named = dataRenderers.renderers[name]?.[0];
|
|
125
180
|
if (named) return named;
|
|
126
181
|
return dataRenderers.fallbacks[0] ?? inlineFallback;
|
|
127
182
|
};
|
|
128
|
-
const DataUIDisplay = (
|
|
129
|
-
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);
|
|
130
204
|
if (!Render) return null;
|
|
131
|
-
|
|
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;
|
|
132
213
|
};
|
|
133
214
|
/**
|
|
134
215
|
* Platform-agnostic no-op default components.
|
|
@@ -144,54 +225,187 @@ const defaultComponents = {
|
|
|
144
225
|
ToolGroup: ({ children }) => children,
|
|
145
226
|
ReasoningGroup: ({ children }) => children
|
|
146
227
|
};
|
|
147
|
-
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;
|
|
148
251
|
const aui = useAui();
|
|
149
|
-
const part = useAuiState(
|
|
252
|
+
const part = useAuiState(_temp5);
|
|
150
253
|
const type = part.type;
|
|
151
254
|
if (type === "tool-call") {
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
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
|
+
}
|
|
161
294
|
const Tool = tools.by_name?.[part.toolName] ?? tools.Fallback;
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
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;
|
|
169
312
|
}
|
|
170
313
|
if (part.status?.type === "requires-action") throw new Error("Encountered unexpected requires-action status");
|
|
171
314
|
switch (type) {
|
|
172
|
-
case "text":
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
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
|
+
}
|
|
178
375
|
case "data": {
|
|
179
376
|
const Data = data?.by_name?.[part.name] ?? data?.Fallback;
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
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;
|
|
184
388
|
}
|
|
185
|
-
case "generative-ui":
|
|
389
|
+
case "generative-ui": {
|
|
186
390
|
if (!generativeUI?.components) {
|
|
187
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 />.");
|
|
188
392
|
return null;
|
|
189
393
|
}
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
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
|
+
}
|
|
195
409
|
default:
|
|
196
410
|
console.warn(`Unknown message part type: ${type}`);
|
|
197
411
|
return null;
|
|
@@ -200,53 +414,128 @@ const MessagePartComponent = ({ components: { Text = defaultComponents.Text, Rea
|
|
|
200
414
|
/**
|
|
201
415
|
* Renders a single message part at the specified index.
|
|
202
416
|
*/
|
|
203
|
-
const MessagePrimitivePartByIndex = memo((
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
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;
|
|
208
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);
|
|
209
438
|
MessagePrimitivePartByIndex.displayName = "MessagePrimitive.PartByIndex";
|
|
210
|
-
const EmptyPartFallback = (
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
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, {
|
|
215
446
|
type: "text",
|
|
216
447
|
text: "",
|
|
217
448
|
status
|
|
218
|
-
})
|
|
219
|
-
|
|
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;
|
|
220
466
|
};
|
|
221
467
|
const COMPLETE_STATUS = Object.freeze({ type: "complete" });
|
|
222
468
|
const RUNNING_STATUS = Object.freeze({ type: "running" });
|
|
223
|
-
const EmptyPartsImpl = (
|
|
224
|
-
const
|
|
225
|
-
|
|
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
|
+
}
|
|
226
483
|
if (status.type !== "running") return null;
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
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;
|
|
231
496
|
};
|
|
232
497
|
const EmptyParts = memo(EmptyPartsImpl, (prev, next) => prev.components?.Empty === next.components?.Empty && prev.components?.Text === next.components?.Text);
|
|
233
|
-
const ConditionalEmptyImpl = (
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
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;
|
|
241
520
|
};
|
|
242
521
|
const ConditionalEmpty = memo(ConditionalEmptyImpl, (prev, next) => prev.enabled === next.enabled && prev.components?.Empty === next.components?.Empty && prev.components?.Text === next.components?.Text);
|
|
243
|
-
const QuoteRendererImpl = (
|
|
522
|
+
const QuoteRendererImpl = (t0) => {
|
|
523
|
+
const $ = c(4);
|
|
524
|
+
const { Quote } = t0;
|
|
244
525
|
const quoteInfo = useAuiState(getMessageQuote);
|
|
245
526
|
if (!quoteInfo) return null;
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
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;
|
|
250
539
|
};
|
|
251
540
|
const QuoteRenderer = memo(QuoteRendererImpl);
|
|
252
541
|
function resolveToolRender(toolsState, part) {
|
|
@@ -260,26 +549,66 @@ function resolveToolRender(toolsState, part) {
|
|
|
260
549
|
* current part context. Reads tool registry and part state from context.
|
|
261
550
|
*/
|
|
262
551
|
const RegisteredToolUI = () => {
|
|
552
|
+
const $ = c(12);
|
|
263
553
|
const aui = useAui();
|
|
264
|
-
const part = useAuiState(
|
|
265
|
-
const Render = useAuiState(
|
|
554
|
+
const part = useAuiState(_temp7);
|
|
555
|
+
const Render = useAuiState(_temp8);
|
|
266
556
|
if (!Render || part.type !== "tool-call") return null;
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
}
|
|
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;
|
|
273
593
|
};
|
|
274
594
|
/**
|
|
275
595
|
* Stable propless component that renders the registered data renderer UI
|
|
276
596
|
* for the current part context.
|
|
277
597
|
*/
|
|
278
598
|
const RegisteredDataRendererUI = () => {
|
|
279
|
-
const
|
|
280
|
-
const
|
|
599
|
+
const $ = c(3);
|
|
600
|
+
const part = useAuiState(_temp9);
|
|
601
|
+
const Render = useAuiState(_temp0);
|
|
281
602
|
if (!Render || part.type !== "data") return null;
|
|
282
|
-
|
|
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;
|
|
283
612
|
};
|
|
284
613
|
/**
|
|
285
614
|
* Fallback component rendered when the children render function returns null.
|
|
@@ -295,9 +624,24 @@ const RegisteredDataRendererUI = () => {
|
|
|
295
624
|
* To explicitly render nothing (suppressing registered UIs), return <></>.
|
|
296
625
|
*/
|
|
297
626
|
const DefaultPartFallback = () => {
|
|
298
|
-
const
|
|
299
|
-
|
|
300
|
-
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
|
+
}
|
|
301
645
|
return null;
|
|
302
646
|
};
|
|
303
647
|
const EMPTY_RUNNING_TEXT_PART = Object.freeze({
|
|
@@ -319,7 +663,7 @@ const MessagePartChildren = ({ index, children }) => {
|
|
|
319
663
|
return /* @__PURE__ */ jsx(PartByIndexProvider, {
|
|
320
664
|
index,
|
|
321
665
|
children: /* @__PURE__ */ jsx(RenderChildrenWithAccessor, {
|
|
322
|
-
getItemState: (
|
|
666
|
+
getItemState: (aui_0) => aui_0.message().part({ index }).getState(),
|
|
323
667
|
children: (getItem) => children({ get part() {
|
|
324
668
|
const state = getItem();
|
|
325
669
|
if (state.type === "tool-call") {
|
|
@@ -345,22 +689,49 @@ const MessagePartChildren = ({ index, children }) => {
|
|
|
345
689
|
})
|
|
346
690
|
});
|
|
347
691
|
};
|
|
348
|
-
const MessagePrimitivePartsInner = (
|
|
349
|
-
const
|
|
350
|
-
const
|
|
692
|
+
const MessagePrimitivePartsInner = (t0) => {
|
|
693
|
+
const $ = c(9);
|
|
694
|
+
const { children } = t0;
|
|
695
|
+
const contentLength = useAuiState(_temp10);
|
|
696
|
+
const isRunning = useAuiState(_temp11);
|
|
351
697
|
const isEmptyRunning = contentLength === 0 && isRunning;
|
|
352
698
|
if (contentLength === 0) {
|
|
353
699
|
if (!isEmptyRunning) return null;
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
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;
|
|
359
717
|
}
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
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;
|
|
364
735
|
};
|
|
365
736
|
/**
|
|
366
737
|
* Renders the parts of a message with support for multiple content types.
|
|
@@ -368,79 +739,176 @@ const MessagePrimitivePartsInner = ({ children }) => {
|
|
|
368
739
|
* This is the platform-agnostic base. Each platform wraps this with its own
|
|
369
740
|
* default components (web uses `<p>`, `<span>`; RN would use `<Text>`, etc.).
|
|
370
741
|
*/
|
|
371
|
-
const MessagePrimitiveParts = (
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
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;
|
|
377
766
|
};
|
|
378
767
|
MessagePrimitiveParts.displayName = "MessagePrimitive.Parts";
|
|
379
|
-
const MessagePrimitivePartsCompat = (
|
|
380
|
-
const
|
|
768
|
+
const MessagePrimitivePartsCompat = (t0) => {
|
|
769
|
+
const $ = c(15);
|
|
770
|
+
const { components, unstable_showEmptyOnNonTextEnd } = t0;
|
|
771
|
+
const contentLength = useAuiState(_temp12);
|
|
381
772
|
const { ranges: messageRanges, partIds } = useMessagePartsGroups(!!components?.ChainOfThought);
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
}
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
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, {
|
|
402
810
|
startIndex: range.startIndex,
|
|
403
811
|
endIndex: range.endIndex,
|
|
404
|
-
children:
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
}
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
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, {
|
|
439
849
|
components,
|
|
440
850
|
enabled: unstable_showEmptyOnNonTextEnd
|
|
441
|
-
})
|
|
442
|
-
|
|
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;
|
|
443
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
|
+
}
|
|
444
912
|
//#endregion
|
|
445
913
|
export { MessagePartChildren, MessagePartComponent, MessagePrimitivePartByIndex, MessagePrimitiveParts, defaultComponents, groupMessageParts };
|
|
446
914
|
|