@assistant-ui/react 0.7.8 → 0.7.10
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/api/AssistantRuntime.d.ts +4 -5
- package/dist/api/AssistantRuntime.d.ts.map +1 -1
- package/dist/api/AssistantRuntime.js +19 -22
- package/dist/api/AssistantRuntime.js.map +1 -1
- package/dist/api/AssistantRuntime.mjs +16 -19
- package/dist/api/AssistantRuntime.mjs.map +1 -1
- package/dist/api/ComposerRuntime.d.ts.map +1 -1
- package/dist/api/ComposerRuntime.js +4 -4
- package/dist/api/MessageRuntime.js +7 -7
- package/dist/api/ThreadListItemRuntime.d.ts +11 -2
- package/dist/api/ThreadListItemRuntime.d.ts.map +1 -1
- package/dist/api/ThreadListItemRuntime.js +16 -5
- package/dist/api/ThreadListItemRuntime.js.map +1 -1
- package/dist/api/ThreadListItemRuntime.mjs +16 -5
- package/dist/api/ThreadListItemRuntime.mjs.map +1 -1
- package/dist/api/ThreadListRuntime.d.ts +3 -0
- package/dist/api/ThreadListRuntime.d.ts.map +1 -1
- package/dist/api/ThreadListRuntime.js +31 -12
- package/dist/api/ThreadListRuntime.js.map +1 -1
- package/dist/api/ThreadListRuntime.mjs +27 -8
- package/dist/api/ThreadListRuntime.mjs.map +1 -1
- package/dist/api/ThreadRuntime.d.ts +10 -7
- package/dist/api/ThreadRuntime.d.ts.map +1 -1
- package/dist/api/ThreadRuntime.js +22 -12
- package/dist/api/ThreadRuntime.js.map +1 -1
- package/dist/api/ThreadRuntime.mjs +16 -6
- package/dist/api/ThreadRuntime.mjs.map +1 -1
- package/dist/api/subscribable/LazyMemoizeSubject.js +2 -2
- package/dist/api/subscribable/NestedSubscriptionSubject.js +1 -1
- package/dist/api/subscribable/ShallowMemoizeSubject.js +3 -3
- package/dist/context/index.js +6 -6
- package/dist/context/index.js.map +1 -1
- package/dist/context/providers/AssistantRuntimeProvider.d.ts.map +1 -1
- package/dist/context/providers/AssistantRuntimeProvider.js +12 -5
- package/dist/context/providers/AssistantRuntimeProvider.js.map +1 -1
- package/dist/context/providers/AssistantRuntimeProvider.mjs +8 -1
- package/dist/context/providers/AssistantRuntimeProvider.mjs.map +1 -1
- package/dist/context/providers/AttachmentRuntimeProvider.js +2 -2
- package/dist/context/providers/ContentPartRuntimeProvider.js +2 -2
- package/dist/context/providers/MessageRuntimeProvider.js +3 -3
- package/dist/context/providers/TextContentPartProvider.js +3 -3
- package/dist/context/providers/ThreadListItemRuntimeProvider.js +2 -2
- package/dist/context/providers/ThreadRuntimeProvider.d.ts +2 -0
- package/dist/context/providers/ThreadRuntimeProvider.d.ts.map +1 -1
- package/dist/context/providers/ThreadRuntimeProvider.js +6 -5
- package/dist/context/providers/ThreadRuntimeProvider.js.map +1 -1
- package/dist/context/providers/ThreadRuntimeProvider.mjs +3 -2
- package/dist/context/providers/ThreadRuntimeProvider.mjs.map +1 -1
- package/dist/context/providers/index.js +2 -2
- package/dist/context/react/AssistantContext.js +2 -2
- package/dist/context/react/AttachmentContext.js +1 -1
- package/dist/context/react/ComposerContext.js +3 -3
- package/dist/context/react/ContentPartContext.js +2 -2
- package/dist/context/react/MessageContext.js +2 -2
- package/dist/context/react/ThreadContext.js +2 -2
- package/dist/context/react/ThreadListItemContext.js +2 -2
- package/dist/context/react/index.js +6 -6
- package/dist/context/react/utils/createContextStoreHook.d.ts.map +1 -1
- package/dist/edge.js +1 -1
- package/dist/index.js +17 -17
- package/dist/index.js.map +1 -1
- package/dist/internal.d.ts +1 -2
- package/dist/internal.d.ts.map +1 -1
- package/dist/internal.js +10 -13
- package/dist/internal.js.map +1 -1
- package/dist/internal.mjs +0 -2
- package/dist/internal.mjs.map +1 -1
- package/dist/model-config/index.js +6 -6
- package/dist/model-config/makeAssistantTool.js +1 -1
- package/dist/model-config/makeAssistantToolUI.js +1 -1
- package/dist/model-config/useAssistantInstructions.js +1 -1
- package/dist/model-config/useAssistantTool.js +1 -1
- package/dist/model-config/useAssistantToolUI.js +1 -1
- package/dist/primitive-hooks/actionBar/useActionBarCopy.js +2 -2
- package/dist/primitive-hooks/actionBar/useActionBarEdit.js +1 -1
- package/dist/primitive-hooks/actionBar/useActionBarFeedbackNegative.js +1 -1
- package/dist/primitive-hooks/actionBar/useActionBarFeedbackPositive.js +1 -1
- package/dist/primitive-hooks/actionBar/useActionBarReload.js +3 -3
- package/dist/primitive-hooks/actionBar/useActionBarSpeak.js +1 -1
- package/dist/primitive-hooks/actionBar/useActionBarStopSpeaking.js +1 -1
- package/dist/primitive-hooks/attachment/useAttachmentRemove.js +1 -1
- package/dist/primitive-hooks/branchPicker/useBranchPickerCount.js +1 -1
- package/dist/primitive-hooks/branchPicker/useBranchPickerNext.js +1 -1
- package/dist/primitive-hooks/branchPicker/useBranchPickerNumber.js +1 -1
- package/dist/primitive-hooks/branchPicker/useBranchPickerPrevious.js +1 -1
- package/dist/primitive-hooks/composer/useComposerAddAttachment.js +1 -1
- package/dist/primitive-hooks/composer/useComposerCancel.js +1 -1
- package/dist/primitive-hooks/composer/useComposerIf.js +1 -1
- package/dist/primitive-hooks/composer/useComposerSend.js +3 -3
- package/dist/primitive-hooks/contentPart/index.js +3 -3
- package/dist/primitive-hooks/contentPart/useContentPartDisplay.js +1 -1
- package/dist/primitive-hooks/contentPart/useContentPartImage.js +1 -1
- package/dist/primitive-hooks/contentPart/useContentPartText.js +1 -1
- package/dist/primitive-hooks/index.js +2 -2
- package/dist/primitive-hooks/index.js.map +1 -1
- package/dist/primitive-hooks/message/useMessageIf.js +2 -2
- package/dist/primitive-hooks/thread/useThreadEmpty.js +1 -1
- package/dist/primitive-hooks/thread/useThreadIf.js +1 -1
- package/dist/primitive-hooks/thread/useThreadScrollToBottom.js +2 -2
- package/dist/primitive-hooks/thread/useThreadSuggestion.js +2 -2
- package/dist/primitive-hooks/thread/useThreadViewportAutoScroll.js +5 -5
- package/dist/primitives/actionBar/ActionBarCopy.js +2 -2
- package/dist/primitives/actionBar/ActionBarEdit.js +2 -2
- package/dist/primitives/actionBar/ActionBarFeedbackNegative.js +2 -2
- package/dist/primitives/actionBar/ActionBarFeedbackPositive.js +2 -2
- package/dist/primitives/actionBar/ActionBarReload.js +2 -2
- package/dist/primitives/actionBar/ActionBarRoot.js +1 -1
- package/dist/primitives/actionBar/ActionBarSpeak.js +2 -2
- package/dist/primitives/actionBar/ActionBarStopSpeaking.js +1 -1
- package/dist/primitives/actionBar/index.js +8 -8
- package/dist/primitives/actionBar/useActionBarFloatStatus.js +3 -3
- package/dist/primitives/assistantModal/AssistantModalAnchor.js +1 -1
- package/dist/primitives/assistantModal/AssistantModalContent.js +1 -1
- package/dist/primitives/assistantModal/AssistantModalRoot.js +2 -2
- package/dist/primitives/assistantModal/AssistantModalTrigger.js +1 -1
- package/dist/primitives/assistantModal/index.js +4 -4
- package/dist/primitives/attachment/AttachmentName.js +1 -1
- package/dist/primitives/attachment/AttachmentRemove.js +2 -2
- package/dist/primitives/attachment/AttachmentThumb.js +1 -1
- package/dist/primitives/attachment/index.js +4 -4
- package/dist/primitives/branchPicker/BranchPickerCount.js +1 -1
- package/dist/primitives/branchPicker/BranchPickerNext.js +2 -2
- package/dist/primitives/branchPicker/BranchPickerNumber.js +1 -1
- package/dist/primitives/branchPicker/BranchPickerPrevious.js +2 -2
- package/dist/primitives/branchPicker/BranchPickerRoot.js +1 -1
- package/dist/primitives/branchPicker/index.js +5 -5
- package/dist/primitives/composer/ComposerAddAttachment.js +2 -2
- package/dist/primitives/composer/ComposerAttachments.js +3 -3
- package/dist/primitives/composer/ComposerCancel.js +2 -2
- package/dist/primitives/composer/ComposerIf.js +1 -1
- package/dist/primitives/composer/ComposerInput.d.ts.map +1 -1
- package/dist/primitives/composer/ComposerInput.js +6 -4
- package/dist/primitives/composer/ComposerInput.js.map +1 -1
- package/dist/primitives/composer/ComposerInput.mjs +3 -1
- package/dist/primitives/composer/ComposerInput.mjs.map +1 -1
- package/dist/primitives/composer/ComposerRoot.js +1 -1
- package/dist/primitives/composer/ComposerSend.js +2 -2
- package/dist/primitives/composer/index.js +7 -7
- package/dist/primitives/contentPart/ContentPartDisplay.js +1 -1
- package/dist/primitives/contentPart/ContentPartImage.js +1 -1
- package/dist/primitives/contentPart/ContentPartInProgress.js +1 -1
- package/dist/primitives/contentPart/ContentPartText.js +2 -2
- package/dist/primitives/contentPart/index.js +4 -4
- package/dist/primitives/index.js +10 -10
- package/dist/primitives/message/MessageAttachments.js +3 -3
- package/dist/primitives/message/MessageContent.js +8 -8
- package/dist/primitives/message/MessageIf.js +1 -1
- package/dist/primitives/message/MessageRoot.js +2 -2
- package/dist/primitives/message/index.js +4 -4
- package/dist/primitives/thread/ThreadEmpty.js +1 -1
- package/dist/primitives/thread/ThreadIf.js +1 -1
- package/dist/primitives/thread/ThreadMessages.js +3 -3
- package/dist/primitives/thread/ThreadScrollToBottom.js +2 -2
- package/dist/primitives/thread/ThreadSuggestion.js +2 -2
- package/dist/primitives/thread/ThreadViewport.js +1 -1
- package/dist/primitives/thread/index.js +7 -7
- package/dist/primitives/threadList/ThreadListItems.js +2 -2
- package/dist/primitives/threadList/ThreadListNew.js +2 -2
- package/dist/primitives/threadList/ThreadListNew.js.map +1 -1
- package/dist/primitives/threadList/ThreadListNew.mjs +1 -1
- package/dist/primitives/threadList/ThreadListNew.mjs.map +1 -1
- package/dist/primitives/threadList/index.js +2 -2
- package/dist/primitives/threadListItem/ThreadListItemArchive.js +2 -2
- package/dist/primitives/threadListItem/ThreadListItemDelete.js +2 -2
- package/dist/primitives/threadListItem/ThreadListItemRoot.js +2 -2
- package/dist/primitives/threadListItem/ThreadListItemRoot.js.map +1 -1
- package/dist/primitives/threadListItem/ThreadListItemRoot.mjs +1 -1
- package/dist/primitives/threadListItem/ThreadListItemRoot.mjs.map +1 -1
- package/dist/primitives/threadListItem/ThreadListItemTitle.js +1 -1
- package/dist/primitives/threadListItem/ThreadListItemTrigger.js +2 -2
- package/dist/primitives/threadListItem/ThreadListItemUnarchive.js +2 -2
- package/dist/primitives/threadListItem/index.js +6 -6
- package/dist/runtimes/attachment/index.js +3 -3
- package/dist/runtimes/composer/DefaultEditComposerRuntimeCore.js +2 -2
- package/dist/runtimes/composer/DefaultThreadComposerRuntimeCore.js +1 -1
- package/dist/runtimes/core/BaseAssistantRuntimeCore.js +1 -1
- package/dist/runtimes/core/BaseThreadRuntimeCore.d.ts +2 -4
- package/dist/runtimes/core/BaseThreadRuntimeCore.d.ts.map +1 -1
- package/dist/runtimes/core/BaseThreadRuntimeCore.js +5 -9
- package/dist/runtimes/core/BaseThreadRuntimeCore.js.map +1 -1
- package/dist/runtimes/core/BaseThreadRuntimeCore.mjs +1 -5
- package/dist/runtimes/core/BaseThreadRuntimeCore.mjs.map +1 -1
- package/dist/runtimes/core/ThreadListRuntimeCore.d.ts +14 -6
- package/dist/runtimes/core/ThreadListRuntimeCore.d.ts.map +1 -1
- package/dist/runtimes/core/ThreadListRuntimeCore.js.map +1 -1
- package/dist/runtimes/core/ThreadRuntimeCore.d.ts +1 -15
- package/dist/runtimes/core/ThreadRuntimeCore.d.ts.map +1 -1
- package/dist/runtimes/core/ThreadRuntimeCore.js.map +1 -1
- package/dist/runtimes/core/index.d.ts +1 -1
- package/dist/runtimes/core/index.d.ts.map +1 -1
- package/dist/runtimes/core/index.js.map +1 -1
- package/dist/runtimes/dangerous-in-browser/DangerousInBrowserAdapter.js +6 -6
- package/dist/runtimes/dangerous-in-browser/index.js +1 -1
- package/dist/runtimes/dangerous-in-browser/useDangerousInBrowserRuntime.js +3 -3
- package/dist/runtimes/edge/EdgeChatAdapter.js +7 -7
- package/dist/runtimes/edge/EdgeRuntimeRequestOptions.js +1 -1
- package/dist/runtimes/edge/converters/fromCoreMessage.js +1 -1
- package/dist/runtimes/edge/converters/index.js +6 -6
- package/dist/runtimes/edge/createEdgeRuntimeAPI.js +9 -9
- package/dist/runtimes/edge/index.js +6 -6
- package/dist/runtimes/edge/index.js.map +1 -1
- package/dist/runtimes/edge/partial-json/parse-partial-json.js +1 -1
- package/dist/runtimes/edge/streams/assistantDecoderStream.js +1 -1
- package/dist/runtimes/edge/streams/assistantEncoderStream.js +1 -1
- package/dist/runtimes/edge/streams/runResultStream.js +1 -1
- package/dist/runtimes/edge/streams/utils/index.js +2 -2
- package/dist/runtimes/edge/streams/utils/streamPartDecoderStream.js +2 -2
- package/dist/runtimes/edge/streams/utils/streamPartEncoderStream.d.ts +1 -1
- package/dist/runtimes/edge/streams/utils/streamPartEncoderStream.d.ts.map +1 -1
- package/dist/runtimes/edge/streams/utils/streamPartEncoderStream.js +1 -1
- package/dist/runtimes/edge/useEdgeRuntime.js +3 -3
- package/dist/runtimes/external-store/ExternalStoreAdapter.d.ts +20 -3
- package/dist/runtimes/external-store/ExternalStoreAdapter.d.ts.map +1 -1
- package/dist/runtimes/external-store/ExternalStoreAdapter.js.map +1 -1
- package/dist/runtimes/external-store/ExternalStoreRuntimeCore.d.ts +0 -1
- package/dist/runtimes/external-store/ExternalStoreRuntimeCore.d.ts.map +1 -1
- package/dist/runtimes/external-store/ExternalStoreRuntimeCore.js +6 -13
- package/dist/runtimes/external-store/ExternalStoreRuntimeCore.js.map +1 -1
- package/dist/runtimes/external-store/ExternalStoreRuntimeCore.mjs +3 -10
- package/dist/runtimes/external-store/ExternalStoreRuntimeCore.mjs.map +1 -1
- package/dist/runtimes/external-store/ExternalStoreThreadListRuntimeCore.d.ts +9 -11
- package/dist/runtimes/external-store/ExternalStoreThreadListRuntimeCore.d.ts.map +1 -1
- package/dist/runtimes/external-store/ExternalStoreThreadListRuntimeCore.js +19 -27
- package/dist/runtimes/external-store/ExternalStoreThreadListRuntimeCore.js.map +1 -1
- package/dist/runtimes/external-store/ExternalStoreThreadListRuntimeCore.mjs +19 -27
- package/dist/runtimes/external-store/ExternalStoreThreadListRuntimeCore.mjs.map +1 -1
- package/dist/runtimes/external-store/ExternalStoreThreadRuntimeCore.d.ts +2 -2
- package/dist/runtimes/external-store/ExternalStoreThreadRuntimeCore.d.ts.map +1 -1
- package/dist/runtimes/external-store/ExternalStoreThreadRuntimeCore.js +10 -13
- package/dist/runtimes/external-store/ExternalStoreThreadRuntimeCore.js.map +1 -1
- package/dist/runtimes/external-store/ExternalStoreThreadRuntimeCore.mjs +4 -7
- package/dist/runtimes/external-store/ExternalStoreThreadRuntimeCore.mjs.map +1 -1
- package/dist/runtimes/external-store/external-message-converter.js +4 -4
- package/dist/runtimes/external-store/index.js +3 -3
- package/dist/runtimes/external-store/useExternalStoreRuntime.js +3 -3
- package/dist/runtimes/index.js +16 -16
- package/dist/runtimes/index.js.map +1 -1
- package/dist/runtimes/local/LocalRuntimeCore.d.ts +0 -1
- package/dist/runtimes/local/LocalRuntimeCore.d.ts.map +1 -1
- package/dist/runtimes/local/LocalRuntimeCore.js +7 -16
- package/dist/runtimes/local/LocalRuntimeCore.js.map +1 -1
- package/dist/runtimes/local/LocalRuntimeCore.mjs +3 -12
- package/dist/runtimes/local/LocalRuntimeCore.mjs.map +1 -1
- package/dist/runtimes/local/LocalThreadListRuntimeCore.d.ts +17 -15
- package/dist/runtimes/local/LocalThreadListRuntimeCore.d.ts.map +1 -1
- package/dist/runtimes/local/LocalThreadListRuntimeCore.js +95 -93
- package/dist/runtimes/local/LocalThreadListRuntimeCore.js.map +1 -1
- package/dist/runtimes/local/LocalThreadListRuntimeCore.mjs +94 -92
- package/dist/runtimes/local/LocalThreadListRuntimeCore.mjs.map +1 -1
- package/dist/runtimes/local/LocalThreadRuntimeCore.d.ts +4 -3
- package/dist/runtimes/local/LocalThreadRuntimeCore.d.ts.map +1 -1
- package/dist/runtimes/local/LocalThreadRuntimeCore.js +15 -14
- package/dist/runtimes/local/LocalThreadRuntimeCore.js.map +1 -1
- package/dist/runtimes/local/LocalThreadRuntimeCore.mjs +11 -10
- package/dist/runtimes/local/LocalThreadRuntimeCore.mjs.map +1 -1
- package/dist/runtimes/local/index.js +1 -1
- package/dist/runtimes/local/useLocalRuntime.d.ts.map +1 -1
- package/dist/runtimes/local/useLocalRuntime.js +7 -10
- package/dist/runtimes/local/useLocalRuntime.js.map +1 -1
- package/dist/runtimes/local/useLocalRuntime.mjs +4 -7
- package/dist/runtimes/local/useLocalRuntime.mjs.map +1 -1
- package/dist/runtimes/speech/index.js +1 -1
- package/dist/runtimes/utils/MessageRepository.js +2 -2
- package/dist/styles/index.css +12 -0
- package/dist/styles/index.css.map +1 -1
- package/dist/styles/tailwindcss/thread.css +1 -1
- package/dist/styles/tailwindcss/thread.css.json +1 -1
- package/dist/ui/assistant-action-bar.js +5 -5
- package/dist/ui/assistant-message.js +7 -7
- package/dist/ui/assistant-modal.js +5 -5
- package/dist/ui/attachment-ui.js +7 -7
- package/dist/ui/base/avatar.js +1 -1
- package/dist/ui/base/index.js +5 -5
- package/dist/ui/base/tooltip-icon-button.js +2 -2
- package/dist/ui/base/tooltip.js +1 -1
- package/dist/ui/branch-picker.js +5 -5
- package/dist/ui/composer.js +7 -7
- package/dist/ui/content-part.js +2 -2
- package/dist/ui/edit-composer.js +4 -4
- package/dist/ui/index.d.ts +4 -4
- package/dist/ui/index.d.ts.map +1 -1
- package/dist/ui/index.js +15 -15
- package/dist/ui/index.js.map +1 -1
- package/dist/ui/index.mjs +18 -18
- package/dist/ui/index.mjs.map +1 -1
- package/dist/ui/thread-config.d.ts +1 -1
- package/dist/ui/thread-config.d.ts.map +1 -1
- package/dist/ui/thread-config.js +2 -2
- package/dist/ui/thread-config.js.map +1 -1
- package/dist/ui/thread-config.mjs.map +1 -1
- package/dist/ui/thread-list-item.d.ts +2 -11
- package/dist/ui/thread-list-item.d.ts.map +1 -1
- package/dist/ui/thread-list-item.js +20 -33
- package/dist/ui/thread-list-item.js.map +1 -1
- package/dist/ui/thread-list-item.mjs +16 -29
- package/dist/ui/thread-list-item.mjs.map +1 -1
- package/dist/ui/thread-list.d.ts +10 -3
- package/dist/ui/thread-list.d.ts.map +1 -1
- package/dist/ui/thread-list.js +8 -9
- package/dist/ui/thread-list.js.map +1 -1
- package/dist/ui/thread-list.mjs +3 -4
- package/dist/ui/thread-list.mjs.map +1 -1
- package/dist/ui/thread-welcome.js +5 -5
- package/dist/ui/thread.js +10 -10
- package/dist/ui/user-action-bar.js +5 -5
- package/dist/ui/user-message.js +6 -6
- package/dist/utils/ProxyConfigProvider.js +1 -1
- package/dist/utils/combined/createCombinedStore.d.ts.map +1 -1
- package/dist/utils/combined/useCombinedStore.d.ts.map +1 -1
- package/dist/utils/combined/useCombinedStore.js +1 -1
- package/dist/utils/hooks/useOnResizeContent.js +1 -1
- package/dist/utils/hooks/useOnScrollToBottom.js +1 -1
- package/dist/utils/smooth/SmoothContext.js +2 -2
- package/dist/utils/smooth/index.js +3 -3
- package/dist/utils/smooth/useSmooth.js +3 -3
- package/package.json +1 -1
- package/src/api/AssistantRuntime.ts +21 -25
- package/src/api/ThreadListItemRuntime.ts +36 -7
- package/src/api/ThreadListRuntime.ts +31 -9
- package/src/api/ThreadRuntime.ts +38 -10
- package/src/context/providers/AssistantRuntimeProvider.tsx +4 -1
- package/src/context/providers/ThreadRuntimeProvider.tsx +9 -2
- package/src/internal.ts +1 -1
- package/src/primitives/composer/ComposerInput.tsx +3 -1
- package/src/primitives/threadList/ThreadListNew.tsx +1 -1
- package/src/primitives/threadListItem/ThreadListItemRoot.tsx +1 -1
- package/src/runtimes/core/BaseThreadRuntimeCore.tsx +1 -9
- package/src/runtimes/core/ThreadListRuntimeCore.tsx +16 -7
- package/src/runtimes/core/ThreadRuntimeCore.tsx +1 -19
- package/src/runtimes/core/index.ts +0 -1
- package/src/runtimes/external-store/ExternalStoreAdapter.tsx +20 -3
- package/src/runtimes/external-store/ExternalStoreRuntimeCore.tsx +5 -12
- package/src/runtimes/external-store/ExternalStoreThreadListRuntimeCore.tsx +22 -35
- package/src/runtimes/external-store/ExternalStoreThreadRuntimeCore.tsx +3 -7
- package/src/runtimes/local/LocalRuntimeCore.tsx +7 -14
- package/src/runtimes/local/LocalThreadListRuntimeCore.tsx +110 -103
- package/src/runtimes/local/LocalThreadRuntimeCore.tsx +11 -10
- package/src/runtimes/local/useLocalRuntime.tsx +5 -12
- package/src/styles/tailwindcss/thread.css +1 -1
- package/src/ui/index.ts +6 -6
- package/src/ui/thread-config.tsx +1 -1
- package/src/ui/thread-list-item.tsx +24 -32
- package/src/ui/thread-list.tsx +13 -7
- package/dist/runtimes/local/LocalThreadMetadataRuntimeCore.d.ts +0 -19
- package/dist/runtimes/local/LocalThreadMetadataRuntimeCore.d.ts.map +0 -1
- package/dist/runtimes/local/LocalThreadMetadataRuntimeCore.js +0 -87
- package/dist/runtimes/local/LocalThreadMetadataRuntimeCore.js.map +0 -1
- package/dist/runtimes/local/LocalThreadMetadataRuntimeCore.mjs +0 -62
- package/dist/runtimes/local/LocalThreadMetadataRuntimeCore.mjs.map +0 -1
- package/src/runtimes/local/LocalThreadMetadataRuntimeCore.tsx +0 -79
@@ -14,12 +14,13 @@ import {
|
|
14
14
|
ThreadRuntimeCore,
|
15
15
|
} from "../core/ThreadRuntimeCore";
|
16
16
|
import { BaseThreadRuntimeCore } from "../core/BaseThreadRuntimeCore";
|
17
|
-
import { LocalThreadMetadataRuntimeCore } from "./LocalThreadMetadataRuntimeCore";
|
18
17
|
|
19
18
|
export class LocalThreadRuntimeCore
|
20
19
|
extends BaseThreadRuntimeCore
|
21
20
|
implements ThreadRuntimeCore
|
22
21
|
{
|
22
|
+
private _isInitialized = false;
|
23
|
+
|
23
24
|
public readonly capabilities = {
|
24
25
|
switchToBranch: true,
|
25
26
|
edit: true,
|
@@ -42,11 +43,10 @@ export class LocalThreadRuntimeCore
|
|
42
43
|
|
43
44
|
constructor(
|
44
45
|
configProvider: ModelConfigProvider,
|
45
|
-
threadId: string,
|
46
46
|
options: LocalRuntimeOptionsBase,
|
47
47
|
) {
|
48
|
-
super(configProvider
|
49
|
-
this.
|
48
|
+
super(configProvider);
|
49
|
+
this.__internal_setOptions(options);
|
50
50
|
}
|
51
51
|
|
52
52
|
private _options!: LocalRuntimeOptionsBase;
|
@@ -55,7 +55,7 @@ export class LocalThreadRuntimeCore
|
|
55
55
|
return undefined;
|
56
56
|
}
|
57
57
|
|
58
|
-
public
|
58
|
+
public __internal_setOptions(options: LocalRuntimeOptionsBase) {
|
59
59
|
if (this._options === options) return;
|
60
60
|
|
61
61
|
this._options = options;
|
@@ -83,14 +83,15 @@ export class LocalThreadRuntimeCore
|
|
83
83
|
if (hasUpdates) this._notifySubscribers();
|
84
84
|
}
|
85
85
|
|
86
|
-
private
|
87
|
-
if (this.
|
88
|
-
this.
|
86
|
+
private _ensureInitialized() {
|
87
|
+
if (!this._isInitialized) {
|
88
|
+
this._isInitialized = true;
|
89
|
+
this._notifyEventSubscribers("initialize");
|
89
90
|
}
|
90
91
|
}
|
91
92
|
|
92
93
|
public async append(message: AppendMessage): Promise<void> {
|
93
|
-
this.
|
94
|
+
this._ensureInitialized();
|
94
95
|
|
95
96
|
const newMessage = fromCoreMessage(message, {
|
96
97
|
attachments: message.attachments,
|
@@ -107,7 +108,7 @@ export class LocalThreadRuntimeCore
|
|
107
108
|
}
|
108
109
|
|
109
110
|
public async startRun(parentId: string | null): Promise<void> {
|
110
|
-
this.
|
111
|
+
this._ensureInitialized();
|
111
112
|
|
112
113
|
this.repository.resetHead(parentId);
|
113
114
|
|
@@ -9,29 +9,22 @@ import {
|
|
9
9
|
AssistantRuntimeImpl,
|
10
10
|
} from "../../api/AssistantRuntime";
|
11
11
|
import { ThreadRuntimeImpl } from "../../internal";
|
12
|
-
import { ThreadRuntime } from "../../api/ThreadRuntime";
|
13
12
|
|
14
13
|
export type LocalRuntime = AssistantRuntime & {
|
15
14
|
reset: (options?: Parameters<LocalRuntimeCore["reset"]>[0]) => void;
|
16
15
|
};
|
17
16
|
|
18
17
|
class LocalRuntimeImpl extends AssistantRuntimeImpl implements LocalRuntime {
|
19
|
-
private constructor(
|
20
|
-
|
21
|
-
thread: ThreadRuntime,
|
22
|
-
) {
|
23
|
-
super(core, thread);
|
18
|
+
private constructor(private core: LocalRuntimeCore) {
|
19
|
+
super(core, ThreadRuntimeImpl);
|
24
20
|
}
|
25
21
|
|
26
22
|
public reset(options?: Parameters<LocalRuntimeCore["reset"]>[0]) {
|
27
23
|
this.core.reset(options);
|
28
24
|
}
|
29
25
|
|
30
|
-
public static override create(_core: LocalRuntimeCore) {
|
31
|
-
return new LocalRuntimeImpl(
|
32
|
-
_core,
|
33
|
-
AssistantRuntimeImpl.createMainThreadRuntime(_core, ThreadRuntimeImpl),
|
34
|
-
) as LocalRuntime;
|
26
|
+
public static override create(_core: LocalRuntimeCore): LocalRuntime {
|
27
|
+
return new LocalRuntimeImpl(_core);
|
35
28
|
}
|
36
29
|
}
|
37
30
|
|
@@ -50,7 +43,7 @@ export const useLocalRuntime = (
|
|
50
43
|
const [runtime] = useState(() => new LocalRuntimeCore(opt, initialMessages));
|
51
44
|
|
52
45
|
useEffect(() => {
|
53
|
-
runtime.
|
46
|
+
runtime.threadList.getMainThreadRuntimeCore().__internal_setOptions(opt);
|
54
47
|
});
|
55
48
|
|
56
49
|
return useMemo(() => LocalRuntimeImpl.create(runtime), [runtime]);
|
@@ -227,7 +227,7 @@
|
|
227
227
|
}
|
228
228
|
|
229
229
|
.aui-thread-list-item {
|
230
|
-
@apply data-[active]:bg-aui-muted hover:bg-aui-muted flex items-center gap-2 rounded-lg transition-all;
|
230
|
+
@apply data-[active]:bg-aui-muted hover:bg-aui-muted focus-visible:bg-aui-muted focus-visible:ring-aui-ring flex items-center gap-2 rounded-lg transition-all focus-visible:outline-none focus-visible:ring-2;
|
231
231
|
}
|
232
232
|
|
233
233
|
.aui-thread-list-new {
|
package/src/ui/index.ts
CHANGED
@@ -20,6 +20,8 @@ export { default as BranchPicker } from "./branch-picker";
|
|
20
20
|
|
21
21
|
export { default as Composer } from "./composer";
|
22
22
|
|
23
|
+
export { default as ContentPart } from "./content-part";
|
24
|
+
|
23
25
|
export {
|
24
26
|
default as AttachmentUI, // TODO name collision with Attachment
|
25
27
|
} from "./attachment-ui";
|
@@ -28,14 +30,12 @@ export { default as EditComposer } from "./edit-composer";
|
|
28
30
|
|
29
31
|
export { default as Thread } from "./thread";
|
30
32
|
|
31
|
-
export { default as
|
33
|
+
export { default as ThreadList } from "./thread-list";
|
32
34
|
|
33
|
-
export { default as
|
35
|
+
export { default as ThreadListItem } from "./thread-list-item";
|
34
36
|
|
35
37
|
export { default as ThreadWelcome } from "./thread-welcome";
|
36
38
|
|
37
|
-
export { default as
|
38
|
-
|
39
|
-
export { default as ThreadList } from "./thread-list";
|
39
|
+
export { default as UserMessage } from "./user-message";
|
40
40
|
|
41
|
-
export { default as
|
41
|
+
export { default as UserActionBar } from "./user-action-bar";
|
package/src/ui/thread-config.tsx
CHANGED
@@ -39,11 +39,9 @@ const ThreadListItemTitle = forwardRef<
|
|
39
39
|
ThreadListItemPrimitiveTitle.Element,
|
40
40
|
ThreadListItemPrimitiveTitle.Props
|
41
41
|
>(({ className, ...props }, ref) => {
|
42
|
-
const
|
43
|
-
|
44
|
-
|
45
|
-
} = {},
|
46
|
-
} = useThreadConfig();
|
42
|
+
const config = useThreadConfig();
|
43
|
+
const fallback =
|
44
|
+
config.strings?.threadList?.item?.title?.fallback ?? "New Chat";
|
47
45
|
|
48
46
|
return (
|
49
47
|
<p
|
@@ -58,34 +56,28 @@ const ThreadListItemTitle = forwardRef<
|
|
58
56
|
|
59
57
|
ThreadListItemTitle.displayName = "ThreadListItemTitle";
|
60
58
|
|
61
|
-
const ThreadListItemArchive =
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
} = {},
|
69
|
-
} = {},
|
70
|
-
} = useThreadConfig();
|
59
|
+
const ThreadListItemArchive = forwardRef<
|
60
|
+
HTMLButtonElement,
|
61
|
+
Partial<TooltipIconButton.Props>
|
62
|
+
>(({ className, ...props }, ref) => {
|
63
|
+
const config = useThreadConfig();
|
64
|
+
const tooltip =
|
65
|
+
config.strings?.threadList?.item?.archive?.tooltip ?? "Archive thread";
|
71
66
|
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
),
|
87
|
-
{},
|
88
|
-
);
|
67
|
+
return (
|
68
|
+
<ThreadListItemPrimitive.Archive asChild>
|
69
|
+
<TooltipIconButton
|
70
|
+
ref={ref}
|
71
|
+
className={classNames("aui-thread-list-item-archive", className)}
|
72
|
+
variant="ghost"
|
73
|
+
tooltip={tooltip}
|
74
|
+
{...props}
|
75
|
+
>
|
76
|
+
<ArchiveIcon />
|
77
|
+
</TooltipIconButton>
|
78
|
+
</ThreadListItemPrimitive.Archive>
|
79
|
+
);
|
80
|
+
});
|
89
81
|
|
90
82
|
ThreadListItemArchive.displayName = "ThreadListItemArchive";
|
91
83
|
|
package/src/ui/thread-list.tsx
CHANGED
@@ -27,17 +27,16 @@ const ThreadListNew = forwardRef<
|
|
27
27
|
HTMLButtonElement,
|
28
28
|
ThreadListPrimitive.New.Props & ButtonProps
|
29
29
|
>((props, ref) => {
|
30
|
-
const
|
31
|
-
|
32
|
-
} = useThreadConfig();
|
30
|
+
const config = useThreadConfig();
|
31
|
+
const label = config.strings?.threadList?.new?.label ?? "New Thread";
|
33
32
|
|
34
33
|
return (
|
35
34
|
<ThreadListPrimitive.New asChild>
|
36
35
|
<Button
|
37
|
-
{...props}
|
38
36
|
ref={ref}
|
39
37
|
className="aui-thread-list-new"
|
40
38
|
variant="ghost"
|
39
|
+
{...props}
|
41
40
|
>
|
42
41
|
<PlusIcon />
|
43
42
|
{label}
|
@@ -47,9 +46,16 @@ const ThreadListNew = forwardRef<
|
|
47
46
|
});
|
48
47
|
ThreadListNew.displayName = "ThreadListNew";
|
49
48
|
|
50
|
-
|
51
|
-
|
52
|
-
|
49
|
+
namespace ThreadListItems {
|
50
|
+
export type Props = {
|
51
|
+
/**
|
52
|
+
* Optional custom components to override default thread list items
|
53
|
+
*/
|
54
|
+
components?: Partial<ThreadListPrimitive.Items.Props["components"]>;
|
55
|
+
};
|
56
|
+
}
|
57
|
+
|
58
|
+
const ThreadListItems: FC<ThreadListItems.Props> = ({ components }) => {
|
53
59
|
return (
|
54
60
|
<ThreadListPrimitive.Items
|
55
61
|
components={{
|
@@ -1,19 +0,0 @@
|
|
1
|
-
import { ThreadMetadataRuntimeCore } from "../core/ThreadRuntimeCore";
|
2
|
-
export declare class LocalThreadMetadataRuntimeCore implements ThreadMetadataRuntimeCore {
|
3
|
-
private _threadId;
|
4
|
-
private _state;
|
5
|
-
private _title;
|
6
|
-
private _subscribers;
|
7
|
-
constructor(_threadId: string);
|
8
|
-
get threadId(): string;
|
9
|
-
get state(): "archived" | "regular" | "new" | "deleted";
|
10
|
-
get title(): string | undefined;
|
11
|
-
rename(newTitle: string): Promise<void>;
|
12
|
-
archive(): Promise<void>;
|
13
|
-
unarchive(): Promise<void>;
|
14
|
-
delete(): Promise<void>;
|
15
|
-
create(title?: string): Promise<void>;
|
16
|
-
subscribe(callback: () => void): () => boolean;
|
17
|
-
private _notifySubscribers;
|
18
|
-
}
|
19
|
-
//# sourceMappingURL=LocalThreadMetadataRuntimeCore.d.ts.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"LocalThreadMetadataRuntimeCore.d.ts","sourceRoot":"","sources":["../../../src/runtimes/local/LocalThreadMetadataRuntimeCore.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,2BAA2B,CAAC;AAEtE,qBAAa,8BACX,YAAW,yBAAyB;IAMxB,OAAO,CAAC,SAAS;IAJ7B,OAAO,CAAC,MAAM,CAAqD;IACnE,OAAO,CAAC,MAAM,CAAqB;IACnC,OAAO,CAAC,YAAY,CAAyB;gBAEzB,SAAS,EAAE,MAAM;IAErC,IAAW,QAAQ,WAElB;IAED,IAAW,KAAK,+CAEf;IAED,IAAW,KAAK,uBAEf;IAEM,MAAM,CAAC,QAAQ,EAAE,MAAM;IAOvB,OAAO;IAWP,SAAS;IAST,MAAM;IAUN,MAAM,CAAC,KAAK,CAAC,EAAE,MAAM;IAUrB,SAAS,CAAC,QAAQ,EAAE,MAAM,IAAI;IAKrC,OAAO,CAAC,kBAAkB;CAG3B"}
|
@@ -1,87 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __defProp = Object.defineProperty;
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
6
|
-
var __export = (target, all) => {
|
7
|
-
for (var name in all)
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
9
|
-
};
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
12
|
-
for (let key of __getOwnPropNames(from))
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
15
|
-
}
|
16
|
-
return to;
|
17
|
-
};
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
19
|
-
|
20
|
-
// src/runtimes/local/LocalThreadMetadataRuntimeCore.tsx
|
21
|
-
var LocalThreadMetadataRuntimeCore_exports = {};
|
22
|
-
__export(LocalThreadMetadataRuntimeCore_exports, {
|
23
|
-
LocalThreadMetadataRuntimeCore: () => LocalThreadMetadataRuntimeCore
|
24
|
-
});
|
25
|
-
module.exports = __toCommonJS(LocalThreadMetadataRuntimeCore_exports);
|
26
|
-
var LocalThreadMetadataRuntimeCore = class {
|
27
|
-
constructor(_threadId) {
|
28
|
-
this._threadId = _threadId;
|
29
|
-
}
|
30
|
-
_state = "new";
|
31
|
-
_title;
|
32
|
-
_subscribers = /* @__PURE__ */ new Set();
|
33
|
-
get threadId() {
|
34
|
-
return this._threadId;
|
35
|
-
}
|
36
|
-
get state() {
|
37
|
-
return this._state;
|
38
|
-
}
|
39
|
-
get title() {
|
40
|
-
return this._title;
|
41
|
-
}
|
42
|
-
rename(newTitle) {
|
43
|
-
this._title = newTitle;
|
44
|
-
this._notifySubscribers();
|
45
|
-
return Promise.resolve();
|
46
|
-
}
|
47
|
-
archive() {
|
48
|
-
if (this._state === "new") throw new Error("Thread not created");
|
49
|
-
if (this._state === "archived") throw new Error("Thread already archived");
|
50
|
-
if (this._state === "deleted") throw new Error("Thread deleted");
|
51
|
-
this._state = "archived";
|
52
|
-
this._notifySubscribers();
|
53
|
-
return Promise.resolve();
|
54
|
-
}
|
55
|
-
unarchive() {
|
56
|
-
if (this._state !== "archived") throw new Error("Thread not archived");
|
57
|
-
this._state = "regular";
|
58
|
-
this._notifySubscribers();
|
59
|
-
return Promise.resolve();
|
60
|
-
}
|
61
|
-
delete() {
|
62
|
-
if (this._state === "new") throw new Error("Thread not created");
|
63
|
-
if (this._state === "deleted") throw new Error("Thread already deleted");
|
64
|
-
this._state = "deleted";
|
65
|
-
this._notifySubscribers();
|
66
|
-
return Promise.resolve();
|
67
|
-
}
|
68
|
-
create(title) {
|
69
|
-
if (this.state !== "new") throw new Error("Thread not new");
|
70
|
-
this._state = "regular";
|
71
|
-
this._title = title ?? this._title;
|
72
|
-
this._notifySubscribers();
|
73
|
-
return Promise.resolve();
|
74
|
-
}
|
75
|
-
subscribe(callback) {
|
76
|
-
this._subscribers.add(callback);
|
77
|
-
return () => this._subscribers.delete(callback);
|
78
|
-
}
|
79
|
-
_notifySubscribers() {
|
80
|
-
for (const callback of this._subscribers) callback();
|
81
|
-
}
|
82
|
-
};
|
83
|
-
// Annotate the CommonJS export names for ESM import in node:
|
84
|
-
0 && (module.exports = {
|
85
|
-
LocalThreadMetadataRuntimeCore
|
86
|
-
});
|
87
|
-
//# sourceMappingURL=LocalThreadMetadataRuntimeCore.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/runtimes/local/LocalThreadMetadataRuntimeCore.tsx"],"sourcesContent":["import { ThreadMetadataRuntimeCore } from \"../core/ThreadRuntimeCore\";\n\nexport class LocalThreadMetadataRuntimeCore\n implements ThreadMetadataRuntimeCore\n{\n private _state: \"regular\" | \"archived\" | \"deleted\" | \"new\" = \"new\";\n private _title: string | undefined;\n private _subscribers = new Set<() => void>();\n\n constructor(private _threadId: string) {}\n\n public get threadId() {\n return this._threadId;\n }\n\n public get state() {\n return this._state;\n }\n\n public get title() {\n return this._title;\n }\n\n public rename(newTitle: string) {\n this._title = newTitle;\n this._notifySubscribers();\n\n return Promise.resolve();\n }\n\n public archive() {\n if (this._state === \"new\") throw new Error(\"Thread not created\");\n if (this._state === \"archived\") throw new Error(\"Thread already archived\");\n if (this._state === \"deleted\") throw new Error(\"Thread deleted\");\n\n this._state = \"archived\";\n this._notifySubscribers();\n\n return Promise.resolve();\n }\n\n public unarchive() {\n if (this._state !== \"archived\") throw new Error(\"Thread not archived\");\n\n this._state = \"regular\";\n this._notifySubscribers();\n\n return Promise.resolve();\n }\n\n public delete() {\n if (this._state === \"new\") throw new Error(\"Thread not created\");\n if (this._state === \"deleted\") throw new Error(\"Thread already deleted\");\n\n this._state = \"deleted\";\n this._notifySubscribers();\n\n return Promise.resolve();\n }\n\n public create(title?: string) {\n if (this.state !== \"new\") throw new Error(\"Thread not new\");\n\n this._state = \"regular\";\n this._title = title ?? this._title;\n this._notifySubscribers();\n\n return Promise.resolve();\n }\n\n public subscribe(callback: () => void) {\n this._subscribers.add(callback);\n return () => this._subscribers.delete(callback);\n }\n\n private _notifySubscribers() {\n for (const callback of this._subscribers) callback();\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEO,IAAM,iCAAN,MAEP;AAAA,EAKE,YAAoB,WAAmB;AAAnB;AAAA,EAAoB;AAAA,EAJhC,SAAqD;AAAA,EACrD;AAAA,EACA,eAAe,oBAAI,IAAgB;AAAA,EAI3C,IAAW,WAAW;AACpB,WAAO,KAAK;AAAA,EACd;AAAA,EAEA,IAAW,QAAQ;AACjB,WAAO,KAAK;AAAA,EACd;AAAA,EAEA,IAAW,QAAQ;AACjB,WAAO,KAAK;AAAA,EACd;AAAA,EAEO,OAAO,UAAkB;AAC9B,SAAK,SAAS;AACd,SAAK,mBAAmB;AAExB,WAAO,QAAQ,QAAQ;AAAA,EACzB;AAAA,EAEO,UAAU;AACf,QAAI,KAAK,WAAW,MAAO,OAAM,IAAI,MAAM,oBAAoB;AAC/D,QAAI,KAAK,WAAW,WAAY,OAAM,IAAI,MAAM,yBAAyB;AACzE,QAAI,KAAK,WAAW,UAAW,OAAM,IAAI,MAAM,gBAAgB;AAE/D,SAAK,SAAS;AACd,SAAK,mBAAmB;AAExB,WAAO,QAAQ,QAAQ;AAAA,EACzB;AAAA,EAEO,YAAY;AACjB,QAAI,KAAK,WAAW,WAAY,OAAM,IAAI,MAAM,qBAAqB;AAErE,SAAK,SAAS;AACd,SAAK,mBAAmB;AAExB,WAAO,QAAQ,QAAQ;AAAA,EACzB;AAAA,EAEO,SAAS;AACd,QAAI,KAAK,WAAW,MAAO,OAAM,IAAI,MAAM,oBAAoB;AAC/D,QAAI,KAAK,WAAW,UAAW,OAAM,IAAI,MAAM,wBAAwB;AAEvE,SAAK,SAAS;AACd,SAAK,mBAAmB;AAExB,WAAO,QAAQ,QAAQ;AAAA,EACzB;AAAA,EAEO,OAAO,OAAgB;AAC5B,QAAI,KAAK,UAAU,MAAO,OAAM,IAAI,MAAM,gBAAgB;AAE1D,SAAK,SAAS;AACd,SAAK,SAAS,SAAS,KAAK;AAC5B,SAAK,mBAAmB;AAExB,WAAO,QAAQ,QAAQ;AAAA,EACzB;AAAA,EAEO,UAAU,UAAsB;AACrC,SAAK,aAAa,IAAI,QAAQ;AAC9B,WAAO,MAAM,KAAK,aAAa,OAAO,QAAQ;AAAA,EAChD;AAAA,EAEQ,qBAAqB;AAC3B,eAAW,YAAY,KAAK,aAAc,UAAS;AAAA,EACrD;AACF;","names":[]}
|
@@ -1,62 +0,0 @@
|
|
1
|
-
// src/runtimes/local/LocalThreadMetadataRuntimeCore.tsx
|
2
|
-
var LocalThreadMetadataRuntimeCore = class {
|
3
|
-
constructor(_threadId) {
|
4
|
-
this._threadId = _threadId;
|
5
|
-
}
|
6
|
-
_state = "new";
|
7
|
-
_title;
|
8
|
-
_subscribers = /* @__PURE__ */ new Set();
|
9
|
-
get threadId() {
|
10
|
-
return this._threadId;
|
11
|
-
}
|
12
|
-
get state() {
|
13
|
-
return this._state;
|
14
|
-
}
|
15
|
-
get title() {
|
16
|
-
return this._title;
|
17
|
-
}
|
18
|
-
rename(newTitle) {
|
19
|
-
this._title = newTitle;
|
20
|
-
this._notifySubscribers();
|
21
|
-
return Promise.resolve();
|
22
|
-
}
|
23
|
-
archive() {
|
24
|
-
if (this._state === "new") throw new Error("Thread not created");
|
25
|
-
if (this._state === "archived") throw new Error("Thread already archived");
|
26
|
-
if (this._state === "deleted") throw new Error("Thread deleted");
|
27
|
-
this._state = "archived";
|
28
|
-
this._notifySubscribers();
|
29
|
-
return Promise.resolve();
|
30
|
-
}
|
31
|
-
unarchive() {
|
32
|
-
if (this._state !== "archived") throw new Error("Thread not archived");
|
33
|
-
this._state = "regular";
|
34
|
-
this._notifySubscribers();
|
35
|
-
return Promise.resolve();
|
36
|
-
}
|
37
|
-
delete() {
|
38
|
-
if (this._state === "new") throw new Error("Thread not created");
|
39
|
-
if (this._state === "deleted") throw new Error("Thread already deleted");
|
40
|
-
this._state = "deleted";
|
41
|
-
this._notifySubscribers();
|
42
|
-
return Promise.resolve();
|
43
|
-
}
|
44
|
-
create(title) {
|
45
|
-
if (this.state !== "new") throw new Error("Thread not new");
|
46
|
-
this._state = "regular";
|
47
|
-
this._title = title ?? this._title;
|
48
|
-
this._notifySubscribers();
|
49
|
-
return Promise.resolve();
|
50
|
-
}
|
51
|
-
subscribe(callback) {
|
52
|
-
this._subscribers.add(callback);
|
53
|
-
return () => this._subscribers.delete(callback);
|
54
|
-
}
|
55
|
-
_notifySubscribers() {
|
56
|
-
for (const callback of this._subscribers) callback();
|
57
|
-
}
|
58
|
-
};
|
59
|
-
export {
|
60
|
-
LocalThreadMetadataRuntimeCore
|
61
|
-
};
|
62
|
-
//# sourceMappingURL=LocalThreadMetadataRuntimeCore.mjs.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/runtimes/local/LocalThreadMetadataRuntimeCore.tsx"],"sourcesContent":["import { ThreadMetadataRuntimeCore } from \"../core/ThreadRuntimeCore\";\n\nexport class LocalThreadMetadataRuntimeCore\n implements ThreadMetadataRuntimeCore\n{\n private _state: \"regular\" | \"archived\" | \"deleted\" | \"new\" = \"new\";\n private _title: string | undefined;\n private _subscribers = new Set<() => void>();\n\n constructor(private _threadId: string) {}\n\n public get threadId() {\n return this._threadId;\n }\n\n public get state() {\n return this._state;\n }\n\n public get title() {\n return this._title;\n }\n\n public rename(newTitle: string) {\n this._title = newTitle;\n this._notifySubscribers();\n\n return Promise.resolve();\n }\n\n public archive() {\n if (this._state === \"new\") throw new Error(\"Thread not created\");\n if (this._state === \"archived\") throw new Error(\"Thread already archived\");\n if (this._state === \"deleted\") throw new Error(\"Thread deleted\");\n\n this._state = \"archived\";\n this._notifySubscribers();\n\n return Promise.resolve();\n }\n\n public unarchive() {\n if (this._state !== \"archived\") throw new Error(\"Thread not archived\");\n\n this._state = \"regular\";\n this._notifySubscribers();\n\n return Promise.resolve();\n }\n\n public delete() {\n if (this._state === \"new\") throw new Error(\"Thread not created\");\n if (this._state === \"deleted\") throw new Error(\"Thread already deleted\");\n\n this._state = \"deleted\";\n this._notifySubscribers();\n\n return Promise.resolve();\n }\n\n public create(title?: string) {\n if (this.state !== \"new\") throw new Error(\"Thread not new\");\n\n this._state = \"regular\";\n this._title = title ?? this._title;\n this._notifySubscribers();\n\n return Promise.resolve();\n }\n\n public subscribe(callback: () => void) {\n this._subscribers.add(callback);\n return () => this._subscribers.delete(callback);\n }\n\n private _notifySubscribers() {\n for (const callback of this._subscribers) callback();\n }\n}\n"],"mappings":";AAEO,IAAM,iCAAN,MAEP;AAAA,EAKE,YAAoB,WAAmB;AAAnB;AAAA,EAAoB;AAAA,EAJhC,SAAqD;AAAA,EACrD;AAAA,EACA,eAAe,oBAAI,IAAgB;AAAA,EAI3C,IAAW,WAAW;AACpB,WAAO,KAAK;AAAA,EACd;AAAA,EAEA,IAAW,QAAQ;AACjB,WAAO,KAAK;AAAA,EACd;AAAA,EAEA,IAAW,QAAQ;AACjB,WAAO,KAAK;AAAA,EACd;AAAA,EAEO,OAAO,UAAkB;AAC9B,SAAK,SAAS;AACd,SAAK,mBAAmB;AAExB,WAAO,QAAQ,QAAQ;AAAA,EACzB;AAAA,EAEO,UAAU;AACf,QAAI,KAAK,WAAW,MAAO,OAAM,IAAI,MAAM,oBAAoB;AAC/D,QAAI,KAAK,WAAW,WAAY,OAAM,IAAI,MAAM,yBAAyB;AACzE,QAAI,KAAK,WAAW,UAAW,OAAM,IAAI,MAAM,gBAAgB;AAE/D,SAAK,SAAS;AACd,SAAK,mBAAmB;AAExB,WAAO,QAAQ,QAAQ;AAAA,EACzB;AAAA,EAEO,YAAY;AACjB,QAAI,KAAK,WAAW,WAAY,OAAM,IAAI,MAAM,qBAAqB;AAErE,SAAK,SAAS;AACd,SAAK,mBAAmB;AAExB,WAAO,QAAQ,QAAQ;AAAA,EACzB;AAAA,EAEO,SAAS;AACd,QAAI,KAAK,WAAW,MAAO,OAAM,IAAI,MAAM,oBAAoB;AAC/D,QAAI,KAAK,WAAW,UAAW,OAAM,IAAI,MAAM,wBAAwB;AAEvE,SAAK,SAAS;AACd,SAAK,mBAAmB;AAExB,WAAO,QAAQ,QAAQ;AAAA,EACzB;AAAA,EAEO,OAAO,OAAgB;AAC5B,QAAI,KAAK,UAAU,MAAO,OAAM,IAAI,MAAM,gBAAgB;AAE1D,SAAK,SAAS;AACd,SAAK,SAAS,SAAS,KAAK;AAC5B,SAAK,mBAAmB;AAExB,WAAO,QAAQ,QAAQ;AAAA,EACzB;AAAA,EAEO,UAAU,UAAsB;AACrC,SAAK,aAAa,IAAI,QAAQ;AAC9B,WAAO,MAAM,KAAK,aAAa,OAAO,QAAQ;AAAA,EAChD;AAAA,EAEQ,qBAAqB;AAC3B,eAAW,YAAY,KAAK,aAAc,UAAS;AAAA,EACrD;AACF;","names":[]}
|
@@ -1,79 +0,0 @@
|
|
1
|
-
import { ThreadMetadataRuntimeCore } from "../core/ThreadRuntimeCore";
|
2
|
-
|
3
|
-
export class LocalThreadMetadataRuntimeCore
|
4
|
-
implements ThreadMetadataRuntimeCore
|
5
|
-
{
|
6
|
-
private _state: "regular" | "archived" | "deleted" | "new" = "new";
|
7
|
-
private _title: string | undefined;
|
8
|
-
private _subscribers = new Set<() => void>();
|
9
|
-
|
10
|
-
constructor(private _threadId: string) {}
|
11
|
-
|
12
|
-
public get threadId() {
|
13
|
-
return this._threadId;
|
14
|
-
}
|
15
|
-
|
16
|
-
public get state() {
|
17
|
-
return this._state;
|
18
|
-
}
|
19
|
-
|
20
|
-
public get title() {
|
21
|
-
return this._title;
|
22
|
-
}
|
23
|
-
|
24
|
-
public rename(newTitle: string) {
|
25
|
-
this._title = newTitle;
|
26
|
-
this._notifySubscribers();
|
27
|
-
|
28
|
-
return Promise.resolve();
|
29
|
-
}
|
30
|
-
|
31
|
-
public archive() {
|
32
|
-
if (this._state === "new") throw new Error("Thread not created");
|
33
|
-
if (this._state === "archived") throw new Error("Thread already archived");
|
34
|
-
if (this._state === "deleted") throw new Error("Thread deleted");
|
35
|
-
|
36
|
-
this._state = "archived";
|
37
|
-
this._notifySubscribers();
|
38
|
-
|
39
|
-
return Promise.resolve();
|
40
|
-
}
|
41
|
-
|
42
|
-
public unarchive() {
|
43
|
-
if (this._state !== "archived") throw new Error("Thread not archived");
|
44
|
-
|
45
|
-
this._state = "regular";
|
46
|
-
this._notifySubscribers();
|
47
|
-
|
48
|
-
return Promise.resolve();
|
49
|
-
}
|
50
|
-
|
51
|
-
public delete() {
|
52
|
-
if (this._state === "new") throw new Error("Thread not created");
|
53
|
-
if (this._state === "deleted") throw new Error("Thread already deleted");
|
54
|
-
|
55
|
-
this._state = "deleted";
|
56
|
-
this._notifySubscribers();
|
57
|
-
|
58
|
-
return Promise.resolve();
|
59
|
-
}
|
60
|
-
|
61
|
-
public create(title?: string) {
|
62
|
-
if (this.state !== "new") throw new Error("Thread not new");
|
63
|
-
|
64
|
-
this._state = "regular";
|
65
|
-
this._title = title ?? this._title;
|
66
|
-
this._notifySubscribers();
|
67
|
-
|
68
|
-
return Promise.resolve();
|
69
|
-
}
|
70
|
-
|
71
|
-
public subscribe(callback: () => void) {
|
72
|
-
this._subscribers.add(callback);
|
73
|
-
return () => this._subscribers.delete(callback);
|
74
|
-
}
|
75
|
-
|
76
|
-
private _notifySubscribers() {
|
77
|
-
for (const callback of this._subscribers) callback();
|
78
|
-
}
|
79
|
-
}
|