@assistant-ui/react 0.10.1 → 0.10.3
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/api/AssistantRuntime.js +5 -4
- package/dist/api/AssistantRuntime.js.map +1 -1
- package/dist/api/AttachmentRuntime.js +11 -10
- package/dist/api/AttachmentRuntime.js.map +1 -1
- package/dist/api/ComposerRuntime.js +16 -15
- package/dist/api/ComposerRuntime.js.map +1 -1
- package/dist/api/ContentPartRuntime.js +3 -2
- package/dist/api/ContentPartRuntime.js.map +1 -1
- package/dist/api/MessageRuntime.js +14 -13
- package/dist/api/MessageRuntime.js.map +1 -1
- package/dist/api/ThreadListItemRuntime.js +3 -2
- package/dist/api/ThreadListItemRuntime.js.map +1 -1
- package/dist/api/ThreadListRuntime.js +11 -10
- package/dist/api/ThreadListRuntime.js.map +1 -1
- package/dist/api/ThreadRuntime.js +14 -13
- package/dist/api/ThreadRuntime.js.map +1 -1
- package/dist/api/subscribable/BaseSubject.js +3 -2
- package/dist/api/subscribable/BaseSubject.js.map +1 -1
- package/dist/api/subscribable/EventSubscriptionSubject.js +4 -3
- package/dist/api/subscribable/EventSubscriptionSubject.js.map +1 -1
- package/dist/api/subscribable/LazyMemoizeSubject.js +5 -4
- package/dist/api/subscribable/LazyMemoizeSubject.js.map +1 -1
- package/dist/api/subscribable/NestedSubscriptionSubject.js +4 -3
- package/dist/api/subscribable/NestedSubscriptionSubject.js.map +1 -1
- package/dist/api/subscribable/SKIP_UPDATE.js +2 -1
- package/dist/api/subscribable/SKIP_UPDATE.js.map +1 -1
- package/dist/api/subscribable/ShallowMemoizeSubject.js +6 -5
- package/dist/api/subscribable/ShallowMemoizeSubject.js.map +1 -1
- package/dist/api/subscribable/shallowEqual.js +1 -0
- package/dist/api/subscribable/shallowEqual.js.map +1 -1
- package/dist/cloud/AssistantCloud.js +7 -6
- package/dist/cloud/AssistantCloud.js.map +1 -1
- package/dist/cloud/AssistantCloudAPI.js +6 -5
- package/dist/cloud/AssistantCloudAPI.js.map +1 -1
- package/dist/cloud/AssistantCloudAuthStrategy.js +9 -8
- package/dist/cloud/AssistantCloudAuthStrategy.js.map +1 -1
- package/dist/cloud/AssistantCloudAuthTokens.js +3 -2
- package/dist/cloud/AssistantCloudAuthTokens.js.map +1 -1
- package/dist/cloud/AssistantCloudRuns.js +3 -2
- package/dist/cloud/AssistantCloudRuns.js.map +1 -1
- package/dist/cloud/AssistantCloudThreadHistoryAdapter.js +6 -5
- package/dist/cloud/AssistantCloudThreadHistoryAdapter.js.map +1 -1
- package/dist/cloud/AssistantCloudThreadMessages.js +3 -2
- package/dist/cloud/AssistantCloudThreadMessages.js.map +1 -1
- package/dist/cloud/AssistantCloudThreads.js +4 -3
- package/dist/cloud/AssistantCloudThreads.js.map +1 -1
- package/dist/cloud/auiV0.js +5 -4
- package/dist/cloud/auiV0.js.map +1 -1
- package/dist/cloud/index.js +3 -2
- package/dist/cloud/index.js.map +1 -1
- package/dist/cloud/useCloudThreadListRuntime.js +5 -3
- package/dist/cloud/useCloudThreadListRuntime.js.map +1 -1
- package/dist/context/ReadonlyStore.js +2 -1
- package/dist/context/ReadonlyStore.js.map +1 -1
- package/dist/context/index.js +4 -3
- package/dist/context/index.js.map +1 -1
- package/dist/context/providers/AssistantRuntimeProvider.js +13 -11
- package/dist/context/providers/AssistantRuntimeProvider.js.map +1 -1
- package/dist/context/providers/AttachmentRuntimeProvider.js +8 -6
- package/dist/context/providers/AttachmentRuntimeProvider.js.map +1 -1
- package/dist/context/providers/ContentPartRuntimeProvider.js +8 -6
- package/dist/context/providers/ContentPartRuntimeProvider.js.map +1 -1
- package/dist/context/providers/MessageRuntimeProvider.js +10 -8
- package/dist/context/providers/MessageRuntimeProvider.js.map +1 -1
- package/dist/context/providers/TextContentPartProvider.js +10 -8
- package/dist/context/providers/TextContentPartProvider.js.map +1 -1
- package/dist/context/providers/ThreadListItemRuntimeProvider.js +8 -6
- package/dist/context/providers/ThreadListItemRuntimeProvider.js.map +1 -1
- package/dist/context/providers/ThreadRuntimeProvider.js +10 -8
- package/dist/context/providers/ThreadRuntimeProvider.js.map +1 -1
- package/dist/context/providers/ThreadViewportProvider.js +8 -6
- package/dist/context/providers/ThreadViewportProvider.js.map +1 -1
- package/dist/context/providers/index.js +3 -2
- package/dist/context/providers/index.js.map +1 -1
- package/dist/context/react/AssistantContext.js +10 -8
- package/dist/context/react/AssistantContext.js.map +1 -1
- package/dist/context/react/AttachmentContext.js +10 -8
- package/dist/context/react/AttachmentContext.js.map +1 -1
- package/dist/context/react/ComposerContext.js +6 -4
- package/dist/context/react/ComposerContext.js.map +1 -1
- package/dist/context/react/ContentPartContext.js +7 -5
- package/dist/context/react/ContentPartContext.js.map +1 -1
- package/dist/context/react/MessageContext.js +11 -9
- package/dist/context/react/MessageContext.js.map +1 -1
- package/dist/context/react/ThreadContext.js +9 -7
- package/dist/context/react/ThreadContext.js.map +1 -1
- package/dist/context/react/ThreadListItemContext.js +7 -5
- package/dist/context/react/ThreadListItemContext.js.map +1 -1
- package/dist/context/react/ThreadViewportContext.js +7 -5
- package/dist/context/react/ThreadViewportContext.js.map +1 -1
- package/dist/context/react/index.js +11 -9
- package/dist/context/react/index.js.map +1 -1
- package/dist/context/react/utils/createContextHook.js +2 -0
- package/dist/context/react/utils/createContextHook.js.map +1 -1
- package/dist/context/react/utils/createContextStoreHook.js +1 -0
- package/dist/context/react/utils/createContextStoreHook.js.map +1 -1
- package/dist/context/react/utils/createStateHookForRuntime.js +2 -1
- package/dist/context/react/utils/createStateHookForRuntime.js.map +1 -1
- package/dist/context/react/utils/ensureBinding.js +2 -21
- package/dist/context/react/utils/ensureBinding.js.map +1 -1
- package/dist/context/react/utils/useRuntimeState.js +3 -2
- package/dist/context/react/utils/useRuntimeState.js.map +1 -1
- package/dist/context/stores/AssistantToolUIs.js +2 -1
- package/dist/context/stores/AssistantToolUIs.js.map +1 -1
- package/dist/context/stores/MessageUtils.js +2 -1
- package/dist/context/stores/MessageUtils.js.map +1 -1
- package/dist/context/stores/ThreadViewport.js +3 -1
- package/dist/context/stores/ThreadViewport.js.map +1 -1
- package/dist/index.js +9 -8
- package/dist/index.js.map +1 -1
- package/dist/internal.js +12 -11
- package/dist/internal.js.map +1 -1
- package/dist/model-context/ModelContextTypes.js +2 -1
- package/dist/model-context/ModelContextTypes.js.map +1 -1
- package/dist/model-context/index.js +10 -9
- package/dist/model-context/index.js.map +1 -1
- package/dist/model-context/makeAssistantTool.js +4 -2
- package/dist/model-context/makeAssistantTool.js.map +1 -1
- package/dist/model-context/makeAssistantToolUI.js +4 -2
- package/dist/model-context/makeAssistantToolUI.js.map +1 -1
- package/dist/model-context/makeAssistantVisible.js +9 -7
- package/dist/model-context/makeAssistantVisible.js.map +1 -1
- package/dist/model-context/tool.d.ts +1 -10
- package/dist/model-context/tool.d.ts.map +1 -1
- package/dist/model-context/tool.js +1 -0
- package/dist/model-context/tool.js.map +1 -1
- package/dist/model-context/useAssistantInstructions.js +5 -3
- package/dist/model-context/useAssistantInstructions.js.map +1 -1
- package/dist/model-context/useAssistantTool.d.ts +0 -1
- package/dist/model-context/useAssistantTool.d.ts.map +1 -1
- package/dist/model-context/useAssistantTool.js +5 -4
- package/dist/model-context/useAssistantTool.js.map +1 -1
- package/dist/model-context/useAssistantToolUI.js +4 -2
- package/dist/model-context/useAssistantToolUI.js.map +1 -1
- package/dist/model-context/useInlineRender.js +3 -1
- package/dist/model-context/useInlineRender.js.map +1 -1
- package/dist/primitives/actionBar/ActionBarCopy.js +8 -6
- package/dist/primitives/actionBar/ActionBarCopy.js.map +1 -1
- package/dist/primitives/actionBar/ActionBarEdit.js +6 -4
- package/dist/primitives/actionBar/ActionBarEdit.js.map +1 -1
- package/dist/primitives/actionBar/ActionBarFeedbackNegative.js +7 -5
- package/dist/primitives/actionBar/ActionBarFeedbackNegative.js.map +1 -1
- package/dist/primitives/actionBar/ActionBarFeedbackPositive.js +6 -4
- package/dist/primitives/actionBar/ActionBarFeedbackPositive.js.map +1 -1
- package/dist/primitives/actionBar/ActionBarReload.js +8 -6
- package/dist/primitives/actionBar/ActionBarReload.js.map +1 -1
- package/dist/primitives/actionBar/ActionBarRoot.js +5 -3
- package/dist/primitives/actionBar/ActionBarRoot.js.map +1 -1
- package/dist/primitives/actionBar/ActionBarSpeak.js +6 -4
- package/dist/primitives/actionBar/ActionBarSpeak.js.map +1 -1
- package/dist/primitives/actionBar/ActionBarStopSpeaking.js +6 -4
- package/dist/primitives/actionBar/ActionBarStopSpeaking.js.map +1 -1
- package/dist/primitives/actionBar/index.js +9 -8
- package/dist/primitives/actionBar/index.js.map +1 -1
- package/dist/primitives/actionBar/useActionBarFloatStatus.js +6 -4
- package/dist/primitives/actionBar/useActionBarFloatStatus.js.map +1 -1
- package/dist/primitives/assistantModal/AssistantModalAnchor.js +5 -3
- package/dist/primitives/assistantModal/AssistantModalAnchor.js.map +1 -1
- package/dist/primitives/assistantModal/AssistantModalContent.js +5 -3
- package/dist/primitives/assistantModal/AssistantModalContent.js.map +1 -1
- package/dist/primitives/assistantModal/AssistantModalRoot.js +7 -5
- package/dist/primitives/assistantModal/AssistantModalRoot.js.map +1 -1
- package/dist/primitives/assistantModal/AssistantModalTrigger.js +4 -3
- package/dist/primitives/assistantModal/AssistantModalTrigger.js.map +1 -1
- package/dist/primitives/assistantModal/index.js +5 -4
- package/dist/primitives/assistantModal/index.js.map +1 -1
- package/dist/primitives/assistantModal/scope.js +2 -1
- package/dist/primitives/assistantModal/scope.js.map +1 -1
- package/dist/primitives/attachment/AttachmentName.js +4 -2
- package/dist/primitives/attachment/AttachmentName.js.map +1 -1
- package/dist/primitives/attachment/AttachmentRemove.js +6 -4
- package/dist/primitives/attachment/AttachmentRemove.js.map +1 -1
- package/dist/primitives/attachment/AttachmentRoot.js +3 -2
- package/dist/primitives/attachment/AttachmentRoot.js.map +1 -1
- package/dist/primitives/attachment/AttachmentThumb.js +5 -3
- package/dist/primitives/attachment/AttachmentThumb.js.map +1 -1
- package/dist/primitives/attachment/index.js +5 -4
- package/dist/primitives/attachment/index.js.map +1 -1
- package/dist/primitives/branchPicker/BranchPickerCount.js +5 -3
- package/dist/primitives/branchPicker/BranchPickerCount.js.map +1 -1
- package/dist/primitives/branchPicker/BranchPickerNext.js +6 -4
- package/dist/primitives/branchPicker/BranchPickerNext.js.map +1 -1
- package/dist/primitives/branchPicker/BranchPickerNumber.js +5 -3
- package/dist/primitives/branchPicker/BranchPickerNumber.js.map +1 -1
- package/dist/primitives/branchPicker/BranchPickerPrevious.js +6 -4
- package/dist/primitives/branchPicker/BranchPickerPrevious.js.map +1 -1
- package/dist/primitives/branchPicker/BranchPickerRoot.js +4 -3
- package/dist/primitives/branchPicker/BranchPickerRoot.js.map +1 -1
- package/dist/primitives/branchPicker/index.js +6 -5
- package/dist/primitives/branchPicker/index.js.map +1 -1
- package/dist/primitives/composer/ComposerAddAttachment.js +6 -4
- package/dist/primitives/composer/ComposerAddAttachment.js.map +1 -1
- package/dist/primitives/composer/ComposerAttachments.js +11 -9
- package/dist/primitives/composer/ComposerAttachments.js.map +1 -1
- package/dist/primitives/composer/ComposerCancel.js +6 -4
- package/dist/primitives/composer/ComposerCancel.js.map +1 -1
- package/dist/primitives/composer/ComposerIf.js +5 -3
- package/dist/primitives/composer/ComposerIf.js.map +1 -1
- package/dist/primitives/composer/ComposerInput.js +8 -6
- package/dist/primitives/composer/ComposerInput.js.map +1 -1
- package/dist/primitives/composer/ComposerRoot.js +5 -3
- package/dist/primitives/composer/ComposerRoot.js.map +1 -1
- package/dist/primitives/composer/ComposerSend.js +8 -6
- package/dist/primitives/composer/ComposerSend.js.map +1 -1
- package/dist/primitives/composer/index.js +8 -7
- package/dist/primitives/composer/index.js.map +1 -1
- package/dist/primitives/contentPart/ContentPartImage.js +5 -3
- package/dist/primitives/contentPart/ContentPartImage.js.map +1 -1
- package/dist/primitives/contentPart/ContentPartInProgress.js +4 -2
- package/dist/primitives/contentPart/ContentPartInProgress.js.map +1 -1
- package/dist/primitives/contentPart/ContentPartText.js +6 -4
- package/dist/primitives/contentPart/ContentPartText.js.map +1 -1
- package/dist/primitives/contentPart/index.js +4 -3
- package/dist/primitives/contentPart/index.js.map +1 -1
- package/dist/primitives/contentPart/useContentPartFile.js +4 -2
- package/dist/primitives/contentPart/useContentPartFile.js.map +1 -1
- package/dist/primitives/contentPart/useContentPartImage.js +4 -2
- package/dist/primitives/contentPart/useContentPartImage.js.map +1 -1
- package/dist/primitives/contentPart/useContentPartReasoning.js +4 -2
- package/dist/primitives/contentPart/useContentPartReasoning.js.map +1 -1
- package/dist/primitives/contentPart/useContentPartSource.js +4 -2
- package/dist/primitives/contentPart/useContentPartSource.js.map +1 -1
- package/dist/primitives/contentPart/useContentPartText.js +4 -2
- package/dist/primitives/contentPart/useContentPartText.js.map +1 -1
- package/dist/primitives/index.js +17 -16
- package/dist/primitives/index.js.map +1 -1
- package/dist/primitives/message/MessageAttachments.js +11 -9
- package/dist/primitives/message/MessageAttachments.js.map +1 -1
- package/dist/primitives/message/MessageContent.js +19 -17
- package/dist/primitives/message/MessageContent.js.map +1 -1
- package/dist/primitives/message/MessageIf.js +6 -4
- package/dist/primitives/message/MessageIf.js.map +1 -1
- package/dist/primitives/message/MessageRoot.js +7 -5
- package/dist/primitives/message/MessageRoot.js.map +1 -1
- package/dist/primitives/message/index.js +5 -4
- package/dist/primitives/message/index.js.map +1 -1
- package/dist/primitives/thread/ThreadEmpty.js +4 -2
- package/dist/primitives/thread/ThreadEmpty.js.map +1 -1
- package/dist/primitives/thread/ThreadIf.js +5 -3
- package/dist/primitives/thread/ThreadIf.js.map +1 -1
- package/dist/primitives/thread/ThreadMessages.js +14 -12
- package/dist/primitives/thread/ThreadMessages.js.map +1 -1
- package/dist/primitives/thread/ThreadRoot.js +3 -2
- package/dist/primitives/thread/ThreadRoot.js.map +1 -1
- package/dist/primitives/thread/ThreadScrollToBottom.js +6 -4
- package/dist/primitives/thread/ThreadScrollToBottom.js.map +1 -1
- package/dist/primitives/thread/ThreadSuggestion.js +7 -5
- package/dist/primitives/thread/ThreadSuggestion.js.map +1 -1
- package/dist/primitives/thread/ThreadViewport.js +7 -5
- package/dist/primitives/thread/ThreadViewport.js.map +1 -1
- package/dist/primitives/thread/index.js +8 -7
- package/dist/primitives/thread/index.js.map +1 -1
- package/dist/primitives/thread/useThreadViewportAutoScroll.js +9 -7
- package/dist/primitives/thread/useThreadViewportAutoScroll.js.map +1 -1
- package/dist/primitives/threadList/ThreadListItems.js +8 -6
- package/dist/primitives/threadList/ThreadListItems.js.map +1 -1
- package/dist/primitives/threadList/ThreadListNew.js +6 -4
- package/dist/primitives/threadList/ThreadListNew.js.map +1 -1
- package/dist/primitives/threadList/ThreadListRoot.js +3 -2
- package/dist/primitives/threadList/ThreadListRoot.js.map +1 -1
- package/dist/primitives/threadList/index.js +4 -3
- package/dist/primitives/threadList/index.js.map +1 -1
- package/dist/primitives/threadListItem/ThreadListItemArchive.js +6 -4
- package/dist/primitives/threadListItem/ThreadListItemArchive.js.map +1 -1
- package/dist/primitives/threadListItem/ThreadListItemDelete.js +6 -4
- package/dist/primitives/threadListItem/ThreadListItemDelete.js.map +1 -1
- package/dist/primitives/threadListItem/ThreadListItemRoot.js +5 -3
- package/dist/primitives/threadListItem/ThreadListItemRoot.js.map +1 -1
- package/dist/primitives/threadListItem/ThreadListItemTitle.js +4 -2
- package/dist/primitives/threadListItem/ThreadListItemTitle.js.map +1 -1
- package/dist/primitives/threadListItem/ThreadListItemTrigger.js +6 -4
- package/dist/primitives/threadListItem/ThreadListItemTrigger.js.map +1 -1
- package/dist/primitives/threadListItem/ThreadListItemUnarchive.js +6 -4
- package/dist/primitives/threadListItem/ThreadListItemUnarchive.js.map +1 -1
- package/dist/primitives/threadListItem/index.js +7 -6
- package/dist/primitives/threadListItem/index.js.map +1 -1
- package/dist/runtimes/adapters/RuntimeAdapterProvider.js +5 -4
- package/dist/runtimes/adapters/RuntimeAdapterProvider.js.map +1 -1
- package/dist/runtimes/adapters/attachment/CompositeAttachmentAdapter.js +3 -2
- package/dist/runtimes/adapters/attachment/CompositeAttachmentAdapter.js.map +1 -1
- package/dist/runtimes/adapters/attachment/SimpleImageAttachmentAdapter.js +4 -3
- package/dist/runtimes/adapters/attachment/SimpleImageAttachmentAdapter.js.map +1 -1
- package/dist/runtimes/adapters/attachment/SimpleTextAttachmentAdapter.js +4 -3
- package/dist/runtimes/adapters/attachment/SimpleTextAttachmentAdapter.js.map +1 -1
- package/dist/runtimes/adapters/attachment/index.js +4 -3
- package/dist/runtimes/adapters/attachment/index.js.map +1 -1
- package/dist/runtimes/adapters/index.js +5 -4
- package/dist/runtimes/adapters/index.js.map +1 -1
- package/dist/runtimes/adapters/speech/WebSpeechSynthesisAdapter.js +3 -2
- package/dist/runtimes/adapters/speech/WebSpeechSynthesisAdapter.js.map +1 -1
- package/dist/runtimes/adapters/speech/index.js +2 -1
- package/dist/runtimes/adapters/speech/index.js.map +1 -1
- package/dist/runtimes/composer/BaseComposerRuntimeCore.js +5 -4
- package/dist/runtimes/composer/BaseComposerRuntimeCore.js.map +1 -1
- package/dist/runtimes/composer/DefaultEditComposerRuntimeCore.js +5 -4
- package/dist/runtimes/composer/DefaultEditComposerRuntimeCore.js.map +1 -1
- package/dist/runtimes/composer/DefaultThreadComposerRuntimeCore.js +4 -3
- package/dist/runtimes/composer/DefaultThreadComposerRuntimeCore.js.map +1 -1
- package/dist/runtimes/core/BaseAssistantRuntimeCore.js +4 -3
- package/dist/runtimes/core/BaseAssistantRuntimeCore.js.map +1 -1
- package/dist/runtimes/core/BaseThreadRuntimeCore.js +7 -6
- package/dist/runtimes/core/BaseThreadRuntimeCore.js.map +1 -1
- package/dist/runtimes/external-store/ExternalStoreRuntimeCore.js +7 -6
- package/dist/runtimes/external-store/ExternalStoreRuntimeCore.js.map +1 -1
- package/dist/runtimes/external-store/ExternalStoreThreadListRuntimeCore.js +8 -7
- package/dist/runtimes/external-store/ExternalStoreThreadListRuntimeCore.js.map +1 -1
- package/dist/runtimes/external-store/ExternalStoreThreadRuntimeCore.js +11 -10
- package/dist/runtimes/external-store/ExternalStoreThreadRuntimeCore.js.map +1 -1
- package/dist/runtimes/external-store/ThreadMessageConverter.js +3 -2
- package/dist/runtimes/external-store/ThreadMessageConverter.js.map +1 -1
- package/dist/runtimes/external-store/ThreadMessageLike.js +3 -2
- package/dist/runtimes/external-store/ThreadMessageLike.js.map +1 -1
- package/dist/runtimes/external-store/auto-status.js +5 -4
- package/dist/runtimes/external-store/auto-status.js.map +1 -1
- package/dist/runtimes/external-store/createMessageConverter.js +6 -4
- package/dist/runtimes/external-store/createMessageConverter.js.map +1 -1
- package/dist/runtimes/external-store/external-message-converter.js +11 -9
- package/dist/runtimes/external-store/external-message-converter.js.map +1 -1
- package/dist/runtimes/external-store/getExternalStoreMessage.js +6 -5
- package/dist/runtimes/external-store/getExternalStoreMessage.js.map +1 -1
- package/dist/runtimes/external-store/index.js +5 -4
- package/dist/runtimes/external-store/index.js.map +1 -1
- package/dist/runtimes/external-store/useExternalStoreRuntime.js +6 -4
- package/dist/runtimes/external-store/useExternalStoreRuntime.js.map +1 -1
- package/dist/runtimes/index.js +7 -6
- package/dist/runtimes/index.js.map +1 -1
- package/dist/runtimes/local/LocalRuntimeCore.js +7 -6
- package/dist/runtimes/local/LocalRuntimeCore.js.map +1 -1
- package/dist/runtimes/local/LocalRuntimeOptions.js +2 -1
- package/dist/runtimes/local/LocalRuntimeOptions.js.map +1 -1
- package/dist/runtimes/local/LocalThreadListRuntimeCore.js +5 -4
- package/dist/runtimes/local/LocalThreadListRuntimeCore.js.map +1 -1
- package/dist/runtimes/local/LocalThreadRuntimeCore.js +6 -5
- package/dist/runtimes/local/LocalThreadRuntimeCore.js.map +1 -1
- package/dist/runtimes/local/index.js +2 -1
- package/dist/runtimes/local/index.js.map +1 -1
- package/dist/runtimes/local/shouldContinue.js +2 -1
- package/dist/runtimes/local/shouldContinue.js.map +1 -1
- package/dist/runtimes/local/useLocalRuntime.js +9 -7
- package/dist/runtimes/local/useLocalRuntime.js.map +1 -1
- package/dist/runtimes/remote-thread-list/BaseSubscribable.js +3 -2
- package/dist/runtimes/remote-thread-list/BaseSubscribable.js.map +1 -1
- package/dist/runtimes/remote-thread-list/EMPTY_THREAD_CORE.js +3 -2
- package/dist/runtimes/remote-thread-list/EMPTY_THREAD_CORE.js.map +1 -1
- package/dist/runtimes/remote-thread-list/OptimisticState.js +5 -4
- package/dist/runtimes/remote-thread-list/OptimisticState.js.map +1 -1
- package/dist/runtimes/remote-thread-list/RemoteThreadListHookInstanceManager.js +9 -7
- package/dist/runtimes/remote-thread-list/RemoteThreadListHookInstanceManager.js.map +1 -1
- package/dist/runtimes/remote-thread-list/RemoteThreadListThreadListRuntimeCore.js +13 -11
- package/dist/runtimes/remote-thread-list/RemoteThreadListThreadListRuntimeCore.js.map +1 -1
- package/dist/runtimes/remote-thread-list/adapter/cloud.js +9 -8
- package/dist/runtimes/remote-thread-list/adapter/cloud.js.map +1 -1
- package/dist/runtimes/remote-thread-list/adapter/in-memory.js +3 -2
- package/dist/runtimes/remote-thread-list/adapter/in-memory.js.map +1 -1
- package/dist/runtimes/remote-thread-list/index.js +3 -2
- package/dist/runtimes/remote-thread-list/index.js.map +1 -1
- package/dist/runtimes/remote-thread-list/useRemoteThreadListRuntime.js +8 -6
- package/dist/runtimes/remote-thread-list/useRemoteThreadListRuntime.js.map +1 -1
- package/dist/runtimes/utils/MessageRepository.js +10 -9
- package/dist/runtimes/utils/MessageRepository.js.map +1 -1
- package/dist/tests/setup.js +2971 -3
- package/dist/tests/setup.js.map +1 -1
- package/dist/utils/CompositeContextProvider.js +4 -3
- package/dist/utils/CompositeContextProvider.js.map +1 -1
- package/dist/utils/combined/createCombinedStore.js +3 -1
- package/dist/utils/combined/createCombinedStore.js.map +1 -1
- package/dist/utils/combined/useCombinedStore.js +4 -2
- package/dist/utils/combined/useCombinedStore.js.map +1 -1
- package/dist/utils/createActionButton.js +3 -2
- package/dist/utils/createActionButton.js.map +1 -1
- package/dist/utils/getThreadMessageText.js +2 -1
- package/dist/utils/getThreadMessageText.js.map +1 -1
- package/dist/utils/hooks/useManagedRef.js +2 -1
- package/dist/utils/hooks/useManagedRef.js.map +1 -1
- package/dist/utils/hooks/useOnResizeContent.js +3 -2
- package/dist/utils/hooks/useOnResizeContent.js.map +1 -1
- package/dist/utils/hooks/useOnScrollToBottom.js +4 -2
- package/dist/utils/hooks/useOnScrollToBottom.js.map +1 -1
- package/dist/utils/idUtils.js +5 -4
- package/dist/utils/idUtils.js.map +1 -1
- package/dist/utils/json/is-json.js +1 -0
- package/dist/utils/json/is-json.js.map +1 -1
- package/dist/utils/smooth/SmoothContext.js +10 -8
- package/dist/utils/smooth/SmoothContext.js.map +1 -1
- package/dist/utils/smooth/index.js +4 -2
- package/dist/utils/smooth/index.js.map +1 -1
- package/dist/utils/smooth/useSmooth.js +9 -7
- package/dist/utils/smooth/useSmooth.js.map +1 -1
- package/dist/utils/useToolArgsFieldStatus.js +4 -3
- package/dist/utils/useToolArgsFieldStatus.js.map +1 -1
- package/package.json +4 -4
- package/src/model-context/tool.ts +3 -16
- package/src/model-context/useAssistantTool.tsx +1 -4
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../src/cloud/AssistantCloudThreadHistoryAdapter.tsx"],"sourcesContent":["import { RefObject, useState } from \"react\";\nimport { useThreadListItemRuntime } from \"../context\";\nimport { ThreadHistoryAdapter } from \"../runtimes/adapters/thread-history/ThreadHistoryAdapter\";\nimport { ExportedMessageRepositoryItem } from \"../runtimes/utils/MessageRepository\";\nimport { AssistantCloud } from \"./AssistantCloud\";\nimport { auiV0Decode, auiV0Encode } from \"./auiV0\";\nimport { ThreadListItemRuntime } from \"../api\";\n\nclass AssistantCloudThreadHistoryAdapter implements ThreadHistoryAdapter {\n constructor(\n private cloudRef: RefObject<AssistantCloud>,\n private threadListItemRuntime: ThreadListItemRuntime,\n ) {}\n\n private _getIdForLocalId: Record<string, string | Promise<string>> = {};\n\n async append({ parentId, message }: ExportedMessageRepositoryItem) {\n const { remoteId } = await this.threadListItemRuntime.initialize();\n const task = this.cloudRef.current.threads.messages\n .create(remoteId, {\n parent_id: parentId\n ? ((await this._getIdForLocalId[parentId]) ?? parentId)\n : null,\n format: \"aui/v0\",\n content: auiV0Encode(message),\n })\n .then(({ message_id }) => {\n this._getIdForLocalId[message.id] = message_id;\n return message_id;\n });\n\n this._getIdForLocalId[message.id] = task;\n\n return task.then(() => {});\n }\n\n async load() {\n const remoteId = this.threadListItemRuntime.getState().remoteId;\n if (!remoteId) return { messages: [] };\n const { messages } =\n await this.cloudRef.current.threads.messages.list(remoteId);\n const payload = {\n messages: messages\n .filter(\n (m): m is typeof m & { format: \"aui/v0\" } => m.format === \"aui/v0\",\n )\n .map(auiV0Decode)\n .reverse(),\n };\n return payload;\n }\n}\n\nexport const useAssistantCloudThreadHistoryAdapter = (\n cloudRef: RefObject<AssistantCloud>,\n): ThreadHistoryAdapter => {\n const threadListItemRuntime = useThreadListItemRuntime();\n const [adapter] = useState(\n () =>\n new AssistantCloudThreadHistoryAdapter(cloudRef, threadListItemRuntime),\n );\n\n return adapter;\n};\n"],"mappings":"AAAA,SAAoB,gBAAgB;AACpC,SAAS,gCAAgC;AAIzC,SAAS,aAAa,mBAAmB;AAGzC,
|
1
|
+
{"version":3,"sources":["../../src/cloud/AssistantCloudThreadHistoryAdapter.tsx"],"sourcesContent":["import { RefObject, useState } from \"react\";\nimport { useThreadListItemRuntime } from \"../context\";\nimport { ThreadHistoryAdapter } from \"../runtimes/adapters/thread-history/ThreadHistoryAdapter\";\nimport { ExportedMessageRepositoryItem } from \"../runtimes/utils/MessageRepository\";\nimport { AssistantCloud } from \"./AssistantCloud\";\nimport { auiV0Decode, auiV0Encode } from \"./auiV0\";\nimport { ThreadListItemRuntime } from \"../api\";\n\nclass AssistantCloudThreadHistoryAdapter implements ThreadHistoryAdapter {\n constructor(\n private cloudRef: RefObject<AssistantCloud>,\n private threadListItemRuntime: ThreadListItemRuntime,\n ) {}\n\n private _getIdForLocalId: Record<string, string | Promise<string>> = {};\n\n async append({ parentId, message }: ExportedMessageRepositoryItem) {\n const { remoteId } = await this.threadListItemRuntime.initialize();\n const task = this.cloudRef.current.threads.messages\n .create(remoteId, {\n parent_id: parentId\n ? ((await this._getIdForLocalId[parentId]) ?? parentId)\n : null,\n format: \"aui/v0\",\n content: auiV0Encode(message),\n })\n .then(({ message_id }) => {\n this._getIdForLocalId[message.id] = message_id;\n return message_id;\n });\n\n this._getIdForLocalId[message.id] = task;\n\n return task.then(() => {});\n }\n\n async load() {\n const remoteId = this.threadListItemRuntime.getState().remoteId;\n if (!remoteId) return { messages: [] };\n const { messages } =\n await this.cloudRef.current.threads.messages.list(remoteId);\n const payload = {\n messages: messages\n .filter(\n (m): m is typeof m & { format: \"aui/v0\" } => m.format === \"aui/v0\",\n )\n .map(auiV0Decode)\n .reverse(),\n };\n return payload;\n }\n}\n\nexport const useAssistantCloudThreadHistoryAdapter = (\n cloudRef: RefObject<AssistantCloud>,\n): ThreadHistoryAdapter => {\n const threadListItemRuntime = useThreadListItemRuntime();\n const [adapter] = useState(\n () =>\n new AssistantCloudThreadHistoryAdapter(cloudRef, threadListItemRuntime),\n );\n\n return adapter;\n};\n"],"mappings":";AAAA,SAAoB,gBAAgB;AACpC,SAAS,gCAAgC;AAIzC,SAAS,aAAa,mBAAmB;AAGzC,IAAM,qCAAN,MAAyE;AAAA,EACvE,YACU,UACA,uBACR;AAFQ;AACA;AAAA,EACP;AAAA,EAEK,mBAA6D,CAAC;AAAA,EAEtE,MAAM,OAAO,EAAE,UAAU,QAAQ,GAAkC;AACjE,UAAM,EAAE,SAAS,IAAI,MAAM,KAAK,sBAAsB,WAAW;AACjE,UAAM,OAAO,KAAK,SAAS,QAAQ,QAAQ,SACxC,OAAO,UAAU;AAAA,MAChB,WAAW,WACL,MAAM,KAAK,iBAAiB,QAAQ,KAAM,WAC5C;AAAA,MACJ,QAAQ;AAAA,MACR,SAAS,YAAY,OAAO;AAAA,IAC9B,CAAC,EACA,KAAK,CAAC,EAAE,WAAW,MAAM;AACxB,WAAK,iBAAiB,QAAQ,EAAE,IAAI;AACpC,aAAO;AAAA,IACT,CAAC;AAEH,SAAK,iBAAiB,QAAQ,EAAE,IAAI;AAEpC,WAAO,KAAK,KAAK,MAAM;AAAA,IAAC,CAAC;AAAA,EAC3B;AAAA,EAEA,MAAM,OAAO;AACX,UAAM,WAAW,KAAK,sBAAsB,SAAS,EAAE;AACvD,QAAI,CAAC,SAAU,QAAO,EAAE,UAAU,CAAC,EAAE;AACrC,UAAM,EAAE,SAAS,IACf,MAAM,KAAK,SAAS,QAAQ,QAAQ,SAAS,KAAK,QAAQ;AAC5D,UAAM,UAAU;AAAA,MACd,UAAU,SACP;AAAA,QACC,CAAC,MAA4C,EAAE,WAAW;AAAA,MAC5D,EACC,IAAI,WAAW,EACf,QAAQ;AAAA,IACb;AACA,WAAO;AAAA,EACT;AACF;AAEO,IAAM,wCAAwC,CACnD,aACyB;AACzB,QAAM,wBAAwB,yBAAyB;AACvD,QAAM,CAAC,OAAO,IAAI;AAAA,IAChB,MACE,IAAI,mCAAmC,UAAU,qBAAqB;AAAA,EAC1E;AAEA,SAAO;AACT;","names":[]}
|
@@ -1,4 +1,5 @@
|
|
1
|
-
|
1
|
+
// src/cloud/AssistantCloudThreadMessages.tsx
|
2
|
+
var AssistantCloudThreadMessages = class {
|
2
3
|
constructor(cloud) {
|
3
4
|
this.cloud = cloud;
|
4
5
|
}
|
@@ -13,7 +14,7 @@ class AssistantCloudThreadMessages {
|
|
13
14
|
{ method: "POST", body }
|
14
15
|
);
|
15
16
|
}
|
16
|
-
}
|
17
|
+
};
|
17
18
|
export {
|
18
19
|
AssistantCloudThreadMessages
|
19
20
|
};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../src/cloud/AssistantCloudThreadMessages.tsx"],"sourcesContent":["import { ReadonlyJSONObject } from \"../utils/json/json-value\";\nimport { AssistantCloudAPI } from \"./AssistantCloudAPI\";\n\nexport type CloudMessage = {\n id: string;\n parent_id: string | null;\n height: number;\n created_at: Date;\n updated_at: Date;\n format: \"aui/v0\" | string;\n content: ReadonlyJSONObject;\n};\n\ntype AssistantCloudThreadMessageListResponse = {\n messages: CloudMessage[];\n};\n\ntype AssistantCloudThreadMessageCreateBody = {\n parent_id: string | null;\n format: \"aui/v0\" | string;\n content: ReadonlyJSONObject;\n};\n\ntype AssistantCloudMessageCreateResponse = {\n message_id: string;\n};\n\nexport class AssistantCloudThreadMessages {\n constructor(private cloud: AssistantCloudAPI) {}\n\n public async list(\n threadId: string,\n ): Promise<AssistantCloudThreadMessageListResponse> {\n return this.cloud.makeRequest(\n `/threads/${encodeURIComponent(threadId)}/messages`,\n );\n }\n\n public async create(\n threadId: string,\n body: AssistantCloudThreadMessageCreateBody,\n ): Promise<AssistantCloudMessageCreateResponse> {\n return this.cloud.makeRequest(\n `/threads/${encodeURIComponent(threadId)}/messages`,\n { method: \"POST\", body },\n );\n }\n}\n"],"mappings":"AA2BO,
|
1
|
+
{"version":3,"sources":["../../src/cloud/AssistantCloudThreadMessages.tsx"],"sourcesContent":["import { ReadonlyJSONObject } from \"../utils/json/json-value\";\nimport { AssistantCloudAPI } from \"./AssistantCloudAPI\";\n\nexport type CloudMessage = {\n id: string;\n parent_id: string | null;\n height: number;\n created_at: Date;\n updated_at: Date;\n format: \"aui/v0\" | string;\n content: ReadonlyJSONObject;\n};\n\ntype AssistantCloudThreadMessageListResponse = {\n messages: CloudMessage[];\n};\n\ntype AssistantCloudThreadMessageCreateBody = {\n parent_id: string | null;\n format: \"aui/v0\" | string;\n content: ReadonlyJSONObject;\n};\n\ntype AssistantCloudMessageCreateResponse = {\n message_id: string;\n};\n\nexport class AssistantCloudThreadMessages {\n constructor(private cloud: AssistantCloudAPI) {}\n\n public async list(\n threadId: string,\n ): Promise<AssistantCloudThreadMessageListResponse> {\n return this.cloud.makeRequest(\n `/threads/${encodeURIComponent(threadId)}/messages`,\n );\n }\n\n public async create(\n threadId: string,\n body: AssistantCloudThreadMessageCreateBody,\n ): Promise<AssistantCloudMessageCreateResponse> {\n return this.cloud.makeRequest(\n `/threads/${encodeURIComponent(threadId)}/messages`,\n { method: \"POST\", body },\n );\n }\n}\n"],"mappings":";AA2BO,IAAM,+BAAN,MAAmC;AAAA,EACxC,YAAoB,OAA0B;AAA1B;AAAA,EAA2B;AAAA,EAE/C,MAAa,KACX,UACkD;AAClD,WAAO,KAAK,MAAM;AAAA,MAChB,YAAY,mBAAmB,QAAQ,CAAC;AAAA,IAC1C;AAAA,EACF;AAAA,EAEA,MAAa,OACX,UACA,MAC8C;AAC9C,WAAO,KAAK,MAAM;AAAA,MAChB,YAAY,mBAAmB,QAAQ,CAAC;AAAA,MACxC,EAAE,QAAQ,QAAQ,KAAK;AAAA,IACzB;AAAA,EACF;AACF;","names":[]}
|
@@ -1,5 +1,6 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
// src/cloud/AssistantCloudThreads.tsx
|
2
|
+
import { AssistantCloudThreadMessages } from "./AssistantCloudThreadMessages.js";
|
3
|
+
var AssistantCloudThreads = class {
|
3
4
|
constructor(cloud) {
|
4
5
|
this.cloud = cloud;
|
5
6
|
this.messages = new AssistantCloudThreadMessages(cloud);
|
@@ -22,7 +23,7 @@ class AssistantCloudThreads {
|
|
22
23
|
method: "DELETE"
|
23
24
|
});
|
24
25
|
}
|
25
|
-
}
|
26
|
+
};
|
26
27
|
export {
|
27
28
|
AssistantCloudThreads
|
28
29
|
};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../src/cloud/AssistantCloudThreads.tsx"],"sourcesContent":["import { AssistantCloudAPI } from \"./AssistantCloudAPI\";\nimport { AssistantCloudThreadMessages } from \"./AssistantCloudThreadMessages\";\n\ntype AssistantCloudThreadsListQuery = {\n is_archived?: boolean;\n limit?: number;\n after?: string;\n};\n\ntype CloudThread = {\n title: string;\n last_message_at: Date;\n metadata: unknown;\n external_id: string | null;\n id: string;\n project_id: string;\n created_at: Date;\n updated_at: Date;\n workspace_id: string;\n is_archived: boolean;\n};\n\ntype AssistantCloudThreadsListResponse = {\n threads: CloudThread[];\n};\n\ntype AssistantCloudThreadsCreateBody = {\n title?: string | undefined;\n last_message_at: Date;\n metadata?: unknown | undefined;\n external_id?: string | undefined;\n};\n\ntype AssistantCloudThreadsCreateResponse = {\n thread_id: string;\n};\n\ntype AssistantCloudThreadsUpdateBody = {\n title?: string | undefined;\n last_message_at?: Date | undefined;\n metadata?: unknown | undefined;\n is_archived?: boolean | undefined;\n};\n\nexport class AssistantCloudThreads {\n public readonly messages: AssistantCloudThreadMessages;\n\n constructor(private cloud: AssistantCloudAPI) {\n this.messages = new AssistantCloudThreadMessages(cloud);\n }\n\n public async list(\n query?: AssistantCloudThreadsListQuery,\n ): Promise<AssistantCloudThreadsListResponse> {\n return this.cloud.makeRequest(\"/threads\", { query });\n }\n\n public async create(\n body: AssistantCloudThreadsCreateBody,\n ): Promise<AssistantCloudThreadsCreateResponse> {\n return this.cloud.makeRequest(\"/threads\", { method: \"POST\", body });\n }\n\n public async update(\n threadId: string,\n body: AssistantCloudThreadsUpdateBody,\n ): Promise<void> {\n return this.cloud.makeRequest(`/threads/${encodeURIComponent(threadId)}`, {\n method: \"PUT\",\n body,\n });\n }\n\n public async delete(threadId: string): Promise<void> {\n return this.cloud.makeRequest(`/threads/${encodeURIComponent(threadId)}`, {\n method: \"DELETE\",\n });\n }\n}\n"],"mappings":"AACA,SAAS,oCAAoC;AA2CtC,
|
1
|
+
{"version":3,"sources":["../../src/cloud/AssistantCloudThreads.tsx"],"sourcesContent":["import { AssistantCloudAPI } from \"./AssistantCloudAPI\";\nimport { AssistantCloudThreadMessages } from \"./AssistantCloudThreadMessages\";\n\ntype AssistantCloudThreadsListQuery = {\n is_archived?: boolean;\n limit?: number;\n after?: string;\n};\n\ntype CloudThread = {\n title: string;\n last_message_at: Date;\n metadata: unknown;\n external_id: string | null;\n id: string;\n project_id: string;\n created_at: Date;\n updated_at: Date;\n workspace_id: string;\n is_archived: boolean;\n};\n\ntype AssistantCloudThreadsListResponse = {\n threads: CloudThread[];\n};\n\ntype AssistantCloudThreadsCreateBody = {\n title?: string | undefined;\n last_message_at: Date;\n metadata?: unknown | undefined;\n external_id?: string | undefined;\n};\n\ntype AssistantCloudThreadsCreateResponse = {\n thread_id: string;\n};\n\ntype AssistantCloudThreadsUpdateBody = {\n title?: string | undefined;\n last_message_at?: Date | undefined;\n metadata?: unknown | undefined;\n is_archived?: boolean | undefined;\n};\n\nexport class AssistantCloudThreads {\n public readonly messages: AssistantCloudThreadMessages;\n\n constructor(private cloud: AssistantCloudAPI) {\n this.messages = new AssistantCloudThreadMessages(cloud);\n }\n\n public async list(\n query?: AssistantCloudThreadsListQuery,\n ): Promise<AssistantCloudThreadsListResponse> {\n return this.cloud.makeRequest(\"/threads\", { query });\n }\n\n public async create(\n body: AssistantCloudThreadsCreateBody,\n ): Promise<AssistantCloudThreadsCreateResponse> {\n return this.cloud.makeRequest(\"/threads\", { method: \"POST\", body });\n }\n\n public async update(\n threadId: string,\n body: AssistantCloudThreadsUpdateBody,\n ): Promise<void> {\n return this.cloud.makeRequest(`/threads/${encodeURIComponent(threadId)}`, {\n method: \"PUT\",\n body,\n });\n }\n\n public async delete(threadId: string): Promise<void> {\n return this.cloud.makeRequest(`/threads/${encodeURIComponent(threadId)}`, {\n method: \"DELETE\",\n });\n }\n}\n"],"mappings":";AACA,SAAS,oCAAoC;AA2CtC,IAAM,wBAAN,MAA4B;AAAA,EAGjC,YAAoB,OAA0B;AAA1B;AAClB,SAAK,WAAW,IAAI,6BAA6B,KAAK;AAAA,EACxD;AAAA,EAJgB;AAAA,EAMhB,MAAa,KACX,OAC4C;AAC5C,WAAO,KAAK,MAAM,YAAY,YAAY,EAAE,MAAM,CAAC;AAAA,EACrD;AAAA,EAEA,MAAa,OACX,MAC8C;AAC9C,WAAO,KAAK,MAAM,YAAY,YAAY,EAAE,QAAQ,QAAQ,KAAK,CAAC;AAAA,EACpE;AAAA,EAEA,MAAa,OACX,UACA,MACe;AACf,WAAO,KAAK,MAAM,YAAY,YAAY,mBAAmB,QAAQ,CAAC,IAAI;AAAA,MACxE,QAAQ;AAAA,MACR;AAAA,IACF,CAAC;AAAA,EACH;AAAA,EAEA,MAAa,OAAO,UAAiC;AACnD,WAAO,KAAK,MAAM,YAAY,YAAY,mBAAmB,QAAQ,CAAC,IAAI;AAAA,MACxE,QAAQ;AAAA,IACV,CAAC;AAAA,EACH;AACF;","names":[]}
|
package/dist/cloud/auiV0.js
CHANGED
@@ -1,6 +1,7 @@
|
|
1
|
-
|
2
|
-
import {
|
3
|
-
|
1
|
+
// src/cloud/auiV0.ts
|
2
|
+
import { fromThreadMessageLike } from "../runtimes/external-store/ThreadMessageLike.js";
|
3
|
+
import { isJSONValue } from "../utils/json/is-json.js";
|
4
|
+
var auiV0Encode = (message) => {
|
4
5
|
return {
|
5
6
|
role: message.role,
|
6
7
|
content: message.content.map((part) => {
|
@@ -61,7 +62,7 @@ const auiV0Encode = (message) => {
|
|
61
62
|
} : void 0
|
62
63
|
};
|
63
64
|
};
|
64
|
-
|
65
|
+
var auiV0Decode = (cloudMessage) => {
|
65
66
|
const payload = cloudMessage.content;
|
66
67
|
const message = fromThreadMessageLike(
|
67
68
|
{
|
package/dist/cloud/auiV0.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../src/cloud/auiV0.ts"],"sourcesContent":["import { ThreadMessage } from \"../types\";\nimport { MessageStatus } from \"../types/AssistantTypes\";\nimport { fromThreadMessageLike } from \"../runtimes/external-store/ThreadMessageLike\";\nimport { CloudMessage } from \"./AssistantCloudThreadMessages\";\nimport { isJSONValue } from \"../utils/json/is-json\";\nimport {\n ReadonlyJSONObject,\n ReadonlyJSONValue,\n} from \"../utils/json/json-value\";\nimport { ExportedMessageRepositoryItem } from \"../runtimes/utils/MessageRepository\";\n\ntype AuiV0MessageContentPart =\n | {\n readonly type: \"text\";\n readonly text: string;\n }\n | {\n readonly type: \"reasoning\";\n readonly text: string;\n }\n | {\n readonly type: \"source\";\n readonly sourceType: \"url\";\n readonly id: string;\n readonly url: string;\n readonly title?: string;\n }\n | {\n readonly type: \"tool-call\";\n readonly toolCallId: string;\n readonly toolName: string;\n readonly args: ReadonlyJSONObject;\n readonly result?: ReadonlyJSONValue;\n readonly isError?: true;\n }\n | {\n readonly type: \"tool-call\";\n readonly toolCallId: string;\n readonly toolName: string;\n readonly argsText: string;\n readonly result?: ReadonlyJSONValue;\n readonly isError?: true;\n };\n\ntype AuiV0Message = {\n readonly role: \"assistant\" | \"user\" | \"system\";\n readonly status?: MessageStatus;\n readonly content: readonly AuiV0MessageContentPart[];\n readonly metadata: {\n readonly unstable_annotations: readonly ReadonlyJSONValue[];\n readonly unstable_data: readonly ReadonlyJSONValue[];\n readonly steps: readonly {\n readonly usage?: {\n readonly promptTokens: number;\n readonly completionTokens: number;\n };\n }[];\n readonly custom: ReadonlyJSONObject;\n };\n};\n\nexport const auiV0Encode = (message: ThreadMessage): AuiV0Message => {\n // TODO attachments are currently intentionally ignored\n // info: ID and createdAt are ignored (we use the server value instead)\n return {\n role: message.role,\n content: message.content.map((part) => {\n const type = part.type;\n switch (type) {\n case \"text\": {\n return {\n type: \"text\",\n text: part.text,\n };\n }\n\n case \"reasoning\": {\n return {\n type: \"reasoning\",\n text: part.text,\n };\n }\n\n case \"source\": {\n return {\n type: \"source\",\n sourceType: part.sourceType,\n id: part.id,\n url: part.url,\n ...(part.title ? { title: part.title } : undefined),\n };\n }\n\n case \"tool-call\": {\n if (!isJSONValue(part.result)) {\n console.warn(\n \"tool-call result is not JSON! \" + JSON.stringify(part),\n );\n }\n return {\n type: \"tool-call\",\n toolCallId: part.toolCallId,\n toolName: part.toolName,\n ...(JSON.stringify(part.args) === part.argsText\n ? {\n args: part.args,\n }\n : { argsText: part.argsText }),\n ...(part.result\n ? { result: part.result as ReadonlyJSONValue }\n : {}),\n ...(part.isError ? { isError: true } : {}),\n };\n }\n\n default: {\n const unhandledType: \"image\" | \"file\" | \"audio\" = type;\n throw new Error(\n `Content part type not supported by aui/v0: ${unhandledType}`,\n );\n }\n }\n }),\n metadata: message.metadata as AuiV0Message[\"metadata\"],\n ...(message.status\n ? {\n status:\n message.status?.type === \"running\"\n ? {\n type: \"incomplete\",\n reason: \"cancelled\",\n }\n : message.status,\n }\n : undefined),\n };\n};\n\nexport const auiV0Decode = (\n cloudMessage: CloudMessage & { format: \"aui/v0\" },\n): ExportedMessageRepositoryItem => {\n const payload = cloudMessage.content as unknown as AuiV0Message;\n const message = fromThreadMessageLike(\n {\n id: cloudMessage.id,\n createdAt: cloudMessage.created_at,\n ...payload,\n },\n cloudMessage.id,\n {\n type: \"complete\",\n reason: \"unknown\",\n },\n );\n\n return {\n parentId: cloudMessage.parent_id,\n message,\n };\n};\n"],"mappings":"AAEA,SAAS,6BAA6B;AAEtC,SAAS,mBAAmB;AAyDrB,
|
1
|
+
{"version":3,"sources":["../../src/cloud/auiV0.ts"],"sourcesContent":["import { ThreadMessage } from \"../types\";\nimport { MessageStatus } from \"../types/AssistantTypes\";\nimport { fromThreadMessageLike } from \"../runtimes/external-store/ThreadMessageLike\";\nimport { CloudMessage } from \"./AssistantCloudThreadMessages\";\nimport { isJSONValue } from \"../utils/json/is-json\";\nimport {\n ReadonlyJSONObject,\n ReadonlyJSONValue,\n} from \"../utils/json/json-value\";\nimport { ExportedMessageRepositoryItem } from \"../runtimes/utils/MessageRepository\";\n\ntype AuiV0MessageContentPart =\n | {\n readonly type: \"text\";\n readonly text: string;\n }\n | {\n readonly type: \"reasoning\";\n readonly text: string;\n }\n | {\n readonly type: \"source\";\n readonly sourceType: \"url\";\n readonly id: string;\n readonly url: string;\n readonly title?: string;\n }\n | {\n readonly type: \"tool-call\";\n readonly toolCallId: string;\n readonly toolName: string;\n readonly args: ReadonlyJSONObject;\n readonly result?: ReadonlyJSONValue;\n readonly isError?: true;\n }\n | {\n readonly type: \"tool-call\";\n readonly toolCallId: string;\n readonly toolName: string;\n readonly argsText: string;\n readonly result?: ReadonlyJSONValue;\n readonly isError?: true;\n };\n\ntype AuiV0Message = {\n readonly role: \"assistant\" | \"user\" | \"system\";\n readonly status?: MessageStatus;\n readonly content: readonly AuiV0MessageContentPart[];\n readonly metadata: {\n readonly unstable_annotations: readonly ReadonlyJSONValue[];\n readonly unstable_data: readonly ReadonlyJSONValue[];\n readonly steps: readonly {\n readonly usage?: {\n readonly promptTokens: number;\n readonly completionTokens: number;\n };\n }[];\n readonly custom: ReadonlyJSONObject;\n };\n};\n\nexport const auiV0Encode = (message: ThreadMessage): AuiV0Message => {\n // TODO attachments are currently intentionally ignored\n // info: ID and createdAt are ignored (we use the server value instead)\n return {\n role: message.role,\n content: message.content.map((part) => {\n const type = part.type;\n switch (type) {\n case \"text\": {\n return {\n type: \"text\",\n text: part.text,\n };\n }\n\n case \"reasoning\": {\n return {\n type: \"reasoning\",\n text: part.text,\n };\n }\n\n case \"source\": {\n return {\n type: \"source\",\n sourceType: part.sourceType,\n id: part.id,\n url: part.url,\n ...(part.title ? { title: part.title } : undefined),\n };\n }\n\n case \"tool-call\": {\n if (!isJSONValue(part.result)) {\n console.warn(\n \"tool-call result is not JSON! \" + JSON.stringify(part),\n );\n }\n return {\n type: \"tool-call\",\n toolCallId: part.toolCallId,\n toolName: part.toolName,\n ...(JSON.stringify(part.args) === part.argsText\n ? {\n args: part.args,\n }\n : { argsText: part.argsText }),\n ...(part.result\n ? { result: part.result as ReadonlyJSONValue }\n : {}),\n ...(part.isError ? { isError: true } : {}),\n };\n }\n\n default: {\n const unhandledType: \"image\" | \"file\" | \"audio\" = type;\n throw new Error(\n `Content part type not supported by aui/v0: ${unhandledType}`,\n );\n }\n }\n }),\n metadata: message.metadata as AuiV0Message[\"metadata\"],\n ...(message.status\n ? {\n status:\n message.status?.type === \"running\"\n ? {\n type: \"incomplete\",\n reason: \"cancelled\",\n }\n : message.status,\n }\n : undefined),\n };\n};\n\nexport const auiV0Decode = (\n cloudMessage: CloudMessage & { format: \"aui/v0\" },\n): ExportedMessageRepositoryItem => {\n const payload = cloudMessage.content as unknown as AuiV0Message;\n const message = fromThreadMessageLike(\n {\n id: cloudMessage.id,\n createdAt: cloudMessage.created_at,\n ...payload,\n },\n cloudMessage.id,\n {\n type: \"complete\",\n reason: \"unknown\",\n },\n );\n\n return {\n parentId: cloudMessage.parent_id,\n message,\n };\n};\n"],"mappings":";AAEA,SAAS,6BAA6B;AAEtC,SAAS,mBAAmB;AAyDrB,IAAM,cAAc,CAAC,YAAyC;AAGnE,SAAO;AAAA,IACL,MAAM,QAAQ;AAAA,IACd,SAAS,QAAQ,QAAQ,IAAI,CAAC,SAAS;AACrC,YAAM,OAAO,KAAK;AAClB,cAAQ,MAAM;AAAA,QACZ,KAAK,QAAQ;AACX,iBAAO;AAAA,YACL,MAAM;AAAA,YACN,MAAM,KAAK;AAAA,UACb;AAAA,QACF;AAAA,QAEA,KAAK,aAAa;AAChB,iBAAO;AAAA,YACL,MAAM;AAAA,YACN,MAAM,KAAK;AAAA,UACb;AAAA,QACF;AAAA,QAEA,KAAK,UAAU;AACb,iBAAO;AAAA,YACL,MAAM;AAAA,YACN,YAAY,KAAK;AAAA,YACjB,IAAI,KAAK;AAAA,YACT,KAAK,KAAK;AAAA,YACV,GAAI,KAAK,QAAQ,EAAE,OAAO,KAAK,MAAM,IAAI;AAAA,UAC3C;AAAA,QACF;AAAA,QAEA,KAAK,aAAa;AAChB,cAAI,CAAC,YAAY,KAAK,MAAM,GAAG;AAC7B,oBAAQ;AAAA,cACN,mCAAmC,KAAK,UAAU,IAAI;AAAA,YACxD;AAAA,UACF;AACA,iBAAO;AAAA,YACL,MAAM;AAAA,YACN,YAAY,KAAK;AAAA,YACjB,UAAU,KAAK;AAAA,YACf,GAAI,KAAK,UAAU,KAAK,IAAI,MAAM,KAAK,WACnC;AAAA,cACE,MAAM,KAAK;AAAA,YACb,IACA,EAAE,UAAU,KAAK,SAAS;AAAA,YAC9B,GAAI,KAAK,SACL,EAAE,QAAQ,KAAK,OAA4B,IAC3C,CAAC;AAAA,YACL,GAAI,KAAK,UAAU,EAAE,SAAS,KAAK,IAAI,CAAC;AAAA,UAC1C;AAAA,QACF;AAAA,QAEA,SAAS;AACP,gBAAM,gBAA4C;AAClD,gBAAM,IAAI;AAAA,YACR,8CAA8C,aAAa;AAAA,UAC7D;AAAA,QACF;AAAA,MACF;AAAA,IACF,CAAC;AAAA,IACD,UAAU,QAAQ;AAAA,IAClB,GAAI,QAAQ,SACR;AAAA,MACE,QACE,QAAQ,QAAQ,SAAS,YACrB;AAAA,QACE,MAAM;AAAA,QACN,QAAQ;AAAA,MACV,IACA,QAAQ;AAAA,IAChB,IACA;AAAA,EACN;AACF;AAEO,IAAM,cAAc,CACzB,iBACkC;AAClC,QAAM,UAAU,aAAa;AAC7B,QAAM,UAAU;AAAA,IACd;AAAA,MACE,IAAI,aAAa;AAAA,MACjB,WAAW,aAAa;AAAA,MACxB,GAAG;AAAA,IACL;AAAA,IACA,aAAa;AAAA,IACb;AAAA,MACE,MAAM;AAAA,MACN,QAAQ;AAAA,IACV;AAAA,EACF;AAEA,SAAO;AAAA,IACL,UAAU,aAAa;AAAA,IACvB;AAAA,EACF;AACF;","names":[]}
|
package/dist/cloud/index.js
CHANGED
@@ -1,5 +1,6 @@
|
|
1
|
-
|
2
|
-
import {
|
1
|
+
// src/cloud/index.ts
|
2
|
+
import { useCloudThreadListRuntime } from "./useCloudThreadListRuntime.js";
|
3
|
+
import { AssistantCloud } from "./AssistantCloud.js";
|
3
4
|
export {
|
4
5
|
AssistantCloud,
|
5
6
|
useCloudThreadListRuntime
|
package/dist/cloud/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../src/cloud/index.ts"],"sourcesContent":["export { useCloudThreadListRuntime } from \"./useCloudThreadListRuntime\";\nexport { AssistantCloud } from \"./AssistantCloud\";\n"],"mappings":"AAAA,SAAS,iCAAiC;AAC1C,SAAS,sBAAsB;","names":[]}
|
1
|
+
{"version":3,"sources":["../../src/cloud/index.ts"],"sourcesContent":["export { useCloudThreadListRuntime } from \"./useCloudThreadListRuntime\";\nexport { AssistantCloud } from \"./AssistantCloud\";\n"],"mappings":";AAAA,SAAS,iCAAiC;AAC1C,SAAS,sBAAsB;","names":[]}
|
@@ -1,7 +1,9 @@
|
|
1
1
|
"use client";
|
2
|
-
|
3
|
-
|
4
|
-
|
2
|
+
|
3
|
+
// src/cloud/useCloudThreadListRuntime.tsx
|
4
|
+
import { useRemoteThreadListRuntime } from "../runtimes/remote-thread-list/useRemoteThreadListRuntime.js";
|
5
|
+
import { useCloudThreadListAdapter } from "../runtimes/remote-thread-list/adapter/cloud.js";
|
6
|
+
var useCloudThreadListRuntime = ({
|
5
7
|
runtimeHook,
|
6
8
|
...adapterOptions
|
7
9
|
}) => {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../src/cloud/useCloudThreadListRuntime.tsx"],"sourcesContent":["\"use client\";\n\nimport { AssistantCloud } from \"./AssistantCloud\";\nimport { AssistantRuntime } from \"../api\";\nimport { useRemoteThreadListRuntime } from \"../runtimes/remote-thread-list/useRemoteThreadListRuntime\";\nimport { useCloudThreadListAdapter } from \"../runtimes/remote-thread-list/adapter/cloud\";\n\ntype ThreadData = {\n externalId: string;\n};\n\ntype CloudThreadListAdapter = {\n cloud: AssistantCloud;\n\n runtimeHook: () => AssistantRuntime;\n\n create?(): Promise<ThreadData>;\n delete?(threadId: string): Promise<void>;\n};\n\nexport const useCloudThreadListRuntime = ({\n runtimeHook,\n ...adapterOptions\n}: CloudThreadListAdapter) => {\n const adapter = useCloudThreadListAdapter(adapterOptions);\n const runtime = useRemoteThreadListRuntime({\n runtimeHook: runtimeHook,\n adapter,\n });\n\n return runtime;\n};\n"],"mappings":"
|
1
|
+
{"version":3,"sources":["../../src/cloud/useCloudThreadListRuntime.tsx"],"sourcesContent":["\"use client\";\n\nimport { AssistantCloud } from \"./AssistantCloud\";\nimport { AssistantRuntime } from \"../api\";\nimport { useRemoteThreadListRuntime } from \"../runtimes/remote-thread-list/useRemoteThreadListRuntime\";\nimport { useCloudThreadListAdapter } from \"../runtimes/remote-thread-list/adapter/cloud\";\n\ntype ThreadData = {\n externalId: string;\n};\n\ntype CloudThreadListAdapter = {\n cloud: AssistantCloud;\n\n runtimeHook: () => AssistantRuntime;\n\n create?(): Promise<ThreadData>;\n delete?(threadId: string): Promise<void>;\n};\n\nexport const useCloudThreadListRuntime = ({\n runtimeHook,\n ...adapterOptions\n}: CloudThreadListAdapter) => {\n const adapter = useCloudThreadListAdapter(adapterOptions);\n const runtime = useRemoteThreadListRuntime({\n runtimeHook: runtimeHook,\n adapter,\n });\n\n return runtime;\n};\n"],"mappings":";;;AAIA,SAAS,kCAAkC;AAC3C,SAAS,iCAAiC;AAenC,IAAM,4BAA4B,CAAC;AAAA,EACxC;AAAA,EACA,GAAG;AACL,MAA8B;AAC5B,QAAM,UAAU,0BAA0B,cAAc;AACxD,QAAM,UAAU,2BAA2B;AAAA,IACzC;AAAA,IACA;AAAA,EACF,CAAC;AAED,SAAO;AACT;","names":[]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../src/context/ReadonlyStore.ts"],"sourcesContent":["import type { StoreApi } from \"zustand\";\n\nexport type ReadonlyStore<T> = Omit<StoreApi<T>, \"setState\" | \"destroy\">;\n\nexport const writableStore = <T>(store: ReadonlyStore<T> | undefined) => {\n return store as unknown as StoreApi<T>;\n};\n"],"mappings":"AAIO,
|
1
|
+
{"version":3,"sources":["../../src/context/ReadonlyStore.ts"],"sourcesContent":["import type { StoreApi } from \"zustand\";\n\nexport type ReadonlyStore<T> = Omit<StoreApi<T>, \"setState\" | \"destroy\">;\n\nexport const writableStore = <T>(store: ReadonlyStore<T> | undefined) => {\n return store as unknown as StoreApi<T>;\n};\n"],"mappings":";AAIO,IAAM,gBAAgB,CAAI,UAAwC;AACvE,SAAO;AACT;","names":[]}
|
package/dist/context/index.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../src/context/index.ts"],"sourcesContent":["export * from \"./providers\";\nexport * from \"./stores\";\nexport * from \"./react\";\n"],"mappings":"AAAA,cAAc;AACd,cAAc;AACd,cAAc;","names":[]}
|
1
|
+
{"version":3,"sources":["../../src/context/index.ts"],"sourcesContent":["export * from \"./providers\";\nexport * from \"./stores\";\nexport * from \"./react\";\n"],"mappings":";AAAA,cAAc;AACd,cAAc;AACd,cAAc;","names":[]}
|
@@ -1,18 +1,20 @@
|
|
1
1
|
"use client";
|
2
|
-
|
2
|
+
|
3
|
+
// src/context/providers/AssistantRuntimeProvider.tsx
|
3
4
|
import {
|
4
5
|
memo,
|
5
6
|
useEffect,
|
6
7
|
useMemo,
|
7
8
|
useState
|
8
9
|
} from "react";
|
9
|
-
import { AssistantContext } from "../react/AssistantContext";
|
10
|
-
import { makeAssistantToolUIsStore } from "../stores/AssistantToolUIs";
|
11
|
-
import { ThreadRuntimeProvider } from "./ThreadRuntimeProvider";
|
10
|
+
import { AssistantContext } from "../react/AssistantContext.js";
|
11
|
+
import { makeAssistantToolUIsStore } from "../stores/AssistantToolUIs.js";
|
12
|
+
import { ThreadRuntimeProvider } from "./ThreadRuntimeProvider.js";
|
12
13
|
import { create } from "zustand";
|
13
|
-
import { writableStore } from "../ReadonlyStore";
|
14
|
-
import { ensureBinding } from "../react/utils/ensureBinding";
|
15
|
-
|
14
|
+
import { writableStore } from "../ReadonlyStore.js";
|
15
|
+
import { ensureBinding } from "../react/utils/ensureBinding.js";
|
16
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
17
|
+
var useAssistantRuntimeStore = (runtime) => {
|
16
18
|
const [store] = useState(() => create(() => runtime));
|
17
19
|
useEffect(() => {
|
18
20
|
ensureBinding(runtime);
|
@@ -21,13 +23,13 @@ const useAssistantRuntimeStore = (runtime) => {
|
|
21
23
|
}, [runtime, store]);
|
22
24
|
return store;
|
23
25
|
};
|
24
|
-
|
26
|
+
var useAssistantToolUIsStore = () => {
|
25
27
|
return useMemo(() => makeAssistantToolUIsStore(), []);
|
26
28
|
};
|
27
|
-
|
29
|
+
var getRenderComponent = (runtime) => {
|
28
30
|
return runtime._core?.RenderComponent;
|
29
31
|
};
|
30
|
-
|
32
|
+
var AssistantRuntimeProviderImpl = ({ children, runtime }) => {
|
31
33
|
const useAssistantRuntime = useAssistantRuntimeStore(runtime);
|
32
34
|
const useToolUIs = useAssistantToolUIsStore();
|
33
35
|
const [context] = useState(() => {
|
@@ -49,7 +51,7 @@ const AssistantRuntimeProviderImpl = ({ children, runtime }) => {
|
|
49
51
|
)
|
50
52
|
] });
|
51
53
|
};
|
52
|
-
|
54
|
+
var AssistantRuntimeProvider = memo(AssistantRuntimeProviderImpl);
|
53
55
|
export {
|
54
56
|
AssistantRuntimeProvider,
|
55
57
|
AssistantRuntimeProviderImpl
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/context/providers/AssistantRuntimeProvider.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n FC,\n PropsWithChildren,\n memo,\n useEffect,\n useMemo,\n useState,\n} from \"react\";\nimport { AssistantContext } from \"../react/AssistantContext\";\nimport { makeAssistantToolUIsStore } from \"../stores/AssistantToolUIs\";\nimport { ThreadRuntimeProvider } from \"./ThreadRuntimeProvider\";\nimport { AssistantRuntime } from \"../../api/AssistantRuntime\";\nimport { create } from \"zustand\";\nimport { writableStore } from \"../ReadonlyStore\";\nimport { AssistantRuntimeCore } from \"../../runtimes/core/AssistantRuntimeCore\";\nimport { ensureBinding } from \"../react/utils/ensureBinding\";\n\nexport namespace AssistantRuntimeProvider {\n export type Props = PropsWithChildren<{\n /**\n * The runtime to provide to the rest of your app.\n */\n runtime: AssistantRuntime;\n }>;\n}\n\nconst useAssistantRuntimeStore = (runtime: AssistantRuntime) => {\n const [store] = useState(() => create(() => runtime));\n\n useEffect(() => {\n ensureBinding(runtime);\n ensureBinding(runtime.threads);\n\n writableStore(store).setState(runtime, true);\n }, [runtime, store]);\n\n return store;\n};\n\nconst useAssistantToolUIsStore = () => {\n return useMemo(() => makeAssistantToolUIsStore(), []);\n};\n\nconst getRenderComponent = (runtime: AssistantRuntime) => {\n return (runtime as { _core?: AssistantRuntimeCore })._core?.RenderComponent;\n};\n\nexport const AssistantRuntimeProviderImpl: FC<\n AssistantRuntimeProvider.Props\n> = ({ children, runtime }) => {\n const useAssistantRuntime = useAssistantRuntimeStore(runtime);\n const useToolUIs = useAssistantToolUIsStore();\n const [context] = useState(() => {\n return {\n useToolUIs,\n useAssistantRuntime,\n };\n });\n\n const RenderComponent = getRenderComponent(runtime);\n\n return (\n <AssistantContext.Provider value={context}>\n {RenderComponent && <RenderComponent />}\n <ThreadRuntimeProvider\n runtime={runtime.thread}\n listItemRuntime={runtime.threads.mainItem}\n >\n {children}\n </ThreadRuntimeProvider>\n </AssistantContext.Provider>\n );\n};\n\nexport const AssistantRuntimeProvider = memo(AssistantRuntimeProviderImpl);\n"],"mappings":";
|
1
|
+
{"version":3,"sources":["../../../src/context/providers/AssistantRuntimeProvider.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n FC,\n PropsWithChildren,\n memo,\n useEffect,\n useMemo,\n useState,\n} from \"react\";\nimport { AssistantContext } from \"../react/AssistantContext\";\nimport { makeAssistantToolUIsStore } from \"../stores/AssistantToolUIs\";\nimport { ThreadRuntimeProvider } from \"./ThreadRuntimeProvider\";\nimport { AssistantRuntime } from \"../../api/AssistantRuntime\";\nimport { create } from \"zustand\";\nimport { writableStore } from \"../ReadonlyStore\";\nimport { AssistantRuntimeCore } from \"../../runtimes/core/AssistantRuntimeCore\";\nimport { ensureBinding } from \"../react/utils/ensureBinding\";\n\nexport namespace AssistantRuntimeProvider {\n export type Props = PropsWithChildren<{\n /**\n * The runtime to provide to the rest of your app.\n */\n runtime: AssistantRuntime;\n }>;\n}\n\nconst useAssistantRuntimeStore = (runtime: AssistantRuntime) => {\n const [store] = useState(() => create(() => runtime));\n\n useEffect(() => {\n ensureBinding(runtime);\n ensureBinding(runtime.threads);\n\n writableStore(store).setState(runtime, true);\n }, [runtime, store]);\n\n return store;\n};\n\nconst useAssistantToolUIsStore = () => {\n return useMemo(() => makeAssistantToolUIsStore(), []);\n};\n\nconst getRenderComponent = (runtime: AssistantRuntime) => {\n return (runtime as { _core?: AssistantRuntimeCore })._core?.RenderComponent;\n};\n\nexport const AssistantRuntimeProviderImpl: FC<\n AssistantRuntimeProvider.Props\n> = ({ children, runtime }) => {\n const useAssistantRuntime = useAssistantRuntimeStore(runtime);\n const useToolUIs = useAssistantToolUIsStore();\n const [context] = useState(() => {\n return {\n useToolUIs,\n useAssistantRuntime,\n };\n });\n\n const RenderComponent = getRenderComponent(runtime);\n\n return (\n <AssistantContext.Provider value={context}>\n {RenderComponent && <RenderComponent />}\n <ThreadRuntimeProvider\n runtime={runtime.thread}\n listItemRuntime={runtime.threads.mainItem}\n >\n {children}\n </ThreadRuntimeProvider>\n </AssistantContext.Provider>\n );\n};\n\nexport const AssistantRuntimeProvider = memo(AssistantRuntimeProviderImpl);\n"],"mappings":";;;AAEA;AAAA,EAGE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,wBAAwB;AACjC,SAAS,iCAAiC;AAC1C,SAAS,6BAA6B;AAEtC,SAAS,cAAc;AACvB,SAAS,qBAAqB;AAE9B,SAAS,qBAAqB;AA+C1B,SACsB,KADtB;AApCJ,IAAM,2BAA2B,CAAC,YAA8B;AAC9D,QAAM,CAAC,KAAK,IAAI,SAAS,MAAM,OAAO,MAAM,OAAO,CAAC;AAEpD,YAAU,MAAM;AACd,kBAAc,OAAO;AACrB,kBAAc,QAAQ,OAAO;AAE7B,kBAAc,KAAK,EAAE,SAAS,SAAS,IAAI;AAAA,EAC7C,GAAG,CAAC,SAAS,KAAK,CAAC;AAEnB,SAAO;AACT;AAEA,IAAM,2BAA2B,MAAM;AACrC,SAAO,QAAQ,MAAM,0BAA0B,GAAG,CAAC,CAAC;AACtD;AAEA,IAAM,qBAAqB,CAAC,YAA8B;AACxD,SAAQ,QAA6C,OAAO;AAC9D;AAEO,IAAM,+BAET,CAAC,EAAE,UAAU,QAAQ,MAAM;AAC7B,QAAM,sBAAsB,yBAAyB,OAAO;AAC5D,QAAM,aAAa,yBAAyB;AAC5C,QAAM,CAAC,OAAO,IAAI,SAAS,MAAM;AAC/B,WAAO;AAAA,MACL;AAAA,MACA;AAAA,IACF;AAAA,EACF,CAAC;AAED,QAAM,kBAAkB,mBAAmB,OAAO;AAElD,SACE,qBAAC,iBAAiB,UAAjB,EAA0B,OAAO,SAC/B;AAAA,uBAAmB,oBAAC,mBAAgB;AAAA,IACrC;AAAA,MAAC;AAAA;AAAA,QACC,SAAS,QAAQ;AAAA,QACjB,iBAAiB,QAAQ,QAAQ;AAAA,QAEhC;AAAA;AAAA,IACH;AAAA,KACF;AAEJ;AAEO,IAAM,2BAA2B,KAAK,4BAA4B;","names":[]}
|
@@ -1,11 +1,13 @@
|
|
1
1
|
"use client";
|
2
|
-
|
2
|
+
|
3
|
+
// src/context/providers/AttachmentRuntimeProvider.tsx
|
3
4
|
import { useEffect, useState } from "react";
|
4
5
|
import { create } from "zustand";
|
5
|
-
import { AttachmentContext } from "../react/AttachmentContext";
|
6
|
-
import { writableStore } from "../ReadonlyStore";
|
7
|
-
import { ensureBinding } from "../react/utils/ensureBinding";
|
8
|
-
|
6
|
+
import { AttachmentContext } from "../react/AttachmentContext.js";
|
7
|
+
import { writableStore } from "../ReadonlyStore.js";
|
8
|
+
import { ensureBinding } from "../react/utils/ensureBinding.js";
|
9
|
+
import { jsx } from "react/jsx-runtime";
|
10
|
+
var useAttachmentRuntimeStore = (runtime) => {
|
9
11
|
const [store] = useState(() => create(() => runtime));
|
10
12
|
useEffect(() => {
|
11
13
|
ensureBinding(runtime);
|
@@ -13,7 +15,7 @@ const useAttachmentRuntimeStore = (runtime) => {
|
|
13
15
|
}, [runtime, store]);
|
14
16
|
return store;
|
15
17
|
};
|
16
|
-
|
18
|
+
var AttachmentRuntimeProvider = ({
|
17
19
|
runtime,
|
18
20
|
children
|
19
21
|
}) => {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/context/providers/AttachmentRuntimeProvider.tsx"],"sourcesContent":["\"use client\";\n\nimport { type FC, type PropsWithChildren, useEffect, useState } from \"react\";\nimport { create } from \"zustand\";\nimport { AttachmentContext } from \"../react/AttachmentContext\";\nimport { writableStore } from \"../ReadonlyStore\";\nimport { AttachmentRuntime } from \"../../api/AttachmentRuntime\";\nimport { ensureBinding } from \"../react/utils/ensureBinding\";\n\nexport namespace AttachmentRuntimeProvider {\n export type Props = PropsWithChildren<{\n runtime: AttachmentRuntime;\n }>;\n}\n\nconst useAttachmentRuntimeStore = (runtime: AttachmentRuntime) => {\n const [store] = useState(() => create(() => runtime));\n\n useEffect(() => {\n ensureBinding(runtime);\n\n writableStore(store).setState(runtime, true);\n }, [runtime, store]);\n\n return store;\n};\n\nexport const AttachmentRuntimeProvider: FC<AttachmentRuntimeProvider.Props> = ({\n runtime,\n children,\n}) => {\n const useAttachmentRuntime = useAttachmentRuntimeStore(runtime);\n const [context] = useState(() => {\n return {\n useAttachmentRuntime,\n };\n });\n\n return (\n <AttachmentContext.Provider value={context}>\n {children}\n </AttachmentContext.Provider>\n );\n};\n"],"mappings":"
|
1
|
+
{"version":3,"sources":["../../../src/context/providers/AttachmentRuntimeProvider.tsx"],"sourcesContent":["\"use client\";\n\nimport { type FC, type PropsWithChildren, useEffect, useState } from \"react\";\nimport { create } from \"zustand\";\nimport { AttachmentContext } from \"../react/AttachmentContext\";\nimport { writableStore } from \"../ReadonlyStore\";\nimport { AttachmentRuntime } from \"../../api/AttachmentRuntime\";\nimport { ensureBinding } from \"../react/utils/ensureBinding\";\n\nexport namespace AttachmentRuntimeProvider {\n export type Props = PropsWithChildren<{\n runtime: AttachmentRuntime;\n }>;\n}\n\nconst useAttachmentRuntimeStore = (runtime: AttachmentRuntime) => {\n const [store] = useState(() => create(() => runtime));\n\n useEffect(() => {\n ensureBinding(runtime);\n\n writableStore(store).setState(runtime, true);\n }, [runtime, store]);\n\n return store;\n};\n\nexport const AttachmentRuntimeProvider: FC<AttachmentRuntimeProvider.Props> = ({\n runtime,\n children,\n}) => {\n const useAttachmentRuntime = useAttachmentRuntimeStore(runtime);\n const [context] = useState(() => {\n return {\n useAttachmentRuntime,\n };\n });\n\n return (\n <AttachmentContext.Provider value={context}>\n {children}\n </AttachmentContext.Provider>\n );\n};\n"],"mappings":";;;AAEA,SAA0C,WAAW,gBAAgB;AACrE,SAAS,cAAc;AACvB,SAAS,yBAAyB;AAClC,SAAS,qBAAqB;AAE9B,SAAS,qBAAqB;AAgC1B;AAxBJ,IAAM,4BAA4B,CAAC,YAA+B;AAChE,QAAM,CAAC,KAAK,IAAI,SAAS,MAAM,OAAO,MAAM,OAAO,CAAC;AAEpD,YAAU,MAAM;AACd,kBAAc,OAAO;AAErB,kBAAc,KAAK,EAAE,SAAS,SAAS,IAAI;AAAA,EAC7C,GAAG,CAAC,SAAS,KAAK,CAAC;AAEnB,SAAO;AACT;AAEO,IAAM,4BAAiE,CAAC;AAAA,EAC7E;AAAA,EACA;AACF,MAAM;AACJ,QAAM,uBAAuB,0BAA0B,OAAO;AAC9D,QAAM,CAAC,OAAO,IAAI,SAAS,MAAM;AAC/B,WAAO;AAAA,MACL;AAAA,IACF;AAAA,EACF,CAAC;AAED,SACE,oBAAC,kBAAkB,UAAlB,EAA2B,OAAO,SAChC,UACH;AAEJ;","names":[]}
|
@@ -1,11 +1,13 @@
|
|
1
1
|
"use client";
|
2
|
-
|
2
|
+
|
3
|
+
// src/context/providers/ContentPartRuntimeProvider.tsx
|
3
4
|
import { useEffect, useState } from "react";
|
4
5
|
import { create } from "zustand";
|
5
|
-
import { ContentPartContext } from "../react/ContentPartContext";
|
6
|
-
import { writableStore } from "../ReadonlyStore";
|
7
|
-
import { ensureBinding } from "../react/utils/ensureBinding";
|
8
|
-
|
6
|
+
import { ContentPartContext } from "../react/ContentPartContext.js";
|
7
|
+
import { writableStore } from "../ReadonlyStore.js";
|
8
|
+
import { ensureBinding } from "../react/utils/ensureBinding.js";
|
9
|
+
import { jsx } from "react/jsx-runtime";
|
10
|
+
var useContentPartRuntimeStore = (runtime) => {
|
9
11
|
const [store] = useState(() => create(() => runtime));
|
10
12
|
useEffect(() => {
|
11
13
|
ensureBinding(runtime);
|
@@ -13,7 +15,7 @@ const useContentPartRuntimeStore = (runtime) => {
|
|
13
15
|
}, [runtime, store]);
|
14
16
|
return store;
|
15
17
|
};
|
16
|
-
|
18
|
+
var ContentPartRuntimeProvider = ({ runtime, children }) => {
|
17
19
|
const useContentPartRuntime = useContentPartRuntimeStore(runtime);
|
18
20
|
const [context] = useState(() => {
|
19
21
|
return { useContentPartRuntime };
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/context/providers/ContentPartRuntimeProvider.tsx"],"sourcesContent":["\"use client\";\n\nimport { type FC, type PropsWithChildren, useEffect, useState } from \"react\";\nimport { create } from \"zustand\";\nimport { ContentPartContext } from \"../react/ContentPartContext\";\nimport type { ContentPartContextValue } from \"../react/ContentPartContext\";\nimport { writableStore } from \"../ReadonlyStore\";\nimport { ContentPartRuntime } from \"../../api/ContentPartRuntime\";\nimport { ensureBinding } from \"../react/utils/ensureBinding\";\n\nexport namespace ContentPartRuntimeProvider {\n export type Props = PropsWithChildren<{\n runtime: ContentPartRuntime;\n }>;\n}\n\nconst useContentPartRuntimeStore = (runtime: ContentPartRuntime) => {\n const [store] = useState(() => create(() => runtime));\n\n useEffect(() => {\n ensureBinding(runtime);\n\n writableStore(store).setState(runtime, true);\n }, [runtime, store]);\n\n return store;\n};\n\nexport const ContentPartRuntimeProvider: FC<\n ContentPartRuntimeProvider.Props\n> = ({ runtime, children }) => {\n const useContentPartRuntime = useContentPartRuntimeStore(runtime);\n const [context] = useState<ContentPartContextValue>(() => {\n return { useContentPartRuntime };\n });\n\n return (\n <ContentPartContext.Provider value={context}>\n {children}\n </ContentPartContext.Provider>\n );\n};\n"],"mappings":"
|
1
|
+
{"version":3,"sources":["../../../src/context/providers/ContentPartRuntimeProvider.tsx"],"sourcesContent":["\"use client\";\n\nimport { type FC, type PropsWithChildren, useEffect, useState } from \"react\";\nimport { create } from \"zustand\";\nimport { ContentPartContext } from \"../react/ContentPartContext\";\nimport type { ContentPartContextValue } from \"../react/ContentPartContext\";\nimport { writableStore } from \"../ReadonlyStore\";\nimport { ContentPartRuntime } from \"../../api/ContentPartRuntime\";\nimport { ensureBinding } from \"../react/utils/ensureBinding\";\n\nexport namespace ContentPartRuntimeProvider {\n export type Props = PropsWithChildren<{\n runtime: ContentPartRuntime;\n }>;\n}\n\nconst useContentPartRuntimeStore = (runtime: ContentPartRuntime) => {\n const [store] = useState(() => create(() => runtime));\n\n useEffect(() => {\n ensureBinding(runtime);\n\n writableStore(store).setState(runtime, true);\n }, [runtime, store]);\n\n return store;\n};\n\nexport const ContentPartRuntimeProvider: FC<\n ContentPartRuntimeProvider.Props\n> = ({ runtime, children }) => {\n const useContentPartRuntime = useContentPartRuntimeStore(runtime);\n const [context] = useState<ContentPartContextValue>(() => {\n return { useContentPartRuntime };\n });\n\n return (\n <ContentPartContext.Provider value={context}>\n {children}\n </ContentPartContext.Provider>\n );\n};\n"],"mappings":";;;AAEA,SAA0C,WAAW,gBAAgB;AACrE,SAAS,cAAc;AACvB,SAAS,0BAA0B;AAEnC,SAAS,qBAAqB;AAE9B,SAAS,qBAAqB;AA6B1B;AArBJ,IAAM,6BAA6B,CAAC,YAAgC;AAClE,QAAM,CAAC,KAAK,IAAI,SAAS,MAAM,OAAO,MAAM,OAAO,CAAC;AAEpD,YAAU,MAAM;AACd,kBAAc,OAAO;AAErB,kBAAc,KAAK,EAAE,SAAS,SAAS,IAAI;AAAA,EAC7C,GAAG,CAAC,SAAS,KAAK,CAAC;AAEnB,SAAO;AACT;AAEO,IAAM,6BAET,CAAC,EAAE,SAAS,SAAS,MAAM;AAC7B,QAAM,wBAAwB,2BAA2B,OAAO;AAChE,QAAM,CAAC,OAAO,IAAI,SAAkC,MAAM;AACxD,WAAO,EAAE,sBAAsB;AAAA,EACjC,CAAC;AAED,SACE,oBAAC,mBAAmB,UAAnB,EAA4B,OAAO,SACjC,UACH;AAEJ;","names":[]}
|
@@ -1,12 +1,14 @@
|
|
1
1
|
"use client";
|
2
|
-
|
2
|
+
|
3
|
+
// src/context/providers/MessageRuntimeProvider.tsx
|
3
4
|
import { useEffect, useState } from "react";
|
4
5
|
import { create } from "zustand";
|
5
|
-
import { MessageContext } from "../react/MessageContext";
|
6
|
-
import { makeMessageUtilsStore } from "../stores/MessageUtils";
|
7
|
-
import { writableStore } from "../ReadonlyStore";
|
8
|
-
import { ensureBinding } from "../react/utils/ensureBinding";
|
9
|
-
|
6
|
+
import { MessageContext } from "../react/MessageContext.js";
|
7
|
+
import { makeMessageUtilsStore } from "../stores/MessageUtils.js";
|
8
|
+
import { writableStore } from "../ReadonlyStore.js";
|
9
|
+
import { ensureBinding } from "../react/utils/ensureBinding.js";
|
10
|
+
import { jsx } from "react/jsx-runtime";
|
11
|
+
var useMessageRuntimeStore = (runtime) => {
|
10
12
|
const [store] = useState(() => create(() => runtime));
|
11
13
|
useEffect(() => {
|
12
14
|
ensureBinding(runtime);
|
@@ -14,11 +16,11 @@ const useMessageRuntimeStore = (runtime) => {
|
|
14
16
|
}, [runtime, store]);
|
15
17
|
return store;
|
16
18
|
};
|
17
|
-
|
19
|
+
var useMessageUtilsStore = () => {
|
18
20
|
const [store] = useState(() => makeMessageUtilsStore());
|
19
21
|
return store;
|
20
22
|
};
|
21
|
-
|
23
|
+
var MessageRuntimeProvider = ({
|
22
24
|
runtime,
|
23
25
|
children
|
24
26
|
}) => {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/context/providers/MessageRuntimeProvider.tsx"],"sourcesContent":["\"use client\";\n\nimport { type FC, type PropsWithChildren, useEffect, useState } from \"react\";\nimport { create } from \"zustand\";\nimport { MessageContext } from \"../react/MessageContext\";\nimport type { MessageContextValue } from \"../react/MessageContext\";\nimport { makeMessageUtilsStore } from \"../stores/MessageUtils\";\nimport { writableStore } from \"../ReadonlyStore\";\nimport { MessageRuntime } from \"../../api/MessageRuntime\";\nimport { ensureBinding } from \"../react/utils/ensureBinding\";\n\nexport namespace MessageRuntimeProvider {\n export type Props = PropsWithChildren<{\n runtime: MessageRuntime;\n }>;\n}\n\nconst useMessageRuntimeStore = (runtime: MessageRuntime) => {\n const [store] = useState(() => create(() => runtime));\n\n useEffect(() => {\n ensureBinding(runtime);\n\n writableStore(store).setState(runtime, true);\n }, [runtime, store]);\n\n return store;\n};\n\nconst useMessageUtilsStore = () => {\n const [store] = useState(() => makeMessageUtilsStore());\n return store;\n};\n\nexport const MessageRuntimeProvider: FC<MessageRuntimeProvider.Props> = ({\n runtime,\n children,\n}) => {\n const useMessageRuntime = useMessageRuntimeStore(runtime);\n const useMessageUtils = useMessageUtilsStore();\n const [context] = useState<MessageContextValue>(() => {\n return { useMessageRuntime, useMessageUtils };\n });\n\n return (\n <MessageContext.Provider value={context}>\n {children}\n </MessageContext.Provider>\n );\n};\n"],"mappings":"
|
1
|
+
{"version":3,"sources":["../../../src/context/providers/MessageRuntimeProvider.tsx"],"sourcesContent":["\"use client\";\n\nimport { type FC, type PropsWithChildren, useEffect, useState } from \"react\";\nimport { create } from \"zustand\";\nimport { MessageContext } from \"../react/MessageContext\";\nimport type { MessageContextValue } from \"../react/MessageContext\";\nimport { makeMessageUtilsStore } from \"../stores/MessageUtils\";\nimport { writableStore } from \"../ReadonlyStore\";\nimport { MessageRuntime } from \"../../api/MessageRuntime\";\nimport { ensureBinding } from \"../react/utils/ensureBinding\";\n\nexport namespace MessageRuntimeProvider {\n export type Props = PropsWithChildren<{\n runtime: MessageRuntime;\n }>;\n}\n\nconst useMessageRuntimeStore = (runtime: MessageRuntime) => {\n const [store] = useState(() => create(() => runtime));\n\n useEffect(() => {\n ensureBinding(runtime);\n\n writableStore(store).setState(runtime, true);\n }, [runtime, store]);\n\n return store;\n};\n\nconst useMessageUtilsStore = () => {\n const [store] = useState(() => makeMessageUtilsStore());\n return store;\n};\n\nexport const MessageRuntimeProvider: FC<MessageRuntimeProvider.Props> = ({\n runtime,\n children,\n}) => {\n const useMessageRuntime = useMessageRuntimeStore(runtime);\n const useMessageUtils = useMessageUtilsStore();\n const [context] = useState<MessageContextValue>(() => {\n return { useMessageRuntime, useMessageUtils };\n });\n\n return (\n <MessageContext.Provider value={context}>\n {children}\n </MessageContext.Provider>\n );\n};\n"],"mappings":";;;AAEA,SAA0C,WAAW,gBAAgB;AACrE,SAAS,cAAc;AACvB,SAAS,sBAAsB;AAE/B,SAAS,6BAA6B;AACtC,SAAS,qBAAqB;AAE9B,SAAS,qBAAqB;AAoC1B;AA5BJ,IAAM,yBAAyB,CAAC,YAA4B;AAC1D,QAAM,CAAC,KAAK,IAAI,SAAS,MAAM,OAAO,MAAM,OAAO,CAAC;AAEpD,YAAU,MAAM;AACd,kBAAc,OAAO;AAErB,kBAAc,KAAK,EAAE,SAAS,SAAS,IAAI;AAAA,EAC7C,GAAG,CAAC,SAAS,KAAK,CAAC;AAEnB,SAAO;AACT;AAEA,IAAM,uBAAuB,MAAM;AACjC,QAAM,CAAC,KAAK,IAAI,SAAS,MAAM,sBAAsB,CAAC;AACtD,SAAO;AACT;AAEO,IAAM,yBAA2D,CAAC;AAAA,EACvE;AAAA,EACA;AACF,MAAM;AACJ,QAAM,oBAAoB,uBAAuB,OAAO;AACxD,QAAM,kBAAkB,qBAAqB;AAC7C,QAAM,CAAC,OAAO,IAAI,SAA8B,MAAM;AACpD,WAAO,EAAE,mBAAmB,gBAAgB;AAAA,EAC9C,CAAC;AAED,SACE,oBAAC,eAAe,UAAf,EAAwB,OAAO,SAC7B,UACH;AAEJ;","names":[]}
|
@@ -1,22 +1,24 @@
|
|
1
1
|
"use client";
|
2
|
-
|
2
|
+
|
3
|
+
// src/context/providers/TextContentPartProvider.tsx
|
3
4
|
import { useEffect, useState } from "react";
|
4
5
|
import { create } from "zustand";
|
5
6
|
import {
|
6
7
|
ContentPartContext
|
7
|
-
} from "../react/ContentPartContext";
|
8
|
-
import { writableStore } from "../ReadonlyStore";
|
8
|
+
} from "../react/ContentPartContext.js";
|
9
|
+
import { writableStore } from "../ReadonlyStore.js";
|
9
10
|
import {
|
10
11
|
ContentPartRuntimeImpl
|
11
|
-
} from "../../api/ContentPartRuntime";
|
12
|
-
import { ensureBinding } from "../react/utils/ensureBinding";
|
13
|
-
|
12
|
+
} from "../../api/ContentPartRuntime.js";
|
13
|
+
import { ensureBinding } from "../react/utils/ensureBinding.js";
|
14
|
+
import { jsx } from "react/jsx-runtime";
|
15
|
+
var COMPLETE_STATUS = {
|
14
16
|
type: "complete"
|
15
17
|
};
|
16
|
-
|
18
|
+
var RUNNING_STATUS = {
|
17
19
|
type: "running"
|
18
20
|
};
|
19
|
-
|
21
|
+
var TextContentPartProvider = ({
|
20
22
|
children,
|
21
23
|
text,
|
22
24
|
isRunning
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/context/providers/TextContentPartProvider.tsx"],"sourcesContent":["\"use client\";\n\nimport { FC, PropsWithChildren, useEffect, useState } from \"react\";\nimport { create, StoreApi, UseBoundStore } from \"zustand\";\nimport {\n ContentPartContext,\n ContentPartContextValue,\n} from \"../react/ContentPartContext\";\nimport { ContentPartStatus } from \"../../types/AssistantTypes\";\nimport { writableStore } from \"../ReadonlyStore\";\nimport {\n ContentPartRuntimeImpl,\n ContentPartState,\n} from \"../../api/ContentPartRuntime\";\nimport { ensureBinding } from \"../react/utils/ensureBinding\";\n\nexport namespace TextContentPartProvider {\n export type Props = PropsWithChildren<{\n text: string;\n isRunning?: boolean | undefined;\n }>;\n}\n\nconst COMPLETE_STATUS: ContentPartStatus = {\n type: \"complete\",\n};\n\nconst RUNNING_STATUS: ContentPartStatus = {\n type: \"running\",\n};\n\nexport const TextContentPartProvider: FC<TextContentPartProvider.Props> = ({\n children,\n text,\n isRunning,\n}) => {\n const [context] = useState<\n ContentPartContextValue & {\n useContentPart: UseBoundStore<\n StoreApi<ContentPartState & { type: \"text\" }>\n >;\n }\n >(() => {\n const useContentPart = create<ContentPartState & { type: \"text\" }>(() => ({\n status: isRunning ? RUNNING_STATUS : COMPLETE_STATUS,\n type: \"text\",\n text,\n }));\n\n const contentPartRuntime = new ContentPartRuntimeImpl({\n path: {\n ref: \"text\",\n threadSelector: { type: \"main\" },\n messageSelector: { type: \"messageId\", messageId: \"\" },\n contentPartSelector: { type: \"index\", index: 0 },\n },\n getState: useContentPart.getState,\n subscribe: useContentPart.subscribe,\n });\n ensureBinding(contentPartRuntime);\n\n const useContentPartRuntime = create(() => contentPartRuntime);\n\n return { useContentPartRuntime, useContentPart };\n });\n\n useEffect(() => {\n const state = context.useContentPart.getState();\n const textUpdated = state.text !== text;\n const targetStatus = isRunning ? RUNNING_STATUS : COMPLETE_STATUS;\n const statusUpdated = state.status !== targetStatus;\n\n if (!textUpdated && !statusUpdated) return;\n\n writableStore(context.useContentPart).setState(\n {\n type: \"text\",\n text,\n status: targetStatus,\n } satisfies ContentPartState,\n true,\n );\n }, [context, isRunning, text]);\n\n return (\n <ContentPartContext.Provider value={context}>\n {children}\n </ContentPartContext.Provider>\n );\n};\n"],"mappings":"
|
1
|
+
{"version":3,"sources":["../../../src/context/providers/TextContentPartProvider.tsx"],"sourcesContent":["\"use client\";\n\nimport { FC, PropsWithChildren, useEffect, useState } from \"react\";\nimport { create, StoreApi, UseBoundStore } from \"zustand\";\nimport {\n ContentPartContext,\n ContentPartContextValue,\n} from \"../react/ContentPartContext\";\nimport { ContentPartStatus } from \"../../types/AssistantTypes\";\nimport { writableStore } from \"../ReadonlyStore\";\nimport {\n ContentPartRuntimeImpl,\n ContentPartState,\n} from \"../../api/ContentPartRuntime\";\nimport { ensureBinding } from \"../react/utils/ensureBinding\";\n\nexport namespace TextContentPartProvider {\n export type Props = PropsWithChildren<{\n text: string;\n isRunning?: boolean | undefined;\n }>;\n}\n\nconst COMPLETE_STATUS: ContentPartStatus = {\n type: \"complete\",\n};\n\nconst RUNNING_STATUS: ContentPartStatus = {\n type: \"running\",\n};\n\nexport const TextContentPartProvider: FC<TextContentPartProvider.Props> = ({\n children,\n text,\n isRunning,\n}) => {\n const [context] = useState<\n ContentPartContextValue & {\n useContentPart: UseBoundStore<\n StoreApi<ContentPartState & { type: \"text\" }>\n >;\n }\n >(() => {\n const useContentPart = create<ContentPartState & { type: \"text\" }>(() => ({\n status: isRunning ? RUNNING_STATUS : COMPLETE_STATUS,\n type: \"text\",\n text,\n }));\n\n const contentPartRuntime = new ContentPartRuntimeImpl({\n path: {\n ref: \"text\",\n threadSelector: { type: \"main\" },\n messageSelector: { type: \"messageId\", messageId: \"\" },\n contentPartSelector: { type: \"index\", index: 0 },\n },\n getState: useContentPart.getState,\n subscribe: useContentPart.subscribe,\n });\n ensureBinding(contentPartRuntime);\n\n const useContentPartRuntime = create(() => contentPartRuntime);\n\n return { useContentPartRuntime, useContentPart };\n });\n\n useEffect(() => {\n const state = context.useContentPart.getState();\n const textUpdated = state.text !== text;\n const targetStatus = isRunning ? RUNNING_STATUS : COMPLETE_STATUS;\n const statusUpdated = state.status !== targetStatus;\n\n if (!textUpdated && !statusUpdated) return;\n\n writableStore(context.useContentPart).setState(\n {\n type: \"text\",\n text,\n status: targetStatus,\n } satisfies ContentPartState,\n true,\n );\n }, [context, isRunning, text]);\n\n return (\n <ContentPartContext.Provider value={context}>\n {children}\n </ContentPartContext.Provider>\n );\n};\n"],"mappings":";;;AAEA,SAAgC,WAAW,gBAAgB;AAC3D,SAAS,cAAuC;AAChD;AAAA,EACE;AAAA,OAEK;AAEP,SAAS,qBAAqB;AAC9B;AAAA,EACE;AAAA,OAEK;AACP,SAAS,qBAAqB;AAuE1B;AA9DJ,IAAM,kBAAqC;AAAA,EACzC,MAAM;AACR;AAEA,IAAM,iBAAoC;AAAA,EACxC,MAAM;AACR;AAEO,IAAM,0BAA6D,CAAC;AAAA,EACzE;AAAA,EACA;AAAA,EACA;AACF,MAAM;AACJ,QAAM,CAAC,OAAO,IAAI,SAMhB,MAAM;AACN,UAAM,iBAAiB,OAA4C,OAAO;AAAA,MACxE,QAAQ,YAAY,iBAAiB;AAAA,MACrC,MAAM;AAAA,MACN;AAAA,IACF,EAAE;AAEF,UAAM,qBAAqB,IAAI,uBAAuB;AAAA,MACpD,MAAM;AAAA,QACJ,KAAK;AAAA,QACL,gBAAgB,EAAE,MAAM,OAAO;AAAA,QAC/B,iBAAiB,EAAE,MAAM,aAAa,WAAW,GAAG;AAAA,QACpD,qBAAqB,EAAE,MAAM,SAAS,OAAO,EAAE;AAAA,MACjD;AAAA,MACA,UAAU,eAAe;AAAA,MACzB,WAAW,eAAe;AAAA,IAC5B,CAAC;AACD,kBAAc,kBAAkB;AAEhC,UAAM,wBAAwB,OAAO,MAAM,kBAAkB;AAE7D,WAAO,EAAE,uBAAuB,eAAe;AAAA,EACjD,CAAC;AAED,YAAU,MAAM;AACd,UAAM,QAAQ,QAAQ,eAAe,SAAS;AAC9C,UAAM,cAAc,MAAM,SAAS;AACnC,UAAM,eAAe,YAAY,iBAAiB;AAClD,UAAM,gBAAgB,MAAM,WAAW;AAEvC,QAAI,CAAC,eAAe,CAAC,cAAe;AAEpC,kBAAc,QAAQ,cAAc,EAAE;AAAA,MACpC;AAAA,QACE,MAAM;AAAA,QACN;AAAA,QACA,QAAQ;AAAA,MACV;AAAA,MACA;AAAA,IACF;AAAA,EACF,GAAG,CAAC,SAAS,WAAW,IAAI,CAAC;AAE7B,SACE,oBAAC,mBAAmB,UAAnB,EAA4B,OAAO,SACjC,UACH;AAEJ;","names":[]}
|
@@ -1,13 +1,15 @@
|
|
1
1
|
"use client";
|
2
|
-
|
2
|
+
|
3
|
+
// src/context/providers/ThreadListItemRuntimeProvider.tsx
|
3
4
|
import { useEffect, useState } from "react";
|
4
5
|
import { create } from "zustand";
|
5
6
|
import {
|
6
7
|
ThreadListItemContext
|
7
|
-
} from "../react/ThreadListItemContext";
|
8
|
-
import { writableStore } from "../ReadonlyStore";
|
9
|
-
import { ensureBinding } from "../react/utils/ensureBinding";
|
10
|
-
|
8
|
+
} from "../react/ThreadListItemContext.js";
|
9
|
+
import { writableStore } from "../ReadonlyStore.js";
|
10
|
+
import { ensureBinding } from "../react/utils/ensureBinding.js";
|
11
|
+
import { jsx } from "react/jsx-runtime";
|
12
|
+
var useThreadListItemRuntimeStore = (runtime) => {
|
11
13
|
const [store] = useState(() => create(() => runtime));
|
12
14
|
useEffect(() => {
|
13
15
|
ensureBinding(runtime);
|
@@ -15,7 +17,7 @@ const useThreadListItemRuntimeStore = (runtime) => {
|
|
15
17
|
}, [runtime, store]);
|
16
18
|
return store;
|
17
19
|
};
|
18
|
-
|
20
|
+
var ThreadListItemRuntimeProvider = ({ runtime, children }) => {
|
19
21
|
const useThreadListItemRuntime = useThreadListItemRuntimeStore(runtime);
|
20
22
|
const [context] = useState(() => {
|
21
23
|
return { useThreadListItemRuntime };
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/context/providers/ThreadListItemRuntimeProvider.tsx"],"sourcesContent":["\"use client\";\n\nimport { type FC, type PropsWithChildren, useEffect, useState } from \"react\";\nimport { create } from \"zustand\";\nimport {\n ThreadListItemContext,\n type ThreadListItemContextValue,\n} from \"../react/ThreadListItemContext\";\nimport { writableStore } from \"../ReadonlyStore\";\nimport { ThreadListItemRuntime } from \"../../api/ThreadListItemRuntime\";\nimport { ensureBinding } from \"../react/utils/ensureBinding\";\n\nexport namespace ThreadListItemRuntimeProvider {\n export type Props = PropsWithChildren<{\n runtime: ThreadListItemRuntime;\n }>;\n}\n\nconst useThreadListItemRuntimeStore = (runtime: ThreadListItemRuntime) => {\n const [store] = useState(() => create(() => runtime));\n\n useEffect(() => {\n ensureBinding(runtime);\n writableStore(store).setState(runtime, true);\n }, [runtime, store]);\n\n return store;\n};\n\nexport const ThreadListItemRuntimeProvider: FC<\n ThreadListItemRuntimeProvider.Props\n> = ({ runtime, children }) => {\n const useThreadListItemRuntime = useThreadListItemRuntimeStore(runtime);\n const [context] = useState<ThreadListItemContextValue>(() => {\n return { useThreadListItemRuntime };\n });\n\n return (\n <ThreadListItemContext.Provider value={context}>\n {children}\n </ThreadListItemContext.Provider>\n );\n};\n"],"mappings":"
|
1
|
+
{"version":3,"sources":["../../../src/context/providers/ThreadListItemRuntimeProvider.tsx"],"sourcesContent":["\"use client\";\n\nimport { type FC, type PropsWithChildren, useEffect, useState } from \"react\";\nimport { create } from \"zustand\";\nimport {\n ThreadListItemContext,\n type ThreadListItemContextValue,\n} from \"../react/ThreadListItemContext\";\nimport { writableStore } from \"../ReadonlyStore\";\nimport { ThreadListItemRuntime } from \"../../api/ThreadListItemRuntime\";\nimport { ensureBinding } from \"../react/utils/ensureBinding\";\n\nexport namespace ThreadListItemRuntimeProvider {\n export type Props = PropsWithChildren<{\n runtime: ThreadListItemRuntime;\n }>;\n}\n\nconst useThreadListItemRuntimeStore = (runtime: ThreadListItemRuntime) => {\n const [store] = useState(() => create(() => runtime));\n\n useEffect(() => {\n ensureBinding(runtime);\n writableStore(store).setState(runtime, true);\n }, [runtime, store]);\n\n return store;\n};\n\nexport const ThreadListItemRuntimeProvider: FC<\n ThreadListItemRuntimeProvider.Props\n> = ({ runtime, children }) => {\n const useThreadListItemRuntime = useThreadListItemRuntimeStore(runtime);\n const [context] = useState<ThreadListItemContextValue>(() => {\n return { useThreadListItemRuntime };\n });\n\n return (\n <ThreadListItemContext.Provider value={context}>\n {children}\n </ThreadListItemContext.Provider>\n );\n};\n"],"mappings":";;;AAEA,SAA0C,WAAW,gBAAgB;AACrE,SAAS,cAAc;AACvB;AAAA,EACE;AAAA,OAEK;AACP,SAAS,qBAAqB;AAE9B,SAAS,qBAAqB;AA4B1B;AApBJ,IAAM,gCAAgC,CAAC,YAAmC;AACxE,QAAM,CAAC,KAAK,IAAI,SAAS,MAAM,OAAO,MAAM,OAAO,CAAC;AAEpD,YAAU,MAAM;AACd,kBAAc,OAAO;AACrB,kBAAc,KAAK,EAAE,SAAS,SAAS,IAAI;AAAA,EAC7C,GAAG,CAAC,SAAS,KAAK,CAAC;AAEnB,SAAO;AACT;AAEO,IAAM,gCAET,CAAC,EAAE,SAAS,SAAS,MAAM;AAC7B,QAAM,2BAA2B,8BAA8B,OAAO;AACtE,QAAM,CAAC,OAAO,IAAI,SAAqC,MAAM;AAC3D,WAAO,EAAE,yBAAyB;AAAA,EACpC,CAAC;AAED,SACE,oBAAC,sBAAsB,UAAtB,EAA+B,OAAO,SACpC,UACH;AAEJ;","names":[]}
|
@@ -1,13 +1,15 @@
|
|
1
1
|
"use client";
|
2
|
-
|
2
|
+
|
3
|
+
// src/context/providers/ThreadRuntimeProvider.tsx
|
3
4
|
import { useEffect, useState } from "react";
|
4
|
-
import { ThreadContext } from "../react/ThreadContext";
|
5
|
-
import { writableStore } from "../ReadonlyStore";
|
5
|
+
import { ThreadContext } from "../react/ThreadContext.js";
|
6
|
+
import { writableStore } from "../ReadonlyStore.js";
|
6
7
|
import { create } from "zustand";
|
7
|
-
import { ThreadListItemRuntimeProvider } from "./ThreadListItemRuntimeProvider";
|
8
|
-
import { ensureBinding } from "../react/utils/ensureBinding";
|
9
|
-
import { ThreadViewportProvider } from "./ThreadViewportProvider";
|
10
|
-
|
8
|
+
import { ThreadListItemRuntimeProvider } from "./ThreadListItemRuntimeProvider.js";
|
9
|
+
import { ensureBinding } from "../react/utils/ensureBinding.js";
|
10
|
+
import { ThreadViewportProvider } from "./ThreadViewportProvider.js";
|
11
|
+
import { jsx } from "react/jsx-runtime";
|
12
|
+
var useThreadRuntimeStore = (runtime) => {
|
11
13
|
const [store] = useState(() => create(() => runtime));
|
12
14
|
useEffect(() => {
|
13
15
|
ensureBinding(runtime);
|
@@ -16,7 +18,7 @@ const useThreadRuntimeStore = (runtime) => {
|
|
16
18
|
}, [runtime, store]);
|
17
19
|
return store;
|
18
20
|
};
|
19
|
-
|
21
|
+
var ThreadRuntimeProvider = ({ children, listItemRuntime: threadListItemRuntime, runtime }) => {
|
20
22
|
const useThreadRuntime = useThreadRuntimeStore(runtime);
|
21
23
|
const [context] = useState(() => {
|
22
24
|
return {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/context/providers/ThreadRuntimeProvider.tsx"],"sourcesContent":["\"use client\";\n\nimport type { FC, PropsWithChildren } from \"react\";\nimport { useEffect, useState } from \"react\";\nimport type { ThreadContextValue } from \"../react/ThreadContext\";\nimport { ThreadContext } from \"../react/ThreadContext\";\nimport { writableStore } from \"../ReadonlyStore\";\nimport { ThreadRuntime } from \"../../api/ThreadRuntime\";\nimport { create } from \"zustand\";\nimport { ThreadListItemRuntime } from \"../../api/ThreadListItemRuntime\";\nimport { ThreadListItemRuntimeProvider } from \"./ThreadListItemRuntimeProvider\";\nimport { ensureBinding } from \"../react/utils/ensureBinding\";\nimport { ThreadViewportProvider } from \"./ThreadViewportProvider\";\n\ntype ThreadProviderProps = {\n listItemRuntime: ThreadListItemRuntime;\n runtime: ThreadRuntime;\n};\n\nconst useThreadRuntimeStore = (runtime: ThreadRuntime) => {\n const [store] = useState(() => create(() => runtime));\n\n useEffect(() => {\n ensureBinding(runtime);\n ensureBinding(runtime.composer);\n\n writableStore(store).setState(runtime, true);\n }, [runtime, store]);\n\n return store;\n};\n\nexport const ThreadRuntimeProvider: FC<\n PropsWithChildren<ThreadProviderProps>\n> = ({ children, listItemRuntime: threadListItemRuntime, runtime }) => {\n const useThreadRuntime = useThreadRuntimeStore(runtime);\n\n const [context] = useState<ThreadContextValue>(() => {\n return {\n useThreadRuntime,\n };\n });\n\n return (\n <ThreadListItemRuntimeProvider runtime={threadListItemRuntime}>\n <ThreadContext.Provider value={context}>\n {/* TODO temporarily allow accessing viewport state from outside the viewport */}\n {/* TODO figure out if this behavior should be deprecated, since it is quite hacky */}\n <ThreadViewportProvider>{children}</ThreadViewportProvider>\n </ThreadContext.Provider>\n </ThreadListItemRuntimeProvider>\n );\n};\n"],"mappings":"
|
1
|
+
{"version":3,"sources":["../../../src/context/providers/ThreadRuntimeProvider.tsx"],"sourcesContent":["\"use client\";\n\nimport type { FC, PropsWithChildren } from \"react\";\nimport { useEffect, useState } from \"react\";\nimport type { ThreadContextValue } from \"../react/ThreadContext\";\nimport { ThreadContext } from \"../react/ThreadContext\";\nimport { writableStore } from \"../ReadonlyStore\";\nimport { ThreadRuntime } from \"../../api/ThreadRuntime\";\nimport { create } from \"zustand\";\nimport { ThreadListItemRuntime } from \"../../api/ThreadListItemRuntime\";\nimport { ThreadListItemRuntimeProvider } from \"./ThreadListItemRuntimeProvider\";\nimport { ensureBinding } from \"../react/utils/ensureBinding\";\nimport { ThreadViewportProvider } from \"./ThreadViewportProvider\";\n\ntype ThreadProviderProps = {\n listItemRuntime: ThreadListItemRuntime;\n runtime: ThreadRuntime;\n};\n\nconst useThreadRuntimeStore = (runtime: ThreadRuntime) => {\n const [store] = useState(() => create(() => runtime));\n\n useEffect(() => {\n ensureBinding(runtime);\n ensureBinding(runtime.composer);\n\n writableStore(store).setState(runtime, true);\n }, [runtime, store]);\n\n return store;\n};\n\nexport const ThreadRuntimeProvider: FC<\n PropsWithChildren<ThreadProviderProps>\n> = ({ children, listItemRuntime: threadListItemRuntime, runtime }) => {\n const useThreadRuntime = useThreadRuntimeStore(runtime);\n\n const [context] = useState<ThreadContextValue>(() => {\n return {\n useThreadRuntime,\n };\n });\n\n return (\n <ThreadListItemRuntimeProvider runtime={threadListItemRuntime}>\n <ThreadContext.Provider value={context}>\n {/* TODO temporarily allow accessing viewport state from outside the viewport */}\n {/* TODO figure out if this behavior should be deprecated, since it is quite hacky */}\n <ThreadViewportProvider>{children}</ThreadViewportProvider>\n </ThreadContext.Provider>\n </ThreadListItemRuntimeProvider>\n );\n};\n"],"mappings":";;;AAGA,SAAS,WAAW,gBAAgB;AAEpC,SAAS,qBAAqB;AAC9B,SAAS,qBAAqB;AAE9B,SAAS,cAAc;AAEvB,SAAS,qCAAqC;AAC9C,SAAS,qBAAqB;AAC9B,SAAS,8BAA8B;AAoC/B;AA7BR,IAAM,wBAAwB,CAAC,YAA2B;AACxD,QAAM,CAAC,KAAK,IAAI,SAAS,MAAM,OAAO,MAAM,OAAO,CAAC;AAEpD,YAAU,MAAM;AACd,kBAAc,OAAO;AACrB,kBAAc,QAAQ,QAAQ;AAE9B,kBAAc,KAAK,EAAE,SAAS,SAAS,IAAI;AAAA,EAC7C,GAAG,CAAC,SAAS,KAAK,CAAC;AAEnB,SAAO;AACT;AAEO,IAAM,wBAET,CAAC,EAAE,UAAU,iBAAiB,uBAAuB,QAAQ,MAAM;AACrE,QAAM,mBAAmB,sBAAsB,OAAO;AAEtD,QAAM,CAAC,OAAO,IAAI,SAA6B,MAAM;AACnD,WAAO;AAAA,MACL;AAAA,IACF;AAAA,EACF,CAAC;AAED,SACE,oBAAC,iCAA8B,SAAS,uBACtC,8BAAC,cAAc,UAAd,EAAuB,OAAO,SAG7B,8BAAC,0BAAwB,UAAS,GACpC,GACF;AAEJ;","names":[]}
|
@@ -1,13 +1,15 @@
|
|
1
1
|
"use client";
|
2
|
-
|
2
|
+
|
3
|
+
// src/context/providers/ThreadViewportProvider.tsx
|
3
4
|
import { useEffect, useState } from "react";
|
4
|
-
import { makeThreadViewportStore } from "../stores/ThreadViewport";
|
5
|
+
import { makeThreadViewportStore } from "../stores/ThreadViewport.js";
|
5
6
|
import {
|
6
7
|
ThreadViewportContext,
|
7
8
|
useThreadViewportStore
|
8
|
-
} from "../react/ThreadViewportContext";
|
9
|
-
import { writableStore } from "../ReadonlyStore";
|
10
|
-
|
9
|
+
} from "../react/ThreadViewportContext.js";
|
10
|
+
import { writableStore } from "../ReadonlyStore.js";
|
11
|
+
import { jsx } from "react/jsx-runtime";
|
12
|
+
var useThreadViewportStoreValue = () => {
|
11
13
|
const outerViewport = useThreadViewportStore({ optional: true });
|
12
14
|
const [store] = useState(() => makeThreadViewportStore());
|
13
15
|
useEffect(() => {
|
@@ -25,7 +27,7 @@ const useThreadViewportStoreValue = () => {
|
|
25
27
|
}, [store, outerViewport]);
|
26
28
|
return store;
|
27
29
|
};
|
28
|
-
|
30
|
+
var ThreadViewportProvider = ({ children }) => {
|
29
31
|
const useThreadViewport = useThreadViewportStoreValue();
|
30
32
|
const [context] = useState(() => {
|
31
33
|
return {
|