@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
|
@@ -1,71 +1,112 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { c } from "@assistant-ui/tap/react-shim/compiler-runtime";
|
|
2
2
|
import { resource } from "@assistant-ui/tap";
|
|
3
3
|
//#region src/store/clients/no-op-composer-client.ts
|
|
4
|
-
const useNoOpComposerClient = (
|
|
5
|
-
const
|
|
6
|
-
|
|
4
|
+
const useNoOpComposerClient = (t0) => {
|
|
5
|
+
const $ = c(7);
|
|
6
|
+
const { type } = t0;
|
|
7
|
+
let t1;
|
|
8
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
9
|
+
t1 = [];
|
|
10
|
+
$[0] = t1;
|
|
11
|
+
} else t1 = $[0];
|
|
12
|
+
let t2;
|
|
13
|
+
if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
|
|
14
|
+
t2 = {};
|
|
15
|
+
$[1] = t2;
|
|
16
|
+
} else t2 = $[1];
|
|
17
|
+
let t3;
|
|
18
|
+
if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
|
|
19
|
+
t3 = [];
|
|
20
|
+
$[2] = t3;
|
|
21
|
+
} else t3 = $[2];
|
|
22
|
+
let t4;
|
|
23
|
+
if ($[3] !== type) {
|
|
24
|
+
t4 = {
|
|
7
25
|
isEditing: false,
|
|
8
26
|
isEmpty: true,
|
|
9
27
|
text: "",
|
|
10
28
|
attachmentAccept: "*",
|
|
11
|
-
attachments:
|
|
29
|
+
attachments: t1,
|
|
12
30
|
role: "user",
|
|
13
|
-
runConfig:
|
|
31
|
+
runConfig: t2,
|
|
14
32
|
canCancel: false,
|
|
15
33
|
canSend: false,
|
|
16
34
|
type,
|
|
17
35
|
dictation: void 0,
|
|
18
36
|
quote: void 0,
|
|
19
|
-
queue:
|
|
37
|
+
queue: t3
|
|
20
38
|
};
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
cancel: () => {
|
|
49
|
-
throw new Error("Not supported");
|
|
50
|
-
},
|
|
51
|
-
startDictation: () => {
|
|
52
|
-
throw new Error("Not supported");
|
|
53
|
-
},
|
|
54
|
-
stopDictation: () => {
|
|
55
|
-
throw new Error("Not supported");
|
|
56
|
-
},
|
|
57
|
-
beginEdit: () => {
|
|
58
|
-
throw new Error("Not supported");
|
|
59
|
-
},
|
|
60
|
-
setQuote: () => {
|
|
61
|
-
throw new Error("Not supported");
|
|
62
|
-
},
|
|
63
|
-
queueItem: () => {
|
|
64
|
-
throw new Error("Not supported");
|
|
65
|
-
}
|
|
66
|
-
};
|
|
39
|
+
$[3] = type;
|
|
40
|
+
$[4] = t4;
|
|
41
|
+
} else t4 = $[4];
|
|
42
|
+
const state = t4;
|
|
43
|
+
let t5;
|
|
44
|
+
if ($[5] !== state) {
|
|
45
|
+
t5 = {
|
|
46
|
+
getState: () => state,
|
|
47
|
+
setText: _temp,
|
|
48
|
+
setRole: _temp2,
|
|
49
|
+
setRunConfig: _temp3,
|
|
50
|
+
addAttachment: _temp4,
|
|
51
|
+
clearAttachments: _temp5,
|
|
52
|
+
attachment: _temp6,
|
|
53
|
+
reset: _temp7,
|
|
54
|
+
send: _temp8,
|
|
55
|
+
cancel: _temp9,
|
|
56
|
+
startDictation: _temp0,
|
|
57
|
+
stopDictation: _temp1,
|
|
58
|
+
beginEdit: _temp10,
|
|
59
|
+
setQuote: _temp11,
|
|
60
|
+
queueItem: _temp12
|
|
61
|
+
};
|
|
62
|
+
$[5] = state;
|
|
63
|
+
$[6] = t5;
|
|
64
|
+
} else t5 = $[6];
|
|
65
|
+
return t5;
|
|
67
66
|
};
|
|
68
67
|
const NoOpComposerClient = resource(useNoOpComposerClient);
|
|
68
|
+
function _temp() {
|
|
69
|
+
throw new Error("Not supported");
|
|
70
|
+
}
|
|
71
|
+
function _temp2() {
|
|
72
|
+
throw new Error("Not supported");
|
|
73
|
+
}
|
|
74
|
+
function _temp3() {
|
|
75
|
+
throw new Error("Not supported");
|
|
76
|
+
}
|
|
77
|
+
function _temp4() {
|
|
78
|
+
throw new Error("Not supported");
|
|
79
|
+
}
|
|
80
|
+
function _temp5() {
|
|
81
|
+
throw new Error("Not supported");
|
|
82
|
+
}
|
|
83
|
+
function _temp6() {
|
|
84
|
+
throw new Error("Not supported");
|
|
85
|
+
}
|
|
86
|
+
function _temp7() {
|
|
87
|
+
throw new Error("Not supported");
|
|
88
|
+
}
|
|
89
|
+
function _temp8() {
|
|
90
|
+
throw new Error("Not supported");
|
|
91
|
+
}
|
|
92
|
+
function _temp9() {
|
|
93
|
+
throw new Error("Not supported");
|
|
94
|
+
}
|
|
95
|
+
function _temp0() {
|
|
96
|
+
throw new Error("Not supported");
|
|
97
|
+
}
|
|
98
|
+
function _temp1() {
|
|
99
|
+
throw new Error("Not supported");
|
|
100
|
+
}
|
|
101
|
+
function _temp10() {
|
|
102
|
+
throw new Error("Not supported");
|
|
103
|
+
}
|
|
104
|
+
function _temp11() {
|
|
105
|
+
throw new Error("Not supported");
|
|
106
|
+
}
|
|
107
|
+
function _temp12() {
|
|
108
|
+
throw new Error("Not supported");
|
|
109
|
+
}
|
|
69
110
|
//#endregion
|
|
70
111
|
export { NoOpComposerClient };
|
|
71
112
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"no-op-composer-client.js","names":[],"sources":["../../../src/store/clients/no-op-composer-client.ts"],"sourcesContent":["import { useMemo } from \"react\";\nimport { resource } from \"@assistant-ui/tap\";\nimport type { ClientOutput } from \"@assistant-ui/store\";\nimport type { ComposerState } from \"../scopes/composer\";\n\nconst useNoOpComposerClient = ({\n type,\n}: {\n type: \"edit\" | \"thread\";\n}): ClientOutput<\"composer\"> => {\n const state = useMemo<ComposerState>(() => {\n return {\n isEditing: false,\n isEmpty: true,\n text: \"\",\n attachmentAccept: \"*\",\n attachments: [],\n role: \"user\",\n runConfig: {},\n canCancel: false,\n canSend: false,\n type: type,\n dictation: undefined,\n quote: undefined,\n queue: [],\n };\n }, [type]);\n\n return {\n getState: () => state,\n setText: () => {\n throw new Error(\"Not supported\");\n },\n setRole: () => {\n throw new Error(\"Not supported\");\n },\n setRunConfig: () => {\n throw new Error(\"Not supported\");\n },\n addAttachment: () => {\n throw new Error(\"Not supported\");\n },\n clearAttachments: () => {\n throw new Error(\"Not supported\");\n },\n attachment: () => {\n throw new Error(\"Not supported\");\n },\n reset: () => {\n throw new Error(\"Not supported\");\n },\n send: () => {\n throw new Error(\"Not supported\");\n },\n cancel: () => {\n throw new Error(\"Not supported\");\n },\n startDictation: () => {\n throw new Error(\"Not supported\");\n },\n stopDictation: () => {\n throw new Error(\"Not supported\");\n },\n beginEdit: () => {\n throw new Error(\"Not supported\");\n },\n setQuote: () => {\n throw new Error(\"Not supported\");\n },\n queueItem: () => {\n throw new Error(\"Not supported\");\n },\n };\n};\n\nexport const NoOpComposerClient = resource(useNoOpComposerClient);\n"],"mappings":";;;AAKA,
|
|
1
|
+
{"version":3,"file":"no-op-composer-client.js","names":["useMemo","resource","ClientOutput","ComposerState","useNoOpComposerClient","t0","$","_c","type","t1","Symbol","for","t2","t3","t4","isEditing","isEmpty","text","attachmentAccept","attachments","role","runConfig","canCancel","canSend","dictation","undefined","quote","queue","state","t5","getState","setText","_temp","setRole","_temp2","setRunConfig","_temp3","addAttachment","_temp4","clearAttachments","_temp5","attachment","_temp6","reset","_temp7","send","_temp8","cancel","_temp9","startDictation","_temp0","stopDictation","_temp1","beginEdit","_temp10","setQuote","_temp11","queueItem","_temp12","NoOpComposerClient","Error"],"sources":["../../../src/store/clients/no-op-composer-client.ts"],"sourcesContent":["import { useMemo } from \"react\";\nimport { resource } from \"@assistant-ui/tap\";\nimport type { ClientOutput } from \"@assistant-ui/store\";\nimport type { ComposerState } from \"../scopes/composer\";\n\nconst useNoOpComposerClient = ({\n type,\n}: {\n type: \"edit\" | \"thread\";\n}): ClientOutput<\"composer\"> => {\n const state = useMemo<ComposerState>(() => {\n return {\n isEditing: false,\n isEmpty: true,\n text: \"\",\n attachmentAccept: \"*\",\n attachments: [],\n role: \"user\",\n runConfig: {},\n canCancel: false,\n canSend: false,\n type: type,\n dictation: undefined,\n quote: undefined,\n queue: [],\n };\n }, [type]);\n\n return {\n getState: () => state,\n setText: () => {\n throw new Error(\"Not supported\");\n },\n setRole: () => {\n throw new Error(\"Not supported\");\n },\n setRunConfig: () => {\n throw new Error(\"Not supported\");\n },\n addAttachment: () => {\n throw new Error(\"Not supported\");\n },\n clearAttachments: () => {\n throw new Error(\"Not supported\");\n },\n attachment: () => {\n throw new Error(\"Not supported\");\n },\n reset: () => {\n throw new Error(\"Not supported\");\n },\n send: () => {\n throw new Error(\"Not supported\");\n },\n cancel: () => {\n throw new Error(\"Not supported\");\n },\n startDictation: () => {\n throw new Error(\"Not supported\");\n },\n stopDictation: () => {\n throw new Error(\"Not supported\");\n },\n beginEdit: () => {\n throw new Error(\"Not supported\");\n },\n setQuote: () => {\n throw new Error(\"Not supported\");\n },\n queueItem: () => {\n throw new Error(\"Not supported\");\n },\n };\n};\n\nexport const NoOpComposerClient = resource(useNoOpComposerClient);\n"],"mappings":";;;AAKA,MAAMI,yBAAwBC,OAAA;CAAA,MAAAC,IAAAC,EAAA,CAAA;CAAC,MAAA,EAAAC,SAAAH;CAI9B,IAAAI;CAAA,IAAAH,EAAA,OAAAI,OAAAC,IAAA,2BAAA,GAAA;EAOkBF,KAAA,CAAA;EAAEH,EAAA,KAAAG;CAAA,OAAAA,KAAAH,EAAA;CAAA,IAAAM;CAAA,IAAAN,EAAA,OAAAI,OAAAC,IAAA,2BAAA,GAAA;EAEJC,KAAA,CAAC;EAACN,EAAA,KAAAM;CAAA,OAAAA,KAAAN,EAAA;CAAA,IAAAO;CAAA,IAAAP,EAAA,OAAAI,OAAAC,IAAA,2BAAA,GAAA;EAMNE,KAAA,CAAA;EAAEP,EAAA,KAAAO;CAAA,OAAAA,KAAAP,EAAA;CAAA,IAAAQ;CAAA,IAAAR,EAAA,OAAAE,MAAA;EAbJM,KAAA;GAAAC,WACM;GAAKC,SACP;GAAIC,MACP;GAAEC,kBACU;GAAGC,aACRV;GAAEW,MACT;GAAMC,WACDT;GAAEU,WACF;GAAKC,SACP;GAAKf;GAAAgB,WAEHC,KAAAA;GAASC,OAC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AIM,MAAM,eAAe;AAAE;AA3DT,SAAAJ,UAAA;CA8DxB,MAAM,IAAII,MAAM,eAAe;AAAE;AA9DT,SAAAF,UAAA;CAiExB,MAAM,IAAIE,MAAM,eAAe;AAAE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime-adapter.js","names":[],"sources":["../../../src/store/clients/runtime-adapter.ts"],"sourcesContent":["import {\n Derived,\n type ScopesConfig,\n type AssistantClient,\n} from \"@assistant-ui/store\";\nimport { ModelContext } from \"./model-context-client\";\nimport { Suggestions } from \"./suggestions\";\n\nexport const baseRuntimeAdapterTransformScopes = (\n scopes: ScopesConfig,\n parent: AssistantClient,\n): void => {\n scopes.thread ??= Derived({\n source: \"threads\",\n query: { type: \"main\" },\n get: (aui) => aui.threads().thread(\"main\"),\n });\n scopes.threadListItem ??= Derived({\n source: \"threads\",\n query: { type: \"main\" },\n get: (aui) => aui.threads().item(\"main\"),\n });\n scopes.composer ??= Derived({\n source: \"thread\",\n query: {},\n get: (aui) => aui.threads().thread(\"main\").composer(),\n });\n\n if (!scopes.modelContext && parent.modelContext.source === null) {\n scopes.modelContext = ModelContext();\n }\n if (!scopes.suggestions && parent.suggestions.source === null) {\n scopes.suggestions = Suggestions();\n }\n};\n"],"mappings":";;;;AAQA,
|
|
1
|
+
{"version":3,"file":"runtime-adapter.js","names":["Derived","ScopesConfig","AssistantClient","ModelContext","Suggestions","baseRuntimeAdapterTransformScopes","scopes","parent","thread","source","query","type","get","aui","threads","threadListItem","item","composer","modelContext","suggestions"],"sources":["../../../src/store/clients/runtime-adapter.ts"],"sourcesContent":["import {\n Derived,\n type ScopesConfig,\n type AssistantClient,\n} from \"@assistant-ui/store\";\nimport { ModelContext } from \"./model-context-client\";\nimport { Suggestions } from \"./suggestions\";\n\nexport const baseRuntimeAdapterTransformScopes = (\n scopes: ScopesConfig,\n parent: AssistantClient,\n): void => {\n scopes.thread ??= Derived({\n source: \"threads\",\n query: { type: \"main\" },\n get: (aui) => aui.threads().thread(\"main\"),\n });\n scopes.threadListItem ??= Derived({\n source: \"threads\",\n query: { type: \"main\" },\n get: (aui) => aui.threads().item(\"main\"),\n });\n scopes.composer ??= Derived({\n source: \"thread\",\n query: {},\n get: (aui) => aui.threads().thread(\"main\").composer(),\n });\n\n if (!scopes.modelContext && parent.modelContext.source === null) {\n scopes.modelContext = ModelContext();\n }\n if (!scopes.suggestions && parent.suggestions.source === null) {\n scopes.suggestions = Suggestions();\n }\n};\n"],"mappings":";;;;AAQA,MAAaK,qCACXC,QACAC,WACS;CACTD,OAAOE,WAAWR,QAAQ;EACxBS,QAAQ;EACRC,OAAO,EAAEC,MAAM,OAAO;EACtBC,MAAMC,QAAQA,IAAIC,QAAQ,CAAC,CAACN,OAAO,MAAM;CAC3C,CAAC;CACDF,OAAOS,mBAAmBf,QAAQ;EAChCS,QAAQ;EACRC,OAAO,EAAEC,MAAM,OAAO;EACtBC,MAAMC,QAAQA,IAAIC,QAAQ,CAAC,CAACE,KAAK,MAAM;CACzC,CAAC;CACDV,OAAOW,aAAajB,QAAQ;EAC1BS,QAAQ;EACRC,OAAO,CAAC;EACRE,MAAMC,QAAQA,IAAIC,QAAQ,CAAC,CAACN,OAAO,MAAM,CAAC,CAACS,SAAS;CACtD,CAAC;CAED,IAAI,CAACX,OAAOY,gBAAgBX,OAAOW,aAAaT,WAAW,MACzDH,OAAOY,eAAef,aAAa;CAErC,IAAI,CAACG,OAAOa,eAAeZ,OAAOY,YAAYV,WAAW,MACvDH,OAAOa,cAAcf,YAAY;AAErC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"suggestions.d.ts","names":[],"sources":["../../../src/store/clients/suggestions.ts"],"mappings":";;;KAOY,gBAAA;EAEN,KAAA;EAAe,KAAA;EAAe,MAAA;AAAA;AAAA,
|
|
1
|
+
{"version":3,"file":"suggestions.d.ts","names":[],"sources":["../../../src/store/clients/suggestions.ts"],"mappings":";;;KAOY,gBAAA;EAEN,KAAA;EAAe,KAAA;EAAe,MAAA;AAAA;AAAA,cAkDvB,WAAA,8BAAW,QAAA,CAAA,YAAA,kBAAA,WAAA,GAAA,gBAAA"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { useState } from "@assistant-ui/tap/react-shim";
|
|
2
2
|
import { useClientLookup } from "@assistant-ui/store";
|
|
3
|
+
import { c } from "@assistant-ui/tap/react-shim/compiler-runtime";
|
|
3
4
|
import { resource, withKey } from "@assistant-ui/tap";
|
|
4
5
|
//#region src/store/clients/suggestions.ts
|
|
5
6
|
const useSuggestionClient = (state) => {
|
|
@@ -7,29 +8,66 @@ const useSuggestionClient = (state) => {
|
|
|
7
8
|
};
|
|
8
9
|
const SuggestionClient = resource(useSuggestionClient);
|
|
9
10
|
const useSuggestionsResource = (suggestions) => {
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
11
|
+
const $ = c(11);
|
|
12
|
+
let t0;
|
|
13
|
+
if ($[0] !== suggestions) {
|
|
14
|
+
t0 = () => {
|
|
15
|
+
return { suggestions: (suggestions ?? []).map(_temp) };
|
|
16
|
+
};
|
|
17
|
+
$[0] = suggestions;
|
|
18
|
+
$[1] = t0;
|
|
19
|
+
} else t0 = $[1];
|
|
20
|
+
const [state] = useState(t0);
|
|
21
|
+
let t1;
|
|
22
|
+
if ($[2] !== state.suggestions) {
|
|
23
|
+
t1 = state.suggestions.map(_temp2);
|
|
24
|
+
$[2] = state.suggestions;
|
|
25
|
+
$[3] = t1;
|
|
26
|
+
} else t1 = $[3];
|
|
27
|
+
const suggestionClients = useClientLookup(t1);
|
|
28
|
+
let t2;
|
|
29
|
+
if ($[4] !== state) {
|
|
30
|
+
t2 = () => state;
|
|
31
|
+
$[4] = state;
|
|
32
|
+
$[5] = t2;
|
|
33
|
+
} else t2 = $[5];
|
|
34
|
+
let t3;
|
|
35
|
+
if ($[6] !== suggestionClients) {
|
|
36
|
+
t3 = (t4) => {
|
|
37
|
+
const { index: index_0 } = t4;
|
|
38
|
+
return suggestionClients.get({ index: index_0 });
|
|
39
|
+
};
|
|
40
|
+
$[6] = suggestionClients;
|
|
41
|
+
$[7] = t3;
|
|
42
|
+
} else t3 = $[7];
|
|
43
|
+
let t4;
|
|
44
|
+
if ($[8] !== t2 || $[9] !== t3) {
|
|
45
|
+
t4 = {
|
|
46
|
+
getState: t2,
|
|
47
|
+
suggestion: t3
|
|
48
|
+
};
|
|
49
|
+
$[8] = t2;
|
|
50
|
+
$[9] = t3;
|
|
51
|
+
$[10] = t4;
|
|
52
|
+
} else t4 = $[10];
|
|
53
|
+
return t4;
|
|
31
54
|
};
|
|
32
55
|
const Suggestions = resource(useSuggestionsResource);
|
|
56
|
+
function _temp(s) {
|
|
57
|
+
if (typeof s === "string") return {
|
|
58
|
+
title: s,
|
|
59
|
+
label: "",
|
|
60
|
+
prompt: s
|
|
61
|
+
};
|
|
62
|
+
return {
|
|
63
|
+
title: s.title,
|
|
64
|
+
label: s.label,
|
|
65
|
+
prompt: s.prompt
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
function _temp2(suggestion, index) {
|
|
69
|
+
return withKey(index, SuggestionClient(suggestion), [suggestion]);
|
|
70
|
+
}
|
|
33
71
|
//#endregion
|
|
34
72
|
export { Suggestions };
|
|
35
73
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"suggestions.js","names":[],"sources":["../../../src/store/clients/suggestions.ts"],"sourcesContent":["import { useState } from \"react\";\nimport { resource, withKey } from \"@assistant-ui/tap\";\nimport type { ClientOutput } from \"@assistant-ui/store\";\nimport { useClientLookup } from \"@assistant-ui/store\";\nimport type { SuggestionsState } from \"../scopes/suggestions\";\nimport type { SuggestionState } from \"../scopes/suggestion\";\n\nexport type SuggestionConfig =\n | string\n | { title: string; label: string; prompt: string };\n\nconst useSuggestionClient = (\n state: SuggestionState,\n): ClientOutput<\"suggestion\"> => {\n return {\n getState: () => state,\n };\n};\n\nconst SuggestionClient = resource(useSuggestionClient);\n\nconst useSuggestionsResource = (\n suggestions?: SuggestionConfig[],\n): ClientOutput<\"suggestions\"> => {\n const [state] = useState<SuggestionsState>(() => {\n const normalizedSuggestions = (suggestions ?? []).map((s) => {\n if (typeof s === \"string\") {\n return {\n title: s,\n label: \"\",\n prompt: s,\n };\n }\n return {\n title: s.title,\n label: s.label,\n prompt: s.prompt,\n };\n });\n\n return {\n suggestions: normalizedSuggestions,\n };\n });\n\n const suggestionClients = useClientLookup(\n
|
|
1
|
+
{"version":3,"file":"suggestions.js","names":["useState","resource","withKey","ClientOutput","useClientLookup","SuggestionsState","SuggestionState","SuggestionConfig","title","label","prompt","useSuggestionClient","state","getState","SuggestionClient","useSuggestionsResource","suggestions","$","_c","t0","normalizedSuggestions","map","_temp","t1","_temp2","suggestionClients","t2","t3","t4","index","index_0","get","suggestion","Suggestions","s"],"sources":["../../../src/store/clients/suggestions.ts"],"sourcesContent":["import { useState } from \"react\";\nimport { resource, withKey } from \"@assistant-ui/tap\";\nimport type { ClientOutput } from \"@assistant-ui/store\";\nimport { useClientLookup } from \"@assistant-ui/store\";\nimport type { SuggestionsState } from \"../scopes/suggestions\";\nimport type { SuggestionState } from \"../scopes/suggestion\";\n\nexport type SuggestionConfig =\n | string\n | { title: string; label: string; prompt: string };\n\nconst useSuggestionClient = (\n state: SuggestionState,\n): ClientOutput<\"suggestion\"> => {\n return {\n getState: () => state,\n };\n};\n\nconst SuggestionClient = resource(useSuggestionClient);\n\nconst useSuggestionsResource = (\n suggestions?: SuggestionConfig[],\n): ClientOutput<\"suggestions\"> => {\n const [state] = useState<SuggestionsState>(() => {\n const normalizedSuggestions = (suggestions ?? []).map((s) => {\n if (typeof s === \"string\") {\n return {\n title: s,\n label: \"\",\n prompt: s,\n };\n }\n return {\n title: s.title,\n label: s.label,\n prompt: s.prompt,\n };\n });\n\n return {\n suggestions: normalizedSuggestions,\n };\n });\n\n const suggestionClients = useClientLookup(\n state.suggestions.map((suggestion, index) =>\n withKey(index, SuggestionClient(suggestion), [suggestion]),\n ),\n );\n\n return {\n getState: () => state,\n suggestion: ({ index }: { index: number }) => {\n return suggestionClients.get({ index });\n },\n };\n};\n\nexport const Suggestions = resource(useSuggestionsResource);\n"],"mappings":";;;;;AAWA,MAAMW,uBACJC,UAC+B;CAC/B,OAAO,EACLC,gBAAgBD,MAClB;AACF;AAEA,MAAME,mBAAmBb,SAASU,mBAAmB;AAErD,MAAMI,0BAAyBC,gBAAA;CAAA,MAAAC,IAAAC,EAAA,EAAA;CAAA,IAAAC;CAAA,IAAAF,EAAA,OAAAD,aAAA;EAGcG,WAAA;GActC,OAEI,EAAAH,cAfwBA,eAAA,CAAA,EAAA,CAAiBK,IAAMC,KAgBvCF,EACf;EAAC;EACFH,EAAA,KAAAD;EAAAC,EAAA,KAAAE;CAAA,OAAAA,KAAAF,EAAA;CAnBD,MAAA,CAAAL,SAAgBZ,SAA2BmB,EAmB1C;CAAE,IAAAI;CAAA,IAAAN,EAAA,OAAAL,MAAAI,aAAA;EAGDO,KAAAX,MAAKI,YAAYK,IAAKG,MAEtB;EAACP,EAAA,KAAAL,MAAAI;EAAAC,EAAA,KAAAM;CAAA,OAAAA,KAAAN,EAAA;CAHH,MAAAQ,oBAA0BrB,gBACxBmB,EAGF;CAAE,IAAAG;CAAA,IAAAT,EAAA,OAAAL,OAAA;EAGUc,WAAMd;EAAKK,EAAA,KAAAL;EAAAK,EAAA,KAAAS;CAAA,OAAAA,KAAAT,EAAA;CAAA,IAAAU;CAAA,IAAAV,EAAA,OAAAQ,mBAAA;EACTE,MAAAC,OAAA;GAAC,MAAA,EAAAC,OAAAC,YAAAF;GAA4B,OAChCH,kBAAiBM,IAAK,EAAAF,OAAEA,QAAM,CAAC;EAAC;EACxCZ,EAAA,KAAAQ;EAAAR,EAAA,KAAAU;CAAA,OAAAA,KAAAV,EAAA;CAAA,IAAAW;CAAA,IAAAX,EAAA,OAAAS,MAAAT,EAAA,OAAAU,IAAA;EAJIC,KAAA;GAAAf,UACKa;GAAWM,YACTL;EAGd;EAACV,EAAA,KAAAS;EAAAT,EAAA,KAAAU;EAAAV,EAAA,MAAAW;CAAA,OAAAA,KAAAX,EAAA;CAAA,OALMW;AAKN;AAGH,MAAaK,cAAchC,SAASc,sBAAsB;AAtC3B,SAAAO,MAAAY,GAAA;CAKzB,IAAI,OAAOA,MAAM,UAAQ,OAChB;EAAA1B,OACE0B;EAACzB,OACD;EAAEC,QACDwB;CACV;CACD,OACM;EAAA1B,OACE0B,EAAC1B;EAAMC,OACPyB,EAACzB;EAAMC,QACNwB,EAACxB;CACX;AAAC;AAhBwB,SAAAc,OAAAQ,YAAAH,OAAA;CAAA,OA0BzB3B,QAAQ2B,OAAOf,iBAAiBkB,UAAU,GAAG,CAACA,UAAU,CAAC;AAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"thread-message-client.d.ts","names":[],"sources":["../../../src/store/clients/thread-message-client.ts"],"mappings":";;;;KA2DY,wBAAA;EACV,OAAA,EAAS,aAAa;EACtB,KAAA;EACA,MAAA;EACA,YAAA;EACA,WAAA;AAAA;AAAA,
|
|
1
|
+
{"version":3,"file":"thread-message-client.d.ts","names":[],"sources":["../../../src/store/clients/thread-message-client.ts"],"mappings":";;;;KA2DY,wBAAA;EACV,OAAA,EAAS,aAAa;EACtB,KAAA;EACA,MAAA;EACA,YAAA;EACA,WAAA;AAAA;AAAA,cAyGW,mBAAA,8BAAmB,QAAA,CAAA,YAAA,cAAA,wBAAA"}
|
|
@@ -1,28 +1,40 @@
|
|
|
1
1
|
import { getThreadMessageText } from "../../utils/text.js";
|
|
2
2
|
import { NoOpComposerClient } from "./no-op-composer-client.js";
|
|
3
|
-
import {
|
|
3
|
+
import { useState } from "@assistant-ui/tap/react-shim";
|
|
4
4
|
import { useClientLookup } from "@assistant-ui/store";
|
|
5
|
+
import { c } from "@assistant-ui/tap/react-shim/compiler-runtime";
|
|
5
6
|
import { resource, useResource, withKey } from "@assistant-ui/tap";
|
|
6
7
|
//#region src/store/clients/thread-message-client.ts
|
|
7
|
-
const useThreadMessagePartClient = (
|
|
8
|
-
const
|
|
9
|
-
|
|
8
|
+
const useThreadMessagePartClient = (t0) => {
|
|
9
|
+
const $ = c(5);
|
|
10
|
+
const { part } = t0;
|
|
11
|
+
let t1;
|
|
12
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
13
|
+
t1 = { type: "complete" };
|
|
14
|
+
$[0] = t1;
|
|
15
|
+
} else t1 = $[0];
|
|
16
|
+
let t2;
|
|
17
|
+
if ($[1] !== part) {
|
|
18
|
+
t2 = {
|
|
10
19
|
...part,
|
|
11
|
-
status:
|
|
20
|
+
status: t1
|
|
12
21
|
};
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
25
|
-
|
|
22
|
+
$[1] = part;
|
|
23
|
+
$[2] = t2;
|
|
24
|
+
} else t2 = $[2];
|
|
25
|
+
const state = t2;
|
|
26
|
+
let t3;
|
|
27
|
+
if ($[3] !== state) {
|
|
28
|
+
t3 = {
|
|
29
|
+
getState: () => state,
|
|
30
|
+
addToolResult: _temp,
|
|
31
|
+
resumeToolCall: _temp2,
|
|
32
|
+
respondToToolApproval: _temp3
|
|
33
|
+
};
|
|
34
|
+
$[3] = state;
|
|
35
|
+
$[4] = t3;
|
|
36
|
+
} else t3 = $[4];
|
|
37
|
+
return t3;
|
|
26
38
|
};
|
|
27
39
|
const ThreadMessagePartClient = resource(useThreadMessagePartClient);
|
|
28
40
|
const useThreadMessageAttachmentClient = ({ attachment }) => {
|
|
@@ -34,15 +46,50 @@ const useThreadMessageAttachmentClient = ({ attachment }) => {
|
|
|
34
46
|
};
|
|
35
47
|
};
|
|
36
48
|
const ThreadMessageAttachmentClient = resource(useThreadMessageAttachmentClient);
|
|
37
|
-
const useThreadMessageClient = (
|
|
49
|
+
const useThreadMessageClient = (t0) => {
|
|
50
|
+
const $ = c(35);
|
|
51
|
+
const { message, index, isLast: t1, branchNumber: t2, branchCount: t3 } = t0;
|
|
52
|
+
const isLast = t1 === void 0 ? true : t1;
|
|
53
|
+
const branchNumber = t2 === void 0 ? 1 : t2;
|
|
54
|
+
const branchCount = t3 === void 0 ? 1 : t3;
|
|
38
55
|
const [isCopiedState, setIsCopied] = useState(false);
|
|
39
56
|
const [isHoveringState, setIsHovering] = useState(false);
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
57
|
+
let t4;
|
|
58
|
+
if ($[0] !== message.content) {
|
|
59
|
+
t4 = message.content.map(_temp4);
|
|
60
|
+
$[0] = message.content;
|
|
61
|
+
$[1] = t4;
|
|
62
|
+
} else t4 = $[1];
|
|
63
|
+
const parts = useClientLookup(t4);
|
|
64
|
+
let t5;
|
|
65
|
+
if ($[2] !== message.attachments) {
|
|
66
|
+
t5 = message.attachments ?? [];
|
|
67
|
+
$[2] = message.attachments;
|
|
68
|
+
$[3] = t5;
|
|
69
|
+
} else t5 = $[3];
|
|
70
|
+
let t6;
|
|
71
|
+
if ($[4] !== t5) {
|
|
72
|
+
t6 = t5.map(_temp5);
|
|
73
|
+
$[4] = t5;
|
|
74
|
+
$[5] = t6;
|
|
75
|
+
} else t6 = $[5];
|
|
76
|
+
const attachments = useClientLookup(t6);
|
|
77
|
+
let t7;
|
|
78
|
+
if ($[6] === Symbol.for("react.memo_cache_sentinel")) {
|
|
79
|
+
t7 = NoOpComposerClient({ type: "edit" });
|
|
80
|
+
$[6] = t7;
|
|
81
|
+
} else t7 = $[6];
|
|
82
|
+
const composer = useResource(t7);
|
|
83
|
+
let t8;
|
|
84
|
+
if ($[7] !== composer) {
|
|
85
|
+
t8 = composer.getState();
|
|
86
|
+
$[7] = composer;
|
|
87
|
+
$[8] = t8;
|
|
88
|
+
} else t8 = $[8];
|
|
89
|
+
const composerState = t8;
|
|
90
|
+
let t9;
|
|
91
|
+
if ($[9] !== branchCount || $[10] !== branchNumber || $[11] !== composerState || $[12] !== index || $[13] !== isCopiedState || $[14] !== isHoveringState || $[15] !== isLast || $[16] !== message || $[17] !== parts.state) {
|
|
92
|
+
t9 = {
|
|
46
93
|
...message,
|
|
47
94
|
parts: parts.state,
|
|
48
95
|
composer: composerState,
|
|
@@ -55,54 +102,114 @@ const useThreadMessageClient = ({ message, index, isLast = true, branchNumber =
|
|
|
55
102
|
isCopied: isCopiedState,
|
|
56
103
|
isHovering: isHoveringState
|
|
57
104
|
};
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
]
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
105
|
+
$[9] = branchCount;
|
|
106
|
+
$[10] = branchNumber;
|
|
107
|
+
$[11] = composerState;
|
|
108
|
+
$[12] = index;
|
|
109
|
+
$[13] = isCopiedState;
|
|
110
|
+
$[14] = isHoveringState;
|
|
111
|
+
$[15] = isLast;
|
|
112
|
+
$[16] = message;
|
|
113
|
+
$[17] = parts.state;
|
|
114
|
+
$[18] = t9;
|
|
115
|
+
} else t9 = $[18];
|
|
116
|
+
const state = t9;
|
|
117
|
+
let t10;
|
|
118
|
+
if ($[19] !== state) {
|
|
119
|
+
t10 = () => state;
|
|
120
|
+
$[19] = state;
|
|
121
|
+
$[20] = t10;
|
|
122
|
+
} else t10 = $[20];
|
|
123
|
+
let t11;
|
|
124
|
+
if ($[21] !== composer) {
|
|
125
|
+
t11 = () => composer;
|
|
126
|
+
$[21] = composer;
|
|
127
|
+
$[22] = t11;
|
|
128
|
+
} else t11 = $[22];
|
|
129
|
+
let t12;
|
|
130
|
+
if ($[23] !== parts) {
|
|
131
|
+
t12 = (selector) => {
|
|
73
132
|
if ("index" in selector) return parts.get({ index: selector.index });
|
|
74
133
|
else return parts.get({ key: `toolCallId-${selector.toolCallId}` });
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
134
|
+
};
|
|
135
|
+
$[23] = parts;
|
|
136
|
+
$[24] = t12;
|
|
137
|
+
} else t12 = $[24];
|
|
138
|
+
let t13;
|
|
139
|
+
if ($[25] !== attachments) {
|
|
140
|
+
t13 = (selector_0) => {
|
|
141
|
+
if ("id" in selector_0) return attachments.get({ key: selector_0.id });
|
|
142
|
+
else return attachments.get(selector_0);
|
|
143
|
+
};
|
|
144
|
+
$[25] = attachments;
|
|
145
|
+
$[26] = t13;
|
|
146
|
+
} else t13 = $[26];
|
|
147
|
+
let t14;
|
|
148
|
+
if ($[27] !== message) {
|
|
149
|
+
t14 = () => getThreadMessageText(message);
|
|
150
|
+
$[27] = message;
|
|
151
|
+
$[28] = t14;
|
|
152
|
+
} else t14 = $[28];
|
|
153
|
+
let t15;
|
|
154
|
+
if ($[29] !== t10 || $[30] !== t11 || $[31] !== t12 || $[32] !== t13 || $[33] !== t14) {
|
|
155
|
+
t15 = {
|
|
156
|
+
getState: t10,
|
|
157
|
+
composer: t11,
|
|
158
|
+
part: t12,
|
|
159
|
+
attachment: t13,
|
|
160
|
+
delete: _temp6,
|
|
161
|
+
reload: _temp7,
|
|
162
|
+
speak: _temp8,
|
|
163
|
+
stopSpeaking: _temp9,
|
|
164
|
+
submitFeedback: _temp0,
|
|
165
|
+
switchToBranch: _temp1,
|
|
166
|
+
getCopyText: t14,
|
|
167
|
+
setIsCopied,
|
|
168
|
+
setIsHovering
|
|
169
|
+
};
|
|
170
|
+
$[29] = t10;
|
|
171
|
+
$[30] = t11;
|
|
172
|
+
$[31] = t12;
|
|
173
|
+
$[32] = t13;
|
|
174
|
+
$[33] = t14;
|
|
175
|
+
$[34] = t15;
|
|
176
|
+
} else t15 = $[34];
|
|
177
|
+
return t15;
|
|
104
178
|
};
|
|
105
179
|
const ThreadMessageClient = resource(useThreadMessageClient);
|
|
180
|
+
function _temp() {
|
|
181
|
+
throw new Error("Not supported");
|
|
182
|
+
}
|
|
183
|
+
function _temp2() {
|
|
184
|
+
throw new Error("Not supported");
|
|
185
|
+
}
|
|
186
|
+
function _temp3() {
|
|
187
|
+
throw new Error("Not supported");
|
|
188
|
+
}
|
|
189
|
+
function _temp4(part, idx) {
|
|
190
|
+
return withKey("toolCallId" in part && part.toolCallId != null ? `toolCallId-${part.toolCallId}` : `index-${idx}`, ThreadMessagePartClient({ part }), [part]);
|
|
191
|
+
}
|
|
192
|
+
function _temp5(attachment) {
|
|
193
|
+
return withKey(attachment.id, ThreadMessageAttachmentClient({ attachment }), [attachment]);
|
|
194
|
+
}
|
|
195
|
+
function _temp6() {
|
|
196
|
+
throw new Error("Not supported in ThreadMessageProvider");
|
|
197
|
+
}
|
|
198
|
+
function _temp7() {
|
|
199
|
+
throw new Error("Not supported in ThreadMessageProvider");
|
|
200
|
+
}
|
|
201
|
+
function _temp8() {
|
|
202
|
+
throw new Error("Not supported in ThreadMessageProvider");
|
|
203
|
+
}
|
|
204
|
+
function _temp9() {
|
|
205
|
+
throw new Error("Not supported in ThreadMessageProvider");
|
|
206
|
+
}
|
|
207
|
+
function _temp0() {
|
|
208
|
+
throw new Error("Not supported in ThreadMessageProvider");
|
|
209
|
+
}
|
|
210
|
+
function _temp1() {
|
|
211
|
+
throw new Error("Not supported in ThreadMessageProvider");
|
|
212
|
+
}
|
|
106
213
|
//#endregion
|
|
107
214
|
export { ThreadMessageClient };
|
|
108
215
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"thread-message-client.js","names":[],"sources":["../../../src/store/clients/thread-message-client.ts"],"sourcesContent":["import type {\n ThreadAssistantMessagePart,\n ThreadUserMessagePart,\n ThreadMessage,\n} from \"../../types/message\";\nimport type { Attachment } from \"../../types/attachment\";\nimport { useMemo, useState } from \"react\";\nimport { useResource, resource, withKey } from \"@assistant-ui/tap\";\nimport type { ClientOutput } from \"@assistant-ui/store\";\nimport { useClientLookup } from \"@assistant-ui/store\";\nimport type { MessageState } from \"../scopes/message\";\nimport type { PartState } from \"../scopes/part\";\nimport { NoOpComposerClient } from \"./no-op-composer-client\";\nimport { getThreadMessageText } from \"../../utils/text\";\n\nconst useThreadMessagePartClient = ({\n part,\n}: {\n part: ThreadAssistantMessagePart | ThreadUserMessagePart;\n}): ClientOutput<\"part\"> => {\n const state = useMemo<PartState>(() => {\n return {\n ...part,\n status: { type: \"complete\" },\n };\n }, [part]);\n\n return {\n getState: () => state,\n addToolResult: () => {\n throw new Error(\"Not supported\");\n },\n resumeToolCall: () => {\n throw new Error(\"Not supported\");\n },\n respondToToolApproval: () => {\n throw new Error(\"Not supported\");\n },\n };\n};\n\nconst ThreadMessagePartClient = resource(useThreadMessagePartClient);\n\nconst useThreadMessageAttachmentClient = ({\n attachment,\n}: {\n attachment: Attachment;\n}): ClientOutput<\"attachment\"> => {\n return {\n getState: () => attachment,\n remove: () => {\n throw new Error(\"Not supported\");\n },\n };\n};\n\nconst ThreadMessageAttachmentClient = resource(\n useThreadMessageAttachmentClient,\n);\nexport type ThreadMessageClientProps = {\n message: ThreadMessage;\n index: number;\n isLast?: boolean;\n branchNumber?: number;\n branchCount?: number;\n};\n\nconst useThreadMessageClient = ({\n message,\n index,\n isLast = true,\n branchNumber = 1,\n branchCount = 1,\n}: ThreadMessageClientProps): ClientOutput<\"message\"> => {\n const [isCopiedState, setIsCopied] = useState(false);\n const [isHoveringState, setIsHovering] = useState(false);\n\n const parts = useClientLookup(\n () =>\n message.content.map((part, idx) =>\n withKey(\n \"toolCallId\" in part && part.toolCallId != null\n ? `toolCallId-${part.toolCallId}`\n : `index-${idx}`,\n ThreadMessagePartClient({ part }),\n ),\n ),\n [message.content],\n );\n\n const attachments = useClientLookup(\n () =>\n (message.attachments ?? []).map((attachment) =>\n withKey(attachment.id, ThreadMessageAttachmentClient({ attachment })),\n ),\n [message.attachments],\n );\n\n const composer = useResource(NoOpComposerClient({ type: \"edit\" }));\n const composerState = composer.getState();\n\n const state = useMemo<MessageState>(() => {\n return {\n ...message,\n parts: parts.state,\n composer: composerState,\n parentId: null,\n index,\n isLast,\n branchNumber,\n branchCount,\n speech: undefined,\n isCopied: isCopiedState,\n isHovering: isHoveringState,\n };\n }, [\n message,\n index,\n isCopiedState,\n isHoveringState,\n isLast,\n parts.state,\n composerState,\n branchNumber,\n branchCount,\n ]);\n\n return {\n getState: () => state,\n composer: () => composer,\n part: (selector) => {\n if (\"index\" in selector) {\n return parts.get({ index: selector.index });\n } else {\n return parts.get({ key: `toolCallId-${selector.toolCallId}` });\n }\n },\n attachment: (selector) => {\n if (\"id\" in selector) {\n return attachments.get({ key: selector.id });\n } else {\n return attachments.get(selector);\n }\n },\n delete: () => {\n throw new Error(\"Not supported in ThreadMessageProvider\");\n },\n reload: () => {\n throw new Error(\"Not supported in ThreadMessageProvider\");\n },\n speak: () => {\n throw new Error(\"Not supported in ThreadMessageProvider\");\n },\n stopSpeaking: () => {\n throw new Error(\"Not supported in ThreadMessageProvider\");\n },\n submitFeedback: () => {\n throw new Error(\"Not supported in ThreadMessageProvider\");\n },\n switchToBranch: () => {\n throw new Error(\"Not supported in ThreadMessageProvider\");\n },\n getCopyText: () => {\n return getThreadMessageText(message);\n },\n setIsCopied,\n setIsHovering,\n };\n};\n\nexport const ThreadMessageClient = resource(useThreadMessageClient);\n"],"mappings":";;;;;;AAeA,MAAM,8BAA8B,EAClC,WAG0B;CAC1B,MAAM,QAAQ,cAAyB;EACrC,OAAO;GACL,GAAG;GACH,QAAQ,EAAE,MAAM,WAAW;EAC7B;CACF,GAAG,CAAC,IAAI,CAAC;CAET,OAAO;EACL,gBAAgB;EAChB,qBAAqB;GACnB,MAAM,IAAI,MAAM,eAAe;EACjC;EACA,sBAAsB;GACpB,MAAM,IAAI,MAAM,eAAe;EACjC;EACA,6BAA6B;GAC3B,MAAM,IAAI,MAAM,eAAe;EACjC;CACF;AACF;AAEA,MAAM,0BAA0B,SAAS,0BAA0B;AAEnE,MAAM,oCAAoC,EACxC,iBAGgC;CAChC,OAAO;EACL,gBAAgB;EAChB,cAAc;GACZ,MAAM,IAAI,MAAM,eAAe;EACjC;CACF;AACF;AAEA,MAAM,gCAAgC,SACpC,gCACF;AASA,MAAM,0BAA0B,EAC9B,SACA,OACA,SAAS,MACT,eAAe,GACf,cAAc,QACyC;CACvD,MAAM,CAAC,eAAe,eAAe,SAAS,KAAK;CACnD,MAAM,CAAC,iBAAiB,iBAAiB,SAAS,KAAK;CAEvD,MAAM,QAAQ,sBAEV,QAAQ,QAAQ,KAAK,MAAM,QACzB,QACE,gBAAgB,QAAQ,KAAK,cAAc,OACvC,cAAc,KAAK,eACnB,SAAS,OACb,wBAAwB,EAAE,KAAK,CAAC,CAClC,CACF,GACF,CAAC,QAAQ,OAAO,CAClB;CAEA,MAAM,cAAc,uBAEf,QAAQ,eAAe,CAAC,EAAA,CAAG,KAAK,eAC/B,QAAQ,WAAW,IAAI,8BAA8B,EAAE,WAAW,CAAC,CAAC,CACtE,GACF,CAAC,QAAQ,WAAW,CACtB;CAEA,MAAM,WAAW,YAAY,mBAAmB,EAAE,MAAM,OAAO,CAAC,CAAC;CACjE,MAAM,gBAAgB,SAAS,SAAS;CAExC,MAAM,QAAQ,cAA4B;EACxC,OAAO;GACL,GAAG;GACH,OAAO,MAAM;GACb,UAAU;GACV,UAAU;GACV;GACA;GACA;GACA;GACA,QAAQ,KAAA;GACR,UAAU;GACV,YAAY;EACd;CACF,GAAG;EACD;EACA;EACA;EACA;EACA;EACA,MAAM;EACN;EACA;EACA;CACF,CAAC;CAED,OAAO;EACL,gBAAgB;EAChB,gBAAgB;EAChB,OAAO,aAAa;GAClB,IAAI,WAAW,UACb,OAAO,MAAM,IAAI,EAAE,OAAO,SAAS,MAAM,CAAC;QAE1C,OAAO,MAAM,IAAI,EAAE,KAAK,cAAc,SAAS,aAAa,CAAC;EAEjE;EACA,aAAa,aAAa;GACxB,IAAI,QAAQ,UACV,OAAO,YAAY,IAAI,EAAE,KAAK,SAAS,GAAG,CAAC;QAE3C,OAAO,YAAY,IAAI,QAAQ;EAEnC;EACA,cAAc;GACZ,MAAM,IAAI,MAAM,wCAAwC;EAC1D;EACA,cAAc;GACZ,MAAM,IAAI,MAAM,wCAAwC;EAC1D;EACA,aAAa;GACX,MAAM,IAAI,MAAM,wCAAwC;EAC1D;EACA,oBAAoB;GAClB,MAAM,IAAI,MAAM,wCAAwC;EAC1D;EACA,sBAAsB;GACpB,MAAM,IAAI,MAAM,wCAAwC;EAC1D;EACA,sBAAsB;GACpB,MAAM,IAAI,MAAM,wCAAwC;EAC1D;EACA,mBAAmB;GACjB,OAAO,qBAAqB,OAAO;EACrC;EACA;EACA;CACF;AACF;AAEA,MAAa,sBAAsB,SAAS,sBAAsB"}
|
|
1
|
+
{"version":3,"file":"thread-message-client.js","names":["ThreadAssistantMessagePart","ThreadUserMessagePart","ThreadMessage","Attachment","useMemo","useState","useResource","resource","withKey","ClientOutput","useClientLookup","MessageState","PartState","NoOpComposerClient","getThreadMessageText","useThreadMessagePartClient","t0","$","_c","part","t1","Symbol","for","type","t2","status","state","t3","getState","addToolResult","_temp","resumeToolCall","_temp2","respondToToolApproval","_temp3","ThreadMessagePartClient","useThreadMessageAttachmentClient","attachment","remove","Error","ThreadMessageAttachmentClient","ThreadMessageClientProps","message","index","isLast","branchNumber","branchCount","useThreadMessageClient","undefined","isCopiedState","setIsCopied","isHoveringState","setIsHovering","t4","content","map","_temp4","parts","t5","attachments","t6","_temp5","t7","composer","t8","composerState","t9","parentId","speech","isCopied","isHovering","t10","t11","t12","selector","get","key","toolCallId","t13","selector_0","id","t14","t15","delete","_temp6","reload","_temp7","speak","_temp8","stopSpeaking","_temp9","submitFeedback","_temp0","switchToBranch","_temp1","getCopyText","ThreadMessageClient","idx"],"sources":["../../../src/store/clients/thread-message-client.ts"],"sourcesContent":["import type {\n ThreadAssistantMessagePart,\n ThreadUserMessagePart,\n ThreadMessage,\n} from \"../../types/message\";\nimport type { Attachment } from \"../../types/attachment\";\nimport { useMemo, useState } from \"react\";\nimport { useResource, resource, withKey } from \"@assistant-ui/tap\";\nimport type { ClientOutput } from \"@assistant-ui/store\";\nimport { useClientLookup } from \"@assistant-ui/store\";\nimport type { MessageState } from \"../scopes/message\";\nimport type { PartState } from \"../scopes/part\";\nimport { NoOpComposerClient } from \"./no-op-composer-client\";\nimport { getThreadMessageText } from \"../../utils/text\";\n\nconst useThreadMessagePartClient = ({\n part,\n}: {\n part: ThreadAssistantMessagePart | ThreadUserMessagePart;\n}): ClientOutput<\"part\"> => {\n const state = useMemo<PartState>(() => {\n return {\n ...part,\n status: { type: \"complete\" },\n };\n }, [part]);\n\n return {\n getState: () => state,\n addToolResult: () => {\n throw new Error(\"Not supported\");\n },\n resumeToolCall: () => {\n throw new Error(\"Not supported\");\n },\n respondToToolApproval: () => {\n throw new Error(\"Not supported\");\n },\n };\n};\n\nconst ThreadMessagePartClient = resource(useThreadMessagePartClient);\n\nconst useThreadMessageAttachmentClient = ({\n attachment,\n}: {\n attachment: Attachment;\n}): ClientOutput<\"attachment\"> => {\n return {\n getState: () => attachment,\n remove: () => {\n throw new Error(\"Not supported\");\n },\n };\n};\n\nconst ThreadMessageAttachmentClient = resource(\n useThreadMessageAttachmentClient,\n);\nexport type ThreadMessageClientProps = {\n message: ThreadMessage;\n index: number;\n isLast?: boolean;\n branchNumber?: number;\n branchCount?: number;\n};\n\nconst useThreadMessageClient = ({\n message,\n index,\n isLast = true,\n branchNumber = 1,\n branchCount = 1,\n}: ThreadMessageClientProps): ClientOutput<\"message\"> => {\n const [isCopiedState, setIsCopied] = useState(false);\n const [isHoveringState, setIsHovering] = useState(false);\n\n const parts = useClientLookup(\n message.content.map((part, idx) =>\n withKey(\n \"toolCallId\" in part && part.toolCallId != null\n ? `toolCallId-${part.toolCallId}`\n : `index-${idx}`,\n ThreadMessagePartClient({ part }),\n [part],\n ),\n ),\n );\n\n const attachments = useClientLookup(\n (message.attachments ?? []).map((attachment) =>\n withKey(attachment.id, ThreadMessageAttachmentClient({ attachment }), [\n attachment,\n ]),\n ),\n );\n\n const composer = useResource(NoOpComposerClient({ type: \"edit\" }));\n const composerState = composer.getState();\n\n const state = useMemo<MessageState>(() => {\n return {\n ...message,\n parts: parts.state,\n composer: composerState,\n parentId: null,\n index,\n isLast,\n branchNumber,\n branchCount,\n speech: undefined,\n isCopied: isCopiedState,\n isHovering: isHoveringState,\n };\n }, [\n message,\n index,\n isCopiedState,\n isHoveringState,\n isLast,\n parts.state,\n composerState,\n branchNumber,\n branchCount,\n ]);\n\n return {\n getState: () => state,\n composer: () => composer,\n part: (selector) => {\n if (\"index\" in selector) {\n return parts.get({ index: selector.index });\n } else {\n return parts.get({ key: `toolCallId-${selector.toolCallId}` });\n }\n },\n attachment: (selector) => {\n if (\"id\" in selector) {\n return attachments.get({ key: selector.id });\n } else {\n return attachments.get(selector);\n }\n },\n delete: () => {\n throw new Error(\"Not supported in ThreadMessageProvider\");\n },\n reload: () => {\n throw new Error(\"Not supported in ThreadMessageProvider\");\n },\n speak: () => {\n throw new Error(\"Not supported in ThreadMessageProvider\");\n },\n stopSpeaking: () => {\n throw new Error(\"Not supported in ThreadMessageProvider\");\n },\n submitFeedback: () => {\n throw new Error(\"Not supported in ThreadMessageProvider\");\n },\n switchToBranch: () => {\n throw new Error(\"Not supported in ThreadMessageProvider\");\n },\n getCopyText: () => {\n return getThreadMessageText(message);\n },\n setIsCopied,\n setIsHovering,\n };\n};\n\nexport const ThreadMessageClient = resource(useThreadMessageClient);\n"],"mappings":";;;;;;;AAeA,MAAMe,8BAA6BC,OAAA;CAAA,MAAAC,IAAAC,EAAA,CAAA;CAAC,MAAA,EAAAC,SAAAH;CAInC,IAAAI;CAAA,IAAAH,EAAA,OAAAI,OAAAC,IAAA,2BAAA,GAAA;EAIaF,KAAA,EAAAG,MAAQ,WAAW;EAACN,EAAA,KAAAG;CAAA,OAAAA,KAAAH,EAAA;CAAA,IAAAO;CAAA,IAAAP,EAAA,OAAAE,MAAA;EAFvBK,KAAA;GAAA,GACFL;GAAIM,QACCL;EACV;EAACH,EAAA,KAAAE;EAAAF,EAAA,KAAAO;CAAA,OAAAA,KAAAP,EAAA;CAJH,MAAAS,QACEF;CAIS,IAAAG;CAAA,IAAAV,EAAA,OAAAS,OAAA;EAEJC,KAAA;GAAAC,gBACWF;GAAKG,eACNC;GAEdC,gBACeC;GAEfC,uBACsBC;EAGzB;EAACjB,EAAA,KAAAS;EAAAT,EAAA,KAAAU;CAAA,OAAAA,KAAAV,EAAA;CAAA,OAXMU;AAWN;AAGH,MAAMQ,0BAA0B5B,SAASQ,0BAA0B;AAEnE,MAAMqB,oCAAoC,EACxCC,iBAGgC;CAChC,OAAO;EACLT,gBAAgBS;EAChBC,cAAc;GACZ,MAAM,IAAIC,MAAM,eAAe;EACjC;CACF;AACF;AAEA,MAAMC,gCAAgCjC,SACpC6B,gCACF;AASA,MAAMW,0BAAyB/B,OAAA;CAAA,MAAAC,IAAAC,EAAA,EAAA;CAAC,MAAA,EAAAwB,SAAAC,OAAAC,QAAAxB,IAAAyB,cAAArB,IAAAsB,aAAAnB,OAAAX;CAG9B,MAAA4B,SAAAxB,OAAA4B,K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