@assistant-ui/react 0.5.100 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/api/AssistantRuntime.d.ts +2 -52
- package/dist/api/AssistantRuntime.d.ts.map +1 -1
- package/dist/api/AssistantRuntime.js +0 -8
- package/dist/api/AssistantRuntime.js.map +1 -1
- package/dist/api/AssistantRuntime.mjs +0 -8
- package/dist/api/AssistantRuntime.mjs.map +1 -1
- package/dist/api/AttachmentRuntime.d.ts +0 -12
- package/dist/api/AttachmentRuntime.d.ts.map +1 -1
- package/dist/api/AttachmentRuntime.js.map +1 -1
- package/dist/api/AttachmentRuntime.mjs.map +1 -1
- package/dist/api/ComposerRuntime.d.ts +5 -121
- package/dist/api/ComposerRuntime.d.ts.map +1 -1
- package/dist/api/ComposerRuntime.js +4 -84
- package/dist/api/ComposerRuntime.js.map +1 -1
- package/dist/api/ComposerRuntime.mjs +4 -84
- package/dist/api/ComposerRuntime.mjs.map +1 -1
- package/dist/api/ContentPartRuntime.d.ts +0 -4
- package/dist/api/ContentPartRuntime.d.ts.map +1 -1
- package/dist/api/ContentPartRuntime.js.map +1 -1
- package/dist/api/ContentPartRuntime.mjs.map +1 -1
- package/dist/api/MessageRuntime.d.ts +1 -12
- package/dist/api/MessageRuntime.d.ts.map +1 -1
- package/dist/api/MessageRuntime.js +9 -5
- package/dist/api/MessageRuntime.js.map +1 -1
- package/dist/api/MessageRuntime.mjs +8 -4
- package/dist/api/MessageRuntime.mjs.map +1 -1
- package/dist/api/ThreadListItemRuntime.d.ts +9 -5
- package/dist/api/ThreadListItemRuntime.d.ts.map +1 -1
- package/dist/api/ThreadListItemRuntime.js +10 -6
- package/dist/api/ThreadListItemRuntime.js.map +1 -1
- package/dist/api/ThreadListItemRuntime.mjs +10 -6
- package/dist/api/ThreadListItemRuntime.mjs.map +1 -1
- package/dist/api/ThreadListRuntime.d.ts +5 -23
- package/dist/api/ThreadListRuntime.d.ts.map +1 -1
- package/dist/api/ThreadListRuntime.js +23 -26
- package/dist/api/ThreadListRuntime.js.map +1 -1
- package/dist/api/ThreadListRuntime.mjs +23 -26
- package/dist/api/ThreadListRuntime.mjs.map +1 -1
- package/dist/api/ThreadRuntime.d.ts +17 -164
- package/dist/api/ThreadRuntime.d.ts.map +1 -1
- package/dist/api/ThreadRuntime.js +2 -94
- package/dist/api/ThreadRuntime.js.map +1 -1
- package/dist/api/ThreadRuntime.mjs +2 -94
- package/dist/api/ThreadRuntime.mjs.map +1 -1
- package/dist/context/providers/AssistantRuntimeProvider.d.ts.map +1 -1
- package/dist/context/providers/AssistantRuntimeProvider.js +0 -1
- package/dist/context/providers/AssistantRuntimeProvider.js.map +1 -1
- package/dist/context/providers/AssistantRuntimeProvider.mjs +0 -1
- package/dist/context/providers/AssistantRuntimeProvider.mjs.map +1 -1
- package/dist/context/providers/TextContentPartProvider.d.ts.map +1 -1
- package/dist/context/providers/TextContentPartProvider.js +0 -2
- package/dist/context/providers/TextContentPartProvider.js.map +1 -1
- package/dist/context/providers/TextContentPartProvider.mjs +0 -2
- package/dist/context/providers/TextContentPartProvider.mjs.map +1 -1
- package/dist/context/providers/ThreadListItemRuntimeProvider.d.ts +1 -4
- package/dist/context/providers/ThreadListItemRuntimeProvider.d.ts.map +1 -1
- package/dist/context/providers/ThreadRuntimeProvider.d.ts.map +1 -1
- package/dist/context/providers/ThreadRuntimeProvider.js +1 -13
- package/dist/context/providers/ThreadRuntimeProvider.js.map +1 -1
- package/dist/context/providers/ThreadRuntimeProvider.mjs +1 -13
- package/dist/context/providers/ThreadRuntimeProvider.mjs.map +1 -1
- package/dist/context/react/AssistantContext.d.ts +16 -88
- package/dist/context/react/AssistantContext.d.ts.map +1 -1
- package/dist/context/react/AssistantContext.js +0 -15
- package/dist/context/react/AssistantContext.js.map +1 -1
- package/dist/context/react/AssistantContext.mjs +0 -11
- package/dist/context/react/AssistantContext.mjs.map +1 -1
- package/dist/context/react/AttachmentContext.d.ts +16 -32
- package/dist/context/react/AttachmentContext.d.ts.map +1 -1
- package/dist/context/react/ComposerContext.d.ts +0 -5
- package/dist/context/react/ComposerContext.d.ts.map +1 -1
- package/dist/context/react/ComposerContext.js +3 -5
- package/dist/context/react/ComposerContext.js.map +1 -1
- package/dist/context/react/ComposerContext.mjs +2 -3
- package/dist/context/react/ComposerContext.mjs.map +1 -1
- package/dist/context/react/ContentPartContext.d.ts +0 -5
- package/dist/context/react/ContentPartContext.d.ts.map +1 -1
- package/dist/context/react/ContentPartContext.js +3 -5
- package/dist/context/react/ContentPartContext.js.map +1 -1
- package/dist/context/react/ContentPartContext.mjs +2 -3
- package/dist/context/react/ContentPartContext.mjs.map +1 -1
- package/dist/context/react/MessageContext.d.ts +0 -10
- package/dist/context/react/MessageContext.d.ts.map +1 -1
- package/dist/context/react/MessageContext.js +2 -6
- package/dist/context/react/MessageContext.js.map +1 -1
- package/dist/context/react/MessageContext.mjs +2 -4
- package/dist/context/react/MessageContext.mjs.map +1 -1
- package/dist/context/react/ThreadContext.d.ts +25 -1635
- package/dist/context/react/ThreadContext.d.ts.map +1 -1
- package/dist/context/react/ThreadContext.js +4 -30
- package/dist/context/react/ThreadContext.js.map +1 -1
- package/dist/context/react/ThreadContext.mjs +4 -22
- package/dist/context/react/ThreadContext.mjs.map +1 -1
- package/dist/context/react/ThreadListItemContext.d.ts +6 -24
- package/dist/context/react/ThreadListItemContext.d.ts.map +1 -1
- package/dist/context/react/index.d.ts +5 -101
- package/dist/context/react/index.d.ts.map +1 -1
- package/dist/context/react/index.js +0 -38
- package/dist/context/react/index.js.map +1 -1
- package/dist/context/react/index.mjs +5 -49
- package/dist/context/react/index.mjs.map +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +0 -1
- package/dist/index.mjs.map +1 -1
- package/dist/internal.d.ts +1 -0
- package/dist/internal.d.ts.map +1 -1
- package/dist/internal.js +3 -0
- package/dist/internal.js.map +1 -1
- package/dist/internal.mjs +2 -0
- package/dist/internal.mjs.map +1 -1
- package/dist/model-config/useAssistantToolUI.d.ts.map +1 -1
- package/dist/model-config/useAssistantToolUI.js.map +1 -1
- package/dist/model-config/useAssistantToolUI.mjs.map +1 -1
- package/dist/primitive-hooks/contentPart/useContentPartDisplay.d.ts +0 -3
- package/dist/primitive-hooks/contentPart/useContentPartDisplay.d.ts.map +1 -1
- package/dist/primitive-hooks/contentPart/useContentPartDisplay.js.map +1 -1
- package/dist/primitive-hooks/contentPart/useContentPartDisplay.mjs.map +1 -1
- package/dist/primitive-hooks/contentPart/useContentPartImage.d.ts +0 -3
- package/dist/primitive-hooks/contentPart/useContentPartImage.d.ts.map +1 -1
- package/dist/primitive-hooks/contentPart/useContentPartImage.js.map +1 -1
- package/dist/primitive-hooks/contentPart/useContentPartImage.mjs.map +1 -1
- package/dist/primitive-hooks/contentPart/useContentPartText.d.ts +0 -3
- package/dist/primitive-hooks/contentPart/useContentPartText.d.ts.map +1 -1
- package/dist/primitive-hooks/contentPart/useContentPartText.js.map +1 -1
- package/dist/primitive-hooks/contentPart/useContentPartText.mjs.map +1 -1
- package/dist/primitive-hooks/index.d.ts +0 -5
- package/dist/primitive-hooks/index.d.ts.map +1 -1
- package/dist/primitive-hooks/index.js +1 -11
- package/dist/primitive-hooks/index.js.map +1 -1
- package/dist/primitive-hooks/index.mjs +0 -5
- package/dist/primitive-hooks/index.mjs.map +1 -1
- package/dist/primitives/actionBar/ActionBarCopy.d.ts +1 -5
- package/dist/primitives/actionBar/ActionBarCopy.d.ts.map +1 -1
- package/dist/primitives/actionBar/ActionBarCopy.js.map +1 -1
- package/dist/primitives/actionBar/ActionBarCopy.mjs.map +1 -1
- package/dist/primitives/actionBar/ActionBarEdit.d.ts +0 -4
- package/dist/primitives/actionBar/ActionBarEdit.d.ts.map +1 -1
- package/dist/primitives/actionBar/ActionBarEdit.js.map +1 -1
- package/dist/primitives/actionBar/ActionBarEdit.mjs.map +1 -1
- package/dist/primitives/actionBar/ActionBarFeedbackNegative.d.ts +0 -4
- package/dist/primitives/actionBar/ActionBarFeedbackNegative.d.ts.map +1 -1
- package/dist/primitives/actionBar/ActionBarFeedbackNegative.js.map +1 -1
- package/dist/primitives/actionBar/ActionBarFeedbackNegative.mjs.map +1 -1
- package/dist/primitives/actionBar/ActionBarFeedbackPositive.d.ts +0 -4
- package/dist/primitives/actionBar/ActionBarFeedbackPositive.d.ts.map +1 -1
- package/dist/primitives/actionBar/ActionBarFeedbackPositive.js.map +1 -1
- package/dist/primitives/actionBar/ActionBarFeedbackPositive.mjs.map +1 -1
- package/dist/primitives/actionBar/ActionBarReload.d.ts +0 -4
- package/dist/primitives/actionBar/ActionBarReload.d.ts.map +1 -1
- package/dist/primitives/actionBar/ActionBarReload.js.map +1 -1
- package/dist/primitives/actionBar/ActionBarReload.mjs.map +1 -1
- package/dist/primitives/actionBar/ActionBarRoot.d.ts +0 -4
- package/dist/primitives/actionBar/ActionBarRoot.d.ts.map +1 -1
- package/dist/primitives/actionBar/ActionBarRoot.js.map +1 -1
- package/dist/primitives/actionBar/ActionBarRoot.mjs.map +1 -1
- package/dist/primitives/actionBar/ActionBarSpeak.d.ts +0 -4
- package/dist/primitives/actionBar/ActionBarSpeak.d.ts.map +1 -1
- package/dist/primitives/actionBar/ActionBarSpeak.js.map +1 -1
- package/dist/primitives/actionBar/ActionBarSpeak.mjs.map +1 -1
- package/dist/primitives/actionBar/ActionBarStopSpeaking.d.ts +0 -4
- package/dist/primitives/actionBar/ActionBarStopSpeaking.d.ts.map +1 -1
- package/dist/primitives/actionBar/ActionBarStopSpeaking.js.map +1 -1
- package/dist/primitives/actionBar/ActionBarStopSpeaking.mjs.map +1 -1
- package/dist/primitives/assistantModal/AssistantModalContent.d.ts +0 -4
- package/dist/primitives/assistantModal/AssistantModalContent.d.ts.map +1 -1
- package/dist/primitives/assistantModal/AssistantModalContent.js.map +1 -1
- package/dist/primitives/assistantModal/AssistantModalContent.mjs.map +1 -1
- package/dist/primitives/assistantModal/AssistantModalRoot.d.ts +0 -4
- package/dist/primitives/assistantModal/AssistantModalRoot.d.ts.map +1 -1
- package/dist/primitives/assistantModal/AssistantModalRoot.js.map +1 -1
- package/dist/primitives/assistantModal/AssistantModalRoot.mjs.map +1 -1
- package/dist/primitives/assistantModal/AssistantModalTrigger.d.ts +0 -4
- package/dist/primitives/assistantModal/AssistantModalTrigger.d.ts.map +1 -1
- package/dist/primitives/assistantModal/AssistantModalTrigger.js.map +1 -1
- package/dist/primitives/assistantModal/AssistantModalTrigger.mjs.map +1 -1
- package/dist/primitives/branchPicker/BranchPickerCount.d.ts +0 -4
- package/dist/primitives/branchPicker/BranchPickerCount.d.ts.map +1 -1
- package/dist/primitives/branchPicker/BranchPickerCount.js.map +1 -1
- package/dist/primitives/branchPicker/BranchPickerCount.mjs.map +1 -1
- package/dist/primitives/branchPicker/BranchPickerNext.d.ts +0 -4
- package/dist/primitives/branchPicker/BranchPickerNext.d.ts.map +1 -1
- package/dist/primitives/branchPicker/BranchPickerNext.js.map +1 -1
- package/dist/primitives/branchPicker/BranchPickerNext.mjs.map +1 -1
- package/dist/primitives/branchPicker/BranchPickerNumber.d.ts +0 -4
- package/dist/primitives/branchPicker/BranchPickerNumber.d.ts.map +1 -1
- package/dist/primitives/branchPicker/BranchPickerNumber.js.map +1 -1
- package/dist/primitives/branchPicker/BranchPickerNumber.mjs.map +1 -1
- package/dist/primitives/branchPicker/BranchPickerPrevious.d.ts +0 -4
- package/dist/primitives/branchPicker/BranchPickerPrevious.d.ts.map +1 -1
- package/dist/primitives/branchPicker/BranchPickerPrevious.js.map +1 -1
- package/dist/primitives/branchPicker/BranchPickerPrevious.mjs.map +1 -1
- package/dist/primitives/branchPicker/BranchPickerRoot.d.ts +0 -4
- package/dist/primitives/branchPicker/BranchPickerRoot.d.ts.map +1 -1
- package/dist/primitives/branchPicker/BranchPickerRoot.js.map +1 -1
- package/dist/primitives/branchPicker/BranchPickerRoot.mjs.map +1 -1
- package/dist/primitives/composer/ComposerAddAttachment.d.ts +1 -5
- package/dist/primitives/composer/ComposerAddAttachment.d.ts.map +1 -1
- package/dist/primitives/composer/ComposerAddAttachment.js +2 -2
- package/dist/primitives/composer/ComposerAddAttachment.js.map +1 -1
- package/dist/primitives/composer/ComposerAddAttachment.mjs +1 -1
- package/dist/primitives/composer/ComposerAddAttachment.mjs.map +1 -1
- package/dist/primitives/composer/ComposerAttachments.d.ts +0 -4
- package/dist/primitives/composer/ComposerAttachments.d.ts.map +1 -1
- package/dist/primitives/composer/ComposerAttachments.js.map +1 -1
- package/dist/primitives/composer/ComposerAttachments.mjs.map +1 -1
- package/dist/primitives/composer/ComposerCancel.d.ts +0 -4
- package/dist/primitives/composer/ComposerCancel.d.ts.map +1 -1
- package/dist/primitives/composer/ComposerCancel.js.map +1 -1
- package/dist/primitives/composer/ComposerCancel.mjs.map +1 -1
- package/dist/primitives/composer/ComposerIf.d.ts +0 -4
- package/dist/primitives/composer/ComposerIf.d.ts.map +1 -1
- package/dist/primitives/composer/ComposerIf.js.map +1 -1
- package/dist/primitives/composer/ComposerIf.mjs.map +1 -1
- package/dist/primitives/composer/ComposerInput.d.ts +0 -4
- package/dist/primitives/composer/ComposerInput.d.ts.map +1 -1
- package/dist/primitives/composer/ComposerInput.js.map +1 -1
- package/dist/primitives/composer/ComposerInput.mjs.map +1 -1
- package/dist/primitives/composer/ComposerRoot.d.ts +0 -1
- package/dist/primitives/composer/ComposerRoot.d.ts.map +1 -1
- package/dist/primitives/composer/ComposerRoot.js +2 -2
- package/dist/primitives/composer/ComposerRoot.js.map +1 -1
- package/dist/primitives/composer/ComposerRoot.mjs +1 -1
- package/dist/primitives/composer/ComposerRoot.mjs.map +1 -1
- package/dist/primitives/composer/ComposerSend.d.ts +1 -5
- package/dist/primitives/composer/ComposerSend.d.ts.map +1 -1
- package/dist/primitives/composer/ComposerSend.js +2 -2
- package/dist/primitives/composer/ComposerSend.js.map +1 -1
- package/dist/primitives/composer/ComposerSend.mjs +1 -1
- package/dist/primitives/composer/ComposerSend.mjs.map +1 -1
- package/dist/primitives/contentPart/ContentPartDisplay.d.ts +0 -4
- package/dist/primitives/contentPart/ContentPartDisplay.d.ts.map +1 -1
- package/dist/primitives/contentPart/ContentPartDisplay.js.map +1 -1
- package/dist/primitives/contentPart/ContentPartDisplay.mjs.map +1 -1
- package/dist/primitives/contentPart/ContentPartImage.d.ts +0 -4
- package/dist/primitives/contentPart/ContentPartImage.d.ts.map +1 -1
- package/dist/primitives/contentPart/ContentPartImage.js.map +1 -1
- package/dist/primitives/contentPart/ContentPartImage.mjs.map +1 -1
- package/dist/primitives/contentPart/ContentPartInProgress.d.ts +0 -4
- package/dist/primitives/contentPart/ContentPartInProgress.d.ts.map +1 -1
- package/dist/primitives/contentPart/ContentPartInProgress.js.map +1 -1
- package/dist/primitives/contentPart/ContentPartInProgress.mjs.map +1 -1
- package/dist/primitives/contentPart/ContentPartText.d.ts +0 -4
- package/dist/primitives/contentPart/ContentPartText.d.ts.map +1 -1
- package/dist/primitives/contentPart/ContentPartText.js.map +1 -1
- package/dist/primitives/contentPart/ContentPartText.mjs.map +1 -1
- package/dist/primitives/index.d.ts +0 -7
- package/dist/primitives/index.d.ts.map +1 -1
- package/dist/primitives/index.js.map +1 -1
- package/dist/primitives/index.mjs.map +1 -1
- package/dist/primitives/message/MessageAttachments.d.ts +0 -4
- package/dist/primitives/message/MessageAttachments.d.ts.map +1 -1
- package/dist/primitives/message/MessageAttachments.js +2 -4
- package/dist/primitives/message/MessageAttachments.js.map +1 -1
- package/dist/primitives/message/MessageAttachments.mjs +2 -4
- package/dist/primitives/message/MessageAttachments.mjs.map +1 -1
- package/dist/primitives/message/MessageContent.d.ts +0 -4
- package/dist/primitives/message/MessageContent.d.ts.map +1 -1
- package/dist/primitives/message/MessageContent.js +6 -6
- package/dist/primitives/message/MessageContent.js.map +1 -1
- package/dist/primitives/message/MessageContent.mjs +7 -7
- package/dist/primitives/message/MessageContent.mjs.map +1 -1
- package/dist/primitives/message/MessageIf.d.ts +0 -4
- package/dist/primitives/message/MessageIf.d.ts.map +1 -1
- package/dist/primitives/message/MessageIf.js.map +1 -1
- package/dist/primitives/message/MessageIf.mjs.map +1 -1
- package/dist/primitives/message/MessageRoot.d.ts +0 -4
- package/dist/primitives/message/MessageRoot.d.ts.map +1 -1
- package/dist/primitives/message/MessageRoot.js.map +1 -1
- package/dist/primitives/message/MessageRoot.mjs.map +1 -1
- package/dist/primitives/message/index.d.ts +0 -1
- package/dist/primitives/message/index.d.ts.map +1 -1
- package/dist/primitives/message/index.js +0 -3
- package/dist/primitives/message/index.js.map +1 -1
- package/dist/primitives/message/index.mjs +0 -2
- package/dist/primitives/message/index.mjs.map +1 -1
- package/dist/primitives/thread/ThreadEmpty.d.ts +0 -4
- package/dist/primitives/thread/ThreadEmpty.d.ts.map +1 -1
- package/dist/primitives/thread/ThreadEmpty.js +2 -2
- package/dist/primitives/thread/ThreadEmpty.js.map +1 -1
- package/dist/primitives/thread/ThreadEmpty.mjs +1 -1
- package/dist/primitives/thread/ThreadEmpty.mjs.map +1 -1
- package/dist/primitives/thread/ThreadIf.d.ts +0 -4
- package/dist/primitives/thread/ThreadIf.d.ts.map +1 -1
- package/dist/primitives/thread/ThreadIf.js.map +1 -1
- package/dist/primitives/thread/ThreadIf.mjs.map +1 -1
- package/dist/primitives/thread/ThreadMessages.d.ts +0 -4
- package/dist/primitives/thread/ThreadMessages.d.ts.map +1 -1
- package/dist/primitives/thread/ThreadMessages.js.map +1 -1
- package/dist/primitives/thread/ThreadMessages.mjs.map +1 -1
- package/dist/primitives/thread/ThreadRoot.d.ts +0 -4
- package/dist/primitives/thread/ThreadRoot.d.ts.map +1 -1
- package/dist/primitives/thread/ThreadRoot.js.map +1 -1
- package/dist/primitives/thread/ThreadRoot.mjs.map +1 -1
- package/dist/primitives/thread/ThreadScrollToBottom.d.ts +0 -4
- package/dist/primitives/thread/ThreadScrollToBottom.d.ts.map +1 -1
- package/dist/primitives/thread/ThreadScrollToBottom.js.map +1 -1
- package/dist/primitives/thread/ThreadScrollToBottom.mjs.map +1 -1
- package/dist/primitives/thread/ThreadSuggestion.d.ts +0 -4
- package/dist/primitives/thread/ThreadSuggestion.d.ts.map +1 -1
- package/dist/primitives/thread/ThreadSuggestion.js.map +1 -1
- package/dist/primitives/thread/ThreadSuggestion.mjs.map +1 -1
- package/dist/primitives/thread/ThreadViewport.d.ts +0 -4
- package/dist/primitives/thread/ThreadViewport.d.ts.map +1 -1
- package/dist/primitives/thread/ThreadViewport.js.map +1 -1
- package/dist/primitives/thread/ThreadViewport.mjs.map +1 -1
- package/dist/primitives/threadListItem/ThreadListItemArchive.d.ts.map +1 -1
- package/dist/primitives/threadListItem/ThreadListItemArchive.js +3 -2
- package/dist/primitives/threadListItem/ThreadListItemArchive.js.map +1 -1
- package/dist/primitives/threadListItem/ThreadListItemArchive.mjs +3 -2
- package/dist/primitives/threadListItem/ThreadListItemArchive.mjs.map +1 -1
- package/dist/primitives/threadListItem/ThreadListItemRoot.d.ts +14 -0
- package/dist/primitives/threadListItem/ThreadListItemRoot.d.ts.map +1 -0
- package/dist/primitives/threadListItem/ThreadListItemRoot.js +47 -0
- package/dist/primitives/threadListItem/ThreadListItemRoot.js.map +1 -0
- package/dist/primitives/threadListItem/ThreadListItemRoot.mjs +23 -0
- package/dist/primitives/threadListItem/ThreadListItemRoot.mjs.map +1 -0
- package/dist/primitives/threadListItem/ThreadListItemTitle.d.ts +8 -0
- package/dist/primitives/threadListItem/ThreadListItemTitle.d.ts.map +1 -0
- package/dist/primitives/{message/MessageInProgress.js → threadListItem/ThreadListItemTitle.js} +13 -10
- package/dist/primitives/threadListItem/ThreadListItemTitle.js.map +1 -0
- package/dist/primitives/threadListItem/ThreadListItemTitle.mjs +14 -0
- package/dist/primitives/threadListItem/ThreadListItemTitle.mjs.map +1 -0
- package/dist/primitives/threadListItem/ThreadListItemTrigger.d.ts +13 -0
- package/dist/primitives/threadListItem/ThreadListItemTrigger.d.ts.map +1 -0
- package/dist/{runtimes/core/subscribeToMainThread.js → primitives/threadListItem/ThreadListItemTrigger.js} +17 -22
- package/dist/primitives/threadListItem/ThreadListItemTrigger.js.map +1 -0
- package/dist/primitives/threadListItem/ThreadListItemTrigger.mjs +21 -0
- package/dist/primitives/threadListItem/ThreadListItemTrigger.mjs.map +1 -0
- package/dist/primitives/threadListItem/index.d.ts +3 -0
- package/dist/primitives/threadListItem/index.d.ts.map +1 -1
- package/dist/primitives/threadListItem/index.js +9 -0
- package/dist/primitives/threadListItem/index.js.map +1 -1
- package/dist/primitives/threadListItem/index.mjs +6 -0
- package/dist/primitives/threadListItem/index.mjs.map +1 -1
- package/dist/runtimes/attachment/AttachmentAdapter.d.ts +3 -7
- package/dist/runtimes/attachment/AttachmentAdapter.d.ts.map +1 -1
- package/dist/runtimes/attachment/AttachmentAdapter.js.map +1 -1
- package/dist/runtimes/attachment/CompositeAttachmentAdapter.d.ts +2 -6
- package/dist/runtimes/attachment/CompositeAttachmentAdapter.d.ts.map +1 -1
- package/dist/runtimes/attachment/CompositeAttachmentAdapter.js +1 -2
- package/dist/runtimes/attachment/CompositeAttachmentAdapter.js.map +1 -1
- package/dist/runtimes/attachment/CompositeAttachmentAdapter.mjs +1 -2
- package/dist/runtimes/attachment/CompositeAttachmentAdapter.mjs.map +1 -1
- package/dist/runtimes/composer/BaseComposerRuntimeCore.d.ts.map +1 -1
- package/dist/runtimes/composer/BaseComposerRuntimeCore.js +0 -6
- package/dist/runtimes/composer/BaseComposerRuntimeCore.js.map +1 -1
- package/dist/runtimes/composer/BaseComposerRuntimeCore.mjs +0 -6
- package/dist/runtimes/composer/BaseComposerRuntimeCore.mjs.map +1 -1
- package/dist/runtimes/core/BaseThreadRuntimeCore.d.ts +5 -4
- package/dist/runtimes/core/BaseThreadRuntimeCore.d.ts.map +1 -1
- package/dist/runtimes/core/BaseThreadRuntimeCore.js +8 -4
- package/dist/runtimes/core/BaseThreadRuntimeCore.js.map +1 -1
- package/dist/runtimes/core/BaseThreadRuntimeCore.mjs +8 -4
- package/dist/runtimes/core/BaseThreadRuntimeCore.mjs.map +1 -1
- package/dist/runtimes/core/ComposerRuntimeCore.d.ts +0 -3
- package/dist/runtimes/core/ComposerRuntimeCore.d.ts.map +1 -1
- package/dist/runtimes/core/ComposerRuntimeCore.js.map +1 -1
- package/dist/runtimes/core/ThreadListRuntimeCore.d.ts +7 -10
- 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 +14 -1
- 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 -2
- package/dist/runtimes/core/index.d.ts.map +1 -1
- package/dist/runtimes/core/index.js +0 -12
- package/dist/runtimes/core/index.js.map +1 -1
- package/dist/runtimes/core/index.mjs +0 -5
- package/dist/runtimes/core/index.mjs.map +1 -1
- package/dist/runtimes/edge/converters/toCoreMessages.d.ts +1 -1
- package/dist/runtimes/edge/converters/toCoreMessages.d.ts.map +1 -1
- package/dist/runtimes/edge/converters/toCoreMessages.js.map +1 -1
- package/dist/runtimes/edge/converters/toCoreMessages.mjs.map +1 -1
- package/dist/runtimes/edge/createEdgeRuntimeAPI.d.ts +0 -4
- package/dist/runtimes/edge/createEdgeRuntimeAPI.d.ts.map +1 -1
- package/dist/runtimes/edge/createEdgeRuntimeAPI.js +0 -2
- package/dist/runtimes/edge/createEdgeRuntimeAPI.js.map +1 -1
- package/dist/runtimes/edge/createEdgeRuntimeAPI.mjs +0 -2
- package/dist/runtimes/edge/createEdgeRuntimeAPI.mjs.map +1 -1
- package/dist/runtimes/edge/streams/runResultStream.js +0 -2
- package/dist/runtimes/edge/streams/runResultStream.js.map +1 -1
- package/dist/runtimes/edge/streams/runResultStream.mjs +0 -2
- package/dist/runtimes/edge/streams/runResultStream.mjs.map +1 -1
- package/dist/runtimes/external-store/ExternalStoreAdapter.d.ts +3 -16
- 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.map +1 -1
- package/dist/runtimes/external-store/ExternalStoreRuntimeCore.js +0 -3
- package/dist/runtimes/external-store/ExternalStoreRuntimeCore.js.map +1 -1
- package/dist/runtimes/external-store/ExternalStoreRuntimeCore.mjs +0 -3
- 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 +29 -7
- package/dist/runtimes/external-store/ExternalStoreThreadListRuntimeCore.js.map +1 -1
- package/dist/runtimes/external-store/ExternalStoreThreadListRuntimeCore.mjs +29 -7
- package/dist/runtimes/external-store/ExternalStoreThreadListRuntimeCore.mjs.map +1 -1
- package/dist/runtimes/external-store/ExternalStoreThreadRuntimeCore.d.ts +0 -1
- package/dist/runtimes/external-store/ExternalStoreThreadRuntimeCore.d.ts.map +1 -1
- package/dist/runtimes/external-store/ExternalStoreThreadRuntimeCore.js +4 -3
- package/dist/runtimes/external-store/ExternalStoreThreadRuntimeCore.js.map +1 -1
- package/dist/runtimes/external-store/ExternalStoreThreadRuntimeCore.mjs +4 -3
- package/dist/runtimes/external-store/ExternalStoreThreadRuntimeCore.mjs.map +1 -1
- package/dist/runtimes/external-store/ThreadMessageLike.d.ts.map +1 -1
- package/dist/runtimes/external-store/ThreadMessageLike.js +2 -0
- package/dist/runtimes/external-store/ThreadMessageLike.js.map +1 -1
- package/dist/runtimes/external-store/ThreadMessageLike.mjs +2 -0
- package/dist/runtimes/external-store/ThreadMessageLike.mjs.map +1 -1
- package/dist/runtimes/local/ChatModelAdapter.d.ts +0 -8
- package/dist/runtimes/local/ChatModelAdapter.d.ts.map +1 -1
- package/dist/runtimes/local/ChatModelAdapter.js.map +1 -1
- package/dist/runtimes/local/LocalRuntimeOptions.d.ts +1 -6
- package/dist/runtimes/local/LocalRuntimeOptions.d.ts.map +1 -1
- package/dist/runtimes/local/LocalRuntimeOptions.js +1 -2
- package/dist/runtimes/local/LocalRuntimeOptions.js.map +1 -1
- package/dist/runtimes/local/LocalRuntimeOptions.mjs +1 -2
- package/dist/runtimes/local/LocalRuntimeOptions.mjs.map +1 -1
- package/dist/runtimes/local/LocalThreadListRuntimeCore.d.ts +16 -20
- package/dist/runtimes/local/LocalThreadListRuntimeCore.d.ts.map +1 -1
- package/dist/runtimes/local/LocalThreadListRuntimeCore.js +112 -72
- package/dist/runtimes/local/LocalThreadListRuntimeCore.js.map +1 -1
- package/dist/runtimes/local/LocalThreadListRuntimeCore.mjs +112 -72
- package/dist/runtimes/local/LocalThreadListRuntimeCore.mjs.map +1 -1
- package/dist/runtimes/local/LocalThreadMetadataRuntimeCore.d.ts +19 -0
- package/dist/runtimes/local/LocalThreadMetadataRuntimeCore.d.ts.map +1 -0
- package/dist/runtimes/local/LocalThreadMetadataRuntimeCore.js +87 -0
- package/dist/runtimes/local/LocalThreadMetadataRuntimeCore.js.map +1 -0
- package/dist/runtimes/local/LocalThreadMetadataRuntimeCore.mjs +62 -0
- package/dist/runtimes/local/LocalThreadMetadataRuntimeCore.mjs.map +1 -0
- package/dist/runtimes/local/LocalThreadRuntimeCore.d.ts +1 -1
- package/dist/runtimes/local/LocalThreadRuntimeCore.d.ts.map +1 -1
- package/dist/runtimes/local/LocalThreadRuntimeCore.js +15 -11
- package/dist/runtimes/local/LocalThreadRuntimeCore.js.map +1 -1
- package/dist/runtimes/local/LocalThreadRuntimeCore.mjs +15 -11
- package/dist/runtimes/local/LocalThreadRuntimeCore.mjs.map +1 -1
- package/dist/styles/index.css.map +1 -1
- package/dist/types/AssistantTypes.d.ts +1 -18
- package/dist/types/AssistantTypes.d.ts.map +1 -1
- package/dist/types/AssistantTypes.js.map +1 -1
- package/dist/types/AttachmentTypes.d.ts +1 -1
- package/dist/types/AttachmentTypes.d.ts.map +1 -1
- package/dist/types/AttachmentTypes.js.map +1 -1
- package/dist/types/ContentPartComponentTypes.d.ts +4 -28
- package/dist/types/ContentPartComponentTypes.d.ts.map +1 -1
- package/dist/types/ContentPartComponentTypes.js.map +1 -1
- package/dist/ui/assistant-message.d.ts +1 -10
- package/dist/ui/assistant-message.d.ts.map +1 -1
- package/dist/ui/assistant-message.js.map +1 -1
- package/dist/ui/assistant-message.mjs.map +1 -1
- package/dist/ui/composer.d.ts +1 -25
- package/dist/ui/composer.d.ts.map +1 -1
- package/dist/ui/composer.js.map +1 -1
- package/dist/ui/composer.mjs.map +1 -1
- package/dist/ui/index.d.ts +6 -14
- package/dist/ui/index.d.ts.map +1 -1
- package/dist/ui/index.js +0 -4
- package/dist/ui/index.js.map +1 -1
- package/dist/ui/index.mjs +14 -24
- package/dist/ui/index.mjs.map +1 -1
- package/dist/ui/thread-welcome.d.ts +5 -17
- package/dist/ui/thread-welcome.d.ts.map +1 -1
- package/dist/ui/thread-welcome.js.map +1 -1
- package/dist/ui/thread-welcome.mjs.map +1 -1
- package/dist/ui/thread.d.ts +1 -19
- package/dist/ui/thread.d.ts.map +1 -1
- package/dist/ui/thread.js.map +1 -1
- package/dist/ui/thread.mjs.map +1 -1
- package/dist/ui/user-message.d.ts +1 -18
- package/dist/ui/user-message.d.ts.map +1 -1
- package/dist/ui/user-message.js.map +1 -1
- package/dist/ui/user-message.mjs.map +1 -1
- package/dist/utils/smooth/SmoothContext.js +2 -2
- package/dist/utils/smooth/SmoothContext.js.map +1 -1
- package/dist/utils/smooth/SmoothContext.mjs +3 -3
- package/dist/utils/smooth/SmoothContext.mjs.map +1 -1
- package/dist/utils/smooth/useSmooth.d.ts.map +1 -1
- package/dist/utils/smooth/useSmooth.js +0 -1
- package/dist/utils/smooth/useSmooth.js.map +1 -1
- package/dist/utils/smooth/useSmooth.mjs +0 -1
- package/dist/utils/smooth/useSmooth.mjs.map +1 -1
- package/package.json +5 -5
- package/src/api/AssistantRuntime.ts +1 -23
- package/src/api/AttachmentRuntime.ts +0 -12
- package/src/api/ComposerRuntime.ts +11 -207
- package/src/api/ContentPartRuntime.ts +0 -4
- package/src/api/MessageRuntime.ts +7 -11
- package/src/api/ThreadListItemRuntime.ts +16 -8
- package/src/api/ThreadListRuntime.ts +34 -53
- package/src/api/ThreadRuntime.ts +11 -203
- package/src/context/providers/AssistantRuntimeProvider.tsx +0 -1
- package/src/context/providers/TextContentPartProvider.tsx +0 -2
- package/src/context/providers/ThreadRuntimeProvider.tsx +1 -17
- package/src/context/react/AssistantContext.ts +0 -25
- package/src/context/react/ComposerContext.ts +1 -1
- package/src/context/react/ContentPartContext.ts +1 -1
- package/src/context/react/MessageContext.ts +2 -2
- package/src/context/react/ThreadContext.ts +5 -42
- package/src/context/react/index.ts +2 -125
- package/src/index.ts +0 -1
- package/src/internal.ts +1 -0
- package/src/model-config/useAssistantToolUI.tsx +0 -1
- package/src/primitive-hooks/contentPart/useContentPartDisplay.tsx +1 -1
- package/src/primitive-hooks/contentPart/useContentPartImage.tsx +1 -2
- package/src/primitive-hooks/contentPart/useContentPartText.tsx +1 -1
- package/src/primitive-hooks/index.ts +0 -5
- package/src/primitives/actionBar/ActionBarCopy.tsx +0 -5
- package/src/primitives/actionBar/ActionBarEdit.tsx +0 -5
- package/src/primitives/actionBar/ActionBarFeedbackNegative.tsx +0 -6
- package/src/primitives/actionBar/ActionBarFeedbackPositive.tsx +0 -6
- package/src/primitives/actionBar/ActionBarReload.tsx +0 -5
- package/src/primitives/actionBar/ActionBarRoot.tsx +0 -5
- package/src/primitives/actionBar/ActionBarSpeak.tsx +0 -5
- package/src/primitives/actionBar/ActionBarStopSpeaking.tsx +0 -6
- package/src/primitives/assistantModal/AssistantModalContent.tsx +1 -7
- package/src/primitives/assistantModal/AssistantModalRoot.tsx +0 -6
- package/src/primitives/assistantModal/AssistantModalTrigger.tsx +0 -6
- package/src/primitives/branchPicker/BranchPickerCount.tsx +0 -5
- package/src/primitives/branchPicker/BranchPickerNext.tsx +0 -6
- package/src/primitives/branchPicker/BranchPickerNumber.tsx +0 -5
- package/src/primitives/branchPicker/BranchPickerPrevious.tsx +1 -6
- package/src/primitives/branchPicker/BranchPickerRoot.tsx +0 -5
- package/src/primitives/composer/ComposerAddAttachment.tsx +2 -7
- package/src/primitives/composer/ComposerAttachments.tsx +0 -6
- package/src/primitives/composer/ComposerCancel.tsx +0 -5
- package/src/primitives/composer/ComposerIf.tsx +0 -5
- package/src/primitives/composer/ComposerInput.tsx +0 -5
- package/src/primitives/composer/ComposerRoot.tsx +1 -3
- package/src/primitives/composer/ComposerSend.tsx +2 -7
- package/src/primitives/contentPart/ContentPartDisplay.tsx +0 -6
- package/src/primitives/contentPart/ContentPartImage.tsx +0 -5
- package/src/primitives/contentPart/ContentPartInProgress.tsx +0 -6
- package/src/primitives/contentPart/ContentPartText.tsx +0 -5
- package/src/primitives/index.ts +0 -8
- package/src/primitives/message/MessageAttachments.tsx +2 -10
- package/src/primitives/message/MessageContent.tsx +7 -15
- package/src/primitives/message/MessageIf.tsx +0 -5
- package/src/primitives/message/MessageRoot.tsx +0 -5
- package/src/primitives/message/index.ts +0 -1
- package/src/primitives/thread/ThreadEmpty.tsx +1 -6
- package/src/primitives/thread/ThreadIf.tsx +0 -5
- package/src/primitives/thread/ThreadMessages.tsx +0 -5
- package/src/primitives/thread/ThreadRoot.tsx +0 -5
- package/src/primitives/thread/ThreadScrollToBottom.tsx +0 -6
- package/src/primitives/thread/ThreadSuggestion.tsx +0 -5
- package/src/primitives/thread/ThreadViewport.tsx +0 -5
- package/src/primitives/threadListItem/ThreadListItemArchive.ts +3 -2
- package/src/primitives/threadListItem/ThreadListItemRoot.tsx +29 -0
- package/src/primitives/threadListItem/ThreadListItemTitle.tsx +19 -0
- package/src/primitives/threadListItem/ThreadListItemTrigger.ts +25 -0
- package/src/primitives/threadListItem/index.ts +4 -1
- package/src/runtimes/attachment/AttachmentAdapter.ts +2 -12
- package/src/runtimes/attachment/CompositeAttachmentAdapter.ts +1 -1
- package/src/runtimes/composer/BaseComposerRuntimeCore.tsx +0 -8
- package/src/runtimes/core/BaseThreadRuntimeCore.tsx +11 -5
- package/src/runtimes/core/ComposerRuntimeCore.tsx +0 -3
- package/src/runtimes/core/ThreadListRuntimeCore.tsx +7 -11
- package/src/runtimes/core/ThreadRuntimeCore.tsx +18 -1
- package/src/runtimes/core/index.ts +1 -2
- package/src/runtimes/edge/converters/toCoreMessages.ts +1 -1
- package/src/runtimes/edge/createEdgeRuntimeAPI.ts +0 -6
- package/src/runtimes/edge/streams/runResultStream.ts +0 -2
- package/src/runtimes/external-store/ExternalStoreAdapter.tsx +3 -17
- package/src/runtimes/external-store/ExternalStoreRuntimeCore.tsx +0 -3
- package/src/runtimes/external-store/ExternalStoreThreadListRuntimeCore.tsx +39 -7
- package/src/runtimes/external-store/ExternalStoreThreadRuntimeCore.tsx +4 -3
- package/src/runtimes/external-store/ThreadMessageLike.tsx +4 -3
- package/src/runtimes/local/ChatModelAdapter.tsx +0 -9
- package/src/runtimes/local/LocalRuntimeOptions.tsx +1 -7
- package/src/runtimes/local/LocalThreadListRuntimeCore.tsx +140 -96
- package/src/runtimes/local/LocalThreadMetadataRuntimeCore.tsx +79 -0
- package/src/runtimes/local/LocalThreadRuntimeCore.tsx +16 -11
- package/src/types/AssistantTypes.ts +1 -20
- package/src/types/AttachmentTypes.ts +1 -2
- package/src/types/ContentPartComponentTypes.tsx +4 -31
- package/src/ui/assistant-message.tsx +0 -5
- package/src/ui/composer.tsx +0 -5
- package/src/ui/index.ts +5 -23
- package/src/ui/thread-welcome.tsx +6 -9
- package/src/ui/thread.tsx +0 -5
- package/src/ui/user-message.tsx +2 -12
- package/src/utils/smooth/SmoothContext.tsx +3 -3
- package/src/utils/smooth/useSmooth.tsx +0 -1
- package/dist/hooks/index.d.ts +0 -3
- package/dist/hooks/index.d.ts.map +0 -1
- package/dist/hooks/index.js +0 -34
- package/dist/hooks/index.js.map +0 -1
- package/dist/hooks/index.mjs +0 -8
- package/dist/hooks/index.mjs.map +0 -1
- package/dist/hooks/useAppendMessage.d.ts +0 -6
- package/dist/hooks/useAppendMessage.d.ts.map +0 -1
- package/dist/hooks/useAppendMessage.js +0 -42
- package/dist/hooks/useAppendMessage.js.map +0 -1
- package/dist/hooks/useAppendMessage.mjs +0 -17
- package/dist/hooks/useAppendMessage.mjs.map +0 -1
- package/dist/hooks/useSwitchToNewThread.d.ts +0 -5
- package/dist/hooks/useSwitchToNewThread.d.ts.map +0 -1
- package/dist/hooks/useSwitchToNewThread.js +0 -39
- package/dist/hooks/useSwitchToNewThread.js.map +0 -1
- package/dist/hooks/useSwitchToNewThread.mjs +0 -14
- package/dist/hooks/useSwitchToNewThread.mjs.map +0 -1
- package/dist/primitive-hooks/actionBar/index.d.ts +0 -34
- package/dist/primitive-hooks/actionBar/index.d.ts.map +0 -1
- package/dist/primitive-hooks/actionBar/index.js +0 -49
- package/dist/primitive-hooks/actionBar/index.js.map +0 -1
- package/dist/primitive-hooks/actionBar/index.mjs +0 -20
- package/dist/primitive-hooks/actionBar/index.mjs.map +0 -1
- package/dist/primitive-hooks/branchPicker/index.d.ts +0 -17
- package/dist/primitive-hooks/branchPicker/index.d.ts.map +0 -1
- package/dist/primitive-hooks/branchPicker/index.js +0 -40
- package/dist/primitive-hooks/branchPicker/index.js.map +0 -1
- package/dist/primitive-hooks/branchPicker/index.mjs +0 -12
- package/dist/primitive-hooks/branchPicker/index.mjs.map +0 -1
- package/dist/primitive-hooks/composer/index.d.ts +0 -17
- package/dist/primitive-hooks/composer/index.d.ts.map +0 -1
- package/dist/primitive-hooks/composer/index.js +0 -40
- package/dist/primitive-hooks/composer/index.js.map +0 -1
- package/dist/primitive-hooks/composer/index.mjs +0 -12
- package/dist/primitive-hooks/composer/index.mjs.map +0 -1
- package/dist/primitive-hooks/message/index.d.ts +0 -5
- package/dist/primitive-hooks/message/index.d.ts.map +0 -1
- package/dist/primitive-hooks/message/index.js +0 -31
- package/dist/primitive-hooks/message/index.js.map +0 -1
- package/dist/primitive-hooks/message/index.mjs +0 -6
- package/dist/primitive-hooks/message/index.mjs.map +0 -1
- package/dist/primitive-hooks/thread/index.d.ts +0 -17
- package/dist/primitive-hooks/thread/index.d.ts.map +0 -1
- package/dist/primitive-hooks/thread/index.js +0 -40
- package/dist/primitive-hooks/thread/index.js.map +0 -1
- package/dist/primitive-hooks/thread/index.mjs +0 -12
- package/dist/primitive-hooks/thread/index.mjs.map +0 -1
- package/dist/primitives/actionBar/types.d.ts +0 -9
- package/dist/primitives/actionBar/types.d.ts.map +0 -1
- package/dist/primitives/actionBar/types.js +0 -19
- package/dist/primitives/actionBar/types.js.map +0 -1
- package/dist/primitives/actionBar/types.mjs +0 -1
- package/dist/primitives/actionBar/types.mjs.map +0 -1
- package/dist/primitives/assistantModal/types.d.ts +0 -4
- package/dist/primitives/assistantModal/types.d.ts.map +0 -1
- package/dist/primitives/assistantModal/types.js +0 -19
- package/dist/primitives/assistantModal/types.js.map +0 -1
- package/dist/primitives/assistantModal/types.mjs +0 -1
- package/dist/primitives/assistantModal/types.mjs.map +0 -1
- package/dist/primitives/attachment/types.d.ts +0 -1
- package/dist/primitives/attachment/types.d.ts.map +0 -1
- package/dist/primitives/attachment/types.js +0 -2
- package/dist/primitives/attachment/types.js.map +0 -1
- package/dist/primitives/attachment/types.mjs +0 -1
- package/dist/primitives/attachment/types.mjs.map +0 -1
- package/dist/primitives/branchPicker/types.d.ts +0 -6
- package/dist/primitives/branchPicker/types.d.ts.map +0 -1
- package/dist/primitives/branchPicker/types.js +0 -19
- package/dist/primitives/branchPicker/types.js.map +0 -1
- package/dist/primitives/branchPicker/types.mjs +0 -1
- package/dist/primitives/branchPicker/types.mjs.map +0 -1
- package/dist/primitives/composer/types.d.ts +0 -6
- package/dist/primitives/composer/types.d.ts.map +0 -1
- package/dist/primitives/composer/types.js +0 -19
- package/dist/primitives/composer/types.js.map +0 -1
- package/dist/primitives/composer/types.mjs +0 -1
- package/dist/primitives/composer/types.mjs.map +0 -1
- package/dist/primitives/contentPart/types.d.ts +0 -5
- package/dist/primitives/contentPart/types.d.ts.map +0 -1
- package/dist/primitives/contentPart/types.js +0 -19
- package/dist/primitives/contentPart/types.js.map +0 -1
- package/dist/primitives/contentPart/types.mjs +0 -1
- package/dist/primitives/contentPart/types.mjs.map +0 -1
- package/dist/primitives/message/MessageInProgress.d.ts +0 -13
- package/dist/primitives/message/MessageInProgress.d.ts.map +0 -1
- package/dist/primitives/message/MessageInProgress.js.map +0 -1
- package/dist/primitives/message/MessageInProgress.mjs +0 -11
- package/dist/primitives/message/MessageInProgress.mjs.map +0 -1
- package/dist/primitives/message/types.d.ts +0 -5
- package/dist/primitives/message/types.d.ts.map +0 -1
- package/dist/primitives/message/types.js +0 -19
- package/dist/primitives/message/types.js.map +0 -1
- package/dist/primitives/message/types.mjs +0 -1
- package/dist/primitives/message/types.mjs.map +0 -1
- package/dist/primitives/thread/types.d.ts +0 -8
- package/dist/primitives/thread/types.d.ts.map +0 -1
- package/dist/primitives/thread/types.js +0 -19
- package/dist/primitives/thread/types.js.map +0 -1
- package/dist/primitives/thread/types.mjs +0 -1
- package/dist/primitives/thread/types.mjs.map +0 -1
- package/dist/runtimes/core/subscribeToMainThread.d.ts +0 -6
- package/dist/runtimes/core/subscribeToMainThread.d.ts.map +0 -1
- package/dist/runtimes/core/subscribeToMainThread.js.map +0 -1
- package/dist/runtimes/core/subscribeToMainThread.mjs +0 -23
- package/dist/runtimes/core/subscribeToMainThread.mjs.map +0 -1
- package/src/hooks/index.ts +0 -2
- package/src/hooks/useAppendMessage.tsx +0 -19
- package/src/hooks/useSwitchToNewThread.tsx +0 -14
- package/src/primitive-hooks/actionBar/index.ts +0 -39
- package/src/primitive-hooks/branchPicker/index.ts +0 -18
- package/src/primitive-hooks/composer/index.ts +0 -17
- package/src/primitive-hooks/message/index.ts +0 -4
- package/src/primitive-hooks/thread/index.ts +0 -16
- package/src/primitives/actionBar/types.ts +0 -8
- package/src/primitives/assistantModal/types.ts +0 -3
- package/src/primitives/attachment/types.ts +0 -0
- package/src/primitives/branchPicker/types.ts +0 -5
- package/src/primitives/composer/types.ts +0 -5
- package/src/primitives/contentPart/types.ts +0 -4
- package/src/primitives/message/MessageInProgress.tsx +0 -22
- package/src/primitives/message/types.ts +0 -4
- package/src/primitives/thread/types.ts +0 -7
- package/src/runtimes/core/subscribeToMainThread.ts +0 -30
@@ -4,12 +4,26 @@ import {
|
|
4
4
|
ThreadListItemRuntimeImpl
|
5
5
|
} from "./ThreadListItemRuntime.mjs";
|
6
6
|
import { SKIP_UPDATE } from "./subscribable/SKIP_UPDATE.mjs";
|
7
|
+
import { ShallowMemoizeSubject } from "./subscribable/ShallowMemoizeSubject.mjs";
|
7
8
|
var getThreadListState = (threadList) => {
|
8
9
|
return {
|
10
|
+
mainThreadId: threadList.mainThread.metadata.threadId,
|
11
|
+
newThread: threadList.newThread,
|
9
12
|
threads: threadList.threads,
|
10
13
|
archivedThreads: threadList.archivedThreads
|
11
14
|
};
|
12
15
|
};
|
16
|
+
var getThreadListItemState = (threadList, threadId) => {
|
17
|
+
if (threadId === void 0) return SKIP_UPDATE;
|
18
|
+
const threadData = threadList.getThreadMetadataById(threadId);
|
19
|
+
if (!threadData) return SKIP_UPDATE;
|
20
|
+
return {
|
21
|
+
threadId: threadData.threadId,
|
22
|
+
title: threadData.title,
|
23
|
+
state: threadData.state,
|
24
|
+
isMain: threadList.mainThread.metadata.threadId === threadId
|
25
|
+
};
|
26
|
+
};
|
13
27
|
var THREAD_MANAGER_PATH = {
|
14
28
|
ref: "ThreadList"
|
15
29
|
};
|
@@ -30,33 +44,18 @@ var ThreadListRuntimeImpl = class {
|
|
30
44
|
getState() {
|
31
45
|
return this._getState();
|
32
46
|
}
|
33
|
-
rename(threadId, newTitle) {
|
34
|
-
return this._core.rename(threadId, newTitle);
|
35
|
-
}
|
36
|
-
archive(threadId) {
|
37
|
-
return this._core.archive(threadId);
|
38
|
-
}
|
39
|
-
unarchive(threadId) {
|
40
|
-
return this._core.unarchive(threadId);
|
41
|
-
}
|
42
|
-
delete(threadId) {
|
43
|
-
return this._core.delete(threadId);
|
44
|
-
}
|
45
47
|
subscribe(callback) {
|
46
48
|
return this._core.subscribe(callback);
|
47
49
|
}
|
48
50
|
getThreadListItemByIndex(idx) {
|
49
51
|
return new ThreadListItemRuntimeImpl(
|
50
|
-
new
|
52
|
+
new ShallowMemoizeSubject({
|
51
53
|
path: {
|
52
54
|
ref: this.path.ref + `${this.path.ref}.threadItems[${idx}]`,
|
53
55
|
threadSelector: { type: "index", index: idx }
|
54
56
|
},
|
55
57
|
getState: () => {
|
56
|
-
|
57
|
-
const thread = threads[idx];
|
58
|
-
if (!thread) return SKIP_UPDATE;
|
59
|
-
return thread;
|
58
|
+
return getThreadListItemState(this._core, this._core.threads[idx]);
|
60
59
|
},
|
61
60
|
subscribe: (callback) => this._core.subscribe(callback)
|
62
61
|
}),
|
@@ -65,16 +64,16 @@ var ThreadListRuntimeImpl = class {
|
|
65
64
|
}
|
66
65
|
getThreadListArchivedItemByIndex(idx) {
|
67
66
|
return new ThreadListItemRuntimeImpl(
|
68
|
-
new
|
67
|
+
new ShallowMemoizeSubject({
|
69
68
|
path: {
|
70
69
|
ref: this.path.ref + `${this.path.ref}.archivedThreadItems[${idx}]`,
|
71
70
|
threadSelector: { type: "archiveIndex", index: idx }
|
72
71
|
},
|
73
72
|
getState: () => {
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
73
|
+
return getThreadListItemState(
|
74
|
+
this._core,
|
75
|
+
this._core.archivedThreads[idx]
|
76
|
+
);
|
78
77
|
},
|
79
78
|
subscribe: (callback) => this._core.subscribe(callback)
|
80
79
|
}),
|
@@ -83,15 +82,13 @@ var ThreadListRuntimeImpl = class {
|
|
83
82
|
}
|
84
83
|
getThreadListItemById(threadId) {
|
85
84
|
return new ThreadListItemRuntimeImpl(
|
86
|
-
new
|
85
|
+
new ShallowMemoizeSubject({
|
87
86
|
path: {
|
88
87
|
ref: this.path.ref + `${this.path.ref}.threadItems[threadId=${threadId}]`,
|
89
88
|
threadSelector: { type: "threadId", threadId }
|
90
89
|
},
|
91
90
|
getState: () => {
|
92
|
-
|
93
|
-
if (!threadItem) return SKIP_UPDATE;
|
94
|
-
return threadItem;
|
91
|
+
return getThreadListItemState(this._core, threadId);
|
95
92
|
},
|
96
93
|
subscribe: (callback) => this._core.subscribe(callback)
|
97
94
|
}),
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../src/api/ThreadListRuntime.ts"],"sourcesContent":["import { LazyMemoizeSubject } from \"./subscribable/LazyMemoizeSubject\";\nimport {
|
1
|
+
{"version":3,"sources":["../../src/api/ThreadListRuntime.ts"],"sourcesContent":["import { LazyMemoizeSubject } from \"./subscribable/LazyMemoizeSubject\";\nimport { ThreadListRuntimeCore } from \"../runtimes/core/ThreadListRuntimeCore\";\nimport { Unsubscribe } from \"../types\";\nimport { ThreadListRuntimePath } from \"./RuntimePathTypes\";\nimport {\n ThreadListItemRuntime,\n ThreadListItemRuntimeImpl,\n ThreadListItemState,\n} from \"./ThreadListItemRuntime\";\nimport { SKIP_UPDATE } from \"./subscribable/SKIP_UPDATE\";\nimport { ShallowMemoizeSubject } from \"./subscribable/ShallowMemoizeSubject\";\n\nexport type ThreadListState = Readonly<{\n mainThreadId: string;\n newThread: string | undefined;\n threads: readonly string[];\n archivedThreads: readonly string[];\n}>;\n\nexport type ThreadListRuntime = Readonly<{\n path: ThreadListRuntimePath;\n getState(): ThreadListState;\n\n subscribe(callback: () => void): Unsubscribe;\n\n getThreadListItemById(threadId: string): ThreadListItemRuntime;\n getThreadListItemByIndex(idx: number): ThreadListItemRuntime;\n getThreadListArchivedItemByIndex(idx: number): ThreadListItemRuntime;\n}>;\n\nconst getThreadListState = (\n threadList: ThreadListRuntimeCore,\n): ThreadListState => {\n return {\n mainThreadId: threadList.mainThread.metadata.threadId,\n newThread: threadList.newThread,\n threads: threadList.threads,\n archivedThreads: threadList.archivedThreads,\n };\n};\n\nconst getThreadListItemState = (\n threadList: ThreadListRuntimeCore,\n threadId: string | undefined,\n): ThreadListItemState | SKIP_UPDATE => {\n if (threadId === undefined) return SKIP_UPDATE;\n\n const threadData = threadList.getThreadMetadataById(threadId);\n if (!threadData) return SKIP_UPDATE;\n return {\n threadId: threadData.threadId,\n title: threadData.title,\n state: threadData.state,\n isMain: threadList.mainThread.metadata.threadId === threadId,\n };\n};\n\nconst THREAD_MANAGER_PATH = {\n ref: \"ThreadList\",\n};\n\nexport type ThreadListRuntimeCoreBinding = ThreadListRuntimeCore;\n\nexport class ThreadListRuntimeImpl implements ThreadListRuntime {\n public get path() {\n return THREAD_MANAGER_PATH;\n }\n\n private _getState;\n constructor(private _core: ThreadListRuntimeCoreBinding) {\n const stateBinding = new LazyMemoizeSubject({\n path: THREAD_MANAGER_PATH,\n getState: () => getThreadListState(_core),\n subscribe: (callback) => _core.subscribe(callback),\n });\n\n this._getState = stateBinding.getState.bind(stateBinding);\n }\n\n public getState(): ThreadListState {\n return this._getState();\n }\n\n public subscribe(callback: () => void): Unsubscribe {\n return this._core.subscribe(callback);\n }\n\n public getThreadListItemByIndex(idx: number) {\n return new ThreadListItemRuntimeImpl(\n new ShallowMemoizeSubject({\n path: {\n ref: this.path.ref + `${this.path.ref}.threadItems[${idx}]`,\n threadSelector: { type: \"index\", index: idx },\n },\n getState: () => {\n return getThreadListItemState(this._core, this._core.threads[idx]);\n },\n subscribe: (callback) => this._core.subscribe(callback),\n }),\n this._core,\n );\n }\n\n public getThreadListArchivedItemByIndex(idx: number) {\n return new ThreadListItemRuntimeImpl(\n new ShallowMemoizeSubject({\n path: {\n ref: this.path.ref + `${this.path.ref}.archivedThreadItems[${idx}]`,\n threadSelector: { type: \"archiveIndex\", index: idx },\n },\n getState: () => {\n return getThreadListItemState(\n this._core,\n this._core.archivedThreads[idx],\n );\n },\n subscribe: (callback) => this._core.subscribe(callback),\n }),\n this._core,\n );\n }\n\n public getThreadListItemById(threadId: string) {\n return new ThreadListItemRuntimeImpl(\n new ShallowMemoizeSubject({\n path: {\n ref:\n this.path.ref +\n `${this.path.ref}.threadItems[threadId=${threadId}]`,\n threadSelector: { type: \"threadId\", threadId },\n },\n getState: () => {\n return getThreadListItemState(this._core, threadId);\n },\n subscribe: (callback) => this._core.subscribe(callback),\n }),\n this._core,\n );\n }\n}\n"],"mappings":";AAAA,SAAS,0BAA0B;AAInC;AAAA,EAEE;AAAA,OAEK;AACP,SAAS,mBAAmB;AAC5B,SAAS,6BAA6B;AAoBtC,IAAM,qBAAqB,CACzB,eACoB;AACpB,SAAO;AAAA,IACL,cAAc,WAAW,WAAW,SAAS;AAAA,IAC7C,WAAW,WAAW;AAAA,IACtB,SAAS,WAAW;AAAA,IACpB,iBAAiB,WAAW;AAAA,EAC9B;AACF;AAEA,IAAM,yBAAyB,CAC7B,YACA,aACsC;AACtC,MAAI,aAAa,OAAW,QAAO;AAEnC,QAAM,aAAa,WAAW,sBAAsB,QAAQ;AAC5D,MAAI,CAAC,WAAY,QAAO;AACxB,SAAO;AAAA,IACL,UAAU,WAAW;AAAA,IACrB,OAAO,WAAW;AAAA,IAClB,OAAO,WAAW;AAAA,IAClB,QAAQ,WAAW,WAAW,SAAS,aAAa;AAAA,EACtD;AACF;AAEA,IAAM,sBAAsB;AAAA,EAC1B,KAAK;AACP;AAIO,IAAM,wBAAN,MAAyD;AAAA,EAM9D,YAAoB,OAAqC;AAArC;AAClB,UAAM,eAAe,IAAI,mBAAmB;AAAA,MAC1C,MAAM;AAAA,MACN,UAAU,MAAM,mBAAmB,KAAK;AAAA,MACxC,WAAW,CAAC,aAAa,MAAM,UAAU,QAAQ;AAAA,IACnD,CAAC;AAED,SAAK,YAAY,aAAa,SAAS,KAAK,YAAY;AAAA,EAC1D;AAAA,EAbA,IAAW,OAAO;AAChB,WAAO;AAAA,EACT;AAAA,EAEQ;AAAA,E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AAA,QACA,UAAU,MAAM;AACd,iBAAO,uBAAuB,KAAK,OAAO,QAAQ;AAAA,QACpD;AAAA,QACA,WAAW,CAAC,aAAa,KAAK,MAAM,UAAU,QAAQ;AAAA,MACxD,CAAC;AAAA,MACD,KAAK;AAAA,IACP;AAAA,EACF;AACF;","names":[]}
|
@@ -1,10 +1,9 @@
|
|
1
|
-
import {
|
1
|
+
import { ThreadSuggestion, RuntimeCapabilities, ThreadRuntimeCore, SpeechState, ThreadRuntimeEventType, ThreadMetadata } from "../runtimes/core/ThreadRuntimeCore";
|
2
2
|
import { ExportedMessageRepository } from "../runtimes/utils/MessageRepository";
|
3
3
|
import { AppendMessage, ModelConfig, ThreadMessage, Unsubscribe } from "../types";
|
4
4
|
import { MessageRuntime, MessageRuntimeImpl } from "./MessageRuntime";
|
5
5
|
import { SubscribableWithState } from "./subscribable/Subscribable";
|
6
6
|
import { ThreadComposerRuntime, ThreadComposerRuntimeImpl } from "./ComposerRuntime";
|
7
|
-
import { ComposerRuntimeCore } from "../runtimes/core/ComposerRuntimeCore";
|
8
7
|
import { ThreadRuntimePath } from "./RuntimePathTypes";
|
9
8
|
export type CreateAppendMessage = string | {
|
10
9
|
parentId?: string | null | undefined;
|
@@ -19,8 +18,13 @@ export type ThreadRuntimeCoreBinding = SubscribableWithState<ThreadRuntimeCore,
|
|
19
18
|
export type ThreadState = Readonly<{
|
20
19
|
/**
|
21
20
|
* The thread ID.
|
21
|
+
* @deprecated This field is deprecated and will be removed in 0.7.0. Use `metadata.threadId` instead.
|
22
22
|
*/
|
23
23
|
threadId: string;
|
24
|
+
/**
|
25
|
+
* The thread metadata.
|
26
|
+
*/
|
27
|
+
metadata: ThreadMetadata;
|
24
28
|
/**
|
25
29
|
* Whether the thread is disabled. Disabled threads cannot receive new messages.
|
26
30
|
*/
|
@@ -55,10 +59,6 @@ export type ThreadRuntime = Readonly<{
|
|
55
59
|
readonly path: ThreadRuntimePath;
|
56
60
|
readonly composer: ThreadComposerRuntime;
|
57
61
|
getState(): ThreadState;
|
58
|
-
/**
|
59
|
-
* @deprecated This method will be removed in 0.6.0. Submit feedback if you need this functionality.
|
60
|
-
*/
|
61
|
-
unstable_getCore(): ThreadRuntimeCore;
|
62
62
|
append(message: CreateAppendMessage): void;
|
63
63
|
startRun(parentId: string | null): void;
|
64
64
|
subscribe(callback: () => void): Unsubscribe;
|
@@ -73,118 +73,11 @@ export type ThreadRuntime = Readonly<{
|
|
73
73
|
*/
|
74
74
|
stopSpeaking: () => void;
|
75
75
|
unstable_on(event: ThreadRuntimeEventType, callback: () => void): Unsubscribe;
|
76
|
-
/**
|
77
|
-
* @deprecated Use `getState().capabilities` instead. This will be removed in 0.6.0.
|
78
|
-
*/
|
79
|
-
capabilities: Readonly<RuntimeCapabilities>;
|
80
|
-
/**
|
81
|
-
* @deprecated Use `getState().threadId` instead. This will be removed in 0.6.0.
|
82
|
-
*/
|
83
|
-
threadId: string;
|
84
|
-
/**
|
85
|
-
* @deprecated Use `getState().isDisabled` instead. This will be removed in 0.6.0.
|
86
|
-
*/
|
87
|
-
isDisabled: boolean;
|
88
|
-
/**
|
89
|
-
* @deprecated Use `getState().isRunning` instead. This will be removed in 0.6.0.
|
90
|
-
*/
|
91
|
-
isRunning: boolean;
|
92
|
-
/**
|
93
|
-
* @deprecated Use `getState().messages` instead. This will be removed in 0.6.0.
|
94
|
-
*/
|
95
|
-
messages: readonly ThreadMessage[];
|
96
|
-
/**
|
97
|
-
* @deprecated Use `getState().followupSuggestions` instead. This will be removed in 0.6.0.
|
98
|
-
*/
|
99
|
-
suggestions: readonly ThreadSuggestion[];
|
100
|
-
/**
|
101
|
-
* @deprecated Use `getState().speechState` instead. This will be removed in 0.6.0.
|
102
|
-
*/
|
103
|
-
speech: SpeechState | undefined;
|
104
|
-
/**
|
105
|
-
* @deprecated Use `getState().extras` instead. This will be removed in 0.6.0.
|
106
|
-
*/
|
107
|
-
extras: unknown;
|
108
|
-
/**
|
109
|
-
* @deprecated Use `getMesssageById(id).getState().branchNumber` / `getMesssageById(id).getState().branchCount` instead. This will be removed in 0.6.0.
|
110
|
-
*/
|
111
|
-
getBranches: (messageId: string) => readonly string[];
|
112
|
-
/**
|
113
|
-
* @deprecated Use `getMesssageById(id).switchToBranch({ options })` instead. This will be removed in 0.6.0.
|
114
|
-
*/
|
115
|
-
switchToBranch: (branchId: string) => void;
|
116
|
-
/**
|
117
|
-
* @deprecated Use `getMesssageById(id).getContentPartByToolCallId(toolCallId).addToolResult({ result })` instead. This will be removed in 0.6.0.
|
118
|
-
*/
|
119
|
-
addToolResult: (options: AddToolResultOptions) => void;
|
120
|
-
/**
|
121
|
-
* @deprecated Use `getMesssageById(id).speak()` instead. This will be removed in 0.6.0.
|
122
|
-
*/
|
123
|
-
speak: (messageId: string) => void;
|
124
|
-
/**
|
125
|
-
* @deprecated Use `getMesssageById(id).getState().submittedFeedback` instead. This will be removed in 0.6.0.
|
126
|
-
*/
|
127
|
-
getSubmittedFeedback: (messageId: string) => SubmittedFeedback | undefined;
|
128
|
-
/**
|
129
|
-
* @deprecated Use `getMesssageById(id).submitFeedback({ type })` instead. This will be removed in 0.6.0.
|
130
|
-
*/
|
131
|
-
submitFeedback: (feedback: SubmitFeedbackOptions) => void;
|
132
|
-
/**
|
133
|
-
* @deprecated Use `getMesssageById(id).composer` instead. This will be removed in 0.6.0.
|
134
|
-
*/
|
135
|
-
getEditComposer: (messageId: string) => ComposerRuntimeCore | undefined;
|
136
|
-
/**
|
137
|
-
* @deprecated Use `getMesssageById(id).composer.beginEdit()` instead. This will be removed in 0.6.0.
|
138
|
-
*/
|
139
|
-
beginEdit: (messageId: string) => void;
|
140
76
|
}>;
|
141
|
-
export declare class ThreadRuntimeImpl implements
|
77
|
+
export declare class ThreadRuntimeImpl implements ThreadRuntime {
|
142
78
|
get path(): ThreadRuntimePath;
|
143
|
-
/**
|
144
|
-
* @deprecated Use `getState().threadId` instead. This will be removed in 0.6.0.
|
145
|
-
*/
|
146
|
-
get threadId(): string;
|
147
|
-
/**
|
148
|
-
* @deprecated Use `getState().isDisabled` instead. This will be removed in 0.6.0.
|
149
|
-
*/
|
150
|
-
get isDisabled(): boolean;
|
151
|
-
/**
|
152
|
-
* @deprecated Use `getState().isRunning` instead. This will be removed in 0.6.0.
|
153
|
-
*/
|
154
|
-
get isRunning(): boolean;
|
155
|
-
/**
|
156
|
-
* @deprecated Use `getState().capabilities` instead. This will be removed in 0.6.0.
|
157
|
-
*/
|
158
|
-
get capabilities(): Readonly<{
|
159
|
-
switchToBranch: boolean;
|
160
|
-
edit: boolean;
|
161
|
-
reload: boolean;
|
162
|
-
cancel: boolean;
|
163
|
-
unstable_copy: boolean;
|
164
|
-
speech: boolean;
|
165
|
-
attachments: boolean;
|
166
|
-
feedback: boolean;
|
167
|
-
}>;
|
168
|
-
/**
|
169
|
-
* @deprecated Use `getState().extras` instead. This will be removed in 0.6.0.
|
170
|
-
*/
|
171
|
-
get extras(): unknown;
|
172
|
-
/**
|
173
|
-
* @deprecated Use `getState().followupSuggestions` instead. This will be removed in 0.6.0.
|
174
|
-
*/
|
175
|
-
get suggestions(): readonly ThreadSuggestion[];
|
176
|
-
/**
|
177
|
-
* @deprecated Use `getState().messages` instead. This will be removed in 0.6.0.
|
178
|
-
*/
|
179
|
-
get messages(): readonly ThreadMessage[];
|
180
|
-
/**
|
181
|
-
* @deprecated Use `getState().speechState` instead. This will be removed in 0.6.0.
|
182
|
-
*/
|
183
|
-
get speech(): Readonly<{
|
184
|
-
messageId: string;
|
185
|
-
status: import("..").SpeechSynthesisAdapter.Status;
|
186
|
-
}> | undefined;
|
187
79
|
unstable_getCore(): Readonly<{
|
80
|
+
metadata: import("..").ThreadMetadataRuntimeCore;
|
188
81
|
getMessageById: (messageId: string) => {
|
189
82
|
parentId: string | null;
|
190
83
|
message: ThreadMessage;
|
@@ -194,18 +87,17 @@ export declare class ThreadRuntimeImpl implements Omit<ThreadRuntimeCore, "getMe
|
|
194
87
|
append: (message: AppendMessage) => void;
|
195
88
|
startRun: (parentId: string | null) => void;
|
196
89
|
cancelRun: () => void;
|
197
|
-
addToolResult: (options: AddToolResultOptions) => void;
|
90
|
+
addToolResult: (options: import("..").AddToolResultOptions) => void;
|
198
91
|
speak: (messageId: string) => void;
|
199
92
|
stopSpeaking: () => void;
|
200
|
-
getSubmittedFeedback: (messageId: string) => SubmittedFeedback | undefined;
|
201
|
-
submitFeedback: (feedback: SubmitFeedbackOptions) => void;
|
93
|
+
getSubmittedFeedback: (messageId: string) => import("../runtimes/core/ThreadRuntimeCore").SubmittedFeedback | undefined;
|
94
|
+
submitFeedback: (feedback: import("..").SubmitFeedbackOptions) => void;
|
202
95
|
getModelConfig: () => ModelConfig;
|
203
96
|
composer: import("../runtimes/core/ComposerRuntimeCore").ThreadComposerRuntimeCore;
|
204
|
-
getEditComposer: (messageId: string) => ComposerRuntimeCore | undefined;
|
97
|
+
getEditComposer: (messageId: string) => import("../runtimes/core/ComposerRuntimeCore").ComposerRuntimeCore | undefined;
|
205
98
|
beginEdit: (messageId: string) => void;
|
206
99
|
speech: SpeechState | undefined;
|
207
100
|
capabilities: Readonly<RuntimeCapabilities>;
|
208
|
-
threadId: string;
|
209
101
|
isDisabled: boolean;
|
210
102
|
messages: readonly ThreadMessage[];
|
211
103
|
suggestions: readonly ThreadSuggestion[];
|
@@ -221,8 +113,13 @@ export declare class ThreadRuntimeImpl implements Omit<ThreadRuntimeCore, "getMe
|
|
221
113
|
getState(): Readonly<{
|
222
114
|
/**
|
223
115
|
* The thread ID.
|
116
|
+
* @deprecated This field is deprecated and will be removed in 0.7.0. Use `metadata.threadId` instead.
|
224
117
|
*/
|
225
118
|
threadId: string;
|
119
|
+
/**
|
120
|
+
* The thread metadata.
|
121
|
+
*/
|
122
|
+
metadata: ThreadMetadata;
|
226
123
|
/**
|
227
124
|
* Whether the thread is disabled. Disabled threads cannot receive new messages.
|
228
125
|
*/
|
@@ -254,57 +151,13 @@ export declare class ThreadRuntimeImpl implements Omit<ThreadRuntimeCore, "getMe
|
|
254
151
|
}>;
|
255
152
|
append(message: CreateAppendMessage): void;
|
256
153
|
subscribe(callback: () => void): Unsubscribe;
|
257
|
-
/**
|
258
|
-
* @derprecated Use `getMesssageById(id).getState().branchNumber` / `getMesssageById(id).getState().branchCount` instead. This will be removed in 0.6.0.
|
259
|
-
*/
|
260
|
-
getBranches(messageId: string): readonly string[];
|
261
154
|
getModelConfig(): ModelConfig;
|
262
155
|
startRun(parentId: string | null): void;
|
263
156
|
cancelRun(): void;
|
264
|
-
/**
|
265
|
-
* @deprecated Use `getMesssageById(id).getContentPartByToolCallId(toolCallId).addToolResult({ result })` instead. This will be removed in 0.6.0.
|
266
|
-
*/
|
267
|
-
addToolResult(options: AddToolResultOptions): void;
|
268
|
-
/**
|
269
|
-
* @deprecated Use `getMesssageById(id).switchToBranch({ options })` instead. This will be removed in 0.6.0.
|
270
|
-
*/
|
271
|
-
switchToBranch(branchId: string): void;
|
272
|
-
/**
|
273
|
-
* @deprecated Use `getMesssageById(id).speak()` instead. This will be removed in 0.6.0.
|
274
|
-
*/
|
275
|
-
speak(messageId: string): void;
|
276
157
|
stopSpeaking(): void;
|
277
158
|
getSubmittedFeedback(messageId: string): Readonly<{
|
278
159
|
type: "negative" | "positive";
|
279
160
|
}> | undefined;
|
280
|
-
/**
|
281
|
-
* @deprecated Use `getMesssageById(id).submitFeedback({ type })` instead. This will be removed in 0.6.0.
|
282
|
-
*/
|
283
|
-
submitFeedback(options: SubmitFeedbackOptions): void;
|
284
|
-
/**
|
285
|
-
* @deprecated Use `getMesssageById(id).getMessageByIndex(idx).composer` instead. This will be removed in 0.6.0.
|
286
|
-
*/
|
287
|
-
getEditComposer(messageId: string): Readonly<{
|
288
|
-
attachments: readonly import("..").Attachment[];
|
289
|
-
getAttachmentAccept(): string;
|
290
|
-
addAttachment: (file: File) => Promise<void>;
|
291
|
-
removeAttachment: (attachmentId: string) => Promise<void>;
|
292
|
-
isEditing: boolean;
|
293
|
-
canCancel: boolean;
|
294
|
-
isEmpty: boolean;
|
295
|
-
text: string;
|
296
|
-
setText: (value: string) => void;
|
297
|
-
role: import("../types/AssistantTypes").MessageRole;
|
298
|
-
setRole: (role: import("../types/AssistantTypes").MessageRole) => void;
|
299
|
-
reset: () => void;
|
300
|
-
send: () => void;
|
301
|
-
cancel: () => void;
|
302
|
-
subscribe: (callback: () => void) => Unsubscribe;
|
303
|
-
}> | undefined;
|
304
|
-
/**
|
305
|
-
* @deprecated Use `getMesssageById(id).getMessageByIndex(idx).composer.beginEdit()` instead. This will be removed in 0.6.0.
|
306
|
-
*/
|
307
|
-
beginEdit(messageId: string): void;
|
308
161
|
export(): ExportedMessageRepository;
|
309
162
|
import(data: ExportedMessageRepository): void;
|
310
163
|
getMesssageByIndex(idx: number): MessageRuntimeImpl;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ThreadRuntime.d.ts","sourceRoot":"","sources":["../../src/api/ThreadRuntime.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,
|
1
|
+
{"version":3,"file":"ThreadRuntime.d.ts","sourceRoot":"","sources":["../../src/api/ThreadRuntime.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,mBAAmB,EACnB,iBAAiB,EACjB,WAAW,EACX,sBAAsB,EACtB,cAAc,EACf,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,yBAAyB,EAAE,MAAM,qCAAqC,CAAC;AAChF,OAAO,EACL,aAAa,EACb,WAAW,EACX,aAAa,EACb,WAAW,EACZ,MAAM,UAAU,CAAC;AAClB,OAAO,EACL,cAAc,EACd,kBAAkB,EAEnB,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EAEL,qBAAqB,EACtB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACL,qBAAqB,EACrB,yBAAyB,EAC1B,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EAAsB,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAE3E,MAAM,MAAM,mBAAmB,GAC3B,MAAM,GACN;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,CAAC,SAAS,EAAE,MAAM;;;IAItC,MAAM;IAIN,MAAM,CAAC,IAAI,EAAE,yBAAyB;IAItC,kBAAkB,CAAC,GAAG,EAAE,MAAM;IAqB9B,eAAe,CAAC,SAAS,EAAE,MAAM;IAaxC,OAAO,CAAC,kBAAkB;IA2C1B,OAAO,CAAC,iCAAiC,CAGrC;IAEG,WAAW,CAChB,KAAK,EAAE,sBAAsB,EAC7B,QAAQ,EAAE,MAAM,IAAI,GACnB,WAAW;CAef"}
|
@@ -52,7 +52,8 @@ var toAppendMessage = (messages, message) => {
|
|
52
52
|
var getThreadState = (runtime) => {
|
53
53
|
const lastMessage = runtime.messages.at(-1);
|
54
54
|
return Object.freeze({
|
55
|
-
threadId: runtime.threadId,
|
55
|
+
threadId: runtime.metadata.threadId,
|
56
|
+
metadata: runtime.metadata,
|
56
57
|
capabilities: runtime.capabilities,
|
57
58
|
isDisabled: runtime.isDisabled,
|
58
59
|
isRunning: lastMessage?.role !== "assistant" ? false : lastMessage.status.type === "running",
|
@@ -66,54 +67,6 @@ var ThreadRuntimeImpl = class {
|
|
66
67
|
get path() {
|
67
68
|
return this._threadBinding.path;
|
68
69
|
}
|
69
|
-
/**
|
70
|
-
* @deprecated Use `getState().threadId` instead. This will be removed in 0.6.0.
|
71
|
-
*/
|
72
|
-
get threadId() {
|
73
|
-
return this.getState().threadId;
|
74
|
-
}
|
75
|
-
/**
|
76
|
-
* @deprecated Use `getState().isDisabled` instead. This will be removed in 0.6.0.
|
77
|
-
*/
|
78
|
-
get isDisabled() {
|
79
|
-
return this.getState().isDisabled;
|
80
|
-
}
|
81
|
-
/**
|
82
|
-
* @deprecated Use `getState().isRunning` instead. This will be removed in 0.6.0.
|
83
|
-
*/
|
84
|
-
get isRunning() {
|
85
|
-
return this.getState().isRunning;
|
86
|
-
}
|
87
|
-
/**
|
88
|
-
* @deprecated Use `getState().capabilities` instead. This will be removed in 0.6.0.
|
89
|
-
*/
|
90
|
-
get capabilities() {
|
91
|
-
return this.getState().capabilities;
|
92
|
-
}
|
93
|
-
/**
|
94
|
-
* @deprecated Use `getState().extras` instead. This will be removed in 0.6.0.
|
95
|
-
*/
|
96
|
-
get extras() {
|
97
|
-
return this._threadBinding.getState().extras;
|
98
|
-
}
|
99
|
-
/**
|
100
|
-
* @deprecated Use `getState().followupSuggestions` instead. This will be removed in 0.6.0.
|
101
|
-
*/
|
102
|
-
get suggestions() {
|
103
|
-
return this._threadBinding.getState().suggestions;
|
104
|
-
}
|
105
|
-
/**
|
106
|
-
* @deprecated Use `getState().messages` instead. This will be removed in 0.6.0.
|
107
|
-
*/
|
108
|
-
get messages() {
|
109
|
-
return this._threadBinding.getState().messages;
|
110
|
-
}
|
111
|
-
/**
|
112
|
-
* @deprecated Use `getState().speechState` instead. This will be removed in 0.6.0.
|
113
|
-
*/
|
114
|
-
get speech() {
|
115
|
-
return this._threadBinding.getState().speech;
|
116
|
-
}
|
117
70
|
unstable_getCore() {
|
118
71
|
return this._threadBinding.getState();
|
119
72
|
}
|
@@ -155,64 +108,21 @@ var ThreadRuntimeImpl = class {
|
|
155
108
|
subscribe(callback) {
|
156
109
|
return this._threadBinding.subscribe(callback);
|
157
110
|
}
|
158
|
-
/**
|
159
|
-
* @derprecated Use `getMesssageById(id).getState().branchNumber` / `getMesssageById(id).getState().branchCount` instead. This will be removed in 0.6.0.
|
160
|
-
*/
|
161
|
-
getBranches(messageId) {
|
162
|
-
return this._threadBinding.getState().getBranches(messageId);
|
163
|
-
}
|
164
111
|
getModelConfig() {
|
165
112
|
return this._threadBinding.getState().getModelConfig();
|
166
113
|
}
|
167
|
-
// TODO sometimes you want to continue when there is no child message
|
168
114
|
startRun(parentId) {
|
169
115
|
return this._threadBinding.getState().startRun(parentId);
|
170
116
|
}
|
171
117
|
cancelRun() {
|
172
118
|
this._threadBinding.getState().cancelRun();
|
173
119
|
}
|
174
|
-
/**
|
175
|
-
* @deprecated Use `getMesssageById(id).getContentPartByToolCallId(toolCallId).addToolResult({ result })` instead. This will be removed in 0.6.0.
|
176
|
-
*/
|
177
|
-
addToolResult(options) {
|
178
|
-
this._threadBinding.getState().addToolResult(options);
|
179
|
-
}
|
180
|
-
/**
|
181
|
-
* @deprecated Use `getMesssageById(id).switchToBranch({ options })` instead. This will be removed in 0.6.0.
|
182
|
-
*/
|
183
|
-
switchToBranch(branchId) {
|
184
|
-
return this._threadBinding.getState().switchToBranch(branchId);
|
185
|
-
}
|
186
|
-
/**
|
187
|
-
* @deprecated Use `getMesssageById(id).speak()` instead. This will be removed in 0.6.0.
|
188
|
-
*/
|
189
|
-
speak(messageId) {
|
190
|
-
return this._threadBinding.getState().speak(messageId);
|
191
|
-
}
|
192
120
|
stopSpeaking() {
|
193
121
|
return this._threadBinding.getState().stopSpeaking();
|
194
122
|
}
|
195
123
|
getSubmittedFeedback(messageId) {
|
196
124
|
return this._threadBinding.getState().getSubmittedFeedback(messageId);
|
197
125
|
}
|
198
|
-
/**
|
199
|
-
* @deprecated Use `getMesssageById(id).submitFeedback({ type })` instead. This will be removed in 0.6.0.
|
200
|
-
*/
|
201
|
-
submitFeedback(options) {
|
202
|
-
return this._threadBinding.getState().submitFeedback(options);
|
203
|
-
}
|
204
|
-
/**
|
205
|
-
* @deprecated Use `getMesssageById(id).getMessageByIndex(idx).composer` instead. This will be removed in 0.6.0.
|
206
|
-
*/
|
207
|
-
getEditComposer(messageId) {
|
208
|
-
return this._threadBinding.getState().getEditComposer(messageId);
|
209
|
-
}
|
210
|
-
/**
|
211
|
-
* @deprecated Use `getMesssageById(id).getMessageByIndex(idx).composer.beginEdit()` instead. This will be removed in 0.6.0.
|
212
|
-
*/
|
213
|
-
beginEdit(messageId) {
|
214
|
-
return this._threadBinding.getState().beginEdit(messageId);
|
215
|
-
}
|
216
126
|
export() {
|
217
127
|
return this._threadBinding.getState().export();
|
218
128
|
}
|
@@ -261,10 +171,8 @@ var ThreadRuntimeImpl = class {
|
|
261
171
|
const submittedFeedback = thread.getSubmittedFeedback(message.id);
|
262
172
|
return {
|
263
173
|
...message,
|
264
|
-
message,
|
265
174
|
isLast: messages.at(-1)?.id === message.id,
|
266
175
|
parentId,
|
267
|
-
branches,
|
268
176
|
branchNumber: branches.indexOf(message.id) + 1,
|
269
177
|
branchCount: branches.length,
|
270
178
|
speech: speechState?.messageId === message.id ? speechState : void 0,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../src/api/ThreadRuntime.ts"],"sourcesContent":["import {\n AddToolResultOptions,\n ThreadSuggestion,\n RuntimeCapabilities,\n SubmitFeedbackOptions,\n ThreadRuntimeCore,\n SpeechState,\n SubmittedFeedback,\n ThreadRuntimeEventType,\n} from \"../runtimes/core/ThreadRuntimeCore\";\nimport { ExportedMessageRepository } from \"../runtimes/utils/MessageRepository\";\nimport {\n AppendMessage,\n ModelConfig,\n ThreadMessage,\n Unsubscribe,\n} from \"../types\";\nimport {\n MessageRuntime,\n MessageRuntimeImpl,\n MessageState,\n} from \"./MessageRuntime\";\nimport { NestedSubscriptionSubject } from \"./subscribable/NestedSubscriptionSubject\";\nimport { ShallowMemoizeSubject } from \"./subscribable/ShallowMemoizeSubject\";\nimport {\n Subscribable,\n SubscribableWithState,\n} from \"./subscribable/Subscribable\";\nimport {\n ThreadComposerRuntime,\n ThreadComposerRuntimeImpl,\n} from \"./ComposerRuntime\";\nimport { LazyMemoizeSubject } from \"./subscribable/LazyMemoizeSubject\";\nimport { SKIP_UPDATE } from \"./subscribable/SKIP_UPDATE\";\nimport { ComposerRuntimeCore } from \"../runtimes/core/ComposerRuntimeCore\";\nimport { MessageRuntimePath, ThreadRuntimePath } from \"./RuntimePathTypes\";\n\nexport type CreateAppendMessage =\n | string\n | {\n parentId?: string | null | undefined;\n role?: AppendMessage[\"role\"] | undefined;\n content: AppendMessage[\"content\"];\n attachments?: AppendMessage[\"attachments\"] | undefined;\n startRun?: boolean | undefined;\n };\n\nconst toAppendMessage = (\n messages: readonly ThreadMessage[],\n message: CreateAppendMessage,\n): AppendMessage => {\n if (typeof message === \"string\") {\n return {\n parentId: messages.at(-1)?.id ?? null,\n role: \"user\",\n content: [{ type: \"text\", text: message }],\n attachments: [],\n };\n }\n\n if (message.role && message.parentId && message.attachments) {\n return message as AppendMessage;\n }\n\n return {\n ...message,\n parentId: message.parentId ?? messages.at(-1)?.id ?? null,\n role: message.role ?? \"user\",\n attachments: message.attachments ?? [],\n } as AppendMessage;\n};\n\nexport type ThreadRuntimeCoreBinding = SubscribableWithState<\n ThreadRuntimeCore,\n ThreadRuntimePath\n> & {\n outerSubscribe(callback: () => void): Unsubscribe;\n};\n\nexport type ThreadState = Readonly<{\n /**\n * The thread ID.\n */\n threadId: string;\n /**\n * Whether the thread is disabled. Disabled threads cannot receive new messages.\n */\n isDisabled: boolean;\n\n /**\n * Whether the thread is running. A thread is considered running when there is an active stream connection to the backend.\n */\n isRunning: boolean;\n\n /**\n * The capabilities of the thread, such as whether the thread supports editing, branch switching, etc.\n */\n capabilities: RuntimeCapabilities;\n\n /**\n * The messages in the currently selected branch of the thread.\n */\n messages: readonly ThreadMessage[];\n\n /**\n * Follow up message suggestions to show the user.\n */\n suggestions: readonly ThreadSuggestion[];\n\n /**\n * Custom extra information provided by the runtime.\n */\n extras: unknown;\n\n /**\n * @deprecated This API is still under active development and might change without notice.\n */\n speech: SpeechState | undefined;\n}>;\n\nexport const getThreadState = (runtime: ThreadRuntimeCore): ThreadState => {\n const lastMessage = runtime.messages.at(-1);\n return Object.freeze({\n threadId: runtime.threadId,\n capabilities: runtime.capabilities,\n isDisabled: runtime.isDisabled,\n isRunning:\n lastMessage?.role !== \"assistant\"\n ? false\n : lastMessage.status.type === \"running\",\n messages: runtime.messages,\n suggestions: runtime.suggestions,\n extras: runtime.extras,\n speech: runtime.speech,\n });\n};\n\nexport type ThreadRuntime = Readonly<{\n readonly path: ThreadRuntimePath;\n\n readonly composer: ThreadComposerRuntime;\n getState(): ThreadState;\n\n /**\n * @deprecated This method will be removed in 0.6.0. Submit feedback if you need this functionality.\n */\n unstable_getCore(): ThreadRuntimeCore;\n\n append(message: CreateAppendMessage): void;\n startRun(parentId: string | null): void;\n subscribe(callback: () => void): Unsubscribe;\n cancelRun(): void;\n getModelConfig(): ModelConfig;\n export(): ExportedMessageRepository;\n import(repository: ExportedMessageRepository): void;\n getMesssageByIndex(idx: number): MessageRuntime;\n getMesssageById(messageId: string): MessageRuntime;\n\n /**\n * @deprecated This API is still under active development and might change without notice.\n */\n stopSpeaking: () => void;\n\n unstable_on(event: ThreadRuntimeEventType, callback: () => void): Unsubscribe;\n\n // Legacy methods with deprecations\n\n /**\n * @deprecated Use `getState().capabilities` instead. This will be removed in 0.6.0.\n */\n capabilities: Readonly<RuntimeCapabilities>;\n\n /**\n * @deprecated Use `getState().threadId` instead. This will be removed in 0.6.0.\n */\n threadId: string;\n\n /**\n * @deprecated Use `getState().isDisabled` instead. This will be removed in 0.6.0.\n */\n isDisabled: boolean;\n\n /**\n * @deprecated Use `getState().isRunning` instead. This will be removed in 0.6.0.\n */\n isRunning: boolean;\n\n /**\n * @deprecated Use `getState().messages` instead. This will be removed in 0.6.0.\n */\n messages: readonly ThreadMessage[];\n\n /**\n * @deprecated Use `getState().followupSuggestions` instead. This will be removed in 0.6.0.\n */\n suggestions: readonly ThreadSuggestion[];\n\n /**\n * @deprecated Use `getState().speechState` instead. This will be removed in 0.6.0.\n */\n speech: SpeechState | undefined;\n\n /**\n * @deprecated Use `getState().extras` instead. This will be removed in 0.6.0.\n */\n extras: unknown;\n\n /**\n * @deprecated Use `getMesssageById(id).getState().branchNumber` / `getMesssageById(id).getState().branchCount` instead. This will be removed in 0.6.0.\n */\n getBranches: (messageId: string) => readonly string[];\n\n /**\n * @deprecated Use `getMesssageById(id).switchToBranch({ options })` instead. This will be removed in 0.6.0.\n */\n switchToBranch: (branchId: string) => void;\n\n /**\n * @deprecated Use `getMesssageById(id).getContentPartByToolCallId(toolCallId).addToolResult({ result })` instead. This will be removed in 0.6.0.\n */\n addToolResult: (options: AddToolResultOptions) => void;\n\n /**\n * @deprecated Use `getMesssageById(id).speak()` instead. This will be removed in 0.6.0.\n */\n speak: (messageId: string) => void;\n\n /**\n * @deprecated Use `getMesssageById(id).getState().submittedFeedback` instead. This will be removed in 0.6.0.\n */\n getSubmittedFeedback: (messageId: string) => SubmittedFeedback | undefined;\n\n /**\n * @deprecated Use `getMesssageById(id).submitFeedback({ type })` instead. This will be removed in 0.6.0.\n */\n submitFeedback: (feedback: SubmitFeedbackOptions) => void;\n\n /**\n * @deprecated Use `getMesssageById(id).composer` instead. This will be removed in 0.6.0.\n */\n getEditComposer: (messageId: string) => ComposerRuntimeCore | undefined;\n\n /**\n * @deprecated Use `getMesssageById(id).composer.beginEdit()` instead. This will be removed in 0.6.0.\n */\n beginEdit: (messageId: string) => void;\n}>;\n\nexport class ThreadRuntimeImpl\n implements Omit<ThreadRuntimeCore, \"getMessageById\">, ThreadRuntime\n{\n public get path() {\n return this._threadBinding.path;\n }\n\n /**\n * @deprecated Use `getState().threadId` instead. This will be removed in 0.6.0.\n */\n public get threadId() {\n return this.getState().threadId;\n }\n\n /**\n * @deprecated Use `getState().isDisabled` instead. This will be removed in 0.6.0.\n */\n public get isDisabled() {\n return this.getState().isDisabled;\n }\n\n /**\n * @deprecated Use `getState().isRunning` instead. This will be removed in 0.6.0.\n */\n public get isRunning() {\n return this.getState().isRunning;\n }\n\n /**\n * @deprecated Use `getState().capabilities` instead. This will be removed in 0.6.0.\n */\n public get capabilities() {\n return this.getState().capabilities;\n }\n\n /**\n * @deprecated Use `getState().extras` instead. This will be removed in 0.6.0.\n */\n public get extras() {\n return this._threadBinding.getState().extras;\n }\n\n /**\n * @deprecated Use `getState().followupSuggestions` instead. This will be removed in 0.6.0.\n */\n public get suggestions() {\n return this._threadBinding.getState().suggestions;\n }\n\n /**\n * @deprecated Use `getState().messages` instead. This will be removed in 0.6.0.\n */\n public get messages() {\n return this._threadBinding.getState().messages;\n }\n\n /**\n * @deprecated Use `getState().speechState` instead. This will be removed in 0.6.0.\n */\n public get speech() {\n return this._threadBinding.getState().speech;\n }\n\n public unstable_getCore() {\n return this._threadBinding.getState();\n }\n\n private _threadBinding: ThreadRuntimeCoreBinding & {\n getStateState(): ThreadState;\n };\n\n constructor(threadBinding: ThreadRuntimeCoreBinding) {\n const stateBinding = new LazyMemoizeSubject({\n path: threadBinding.path,\n getState: () => getThreadState(threadBinding.getState()),\n subscribe: (callback) => threadBinding.subscribe(callback),\n });\n\n this._threadBinding = {\n path: threadBinding.path,\n getState: () => threadBinding.getState(),\n getStateState: () => stateBinding.getState(),\n outerSubscribe: (callback) => threadBinding.outerSubscribe(callback),\n subscribe: (callback) => threadBinding.subscribe(callback),\n };\n\n this.composer = new ThreadComposerRuntimeImpl(\n new NestedSubscriptionSubject({\n path: {\n ...this.path,\n ref: this.path.ref + `${this.path.ref}.composer`,\n composerSource: \"thread\",\n },\n getState: () => this._threadBinding.getState().composer,\n subscribe: (callback) => this._threadBinding.subscribe(callback),\n }),\n );\n }\n\n public readonly composer;\n\n public getState() {\n return this._threadBinding.getStateState();\n }\n\n public append(message: CreateAppendMessage) {\n this._threadBinding\n .getState()\n .append(\n toAppendMessage(this._threadBinding.getState().messages, message),\n );\n }\n\n public subscribe(callback: () => void) {\n return this._threadBinding.subscribe(callback);\n }\n\n /**\n * @derprecated Use `getMesssageById(id).getState().branchNumber` / `getMesssageById(id).getState().branchCount` instead. This will be removed in 0.6.0.\n */\n public getBranches(messageId: string) {\n return this._threadBinding.getState().getBranches(messageId);\n }\n\n public getModelConfig() {\n return this._threadBinding.getState().getModelConfig();\n }\n\n // TODO sometimes you want to continue when there is no child message\n public startRun(parentId: string | null) {\n return this._threadBinding.getState().startRun(parentId);\n }\n\n public cancelRun() {\n this._threadBinding.getState().cancelRun();\n }\n\n /**\n * @deprecated Use `getMesssageById(id).getContentPartByToolCallId(toolCallId).addToolResult({ result })` instead. This will be removed in 0.6.0.\n */\n public addToolResult(options: AddToolResultOptions) {\n this._threadBinding.getState().addToolResult(options);\n }\n\n /**\n * @deprecated Use `getMesssageById(id).switchToBranch({ options })` instead. This will be removed in 0.6.0.\n */\n public switchToBranch(branchId: string) {\n return this._threadBinding.getState().switchToBranch(branchId);\n }\n\n /**\n * @deprecated Use `getMesssageById(id).speak()` instead. This will be removed in 0.6.0.\n */\n public speak(messageId: string) {\n return this._threadBinding.getState().speak(messageId);\n }\n\n public stopSpeaking() {\n return this._threadBinding.getState().stopSpeaking();\n }\n\n public getSubmittedFeedback(messageId: string) {\n return this._threadBinding.getState().getSubmittedFeedback(messageId);\n }\n\n /**\n * @deprecated Use `getMesssageById(id).submitFeedback({ type })` instead. This will be removed in 0.6.0.\n */\n public submitFeedback(options: SubmitFeedbackOptions) {\n return this._threadBinding.getState().submitFeedback(options);\n }\n\n /**\n * @deprecated Use `getMesssageById(id).getMessageByIndex(idx).composer` instead. This will be removed in 0.6.0.\n */\n public getEditComposer(messageId: string) {\n return this._threadBinding.getState().getEditComposer(messageId);\n }\n\n /**\n * @deprecated Use `getMesssageById(id).getMessageByIndex(idx).composer.beginEdit()` instead. This will be removed in 0.6.0.\n */\n public beginEdit(messageId: string) {\n return this._threadBinding.getState().beginEdit(messageId);\n }\n\n public export() {\n return this._threadBinding.getState().export();\n }\n\n public import(data: ExportedMessageRepository) {\n this._threadBinding.getState().import(data);\n }\n\n public getMesssageByIndex(idx: number) {\n if (idx < 0) throw new Error(\"Message index must be >= 0\");\n\n return this._getMessageRuntime(\n {\n ...this.path,\n ref: this.path.ref + `${this.path.ref}.messages[${idx}]`,\n messageSelector: { type: \"index\", index: idx },\n },\n () => {\n const messages = this._threadBinding.getState().messages;\n const message = messages[idx];\n if (!message) return undefined;\n return {\n message,\n parentId: messages[idx - 1]?.id ?? null,\n };\n },\n );\n }\n\n public getMesssageById(messageId: string) {\n return this._getMessageRuntime(\n {\n ...this.path,\n ref:\n this.path.ref +\n `${this.path.ref}.messages[messageId=${JSON.stringify(messageId)}]`,\n messageSelector: { type: \"messageId\", messageId: messageId },\n },\n () => this._threadBinding.getState().getMessageById(messageId),\n );\n }\n\n private _getMessageRuntime(\n path: MessageRuntimePath,\n callback: () =>\n | { parentId: string | null; message: ThreadMessage }\n | undefined,\n ) {\n return new MessageRuntimeImpl(\n new ShallowMemoizeSubject({\n path,\n getState: () => {\n const { message, parentId } = callback() ?? {};\n\n const { messages, speech: speechState } =\n this._threadBinding.getState();\n\n if (!message || parentId === undefined) return SKIP_UPDATE;\n\n const thread = this._threadBinding.getState();\n\n const branches = thread.getBranches(message.id);\n const submittedFeedback = thread.getSubmittedFeedback(message.id);\n\n return {\n ...message,\n\n message,\n isLast: messages.at(-1)?.id === message.id,\n parentId,\n\n branches,\n branchNumber: branches.indexOf(message.id) + 1,\n branchCount: branches.length,\n\n speech:\n speechState?.messageId === message.id ? speechState : undefined,\n\n submittedFeedback,\n } satisfies MessageState;\n },\n subscribe: (callback) => this._threadBinding.subscribe(callback),\n }),\n this._threadBinding,\n );\n }\n\n private _eventListenerNestedSubscriptions = new Map<\n string,\n NestedSubscriptionSubject<Subscribable, ThreadRuntimePath>\n >();\n\n public unstable_on(\n event: ThreadRuntimeEventType,\n callback: () => void,\n ): Unsubscribe {\n let subject = this._eventListenerNestedSubscriptions.get(event);\n if (!subject) {\n subject = new NestedSubscriptionSubject({\n path: this.path,\n getState: () => ({\n subscribe: (callback) =>\n this._threadBinding.getState().unstable_on(event, callback),\n }),\n subscribe: (callback) => this._threadBinding.outerSubscribe(callback),\n });\n this._eventListenerNestedSubscriptions.set(event, subject);\n }\n return subject.subscribe(callback);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAiBA,4BAIO;AACP,uCAA0C;AAC1C,mCAAsC;AAKtC,6BAGO;AACP,gCAAmC;AACnC,yBAA4B;AAc5B,IAAM,kBAAkB,CACtB,UACA,YACkB;AAClB,MAAI,OAAO,YAAY,UAAU;AAC/B,WAAO;AAAA,MACL,UAAU,SAAS,GAAG,EAAE,GAAG,MAAM;AAAA,M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C,KAAK,eAAe,SAAS;AAE/B,cAAI,CAAC,WAAW,aAAa,OAAW,QAAO;AAE/C,gBAAM,SAAS,KAAK,eAAe,SAAS;AAE5C,gBAAM,WAAW,OAAO,YAAY,QAAQ,EAAE;AAC9C,gBAAM,oBAAoB,OAAO,qBAAqB,QAAQ,EAAE;AAEhE,iBAAO;AAAA,YACL,GAAG;AAAA,YAEH;AAAA,YACA,QAAQ,SAAS,GAAG,EAAE,GAAG,OAAO,QAAQ;AAAA,YACxC;AAAA,YAEA;AAAA,YACA,cAAc,SAAS,QAAQ,QAAQ,EAAE,IAAI;AAAA,YAC7C,aAAa,SAAS;AAAA,YAEtB,QACE,aAAa,cAAc,QAAQ,KAAK,cAAc;AAAA,YAExD;AAAA,UACF;AAAA,QACF;AAAA,QACA,WAAW,CAACA,cAAa,KAAK,eAAe,UAAUA,SAAQ;AAAA,MACjE,CAAC;AAAA,MACD,KAAK;AAAA,IACP;AAAA,EACF;AAAA,EAEQ,oCAAoC,oBAAI,IAG9C;AAAA,EAEK,YACL,OACA,UACa;AACb,QAAI,UAAU,KAAK,kCAAkC,IAAI,KAAK;AAC9D,QAAI,CAAC,SAAS;AACZ,gBAAU,IAAI,2DAA0B;AAAA,QACtC,MAAM,KAAK;AAAA,QACX,UAAU,OAAO;AAAA,UACf,WAAW,CAACA,cACV,KAAK,eAAe,SAAS,EAAE,YAAY,OAAOA,SAAQ;AAAA,QAC9D;AAAA,QACA,WAAW,CAACA,cAAa,KAAK,eAAe,eAAeA,SAAQ;AAAA,MACtE,CAAC;AACD,WAAK,kCAAkC,IAAI,OAAO,OAAO;AAAA,IAC3D;AACA,WAAO,QAAQ,UAAU,QAAQ;AAAA,EACnC;AACF;","names":["callback"]}
|
1
|
+
{"version":3,"sources":["../../src/api/ThreadRuntime.ts"],"sourcesContent":["import {\n ThreadSuggestion,\n RuntimeCapabilities,\n ThreadRuntimeCore,\n SpeechState,\n ThreadRuntimeEventType,\n ThreadMetadata,\n} from \"../runtimes/core/ThreadRuntimeCore\";\nimport { ExportedMessageRepository } from \"../runtimes/utils/MessageRepository\";\nimport {\n AppendMessage,\n ModelConfig,\n ThreadMessage,\n Unsubscribe,\n} from \"../types\";\nimport {\n MessageRuntime,\n MessageRuntimeImpl,\n MessageState,\n} from \"./MessageRuntime\";\nimport { NestedSubscriptionSubject } from \"./subscribable/NestedSubscriptionSubject\";\nimport { ShallowMemoizeSubject } from \"./subscribable/ShallowMemoizeSubject\";\nimport {\n Subscribable,\n SubscribableWithState,\n} from \"./subscribable/Subscribable\";\nimport {\n ThreadComposerRuntime,\n ThreadComposerRuntimeImpl,\n} from \"./ComposerRuntime\";\nimport { LazyMemoizeSubject } from \"./subscribable/LazyMemoizeSubject\";\nimport { SKIP_UPDATE } from \"./subscribable/SKIP_UPDATE\";\nimport { MessageRuntimePath, ThreadRuntimePath } from \"./RuntimePathTypes\";\n\nexport type CreateAppendMessage =\n | string\n | {\n parentId?: string | null | undefined;\n role?: AppendMessage[\"role\"] | undefined;\n content: AppendMessage[\"content\"];\n attachments?: AppendMessage[\"attachments\"] | undefined;\n startRun?: boolean | undefined;\n };\n\nconst toAppendMessage = (\n messages: readonly ThreadMessage[],\n message: CreateAppendMessage,\n): AppendMessage => {\n if (typeof message === \"string\") {\n return {\n parentId: messages.at(-1)?.id ?? null,\n role: \"user\",\n content: [{ type: \"text\", text: message }],\n attachments: [],\n };\n }\n\n if (message.role && message.parentId && message.attachments) {\n return message as AppendMessage;\n }\n\n return {\n ...message,\n parentId: message.parentId ?? messages.at(-1)?.id ?? null,\n role: message.role ?? \"user\",\n attachments: message.attachments ?? [],\n } as AppendMessage;\n};\n\nexport type ThreadRuntimeCoreBinding = SubscribableWithState<\n ThreadRuntimeCore,\n ThreadRuntimePath\n> & {\n outerSubscribe(callback: () => void): Unsubscribe;\n};\n\nexport type ThreadState = Readonly<{\n /**\n * The thread ID.\n * @deprecated This field is deprecated and will be removed in 0.7.0. Use `metadata.threadId` instead. \n */\n threadId: string;\n\n /**\n * The thread metadata.\n */\n metadata: ThreadMetadata;\n\n /**\n * Whether the thread is disabled. Disabled threads cannot receive new messages.\n */\n isDisabled: boolean;\n\n /**\n * Whether the thread is running. A thread is considered running when there is an active stream connection to the backend.\n */\n isRunning: boolean;\n\n /**\n * The capabilities of the thread, such as whether the thread supports editing, branch switching, etc.\n */\n capabilities: RuntimeCapabilities;\n\n /**\n * The messages in the currently selected branch of the thread.\n */\n messages: readonly ThreadMessage[];\n\n /**\n * Follow up message suggestions to show the user.\n */\n suggestions: readonly ThreadSuggestion[];\n\n /**\n * Custom extra information provided by the runtime.\n */\n extras: unknown;\n\n /**\n * @deprecated This API is still under active development and might change without notice.\n */\n speech: SpeechState | undefined;\n}>;\n\nexport const getThreadState = (runtime: ThreadRuntimeCore): ThreadState => {\n const lastMessage = runtime.messages.at(-1);\n return Object.freeze({\n threadId: runtime.metadata.threadId,\n metadata: runtime.metadata,\n capabilities: runtime.capabilities,\n isDisabled: runtime.isDisabled,\n isRunning:\n lastMessage?.role !== \"assistant\"\n ? false\n : lastMessage.status.type === \"running\",\n messages: runtime.messages,\n suggestions: runtime.suggestions,\n extras: runtime.extras,\n speech: runtime.speech,\n });\n};\n\nexport type ThreadRuntime = Readonly<{\n readonly path: ThreadRuntimePath;\n\n readonly composer: ThreadComposerRuntime;\n getState(): ThreadState;\n\n append(message: CreateAppendMessage): void;\n startRun(parentId: string | null): void;\n subscribe(callback: () => void): Unsubscribe;\n cancelRun(): void;\n getModelConfig(): ModelConfig;\n export(): ExportedMessageRepository;\n import(repository: ExportedMessageRepository): void;\n getMesssageByIndex(idx: number): MessageRuntime;\n getMesssageById(messageId: string): MessageRuntime;\n\n /**\n * @deprecated This API is still under active development and might change without notice.\n */\n stopSpeaking: () => void;\n\n unstable_on(event: ThreadRuntimeEventType, callback: () => void): Unsubscribe;\n}>;\n\nexport class ThreadRuntimeImpl implements ThreadRuntime {\n public get path() {\n return this._threadBinding.path;\n }\n\n public unstable_getCore() {\n return this._threadBinding.getState();\n }\n\n private _threadBinding: ThreadRuntimeCoreBinding & {\n getStateState(): ThreadState;\n };\n\n constructor(threadBinding: ThreadRuntimeCoreBinding) {\n const stateBinding = new LazyMemoizeSubject({\n path: threadBinding.path,\n getState: () => getThreadState(threadBinding.getState()),\n subscribe: (callback) => threadBinding.subscribe(callback),\n });\n\n this._threadBinding = {\n path: threadBinding.path,\n getState: () => threadBinding.getState(),\n getStateState: () => stateBinding.getState(),\n outerSubscribe: (callback) => threadBinding.outerSubscribe(callback),\n subscribe: (callback) => threadBinding.subscribe(callback),\n };\n\n this.composer = new ThreadComposerRuntimeImpl(\n new NestedSubscriptionSubject({\n path: {\n ...this.path,\n ref: this.path.ref + `${this.path.ref}.composer`,\n composerSource: \"thread\",\n },\n getState: () => this._threadBinding.getState().composer,\n subscribe: (callback) => this._threadBinding.subscribe(callback),\n }),\n );\n }\n\n public readonly composer;\n\n public getState() {\n return this._threadBinding.getStateState();\n }\n\n public append(message: CreateAppendMessage) {\n this._threadBinding\n .getState()\n .append(\n toAppendMessage(this._threadBinding.getState().messages, message),\n );\n }\n\n public subscribe(callback: () => void) {\n return this._threadBinding.subscribe(callback);\n }\n\n public getModelConfig() {\n return this._threadBinding.getState().getModelConfig();\n }\n\n public startRun(parentId: string | null) {\n return this._threadBinding.getState().startRun(parentId);\n }\n\n public cancelRun() {\n this._threadBinding.getState().cancelRun();\n }\n\n public stopSpeaking() {\n return this._threadBinding.getState().stopSpeaking();\n }\n\n public getSubmittedFeedback(messageId: string) {\n return this._threadBinding.getState().getSubmittedFeedback(messageId);\n }\n\n public export() {\n return this._threadBinding.getState().export();\n }\n\n public import(data: ExportedMessageRepository) {\n this._threadBinding.getState().import(data);\n }\n\n public getMesssageByIndex(idx: number) {\n if (idx < 0) throw new Error(\"Message index must be >= 0\");\n\n return this._getMessageRuntime(\n {\n ...this.path,\n ref: this.path.ref + `${this.path.ref}.messages[${idx}]`,\n messageSelector: { type: \"index\", index: idx },\n },\n () => {\n const messages = this._threadBinding.getState().messages;\n const message = messages[idx];\n if (!message) return undefined;\n return {\n message,\n parentId: messages[idx - 1]?.id ?? null,\n };\n },\n );\n }\n\n public getMesssageById(messageId: string) {\n return this._getMessageRuntime(\n {\n ...this.path,\n ref:\n this.path.ref +\n `${this.path.ref}.messages[messageId=${JSON.stringify(messageId)}]`,\n messageSelector: { type: \"messageId\", messageId: messageId },\n },\n () => this._threadBinding.getState().getMessageById(messageId),\n );\n }\n\n private _getMessageRuntime(\n path: MessageRuntimePath,\n callback: () =>\n | { parentId: string | null; message: ThreadMessage }\n | undefined,\n ) {\n return new MessageRuntimeImpl(\n new ShallowMemoizeSubject({\n path,\n getState: () => {\n const { message, parentId } = callback() ?? {};\n\n const { messages, speech: speechState } =\n this._threadBinding.getState();\n\n if (!message || parentId === undefined) return SKIP_UPDATE;\n\n const thread = this._threadBinding.getState();\n\n const branches = thread.getBranches(message.id);\n const submittedFeedback = thread.getSubmittedFeedback(message.id);\n\n return {\n ...message,\n\n isLast: messages.at(-1)?.id === message.id,\n parentId,\n\n branchNumber: branches.indexOf(message.id) + 1,\n branchCount: branches.length,\n\n speech:\n speechState?.messageId === message.id ? speechState : undefined,\n\n submittedFeedback,\n } satisfies MessageState;\n },\n subscribe: (callback) => this._threadBinding.subscribe(callback),\n }),\n this._threadBinding,\n );\n }\n\n private _eventListenerNestedSubscriptions = new Map<\n string,\n NestedSubscriptionSubject<Subscribable, ThreadRuntimePath>\n >();\n\n public unstable_on(\n event: ThreadRuntimeEventType,\n callback: () => void,\n ): Unsubscribe {\n let subject = this._eventListenerNestedSubscriptions.get(event);\n if (!subject) {\n subject = new NestedSubscriptionSubject({\n path: this.path,\n getState: () => ({\n subscribe: (callback) =>\n this._threadBinding.getState().unstable_on(event, callback),\n }),\n subscribe: (callback) => this._threadBinding.outerSubscribe(callback),\n });\n this._eventListenerNestedSubscriptions.set(event, subject);\n }\n return subject.subscribe(callback);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;A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